diff mbox series

[FFmpeg-devel] hevcdec: Correctly signal AVCOL_RANGE_UNSPECIFIED if nothing was set in the bitstream

Message ID 20220217125439.40288-1-martin@martin.st
State New
Headers show
Series [FFmpeg-devel] hevcdec: Correctly signal AVCOL_RANGE_UNSPECIFIED if nothing was set in the bitstream | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Martin Storsjö Feb. 17, 2022, 12:54 p.m. UTC
This matches what the H264 decoder signals for such a case.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavcodec/hevcdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hendrik Leppkes Feb. 17, 2022, 12:58 p.m. UTC | #1
On Thu, Feb 17, 2022 at 1:54 PM Martin Storsjö <martin@martin.st> wrote:
>
> This matches what the H264 decoder signals for such a case.
>
> Signed-off-by: Martin Storsjö <martin@martin.st>
> ---
>  libavcodec/hevcdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index 8d7a4f7147..01d459984f 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -338,7 +338,7 @@ static void export_stream_params(HEVCContext *s, const HEVCSPS *sps)
>          avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG
>                                                              : AVCOL_RANGE_MPEG;
>      else
> -        avctx->color_range = AVCOL_RANGE_MPEG;
> +        avctx->color_range = AVCOL_RANGE_UNSPECIFIED;
>

The HEVC specification is pretty clear that when its not signalled, it
should be inferred as 0 (eg. mpeg)

> When the video_full_range_flag syntax element is not present, the value of video_full_range_flag is inferred to be equal to 0

- Hendrik
Martin Storsjö Feb. 17, 2022, 1:06 p.m. UTC | #2
On Thu, 17 Feb 2022, Hendrik Leppkes wrote:

> On Thu, Feb 17, 2022 at 1:54 PM Martin Storsjö <martin@martin.st> wrote:
>>
>> This matches what the H264 decoder signals for such a case.
>>
>> Signed-off-by: Martin Storsjö <martin@martin.st>
>> ---
>>  libavcodec/hevcdec.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
>> index 8d7a4f7147..01d459984f 100644
>> --- a/libavcodec/hevcdec.c
>> +++ b/libavcodec/hevcdec.c
>> @@ -338,7 +338,7 @@ static void export_stream_params(HEVCContext *s, const HEVCSPS *sps)
>>          avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG
>>                                                              : AVCOL_RANGE_MPEG;
>>      else
>> -        avctx->color_range = AVCOL_RANGE_MPEG;
>> +        avctx->color_range = AVCOL_RANGE_UNSPECIFIED;
>>
>
> The HEVC specification is pretty clear that when its not signalled, it
> should be inferred as 0 (eg. mpeg)
>
>> When the video_full_range_flag syntax element is not present, the value of video_full_range_flag is inferred to be equal to 0

Hmm, I see. Ok, thanks - patch dropped then.

// Martin
diff mbox series

Patch

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 8d7a4f7147..01d459984f 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -338,7 +338,7 @@  static void export_stream_params(HEVCContext *s, const HEVCSPS *sps)
         avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG
                                                             : AVCOL_RANGE_MPEG;
     else
-        avctx->color_range = AVCOL_RANGE_MPEG;
+        avctx->color_range = AVCOL_RANGE_UNSPECIFIED;
 
     if (sps->vui.colour_description_present_flag) {
         avctx->color_primaries = sps->vui.colour_primaries;