shithub: libvpx

Download patch

ref: 2eb934d9c1fb4a460e3f03c8578b7b4f4f195784
parent: 4ec84326cc65c5b042bf06d222d51e51d7e5461d
parent: e14026ac21a6b6c93fd0fc954055643ed30972e0
author: Paul Wilkins <[email protected]>
date: Thu Apr 29 12:31:52 EDT 2021

Merge "Add assert for zero_motion_factor range"

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1882,13 +1882,8 @@
   double zero_motion_factor =
       twopass->zm_factor * (frame_stats->pcnt_inter - frame_stats->pcnt_motion);
 
-  // Clamp value to range 0.0 to 1.0
-  // This should happen anyway if input values are sensibly clamped but checked
-  // here just in case.
-  if (zero_motion_factor > 1.0)
-    zero_motion_factor = 1.0;
-  else if (zero_motion_factor < 0.0)
-    zero_motion_factor = 0.0;
+  // Check that the zero motion factor is valid
+  assert(zero_motion_factor >= 0.0 && zero_motion_factor <= 1.0);
 
   return VPXMAX(zero_motion_factor,
                 (sr_decay_rate + ((1.0 - sr_decay_rate) * zero_motion_factor)));