]> granicus.if.org Git - libvpx/commitdiff
vp9: Adjust logic for gf update in 1 pass vbr
authorMarco Paniconi <marpan@google.com>
Thu, 17 Jun 2021 19:00:33 +0000 (12:00 -0700)
committerMarco Paniconi <marpan@google.com>
Thu, 17 Jun 2021 19:18:49 +0000 (12:18 -0700)
This reduces some regression when external RC
is used, for which avg_frame_low_motion is not
set/updated (=0).

Change-Id: I2408e62bd97592e892cefa0f183357c641aa5eea

vp9/encoder/vp9_ratectrl.c

index b89166466c7e1d32d0b45d3c873f0a8efcbe78d2..3775d223619fef35b09470d90b088f4896df6ed0 100644 (file)
@@ -2076,13 +2076,14 @@ void vp9_set_gf_update_one_pass_vbr(VP9_COMP *const cpi) {
         // Decrease gf interval for high motion case.
         rc->baseline_gf_interval = VPXMAX(6, rc->baseline_gf_interval >> 1);
       }
-      if (rc->avg_frame_low_motion > 0) {
-        // Adjust boost and af_ratio based on avg_frame_low_motion, which
-        // varies between 0 and 100 (stationary, 100% zero/small motion).
+      // Adjust boost and af_ratio based on avg_frame_low_motion, which
+      // varies between 0 and 100 (stationary, 100% zero/small motion).
+      if (rc->avg_frame_low_motion > 0)
         rc->gfu_boost =
             VPXMAX(500, DEFAULT_GF_BOOST * (rc->avg_frame_low_motion << 1) /
                             (rc->avg_frame_low_motion + 100));
-      }
+      else if (rc->avg_frame_low_motion == 0 && rate_err > 1.0)
+        rc->gfu_boost = DEFAULT_GF_BOOST >> 1;
       rc->af_ratio_onepass_vbr = VPXMIN(15, VPXMAX(5, 3 * rc->gfu_boost / 400));
     }
     adjust_gfint_frame_constraint(cpi, rc->frames_to_key);