mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 12:44:07 +00:00
[isp] Modify quantization functions to work with non-square blocks.
This commit is contained in:
parent
31c8f1356f
commit
50ad91a94e
|
@ -380,13 +380,15 @@ void uvg_quant_avx2(const encoder_state_t * const state, const coeff_t * __restr
|
|||
int32_t height, color_t color, int8_t scan_idx, int8_t block_type, int8_t transform_skip, uint8_t lfnst_idx)
|
||||
{
|
||||
const encoder_control_t * const encoder = state->encoder_control;
|
||||
const uint32_t log2_block_size = uvg_g_convert_to_bit[width] + 2;
|
||||
const uint32_t * const scan = uvg_g_sig_last_scan[scan_idx][log2_block_size - 1];
|
||||
//const uint32_t log2_block_size = uvg_g_convert_to_bit[width] + 2;
|
||||
//const uint32_t * const old_scan = uvg_g_sig_last_scan[scan_idx][log2_block_size - 1];
|
||||
const uint32_t log2_tr_width = uvg_g_convert_to_bit[width] + 2;
|
||||
const uint32_t log2_tr_height = uvg_g_convert_to_bit[height] + 2;
|
||||
const uint32_t* const scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_idx, log2_tr_width, log2_tr_height);
|
||||
|
||||
int32_t qp_scaled = uvg_get_scaled_qp(color, state->qp, (encoder->bitdepth - 8) * 6, encoder->qp_map[0]);
|
||||
qp_scaled = transform_skip ? MAX(qp_scaled, 4 + 6 * MIN_QP_PRIME_TS) : qp_scaled;
|
||||
uint32_t log2_tr_width = uvg_math_floor_log2(height);
|
||||
uint32_t log2_tr_height = uvg_math_floor_log2(width);
|
||||
|
||||
const int32_t scalinglist_type = (block_type == CU_INTRA ? 0 : 3) + (int8_t)color;
|
||||
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_width + log2_tr_height) >> 1); //!< Represents scaling through forward transform
|
||||
|
@ -501,6 +503,7 @@ void uvg_quant_avx2(const encoder_state_t * const state, const coeff_t * __restr
|
|||
__m256i v_coef, q_coefs;
|
||||
__m256i v_quant_coeff_lo, v_quant_coeff_hi;
|
||||
|
||||
// ISP_TODO: do these avx common functions need height?
|
||||
scanord_read_vector(coeffs, scan, scan_idx, subpos, width, result_coeffs, 2);
|
||||
|
||||
v_coef = result_coeffs[0];
|
||||
|
|
|
@ -62,14 +62,16 @@ void uvg_quant_generic(
|
|||
uint8_t lfnst_idx)
|
||||
{
|
||||
const encoder_control_t * const encoder = state->encoder_control;
|
||||
const uint32_t log2_block_size = uvg_g_convert_to_bit[width] + 2;
|
||||
// ISP_TODO: width & height affect scan order
|
||||
const uint32_t * const scan = uvg_g_sig_last_scan[scan_idx][log2_block_size - 1];
|
||||
const uint32_t log2_tr_width = uvg_g_convert_to_bit[width] + 2;
|
||||
const uint32_t log2_tr_height = uvg_g_convert_to_bit[height] + 2;
|
||||
//const uint32_t log2_block_size = uvg_g_convert_to_bit[width] + 2;
|
||||
//const uint32_t * const old_scan = uvg_g_sig_last_scan[scan_idx][log2_block_size - 1];
|
||||
const uint32_t * const scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_idx, log2_tr_width, log2_tr_height);
|
||||
|
||||
int32_t qp_scaled = uvg_get_scaled_qp(color, state->qp, (encoder->bitdepth - 8) * 6, encoder->qp_map[0]);
|
||||
qp_scaled = transform_skip ? MAX(qp_scaled, 4 + 6 * MIN_QP_PRIME_TS) : qp_scaled;
|
||||
uint32_t log2_tr_width = uvg_math_floor_log2(height);
|
||||
uint32_t log2_tr_height = uvg_math_floor_log2(width);
|
||||
|
||||
|
||||
const int32_t scalinglist_type = (block_type == CU_INTRA ? 0 : 3) + (int8_t)color;
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue