diff mbox series

[FFmpeg-devel] avcodec/cbs_av1: add missing value constrains to point_y_value, point_cb_value and point_cr_value

Message ID 20200213025914.5451-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/cbs_av1: add missing value constrains to point_y_value, point_cb_value and point_cr_value
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

James Almer Feb. 13, 2020, 2:59 a.m. UTC
If i is greater than 0, it is a requirement of bitstream conformance that point_y_value[ i ] is greater than point_y_value[ i - 1 ].
If i is greater than 0, it is a requirement of bitstream conformance that point_cb_value[ i ] is greater than point_cb_value[ i - 1 ].
If i is greater than 0, it is a requirement of bitstream conformance that point_cr_value[ i ] is greater than point_cr_value[ i - 1 ].

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cbs_av1_syntax_template.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
index b62e07fb11..614097bc7e 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1156,7 +1156,8 @@  static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw,
 
     fc(4, num_y_points, 0, 14);
     for (i = 0; i < current->num_y_points; i++) {
-        fbs(8, point_y_value[i],   1, i);
+        fcs(8, point_y_value[i],
+            i ? current->point_y_value[i - 1] + 1 : 0, MAX_UINT_BITS(8), 1, i);
         fbs(8, point_y_scaling[i], 1, i);
     }
 
@@ -1175,12 +1176,14 @@  static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw,
     } else {
         fc(4, num_cb_points, 0, 10);
         for (i = 0; i < current->num_cb_points; i++) {
-            fbs(8, point_cb_value[i],   1, i);
+            fcs(8, point_cb_value[i],
+                i ? current->point_cb_value[i - 1] + 1 : 0, MAX_UINT_BITS(8), 1, i);
             fbs(8, point_cb_scaling[i], 1, i);
         }
         fc(4, num_cr_points, 0, 10);
         for (i = 0; i < current->num_cr_points; i++) {
-            fbs(8, point_cr_value[i],   1, i);
+            fcs(8, point_cr_value[i],
+                i ? current->point_cr_value[i - 1] + 1 : 0, MAX_UINT_BITS(8), 1, i);
             fbs(8, point_cr_scaling[i], 1, i);
         }
     }