passed files: ACT_A_Kwai_3.bit ACT_B_Kwai_3.bit
Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -392,6 +392,8 @@ static int hls_transform_unit(VVCLocalContext *lc, int x0, int y0,int tu_width, · 391 unmodified lines | ||
| 392 | 392 | if (ret < 0) |
| 393 | 393 | return ret; |
| 394 | 394 | 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)); | |
| 395 | 397 | } |
| 396 | 398 | if (tb->c_idx != CR) |
| 397 | 399 | set_tb_size(fc, tb); |
| @@ -523,13 +523,14 @@ static void lmcs_scale_chroma(VVCLocalContext *lc, TransformUnit *tu, TransformB · 522 unmodified lines | ||
| 523 | 523 | static void add_residual(const VVCLocalContext *lc, TransformUnit *tu, const int target_ch_type) |
| 524 | 524 | { |
| 525 | 525 | const VVCFrameContext *fc = lc->fc; |
| 526 | + const CodingUnit *cu = lc->cu; | |
| 526 | 527 | |
| 527 | 528 | for (int i = 0; i < tu->nb_tbs; i++) { |
| 528 | 529 | TransformBlock *tb = tu->tbs + i; |
| 529 | 530 | const int c_idx = tb->c_idx; |
| 530 | 531 | const int ch_type = c_idx > 0; |
| 531 | 532 | 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 || | |
| 533 | 534 | (c_idx && tu->joint_cbcr_residual_flag); |
| 534 | 535 | uint8_t *dst = POS(c_idx, tb->x0, tb->y0); |
| 535 | 536 | |
| @@ -543,12 +544,13 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int target_ · 7 unmodified lines | ||
| 543 | 544 | const VVCFrameContext *fc = lc->fc; |
| 544 | 545 | const CodingUnit *cu = lc->cu; |
| 545 | 546 | TransformBlock *tbs = tu->tbs; |
| 547 | + const bool is_act_luma = cu->act_enabled_flag && target_ch_type == LUMA; | |
| 546 | 548 | |
| 547 | 549 | for (int i = 0; i < tu->nb_tbs; i++) { |
| 548 | 550 | TransformBlock *tb = tbs + i; |
| 549 | 551 | const int c_idx = tb->c_idx; |
| 550 | 552 | 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; | |
| 552 | 554 | |
| 553 | 555 | if (tb->has_coeffs && do_itx) { |
| 554 | 556 | if (cu->bdpcm_flag[tb->c_idx]) |
| @@ -568,6 +570,13 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int target_ · 13 unmodified lines | ||
| 568 | 570 | lmcs_scale_chroma(lc, tu, tb, target_ch_type); |
| 569 | 571 | } |
| 570 | 572 | } |
| 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 | + | |
| 571 | 580 | add_residual(lc, tu, target_ch_type); |
| 572 | 581 | } |
| 573 | 582 | |