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

modes.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 MODES_H 00037 #define MODES_H 00038 00039 #include <speex/speex.h> 00040 #include <speex/speex_bits.h> 00041 #include "misc.h" 00042 00043 #define NB_SUBMODES 16 00044 #define NB_SUBMODE_BITS 4 00045 00046 #define SB_SUBMODES 8 00047 #define SB_SUBMODE_BITS 3 00048 00049 00051 typedef void (*lsp_quant_func)(spx_lsp_t *, spx_lsp_t *, int, SpeexBits *); 00052 00054 typedef void (*lsp_unquant_func)(spx_lsp_t *, int, SpeexBits *); 00055 00056 00058 typedef int (*ltp_quant_func)(spx_sig_t *, spx_sig_t *, spx_coef_t *, spx_coef_t *, 00059 spx_coef_t *, spx_sig_t *, const void *, int, int, spx_word16_t, 00060 int, int, SpeexBits*, char *, spx_sig_t *, spx_sig_t *, int, int); 00061 00063 typedef void (*ltp_unquant_func)(spx_sig_t *, int, int, spx_word16_t, const void *, int, int *, 00064 spx_word16_t *, SpeexBits*, char*, int, int, spx_word16_t, int); 00065 00066 00068 typedef void (*innovation_quant_func)(spx_sig_t *, spx_coef_t *, spx_coef_t *, spx_coef_t *, const void *, int, int, 00069 spx_sig_t *, spx_sig_t *, SpeexBits *, char *, int); 00070 00072 typedef void (*innovation_unquant_func)(spx_sig_t *, const void *, int, SpeexBits*, char *); 00073 00075 typedef struct SpeexSubmode { 00076 int lbr_pitch; 00077 int forced_pitch_gain; 00078 int have_subframe_gain; 00079 int double_codebook; 00080 /*LSP functions*/ 00081 lsp_quant_func lsp_quant; 00082 lsp_unquant_func lsp_unquant; 00084 /*Lont-term predictor functions*/ 00085 ltp_quant_func ltp_quant; 00086 ltp_unquant_func ltp_unquant; 00087 const void *ltp_params; 00089 /*Quantization of innovation*/ 00090 innovation_quant_func innovation_quant; 00091 innovation_unquant_func innovation_unquant; 00092 const void *innovation_params; 00094 /*Synthesis filter enhancement*/ 00095 spx_word16_t lpc_enh_k1; 00096 spx_word16_t lpc_enh_k2; 00097 spx_word16_t lpc_enh_k3; 00098 spx_word16_t comb_gain; 00100 int bits_per_frame; 00101 } SpeexSubmode; 00102 00104 typedef struct SpeexNBMode { 00105 int frameSize; 00106 int subframeSize; 00107 int lpcSize; 00108 int bufSize; 00109 int pitchStart; 00110 int pitchEnd; 00112 spx_word16_t gamma1; 00113 spx_word16_t gamma2; 00114 float lag_factor; 00115 float lpc_floor; 00117 #ifdef EPIC_48K 00118 int lbr48k; 00119 #endif 00120 00121 const SpeexSubmode *submodes[NB_SUBMODES]; 00122 int defaultSubmode; 00123 int quality_map[11]; 00124 } SpeexNBMode; 00125 00126 00128 typedef struct SpeexSBMode { 00129 const SpeexMode *nb_mode; 00130 int frameSize; 00131 int subframeSize; 00132 int lpcSize; 00133 int bufSize; 00134 spx_word16_t gamma1; 00135 spx_word16_t gamma2; 00136 float lag_factor; 00137 float lpc_floor; 00138 float folding_gain; 00139 00140 const SpeexSubmode *submodes[SB_SUBMODES]; 00141 int defaultSubmode; 00142 int low_quality_map[11]; 00143 int quality_map[11]; 00144 const float (*vbr_thresh)[11]; 00145 int nb_modes; 00146 } SpeexSBMode; 00147 00148 int speex_encode_native(void *state, spx_word16_t *in, SpeexBits *bits); 00149 int speex_decode_native(void *state, SpeexBits *bits, spx_word16_t *out); 00150 00151 int nb_mode_query(const void *mode, int request, void *ptr); 00152 int wb_mode_query(const void *mode, int request, void *ptr); 00153 00154 #endif

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