shithub: libvpx

Download patch

ref: 97d8adef8203201e9247c1ca0e2e588ddcff9020
parent: ef4a132cc4001bbc333fab24025661afd24dffd2
parent: e172e8aa26a95c5f7f23b46d2e9768ddd52be6f1
author: Marco Paniconi <[email protected]>
date: Mon Apr 25 17:13:56 EDT 2016

Merge "vp9: 1 pass vbr: Adjust gf boost/interval on motion level."

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1441,10 +1441,6 @@
 
   rc->total_target_vs_actual = rc->total_actual_bits - rc->total_target_bits;
 
-  if (!cpi->refresh_golden_frame && !cpi->refresh_alt_ref_frame) {
-    rc->avg_intersize_gfint += rc->projected_frame_size;
-  }
-
   if (!cpi->use_svc || is_two_pass_svc(cpi)) {
     if (is_altref_enabled(cpi) && cpi->refresh_alt_ref_frame &&
         (cm->frame_type != KEY_FRAME))
@@ -1469,8 +1465,12 @@
     rc->frame_size_selector = rc->next_frame_size_selector;
   }
 
-  if (oxcf->pass == 0 && cm->frame_type != KEY_FRAME)
-    compute_frame_low_motion(cpi);
+  if (oxcf->pass == 0) {
+    if (cm->frame_type != KEY_FRAME)
+      compute_frame_low_motion(cpi);
+    if (!cpi->refresh_golden_frame && !cpi->refresh_alt_ref_frame)
+      rc->avg_intersize_gfint += rc->projected_frame_size;
+  }
 }
 
 void vp9_rc_postencode_update_drop_frame(VP9_COMP *cpi) {
@@ -1531,6 +1531,7 @@
   if (rc->frames_till_gf_update_due == 0) {
     rc->avg_intersize_gfint =
         rc->avg_intersize_gfint / (rc->baseline_gf_interval + 1);
+    rc->gfu_boost = DEFAULT_GF_BOOST;
     if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cpi->oxcf.pass == 0) {
       vp9_cyclic_refresh_set_golden_update(cpi);
     } else {
@@ -1547,6 +1548,11 @@
           rc->avg_frame_qindex[INTER_FRAME] > (7 * rc->worst_quality) >> 3 &&
           rc->avg_intersize_gfint > (5 * rc->avg_frame_bandwidth) >> 1) {
           rc->baseline_gf_interval = (3 * rc->baseline_gf_interval) >> 1;
+      } else if (cm->current_video_frame > 30 &&
+                 rc->avg_frame_low_motion < 20) {
+        // Decrease boost and gf interval for high motion case.
+        rc->gfu_boost = DEFAULT_GF_BOOST >> 1;
+        rc->baseline_gf_interval = VPXMIN(6, rc->baseline_gf_interval >> 1);
       }
     }
     rc->frames_till_gf_update_due = rc->baseline_gf_interval;
@@ -1559,7 +1565,6 @@
     }
     cpi->refresh_golden_frame = 1;
     rc->source_alt_ref_pending = USE_ALTREF_FOR_ONE_PASS;
-    rc->gfu_boost = DEFAULT_GF_BOOST;
     rc->avg_intersize_gfint = 0;
   }
   if (cm->frame_type == KEY_FRAME)