Commit df5230ef authored by Niklas Haas's avatar Niklas Haas Committed by Ronald S. Bultje

obu: parse uv_mult etc. as signed integers

The spec subtracts the signed offset from all of these when using them,
like it does for e.g. ar_coeffs_y_plus_128, although for some reason
the naming scheme is inconsistent here. Either way, it makes more sense
to treat them as signed integers than unsigned integers.

To avoid confusion since the name of the field is the same as the one in
the spec, we mark the type as int8_t (resp. int16_t for the 9-bit field)
to make it clear to the user that these are already signed integers.
parent 5698bc91
......@@ -403,9 +403,9 @@ typedef struct Av1FilmGrainData {
int8_t ar_coeffs_uv[2][25];
int ar_coeff_shift;
int grain_scale_shift;
int uv_mult[2];
int uv_luma_mult[2];
int uv_offset[2];
int8_t uv_mult[2];
int8_t uv_luma_mult[2];
int16_t uv_offset[2];
int overlap_flag;
int clip_to_restricted_range;
} Av1FilmGrainData;
......
......@@ -1070,9 +1070,9 @@ static int parse_frame_hdr(Dav1dContext *const c, GetBits *const gb) {
fgd->grain_scale_shift = dav1d_get_bits(gb, 2);
for (int pl = 0; pl < 2; pl++)
if (fgd->num_uv_points[pl]) {
fgd->uv_mult[pl] = dav1d_get_bits(gb, 8);
fgd->uv_luma_mult[pl] = dav1d_get_bits(gb, 8);
fgd->uv_offset[pl] = dav1d_get_bits(gb, 9);
fgd->uv_mult[pl] = dav1d_get_bits(gb, 8) - 128;
fgd->uv_luma_mult[pl] = dav1d_get_bits(gb, 8) - 128;
fgd->uv_offset[pl] = dav1d_get_bits(gb, 9) - 256;
}
fgd->overlap_flag = dav1d_get_bits(gb, 1);
fgd->clip_to_restricted_range = dav1d_get_bits(gb, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment