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/speex_bits.h> 00041 #include <speex/speex_callbacks.h> 00042 #include "vbr.h" 00043 #include "filters.h" 00044 00046 typedef struct EncState { 00047 const 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 spx_word16_t gamma1; 00069 spx_word16_t 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 spx_word16_t *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 spx_word32_t *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 const SpeexSubmode * const *submodes; 00119 int submodeID; 00120 int submodeSelect; 00121 } EncState; 00122 00124 typedef struct DecState { 00125 const 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 spx_word16_t last_ol_gain; 00144 char *stack; 00145 spx_sig_t *inBuf; 00146 spx_sig_t *frame; 00147 spx_sig_t *excBuf; 00148 spx_sig_t *exc; 00149 spx_sig_t *innov; 00150 spx_lsp_t *qlsp; 00151 spx_lsp_t *old_qlsp; 00152 spx_lsp_t *interp_qlsp; 00153 spx_coef_t *interp_qlpc; 00154 spx_mem_t *mem_sp; 00155 spx_word32_t *pi_gain; 00156 int last_pitch; 00157 spx_word16_t last_pitch_gain; 00158 spx_word16_t pitch_gain_buf[3]; 00159 int pitch_gain_buf_idx; 00161 int encode_submode; 00162 const SpeexSubmode * const *submodes; 00163 int submodeID; 00164 int lpc_enh_enabled; 00165 CombFilterMem *comb_mem; 00166 SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS]; 00167 00168 SpeexCallback user_callback; 00169 00170 /*Vocoder data*/ 00171 float voc_m1; 00172 float voc_m2; 00173 float voc_mean; 00174 int voc_offset; 00175 00176 int dtx_enabled; 00177 } DecState; 00178 00180 void *nb_encoder_init(const SpeexMode *m); 00181 00183 void nb_encoder_destroy(void *state); 00184 00186 int nb_encode(void *state, void *in, SpeexBits *bits); 00187 00188 00190 void *nb_decoder_init(const SpeexMode *m); 00191 00193 void nb_decoder_destroy(void *state); 00194 00196 int nb_decode(void *state, SpeexBits *bits, void *out); 00197 00199 int nb_encoder_ctl(void *state, int request, void *ptr); 00200 00202 int nb_decoder_ctl(void *state, int request, void *ptr); 00203 00204 00205 #endif

Generated on Thu Aug 12 11:55:01 2004 for speex by doxygen 1.3.8