瀏覽代碼

Fix MSVC build #20

tags/v1.8.0
Xerbo 2 年之前
父節點
當前提交
3e8297a912
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 34103F6D8F11CEB0
共有 3 個檔案被更改,包括 20 行新增11 行删除
  1. +6
    -7
      src/dsp.c
  2. +5
    -1
      src/filter.c
  3. +9
    -3
      src/filter.h

+ 6
- 7
src/dsp.c 查看文件

@@ -26,12 +26,6 @@
#include "taps.h"
#include "util.h"

#ifdef _MSC_VER
typedef _Fcomplex complexf_t;
#else
typedef complex float complexf_t;
#endif

// Block sizes
#define BLKAMP 32768
#define BLKIN 32768
@@ -69,8 +63,13 @@ static float pll(complexf_t in) {
static float oscillator_phase = 0.0;

// 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;
in *= osc;
in *= osc;
#endif

// Error detector
float error = cargf(in);


+ 5
- 1
src/filter.c 查看文件

@@ -29,7 +29,7 @@ float convolve(const float *in, const float *taps, size_t len) {
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 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);
#ifdef _MSC_VER
return _FCbuild(i, q);
#else
return i + q*I;
#endif
}

float interpolating_convolve(const float *in, const float *taps, size_t len, float offset, float delta) {


+ 9
- 3
src/filter.h 查看文件

@@ -19,6 +19,12 @@
#include <stddef.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);

Loading…
取消
儲存