shithub: libvpx

Download patch

ref: 0b4deea896e50c4fbe9e0b2e2f60ccc117b7a28a
parent: 6cb2fcf601b98875ec8b6e40823f7156b046e04b
parent: 17ef6a8dfd31fc5787d291dfc254d3acd5d814ef
author: Paul Wilkins <paulwilkins@google.com>
date: Thu Mar 28 08:53:23 EDT 2013

Merge "Adjust mv_ratio_accumulator threshold." into experimental

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1536,7 +1536,7 @@
   double this_frame_mv_in_out = 0.0;
   double mv_in_out_accumulator = 0.0;
   double abs_mv_in_out_accumulator = 0.0;
-
+  double mv_ratio_accumulator_thresh;
   int max_bits = frame_max_bits(cpi);     // Max for a single frame
 
   unsigned int allow_alt_ref =
@@ -1568,10 +1568,8 @@
   if (cpi->common.frame_type == KEY_FRAME)
     gf_group_err -= gf_first_frame_err;
 
-  // Scan forward to try and work out how many frames the next gf group
-  // should contain and what level of boost is appropriate for the GF
-  // or ARF that will be coded with the group
-  i = 0;
+  // Motion breakout threshold for loop below depends on image size.
+  mv_ratio_accumulator_thresh = (cpi->common.width + cpi->common.height) / 10.0;
 
   // Work out a maximum interval for the GF.
   // If the image appears completely static we can extend beyond this.
@@ -1585,6 +1583,7 @@
   if (active_max_gf_interval > cpi->max_gf_interval)
     active_max_gf_interval = cpi->max_gf_interval;
 
+  i = 0;
   while (((i < cpi->twopass.static_scene_max_gf_interval) ||
           ((cpi->twopass.frames_to_key - i) < MIN_GF_INTERVAL)) &&
          (i < cpi->twopass.frames_to_key)) {
@@ -1644,7 +1643,7 @@
         ((cpi->twopass.frames_to_key - i) >= MIN_GF_INTERVAL) &&
         ((boost_score > 125.0) || (next_frame.pcnt_inter < 0.75)) &&
         (!flash_detected) &&
-        ((mv_ratio_accumulator > 100.0) ||
+        ((mv_ratio_accumulator > mv_ratio_accumulator_thresh) ||
          (abs_mv_in_out_accumulator > 3.0) ||
          (mv_in_out_accumulator < -2.0) ||
          ((boost_score - old_boost_score) < IIFACTOR))