[FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

Michael Niedermayer michael at niedermayer.cc
Mon Mar 26 02:55:19 EEST 2018


On Wed, Mar 21, 2018 at 03:04:35PM +0100, wm4 wrote:
> On Tue, 20 Mar 2018 23:59:46 +0100
> Michael Niedermayer <michael at niedermayer.cc> wrote:
> 
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavfilter/vf_scale.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > index 9f45032e85..2f6fa4791d 100644
> > --- a/libavfilter/vf_scale.c
> > +++ b/libavfilter/vf_scale.c
> > @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
> >      AVFilterLink *outlink = link->dst->outputs[0];
> >      AVFrame *out;
> >      const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
> > +    const AVPixFmtDescriptor *out_desc = av_pix_fmt_desc_get(outlink->format);
> >      char buf[32];
> >      int in_range;
> >  
> > @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
> >                                       table, out_full,
> >                                       brightness, contrast, saturation);
> >  
> > -        out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
> > +        // color_range describes YUV, it is undefined for RGB
> > +        if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) && out_desc->nb_components != 1) {
> > +            out->color_range = AVCOL_RANGE_UNSPECIFIED;
> > +        } else
> > +            out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
> >      }
> >  
> >      av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den,
> 
> Why is it not setting full range for gray? PNGs can use this for
> grayscale images, so they would be affected by this too.

I do not understand what you describe here. Please describe the issue
clearer and or provide a testcase.

there is no unique gray pixel format.
gray8 is not a AV_PIX_FMT_FLAG_RGB format, thus its treated the same as
before this patch



[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180326/17b7a91c/attachment.sig>


More information about the ffmpeg-devel mailing list