Skip to content

Commit

Permalink
lavc/vvc: Fix scaling matrix DC coef derivation
Browse files Browse the repository at this point in the history
In 7.4.3.20 of H.266 (V3), there are two similarly-named variables:
scalingMatrixDcPred and ScalingMatrixDcRec.  The old code set
ScalingMatrixDcRec, rather than scalingMatrixDcPred, in the first two
branches of the conditions on scaling_list_copy_mode_flag[id] and
aps->scaling_list_pred_mode_flag[id].  This could lead to decode
mismatches in sequences with explicitly-signalled scaling lists.

Signed-off-by: Frank Plowman <post@frankplowman.com>
  • Loading branch information
frankplow authored and nuomi2021 committed Dec 10, 2024
1 parent 47b1e1b commit 8629306
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libavcodec/vvc/ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1113,17 +1113,17 @@ static void scaling_derive(VVCScalingList *sl, const H266RawAPS *aps)
//dc
if (id >= SL_START_16x16) {
if (!aps->scaling_list_copy_mode_flag[id] && !aps->scaling_list_pred_mode_flag[id]) {
sl->scaling_matrix_dc_rec[id - SL_START_16x16] = 8;
dc += 8;
} else if (!aps->scaling_list_pred_id_delta[id]) {
sl->scaling_matrix_dc_rec[id - SL_START_16x16] = 16;
dc += 16;
} else {
const int ref_id = id - aps->scaling_list_pred_id_delta[id];
if (ref_id >= SL_START_16x16)
dc += sl->scaling_matrix_dc_rec[ref_id - SL_START_16x16];
else
dc += sl->scaling_matrix_rec[ref_id][0];
sl->scaling_matrix_dc_rec[id - SL_START_16x16] = dc & 255;
}
sl->scaling_matrix_dc_rec[id - SL_START_16x16] = dc & 255;
}

//ac
Expand Down

0 comments on commit 8629306

Please sign in to comment.