From f4284aea8590d63baf818b4d6a3df13153949fc2 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Tue, 12 Aug 2008 16:49:13 -0400 Subject: Added an option to implement iir_mem16() and fir_mem16() in terms of filter_mem16() --- libspeex/filters.c | 4 +++- libspeex/filters.h | 11 +++++++++++ libspeex/ltp.c | 4 ++-- libspeex/ltp.h | 1 - 4 files changed, 16 insertions(+), 4 deletions(-) (limited to 'libspeex') diff --git a/libspeex/filters.c b/libspeex/filters.c index d7c950e..473e16c 100644 --- a/libspeex/filters.c +++ b/libspeex/filters.c @@ -320,7 +320,9 @@ spx_word16_t compute_rms16(const spx_word16_t *x, int len) } #endif - +#ifdef MERGE_FILTERS +const spx_word16_t zeros[10] = {0,0,0,0,0,0,0,0,0,0}; +#endif /* MERGE_FILTERS */ #if !defined(OVERRIDE_FILTER_MEM16) && !defined(DISABLE_ENCODER) void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) diff --git a/libspeex/filters.h b/libspeex/filters.h index d0689ea..df14851 100644 --- a/libspeex/filters.h +++ b/libspeex/filters.h @@ -62,8 +62,19 @@ void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack); void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); + +#ifdef MERGE_FILTERS + +#define OVERRIDE_IIR_MEM16 +#define OVERRIDE_FIR_MEM16 +extern const spx_word16_t zeros[]; +#define iir_mem16(x, den, y, N, ord, mem, stack) filter_mem16(x, zeros, den, y, N, ord, mem, stack) +#define fir_mem16(x, num, y, N, ord, mem, stack) filter_mem16(x, num, zeros, y, N, ord, mem, stack) + +#else /* MERGE_FILTERS */ void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); +#endif /* MERGE_FILTERS */ /* Apply bandwidth expansion on LPC coef */ void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order); diff --git a/libspeex/ltp.c b/libspeex/ltp.c index 3297313..2815587 100644 --- a/libspeex/ltp.c +++ b/libspeex/ltp.c @@ -78,7 +78,7 @@ spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) #ifndef OVERRIDE_PITCH_XCORR #if 0 /* HINT: Enable this for machines with enough registers (i.e. not x86) */ -void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack) +static void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack) { int i,j; for (i=0;i