From 31b6d7c1eb6a1527c06bf7d4691460e195c799f2 Mon Sep 17 00:00:00 2001 From: Paul Wilkins Date: Fri, 7 Nov 2014 14:11:29 +0000 Subject: [PATCH] AQ1 - remove first pass weights. Removed redundant weighting function tied for AQ1 from first pass code. Improvment in baseline AQ1 results:- Derf opsnr +0.142% SSIm +0.258% YT opsnr +0.173% SSIm +0.3% Change-Id: I16ef91caf2d7f302cd5940cc5e2626d48ebcb212 --- vp9/encoder/vp9_aq_variance.c | 8 -------- vp9/encoder/vp9_aq_variance.h | 1 - vp9/encoder/vp9_firstpass.c | 23 ----------------------- 3 files changed, 32 deletions(-) diff --git a/vp9/encoder/vp9_aq_variance.c b/vp9/encoder/vp9_aq_variance.c index 7d75f09a4..7ee9662e9 100644 --- a/vp9/encoder/vp9_aq_variance.c +++ b/vp9/encoder/vp9_aq_variance.c @@ -52,14 +52,6 @@ double vp9_vaq_rdmult_ratio(int energy) { return RDMULT_RATIO(energy); } -double vp9_vaq_inv_q_ratio(int energy) { - ENERGY_IN_BOUNDS(energy); - - vp9_clear_system_state(); - - return Q_RATIO(-energy); -} - void vp9_vaq_init() { int i; double base_ratio; diff --git a/vp9/encoder/vp9_aq_variance.h b/vp9/encoder/vp9_aq_variance.h index d1a459fe9..73ce2eb13 100644 --- a/vp9/encoder/vp9_aq_variance.h +++ b/vp9/encoder/vp9_aq_variance.h @@ -20,7 +20,6 @@ extern "C" { unsigned int vp9_vaq_segment_id(int energy); double vp9_vaq_rdmult_ratio(int energy); -double vp9_vaq_inv_q_ratio(int energy); void vp9_vaq_init(); void vp9_vaq_frame_setup(VP9_COMP *cpi); diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 85b2db146..327082fcd 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -593,7 +593,6 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { for (mb_col = 0; mb_col < cm->mb_cols; ++mb_col) { int this_error; const int use_dc_pred = (mb_col || mb_row) && (!mb_col || !mb_row); - double error_weight = 1.0; const BLOCK_SIZE bsize = get_bsize(cm, mb_row, mb_col); double log_intra; int level_sample; @@ -615,11 +614,6 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { mb_col << 1, num_8x8_blocks_wide_lookup[bsize], cm->mi_rows, cm->mi_cols); - if (cpi->oxcf.aq_mode == VARIANCE_AQ) { - const int energy = vp9_block_energy(cpi, x, bsize); - error_weight = vp9_vaq_inv_q_ratio(energy); - } - // Do intra 16x16 prediction. x->skip_encode = 0; xd->mi[0].src_mi->mbmi.mode = DC_PRED; @@ -665,11 +659,6 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { else brightness_factor += 1.0; - if (cpi->oxcf.aq_mode == VARIANCE_AQ) { - vp9_clear_system_state(); - this_error = (int)(this_error * error_weight); - } - // Intrapenalty below deals with situations where the intra and inter // error scores are very low (e.g. a plain black frame). // We do not have special cases in first pass for 0,0 and nearest etc so @@ -741,20 +730,12 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { // Test last reference frame using the previous best mv as the // starting point (best reference) for the search. first_pass_motion_search(cpi, x, &best_ref_mv, &mv, &motion_error); - if (cpi->oxcf.aq_mode == VARIANCE_AQ) { - vp9_clear_system_state(); - motion_error = (int)(motion_error * error_weight); - } // If the current best reference mv is not centered on 0,0 then do a // 0,0 based search as well. if (!is_zero_mv(&best_ref_mv)) { tmp_err = INT_MAX; first_pass_motion_search(cpi, x, &zero_mv, &tmp_mv, &tmp_err); - if (cpi->oxcf.aq_mode == VARIANCE_AQ) { - vp9_clear_system_state(); - tmp_err = (int)(tmp_err * error_weight); - } if (tmp_err < motion_error) { motion_error = tmp_err; @@ -785,10 +766,6 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { first_pass_motion_search(cpi, x, &zero_mv, &tmp_mv, &gf_motion_error); - if (cpi->oxcf.aq_mode == VARIANCE_AQ) { - vp9_clear_system_state(); - gf_motion_error = (int)(gf_motion_error * error_weight); - } if (gf_motion_error < motion_error && gf_motion_error < this_error) ++second_ref_count;