[FFmpeg-devel] [PATCH 06/11] avcodec/vvcdec: do not zero frame mvf table

Nuo Mi nuomi2021 at gmail.com
Sun Jul 28 06:18:02 EEST 2024


---
 libavcodec/vvc/dec.c | 11 +++++++++++
 libavcodec/vvc/mvs.c |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index 568229d2c3..be23f2bd54 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -159,6 +159,16 @@ static void min_pu_tl_init(TabList *l, VVCFrameContext *fc)
     TL_ADD(msf, pic_size_in_min_pu);
     TL_ADD(iaf, pic_size_in_min_pu);
     TL_ADD(mmi, pic_size_in_min_pu);
+}
+
+static void min_pu_nz_tl_init(TabList *l, VVCFrameContext *fc)
+{
+    const VVCPPS *pps            = fc->ps.pps;
+    const int pic_size_in_min_pu = pps ? pps->min_pu_width * pps->min_pu_height : 0;
+    const int changed            = fc->tab.sz.pic_size_in_min_pu != pic_size_in_min_pu;
+
+    tl_init(l, 0, changed);
+
     TL_ADD(mvf, pic_size_in_min_pu);
 }
 
@@ -302,6 +312,7 @@ static int frame_context_for_each_tl(VVCFrameContext *fc, int (*unary_fn)(TabLis
         min_cb_tl_init,
         min_cb_nz_tl_init,
         min_pu_tl_init,
+        min_pu_nz_tl_init,
         min_tu_tl_init,
         min_tu_nz_tl_init,
         pixel_buffer_nz_tl_init,
diff --git a/libavcodec/vvc/mvs.c b/libavcodec/vvc/mvs.c
index 905edf1cd0..fe047cfd5a 100644
--- a/libavcodec/vvc/mvs.c
+++ b/libavcodec/vvc/mvs.c
@@ -614,7 +614,7 @@ static int check_available(Neighbour *n, const VVCLocalContext *lc, const int ch
     if (!n->checked) {
         n->checked = 1;
         n->available = !sps->r->sps_entropy_coding_sync_enabled_flag || ((n->x >> sps->ctb_log2_size_y) <= (cu->x0 >> sps->ctb_log2_size_y));
-        n->available &= cu->pred_mode == pred_flag_to_mode(TAB_MVF(n->x, n->y).pred_flag);
+        n->available &= is_available(fc, n->x, n->y) && cu->pred_mode == pred_flag_to_mode(TAB_MVF(n->x, n->y).pred_flag);
         if (check_mer)
             n->available &= !is_same_mer(fc, n->x, n->y, cu->x0, cu->y0);
     }
-- 
2.34.1



More information about the ffmpeg-devel mailing list