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

Michael Niedermayer michael at niedermayer.cc
Tue Apr 3 02:30:32 EEST 2018


On Mon, Apr 02, 2018 at 11:52:42AM +0200, Vittorio Giovara wrote:
> On 3/20/18, Michael Niedermayer <michael at niedermayer.cc
> <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>> wrote:
> >* Signed-off-by: Michael Niedermayer <michael at niedermayer.cc <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>>
> *>* ---
> *>*  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,
> *>* --
> *>* 2.16.2
> *
> 
> shouldn't color_range be always set to FULL when outputting RGB? This would
> simplify conversions towards YUV (which assumes UNSPEC == LIMITED) and
> something that other libraries already assume (ie zimg).

ill need to test but if FULL simplifies things, it could be used instead
yes

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- 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/20180403/856cbae6/attachment.sig>


More information about the ffmpeg-devel mailing list