[FFmpeg-devel] [PATCH 4/6] lavc/vvc: Fix scaling matrix DC coef derivation

Nuo Mi nuomi2021 at gmail.com
Sat Nov 30 08:39:14 EET 2024


Hi Frank,
Thank you for the patch set; I will apply it except for this one

On Fri, Nov 29, 2024 at 6:19 AM Frank Plowman <post at frankplowman.com> wrote:

> 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.
>
dc is scaling_list_dc_coef, and scalingMatrixDcPred is 8, 16,
scaling_matrix_dc_rec, or scaling_matrix_rec.
Then we use (dc + scalingMatrixDcPred) & 255 to get ScalingMatrixDcRec
The original logic looks correct to me. Did I miss something? Could you
send me the clip?

>
> Signed-off-by: Frank Plowman <post at frankplowman.com>
> ---
>  libavcodec/vvc/ps.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c
> index f32f1cc5a1..9bd2d01776 100644
> --- a/libavcodec/vvc/ps.c
> +++ b/libavcodec/vvc/ps.c
> @@ -1107,17 +1107,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];
>
This should be  sl->scaling_matrix_rec[0][0];
Is the issue related to this?

-                sl->scaling_matrix_dc_rec[id - SL_START_16x16] = dc & 255;
>              }
> +            sl->scaling_matrix_dc_rec[id - SL_START_16x16] = dc & 255;
>          }
>
>          //ac
> --
> 2.47.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list