diff libaf/af_volnorm.c @ 36395:2b9bc3c2933d

Remove some macros and switch to libavutil equivalents.
author reimar
date Sat, 26 Oct 2013 09:36:23 +0000
parents 1dca5ff3d3c6
children
line wrap: on
line diff
--- a/libaf/af_volnorm.c	Sat Oct 26 09:36:21 2013 +0000
+++ b/libaf/af_volnorm.c	Sat Oct 26 09:36:23 2013 +0000
@@ -26,6 +26,7 @@
 #include <math.h>
 #include <limits.h>
 
+#include "libavutil/common.h"
 #include "af.h"
 
 // Methods:
@@ -144,14 +145,14 @@
     s->mul = (1.0 - SMOOTH_MUL) * s->mul + SMOOTH_MUL * neededmul;
 
     // clamp the mul coefficient
-    s->mul = clamp(s->mul, MUL_MIN, MUL_MAX);
+    s->mul = av_clipf(s->mul, MUL_MIN, MUL_MAX);
   }
 
   // Scale & clamp the samples
   for (i = 0; i < len; i++)
   {
     tmp = s->mul * data[i];
-    tmp = clamp(tmp, SHRT_MIN, SHRT_MAX);
+    tmp = av_clip_int16(tmp);
     data[i] = tmp;
   }
 
@@ -185,7 +186,7 @@
     s->mul = (1.0 - SMOOTH_MUL) * s->mul + SMOOTH_MUL * neededmul;
 
     // clamp the mul coefficient
-    s->mul = clamp(s->mul, MUL_MIN, MUL_MAX);
+    s->mul = av_clipf(s->mul, MUL_MIN, MUL_MAX);
   }
 
   // Scale & clamp the samples
@@ -228,7 +229,7 @@
     if (avg >= SIL_S16)
     {
 	s->mul = s->mid_s16 / avg;
-	s->mul = clamp(s->mul, MUL_MIN, MUL_MAX);
+	s->mul = av_clipf(s->mul, MUL_MIN, MUL_MAX);
     }
   }
 
@@ -236,7 +237,7 @@
   for (i = 0; i < len; i++)
   {
     tmp = s->mul * data[i];
-    tmp = clamp(tmp, SHRT_MIN, SHRT_MAX);
+    tmp = av_clip_int16(tmp);
     data[i] = tmp;
   }
 
@@ -278,7 +279,7 @@
     if (avg >= SIL_FLOAT)
     {
 	s->mul = s->mid_float / avg;
-	s->mul = clamp(s->mul, MUL_MIN, MUL_MAX);
+	s->mul = av_clipf(s->mul, MUL_MIN, MUL_MAX);
     }
   }