diff --git a/audio/audio_filters/Makefile b/audio/audio_filters/Makefile index 0e4fbddd86..44b9e38df5 100644 --- a/audio/audio_filters/Makefile +++ b/audio/audio_filters/Makefile @@ -57,12 +57,12 @@ endif CC := $(compiler) -Wall CXX := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall -flags := -fPIC $(extra_flags) +flags := -fPIC $(extra_flags) -I../../libretro-common/include asflags := -fPIC $(extra_flags) objects := ifeq (1,$(use_neon)) - ASMFLAGS := -INEON/asm + ASMFLAGS := -INEON/asm asflags += -mfpu=neon endif diff --git a/audio/audio_filters/eq.c b/audio/audio_filters/eq.c index 49828c013e..f81161e365 100644 --- a/audio/audio_filters/eq.c +++ b/audio/audio_filters/eq.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "fft/fft.c" @@ -185,7 +186,7 @@ static void generate_response(fft_complex_t *response, // Modified Bessel function of first order. // Check Wiki for mathematical definition ... -static inline double kaiser_besseli0(double x) +static INLINE double kaiser_besseli0(double x) { unsigned i; double sum = 0.0; @@ -211,7 +212,7 @@ static inline double kaiser_besseli0(double x) return sum; } -static inline double kaiser_window(double index, double beta) +static INLINE double kaiser_window(double index, double beta) { return kaiser_besseli0(beta * sqrt(1 - index * index)); } diff --git a/audio/audio_filters/iir.c b/audio/audio_filters/iir.c index 8347ecc6f3..7f91e2bdd0 100644 --- a/audio/audio_filters/iir.c +++ b/audio/audio_filters/iir.c @@ -25,19 +25,20 @@ #define sqr(a) ((a) * (a)) /* filter types */ -enum IIRFilter { - LPF, /* low pass filter */ - HPF, /* High pass filter */ - BPCSGF,/* band pass filter 1 */ - BPZPGF,/* band pass filter 2 */ - APF, /* Allpass filter*/ - NOTCH, /* Notch Filter */ - RIAA_phono, /* RIAA record/tape deemphasis */ - PEQ, /* Peaking band EQ filter */ - BBOOST, /* Bassboost filter */ - LSH, /* Low shelf filter */ - HSH, /* High shelf filter */ - RIAA_CD /* CD de-emphasis */ +enum IIRFilter +{ + LPF, /* low pass filter */ + HPF, /* High pass filter */ + BPCSGF, /* band pass filter 1 */ + BPZPGF, /* band pass filter 2 */ + APF, /* Allpass filter*/ + NOTCH, /* Notch Filter */ + RIAA_phono, /* RIAA record/tape deemphasis */ + PEQ, /* Peaking band EQ filter */ + BBOOST, /* Bassboost filter */ + LSH, /* Low shelf filter */ + HSH, /* High shelf filter */ + RIAA_CD /* CD de-emphasis */ }; struct iir_data @@ -90,8 +91,8 @@ static void iir_process(void *data, struct dspfilter_output *output, float in_l = out[0]; float in_r = out[1]; - float l = (b0 * in_l + b1 * xn1_l + b2 * xn2_l - a1 * yn1_l - a2 * yn2_l) / a0; - float r = (b0 * in_r + b1 * xn1_r + b2 * xn2_r - a1 * yn1_r - a2 * yn2_r) / a0; + float l = (b0 * in_l + b1 * xn1_l + b2 * xn2_l - a1 * yn1_l - a2 * yn2_l) / a0; + float r = (b0 * in_r + b1 * xn1_r + b2 * xn2_r - a1 * yn1_r - a2 * yn2_r) / a0; xn2_l = xn1_l; xn1_l = in_l; @@ -140,9 +141,11 @@ static void make_poly_from_roots( const double *roots, unsigned num_roots, float *poly) { unsigned i, j; + poly[0] = 1; poly[1] = -roots[0]; memset(poly + 2, 0, (num_roots + 1 - 2) * sizeof(*poly)); + for (i = 1; i < num_roots; i++) for (j = num_roots; j > 0; j--) poly[j] -= poly[j - 1] * roots[i]; diff --git a/audio/audio_filters/reverb.c b/audio/audio_filters/reverb.c index 229a39b7dd..2b9eac4e81 100644 --- a/audio/audio_filters/reverb.c +++ b/audio/audio_filters/reverb.c @@ -18,6 +18,7 @@ #include #include #include +#include struct comb { @@ -30,7 +31,15 @@ struct comb float damp1, damp2; }; -static inline float comb_process(struct comb *c, float input) +struct allpass +{ + float *buffer; + float feedback; + unsigned bufsize; + unsigned bufidx; +}; + +static INLINE float comb_process(struct comb *c, float input) { float output = c->buffer[c->bufidx]; c->filterstore = (output * c->damp2) + (c->filterstore * c->damp1); @@ -44,15 +53,8 @@ static inline float comb_process(struct comb *c, float input) return output; } -struct allpass -{ - float *buffer; - float feedback; - unsigned bufsize; - unsigned bufidx; -}; -static inline float allpass_process(struct allpass *a, float input) +static INLINE float allpass_process(struct allpass *a, float input) { float bufout = a->buffer[a->bufidx]; float output = -input + bufout;