[lfnst] 16x16

This commit is contained in:
Joose Sainio 2022-06-16 14:58:28 +03:00
parent d7f7a2d99b
commit 7a7bf045e6
2 changed files with 23 additions and 2 deletions

View file

@ -554,6 +554,26 @@ static double cu_rd_cost_tr_split_accurate(const encoder_state_t* const state,
coeff_bits += uvg_get_coeff_cost(state, coeffs, tr_cu, width, 0, luma_scan_mode, tr_cu->tr_skip & 1); coeff_bits += uvg_get_coeff_cost(state, coeffs, tr_cu, width, 0, luma_scan_mode, tr_cu->tr_skip & 1);
} }
if(depth == 4) {
if (uvg_is_lfnst_allowed(state, tr_cu, COLOR_Y, width, width, x_px, y_px)) {
const int lfnst_idx = tr_cu->lfnst_idx;
CABAC_FBITS_UPDATE(
cabac,
&cabac->ctx.lfnst_idx_model[tr_cu->depth == 4],
lfnst_idx != 0,
tr_tree_bits,
"lfnst_idx");
if (lfnst_idx > 0) {
CABAC_FBITS_UPDATE(
cabac,
&cabac->ctx.lfnst_idx_model[2],
lfnst_idx == 2,
tr_tree_bits,
"lfnst_idx");
}
}
}
unsigned chroma_ssd = 0; unsigned chroma_ssd = 0;
if(has_chroma) { if(has_chroma) {
const vector2d_t lcu_px = { (x_px & ~7 ) / 2, (y_px & ~7) / 2 }; const vector2d_t lcu_px = { (x_px & ~7 ) / 2, (y_px & ~7) / 2 };
@ -600,7 +620,8 @@ static double cu_rd_cost_tr_split_accurate(const encoder_state_t* const state,
coeff_bits += uvg_get_coeff_cost(state, &lcu->coeff.joint_uv[index], NULL, chroma_width, COLOR_U, scan_order, 0); coeff_bits += uvg_get_coeff_cost(state, &lcu->coeff.joint_uv[index], NULL, chroma_width, COLOR_U, scan_order, 0);
} }
} }
if (uvg_is_lfnst_allowed(state, tr_cu, COLOR_Y, width, width, x_px, y_px)) {
if (uvg_is_lfnst_allowed(state, tr_cu, depth == 4 ? COLOR_UV : COLOR_Y, width, width, x_px, y_px)) {
const int lfnst_idx = tr_cu->lfnst_idx; const int lfnst_idx = tr_cu->lfnst_idx;
CABAC_FBITS_UPDATE( CABAC_FBITS_UPDATE(
cabac, cabac,

View file

@ -406,7 +406,7 @@ static double search_intra_trdepth(
); );
// Temp constraints. Updating the actual pred_cu constraints here will break things later // Temp constraints. Updating the actual pred_cu constraints here will break things later
if (constraints[0] || !constraints[1]) { if (!constraints[1] && cbf_is_set(pred_cu->cbf, depth, COLOR_Y)) {
//end_idx = 0; //end_idx = 0;
if (pred_cu->lfnst_idx > 0) { if (pred_cu->lfnst_idx > 0) {
continue; continue;