]> granicus.if.org Git - libvpx/commitdiff
Using clamp() for active_{best, worst}_quality.
authorDmitry Kovalev <dkovalev@google.com>
Wed, 26 Feb 2014 02:01:49 +0000 (18:01 -0800)
committerDmitry Kovalev <dkovalev@google.com>
Wed, 26 Feb 2014 02:01:49 +0000 (18:01 -0800)
Change-Id: Ia79f975f54829b8ae6b568ca5c05f4f1f541706f

vp9/encoder/vp9_ratectrl.c

index f78ebfe185b08a95407c436bc7b294c6cd0a0e5a..16c617e2236343368b3e2a156747158171b1d33a 100644 (file)
@@ -958,17 +958,10 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
   }
 
   // Clip the active best and worst quality values to limits.
-  if (active_worst_quality > rc->worst_quality)
-    active_worst_quality = rc->worst_quality;
-
-  if (active_best_quality < rc->best_quality)
-    active_best_quality = rc->best_quality;
-
-  if (active_best_quality > rc->worst_quality)
-    active_best_quality = rc->worst_quality;
-
-  if (active_worst_quality < active_best_quality)
-    active_worst_quality = active_best_quality;
+  active_best_quality = clamp(active_best_quality,
+                              rc->best_quality, rc->worst_quality);
+  active_worst_quality = clamp(active_worst_quality,
+                               active_best_quality, rc->worst_quality);
 
   *top_index = active_worst_quality;
   *bottom_index = active_best_quality;