[FFmpeg-devel] [PATCH] swscale: Take the destination range into account for yuv->rgb->yuv conversions

Martin Storsjö martin at martin.st
Sat Feb 19 23:43:14 EET 2022


On Sat, 19 Feb 2022, Michael Niedermayer wrote:

> On Fri, Feb 18, 2022 at 04:45:46PM +0200, Martin Storsjö wrote:
>> The range parameters need to be set up before calling
>> sws_init_context (which selects which fastpaths can be used;
>> this gets called by sws_getContext); solely passing them via
>> sws_setColorspaceDetails isn't enough.
>>
>> This fixes producing full range YUV range output when doing
>> YUV->YUV conversions between different YUV color spaces.
>>
>> Signed-off-by: Martin Storsjö <martin at martin.st>
>> ---
>>  libswscale/utils.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> Probably ok
>
> please add a fate test for this

Sure. I'm not offhand familiar with what kinds of tests we have for 
swscale right now, and where a test for this would fit in best. (It's 
reproducible by converting from e.g. BT601 to BT709 or vice versa, when 
the output is supposed to be full range.)

// Martin


More information about the ffmpeg-devel mailing list