shithub: libvpx

Download patch

ref: 338013712e516d07388651437918e6328ea909f5
parent: 364f0e31fed78be436d00c177574dac00c0d85a4
author: Marco Paniconi <[email protected]>
date: Thu Jun 17 08:00:33 EDT 2021

vp9: Adjust logic for gf update in 1 pass vbr

This reduces some regression when external RC
is used, for which avg_frame_low_motion is not
set/updated (=0).

Change-Id: I2408e62bd97592e892cefa0f183357c641aa5eea

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -2076,13 +2076,14 @@
         // 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);