From 6fb59f1182965a0e1e45d60e81e3ff02db45944c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 1 Apr 2020 22:22:50 -0700 Subject: Avoid using M_PI --- common/polyphase_resampler.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'common/polyphase_resampler.cpp') diff --git a/common/polyphase_resampler.cpp b/common/polyphase_resampler.cpp index b205fe83..d572ddcc 100644 --- a/common/polyphase_resampler.cpp +++ b/common/polyphase_resampler.cpp @@ -4,15 +4,12 @@ #include #include +#include "math_defs.h" #include "opthelpers.h" namespace { -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - #define EPSILON 1e-9 using uint = unsigned int; @@ -26,7 +23,7 @@ double Sinc(const double x) { if UNLIKELY(std::abs(x) < EPSILON) return 1.0; - return std::sin(M_PI * x) / (M_PI * x); + return std::sin(al::MathDefs::Pi()*x) / (al::MathDefs::Pi()*x); } /* The zero-order modified Bessel function of the first kind, used for the @@ -100,7 +97,7 @@ uint Gcd(uint x, uint y) */ uint CalcKaiserOrder(const double rejection, const double transition) { - double w_t = 2.0 * M_PI * transition; + double w_t = 2.0 * al::MathDefs::Pi() * transition; if LIKELY(rejection > 21.0) return static_cast(std::ceil((rejection - 7.95) / (2.285 * w_t))); return static_cast(std::ceil(5.79 / w_t)); -- cgit v1.2.3