[scalinglist] Fix quant-generic

This commit is contained in:
Joose Sainio 2021-03-09 10:42:40 +02:00
parent 21bc9aa3c2
commit 412781db41

View file

@ -43,10 +43,10 @@ void kvz_quant_generic(const encoder_state_t * const state, coeff_t *coef, coeff
const uint32_t * const scan = kvz_g_sig_last_scan[scan_idx][log2_block_size - 1];
int32_t qp_scaled = kvz_get_scaled_qp(type, state->qp, (encoder->bitdepth - 8) * 6);
uint32_t log2_tr_width = kvz_math_floor_log2(height) + 2;
uint32_t log2_tr_height = kvz_math_floor_log2(width) + 2;
uint32_t log2_tr_width = kvz_math_floor_log2(height);
uint32_t log2_tr_height = kvz_math_floor_log2(width);
const int32_t scalinglist_type = (block_type == CU_INTRA ? 0 : 3) + (int8_t)("\0\3\1\2"[type]);
const int32_t *quant_coeff = encoder->scaling_list.quant_coeff[log2_tr_width - 2][log2_tr_height - 2][scalinglist_type][qp_scaled % 6];
const int32_t *quant_coeff = encoder->scaling_list.quant_coeff[log2_tr_width][log2_tr_height][scalinglist_type][qp_scaled % 6];
const int32_t transform_shift = MAX_TR_DYNAMIC_RANGE - encoder->bitdepth - ((log2_tr_height + log2_tr_width) >> 1); //!< Represents scaling through forward transform
const int32_t q_bits = QUANT_SHIFT + qp_scaled / 6 + transform_shift;
const int32_t add = ((state->frame->slicetype == KVZ_SLICE_I) ? 171 : 85) << (q_bits - 9);