ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | /* Copyright (C) 2002 Jean-Marc Valin */ |
| TMBOY | 47:9e361da97763 | 2 | /** |
| TMBOY | 47:9e361da97763 | 3 | @file filters.h |
| TMBOY | 47:9e361da97763 | 4 | @brief Various analysis/synthesis filters |
| TMBOY | 47:9e361da97763 | 5 | */ |
| TMBOY | 47:9e361da97763 | 6 | /* |
| TMBOY | 47:9e361da97763 | 7 | Redistribution and use in source and binary forms, with or without |
| TMBOY | 47:9e361da97763 | 8 | modification, are permitted provided that the following conditions |
| TMBOY | 47:9e361da97763 | 9 | are met: |
| TMBOY | 47:9e361da97763 | 10 | |
| TMBOY | 47:9e361da97763 | 11 | - Redistributions of source code must retain the above copyright |
| TMBOY | 47:9e361da97763 | 12 | notice, this list of conditions and the following disclaimer. |
| TMBOY | 47:9e361da97763 | 13 | |
| TMBOY | 47:9e361da97763 | 14 | - Redistributions in binary form must reproduce the above copyright |
| TMBOY | 47:9e361da97763 | 15 | notice, this list of conditions and the following disclaimer in the |
| TMBOY | 47:9e361da97763 | 16 | documentation and/or other materials provided with the distribution. |
| TMBOY | 47:9e361da97763 | 17 | |
| TMBOY | 47:9e361da97763 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its |
| TMBOY | 47:9e361da97763 | 19 | contributors may be used to endorse or promote products derived from |
| TMBOY | 47:9e361da97763 | 20 | this software without specific prior written permission. |
| TMBOY | 47:9e361da97763 | 21 | |
| TMBOY | 47:9e361da97763 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| TMBOY | 47:9e361da97763 | 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| TMBOY | 47:9e361da97763 | 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| TMBOY | 47:9e361da97763 | 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| TMBOY | 47:9e361da97763 | 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| TMBOY | 47:9e361da97763 | 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| TMBOY | 47:9e361da97763 | 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| TMBOY | 47:9e361da97763 | 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| TMBOY | 47:9e361da97763 | 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| TMBOY | 47:9e361da97763 | 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| TMBOY | 47:9e361da97763 | 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| TMBOY | 47:9e361da97763 | 33 | */ |
| TMBOY | 47:9e361da97763 | 34 | |
| TMBOY | 47:9e361da97763 | 35 | #ifndef FILTERS_H |
| TMBOY | 47:9e361da97763 | 36 | #define FILTERS_H |
| TMBOY | 47:9e361da97763 | 37 | |
| TMBOY | 47:9e361da97763 | 38 | #include "misc.h" |
| TMBOY | 47:9e361da97763 | 39 | |
| TMBOY | 47:9e361da97763 | 40 | spx_word16_t compute_rms(const spx_sig_t *x, int len); |
| TMBOY | 47:9e361da97763 | 41 | spx_word16_t compute_rms16(const spx_word16_t *x, int len); |
| TMBOY | 47:9e361da97763 | 42 | void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len); |
| TMBOY | 47:9e361da97763 | 43 | void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len); |
| TMBOY | 47:9e361da97763 | 44 | |
| TMBOY | 47:9e361da97763 | 45 | #ifdef FIXED_POINT |
| TMBOY | 47:9e361da97763 | 46 | |
| TMBOY | 47:9e361da97763 | 47 | int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len); |
| TMBOY | 47:9e361da97763 | 48 | |
| TMBOY | 47:9e361da97763 | 49 | #endif |
| TMBOY | 47:9e361da97763 | 50 | |
| TMBOY | 47:9e361da97763 | 51 | |
| TMBOY | 47:9e361da97763 | 52 | #define HIGHPASS_NARROWBAND 0 |
| TMBOY | 47:9e361da97763 | 53 | #define HIGHPASS_WIDEBAND 2 |
| TMBOY | 47:9e361da97763 | 54 | #define HIGHPASS_INPUT 0 |
| TMBOY | 47:9e361da97763 | 55 | #define HIGHPASS_OUTPUT 1 |
| TMBOY | 47:9e361da97763 | 56 | #define HIGHPASS_IRS 4 |
| TMBOY | 47:9e361da97763 | 57 | |
| TMBOY | 47:9e361da97763 | 58 | void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem); |
| TMBOY | 47:9e361da97763 | 59 | |
| TMBOY | 47:9e361da97763 | 60 | |
| TMBOY | 47:9e361da97763 | 61 | void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack); |
| TMBOY | 47:9e361da97763 | 62 | 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_word32_t *mem1, spx_word32_t *mem2, char *stack); |
| TMBOY | 47:9e361da97763 | 63 | |
| TMBOY | 47:9e361da97763 | 64 | 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); |
| TMBOY | 47:9e361da97763 | 65 | 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); |
| TMBOY | 47:9e361da97763 | 66 | 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); |
| TMBOY | 47:9e361da97763 | 67 | |
| TMBOY | 47:9e361da97763 | 68 | /* Apply bandwidth expansion on LPC coef */ |
| TMBOY | 47:9e361da97763 | 69 | void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order); |
| TMBOY | 47:9e361da97763 | 70 | void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len); |
| TMBOY | 47:9e361da97763 | 71 | |
| TMBOY | 47:9e361da97763 | 72 | |
| TMBOY | 47:9e361da97763 | 73 | void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); |
| TMBOY | 47:9e361da97763 | 74 | void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); |
| TMBOY | 47:9e361da97763 | 75 | |
| TMBOY | 47:9e361da97763 | 76 | void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); |
| TMBOY | 47:9e361da97763 | 77 | |
| TMBOY | 47:9e361da97763 | 78 | void multicomb( |
| TMBOY | 47:9e361da97763 | 79 | spx_word16_t *exc, /*decoded excitation*/ |
| TMBOY | 47:9e361da97763 | 80 | spx_word16_t *new_exc, /*enhanced excitation*/ |
| TMBOY | 47:9e361da97763 | 81 | spx_coef_t *ak, /*LPC filter coefs*/ |
| TMBOY | 47:9e361da97763 | 82 | int p, /*LPC order*/ |
| TMBOY | 47:9e361da97763 | 83 | int nsf, /*sub-frame size*/ |
| TMBOY | 47:9e361da97763 | 84 | int pitch, /*pitch period*/ |
| TMBOY | 47:9e361da97763 | 85 | int max_pitch, /*pitch gain (3-tap)*/ |
| TMBOY | 47:9e361da97763 | 86 | spx_word16_t comb_gain, /*gain of comb filter*/ |
| TMBOY | 47:9e361da97763 | 87 | char *stack |
| TMBOY | 47:9e361da97763 | 88 | ); |
| TMBOY | 47:9e361da97763 | 89 | |
| TMBOY | 47:9e361da97763 | 90 | #endif |
