summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2021-04-29 11:06:16 +0100
committerPaul Wilkins <paulwilkins@google.com>2021-04-29 11:12:40 +0100
commite14026ac21a6b6c93fd0fc954055643ed30972e0 (patch)
tree2a269ce37c7966eea239ebd04a25cdd780f0e307
parent9f57bc4d6c7a577538042a49ede8ee98dc8cc300 (diff)
downloadlibvpx-e14026ac21a6b6c93fd0fc954055643ed30972e0.tar
libvpx-e14026ac21a6b6c93fd0fc954055643ed30972e0.tar.gz
libvpx-e14026ac21a6b6c93fd0fc954055643ed30972e0.tar.bz2
libvpx-e14026ac21a6b6c93fd0fc954055643ed30972e0.zip
Add assert for zero_motion_factor range
Change clamp to an assert so we are warned if changes to input ranges or defaults in the future lead to an invalid value. Change-Id: Idb4e0729f477a519bfff3083cdce3891e2fc6faa
-rw-r--r--vp9/encoder/vp9_firstpass.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index ce7590fe4..b63d47a05 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1882,13 +1882,8 @@ static double get_prediction_decay_rate(const TWO_PASS *const twopass,
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)));