[dep_quant] Fix rate_estimator and quant_block init cases

This commit is contained in:
Joose Sainio 2023-04-21 11:34:31 +03:00
parent dfff9a8030
commit 48ea4bff4d
4 changed files with 5 additions and 3 deletions

View file

@ -908,6 +908,8 @@ int uvg_dep_quant(
init_rate_esimator(rate_estimator, &state->search_cabac, compID); init_rate_esimator(rate_estimator, &state->search_cabac, compID);
xSetLastCoeffOffset(state, cur_tu, width, height, rate_estimator, compID); xSetLastCoeffOffset(state, cur_tu, width, height, rate_estimator, compID);
rate_estimator->needs_init = false; 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); reset_common_context(&dep_quant_context.m_common_context, rate_estimator, (width * height) >> 4, numCoeff);

View file

@ -1414,6 +1414,7 @@ static double search_cu(
else { else {
intra_search.pred_cu.intra.mode_chroma = 0; intra_search.pred_cu.intra.mode_chroma = 0;
} }
state->quant_blocks[2].needs_init = true;
uvg_intra_recon_cu(state, uvg_intra_recon_cu(state,
&intra_search, chroma_loc, &intra_search, chroma_loc,
&intra_search.pred_cu, lcu, &intra_search.pred_cu, lcu,

View file

@ -1971,6 +1971,7 @@ void uvg_search_cu_intra(
} }
state->quant_blocks[0].needs_init = 1; state->quant_blocks[0].needs_init = 1;
state->rate_estimator[0].needs_init = 1;
search_intra_rdo( search_intra_rdo(
state, state,
number_of_modes_to_search, number_of_modes_to_search,

View file

@ -437,7 +437,7 @@ static void quantize_chroma(
int8_t height = cu_loc->chroma_height; int8_t height = cu_loc->chroma_height;
if(state->encoder_control->cfg.dep_quant && transform != CHROMA_TS) { if(state->encoder_control->cfg.dep_quant && transform != CHROMA_TS) {
int abs_sum = 0; 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( uvg_dep_quant(
state, state,
cur_tu, cur_tu,
@ -1561,8 +1561,6 @@ void uvg_quantize_lcu_residual(
uvg_cu_loc_ctor(&loc, x, y, width, height); uvg_cu_loc_ctor(&loc, x, y, width, height);
if (luma) { 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); quantize_tr_residual(state, COLOR_Y, &loc, cur_pu, lcu, early_skip, tree_type);
} }
double c_lambda = state->c_lambda; double c_lambda = state->c_lambda;