shithub: libvpx

Download patch

ref: d693439beda46732410ecc7b3945132e4ab01511
parent: 7d349b2cab069c9305240ae509b92de11d4e8f3b
author: angiebird <angiebird@google.com>
date: Thu Oct 24 09:59:00 EDT 2019

Add rate_ctrl flag

BDRate Changes (negative means improvement)
lowres: 0.565%
midres: 0.361%
lowres: 0.233%
ugc360: -0.242%

Make gop size independent from coding results

Change-Id: I1f54c48b12dc45ee5162ca2527a877c1610528bd

--- a/configure
+++ b/configure
@@ -272,6 +272,7 @@
     fp_mb_stats
     emulate_hardware
     non_greedy_mv
+    rate_ctrl
 "
 CONFIG_LIST="
     dependency_tracking
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2580,6 +2580,21 @@
     const FRAME_INFO *frame_info, const RATE_CONTROL *rc, int arf_active_or_kf,
     int gf_start_show_idx, int active_worst_quality, int last_boosted_qindex) {
   RANGE active_gf_interval;
+#if CONFIG_RATE_CTRL
+  (void)frame_info;
+  (void)gf_start_show_idx;
+  (void)active_worst_quality;
+  (void)last_boosted_qindex;
+  active_gf_interval.min = rc->min_gf_interval + arf_active_or_kf + 2;
+
+  active_gf_interval.max = 16 + arf_active_or_kf;
+
+  if ((active_gf_interval.max <= rc->frames_to_key) &&
+      (active_gf_interval.max >= (rc->frames_to_key - rc->min_gf_interval))) {
+    active_gf_interval.min = rc->frames_to_key / 2;
+    active_gf_interval.max = rc->frames_to_key / 2;
+  }
+#else
   int int_max_q = (int)(vp9_convert_qindex_to_q(active_worst_quality,
                                                 frame_info->bit_depth));
   int q_term = (gf_start_show_idx == 0)
@@ -2617,6 +2632,7 @@
   }
   active_gf_interval.max =
       VPXMAX(active_gf_interval.max, active_gf_interval.min);
+#endif
   return active_gf_interval;
 }