shithub: libvpx

Download patch

ref: 00e3626e13f27112d23b58fedce4bda7395ff793
parent: aabedc8807d21734706581f661bfc8d926db1b79
author: Paul Wilkins <[email protected]>
date: Tue Nov 25 09:54:55 EST 2014

Use average mb energy from first pass in AQ2 test.

AQ2 modified to use mb_av_energy in defining variance
thresholds used alongside complexity when defining the
segment to be used for an SB64.

Slight improvements in metrics (ssim and PSNR).

Change-Id: Idb9cb73f7d9c4f7118cd7e84ac77b0f25cacbf81

--- a/vp9/encoder/vp9_aq_complexity.c
+++ b/vp9/encoder/vp9_aq_complexity.c
@@ -23,7 +23,7 @@
   {{1.0, 1.0, 1.0}, {1.0, 2.0, 1.0}, {1.0, 1.5, 2.5}};
 static const double aq_c_transitions[AQ_C_STRENGTHS][AQ_C_SEGMENTS] =
   {{1.0, 1.0, 1.0}, {1.0, 0.25, 0.0}, {1.0, 0.5, 0.25}};
-static const double aq_c_var_thresholds[AQ_C_SEGMENTS] = {100.0, 12.0, 10.0};
+static const double aq_c_var_thresholds[AQ_C_SEGMENTS] = {100.0, -1.0, -2.0};
 
 static int get_aq_c_strength(int q_index, vpx_bit_depth_t bit_depth) {
   // Approximate base quatizer (truncated to int)
@@ -90,6 +90,8 @@
   }
 }
 
+#define DEFAULT_LV_THRESH 10.0
+
 // Select a segment for the current SB64 block.
 // The choice of segment for a block depends on the ratio of the projected
 // bits for the block vs a target average.
@@ -122,7 +124,12 @@
     const int aq_strength = get_aq_c_strength(cm->base_qindex, cm->bit_depth);
     const int active_segments = aq_c_active_segments[aq_strength];
     double logvar;
+    double low_var_thresh;
 
+    vp9_clear_system_state();
+    low_var_thresh =
+      (cpi->oxcf.pass == 2) ? cpi->twopass.mb_av_energy : DEFAULT_LV_THRESH;
+
     vp9_setup_src_planes(mb, cpi->Source, mi_row, mi_col);
     logvar = vp9_log_block_var(cpi, mb, bs);
 
@@ -136,7 +143,7 @@
     while (segment > 0) {
       if ((projected_rate <
           target_rate * aq_c_transitions[aq_strength][segment]) &&
-          (logvar < aq_c_var_thresholds[segment])) {
+          (logvar < (low_var_thresh + aq_c_var_thresholds[segment]))) {
         break;
       }
       --segment;