diff mbox series

[FFmpeg-devel,2/8] avfilter/vf_extractplanes: tag alpha plane as full range

Message ID 20231027170446.63684-2-ffmpeg@haasn.xyz
State New
Headers show
Series [FFmpeg-devel,1/8] swscale: fix sws_setColorspaceDetails after sws_init_context | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Niklas Haas Oct. 27, 2023, 5:04 p.m. UTC
From: Niklas Haas <git@haasn.dev>

Alpha planes are explicitly full range, even for limited range YUVA
formats. Mark them as such.
---
 libavfilter/vf_extractplanes.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Vittorio Giovara Oct. 28, 2023, 2:02 a.m. UTC | #1
On Fri, Oct 27, 2023 at 10:05 AM Niklas Haas <ffmpeg@haasn.xyz> wrote:

> From: Niklas Haas <git@haasn.dev>
>
> Alpha planes are explicitly full range, even for limited range YUVA
> formats. Mark them as such.
> ---
>  libavfilter/vf_extractplanes.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavfilter/vf_extractplanes.c
> b/libavfilter/vf_extractplanes.c
> index 7b7149ab24..ca406ff323 100644
> --- a/libavfilter/vf_extractplanes.c
> +++ b/libavfilter/vf_extractplanes.c
> @@ -312,6 +312,8 @@ static int extract_plane(AVFilterLink *outlink,
> AVFrame *frame)
>      if (!out)
>          return AVERROR(ENOMEM);
>      av_frame_copy_props(out, frame);
> +    if (idx == 3 /* alpha */)
> +        out->color_range = AVCOL_RANGE_JPEG;
>

this might be overkill, but do you think the check here should be made more
generic, in case the alpha plane is not in position #3?
diff mbox series

Patch

diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c
index 7b7149ab24..ca406ff323 100644
--- a/libavfilter/vf_extractplanes.c
+++ b/libavfilter/vf_extractplanes.c
@@ -312,6 +312,8 @@  static int extract_plane(AVFilterLink *outlink, AVFrame *frame)
     if (!out)
         return AVERROR(ENOMEM);
     av_frame_copy_props(out, frame);
+    if (idx == 3 /* alpha */)
+        out->color_range = AVCOL_RANGE_JPEG;
 
     if (s->is_packed) {
         extract_from_packed(out->data[0], out->linesize[0],