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

nb_celp.h

Go to the documentation of this file.
00001 /* Copyright (C) 2002 Jean-Marc Valin */
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 
00036 #ifndef NB_CELP_H
00037 #define NB_CELP_H
00038 
00039 #include "modes.h"
00040 #include "speex_bits.h"
00041 #include "speex_callbacks.h"
00042 #include "vbr.h"
00043 #include "filters.h"
00044 
00046 typedef struct EncState {
00047    SpeexMode *mode;       
00048    int    first;          
00049    int    frameSize;      
00050    int    subframeSize;   
00051    int    nbSubframes;    
00052    int    windowSize;     
00053    int    lpcSize;        
00054    int    bufSize;        
00055    int    min_pitch;      
00056    int    max_pitch;      
00058    int    safe_pitch;     
00059    int    bounded_pitch;  
00060    int    ol_pitch;       
00061    int    ol_voiced;      
00062    int   *pitch;
00063    float  gamma1;         
00064    float  gamma2;         
00065    float  lag_factor;     
00066    float  lpc_floor;      
00067    float  preemph;        
00068    float  pre_mem;        
00069    float  pre_mem2;       
00070    char  *stack;          
00071    float *inBuf;          
00072    float *frame;          
00073    float *excBuf;         
00074    float *exc;            
00075    float *exc2Buf;        
00076    float *exc2;           
00077    float *swBuf;          
00078    float *sw;             
00079    float *innov;          
00080    float *window;         
00081    float *buf2;           
00082    float *autocorr;       
00083    float *lagWindow;      
00084    float *lpc;            
00085    float *lsp;            
00086    float *qlsp;           
00087    float *old_lsp;        
00088    float *old_qlsp;       
00089    float *interp_lsp;     
00090    float *interp_qlsp;    
00091    float *interp_lpc;     
00092    float *interp_qlpc;    
00093    float *bw_lpc1;        
00094    float *bw_lpc2;        
00095    float *rc;             
00096    float *mem_sp;         
00097    float *mem_sw;         
00098    float *mem_sw_whole;   
00099    float *mem_exc;        
00100    float *pi_gain;        
00102    VBRState *vbr;         
00103    float  vbr_quality;    
00104    float  relative_quality; 
00105    int    vbr_enabled;    
00106    int    vad_enabled;    
00107    int    dtx_enabled;    
00108    int    dtx_count;      
00109    int    abr_enabled;    
00110    float  abr_drift;
00111    float  abr_drift2;
00112    float  abr_count;
00113    int    complexity;     
00114    int    sampling_rate;
00115 
00116    SpeexSubmode **submodes; 
00117    int    submodeID;      
00118    int    submodeSelect;  
00119 } EncState;
00120 
00122 typedef struct DecState {
00123    SpeexMode *mode;       
00124    int    first;          
00125    int    count_lost;     
00126    int    frameSize;      
00127    int    subframeSize;   
00128    int    nbSubframes;    
00129    int    windowSize;     
00130    int    lpcSize;        
00131    int    bufSize;        
00132    int    min_pitch;      
00133    int    max_pitch;      
00134    int    sampling_rate;
00135    float  last_ol_gain;   
00138    float  gamma1;         
00139    float  gamma2;         
00140    float  preemph;        
00141    float  pre_mem;        
00142    char  *stack;          
00143    float *inBuf;          
00144    float *frame;          
00145    float *excBuf;         
00146    float *exc;            
00147    float *innov;          
00148    float *qlsp;           
00149    float *old_qlsp;       
00150    float *interp_qlsp;    
00151    float *interp_qlpc;    
00152    float *mem_sp;         
00153    float *pi_gain;        
00154    int    last_pitch;     
00155    float  last_pitch_gain; 
00156    float  pitch_gain_buf[3];  
00157    int    pitch_gain_buf_idx; 
00159    SpeexSubmode **submodes; 
00160    int    submodeID;      
00161    int    lpc_enh_enabled; 
00162    CombFilterMem *comb_mem;
00163    SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS];
00164 
00165    SpeexCallback user_callback;
00166 
00167    /*Vocoder data*/
00168    float  voc_m1;
00169    float  voc_m2;
00170    float  voc_mean;
00171    int    voc_offset;
00172 
00173    int    dtx_enabled;
00174 } DecState;
00175 
00177 void *nb_encoder_init(SpeexMode *m);
00178 
00180 void nb_encoder_destroy(void *state);
00181 
00183 int nb_encode(void *state, float *in, SpeexBits *bits);
00184 
00185 
00187 void *nb_decoder_init(SpeexMode *m);
00188 
00190 void nb_decoder_destroy(void *state);
00191 
00193 int nb_decode(void *state, SpeexBits *bits, float *out);
00194 
00196 int nb_encoder_ctl(void *state, int request, void *ptr);
00197 
00199 int nb_decoder_ctl(void *state, int request, void *ptr);
00200 
00201 
00202 #endif

Generated on Thu Nov 20 04:15:42 2003 for speex by doxygen 1.3.4