Commit 982b061d authored by Yaowu Xu's avatar Yaowu Xu
Browse files

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
parent a0ed4e63
......@@ -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
......
......@@ -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++)
......
......@@ -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;
......
......@@ -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)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment