You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/vvc/ctu: refact out ff_vvc_channel_range
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
This commit is contained in:
@ -501,13 +501,12 @@ static int skipped_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_wid
|
||||
SKIPPED_TRANSFORM_TREE(x0, y0 + trafo_height);
|
||||
} else {
|
||||
TransformUnit *tu = add_tu(fc, lc->cu, x0, y0, tu_width, tu_height);
|
||||
const int has_chroma = sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA;
|
||||
const int c_start = cu->tree_type == DUAL_TREE_CHROMA ? CB : LUMA;
|
||||
const int c_end = has_chroma ? VVC_MAX_SAMPLE_ARRAYS : CB;
|
||||
int start, end;
|
||||
|
||||
if (!tu)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (int i = c_start; i < c_end; i++) {
|
||||
ff_vvc_channel_range(&start, &end, cu->tree_type, sps->r->sps_chroma_format_idc);
|
||||
for (int i = start; i < 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_size(fc, tb);
|
||||
@ -2580,3 +2579,12 @@ void ff_vvc_ep_init_stat_coeff(EntryPoint *ep,
|
||||
persistent_rice_adaptation_enabled_flag ? 2 * (av_log2(bit_depth - 10)) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ff_vvc_channel_range(int *start, int *end, const VVCTreeType tree_type, const uint8_t chroma_format_idc)
|
||||
{
|
||||
const bool has_chroma = chroma_format_idc && tree_type != DUAL_TREE_LUMA;
|
||||
const bool has_luma = tree_type != DUAL_TREE_CHROMA;
|
||||
|
||||
*start = has_luma ? LUMA : CB;
|
||||
*end = has_chroma ? VVC_MAX_SAMPLE_ARRAYS : CB;
|
||||
}
|
||||
|
@ -489,5 +489,6 @@ void ff_vvc_decode_neighbour(VVCLocalContext *lc, int x_ctb, int y_ctb, int rx,
|
||||
void ff_vvc_ctu_free_cus(CodingUnit **cus);
|
||||
int ff_vvc_get_qPy(const VVCFrameContext *fc, int xc, int yc);
|
||||
void ff_vvc_ep_init_stat_coeff(EntryPoint *ep, int bit_depth, int persistent_rice_adaptation_enabled_flag);
|
||||
void ff_vvc_channel_range(int *start, int *end, VVCTreeType tree_type, uint8_t chroma_format_idc);
|
||||
|
||||
#endif // AVCODEC_VVC_CTU_H
|
||||
|
@ -639,11 +639,11 @@ static void ibc_fill_vir_buf(const VVCLocalContext *lc, const CodingUnit *cu)
|
||||
{
|
||||
const VVCFrameContext *fc = lc->fc;
|
||||
const VVCSPS *sps = fc->ps.sps;
|
||||
const int has_chroma = sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA;
|
||||
const int start = cu->tree_type == DUAL_TREE_CHROMA;
|
||||
const int end = has_chroma ? CR : LUMA;
|
||||
int start, end;
|
||||
|
||||
for (int c_idx = start; c_idx <= end; c_idx++) {
|
||||
ff_vvc_channel_range(&start, &end, cu->tree_type, sps->r->sps_chroma_format_idc);
|
||||
|
||||
for (int c_idx = start; c_idx < end; c_idx++) {
|
||||
const int hs = sps->hshift[c_idx];
|
||||
const int vs = sps->vshift[c_idx];
|
||||
const int ps = sps->pixel_shift;
|
||||
|
Reference in New Issue
Block a user