ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filterbank.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) 2006 Jean-Marc Valin */ |
| TMBOY | 47:9e361da97763 | 2 | /** |
| TMBOY | 47:9e361da97763 | 3 | @file filterbank.h |
| TMBOY | 47:9e361da97763 | 4 | @brief Converting between psd and filterbank |
| 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 are |
| TMBOY | 47:9e361da97763 | 9 | met: |
| TMBOY | 47:9e361da97763 | 10 | |
| TMBOY | 47:9e361da97763 | 11 | 1. Redistributions of source code must retain the above copyright notice, |
| TMBOY | 47:9e361da97763 | 12 | this list of conditions and the following disclaimer. |
| TMBOY | 47:9e361da97763 | 13 | |
| TMBOY | 47:9e361da97763 | 14 | 2. 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 | 3. The name of the author may not be used to endorse or promote products |
| TMBOY | 47:9e361da97763 | 19 | derived from this software without specific prior written permission. |
| TMBOY | 47:9e361da97763 | 20 | |
| TMBOY | 47:9e361da97763 | 21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| TMBOY | 47:9e361da97763 | 22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| TMBOY | 47:9e361da97763 | 23 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| TMBOY | 47:9e361da97763 | 24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
| TMBOY | 47:9e361da97763 | 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| TMBOY | 47:9e361da97763 | 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| TMBOY | 47:9e361da97763 | 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| TMBOY | 47:9e361da97763 | 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| TMBOY | 47:9e361da97763 | 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| TMBOY | 47:9e361da97763 | 30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| TMBOY | 47:9e361da97763 | 31 | POSSIBILITY OF SUCH DAMAGE. |
| TMBOY | 47:9e361da97763 | 32 | */ |
| TMBOY | 47:9e361da97763 | 33 | |
| TMBOY | 47:9e361da97763 | 34 | #ifndef FILTERBANK_H |
| TMBOY | 47:9e361da97763 | 35 | #define FILTERBANK_H |
| TMBOY | 47:9e361da97763 | 36 | |
| TMBOY | 47:9e361da97763 | 37 | #include "misc.h" |
| TMBOY | 47:9e361da97763 | 38 | |
| TMBOY | 47:9e361da97763 | 39 | typedef struct { |
| TMBOY | 47:9e361da97763 | 40 | int *bank_left; |
| TMBOY | 47:9e361da97763 | 41 | int *bank_right; |
| TMBOY | 47:9e361da97763 | 42 | spx_word16_t *filter_left; |
| TMBOY | 47:9e361da97763 | 43 | spx_word16_t *filter_right; |
| TMBOY | 47:9e361da97763 | 44 | #ifndef FIXED_POINT |
| TMBOY | 47:9e361da97763 | 45 | float *scaling; |
| TMBOY | 47:9e361da97763 | 46 | #endif |
| TMBOY | 47:9e361da97763 | 47 | int nb_banks; |
| TMBOY | 47:9e361da97763 | 48 | int len; |
| TMBOY | 47:9e361da97763 | 49 | } FilterBank; |
| TMBOY | 47:9e361da97763 | 50 | |
| TMBOY | 47:9e361da97763 | 51 | |
| TMBOY | 47:9e361da97763 | 52 | FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type); |
| TMBOY | 47:9e361da97763 | 53 | |
| TMBOY | 47:9e361da97763 | 54 | void filterbank_destroy(FilterBank *bank); |
| TMBOY | 47:9e361da97763 | 55 | |
| TMBOY | 47:9e361da97763 | 56 | void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel); |
| TMBOY | 47:9e361da97763 | 57 | |
| TMBOY | 47:9e361da97763 | 58 | void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *psd); |
| TMBOY | 47:9e361da97763 | 59 | |
| TMBOY | 47:9e361da97763 | 60 | #ifndef FIXED_POINT |
| TMBOY | 47:9e361da97763 | 61 | void filterbank_compute_bank(FilterBank *bank, float *psd, float *mel); |
| TMBOY | 47:9e361da97763 | 62 | void filterbank_compute_psd(FilterBank *bank, float *mel, float *psd); |
| TMBOY | 47:9e361da97763 | 63 | #endif |
| TMBOY | 47:9e361da97763 | 64 | |
| TMBOY | 47:9e361da97763 | 65 | |
| TMBOY | 47:9e361da97763 | 66 | #endif |
