shithub: libvpx

Download patch

ref: 716c1d5ff512135577ba80d336f0c572c987db21
parent: ccada0636b6783598af4f6a35d90b13b6b5d39b3
author: Marco <[email protected]>
date: Wed Feb 15 04:18:34 EST 2017

Vp9: Speed 8 aq-mode=3: Reduce computation in estimating bits per mb.

vp9_compute_qdelta_by_rate has almost 2% overhead in profiling on Nexus 6.
Reduce the calling of that function in speed 8 by estimating the delta-q.
Both rtc and rtc_derf show little/no change in avg psnr/ssim.
Encoding speed is 2~3% faster on Nexus 6.

Change-Id: If25933715783f31104a18a5092ea347b1221b5f5

--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -128,8 +128,7 @@
   CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
   int bits_per_mb;
   int num8x8bl = cm->MBs << 2;
-  // Compute delta-q corresponding to qindex i.
-  int deltaq = compute_deltaq(cpi, i, cr->rate_ratio_qdelta);
+  int deltaq = 0;
   // Weight for segment prior to encoding: take the average of the target
   // number for the frame to be encoded and the actual from the previous frame.
   // Use the target if its less.
@@ -142,6 +141,12 @@
       num8x8bl;
   if (weight_segment_target < 7 * weight_segment / 8)
     weight_segment = weight_segment_target;
+  // Compute delta-q corresponding to qindex i.
+  // Take a quick estimate for speed >=8, half of the max allowed deltaq.
+  if (cpi->oxcf.speed < 8)
+    deltaq = compute_deltaq(cpi, i, cr->rate_ratio_qdelta);
+  else
+    deltaq = -(cr->max_qdelta_perc * i) / 200;
   // Take segment weighted average for bits per mb.
   bits_per_mb = (int)((1.0 - weight_segment) *
                           vp9_rc_bits_per_mb(cm->frame_type, i,