ex

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers filters.h Source File

filters.h

Go to the documentation of this file.
00001 /* Copyright (C) 2002 Jean-Marc Valin */
00002 /**
00003    @file filters.h
00004    @brief Various analysis/synthesis filters
00005 */
00006 /*
00007    Redistribution and use in source and binary forms, with or without
00008    modification, are permitted provided that the following conditions
00009    are met:
00010    
00011    - Redistributions of source code must retain the above copyright
00012    notice, this list of conditions and the following disclaimer.
00013    
00014    - 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    - Neither the name of the Xiph.org Foundation nor the names of its
00019    contributors may be used to endorse or promote products derived from
00020    this software without specific prior written permission.
00021    
00022    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00026    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00028    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00029    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00030    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00031    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 */
00034 
00035 #ifndef FILTERS_H
00036 #define FILTERS_H
00037 
00038 #include "misc.h"
00039 
00040 spx_word16_t compute_rms(const spx_sig_t *x, int len);
00041 spx_word16_t compute_rms16(const spx_word16_t *x, int len);
00042 void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len);
00043 void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len);
00044 
00045 #ifdef FIXED_POINT
00046 
00047 int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len);
00048 
00049 #endif
00050 
00051 
00052 #define HIGHPASS_NARROWBAND 0
00053 #define HIGHPASS_WIDEBAND 2
00054 #define HIGHPASS_INPUT 0
00055 #define HIGHPASS_OUTPUT 1
00056 #define HIGHPASS_IRS 4
00057 
00058 void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem);
00059 
00060 
00061 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);
00062 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);
00063 
00064 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);
00065 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);
00066 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);
00067 
00068 /* Apply bandwidth expansion on LPC coef */
00069 void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order);
00070 void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len);
00071 
00072 
00073 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);
00074 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);
00075 
00076 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);
00077 
00078 void multicomb(
00079 spx_word16_t *exc,          /*decoded excitation*/
00080 spx_word16_t *new_exc,      /*enhanced excitation*/
00081 spx_coef_t *ak,           /*LPC filter coefs*/
00082 int p,               /*LPC order*/
00083 int nsf,             /*sub-frame size*/
00084 int pitch,           /*pitch period*/
00085 int max_pitch,   /*pitch gain (3-tap)*/
00086 spx_word16_t  comb_gain,    /*gain of comb filter*/
00087 char *stack
00088 );
00089 
00090 #endif