shithub: libvpx

Download patch

ref: 1c7b1f9aec21b9fd5ce89397b0b0a7ee038d0cf1
parent: 3393243d5e484c4530d96ffb8e3ac4e4ee070b43
author: Marco <[email protected]>
date: Thu Jun 25 08:22:19 EDT 2015

Update to dynamic resize logic for 1pass CBR.

Only do the check for resizing if the feature is selected
(i.e., resize_mode = RESIZE_DYNAMIC).

And modify condition for checking to be resize_count >= window,
(since framerate can change).

Change-Id: Idceb4e50956bb965a1492b4993b0dcb393c9be4d

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1596,7 +1596,10 @@
     target = calc_pframe_target_size_one_pass_cbr(cpi);
 
   vp9_rc_set_frame_target(cpi, target);
-  cpi->resize_state = vp9_resize_one_pass_cbr(cpi);
+  if (cpi->oxcf.resize_mode == RESIZE_DYNAMIC)
+    cpi->resize_state = vp9_resize_one_pass_cbr(cpi);
+  else
+    cpi->resize_state = 0;
 }
 
 int vp9_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget,
@@ -1781,7 +1784,7 @@
       ++cpi->resize_buffer_underflow;
     ++cpi->resize_count;
     // Check for resize action every "window" frames.
-    if (cpi->resize_count == window) {
+    if (cpi->resize_count >= window) {
       int avg_qp = cpi->resize_avg_qp / cpi->resize_count;
       // Resize down if buffer level has underflowed sufficent amount in past
       // window, and we are at original resolution.