aboutsummaryrefslogtreecommitdiffstats
path: root/common/polyphase_resampler.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-01 22:22:50 -0700
committerChris Robinson <[email protected]>2020-04-01 22:22:50 -0700
commit6fb59f1182965a0e1e45d60e81e3ff02db45944c (patch)
tree43f192cb9288e375dc633083a84692ca0b52dca3 /common/polyphase_resampler.cpp
parentbf48dcd37535ccf3146082cee421f418bb0cb66b (diff)
Avoid using M_PI
Diffstat (limited to 'common/polyphase_resampler.cpp')
-rw-r--r--common/polyphase_resampler.cpp9
1 files changed, 3 insertions, 6 deletions
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 <algorithm>
#include <cmath>
+#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<double>::Pi()*x) / (al::MathDefs<double>::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<double>::Pi() * transition;
if LIKELY(rejection > 21.0)
return static_cast<uint>(std::ceil((rejection - 7.95) / (2.285 * w_t)));
return static_cast<uint>(std::ceil(5.79 / w_t));