From 7abbf14d50c954091bb50b5b2f4a9f50c9758bf3 Mon Sep 17 00:00:00 2001 From: siivonek Date: Wed, 1 Jun 2022 14:28:34 +0300 Subject: [PATCH] [lfnst] Fix lfnst constraint calculation check. Constraints will now be calculated regardless of tr_idx value. --- src/search_intra.c | 2 ++ src/strategies/generic/encode_coding_tree-generic.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/search_intra.c b/src/search_intra.c index adaba818..a3295653 100644 --- a/src/search_intra.c +++ b/src/search_intra.c @@ -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; diff --git a/src/strategies/generic/encode_coding_tree-generic.c b/src/strategies/generic/encode_coding_tree-generic.c index e4bd156c..5cf28d16 100644 --- a/src/strategies/generic/encode_coding_tree-generic.c +++ b/src/strategies/generic/encode_coding_tree-generic.c @@ -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;