shithub: libvpx

Download patch

ref: de53e6de4958aea839a9b64c78c631775a1784ab
parent: 5e6533e70730e0798b4b00d795d400bc87f8927c
author: jackychen <[email protected]>
date: Mon Oct 5 11:35:22 EDT 2015

Add the check of resolution in VP9 dynamic resizing.

The resolution check fixs the issue which resets resize_pending
unnecessarily and causes not-bitexact with previous one-step version.

Change-Id: I4e7660b3c8f34f59781e2e61ca30d61080c322de

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1852,18 +1852,20 @@
       // Resize back up if average QP is low, and we are currently in a resized
       // down state, i.e. 1/2 or 3/4 of original resolution.
       // Currently, use a flag to turn 3/4 resizing feature on/off.
-      if (cpi->resize_buffer_underflow > (cpi->resize_count >> 1)) {
+      if (cpi->resize_state == ORIG &&
+          cpi->resize_buffer_underflow > (cpi->resize_count >> 1)) {
         resize_action = DOWN_ONEHALF;
         cpi->resize_state = ONE_HALF;
       } else if (cpi->resize_buffer_underflow > (cpi->resize_count >> 2)) {
-        if (cpi->resize_state == THREE_QUARTER || ONEHALFONLY_RESIZE) {
+        if (cpi->resize_state == THREE_QUARTER) {
           resize_action = DOWN_ONEHALF;
           cpi->resize_state = ONE_HALF;
         } else if (cpi->resize_state == ORIG) {
-          resize_action = DOWN_THREEFOUR;
-          cpi->resize_state = THREE_QUARTER;
+          resize_action = ONEHALFONLY_RESIZE ? DOWN_ONEHALF : DOWN_THREEFOUR;
+          cpi->resize_state = ONEHALFONLY_RESIZE ? ONE_HALF : THREE_QUARTER;
         }
-      } else if (avg_qp < 60 * cpi->rc.worst_quality / 100) {
+      } else if (cpi->resize_state != ORIG &&
+                 avg_qp < 60 * cpi->rc.worst_quality / 100) {
         if (cpi->resize_state == THREE_QUARTER ||
             avg_qp < 40 * cpi->rc.worst_quality / 100 ||
             ONEHALFONLY_RESIZE) {