[ISP] Fix ISP cost calculation and DepQuant with mts

This commit is contained in:
Joose Sainio 2023-02-03 14:58:36 +02:00 committed by Marko Viitanen
parent 6e24b9a7f9
commit 7d787c6b22
3 changed files with 20 additions and 20 deletions

View file

@ -240,6 +240,7 @@ int uvg_init_nb_info(encoder_control_t * encoder) {
{
nbSbb->inPos[k] = 0;
}
printf("");
}
{
//===== outside subband neighbours =====
@ -1282,8 +1283,8 @@ int uvg_dep_quant(
encoder->m_scanId2NbInfoSbbArray[log2_tr_width][log2_tr_height][scanIdx ? scanIdx - 1 : 0],
(zeroOut && (pos_x >= effWidth || pos_y >= effHeight)),
q_coeff[blkpos],
effectWidth,
effectHeight
width,
height
); //tu.cu->slice->getReverseLastSigCoeffFlag());
}
else {
@ -1304,9 +1305,13 @@ int uvg_dep_quant(
encoder->m_scanId2NbInfoSbbArray[log2_tr_width][log2_tr_height][scanIdx ? scanIdx - 1 : 0],
(zeroOut && (pos_x >= effWidth || pos_y >= effHeight)),
default_quant_coeff,
effectWidth,
effectHeight); //tu.cu->slice->getReverseLastSigCoeffFlag());
width,
height); //tu.cu->slice->getReverseLastSigCoeffFlag());
}
Decision temp[8];
Decision* decisions = ctxs->m_trellis[scanIdx];
memcpy(temp, decisions, sizeof(Decision) * 8);
decisions++;
}
//===== find best path =====

View file

@ -2016,7 +2016,7 @@ bool uvg_can_use_isp_with_lfnst(const int width, const int height, const int isp
return false;
}
if (isp_split_type == ISP_MODE_NO_ISP) {
return false;
return true;
}
const int tu_width = (isp_split_type == ISP_MODE_HOR) ? width : uvg_get_isp_split_dim(width, height, SPLIT_TYPE_VER, true);
@ -2062,7 +2062,7 @@ double uvg_recon_and_estimate_cost_isp(encoder_state_t* const state,
&tu_loc, &search_data->pred_cu, lcu,
false, UVG_LUMA_T);
int index = cu_loc->local_y * LCU_WIDTH + cu_loc->local_x;
int index = tu_loc.local_y * LCU_WIDTH + tu_loc.local_x;
int ssd = uvg_pixels_calc_ssd(&lcu->ref.y[index], &lcu->rec.y[index],
LCU_WIDTH, LCU_WIDTH,
tu_loc.width, tu_loc.height);

View file

@ -361,21 +361,16 @@ static double search_intra_trdepth(
}
for (trafo = mts_start; trafo < num_transforms; trafo++) {
for (int lfnst_idx = start_idx; lfnst_idx <= end_lfnst_idx; lfnst_idx++) {
// Initialize lfnst variables
pred_cu->tr_idx = trafo;
pred_cu->tr_skip = trafo == MTS_SKIP;
pred_cu->lfnst_idx = lfnst_idx;
pred_cu->violates_lfnst_constrained_luma = false;
pred_cu->violates_lfnst_constrained_chroma = false;
pred_cu->lfnst_last_scan_pos = false;
//if (pred_cu->lfnst_idx != 0) {
// // Cannot use ISP with LFNST for small blocks
// pred_cu->intra.isp_mode = uvg_can_use_isp_with_lfnst(width, height, pred_cu->intra.isp_mode, tree_type) ? pred_cu->intra.isp_mode : ISP_MODE_NO_ISP;
//}
for (trafo = mts_start; trafo < num_transforms; trafo++) {
pred_cu->tr_idx = trafo;
pred_cu->tr_skip = trafo == MTS_SKIP;
bool constraints[2] = {false, false};
if (mts_enabled) {
pred_cu->mts_last_scan_pos = 0;