diff options
Diffstat (limited to 'gr-analog/lib/cpm.cc')
-rw-r--r-- | gr-analog/lib/cpm.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/gr-analog/lib/cpm.cc b/gr-analog/lib/cpm.cc index b61ee28816..ccac42cd0c 100644 --- a/gr-analog/lib/cpm.cc +++ b/gr-analog/lib/cpm.cc @@ -24,13 +24,10 @@ #include "config.h" #endif +#include <gnuradio/analog/cpm.h> #include <cmath> #include <cfloat> -#include <gnuradio/analog/cpm.h> -//gives us erf on compilers without it -#include <boost/math/special_functions/erf.hpp> -namespace bm = boost::math; namespace gr { namespace analog { @@ -39,14 +36,14 @@ namespace gr { # define M_TWOPI (2*M_PI) #endif - //! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x + //! Normalised sinc function, sinc(x)=std::sin(pi*x)/pi*x inline double sinc(double x) { if(x == 0) { return 1.0; } - return sin(M_PI * x) / (M_PI * x); + return std::sin(M_PI * x) / (M_PI * x); } @@ -56,7 +53,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 - cos(M_TWOPI * i / L / samples_per_sym); + taps[i] *= 1 - std::cos(M_TWOPI * i / L / samples_per_sym); } return taps; @@ -67,7 +64,7 @@ namespace gr { * * L-SRC has a time-continuous phase response function of * - * g(t) = 1/LT * sinc(2t/LT) * cos(beta * 2pi t / LT) / (1 - (4beta / LT * t)^2) + * g(t) = 1/LT * sinc(2t/LT) * std::cos(beta * 2pi t / LT) / (1 - (4beta / LT * t)^2) * * which is the Fourier transform of a cos-rolloff function with rolloff * beta, and looks like a sinc-function, multiplied with a rolloff term. @@ -75,7 +72,7 @@ namespace gr { * zero crossings. * The time-discrete IR is thus * - * g(k) = 1/Ls * sinc(2k/Ls) * cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2) + * g(k) = 1/Ls * sinc(2k/Ls) * std::cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2) * where k = 0...Ls-1 * and s = samples per symbol. */ @@ -100,7 +97,7 @@ namespace gr { } else { double tmp = 4.0 * beta * k / Ls; - taps_d[i] *= cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp); + taps_d[i] *= std::cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp); } sum += taps_d[i]; } @@ -128,7 +125,7 @@ namespace gr { const double pi2_24 = 0.411233516712057; // pi^2/24 double f = M_PI * k / sps; - return sinc(k/sps) - pi2_24 * (2 * sin(f) - 2*f*cos(f) - f*f*sin(f)) / (f*f*f); + return sinc(k/sps) - pi2_24 * (2 * std::sin(f) - 2*f*std::cos(f) - f*f*std::sin(f)) / (f*f*f); } //! Taps for TFM CPM (Tamed frequency modulation) @@ -183,8 +180,8 @@ namespace gr { double alpha = 5.336446256636997 * bt; for(unsigned i = 0; i < samples_per_sym * L; i++) { double k = i - Ls/2; // Causal to acausal - taps_d[i] = (bm::erf(alpha * (k / samples_per_sym + 0.5)) - - bm::erf(alpha * (k / samples_per_sym - 0.5))) + taps_d[i] = (std::erf(alpha * (k / samples_per_sym + 0.5)) - + std::erf(alpha * (k / samples_per_sym - 0.5))) * 0.5 / samples_per_sym; taps[i] = (float) taps_d[i]; } |