1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

lavc/hevcdec: move HEVCContext.tab_ct_depth to HEVCLayerContext

This commit is contained in:
Anton Khirnov 2024-06-05 09:01:16 +02:00
parent 1ca4c2a96d
commit cf7add8d70
3 changed files with 13 additions and 12 deletions

View File

@ -636,10 +636,10 @@ int ff_hevc_pred_mode_decode(HEVCLocalContext *lc)
return GET_CABAC(PRED_MODE_FLAG_OFFSET);
}
int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, const HEVCSPS *sps,
int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, uint8_t *tab_ct_depth,
const HEVCSPS *sps,
int ct_depth, int x0, int y0)
{
const HEVCContext *const s = lc->parent;
int inc = 0, depth_left = 0, depth_top = 0;
int x0b = av_zero_extend(x0, sps->log2_ctb_size);
int y0b = av_zero_extend(y0, sps->log2_ctb_size);
@ -647,9 +647,9 @@ int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, const HEVCSPS *s
int y_cb = y0 >> sps->log2_min_cb_size;
if (lc->ctb_left_flag || x0b)
depth_left = s->tab_ct_depth[(y_cb) * sps->min_cb_width + x_cb - 1];
depth_left = tab_ct_depth[(y_cb) * sps->min_cb_width + x_cb - 1];
if (lc->ctb_up_flag || y0b)
depth_top = s->tab_ct_depth[(y_cb - 1) * sps->min_cb_width + x_cb];
depth_top = tab_ct_depth[(y_cb - 1) * sps->min_cb_width + x_cb];
inc += (depth_left > ct_depth);
inc += (depth_top > ct_depth);

View File

@ -72,7 +72,7 @@ static void pic_arrays_free(HEVCContext *s, HEVCLayerContext *l)
av_freep(&l->deblock);
av_freep(&l->skip_flag);
av_freep(&s->tab_ct_depth);
av_freep(&l->tab_ct_depth);
av_freep(&s->tab_ipm);
av_freep(&s->cbf_luma);
@ -109,8 +109,8 @@ static int pic_arrays_init(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *s
goto fail;
l->skip_flag = av_malloc_array(sps->min_cb_height, sps->min_cb_width);
s->tab_ct_depth = av_malloc_array(sps->min_cb_height, sps->min_cb_width);
if (!l->skip_flag || !s->tab_ct_depth)
l->tab_ct_depth = av_malloc_array(sps->min_cb_height, sps->min_cb_width);
if (!l->skip_flag || !l->tab_ct_depth)
goto fail;
s->cbf_luma = av_malloc_array(sps->min_tb_width, sps->min_tb_height);
@ -2383,7 +2383,7 @@ static int hls_coding_unit(HEVCLocalContext *lc, const HEVCContext *s,
lc->qPy_pred = lc->qp_y;
}
set_ct_depth(sps, s->tab_ct_depth, x0, y0, log2_cb_size, lc->ct_depth);
set_ct_depth(sps, l->tab_ct_depth, x0, y0, log2_cb_size, lc->ct_depth);
return 0;
}
@ -2403,7 +2403,8 @@ static int hls_coding_quadtree(HEVCLocalContext *lc,
if (x0 + cb_size <= sps->width &&
y0 + cb_size <= sps->height &&
log2_cb_size > sps->log2_min_cb_size) {
split_cu = ff_hevc_split_coding_unit_flag_decode(lc, sps, cb_depth, x0, y0);
split_cu = ff_hevc_split_coding_unit_flag_decode(lc, l->tab_ct_depth,
sps, cb_depth, x0, y0);
} else {
split_cu = (log2_cb_size > sps->log2_min_cb_size);
}

View File

@ -449,6 +449,7 @@ typedef struct HEVCLayerContext {
// CU
uint8_t *skip_flag;
uint8_t *tab_ct_depth;
} HEVCLayerContext;
typedef struct HEVCContext {
@ -506,8 +507,6 @@ typedef struct HEVCContext {
int32_t *tab_slice_address;
// CU
uint8_t *tab_ct_depth;
// PU
uint8_t *tab_ipm;
@ -584,7 +583,8 @@ int ff_hevc_cu_transquant_bypass_flag_decode(HEVCLocalContext *lc);
int ff_hevc_skip_flag_decode(HEVCLocalContext *lc, uint8_t *skip_flag,
int x0, int y0, int x_cb, int y_cb, int min_cb_width);
int ff_hevc_pred_mode_decode(HEVCLocalContext *lc);
int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, const HEVCSPS *sps,
int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, uint8_t *tab_ct_depth,
const HEVCSPS *sps,
int ct_depth, int x0, int y0);
int ff_hevc_part_mode_decode(HEVCLocalContext *lc, const HEVCSPS *sps, int log2_cb_size);
int ff_hevc_pcm_flag_decode(HEVCLocalContext *lc);