[FFmpeg-devel] [PATCH 2/4] avcodec/vvcdec: misc, move pcmf from min_tu_tl_init to min_cb_nz_tl_init

Nuo Mi nuomi2021 at gmail.com
Fri Oct 4 17:31:13 EEST 2024


pcmf are cu level flags
---
 libavcodec/vvc/ctu.c    | 8 +++++---
 libavcodec/vvc/dec.c    | 4 +---
 libavcodec/vvc/filter.c | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index b33ad576cf..8210ab520f 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -1240,16 +1240,18 @@ static void set_cu_tabs(const VVCLocalContext *lc, const CodingUnit *cu)
 
     set_cb_tab(lc, fc->tab.mmi, pu->mi.motion_model_idc);
     set_cb_tab(lc, fc->tab.msf, pu->merge_subblock_flag);
-    if (cu->tree_type != DUAL_TREE_CHROMA)
+    if (cu->tree_type != DUAL_TREE_CHROMA) {
         set_cb_tab(lc, fc->tab.skip, cu->skip_flag);
+        set_cb_tab(lc, fc->tab.pcmf[LUMA], cu->bdpcm_flag[LUMA]);
+    }
+    if (cu->tree_type != DUAL_TREE_LUMA)
+        set_cb_tab(lc, fc->tab.pcmf[CHROMA], cu->bdpcm_flag[CHROMA]);
 
     while (tu) {
           for (int j = 0; j < tu->nb_tbs; j++) {
             const TransformBlock *tb = tu->tbs + j;
             if (tb->c_idx != LUMA)
                 set_qp_c_tab(lc, tu, tb);
-            if (tb->c_idx != CR && cu->bdpcm_flag[tb->c_idx])
-                set_tb_tab(fc->tab.pcmf[tb->c_idx], 1, fc, tb);
         }
         tu = tu->next;
     }
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index edf2607f50..13ca752eec 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -150,6 +150,7 @@ static void min_cb_nz_tl_init(TabList *l, VVCFrameContext *fc)
         TL_ADD(cb_height[i], pic_size_in_min_cb);
         TL_ADD(cp_mv[i],     pic_size_in_min_cb * MAX_CONTROL_POINTS);
         TL_ADD(cpm[i],       pic_size_in_min_cb);
+        TL_ADD(pcmf[i],      pic_size_in_min_cb);
     }
     // For luma, qp can only change at the CU level, so the qp tab size is related to the CU.
     TL_ADD(qp[LUMA], pic_size_in_min_cb);
@@ -189,9 +190,6 @@ static void min_tu_tl_init(TabList *l, VVCFrameContext *fc)
 
     TL_ADD(tu_joint_cbcr_residual_flag, pic_size_in_min_tu);
 
-    for (int i = LUMA; i <= CHROMA; i++)
-        TL_ADD(pcmf[i], pic_size_in_min_tu);
-
     for (int i = 0; i < VVC_MAX_SAMPLE_ARRAYS; i++) {
         TL_ADD(tu_coded_flag[i], pic_size_in_min_tu);
 
diff --git a/libavcodec/vvc/filter.c b/libavcodec/vvc/filter.c
index 707fc24203..9a45a735e0 100644
--- a/libavcodec/vvc/filter.c
+++ b/libavcodec/vvc/filter.c
@@ -543,9 +543,9 @@ static av_always_inline int deblock_bs(const VVCLocalContext *lc,
     const uint8_t chroma       = !!c_idx;
     const int tu_p             = (y_p >> log2_min_tu_size) * min_tu_width  + (x_p >>  log2_min_tu_size);
     const int tu_q             = (y_q >> log2_min_tu_size) * min_tu_width  + (x_q >>  log2_min_tu_size);
-    const uint8_t pcmf         = fc->tab.pcmf[chroma][tu_p] && fc->tab.pcmf[chroma][tu_q];
     const int cb_p             = (y_p >> log2_min_cb_size) * min_cb_width  + (x_p >>  log2_min_cb_size);
     const int cb_q             = (y_q >> log2_min_cb_size) * min_cb_width  + (x_q >>  log2_min_cb_size);
+    const uint8_t pcmf         = fc->tab.pcmf[chroma][cb_p] && fc->tab.pcmf[chroma][cb_q];
     const uint8_t intra        = fc->tab.cpm[chroma][cb_p] == MODE_INTRA || fc->tab.cpm[chroma][cb_q] == MODE_INTRA;
     const uint8_t same_mode    = fc->tab.cpm[chroma][cb_p] == fc->tab.cpm[chroma][cb_q];
 
-- 
2.34.1



More information about the ffmpeg-devel mailing list