shithub: libvpx

Download patch

ref: 45a26dd9c8de9113d691df38730fd1302312b90a
parent: 552fd02cf06128bcab3e8e7ae8eb5eddd6bcf1a4
author: paulwilkins <[email protected]>
date: Wed Jun 1 13:13:31 EDT 2016

Slightly more damped  VBR adjustment.

Increase in the damping used in adjusting the active Q range.
This does hurt rate accuracy a little in a few extreme cases
especially if the clip is very short*, but helps metrics.

* Note that the adjustment is applied at the GF/ARF group level based
on what happened in the last group.  Hence for very short clips where
the length of a single group may be a significant % of the clip length
there is still scope for some drift that cannot be accommodated.

In practice most data points in our test sets are now much closer to target
than was previously the case with default settings and in some cases are
better even than they were with the command line undershoot and overshoot
parameter was set very low (e.g. 2%). For example in bridge_close at high rates
the old mechanism was unable to adapt enough to prevent extreme overshoot.

Change-Id: I634f8f0e015b5ee64a9f0ccaa2bcfdbc1d360489

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1277,7 +1277,7 @@
         DOUBLE_DIVIDE_CHECK((double)twopass->rolling_arf_group_target_bits);
     last_group_rate_err =
         VPXMAX(0.25, VPXMIN(4.0, last_group_rate_err));
-    twopass->bpm_factor *= (1.0 + last_group_rate_err) / 2.0;
+    twopass->bpm_factor *= (3.0 + last_group_rate_err) / 4.0;
     twopass->bpm_factor =
         VPXMAX(0.25, VPXMIN(4.0, twopass->bpm_factor));
 
@@ -2174,13 +2174,12 @@
     const double group_av_inactive_zone =
       ((gf_group_inactive_zone_rows * 2) /
        (rc->baseline_gf_interval * (double)cm->mb_rows));
-
     int tmp_q =
         get_twopass_worst_quality(cpi, group_av_err,
                                   (group_av_skip_pct + group_av_inactive_zone),
                                   vbr_group_bits_per_frame);
     twopass->active_worst_quality =
-        VPXMAX(tmp_q, twopass->active_worst_quality >> 1);
+        (tmp_q + (twopass->active_worst_quality * 3)) >> 2;
   }
 #endif