diff options
author | Nuo Mi <nuomi2021@gmail.com> | 2024-07-28 11:18:00 +0800 |
---|---|---|
committer | Nuo Mi <nuomi2021@gmail.com> | 2024-08-15 20:19:45 +0800 |
commit | e8ac76129365302de7e2885b76459ad890b7ecc7 (patch) | |
tree | eb04007293325a533647701a87920ceb07f2be07 /libavcodec/vvc/dec.c | |
parent | 4f609614983bcabc277d354ef8bc4e65e52faaf6 (diff) | |
download | ffmpeg-e8ac76129365302de7e2885b76459ad890b7ecc7.tar.gz |
avcodec/vvcdec: split ctu table to zero init and no zero init parts
cus need to init to zero, other parts are not
Diffstat (limited to 'libavcodec/vvc/dec.c')
-rw-r--r-- | libavcodec/vvc/dec.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c index d609fc5184..568229d2c3 100644 --- a/libavcodec/vvc/dec.c +++ b/libavcodec/vvc/dec.c @@ -91,17 +91,6 @@ static int tl_create(TabList *l) return 0; } -static void ctu_tl_init(TabList *l, VVCFrameContext *fc) -{ - const VVCPPS *pps = fc->ps.pps; - const int ctu_count = pps ? pps->ctb_count : 0; - const int changed = fc->tab.sz.ctu_count != ctu_count; - - tl_init(l, 1, changed); - - TL_ADD(ctus, ctu_count); -} - static void ctu_nz_tl_init(TabList *l, VVCFrameContext *fc) { const VVCSPS *sps = fc->ps.sps; @@ -112,6 +101,8 @@ static void ctu_nz_tl_init(TabList *l, VVCFrameContext *fc) tl_init(l, 0, changed); + TL_ADD(cus, ctu_count); + TL_ADD(ctus, ctu_count); TL_ADD(deblock, ctu_count); TL_ADD(sao, ctu_count); TL_ADD(alf, ctu_count); @@ -307,7 +298,6 @@ typedef void (*tl_init_fn)(TabList *l, VVCFrameContext *fc); static int frame_context_for_each_tl(VVCFrameContext *fc, int (*unary_fn)(TabList *l)) { const tl_init_fn init[] = { - ctu_tl_init, ctu_nz_tl_init, min_cb_tl_init, min_cb_nz_tl_init, @@ -334,9 +324,9 @@ static int frame_context_for_each_tl(VVCFrameContext *fc, int (*unary_fn)(TabLis static void free_cus(VVCFrameContext *fc) { - if (fc->tab.ctus) { + if (fc->tab.cus) { for (int i = 0; i < fc->tab.sz.ctu_count; i++) - ff_vvc_ctu_free_cus(fc->tab.ctus + i); + ff_vvc_ctu_free_cus(fc->tab.cus + i); } } @@ -364,6 +354,9 @@ static int pic_arrays_init(VVCContext *s, VVCFrameContext *fc) if (ret < 0) return ret; + // for error handling case, we may call free_cus before VVC_TASK_STAGE_INIT, so we need to set cus to 0 here + memset(fc->tab.cus, 0, sizeof(*fc->tab.cus) * ctu_count); + memset(fc->tab.slice_idx, -1, sizeof(*fc->tab.slice_idx) * ctu_count); if (fc->tab.sz.ctu_count != ctu_count) { |