diff --git a/src/dep_quant.c b/src/dep_quant.c index 519e5795..cc107ddf 100644 --- a/src/dep_quant.c +++ b/src/dep_quant.c @@ -908,6 +908,8 @@ int uvg_dep_quant( init_rate_esimator(rate_estimator, &state->search_cabac, compID); xSetLastCoeffOffset(state, cur_tu, width, height, rate_estimator, compID); rate_estimator->needs_init = false; + } else if (compID == COLOR_U && state->encoder_control->cfg.jccr) { + xSetLastCoeffOffset(state, cur_tu, width, height, rate_estimator, compID); } reset_common_context(&dep_quant_context.m_common_context, rate_estimator, (width * height) >> 4, numCoeff); diff --git a/src/search.c b/src/search.c index 755062ab..c353a914 100644 --- a/src/search.c +++ b/src/search.c @@ -1414,6 +1414,7 @@ static double search_cu( else { intra_search.pred_cu.intra.mode_chroma = 0; } + state->quant_blocks[2].needs_init = true; uvg_intra_recon_cu(state, &intra_search, chroma_loc, &intra_search.pred_cu, lcu, diff --git a/src/search_intra.c b/src/search_intra.c index 9d4c5da6..a644ed9c 100644 --- a/src/search_intra.c +++ b/src/search_intra.c @@ -1971,6 +1971,7 @@ void uvg_search_cu_intra( } state->quant_blocks[0].needs_init = 1; + state->rate_estimator[0].needs_init = 1; search_intra_rdo( state, number_of_modes_to_search, diff --git a/src/transform.c b/src/transform.c index 969394df..45846cf9 100644 --- a/src/transform.c +++ b/src/transform.c @@ -437,7 +437,7 @@ static void quantize_chroma( int8_t height = cu_loc->chroma_height; if(state->encoder_control->cfg.dep_quant && transform != CHROMA_TS) { int abs_sum = 0; - state->quant_blocks[1].needs_init = state->encoder_control->cfg.jccr; + state->quant_blocks[2].needs_init = state->encoder_control->cfg.jccr; uvg_dep_quant( state, cur_tu, @@ -1561,8 +1561,6 @@ void uvg_quantize_lcu_residual( uvg_cu_loc_ctor(&loc, x, y, width, height); if (luma) { - state->quant_blocks[0].needs_init = true; - state->rate_estimator[0].needs_init = true; quantize_tr_residual(state, COLOR_Y, &loc, cur_pu, lcu, early_skip, tree_type); } double c_lambda = state->c_lambda;