[FFmpeg-devel] [PATCH] cbs_av1: Copy loop filter and segment parameters of repeat frame from its mapped frame

Dai, Jianhui J jianhui.j.dai at intel.com
Tue Sep 3 04:20:14 EEST 2024



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> fei.w.wang-at-intel.com at ffmpeg.org
> Sent: Wednesday, August 28, 2024 8:02 PM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Wang, Fei W <fei.w.wang at intel.com>
> Subject: [FFmpeg-devel] [PATCH] cbs_av1: Copy loop filter and segment
> parameters of repeat frame from its mapped frame
> 
> From: Fei Wang <fei.w.wang at intel.com>
> 
> Implement load/save loop filter and segment parameters defined in section
> 7.20 and 7.21 in spec for show_existing_frame frames.
> 
> Fixes ticket #11151.
> 
> Signed-off-by: Fei Wang <fei.w.wang at intel.com>
> ---
>  libavcodec/cbs_av1.h                 |  5 ++++
>  libavcodec/cbs_av1_syntax_template.c | 36 +++++++++++++++++++++-------
>  2 files changed, 33 insertions(+), 8 deletions(-)
> 
> diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h index
> a027013bc7..8586f2bf4a 100644
> --- a/libavcodec/cbs_av1.h
> +++ b/libavcodec/cbs_av1.h
> @@ -477,6 +477,11 @@ typedef struct CodedBitstreamAV1Context {
>      // Writing will fail with an error if an OBU larger than can be
>      // represented by the fixed size is encountered.
>      int fixed_obu_size_length;
> +
> +    int8_t  loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME];
> +    int8_t  loop_filter_mode_deltas[2];
> +    uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
> +    int16_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
>  } CodedBitstreamAV1Context;
> 
> 
> diff --git a/libavcodec/cbs_av1_syntax_template.c
> b/libavcodec/cbs_av1_syntax_template.c
> index 3f4b13a177..a4a912482c 100644
> --- a/libavcodec/cbs_av1_syntax_template.c
> +++ b/libavcodec/cbs_av1_syntax_template.c
> @@ -1374,6 +1374,15 @@ static int
> FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
>                  priv->render_height   = ref->render_height;
>                  priv->bit_depth       = ref->bit_depth;
>                  priv->order_hint      = ref->order_hint;
> +
> +                memcpy(priv->loop_filter_ref_deltas, ref->loop_filter_ref_deltas,
> +                       sizeof(ref->loop_filter_ref_deltas));
> +                memcpy(priv->loop_filter_mode_deltas, ref-
> >loop_filter_mode_deltas,
> +                       sizeof(ref->loop_filter_mode_deltas));
> +                memcpy(priv->feature_enabled, ref->feature_enabled,
> +                       sizeof(ref->feature_enabled));
> +                memcpy(priv->feature_value, ref->feature_value,
> +                       sizeof(ref->feature_value));
>              } else
>                  infer(refresh_frame_flags, 0);
> 
> @@ -1691,14 +1700,25 @@ update_refs:
>                      priv->order_hints[j + AV1_REF_FRAME_LAST];
>              }
> 
> -            memcpy(priv->ref[i].loop_filter_ref_deltas, current-
> >loop_filter_ref_deltas,
> -                   sizeof(current->loop_filter_ref_deltas));
> -            memcpy(priv->ref[i].loop_filter_mode_deltas, current-
> >loop_filter_mode_deltas,
> -                   sizeof(current->loop_filter_mode_deltas));
> -            memcpy(priv->ref[i].feature_enabled, current->feature_enabled,
> -                   sizeof(current->feature_enabled));
> -            memcpy(priv->ref[i].feature_value, current->feature_value,
> -                   sizeof(current->feature_value));
> +            if (current->show_existing_frame) {
> +                memcpy(priv->ref[i].loop_filter_ref_deltas, priv-
> >loop_filter_ref_deltas,
> +                       sizeof(priv->loop_filter_ref_deltas));
> +                memcpy(priv->ref[i].loop_filter_mode_deltas, priv-
> >loop_filter_mode_deltas,
> +                       sizeof(priv->loop_filter_mode_deltas));
> +                memcpy(priv->ref[i].feature_enabled, priv->feature_enabled,
> +                       sizeof(priv->feature_enabled));
> +                memcpy(priv->ref[i].feature_value, priv->feature_value,
> +                       sizeof(priv->feature_value));
> +            } else {
> +                memcpy(priv->ref[i].loop_filter_ref_deltas, current-
> >loop_filter_ref_deltas,
> +                       sizeof(current->loop_filter_ref_deltas));
> +                memcpy(priv->ref[i].loop_filter_mode_deltas, current-
> >loop_filter_mode_deltas,
> +                       sizeof(current->loop_filter_mode_deltas));
> +                memcpy(priv->ref[i].feature_enabled, current->feature_enabled,
> +                       sizeof(current->feature_enabled));
> +                memcpy(priv->ref[i].feature_value, current->feature_value,
> +                       sizeof(current->feature_value));
> +            }
>          }
>      }
> 

Good fixing. Could you please apply?

> --
> 2.34.1
> 
> _______________________________________________
> 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