Respond more rapidly to excessive local overshoot.
This patch attempts to address a bug reported for 4K video. https://b.corp.google.com/issues/62215394 In this instance a perfect storm of a moderate complexity section followed by a much easier section where a CGI overlay helped to suppress film grain noise, followed by a much harder and very grainy section at the end, cause a massive local rate spike that pushed a chunk over the upper allowed rate limit. This patch detects cases where the rate for a frame is much higher than expected and allows, in this special case, for rapid adjustment of the active Q range. For the example chunk in the bug report the target rate was 18Mb/s and the observed rate was over 37 Mb/s with a surge for the last few frames to over 100Mb/s. This patch brings the overall chunk rate right back down to ~18.2 Mbit/s and almost completely eliminates the rate spike at the end. (See graphs appended to bug report) Also see I108da7ca42f3bc95c5825dd33c9d84583227dac1 which fixes a bug unearthed during testing of this patch and also has a bearing on high rate encodes such as 4K. This patch does have a negative impact on some metrics. Most notably there are clips in our standard test set where it hurts global psnr (though in many cases it conversely helps SSIM, FAST SSIM and PSNR-HVS). It is also worth noting that the clips (and data rates) where there is a big metric impact, are almost all cases where there is currently a significant overshoot vs the target rate and overall rate accuracy is greatly improved. Change-Id: I692311a709ccdb6003e705103de9d05b59bf840a
Showing with 56 additions and 21 deletions