shithub: libvpx

Download patch

ref: 9e15c3058543d71867af9e02e314a7303f6049b3
parent: 1e9929390c8c18ffda02e0073481625e5afb2529
author: Marco Paniconi <marpan@google.com>
date: Mon Jul 6 07:28:56 EDT 2020

vp9: Fix to use last_q for resize check

For temporal layers resize is only checked
on the base/TL0 frames. So rc->last_q should be used,
which because rc is in the layer context, rc->last_q
will correspond to the qindex on last TL0 frame.
In the previous code cm->base_qindex was used, which
would correspond to qindex on last encoded frame, which
is not TL0 when temporal_layers > 1.

Change-Id: Iaf86f7156d2d48ae99a1b34ad576d453d490e746

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -2716,7 +2716,7 @@
   // Ignore samples close to key frame, since QP is usually high after key.
   if (!force_downsize_rate && cpi->rc.frames_since_key > cpi->framerate) {
     const int window = VPXMIN(30, (int)(2 * cpi->framerate));
-    cpi->resize_avg_qp += cm->base_qindex;
+    cpi->resize_avg_qp += rc->last_q[INTER_FRAME];
     if (cpi->rc.buffer_level < (int)(30 * rc->optimal_buffer_level / 100))
       ++cpi->resize_buffer_underflow;
     ++cpi->resize_count;