diff options
Diffstat (limited to 'gr-analog/lib/cpm.cc')
-rw-r--r-- | gr-analog/lib/cpm.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gr-analog/lib/cpm.cc b/gr-analog/lib/cpm.cc index ccac42cd0c..163588682d 100644 --- a/gr-analog/lib/cpm.cc +++ b/gr-analog/lib/cpm.cc @@ -25,17 +25,14 @@ #endif #include <gnuradio/analog/cpm.h> +#include <gnuradio/math.h> + #include <cmath> #include <cfloat> - namespace gr { namespace analog { -#ifndef M_TWOPI -# define M_TWOPI (2*M_PI) -#endif - //! Normalised sinc function, sinc(x)=std::sin(pi*x)/pi*x inline double sinc(double x) @@ -43,7 +40,7 @@ namespace gr { if(x == 0) { return 1.0; } - return std::sin(M_PI * x) / (M_PI * x); + return std::sin(GR_M_PI * x) / (GR_M_PI * x); } @@ -53,7 +50,7 @@ namespace gr { { std::vector<float> taps(samples_per_sym * L, 1.0/L/samples_per_sym); for(unsigned i = 0; i < samples_per_sym * L; i++) { - taps[i] *= 1 - std::cos(M_TWOPI * i / L / samples_per_sym); + taps[i] *= 1 - std::cos(GR_M_TWOPI * i / L / samples_per_sym); } return taps; @@ -97,7 +94,7 @@ namespace gr { } else { double tmp = 4.0 * beta * k / Ls; - taps_d[i] *= std::cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp); + taps_d[i] *= std::cos(beta * GR_M_TWOPI * k / Ls) / (1 - tmp * tmp); } sum += taps_d[i]; } @@ -124,7 +121,7 @@ namespace gr { } const double pi2_24 = 0.411233516712057; // pi^2/24 - double f = M_PI * k / sps; + double f = GR_M_PI * k / sps; return sinc(k/sps) - pi2_24 * (2 * std::sin(f) - 2*f*std::cos(f) - f*f*std::sin(f)) / (f*f*f); } |