shithub: libvpx

Download patch

ref: 8b33c641621237e321c6907c86be1ac7d25fb8cc
parent: e211244b02605ff989f443ed31c0098a1338befb
parent: 8d80c262d11db39212fd96c325c8ca281be79340
author: Dmitry Kovalev <[email protected]>
date: Wed Feb 26 04:20:14 EST 2014

Merge "Using clamp() for active_{best, worst}_quality."

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -958,17 +958,10 @@
   }
 
   // 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;