ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers filterbank.h Source File

filterbank.h

Go to the documentation of this file.
00001 /* Copyright (C) 2006 Jean-Marc Valin */
00002 /**
00003    @file filterbank.h
00004    @brief Converting between psd and filterbank
00005  */
00006 /*
00007    Redistribution and use in source and binary forms, with or without
00008    modification, are permitted provided that the following conditions are
00009    met:
00010 
00011    1. Redistributions of source code must retain the above copyright notice,
00012    this list of conditions and the following disclaimer.
00013 
00014    2. Redistributions in binary form must reproduce the above copyright
00015    notice, this list of conditions and the following disclaimer in the
00016    documentation and/or other materials provided with the distribution.
00017 
00018    3. The name of the author may not be used to endorse or promote products
00019    derived from this software without specific prior written permission.
00020 
00021    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00022    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00023    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00024    DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
00025    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00026    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00027    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00029    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00030    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00031    POSSIBILITY OF SUCH DAMAGE.
00032 */
00033 
00034 #ifndef FILTERBANK_H
00035 #define FILTERBANK_H
00036 
00037 #include "misc.h"
00038 
00039 typedef struct {
00040    int *bank_left;
00041    int *bank_right;
00042    spx_word16_t *filter_left;
00043    spx_word16_t *filter_right;
00044 #ifndef FIXED_POINT
00045    float *scaling;
00046 #endif
00047    int nb_banks;
00048    int len;
00049 } FilterBank;
00050 
00051 
00052 FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type);
00053 
00054 void filterbank_destroy(FilterBank *bank);
00055 
00056 void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel);
00057 
00058 void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *psd);
00059 
00060 #ifndef FIXED_POINT
00061 void filterbank_compute_bank(FilterBank *bank, float *psd, float *mel);
00062 void filterbank_compute_psd(FilterBank *bank, float *mel, float *psd);
00063 #endif
00064 
00065 
00066 #endif