shithub: libvpx

Download patch

ref: 77e389dca4bb26e4e66cb665c9183aef7f02f7d7
parent: c230d7f6e632a3fc10f042514d1246f78c244268
parent: 6804737ef5f18e2e5ade9608b2e34090bb030ef2
author: Jingning Han <jingning@google.com>
date: Tue Oct 2 17:16:19 EDT 2018

Merge "Force even arf group length where possible."

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2513,8 +2513,11 @@
     // bits to spare and are better with a smaller interval and smaller boost.
     // At high Q when there are few bits to spare we are better with a longer
     // interval to spread the cost of the GF.
-    active_max_gf_interval = 12 + arf_active_or_kf + VPXMIN(4, q_term);
+    active_max_gf_interval = 11 + arf_active_or_kf + VPXMIN(5, q_term);
 
+    // Force max GF interval to be odd.
+    active_max_gf_interval = active_max_gf_interval | 0x01;
+
     // We have: active_min_gf_interval <=
     // rc->max_gf_interval + arf_active_or_kf.
     if (active_max_gf_interval < active_min_gf_interval) {
@@ -2613,7 +2616,7 @@
             // Don't break out with a very short interval.
             (i >= active_min_gf_interval) &&
             // If possible dont break very close to a kf
-            ((rc->frames_to_key - i) >= rc->min_gf_interval) &&
+            ((rc->frames_to_key - i) >= rc->min_gf_interval) && (i & 0x01) &&
             (!flash_detected) &&
             ((mv_ratio_accumulator > mv_ratio_accumulator_thresh) ||
              (abs_mv_in_out_accumulator > abs_mv_in_out_thresh) ||