From 03fd8f1545862d154efe97a0140f9368c1674e0f Mon Sep 17 00:00:00 2001 From: Joose Sainio Date: Thu, 31 Mar 2022 11:45:49 +0300 Subject: [PATCH] Don't write jccr flag for inter CUs when it cannot be enabled --- src/encode_coding_tree.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/encode_coding_tree.c b/src/encode_coding_tree.c index 6912787d..f31c950d 100644 --- a/src/encode_coding_tree.c +++ b/src/encode_coding_tree.c @@ -594,7 +594,13 @@ static void encode_transform_coeff(encoder_state_t * const state, state->must_code_qp_delta = false; } - if((cb_flag_u || cb_flag_v ) && (depth != 4 || only_chroma) && state->encoder_control->cfg.jccr) { + if(( + ((cb_flag_u || cb_flag_v ) + && cur_cu->type == CU_INTRA) + || (cb_flag_u && cb_flag_v)) + && (depth != 4 || only_chroma) + && state->encoder_control->cfg.jccr + ) { cabac->cur_ctx = &cabac->ctx.joint_cb_cr[cb_flag_u * 2 + cb_flag_v - 1]; CABAC_BIN(cabac, cur_pu->joint_cb_cr != 0, "tu_joint_cbcr_residual_flag"); }