diff options
author | Jean-Marc Valin <jean-marc.valin@octasic.com> | 2008-08-13 00:49:13 +0400 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@octasic.com> | 2008-08-13 00:49:13 +0400 |
commit | f4284aea8590d63baf818b4d6a3df13153949fc2 (patch) | |
tree | 6996e0b55b9f8be99839733c9efdddc22c1b6341 /libspeex | |
parent | 95fceab730829224aa519350723e36b949f1bd96 (diff) |
Added an option to implement iir_mem16() and fir_mem16() in terms of
filter_mem16()
Diffstat (limited to 'libspeex')
-rw-r--r-- | libspeex/filters.c | 4 | ||||
-rw-r--r-- | libspeex/filters.h | 11 | ||||
-rw-r--r-- | libspeex/ltp.c | 4 | ||||
-rw-r--r-- | libspeex/ltp.h | 1 |
4 files changed, 16 insertions, 4 deletions
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<nb_pitch;i+=4) @@ -141,7 +141,7 @@ void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *c } #else -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; for (i=0;i<nb_pitch;i++) diff --git a/libspeex/ltp.h b/libspeex/ltp.h index a2912e2..7218ffe 100644 --- a/libspeex/ltp.h +++ b/libspeex/ltp.h @@ -52,7 +52,6 @@ typedef struct { #endif spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len); -void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack); void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack); |