19 #ifndef INCLUDE_DSP_PHASEDISCRI_H_ 20 #define INCLUDE_DSP_PHASEDISCRI_H_ 25 #define M_PI 3.14159265358979323846 64 Real fltI = sample.real();
65 Real fltQ = sample.imag();
66 magsq = fltI*fltI + fltQ*fltQ;
74 }
else if (fmDev > 1.0f) {
105 Real fltI = sample.real();
106 Real fltQ = sample.imag();
112 magsq = fltI*fltI + fltQ*fltQ;
115 fltNormI= fltI/fltNorm;
116 fltNormQ= fltQ/fltNorm;
147 const float ONEQTR_PI =
M_PI / 4.0;
148 const float THRQTR_PI = 3.0 *
M_PI / 4.0;
150 float abs_y = std::fabs(y) + 1e-10f;
153 r = (x + abs_y) / (abs_y - x);
158 r = (x - abs_y) / (x + abs_y);
161 angle += (0.1963f * r * r - 0.9817f) * r;
170 #define PI_FLOAT 3.14159265f 171 #define PIBY2_FLOAT 1.5707963f 178 if ( y == 0.0f )
return 0.0f;
183 if ( std::fabs( z ) < 1.0f )
185 atan = z/(1.0f + 0.28f*z*z);
188 if ( y < 0.0f )
return atan -
PI_FLOAT;
195 if ( y < 0.0f )
return atan -
PI_FLOAT;
void setFMScaling(Real fmScaling)
float atan2_approximation2(float y, float x)
float atan2_approximation1(float y, float x)
Real phaseDiscriminator(const Complex &sample)
Fixed< IntType, IntBits > sqrt(Fixed< IntType, IntBits > const &x)
Real phaseDiscriminator3(const Complex &sample, long double &magsq, Real &fltVal)
std::complex< Real > Complex
Real phaseDiscriminator2(const Complex &sample)
Real phaseDiscriminatorDelta(const Complex &sample, double &magsq, Real &fmDev)