Slightly more damped VBR adjustment.
authorpaulwilkins <paulwilkins@google.com>
Wed, 1 Jun 2016 16:13:31 +0000 (17:13 +0100)
committerpaulwilkins <paulwilkins@google.com>
Fri, 3 Jun 2016 12:19:51 +0000 (13:19 +0100)
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

vp9/encoder/vp9_firstpass.c

index 8e6b880..a70eaea 100644 (file)
@@ -1277,7 +1277,7 @@ static int get_twopass_worst_quality(VP9_COMP *cpi,
         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 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
     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