[isp] Add lfnst asserts. Fix error in MTS search. Fix chroma lfnst index when no coefficients present.

This commit is contained in:
siivonek 2022-09-26 14:44:51 +03:00 committed by Marko Viitanen
parent b9822398a0
commit 85f6b00394
3 changed files with 10 additions and 5 deletions

View file

@ -230,6 +230,12 @@ static bool encode_lfnst_idx(
return true; return true;
} }
else { else {
if(depth != 4 || color == COLOR_Y) {
assert(pred_cu->lfnst_idx == 0);
}
if(depth == 4 && color != COLOR_Y) {
assert(pred_cu->cr_lfnst_idx == 0);
}
return false; return false;
} }
} }

View file

@ -343,9 +343,7 @@ static double search_intra_trdepth(
const int max_tb_size = TR_MAX_WIDTH; const int max_tb_size = TR_MAX_WIDTH;
// LFNST search params // LFNST search params
int max_lfnst_idx = width > max_tb_size || height > max_tb_size ? int max_lfnst_idx = width > max_tb_size || height > max_tb_size ? 0 : 2;
0 :
2;
if(pred_cu->intra.mip_flag && (width < 16 || height < 16)) { if(pred_cu->intra.mip_flag && (width < 16 || height < 16)) {
max_lfnst_idx = 0; max_lfnst_idx = 0;
} }
@ -379,8 +377,8 @@ static double search_intra_trdepth(
pred_cu->mts_last_scan_pos = 0; pred_cu->mts_last_scan_pos = 0;
pred_cu->violates_mts_coeff_constraint = 0; pred_cu->violates_mts_coeff_constraint = 0;
if ((trafo == MTS_SKIP && width > (1 << state->encoder_control->cfg.trskip_max_size)) if (trafo == MTS_SKIP && (width > (1 << state->encoder_control->cfg.trskip_max_size)
|| !state->encoder_control->cfg.trskip_enable) { || !state->encoder_control->cfg.trskip_enable)) {
continue; continue;
} }
} }

View file

@ -580,6 +580,7 @@ void uvg_chroma_transform_search(
&u_has_coeffs, &u_has_coeffs,
&v_has_coeffs, &v_has_coeffs,
pred_cu->cr_lfnst_idx); pred_cu->cr_lfnst_idx);
if(pred_cu->cr_lfnst_idx !=0 && !u_has_coeffs && !v_has_coeffs) continue;
if(pred_cu->type == CU_INTRA && transforms[i] != CHROMA_TS && (depth == 4 || tree_type == UVG_CHROMA_T)) { if(pred_cu->type == CU_INTRA && transforms[i] != CHROMA_TS && (depth == 4 || tree_type == UVG_CHROMA_T)) {
bool constraints[2] = { false, false }; bool constraints[2] = { false, false };