diff options
author | Paul Wilkins <paulwilkins@google.com> | 2012-02-09 16:44:46 +0000 |
---|---|---|
committer | Paul Wilkins <paulwilkins@google.com> | 2012-02-09 17:22:34 +0000 |
commit | 3e9890a3944c4480e198020d7daea30f6a0a3ed0 (patch) | |
tree | 3c50220b372bc5617474840e1aea48a8ea1c480e /vp8/encoder | |
parent | cf8af867dddc7830cf42577dd9bb27bf0330a682 (diff) | |
download | libvpx-3e9890a3944c4480e198020d7daea30f6a0a3ed0.tar libvpx-3e9890a3944c4480e198020d7daea30f6a0a3ed0.tar.gz libvpx-3e9890a3944c4480e198020d7daea30f6a0a3ed0.tar.bz2 libvpx-3e9890a3944c4480e198020d7daea30f6a0a3ed0.zip |
Merge Extended Q experiment.
Merge the extended Q experiment as indicated by the
Change-Id: I02d9e654fff9998cc7e9e2f1f5cd838dad8fb431
Diffstat (limited to 'vp8/encoder')
-rw-r--r-- | vp8/encoder/dct.c | 30 | ||||
-rw-r--r-- | vp8/encoder/encodemb.c | 21 | ||||
-rw-r--r-- | vp8/encoder/generic/csystemdependent.c | 2 | ||||
-rw-r--r-- | vp8/encoder/onyx_if.c | 30 | ||||
-rw-r--r-- | vp8/encoder/quantize.c | 23 | ||||
-rw-r--r-- | vp8/encoder/ratectrl.c | 32 | ||||
-rw-r--r-- | vp8/encoder/rdopt.c | 14 |
7 files changed, 6 insertions, 146 deletions
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); |