@@ -26,12 +26,6 @@ | |||||
#include "taps.h" | #include "taps.h" | ||||
#include "util.h" | #include "util.h" | ||||
#ifdef _MSC_VER | |||||
typedef _Fcomplex complexf_t; | |||||
#else | |||||
typedef complex float complexf_t; | |||||
#endif | |||||
// Block sizes | // Block sizes | ||||
#define BLKAMP 32768 | #define BLKAMP 32768 | ||||
#define BLKIN 32768 | #define BLKIN 32768 | ||||
@@ -69,8 +63,13 @@ static float pll(complexf_t in) { | |||||
static float oscillator_phase = 0.0; | static float oscillator_phase = 0.0; | ||||
// Internal oscillator | // Internal oscillator | ||||
#ifdef _MSC_VER | |||||
complexf_t osc = _FCbuild(cos(oscillator_phase), -sin(oscillator_phase)); | |||||
in = _FCmulcc(in, osc); | |||||
#else | |||||
complexf_t osc = cos(oscillator_phase) + -sin(oscillator_phase)*I; | complexf_t osc = cos(oscillator_phase) + -sin(oscillator_phase)*I; | ||||
in *= osc; | |||||
in *= osc; | |||||
#endif | |||||
// Error detector | // Error detector | ||||
float error = cargf(in); | float error = cargf(in); | ||||
@@ -29,7 +29,7 @@ float convolve(const float *in, const float *taps, size_t len) { | |||||
return sum; | return sum; | ||||
} | } | ||||
float complex hilbert_transform(const float *in, const float *taps, size_t len) { | |||||
complexf_t hilbert_transform(const float *in, const float *taps, size_t len) { | |||||
float i = 0.0; | float i = 0.0; | ||||
float q = 0.0; | float q = 0.0; | ||||
@@ -39,7 +39,11 @@ float complex hilbert_transform(const float *in, const float *taps, size_t len) | |||||
} | } | ||||
i = in[len-1] - (i / len); | i = in[len-1] - (i / len); | ||||
#ifdef _MSC_VER | |||||
return _FCbuild(i, q); | |||||
#else | |||||
return i + q*I; | return i + q*I; | ||||
#endif | |||||
} | } | ||||
float interpolating_convolve(const float *in, const float *taps, size_t len, float offset, float delta) { | float interpolating_convolve(const float *in, const float *taps, size_t len, float offset, float delta) { | ||||
@@ -19,6 +19,12 @@ | |||||
#include <stddef.h> | #include <stddef.h> | ||||
#include <complex.h> | #include <complex.h> | ||||
float convolve(const float *in, const float *taps, size_t len); | |||||
float complex hilbert_transform(const float *in, const float *taps, size_t len); | |||||
float interpolating_convolve(const float *in, const float *taps, size_t len, float offset, float delta); | |||||
#ifdef _MSC_VER | |||||
typedef _Fcomplex complexf_t; | |||||
#else | |||||
typedef complex float complexf_t; | |||||
#endif | |||||
float convolve(const float *in, const float *taps, size_t len); | |||||
complexf_t hilbert_transform(const float *in, const float *taps, size_t len); | |||||
float interpolating_convolve(const float *in, const float *taps, size_t len, float offset, float delta); |