From: Marco Paniconi Date: Thu, 17 Jun 2021 19:00:33 +0000 (-0700) Subject: vp9: Adjust logic for gf update in 1 pass vbr X-Git-Tag: v1.11.0-rc1~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=338013712e516d07388651437918e6328ea909f5;p=libvpx 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 --- diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index b89166466..3775d2236 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -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);