Main Page | Class List | Directories | 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 
00064 #ifdef EPIC_48K
00065    int    lbr_48k;
00066 #endif
00067 
00068    float  gamma1;         
00069    float  gamma2;         
00070    float  lag_factor;     
00071    float  lpc_floor;      
00072    char  *stack;          
00073    spx_sig_t *inBuf;          
00074    spx_sig_t *frame;          
00075    spx_sig_t *excBuf;         
00076    spx_sig_t *exc;            
00077    spx_sig_t *exc2Buf;        
00078    spx_sig_t *exc2;           
00079    spx_sig_t *swBuf;          
00080    spx_sig_t *sw;             
00081    spx_sig_t *innov;          
00082    spx_word16_t *window;         
00083    spx_sig_t *buf2;           
00084    spx_word16_t *autocorr;       
00085    float *lagWindow;      
00086    spx_coef_t *lpc;            
00087    spx_lsp_t *lsp;            
00088    spx_lsp_t *qlsp;           
00089    spx_lsp_t *old_lsp;        
00090    spx_lsp_t *old_qlsp;       
00091    spx_lsp_t *interp_lsp;     
00092    spx_lsp_t *interp_qlsp;    
00093    spx_coef_t *interp_lpc;     
00094    spx_coef_t *interp_qlpc;    
00095    spx_coef_t *bw_lpc1;        
00096    spx_coef_t *bw_lpc2;        
00097    spx_mem_t *mem_sp;         
00098    spx_mem_t *mem_sw;         
00099    spx_mem_t *mem_sw_whole;   
00100    spx_mem_t *mem_exc;        
00101    float *pi_gain;        
00103    VBRState *vbr;         
00104    float  vbr_quality;    
00105    float  relative_quality; 
00106    int    vbr_enabled;    
00107    int    vad_enabled;    
00108    int    dtx_enabled;    
00109    int    dtx_count;      
00110    int    abr_enabled;    
00111    float  abr_drift;
00112    float  abr_drift2;
00113    float  abr_count;
00114    int    complexity;     
00115    int    sampling_rate;
00116 
00117    int    encode_submode;
00118    SpeexSubmode **submodes; 
00119    int    submodeID;      
00120    int    submodeSelect;  
00121 } EncState;
00122 
00124 typedef struct DecState {
00125    SpeexMode *mode;       
00126    int    first;          
00127    int    count_lost;     
00128    int    frameSize;      
00129    int    subframeSize;   
00130    int    nbSubframes;    
00131    int    windowSize;     
00132    int    lpcSize;        
00133    int    bufSize;        
00134    int    min_pitch;      
00135    int    max_pitch;      
00136    int    sampling_rate;
00137 
00138 #ifdef EPIC_48K
00139    int    lbr_48k;
00140 #endif
00141 
00142    float  last_ol_gain;   
00144    float  gamma1;         
00145    float  gamma2;         
00146    char  *stack;          
00147    spx_sig_t *inBuf;          
00148    spx_sig_t *frame;          
00149    spx_sig_t *excBuf;         
00150    spx_sig_t *exc;            
00151    spx_sig_t *innov;          
00152    spx_lsp_t *qlsp;           
00153    spx_lsp_t *old_qlsp;       
00154    spx_lsp_t *interp_qlsp;    
00155    spx_coef_t *interp_qlpc;    
00156    spx_mem_t *mem_sp;         
00157    float *pi_gain;        
00158    int    last_pitch;     
00159    float  last_pitch_gain; 
00160    float  pitch_gain_buf[3];  
00161    int    pitch_gain_buf_idx; 
00163    int    encode_submode;
00164    SpeexSubmode **submodes; 
00165    int    submodeID;      
00166    int    lpc_enh_enabled; 
00167    CombFilterMem *comb_mem;
00168    SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS];
00169 
00170    SpeexCallback user_callback;
00171 
00172    /*Vocoder data*/
00173    float  voc_m1;
00174    float  voc_m2;
00175    float  voc_mean;
00176    int    voc_offset;
00177 
00178    int    dtx_enabled;
00179 } DecState;
00180 
00182 void *nb_encoder_init(SpeexMode *m);
00183 
00185 void nb_encoder_destroy(void *state);
00186 
00188 int nb_encode(void *state, short *in, SpeexBits *bits);
00189 
00190 
00192 void *nb_decoder_init(SpeexMode *m);
00193 
00195 void nb_decoder_destroy(void *state);
00196 
00198 int nb_decode(void *state, SpeexBits *bits, short *out);
00199 
00201 int nb_encoder_ctl(void *state, int request, void *ptr);
00202 
00204 int nb_decoder_ctl(void *state, int request, void *ptr);
00205 
00206 
00207 #endif

Generated on Wed Aug 24 01:08:53 2005 for Speex by  doxygen 1.4.2