Fix short first kf bug.
authorPaul Wilkins <paulwilkins@google.com>
Mon, 3 Sep 2018 15:48:02 +0000 (16:48 +0100)
committerHui Su <huisu@google.com>
Tue, 4 Sep 2018 16:24:17 +0000 (16:24 +0000)
commit1f46c31844b9162557e12de73352075f6b8d9379
treeba615ec1c542cfc26ed9ef0f8e6f55c075b3d48c
parentce29b592822563a4e691d8793bdf5d4f87b27926
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
vp9/encoder/vp9_firstpass.c