shithub: libvpx

Download patch

ref: 570b6d25c0498f77339db28a291cab87de2d3ea2
parent: d77b9d1ce9f560d0fff92dd22c0d024466b25148
author: Paul Wilkins <paulwilkins@google.com>
date: Fri Dec 6 08:17:34 EST 2013

Remove rate correction factor.

Removed an adaptive rate correction factor that was having
a negative impact on quality in many clips. This factor
was influencing the Q range available to each frame
independently of the bits allocated to each.

Average results with DISABLE_RC_LONG_TERM_MEM.

derf +0.199, -0.059.
yt +3.957, +3.798
std hd +1.577, +2.140
yt hd +4.127, +4.513

Average results without  DISABLE_RC_LONG_TERM_MEM

derf -0.628, -0.665
yt +3.432, +3.015
std hd -0.105, +0.153
yt hd +3.432, +3.015

Change-Id: I45bab6b606f49a442e7b27a6d631f3ffd843bbce

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1030,22 +1030,6 @@
     sr_correction = 0.75;
   }
 
-  // Calculate a corrective factor based on a rolling ratio of bits spent
-  // vs target bits
-  if (cpi->rc.rolling_target_bits > 0 &&
-      cpi->rc.active_worst_quality < cpi->rc.worst_quality) {
-    double rolling_ratio = (double)cpi->rc.rolling_actual_bits /
-                               (double)cpi->rc.rolling_target_bits;
-
-    if (rolling_ratio < 0.95)
-      cpi->twopass.est_max_qcorrection_factor -= 0.005;
-    else if (rolling_ratio > 1.05)
-      cpi->twopass.est_max_qcorrection_factor += 0.005;
-
-    cpi->twopass.est_max_qcorrection_factor = fclamp(
-        cpi->twopass.est_max_qcorrection_factor, 0.1, 10.0);
-  }
-
   // Corrections for higher compression speed settings
   // (reduced compression expected)
   // FIXME(jimbankoski): Once we settle on vp9 speed features we need to
@@ -1062,8 +1046,7 @@
 
     err_correction_factor = calc_correction_factor(err_per_mb,
                                                    ERR_DIVISOR, 0.4, 0.90, q) *
-                                sr_correction * speed_correction *
-                                cpi->twopass.est_max_qcorrection_factor;
+                                sr_correction * speed_correction;
 
     bits_per_mb_at_this_q = vp9_rc_bits_per_mb(INTER_FRAME, q,
                                                err_correction_factor);
@@ -2168,7 +2151,6 @@
     if (cpi->common.current_video_frame == 0) {
       int section_target_bandwidth =
           (int)(cpi->twopass.bits_left / frames_left);
-      cpi->twopass.est_max_qcorrection_factor = 1.0;
 
       // guess at maxq needed in 2nd pass
       cpi->twopass.maxq_max_limit = cpi->rc.worst_quality;
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1632,7 +1632,6 @@
   cpi->rc.rate_correction_factor         = 1.0;
   cpi->rc.key_frame_rate_correction_factor = 1.0;
   cpi->rc.gf_rate_correction_factor  = 1.0;
-  cpi->twopass.est_max_qcorrection_factor  = 1.0;
 
   cal_nmvjointsadcost(cpi->mb.nmvjointsadcost);
   cpi->mb.nmvcost[0] = &cpi->mb.nmvcosts[0][MV_MAX];
@@ -2617,7 +2616,7 @@
   if (cpi->twopass.total_left_stats.coded_error != 0.0)
     fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %10d"
         "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f"
-        "%6d %6d %5d %5d %5d %8.2f %10d %10.3f"
+        "%6d %6d %5d %5d %5d %10d %10.3f"
         "%10.3f %8d %10d %10d %10d\n",
         cpi->common.current_video_frame, cpi->rc.this_frame_target,
         cpi->rc.projected_frame_size, 0,
@@ -2632,7 +2631,7 @@
         vp9_convert_qindex_to_q(cpi->cq_target_quality),
         cpi->refresh_last_frame, cpi->refresh_golden_frame,
         cpi->refresh_alt_ref_frame, cm->frame_type, cpi->rc.gfu_boost,
-        cpi->twopass.est_max_qcorrection_factor, (int)cpi->twopass.bits_left,
+        (int)cpi->twopass.bits_left,
         cpi->twopass.total_left_stats.coded_error,
         (double)cpi->twopass.bits_left /
             (1 + cpi->twopass.total_left_stats.coded_error),
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -569,7 +569,6 @@
     int alt_extra_bits;
 
     int sr_update_lag;
-    double est_max_qcorrection_factor;
   } twopass;
 
   YV12_BUFFER_CONFIG alt_ref_buffer;