History

avcodec/vvc: add adaptive color transform support

passed files: ACT_A_Kwai_3.bit ACT_B_Kwai_3.bit

Wu Jianhua committed 1 year ago

Commit fd5d7541 parent 0e4c0db2 files · +13 −2Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/vvc/ctu.c +2 −0
  2. libavcodec/vvc/intra.c +11 −2
libavcodec/vvc/ctu.c+2−0
@@ -392,6 +392,8 @@ static int hls_transform_unit(VVCLocalContext *lc, int x0, int y0,int tu_width, · 391 unmodified lines
392392 if (ret < 0)
393393 return ret;
394394 set_tb_tab(fc->tab.tu_coded_flag[tb->c_idx], tu->coded_flag[tb->c_idx], fc, tb);
395+ } else if (cu->act_enabled_flag) {
396+ memset(tb->coeffs, 0, tb->tb_width * tb->tb_height * sizeof(*tb->coeffs));
395397 }
396398 if (tb->c_idx != CR)
397399 set_tb_size(fc, tb);
libavcodec/vvc/intra.c+11−2
@@ -523,13 +523,14 @@ static void lmcs_scale_chroma(VVCLocalContext *lc, TransformUnit *tu, TransformB · 522 unmodified lines
523523 static void add_residual(const VVCLocalContext *lc, TransformUnit *tu, const int target_ch_type)
524524 {
525525 const VVCFrameContext *fc = lc->fc;
526+ const CodingUnit *cu = lc->cu;
526527
527528 for (int i = 0; i < tu->nb_tbs; i++) {
528529 TransformBlock *tb = tu->tbs + i;
529530 const int c_idx = tb->c_idx;
530531 const int ch_type = c_idx > 0;
531532 const ptrdiff_t stride = fc->frame->linesize[c_idx];
532− const bool has_residual = tb->has_coeffs ||
533+ const bool has_residual = tb->has_coeffs || cu->act_enabled_flag ||
533534 (c_idx && tu->joint_cbcr_residual_flag);
534535 uint8_t *dst = POS(c_idx, tb->x0, tb->y0);
535536
@@ -543,12 +544,13 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int target_ · 7 unmodified lines
543544 const VVCFrameContext *fc = lc->fc;
544545 const CodingUnit *cu = lc->cu;
545546 TransformBlock *tbs = tu->tbs;
547+ const bool is_act_luma = cu->act_enabled_flag && target_ch_type == LUMA;
546548
547549 for (int i = 0; i < tu->nb_tbs; i++) {
548550 TransformBlock *tb = tbs + i;
549551 const int c_idx = tb->c_idx;
550552 const int ch_type = c_idx > 0;
551− const bool do_itx = ch_type == target_ch_type;
553+ const bool do_itx = is_act_luma || !cu->act_enabled_flag && ch_type == target_ch_type;
552554
553555 if (tb->has_coeffs && do_itx) {
554556 if (cu->bdpcm_flag[tb->c_idx])
@@ -568,6 +570,13 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int target_ · 13 unmodified lines
568570 lmcs_scale_chroma(lc, tu, tb, target_ch_type);
569571 }
570572 }
573+
574+ if (is_act_luma) {
575+ fc->vvcdsp.itx.adaptive_color_transform(
576+ tbs[LUMA].coeffs, tbs[CB].coeffs, tbs[CR].coeffs,
577+ tbs[LUMA].tb_width, tbs[LUMA].tb_height);
578+ }
579+
571580 add_residual(lc, tu, target_ch_type);
572581 }
573582

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t