aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-03-21 15:37:26 -0300
committerJames Almer <jamrial@gmail.com>2019-03-25 19:59:28 -0300
commit6972b353b4e00f784b9e70939e4d37dc61295e28 (patch)
tree63f0969b45a0edaefbedfea15660611aa41a22bc
parentabf36b76de63b4cdf07e0f8360422ff4758f7f70 (diff)
downloadffmpeg-6972b353b4e00f784b9e70939e4d37dc61295e28.tar.gz
avcodec/cbs_av1: fix range of values for Mastering Display Color Volume Metadata OBUs
Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 40490b3a63368bdc2403bf7415b214e6dc0a9a3a)
-rw-r--r--libavcodec/cbs_av1_syntax_template.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
index 48f4fab514..76eb90b279 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1637,15 +1637,18 @@ static int FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
int err, i;
for (i = 0; i < 3; i++) {
- fcs(16, primary_chromaticity_x[i], 0, 50000, 1, i);
- fcs(16, primary_chromaticity_y[i], 0, 50000, 1, i);
+ fbs(16, primary_chromaticity_x[i], 1, i);
+ fbs(16, primary_chromaticity_y[i], 1, i);
}
- fc(16, white_point_chromaticity_x, 0, 50000);
- fc(16, white_point_chromaticity_y, 0, 50000);
+ fb(16, white_point_chromaticity_x);
+ fb(16, white_point_chromaticity_y);
fc(32, luminance_max, 1, MAX_UINT_BITS(32));
- fc(32, luminance_min, 0, current->luminance_max >> 6);
+ // 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)));
return 0;
}