diff options
author | Yaowu Xu <yaowu@google.com> | 2011-11-10 12:54:22 -0800 |
---|---|---|
committer | Yaowu Xu <yaowu@google.com> | 2011-11-11 07:31:00 -0800 |
commit | 982b061dc2f39cb4a7505260a856ce870ba7ba1c (patch) | |
tree | f27ad2f3d695162c567407b80ac4d1fb05b29350 /vp8 | |
parent | a0ed4e63802a395c6147b5abb70311f50b98d95e (diff) | |
download | libvpx-982b061dc2f39cb4a7505260a856ce870ba7ba1c.tar libvpx-982b061dc2f39cb4a7505260a856ce870ba7ba1c.tar.gz libvpx-982b061dc2f39cb4a7505260a856ce870ba7ba1c.tar.bz2 libvpx-982b061dc2f39cb4a7505260a856ce870ba7ba1c.zip |
Make 8x8 and extend_qrange to work together
This commit added scaling factors to 8x8 transform, quant, dequant and
inverse transform pipeline to make 8x8 transform to work when configed
with enable-extend_qrange. This commit also disabled the trellis-quant
when extend_qrange is configured.
Change-Id: Icfb3192e4746f70a4bb35ad18b7b47705b657e52
Diffstat (limited to 'vp8')
-rw-r--r-- | vp8/decoder/dequantize.c | 25 | ||||
-rw-r--r-- | vp8/encoder/dct.c | 4 | ||||
-rw-r--r-- | vp8/encoder/encodemb.c | 12 | ||||
-rw-r--r-- | vp8/encoder/quantize.c | 17 |
4 files changed, 55 insertions, 3 deletions
diff --git a/vp8/decoder/dequantize.c b/vp8/decoder/dequantize.c index 956acba8f..903d44a3f 100644 --- a/vp8/decoder/dequantize.c +++ b/vp8/decoder/dequantize.c @@ -131,7 +131,11 @@ void vp8_dequantize_b_8x8_c(BLOCKD *d)//just for 2x2 haar transform for (i = 0; i < 16; i++) { +#if CONFIG_EXTEND_QRANGE + DQ[i] = (short)((Q[i] * DQC[i]+2)>>2); +#else DQ[i] = (short)(Q[i] * DQC[i]); +#endif } #ifdef DEC_DEBUG if (dec_debug) { @@ -163,10 +167,21 @@ void vp8_dequant_idct_add_8x8_c(short *input, short *dq, unsigned char *pred, } } #endif + +#if CONFIG_EXTEND_QRANGE + input[0]= (input[0] * dq[0]+2)>>2; +#else + input[0]= input[0] * dq[0]; +#endif + // recover quantizer for 4 4x4 blocks - for (i = 0; i < 64; i++) + for (i = 1; i < 64; i++) { - input[i]=input[i] * dq[i!=0]; +#if CONFIG_EXTEND_QRANGE + input[i]=(input[i] * dq[1]+2)>>2; +#else + input[i]=input[i] * dq[1]; +#endif } #ifdef DEC_DEBUG if (dec_debug) { @@ -259,7 +274,11 @@ void vp8_dequant_dc_idct_add_8x8_c(short *input, short *dq, unsigned char *pred, #endif for (i = 1; i < 64; i++) { - input[i] = input[i] * dq[i!=0]; +#if CONFIG_EXTEND_QRANGE + input[i]=(input[i] * dq[1]+2)>>2; +#else + input[i]=input[i] * dq[1]; +#endif } #ifdef DEC_DEBUG diff --git a/vp8/encoder/dct.c b/vp8/encoder/dct.c index fd4c62cd4..5c386e224 100644 --- a/vp8/encoder/dct.c +++ b/vp8/encoder/dct.c @@ -36,7 +36,11 @@ void vp8_short_fdct8x8_c(short *block, short *coefs, int pitch) { for (j = 0; j < 8; j++) { +#if !CONFIG_EXTEND_QRANGE b[j] = (float)( block[k + j]<<1); +#else + b[j] = (float)( block[k + j]<<3); +#endif } /* Horizontal transform */ for (j = 0; j < 4; j++) diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c index 0711a1468..ead1686b5 100644 --- a/vp8/encoder/encodemb.c +++ b/vp8/encoder/encodemb.c @@ -1075,6 +1075,9 @@ void optimize_mb_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) ENTROPY_CONTEXT *ta; ENTROPY_CONTEXT *tl; +#if CONFIG_EXTEND_QRANGE +return ; +#endif vpx_memcpy(&t_above, x->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES)); vpx_memcpy(&t_left, x->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES)); @@ -1164,6 +1167,11 @@ void vp8_optimize_mby_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) ENTROPY_CONTEXT *ta; ENTROPY_CONTEXT *tl; +#if CONFIG_EXTEND_QRANGE +return ; +#endif + + if (!x->e_mbd.above_context) return; @@ -1228,6 +1236,10 @@ void vp8_optimize_mbuv_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) ENTROPY_CONTEXT *ta; ENTROPY_CONTEXT *tl; +#if CONFIG_EXTEND_QRANGE +return ; +#endif + if (!x->e_mbd.above_context) return; diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index e95fa60e6..8bbc0d0a5 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -458,6 +458,9 @@ void vp8_fast_quantize_b_2x2_c(BLOCK *b, BLOCKD *d) qcoeff_ptr[rc] = x; // write to destination //dqcoeff_ptr[rc] = x * dequant_ptr[rc] / q2nd; // dequantized value dqcoeff_ptr[rc] = x * dequant_ptr[rc]; // dequantized value +#if CONFIG_EXTEND_QRANGE + dqcoeff_ptr[rc] = (dqcoeff_ptr[rc]+2)>>2; +#endif if (y) { @@ -506,6 +509,12 @@ void vp8_fast_quantize_b_8x8_c(BLOCK *b, BLOCKD *d) qcoeff_ptr[rc] = x; // write to destination //dqcoeff_ptr[rc] = x * dequant_ptr[rc!=0] / q1st; // dequantized value dqcoeff_ptr[rc] = x * dequant_ptr[rc!=0]; // dequantized value + +#if CONFIG_EXTEND_QRANGE + dqcoeff_ptr[rc] = (dqcoeff_ptr[rc]+2)>>2; +#endif + + if (y) { eob = i; // last nonzero coeffs @@ -562,6 +571,11 @@ void vp8_regular_quantize_b_2x2(BLOCK *b, BLOCKD *d) //dqcoeff_ptr[rc] = x * dequant_ptr[rc]/q2nd; // dequantized value dqcoeff_ptr[rc] = x * dequant_ptr[rc]; // dequantized value +#if CONFIG_EXTEND_QRANGE + dqcoeff_ptr[rc] = (dqcoeff_ptr[rc]+2)>>2; +#endif + + if (y) { eob = i; // last nonzero coeffs @@ -620,6 +634,9 @@ void vp8_regular_quantize_b_8x8(BLOCK *b, BLOCKD *d) qcoeff_ptr[rc] = x; // write to destination //dqcoeff_ptr[rc] = x * dequant_ptr[rc!=0] / q1st; // dequantized value dqcoeff_ptr[rc] = x * dequant_ptr[rc!=0]; // dequantized value +#if CONFIG_EXTEND_QRANGE + dqcoeff_ptr[rc] = (dqcoeff_ptr[rc]+2)>>2; +#endif if (y) { |