[vlc-devel] [PATCH] avcodec: assume a source is full range if not specified and an RGB format

Steve Lhomme robux4 at ycbcr.xyz
Sat Jan 27 13:08:15 CET 2018


Le 26/01/2018 à 18:00, Rémi Denis-Courmont a écrit :
> Le perjantaina 26. tammikuuta 2018, 11.47.24 EET Steve Lhomme a écrit :
>> There's a good chance that codec decoding to RGB are capture formats from
>> computers using full range display.
>>
>> Ref #19127
>> ---
>>   modules/codec/avcodec/video.c | 13 ++++++++++++-
>>   1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
>> index 6d2cf4458a..fac33d663b 100644
>> --- a/modules/codec/avcodec/video.c
>> +++ b/modules/codec/avcodec/video.c
>> @@ -205,8 +205,19 @@ static int lavc_GetVideoFormat(decoder_t *dec,
>> video_format_t *restrict fmt, * __MAX(ctx->ticks_per_frame, 1); }
>>
>> -    if( ctx->color_range == AVCOL_RANGE_JPEG )
>> +    switch ( ctx->color_range )
>> +    {
>> +    case AVCOL_RANGE_JPEG:
>>           fmt->b_color_range_full = true;
>> +        break;
>> +    case AVCOL_RANGE_UNSPECIFIED:
>> +        fmt->b_color_range_full = !vlc_fourcc_IsYUV( fmt->i_chroma );
>> +        break;
>> +    case AVCOL_RANGE_MPEG:
>> +    default:
>> +        fmt->b_color_range_full = false;
>> +        break;
>> +    }
>>
>>       switch( ctx->colorspace )
>>       {
> How is that a property of libavcodec?
It's not, but unless we use a value with an undefined by default, it has 
to be set there.

I don't think a change to a integer/enum is OK for 3.0 so I'd rather do 
it that way.


More information about the vlc-devel mailing list