Main Page | Class List | Directories | File List | Class Members | File Members

filters.h

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

Generated on Sun Feb 27 16:36:11 2005 for speex by  doxygen 1.4.1