[lfnst] Fix error in writing lfnst constraints. Added check to test if CU data exists before referencing it.

This commit is contained in:
siivonek 2022-03-21 19:59:57 +02:00 committed by Joose Sainio
parent e11fd3154d
commit 835f576eef

View file

@ -103,7 +103,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 = !is_luma;
if (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;