From 3e9890a3944c4480e198020d7daea30f6a0a3ed0 Mon Sep 17 00:00:00 2001 From: Paul Wilkins Date: Thu, 9 Feb 2012 16:44:46 +0000 Subject: [PATCH] Merge Extended Q experiment. Merge the extended Q experiment as indicated by the Change-Id: I02d9e654fff9998cc7e9e2f1f5cd838dad8fb431 --- vp8/common/entropy.c | 14 ------- vp8/common/entropy.h | 4 -- vp8/common/generic/systemdependent.c | 4 -- vp8/common/idctllm.c | 29 +------------- vp8/common/onyxc_int.h | 6 --- vp8/common/quant_common.c | 52 ++------------------------ vp8/common/quant_common.h | 2 - vp8/decoder/dequantize.c | 18 +-------- vp8/decoder/detokenize.c | 9 +---- vp8/decoder/generic/dsystemdependent.c | 2 - vp8/decoder/onyxd_if.c | 2 - vp8/encoder/dct.c | 30 +-------------- vp8/encoder/encodemb.c | 21 ----------- vp8/encoder/generic/csystemdependent.c | 2 - vp8/encoder/onyx_if.c | 30 --------------- vp8/encoder/quantize.c | 23 ++---------- vp8/encoder/ratectrl.c | 32 ---------------- vp8/encoder/rdopt.c | 14 +------ 18 files changed, 14 insertions(+), 280 deletions(-) diff --git a/vp8/common/entropy.c b/vp8/common/entropy.c index 558ca4b10..b2cfb354f 100644 --- a/vp8/common/entropy.c +++ b/vp8/common/entropy.c @@ -119,14 +119,8 @@ static const Prob Pcat2[] = { 165, 145}; static const Prob Pcat3[] = { 173, 148, 140}; static const Prob Pcat4[] = { 176, 155, 140, 135}; static const Prob Pcat5[] = { 180, 157, 141, 134, 130}; -#if CONFIG_EXTEND_QRANGE static const Prob Pcat6[] = { 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129}; -#else -static const Prob Pcat6[] = -{ 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129}; - -#endif static vp8_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[26]; @@ -166,11 +160,7 @@ static void init_bit_trees() init_bit_tree(cat3, 3); init_bit_tree(cat4, 4); init_bit_tree(cat5, 5); -#if CONFIG_EXTEND_QRANGE init_bit_tree(cat6, 13); -#else - init_bit_tree(cat6, 11); -#endif } vp8_extra_bit_struct vp8_extra_bits[12] = @@ -185,11 +175,7 @@ vp8_extra_bit_struct vp8_extra_bits[12] = { cat3, Pcat3, 3, 11}, { cat4, Pcat4, 4, 19}, { cat5, Pcat5, 5, 35}, -#if CONFIG_EXTEND_QRANGE { cat6, Pcat6, 13, 67}, -#else - { cat6, Pcat6, 11, 67}, -#endif { 0, 0, 0, 0} }; diff --git a/vp8/common/entropy.h b/vp8/common/entropy.h index 3bce23da5..541aa4d4c 100644 --- a/vp8/common/entropy.h +++ b/vp8/common/entropy.h @@ -50,11 +50,7 @@ extern vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */ #define PROB_UPDATE_BASELINE_COST 7 #define MAX_PROB 255 -#if CONFIG_EXTEND_QRANGE #define DCT_MAX_VALUE 8192 -#else -#define DCT_MAX_VALUE 2048 -#endif /* Coefficients are predicted via a 3-dimensional probability table. */ diff --git a/vp8/common/generic/systemdependent.c b/vp8/common/generic/systemdependent.c index 445cd3f09..267b2f21a 100644 --- a/vp8/common/generic/systemdependent.c +++ b/vp8/common/generic/systemdependent.c @@ -156,16 +156,12 @@ void vp8_machine_specific_config(VP8_COMMON *ctx) #if ARCH_ARM vp8_arch_arm_common_init(ctx); #endif -#if CONFIG_EXTEND_QRANGE rtcd->idct.idct1 = vp8_short_idct4x4llm_1_c; rtcd->idct.idct16 = vp8_short_idct4x4llm_c; rtcd->idct.idct1_scalar_add = vp8_dc_only_idct_add_c; rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_c; rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_c; -#endif - - #if CONFIG_MULTITHREAD ctx->processor_core_count = get_cpu_count(); #endif /* CONFIG_MULTITHREAD */ diff --git a/vp8/common/idctllm.c b/vp8/common/idctllm.c index ba4beb4ca..c11386898 100644 --- a/vp8/common/idctllm.c +++ b/vp8/common/idctllm.c @@ -80,20 +80,11 @@ void vp8_short_idct4x4llm_c(short *input, short *output, int pitch) temp2 = (ip[3] * sinpi8sqrt2 + rounding) >> 16; d1 = temp1 + temp2; - -#if !CONFIG_EXTEND_QRANGE - op[0] = (a1 + d1 + 4) >> 3; - op[3] = (a1 - d1 + 4) >> 3; - - op[1] = (b1 + c1 + 4) >> 3; - op[2] = (b1 - c1 + 4) >> 3; -#else op[0] = (a1 + d1 + 16) >> 5; op[3] = (a1 - d1 + 16) >> 5; op[1] = (b1 + c1 + 16) >> 5; op[2] = (b1 - c1 + 16) >> 5; -#endif ip += shortpitch; op += shortpitch; @@ -106,11 +97,7 @@ void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch) int a1; short *op = output; int shortpitch = pitch >> 1; -#if !CONFIG_EXTEND_QRANGE - a1 = ((input[0] + 4) >> 3); -#else a1 = ((input[0] + 16) >> 5); -#endif for (i = 0; i < 4; i++) { op[0] = a1; @@ -123,11 +110,7 @@ void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch) void vp8_dc_only_idct_add_c(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride) { -#if !CONFIG_EXTEND_QRANGE - int a1 = ((input_dc + 4) >> 3); -#else int a1 = ((input_dc + 16) >> 5); -#endif int r, c; for (r = 0; r < 4; r++) @@ -189,17 +172,11 @@ void vp8_short_inv_walsh4x4_c(short *input, short *output) c2 = a1 - b1; d2 = d1 - c1; -#if !CONFIG_EXTEND_QRANGE - op[0] = (a2 + 3) >> 3; - op[1] = (b2 + 3) >> 3; - op[2] = (c2 + 3) >> 3; - op[3] = (d2 + 3) >> 3; -#else op[0] = (a2 + 1) >> 2; op[1] = (b2 + 1) >> 2; op[2] = (c2 + 1) >> 2; op[3] = (d2 + 1) >> 2; -#endif + ip += 4; op += 4; } @@ -211,11 +188,7 @@ void vp8_short_inv_walsh4x4_1_c(short *input, short *output) int a1; short *op = output; -#if !CONFIG_EXTEND_QRANGE - a1 = (input[0] + 3 )>> 3; -#else a1 = (input[0] + 1 )>> 2; -#endif for (i = 0; i < 4; i++) { diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h index c424b2a4d..338fc2d2d 100644 --- a/vp8/common/onyxc_int.h +++ b/vp8/common/onyxc_int.h @@ -33,14 +33,8 @@ void vp8_initialize_common(void); #define MINQ 0 -#if CONFIG_EXTEND_QRANGE #define MAXQ 255 #define QINDEX_BITS 8 -#else -#define MAXQ 127 -#define QINDEX_BITS 7 -#endif - #define QINDEX_RANGE (MAXQ + 1) diff --git a/vp8/common/quant_common.c b/vp8/common/quant_common.c index aa580a34e..0bb44f588 100644 --- a/vp8/common/quant_common.c +++ b/vp8/common/quant_common.c @@ -11,54 +11,21 @@ #include "quant_common.h" - -#if !CONFIG_EXTEND_QRANGE -static const int dc_qlookup[QINDEX_RANGE] = -{ - 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 17, - 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 91, 93, 95, 96, 98, 100, 101, 102, 104, 106, 108, 110, 112, 114, 116, 118, - 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 143, 145, 148, 151, 154, 157, -}; - -static const int ac_qlookup[QINDEX_RANGE] = -{ - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, - 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, - 110, 112, 114, 116, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146, 149, 152, - 155, 158, 161, 164, 167, 170, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, - 213, 217, 221, 225, 229, 234, 239, 245, 249, 254, 259, 264, 269, 274, 279, 284, -}; -#else - static int dc_qlookup[QINDEX_RANGE]; static int ac_qlookup[QINDEX_RANGE]; -#endif - -#if CONFIG_EXTEND_QRANGE #define ACDC_MIN 4 + void vp8_init_quant_tables() { int i; - //int current_val = 16; - //int last_val = 16; int current_val = 4; int last_val = 4; int ac_val; - //int dc_max; for ( i = 0; i < QINDEX_RANGE; i++ ) { ac_qlookup[i] = current_val; - //current_val = (int)((double)current_val * 1.018); current_val = (int)((double)current_val * 1.02); if ( current_val == last_val ) current_val++; @@ -68,14 +35,10 @@ void vp8_init_quant_tables() dc_qlookup[i] = (0.000000305 * ac_val * ac_val * ac_val) + (-0.00065 * ac_val * ac_val) + (0.9 * ac_val) + 0.5; - //dc_max = (int)(((double)ac_val * 0.75) + 0.5); - //if ( dc_qlookup[i] > dc_max ) - // dc_qlookup[i] = dc_max; if ( dc_qlookup[i] < ACDC_MIN ) dc_qlookup[i] = ACDC_MIN; } } -#endif int vp8_dc_quant(int QIndex, int Delta) { @@ -103,11 +66,8 @@ int vp8_dc2quant(int QIndex, int Delta) else if (QIndex < 0) QIndex = 0; -#if !CONFIG_EXTEND_QRANGE - retval = dc_qlookup[ QIndex ] * 2; -#else retval = dc_qlookup[ QIndex ]; -#endif + return retval; } @@ -150,15 +110,11 @@ int vp8_ac2quant(int QIndex, int Delta) QIndex = MAXQ; else if (QIndex < 0) QIndex = 0; -#if !CONFIG_EXTEND_QRANGE - retval = (ac_qlookup[ QIndex ] * 155) / 100; - if (retval < 8) - retval = 8; -#else + retval = (ac_qlookup[ QIndex ] * 775) / 1000; if (retval < 4) retval = 4; -#endif + return retval; } int vp8_ac_uv_quant(int QIndex, int Delta) diff --git a/vp8/common/quant_common.h b/vp8/common/quant_common.h index ea0383b3c..0d8099e9b 100644 --- a/vp8/common/quant_common.h +++ b/vp8/common/quant_common.h @@ -13,9 +13,7 @@ #include "blockd.h" #include "onyxc_int.h" -#if CONFIG_EXTEND_QRANGE extern void vp8_init_quant_tables(); -#endif extern int vp8_ac_yquant(int QIndex); extern int vp8_dc_quant(int QIndex, int Delta); extern int vp8_dc2quant(int QIndex, int Delta); diff --git a/vp8/decoder/dequantize.c b/vp8/decoder/dequantize.c index a39b544f5..83bf8a76c 100644 --- a/vp8/decoder/dequantize.c +++ b/vp8/decoder/dequantize.c @@ -131,11 +131,7 @@ void vp8_dequantize_b_2x2_c(BLOCKD *d) 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) { @@ -168,20 +164,12 @@ 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 + input[0]= (input[0] * dq[0]+2)>>2; // recover quantizer for 4 4x4 blocks for (i = 1; i < 64; i++) { -#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) { @@ -274,11 +262,7 @@ void vp8_dequant_dc_idct_add_8x8_c(short *input, short *dq, unsigned char *pred, #endif for (i = 1; i < 64; i++) { -#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/decoder/detokenize.c b/vp8/decoder/detokenize.c index fd134156b..3c0d7403d 100644 --- a/vp8/decoder/detokenize.c +++ b/vp8/decoder/detokenize.c @@ -78,13 +78,8 @@ DECLARE_ALIGNED(64, static const unsigned char, coef_bands_x_8x8[64]) = { #define CAT5_PROB3 157 #define CAT5_PROB4 180 -#if CONFIG_EXTEND_QRANGE static const unsigned char cat6_prob[14] = { 129, 130, 133, 140, 153, 177, 196, 230, 243, 249, 252, 254, 254, 0 }; -#else -static const unsigned char cat6_prob[12] = -{ 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254, 0 }; -#endif void vp8_reset_mb_tokens_context(MACROBLOCKD *x) { @@ -379,7 +374,7 @@ CHECK_0_8x8_: DECODE_AND_BRANCH_IF_ZERO(Prob[CAT_FIVE_CONTEXT_NODE], CAT_FIVE_CONTEXT_NODE_0_8x8_); val = CAT6_MIN_VAL; - bits_count = CONFIG_EXTEND_QRANGE?12:10; + bits_count = 12; do { DECODE_EXTRABIT_AND_ADJUST_VAL(cat6_prob[bits_count], bits_count); @@ -718,7 +713,7 @@ CHECK_0_: CAT_FIVE_CONTEXT_NODE_0_); val = CAT6_MIN_VAL; - bits_count = CONFIG_EXTEND_QRANGE?12:10; + bits_count = 12; do { diff --git a/vp8/decoder/generic/dsystemdependent.c b/vp8/decoder/generic/dsystemdependent.c index 40aa8bd6e..237bc6bc7 100644 --- a/vp8/decoder/generic/dsystemdependent.c +++ b/vp8/decoder/generic/dsystemdependent.c @@ -49,11 +49,9 @@ void vp8_dmachine_specific_config(VP8D_COMP *pbi) vp8_arch_arm_decode_init(pbi); #endif -#if CONFIG_EXTEND_QRANGE pbi->dequant.idct_add = vp8_dequant_idct_add_c; pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_c; pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_c; pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_c; pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_c; -#endif } diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c index d6f91ac58..a812d0e8e 100644 --- a/vp8/decoder/onyxd_if.c +++ b/vp8/decoder/onyxd_if.c @@ -124,9 +124,7 @@ void vp8dx_initialize() if (!init_done) { vp8_initialize_common(); -#if CONFIG_EXTEND_QRANGE vp8_init_quant_tables(); -#endif vp8_scale_machine_specific_config(); init_done = 1; } diff --git a/vp8/encoder/dct.c b/vp8/encoder/dct.c index 5c386e224..d6b3e77c5 100644 --- a/vp8/encoder/dct.c +++ b/vp8/encoder/dct.c @@ -36,11 +36,7 @@ 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++) @@ -140,17 +136,11 @@ void vp8_short_fdct4x4_c(short *input, short *output, int pitch) for (i = 0; i < 4; i++) { -#if CONFIG_EXTEND_QRANGE a1 = ((ip[0] + ip[3])<<5); b1 = ((ip[1] + ip[2])<<5); c1 = ((ip[1] - ip[2])<<5); d1 = ((ip[0] - ip[3])<<5); -#else - a1 = ((ip[0] + ip[3])<<3); - b1 = ((ip[1] + ip[2])<<3); - c1 = ((ip[1] - ip[2])<<3); - d1 = ((ip[0] - ip[3])<<3); -#endif + op[0] = a1 + b1; op[2] = a1 - b1; @@ -198,22 +188,12 @@ void vp8_short_walsh4x4_c(short *input, short *output, int pitch) for (i = 0; i < 4; i++) { -#if !CONFIG_EXTEND_QRANGE - a1 = ((ip[0] + ip[2])<<2); - d1 = ((ip[1] + ip[3])<<2); - c1 = ((ip[1] - ip[3])<<2); - b1 = ((ip[0] - ip[2])<<2); - - op[0] = a1 + d1 + (a1!=0); -#else a1 = ((ip[0] + ip[2])); d1 = ((ip[1] + ip[3])); c1 = ((ip[1] - ip[3])); b1 = ((ip[0] - ip[2])); - op[0] = a1 + d1; -#endif op[1] = b1 + c1; op[2] = b1 - c1; op[3] = a1 - d1; @@ -241,17 +221,11 @@ void vp8_short_walsh4x4_c(short *input, short *output, int pitch) c2 += c2<0; d2 += d2<0; -#if !CONFIG_EXTEND_QRANGE - op[0] = (a2+3) >> 3; - op[4] = (b2+3) >> 3; - op[8] = (c2+3) >> 3; - op[12]= (d2+3) >> 3; -#else op[0] = (a2+1) >> 2; op[4] = (b2+1) >> 2; op[8] = (c2+1) >> 2; op[12]= (d2+1) >> 2; -#endif + ip++; op++; } diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c index 7916066eb..42af30408 100644 --- a/vp8/encoder/encodemb.c +++ b/vp8/encoder/encodemb.c @@ -355,11 +355,7 @@ struct vp8_token_state{ // TODO: experiments to find optimal multiple numbers #define Y1_RD_MULT 4 #define UV_RD_MULT 2 -#if !CONFIG_EXTEND_QRANGE -#define Y2_RD_MULT 16 -#else #define Y2_RD_MULT 4 -#endif static const int plane_rd_mult[4]= { @@ -615,7 +611,6 @@ static void optimize_b(MACROBLOCK *mb, int ib, int type, *a = *l = (d->eob != !type); } -#if CONFIG_EXTEND_QRANGE /************************************************************************** our inverse hadamard transform effectively is weighted sum of all 16 inputs with weight either 1 or -1. It has a last stage scaling of (sum+1)>>2. And @@ -625,18 +620,6 @@ static void optimize_b(MACROBLOCK *mb, int ib, int type, fall between -65 and +65. **************************************************************************/ #define SUM_2ND_COEFF_THRESH 65 -#else - /************************************************************************** - our inverse hadamard transform effectively is weighted sum of all 16 inputs - with weight either 1 or -1. It has a last stage scaling of (sum+3)>>3. And - dc only idct is (dc+4)>>3. So if all the sums are between -35 and 29, the - output after inverse wht and idct will be all zero. A sum of absolute value - smaller than 35 guarantees all 16 different (+1/-1) weighted sums in wht - fall between -35 and +35. - **************************************************************************/ -#define SUM_2ND_COEFF_THRESH 35 - -#endif static void check_reset_2nd_coeffs(MACROBLOCKD *x, int type, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) @@ -1052,11 +1035,7 @@ void optimize_b_8x8(MACROBLOCK *mb, int i, int type, final_eob = i; rc = vp8_default_zig_zag1d_8x8[i]; qcoeff_ptr[rc] = x; -#if !CONFIG_EXTEND_QRANGE - dqcoeff_ptr[rc] = x * dequant_ptr[rc!=0]; -#else dqcoeff_ptr[rc] = (x * dequant_ptr[rc!=0]+2)>>2; -#endif next = tokens[i][best].next; best = (best_mask[best] >> i) & 1; diff --git a/vp8/encoder/generic/csystemdependent.c b/vp8/encoder/generic/csystemdependent.c index 021f74d37..f66c7524a 100644 --- a/vp8/encoder/generic/csystemdependent.c +++ b/vp8/encoder/generic/csystemdependent.c @@ -121,12 +121,10 @@ void vp8_cmachine_specific_config(VP8_COMP *cpi) vp8_arch_arm_encoder_init(cpi); #endif -#if CONFIG_EXTEND_QRANGE cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_c; cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_c; cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_c; cpi->rtcd.fdct.fast8x4 = vp8_short_fdct8x4_c; cpi->rtcd.fdct.walsh_short4x4 = vp8_short_walsh4x4_c; -#endif } diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index d8867d2ae..d06d12822 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -275,9 +275,7 @@ void vp8_initialize() vp8_initialize_common(); //vp8_dmachine_specific_config(); vp8_tokenize_initialize(); -#if CONFIG_EXTEND_QRANGE vp8_init_quant_tables(); -#endif vp8_init_me_luts(); init_minq_luts(); init_base_skip_probs(); @@ -1879,7 +1877,6 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi) // // Table that converts 0-63 Q range values passed in outside to the Qindex // range used internally. -#if CONFIG_EXTEND_QRANGE static const int q_trans[] = { 0, 4, 8, 12, 16, 20, 24, 28, @@ -1891,19 +1888,6 @@ static const int q_trans[] = 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 249, 255, }; -#else -static const int q_trans[] = -{ - 0, 1, 2, 3, 4, 5, 7, 8, - 9, 10, 12, 13, 15, 17, 18, 19, - 20, 21, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 33, 35, 37, 39, 41, - 43, 45, 47, 49, 51, 53, 55, 57, - 59, 61, 64, 67, 70, 73, 76, 79, - 82, 85, 88, 91, 94, 97, 100, 103, - 106, 109, 112, 115, 118, 121, 124, 127, -}; -#endif int vp8_reverse_trans(int x) { @@ -3500,12 +3484,6 @@ static int decide_key_frame(VP8_COMP *cpi) } -/*#if !CONFIG_EXTEND_QRANGE -#define FIRSTPASS_QINDEX 26 -#else -#define FIRSTPASS_QINDEX 49 -#endif*/ - int find_fp_qindex() { int i; @@ -5062,11 +5040,7 @@ static void encode_frame_to_data_rate (cpi->oxcf.starting_buffer_level-cpi->bits_off_target), (int)cpi->total_actual_bits, vp8_convert_qindex_to_q(cm->base_qindex), -#if CONFIG_EXTEND_QRANGE (double)vp8_dc_quant(cm->base_qindex,0)/4.0, -#else - (double)vp8_dc_quant(cm->base_qindex,0), -#endif vp8_convert_qindex_to_q(cpi->active_best_quality), vp8_convert_qindex_to_q(cpi->active_worst_quality), cpi->avg_q, @@ -5094,11 +5068,7 @@ static void encode_frame_to_data_rate (cpi->oxcf.starting_buffer_level-cpi->bits_off_target), (int)cpi->total_actual_bits, vp8_convert_qindex_to_q(cm->base_qindex), -#if CONFIG_EXTEND_QRANGE (double)vp8_dc_quant(cm->base_qindex,0)/4.0, -#else - (double)vp8_dc_quant(cm->base_qindex,0), -#endif vp8_convert_qindex_to_q(cpi->active_best_quality), vp8_convert_qindex_to_q(cpi->active_worst_quality), cpi->avg_q, diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index d80122d01..1fc39b343 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -460,9 +460,7 @@ 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) { @@ -511,11 +509,7 @@ 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) { @@ -572,10 +566,7 @@ void vp8_regular_quantize_b_2x2(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) @@ -636,9 +627,7 @@ 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) { @@ -971,11 +960,8 @@ void vp8cx_init_quantizer(VP8_COMP *cpi) for (Q = 0; Q < QINDEX_RANGE; Q++) { -#if CONFIG_EXTEND_QRANGE int qzbin_factor = (vp8_dc_quant(Q,0) < 148) ? 84 : 80; -#else - int qzbin_factor = (vp8_dc_quant(Q,0) < 37) ? 84: 80; -#endif + // dc values quant_val = vp8_dc_quant(Q, cpi->common.y1dc_delta_q); cpi->Y1quant_fast[Q][0] = (1 << 16) / quant_val; @@ -1046,14 +1032,11 @@ void vp8cx_init_quantizer(VP8_COMP *cpi) int Q; int zbin_boost[16] = {0, 0, 8, 10, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 44, 44}; int qrounding_factor = 48; -#if CONFIG_EXTEND_QRANGE - int qzbin_factor = vp8_dc_quant(Q,0) < 148 ) ? 84: 80; -#else - int qzbin_factor = vp8_dc_quant(Q,0) < 37 ) ? 84: 80; -#endif for (Q = 0; Q < QINDEX_RANGE; Q++) { + int qzbin_factor = vp8_dc_quant(Q,0) < 148 ) ? 84: 80; + // dc values quant_val = vp8_dc_quant(Q, cpi->common.y1dc_delta_q); cpi->Y1quant[Q][0] = (1 << 16) / quant_val; diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index ddd97b75e..83768b32f 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -45,28 +45,6 @@ extern int inter_b_modes[B_MODE_COUNT]; // Bits Per MB at different Q (Multiplied by 512) #define BPER_MB_NORMBITS 9 -#if !CONFIG_EXTEND_QRANGE -static const int kf_gf_boost_qlimits[QINDEX_RANGE] = -{ - 150, 155, 160, 165, 170, 175, 180, 185, - 190, 195, 200, 205, 210, 215, 220, 225, - 230, 235, 240, 245, 250, 255, 260, 265, - 270, 275, 280, 285, 290, 295, 300, 305, - 310, 320, 330, 340, 350, 360, 370, 380, - 390, 400, 410, 420, 430, 440, 450, 460, - 470, 480, 490, 500, 510, 520, 530, 540, - 550, 560, 570, 580, 590, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, -}; -#endif - // % adjustment to target kf size based on seperation from previous frame static const int kf_boost_seperation_adjustment[16] = { @@ -117,12 +95,8 @@ static const unsigned int prior_key_frame_weight[KEY_FRAME_CONTEXT] = { 1, 2, 3, // tables if and when things settle down in the experimental bitstream double vp8_convert_qindex_to_q( int qindex ) { -#if CONFIG_EXTEND_QRANGE // Convert the index to a real Q value (scaled down to match old Q values) return (double)vp8_ac_yquant( qindex, 0 ) / 4.0; -#else - return (double)vp8_ac_yquant( qindex, 0 ); -#endif } int vp8_gfboost_qadjust( int qindex ) @@ -494,18 +468,12 @@ static void calc_gf_params(VP8_COMP *cpi) } // Apply an upper limit based on Q for 1 pass encodes -#if !CONFIG_EXTEND_QRANGE - if (Boost > kf_gf_boost_qlimits[Q] && (cpi->pass == 0)) - Boost = kf_gf_boost_qlimits[Q]; -#else // TODO. // This is a temporay measure oas one pass not really supported yet in // the experimental branch if (Boost > 600 && (cpi->pass == 0)) Boost = 600; -#endif - // Apply lower limits to boost. else if (Boost < 110) Boost = 110; diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 10686688c..d9409b32f 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -251,12 +251,7 @@ int compute_rd_mult( int qindex ) int q; q = vp8_dc_quant(qindex,0); -#if CONFIG_EXTEND_QRANGE return (3 * q * q) >> 4; -#else - return (3 * q * q); -#endif - } void vp8cx_initialize_me_consts(VP8_COMP *cpi, int QIndex) @@ -309,13 +304,10 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex) vp8_set_speed_features(cpi); -#if CONFIG_EXTEND_QRANGE q = (int)pow(vp8_dc_quant(QIndex,0)>>2, 1.25); q = q << 2; cpi->RDMULT = cpi->RDMULT << 4; -#else - q = (int)pow(vp8_dc_quant(QIndex,0), 1.25); -#endif + if (q < 8) q = 8; @@ -659,11 +651,7 @@ static void macro_block_yrd( MACROBLOCK *mb, // Distortion d = ENCODEMB_INVOKE(rtcd, mberr)(mb, 1) << 2; -#if CONFIG_EXTEND_QRANGE d += ENCODEMB_INVOKE(rtcd, berr)(mb_y2->coeff, x_y2->dqcoeff)<<2; -#else - d += ENCODEMB_INVOKE(rtcd, berr)(mb_y2->coeff, x_y2->dqcoeff); -#endif *Distortion = (d >> 4); -- 2.40.0