[FFmpeg-devel] [PATCH] libavfilter: vf_scale: Properly take in->color_range into account

Michael Niedermayer michael at niedermayer.cc
Fri Mar 4 22:09:00 EET 2022


On Thu, Mar 03, 2022 at 02:06:45PM +0200, Martin Storsjö wrote:
> While swscale can be reconfigured with sws_setColorspaceDetails,
> the in/out ranges also need to be set before calling
> sws_init_context, otherwise the initialization might choose
> fastpaths that don't take the ranges into account.
> 
> Therefore, look at in->color_range too, when deciding on whether
> the scaler needs to be reconfigured.
> 
> Add a new member variable for keeping track of this, for being
> able to differentiate between whether the scale filter parameter
> "in_range" has been set (which should override whatever the input
> frame has set) or whether it has been configured based on the
> latest frame (which should trigger reconfiguring the scaler if
> the input frame ranges change).
> 
> Signed-off-by: Martin Storsjö <martin at martin.st>
> ---
> To test this (without risking running many conflicting swscale
> filters in one filter pipeline), we'd need to be able to tag
> the incoming raw yuv data with colorspace and range without setting
> the in_color_matrix and in_range options on the scale filter.
> 
> When using the rawvideo demuxer, the pixel format is set via the
> ffmpeg -pix_fmt option, but there's no corresponding option for
> setting color matrix or range for it.
> ---
>  libavfilter/vf_scale.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

This changes the output for:
ffmpeg -i tickets/524/AVCI50.mov   -vframes 3 file-avci50dec.nut
ffmpeg -i tickets/4493/AVCI100.mov -vframes 3 file-avci100dec.nut

https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket524/

Is that intended ?

- 233903 file-avci100dec.nut
- 383853 file-avci50dec.nut
+ 196558 file-avci100dec.nut
+ 333893 file-avci50dec.nut

thx

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

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220304/f60d5ad2/attachment.sig>


More information about the ffmpeg-devel mailing list