[FFmpeg-devel] [PATCH 4/4] avcodec/vvcdec: remove unused tb_pos_x0 and tb_pos_y0
Nuo Mi
nuomi2021 at gmail.com
Fri Oct 4 17:31:15 EEST 2024
This change will save approximately 531 MB for an 8K clip when processed with 16 threads.
The calculation is as follows:
7680 * 4320 * sizeof(int) * 2 * 2 * 16 / (4 * 4).
---
libavcodec/vvc/ctu.c | 10 +++-------
libavcodec/vvc/dec.c | 2 --
libavcodec/vvc/dec.h | 2 --
3 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index e49976c66b..1e06119cfd 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -38,7 +38,7 @@ typedef enum VVCModeType {
MODE_TYPE_INTRA,
} VVCModeType;
-static void set_tb_pos(const VVCFrameContext *fc, const TransformBlock *tb)
+static void set_tb_size(const VVCFrameContext *fc, const TransformBlock *tb)
{
const int x_tb = tb->x0 >> MIN_TU_LOG2;
const int y_tb = tb->y0 >> MIN_TU_LOG2;
@@ -50,10 +50,6 @@ static void set_tb_pos(const VVCFrameContext *fc, const TransformBlock *tb)
for (int y = y_tb; y < end; y++) {
const int off = y * fc->ps.pps->min_tu_width + x_tb;
- for (int i = 0; i < width; i++) {
- fc->tab.tb_pos_x0[is_chroma][off + i] = tb->x0;
- fc->tab.tb_pos_y0[is_chroma][off + i] = tb->y0;
- }
memset(fc->tab.tb_width [is_chroma] + off, tb->tb_width, width);
memset(fc->tab.tb_height[is_chroma] + off, tb->tb_height, width);
}
@@ -397,7 +393,7 @@ static int hls_transform_unit(VVCLocalContext *lc, int x0, int y0,int tu_width,
set_tb_tab(fc->tab.tu_coded_flag[tb->c_idx], tu->coded_flag[tb->c_idx], fc, tb);
}
if (tb->c_idx != CR)
- set_tb_pos(fc, tb);
+ set_tb_size(fc, tb);
if (tb->c_idx == CB)
set_tb_tab(fc->tab.tu_joint_cbcr_residual_flag, tu->joint_cbcr_residual_flag, fc, tb);
}
@@ -514,7 +510,7 @@ static int skipped_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_wid
for (int i = c_start; i < c_end; i++) {
TransformBlock *tb = add_tb(tu, lc, x0, y0, tu_width >> sps->hshift[i], tu_height >> sps->vshift[i], i);
if (i != CR)
- set_tb_pos(fc, tb);
+ set_tb_size(fc, tb);
}
}
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index 13ca752eec..9b7afe4c38 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -207,8 +207,6 @@ static void min_tu_nz_tl_init(TabList *l, VVCFrameContext *fc)
tl_init(l, 0, changed);
for (int i = LUMA; i <= CHROMA; i++) {
- TL_ADD(tb_pos_x0[i], pic_size_in_min_tu);
- TL_ADD(tb_pos_y0[i], pic_size_in_min_tu);
TL_ADD(tb_width[i], pic_size_in_min_tu);
TL_ADD(tb_height[i], pic_size_in_min_tu);
}
diff --git a/libavcodec/vvc/dec.h b/libavcodec/vvc/dec.h
index 159c60942b..7254b515fd 100644
--- a/libavcodec/vvc/dec.h
+++ b/libavcodec/vvc/dec.h
@@ -172,8 +172,6 @@ typedef struct VVCFrameContext {
uint8_t *tu_coded_flag[VVC_MAX_SAMPLE_ARRAYS]; ///< tu_y_coded_flag[][], tu_cb_coded_flag[][], tu_cr_coded_flag[][]
uint8_t *tu_joint_cbcr_residual_flag; ///< tu_joint_cbcr_residual_flag[][]
- int *tb_pos_x0[2];
- int *tb_pos_y0[2];
uint8_t *tb_width[2];
uint8_t *tb_height[2];
uint8_t *pcmf[2];
--
2.34.1
More information about the ffmpeg-devel
mailing list