diff mbox series

[FFmpeg-devel,3/2] cbs_av1: Remove constraint on MDCV luminance values

Message ID f54abbae-e832-6030-7ba4-5abcddf357e7@jkqxz.net
State New
Headers show
Series [FFmpeg-devel,1/2] cbs_av1: Add tracing headers for metadata types | expand

Commit Message

Mark Thompson Jan. 18, 2023, 8:35 p.m. UTC
While desiring min to be less than max feels entirely sensible,
unfortunately the standard does not actually have this requirement.
---
Some of the Argon coverage streams test this.

  libavcodec/cbs_av1_syntax_template.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)

Comments

James Almer Jan. 18, 2023, 8:38 p.m. UTC | #1
On 1/18/2023 5:35 PM, Mark Thompson wrote:
> While desiring min to be less than max feels entirely sensible,
> unfortunately the standard does not actually have this requirement.

Huh, it really doesn't.

> ---
> Some of the Argon coverage streams test this.
> 
>   libavcodec/cbs_av1_syntax_template.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/cbs_av1_syntax_template.c 
> b/libavcodec/cbs_av1_syntax_template.c
> index 3cab02bdd9..dc6724cb59 100644
> --- a/libavcodec/cbs_av1_syntax_template.c
> +++ b/libavcodec/cbs_av1_syntax_template.c
> @@ -1866,11 +1866,8 @@ static int 
> FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
>       fb(16, white_point_chromaticity_x);
>       fb(16, white_point_chromaticity_y);
> 
> -    fc(32, luminance_max, 1, MAX_UINT_BITS(32));
> -    // luminance_min must be lower than luminance_max. Convert 
> luminance_max from
> -    // 24.8 fixed point to 18.14 fixed point in order to compare them.
> -    fc(32, luminance_min, 0, FFMIN(((uint64_t)current->luminance_max << 
> 6) - 1,
> -                                   MAX_UINT_BITS(32)));
> +    fb(32, luminance_max);
> +    fb(32, luminance_min);
> 
>       return 0;
>   }

LGTM.
Mark Thompson Jan. 24, 2023, 10:29 p.m. UTC | #2
On 18/01/2023 20:38, James Almer wrote:
> On 1/18/2023 5:35 PM, Mark Thompson wrote:
>> While desiring min to be less than max feels entirely sensible,
>> unfortunately the standard does not actually have this requirement.
> 
> Huh, it really doesn't.
> 
>> ---
>> Some of the Argon coverage streams test this.
>>
>>   libavcodec/cbs_av1_syntax_template.c | 7 ++-----
>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
>> index 3cab02bdd9..dc6724cb59 100644
>> --- a/libavcodec/cbs_av1_syntax_template.c
>> +++ b/libavcodec/cbs_av1_syntax_template.c
>> @@ -1866,11 +1866,8 @@ static int FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
>>       fb(16, white_point_chromaticity_x);
>>       fb(16, white_point_chromaticity_y);
>>
>> -    fc(32, luminance_max, 1, MAX_UINT_BITS(32));
>> -    // luminance_min must be lower than luminance_max. Convert luminance_max from
>> -    // 24.8 fixed point to 18.14 fixed point in order to compare them.
>> -    fc(32, luminance_min, 0, FFMIN(((uint64_t)current->luminance_max << 6) - 1,
>> -                                   MAX_UINT_BITS(32)));
>> +    fb(32, luminance_max);
>> +    fb(32, luminance_min);
>>
>>       return 0;
>>   }
> 
> LGTM.

Applied.

Thanks,

- Mark
diff mbox series

Patch

diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
index 3cab02bdd9..dc6724cb59 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1866,11 +1866,8 @@  static int FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
      fb(16, white_point_chromaticity_x);
      fb(16, white_point_chromaticity_y);

-    fc(32, luminance_max, 1, MAX_UINT_BITS(32));
-    // luminance_min must be lower than luminance_max. Convert luminance_max from
-    // 24.8 fixed point to 18.14 fixed point in order to compare them.
-    fc(32, luminance_min, 0, FFMIN(((uint64_t)current->luminance_max << 6) - 1,
-                                   MAX_UINT_BITS(32)));
+    fb(32, luminance_max);
+    fb(32, luminance_min);

      return 0;
  }