diff options
| author | Lioncash <mathew1800@gmail.com> | 2014-02-04 20:43:07 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2014-02-04 20:43:07 -0500 |
| commit | 6b87a0ef202c614e370d74291c1f754492524aaf (patch) | |
| tree | 165d791cba12b45101802979ebbbae994c37b41f /Source/Core/AudioCommon/DPL2Decoder.cpp | |
| parent | 59e2179172a5881cb53b2048cc01ae1f52b0b703 (diff) | |
Introduce a generic clamp function to clean up some similarly duplicated code.
Diffstat (limited to 'Source/Core/AudioCommon/DPL2Decoder.cpp')
| -rw-r--r-- | Source/Core/AudioCommon/DPL2Decoder.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/Source/Core/AudioCommon/DPL2Decoder.cpp b/Source/Core/AudioCommon/DPL2Decoder.cpp index 97bdb5413d..0c9fd65400 100644 --- a/Source/Core/AudioCommon/DPL2Decoder.cpp +++ b/Source/Core/AudioCommon/DPL2Decoder.cpp @@ -13,6 +13,7 @@ #include <stdlib.h> #include <string.h> #include "DPL2Decoder.h" +#include "MathUtil.h" #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -72,17 +73,6 @@ template<class T> static T firfilter(const T *buf, int pos, int len, int count, return T(r1+r2); } -template<class T> inline const T& limit(const T& val, const T& min, const T& max) -{ - if (val < min) { - return min; - } else if (val > max) { - return max; - } else { - return val; - } -} - /* // Hamming // 2*pi*k @@ -133,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt) // Sanity check if(*n==0) return NULL; - fc[0]=limit(fc[0],float(0.001),float(1)); + MathUtil::Clamp(fc[0],float(0.001),float(1)); float *w=(float*)calloc(sizeof(float),*n); |
