From 3d8e14f58b2b84233c11114c263d56c602e837e7 Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Thu, 10 Oct 2013 15:22:25 +0300 Subject: [PATCH] Fixed dequantization of inter-blocks --- src/encoder.c | 6 +++--- src/transform.c | 4 ++-- src/transform.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/encoder.c b/src/encoder.c index 8cd2b7c6..43795ef4 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -1573,7 +1573,7 @@ void encode_transform_tree(encoder_control *encoder, transform_info *ti, // if non-zero coeffs if (cb_y) { // RECONSTRUCT for predictions - dequant(encoder, coeff_y, pre_quant_coeff, width, width, 0); + dequant(encoder, coeff_y, pre_quant_coeff, width, width, 0, ti->block_type); itransform2d(block,pre_quant_coeff,width,0); i = 0; @@ -1646,7 +1646,7 @@ void encode_transform_tree(encoder_control *encoder, transform_info *ti, if (cb_u) { // RECONSTRUCT for predictions - dequant(encoder, coeff_u, pre_quant_coeff, width >> 1, width >> 1, 2); + dequant(encoder, coeff_u, pre_quant_coeff, width >> 1, width >> 1, 2, ti->block_type); itransform2d(block,pre_quant_coeff,LCU_WIDTH>>(depth+1),65535); i = 0; @@ -1672,7 +1672,7 @@ void encode_transform_tree(encoder_control *encoder, transform_info *ti, if (cb_v) { // RECONSTRUCT for predictions - dequant(encoder, coeff_v, pre_quant_coeff, width >> 1, width >> 1, 3); + dequant(encoder, coeff_v, pre_quant_coeff, width >> 1, width >> 1, 3, ti->block_type); itransform2d(block,pre_quant_coeff,LCU_WIDTH>>(depth+1),65535); i = 0; diff --git a/src/transform.c b/src/transform.c index c02deabc..2340c7ae 100644 --- a/src/transform.c +++ b/src/transform.c @@ -903,7 +903,7 @@ void quant(encoder_control *encoder, int16_t *coef, int16_t *q_coef, int32_t wid * \brief inverse quantize transformed and quantized coefficents * */ -void dequant(encoder_control *encoder, int16_t *q_coef, int16_t *coef, int32_t width, int32_t height,int8_t type) +void dequant(encoder_control *encoder, int16_t *q_coef, int16_t *coef, int32_t width, int32_t height,int8_t type, int8_t block_type) { int32_t shift,add,coeff_q; uint32_t log2_tr_size = g_convert_to_bit[ width ] + 2; @@ -912,7 +912,7 @@ void dequant(encoder_control *encoder, int16_t *q_coef, int16_t *coef, int32_t w int32_t transform_shift = 15 - g_bitdepth - (g_convert_to_bit[ width ] + 2); int32_t qp_scaled; int32_t qp_base = encoder->QP; - int32_t scalinglist_type = (/*pcCU->isintra(uiAbsPartIdx)*/1 ? 0 : 3) + (int8_t)("\0\3\1\2"[type]); + int32_t scalinglist_type = (block_type == CU_INTRA ? 0 : 3) + (int8_t)("\0\3\1\2"[type]); int32_t *dequant_coef; if (type == 0) { diff --git a/src/transform.h b/src/transform.h index e11fe58c..7c77460e 100644 --- a/src/transform.h +++ b/src/transform.h @@ -24,7 +24,7 @@ extern const uint8_t g_chroma_scale[58]; void quant(encoder_control *encoder, int16_t *coef, int16_t *q_coef, int32_t width, int32_t height, uint32_t *ac_sum, int8_t type, int8_t scan_idx, int8_t block_type); -void dequant(encoder_control *encoder, int16_t *q_coef, int16_t *coef, int32_t width, int32_t height,int8_t type); +void dequant(encoder_control *encoder, int16_t *q_coef, int16_t *coef, int32_t width, int32_t height,int8_t type, int8_t block_type); void transform2d(int16_t *block,int16_t *coeff, int8_t block_size, int32_t mode); void itransform2d(int16_t *block,int16_t *coeff, int8_t block_size, int32_t mode);