diff --git a/src/inter.c b/src/inter.c index 44ac599f..177428e1 100644 --- a/src/inter.c +++ b/src/inter.c @@ -624,7 +624,9 @@ void kvz_inter_pred_pu(const encoder_state_t * const state, int i_pu) { - cu_info_t *cu = LCU_GET_CU_AT_PX(lcu, SUB_SCU(x), SUB_SCU(y)); + const int x_scu = SUB_SCU(x); + const int y_scu = SUB_SCU(y); + cu_info_t *cu = LCU_GET_CU_AT_PX(lcu, x_scu, y_scu); const int pu_x = PU_GET_X(cu->part_size, width, x, i_pu); const int pu_y = PU_GET_Y(cu->part_size, width, y, i_pu); const int pu_w = PU_GET_W(cu->part_size, width, i_pu); @@ -673,6 +675,12 @@ void kvz_inter_pred_pu(const encoder_state_t * const state, NULL, predict_luma, predict_chroma); } + + if (predict_chroma && state->encoder_control->cfg.jccr) { + const int offset = x_scu / 2 + y_scu / 2 * LCU_WIDTH_C; + kvz_pixels_blit(lcu->rec.u + offset, lcu->rec.joint_u + offset, width / 2, width / 2, LCU_WIDTH_C, LCU_WIDTH_C); + kvz_pixels_blit(lcu->rec.v + offset, lcu->rec.joint_v + offset, width / 2, width / 2, LCU_WIDTH_C, LCU_WIDTH_C); + } } /** diff --git a/src/search.c b/src/search.c index 0d89ab67..12f75832 100644 --- a/src/search.c +++ b/src/search.c @@ -1059,6 +1059,14 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth, NULL, lcu, false); + if (cur_cu->depth == cur_cu->tr_depth && state->encoder_control->cfg.jccr && cur_cu->joint_cb_cr) { + kvz_select_jccr_mode(state, + x & ~7, y & ~7, + depth, + NULL, + lcu, + NULL); + } int cbf = cbf_is_set_any(cur_cu->cbf, depth);