shithub: libvpx

Download patch

ref: 49e0673659a5f92ab93a69a0be9af8f6db63a7a8
parent: ce4c4b96e4ad28c2ba326629dd9ffdab95d63274
author: Alex Converse <[email protected]>
date: Fri Jul 24 10:59:03 EDT 2015

Clean up some casts.

Change-Id: I264ca534cd7d4755906e20aea47e7a2523bca611

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -281,14 +281,14 @@
   // Assume we do not need any constraint lower than 4K 20 fps
   static const double factor_safe = 3840 * 2160 * 20.0;
   const double factor = width * height * framerate;
-  const double default_interval =
-      MIN(MAX_GF_INTERVAL, MAX(MIN_GF_INTERVAL, (int)(framerate * 0.125)));
+  const int default_interval =
+      clamp((int)(framerate * 0.125), MIN_GF_INTERVAL, MAX_GF_INTERVAL);
 
   if (factor <= factor_safe)
-    return (int)default_interval;
+    return default_interval;
   else
-    return (int)MAX(default_interval,
-                    (int)(MIN_GF_INTERVAL * factor / factor_safe + 0.5));
+    return MAX(default_interval,
+               (int)(MIN_GF_INTERVAL * factor / factor_safe + 0.5));
   // Note this logic makes:
   // 4K24: 5
   // 4K30: 6