ref: 1f46c31844b9162557e12de73352075f6b8d9379
parent: ce29b592822563a4e691d8793bdf5d4f87b27926
author: Paul Wilkins <[email protected]>
date: Mon Sep 3 12:48:02 EDT 2018
Fix short first kf bug. This change is in response to quality issue in b/112953058 The quality regression observed is a result of a bug that manifested because of a very short key frame group at the start of a chunk. The group was so short that it was less than the minimum allowed length of an ARF group, so the initial group was coded as a GF only group. However, group length was not set correctly and the result was a frame coded with a target of 0 bits. This causes two problems: Firstly one very poor frame that caused the issue to be raised. Secondly that one frame obviously overshoots its 0 target very heavily and this has the effect moving the needle significantly in terms of the adaptive rate control (specifically the estimate of bits per macro block used to estimate the active Q range). Consequently there is undershoot for most of the rest of the chunk and the overall rate ends up much lower than the target (14Mb/s vs a target of 22Mb/s). (The sharp drop in the overall rate is also noted in the issue. BUG=b/112953058 Change-Id: Ide9cce57acd3dee0f9496b752902e7b4735f2c7f
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -3002,11 +3002,7 @@
rc->gfu_boost = VPXMIN((int)rc->gfu_boost, i * 200);
#endif
- rc->baseline_gf_interval =
- ((twopass->kf_zeromotion_pct >= STATIC_KF_GROUP_THRESH) &&
- (i >= rc->frames_to_key))
- ? i
- : (i - (is_key_frame || rc->source_alt_ref_pending));
+ rc->baseline_gf_interval = i - rc->source_alt_ref_pending;
// TODO(zoeliu): Turn on the option to disable extra ALTREFs for still GF
// groups.