Commit 2f5cd424a4 for ffmpeg

commit 2f5cd424a4e6f7fb743aa23507ad22e4fac0bffc
Author: Wu Jianhua <toqsxw@outlook.com>
Date:   Tue Apr 15 04:47:49 2025 +0800

    avcodec/vvc/inter: multiply the memory size of temporary buffer by 2 for high bitdepth

    Signed-off-by: Wu Jianhua <toqsxw@outlook.com>

diff --git a/libavcodec/vvc/inter.c b/libavcodec/vvc/inter.c
index 670625f5e4..228e170720 100644
--- a/libavcodec/vvc/inter.c
+++ b/libavcodec/vvc/inter.c
@@ -30,6 +30,8 @@
 #define PROF_TEMP_OFFSET (MAX_PB_SIZE + 32)
 static const int bcw_w_lut[] = {4, 5, 3, 10, -2};

+#define HIGHBD_MULTIPLIER(bd) (((bd) + 2) >> 3)
+
 static void subpic_get_rect(VVCRect *r, const VVCFrame *src_frame, const int subpic_idx, const int is_chroma)
 {
     const VVCSPS *sps = src_frame->sps;
@@ -322,8 +324,9 @@ static void mc_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride,
     const int hs              = fc->ps.sps->hshift[c_idx];
     const int vs              = fc->ps.sps->vshift[c_idx];
     const int idx             = av_log2(block_w) - 1;
+    const int mult            = HIGHBD_MULTIPLIER(fc->ps.sps->bit_depth);
     const VVCFrame *refs[]    = { ref0, ref1 };
-    int16_t *tmp[]            = { lc->pred.tmp + sb_bdof_flag * PROF_TEMP_OFFSET, lc->pred.tmp1 + sb_bdof_flag * PROF_TEMP_OFFSET };
+    int16_t *tmp[]            = { lc->pred.tmp + sb_bdof_flag * PROF_TEMP_OFFSET * mult, lc->pred.tmp1 + sb_bdof_flag * PROF_TEMP_OFFSET * mult };
     const int is_chroma       = !!c_idx;
     const int hpel_if_idx     = is_chroma ? 0 : pu->mi.hpel_if_idx;

@@ -494,7 +497,7 @@ static void luma_prof_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst
     const VVCFrameContext *fc = lc->fc;
     const uint8_t *src        = ref->frame->data[LUMA];
     ptrdiff_t src_stride      = ref->frame->linesize[LUMA];
-    uint16_t *prof_tmp        = lc->pred.tmp + PROF_TEMP_OFFSET;
+    int16_t *prof_tmp         = lc->pred.tmp + PROF_TEMP_OFFSET * HIGHBD_MULTIPLIER(fc->ps.sps->bit_depth);
     const int idx             = av_log2(block_w) - 1;
     const int lx              = mvf->pred_flag - PF_L0;
     const Mv *mv              = mvf->mv + lx;
@@ -537,7 +540,7 @@ static void luma_prof(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref,
     const int oy              = y_off + (mv->y >> 4);
     const int idx             = av_log2(block_w) - 1;
     const int is_chroma       = 0;
-    int16_t *prof_tmp         = lc->pred.prof_tmp + PROF_TEMP_OFFSET;
+    int16_t *prof_tmp         = lc->pred.prof_tmp + PROF_TEMP_OFFSET * HIGHBD_MULTIPLIER(fc->ps.sps->bit_depth);
     ptrdiff_t src_stride      = ref->frame->linesize[LUMA];
     const uint8_t *src        = ref->frame->data[LUMA];
     const int8_t *hf          = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][mx];