shithub: libvpx

Download patch

ref: 04b4a5f25e3ac3ad10933078b6f28b8352754b03
parent: 27a6be1419507d50d00744f7a4ac04e5f2b39aab
parent: 9d8ead125d10f46ff91941b0c7eb097e3ae9622a
author: Paul Wilkins <[email protected]>
date: Thu Mar 24 14:05:24 EDT 2016

Merge "Force recode for bad rate misses."

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2722,6 +2722,13 @@
   return scale;
 }
 
+static int big_rate_miss(VP9_COMP *cpi, int high_limit, int low_limit) {
+  const RATE_CONTROL *const rc = &cpi->rc;
+
+  return (rc->projected_frame_size > ((high_limit * 3) / 2)) ||
+         (rc->projected_frame_size < (low_limit / 2));
+}
+
 // Function to test for conditions that indicate we should loop
 // back and recode a frame.
 static int recode_loop_test(VP9_COMP *cpi,
@@ -2733,6 +2740,7 @@
   int force_recode = 0;
 
   if ((rc->projected_frame_size >= rc->max_frame_bandwidth) ||
+      big_rate_miss(cpi, high_limit, low_limit) ||
       (cpi->sf.recode_loop == ALLOW_RECODE) ||
       (frame_is_kfgfarf &&
        (cpi->sf.recode_loop == ALLOW_RECODE_KFARFGF))) {