[lfnst] Fix lfnst constraint calculation check. Constraints will now be calculated regardless of tr_idx value.

This commit is contained in:
siivonek 2022-06-01 14:28:34 +03:00 committed by Joose Sainio
parent d15fb473a2
commit 7abbf14d50
2 changed files with 3 additions and 1 deletions

View file

@ -443,6 +443,8 @@ static double search_intra_trdepth(
// rd_cost += uvg_cu_rd_cost_chroma(state, lcu_px.x, lcu_px.y, depth, pred_cu, lcu);
//}
// TODO: there is an error in this cost calculation. This will be fixed when merged into current master
// This is compared to the previous best, which may have chroma cost included
if (rd_cost < best_rd_cost) {
best_rd_cost = rd_cost;
best_lfnst_idx = pred_cu->lfnst_idx;

View file

@ -102,7 +102,7 @@ void uvg_encode_coeff_nxn_generic(encoder_state_t * const state,
last_coeff_x = (uint8_t)(pos_last - (last_coeff_y * width));
bool is_chroma = color != COLOR_Y;
if (cur_cu != NULL && cur_cu->tr_idx != MTS_SKIP && height >= 4 && width >= 4) {
if (cur_cu != NULL && /*cur_cu->tr_idx != MTS_SKIP &&*/ height >= 4 && width >= 4) {
const int max_lfnst_pos = ((height == 4 && width == 4) || (height == 8 && width == 8)) ? 7 : 15;
cur_cu->violates_lfnst_constrained[is_chroma] |= scan_pos_last > max_lfnst_pos;
cur_cu->lfnst_last_scan_pos |= scan_pos_last >= 1;