shithub: libvpx

Download patch

ref: 03c1a827acd5cb103316dd8ee2b2f3953ecd29c3
parent: 607e45f42027cde9cab7a017559ea02fd397fffd
author: paulwilkins <[email protected]>
date: Wed Nov 15 11:58:05 EST 2017

Remove decay_accumulator clause from alt ref breakout.

The decay accumulator clause covers similar ground to the
new clause that tests the accumulated second reference error
so it has been removed to reduce complexity.

Change-Id: I4ec1cce32d72bd4ee463ad7def2831a68447d525

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2407,8 +2407,6 @@
   const FIRSTPASS_STATS *const start_pos = twopass->stats_in;
   int i;
 
-  double boost_score = 0.0;
-  double old_boost_score = 0.0;
   double gf_group_err = 0.0;
   double gf_group_raw_error = 0.0;
   double gf_group_noise = 0.0;
@@ -2420,7 +2418,6 @@
   double mod_frame_err = 0.0;
 
   double mv_ratio_accumulator = 0.0;
-  double decay_accumulator = 1.0;
   double zero_motion_accumulator = 1.0;
   double loop_decay_rate = 1.00;
   double last_loop_decay_rate = 1.00;
@@ -2546,8 +2543,6 @@
       last_loop_decay_rate = loop_decay_rate;
       loop_decay_rate = get_prediction_decay_rate(cpi, &next_frame);
 
-      decay_accumulator = decay_accumulator * loop_decay_rate;
-
       // Monitor for static sections.
       zero_motion_accumulator = VPXMIN(
           zero_motion_accumulator, get_zero_motion_factor(cpi, &next_frame));
@@ -2559,13 +2554,14 @@
         allow_alt_ref = 0;
         break;
       }
+
+      // Update the accumulator for second ref error difference.
+      // This is intended to give an indication of how much the coded error is
+      // increasing over time.
+      sr_accumulator += (next_frame.sr_coded_error - next_frame.coded_error);
+      sr_accumulator = VPXMAX(0.0, sr_accumulator);
     }
 
-    // Calculate a boost number for this frame.
-    boost_score += decay_accumulator *
-                   calc_frame_boost(cpi, &next_frame, &sr_accumulator,
-                                    this_frame_mv_in_out, GF_MAX_BOOST);
-
     // Break out conditions.
     if (
         // Break at active_max_gf_interval unless almost totally static.
@@ -2579,14 +2575,11 @@
             ((mv_ratio_accumulator > mv_ratio_accumulator_thresh) ||
              (abs_mv_in_out_accumulator > abs_mv_in_out_thresh) ||
              (mv_in_out_accumulator < -mv_in_out_thresh) ||
-             (decay_accumulator < ARF_DECAY_BREAKOUT) ||
              (sr_accumulator > next_frame.intra_error)))) {
-      boost_score = old_boost_score;
       break;
     }
 
     *this_frame = next_frame;
-    old_boost_score = boost_score;
   }
 
   // Was the group length constrained by the requirement for a new KF?
@@ -2610,7 +2603,7 @@
             ? 1
             : 0;
   } else {
-    rc->gfu_boost = VPXMAX((int)boost_score, MIN_ARF_GF_BOOST);
+    rc->gfu_boost = calc_arf_boost(cpi, 0, (i - 1));
     rc->source_alt_ref_pending = 0;
   }