1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/cbs_av1: add missing value constrains to point_y_value, point_cb_value and point_cr_value

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 ].

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-02-12 23:40:22 -03:00
parent 223b58c74b
commit 6d37ca8a4e

View File

@ -1156,7 +1156,10 @@ static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw,
fc(4, num_y_points, 0, 14); fc(4, num_y_points, 0, 14);
for (i = 0; i < current->num_y_points; i++) { 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) - (current->num_y_points - i - 1),
1, i);
fbs(8, point_y_scaling[i], 1, i); fbs(8, point_y_scaling[i], 1, i);
} }
@ -1175,12 +1178,18 @@ static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw,
} else { } else {
fc(4, num_cb_points, 0, 10); fc(4, num_cb_points, 0, 10);
for (i = 0; i < current->num_cb_points; i++) { 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) - (current->num_cb_points - i - 1),
1, i);
fbs(8, point_cb_scaling[i], 1, i); fbs(8, point_cb_scaling[i], 1, i);
} }
fc(4, num_cr_points, 0, 10); fc(4, num_cr_points, 0, 10);
for (i = 0; i < current->num_cr_points; i++) { 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) - (current->num_cr_points - i - 1),
1, i);
fbs(8, point_cr_scaling[i], 1, i); fbs(8, point_cr_scaling[i], 1, i);
} }
} }