diff --git a/src/intra.c b/src/intra.c index 90008887..33e54b31 100644 --- a/src/intra.c +++ b/src/intra.c @@ -665,7 +665,18 @@ void kvz_intra_recon_cu( cur_cu = LCU_GET_CU_AT_PX(lcu, lcu_px.x, lcu_px.y); } + // Reset CBFs because CBFs might have been set + // for depth earlier + if (mode_luma >= 0) { + cbf_clear(&cur_cu->cbf, depth, COLOR_Y); + } + if (mode_chroma >= 0) { + cbf_clear(&cur_cu->cbf, depth, COLOR_U); + cbf_clear(&cur_cu->cbf, depth, COLOR_V); + } + if (depth == 0 || cur_cu->tr_depth > depth) { + const int offset = width / 2; const int32_t x2 = x + offset; const int32_t y2 = y + offset; diff --git a/src/transform.c b/src/transform.c index 26876efe..141d5efa 100644 --- a/src/transform.c +++ b/src/transform.c @@ -445,7 +445,18 @@ void kvz_quantize_lcu_residual(encoder_state_t * const state, width == 32 || width == 64); + // Reset CBFs because CBFs might have been set + // for depth earlier + if (luma) { + cbf_clear(&cur_pu->cbf, depth, COLOR_Y); + } + if (chroma) { + cbf_clear(&cur_pu->cbf, depth, COLOR_U); + cbf_clear(&cur_pu->cbf, depth, COLOR_V); + } + if (depth == 0 || cur_pu->tr_depth > depth) { + // Split transform and increase depth const int offset = width / 2; const int32_t x2 = x + offset;