Main Page | Compound List | File List | Compound Members | File Members

speex.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 SPEEX_H
00037 #define SPEEX_H
00038 
00039 #include "speex_bits.h"
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 /* Values allowed for *ctl() requests */
00046 
00048 #define SPEEX_SET_ENH 0
00049 
00050 #define SPEEX_GET_ENH 1
00051 
00052 /*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/
00054 #define SPEEX_GET_FRAME_SIZE 3
00055 
00057 #define SPEEX_SET_QUALITY 4
00058 
00059 #define SPEEX_GET_QUALITY 5
00060 
00062 #define SPEEX_SET_MODE 6
00063 
00064 #define SPEEX_GET_MODE 7
00065 
00067 #define SPEEX_SET_LOW_MODE 8
00068 
00069 #define SPEEX_GET_LOW_MODE 9
00070 
00072 #define SPEEX_SET_HIGH_MODE 10
00073 
00074 #define SPEEX_GET_HIGH_MODE 11
00075 
00077 #define SPEEX_SET_VBR 12
00078 
00079 #define SPEEX_GET_VBR 13
00080 
00082 #define SPEEX_SET_VBR_QUALITY 14
00083 
00084 #define SPEEX_GET_VBR_QUALITY 15
00085 
00087 #define SPEEX_SET_COMPLEXITY 16
00088 
00089 #define SPEEX_GET_COMPLEXITY 17
00090 
00092 #define SPEEX_SET_BITRATE 18
00093 
00094 #define SPEEX_GET_BITRATE 19
00095 
00097 #define SPEEX_SET_HANDLER 20
00098 
00100 #define SPEEX_SET_USER_HANDLER 22
00101 
00103 #define SPEEX_SET_SAMPLING_RATE 24
00104 
00105 #define SPEEX_GET_SAMPLING_RATE 25
00106 
00108 #define SPEEX_RESET_STATE 26
00109 
00111 #define SPEEX_GET_RELATIVE_QUALITY 29
00112 
00114 #define SPEEX_SET_VAD 30
00115 
00117 #define SPEEX_GET_VAD 31
00118 
00120 #define SPEEX_SET_ABR 32
00121 
00122 #define SPEEX_GET_ABR 33
00123 
00125 #define SPEEX_SET_DTX 34
00126 
00127 #define SPEEX_GET_DTX 35
00128 
00130 #define SPEEX_SET_SUBMODE_ENCODING 36
00131 
00132 #define SPEEX_GET_SUBMODE_ENCODING 37
00133 
00134 
00135 /* Used internally, not to be used in applications */
00137 #define SPEEX_GET_PI_GAIN 100
00138 
00139 #define SPEEX_GET_EXC     101
00140 
00141 #define SPEEX_GET_INNOV   102
00142 
00143 #define SPEEX_GET_DTX_STATUS   103
00144 
00145 
00146 /* Preserving compatibility:*/
00148 #define SPEEX_SET_PF 0
00149 
00150 #define SPEEX_GET_PF 1
00151 
00152 
00153 /* Values allowed for mode queries */
00155 #define SPEEX_MODE_FRAME_SIZE 0
00156 
00158 #define SPEEX_SUBMODE_BITS_PER_FRAME 1
00159 
00160 
00162 #define SPEEX_NB_MODES 3
00163 
00164 struct SpeexMode;
00165 
00166 
00167 /* Prototypes for mode function pointers */
00168 
00170 typedef void *(*encoder_init_func)(struct SpeexMode *mode);
00171 
00173 typedef void (*encoder_destroy_func)(void *st);
00174 
00176 typedef int (*encode_func)(void *state, float *in, SpeexBits *bits);
00177 
00179 typedef int (*encoder_ctl_func)(void *state, int request, void *ptr);
00180 
00182 typedef void *(*decoder_init_func)(struct SpeexMode *mode);
00183 
00185 typedef void (*decoder_destroy_func)(void *st);
00186 
00188 typedef int  (*decode_func)(void *state, SpeexBits *bits, float *out);
00189 
00191 typedef int (*decoder_ctl_func)(void *state, int request, void *ptr);
00192 
00193 
00195 typedef int (*mode_query_func)(void *mode, int request, void *ptr);
00196 
00198 typedef struct SpeexMode {
00200    void *mode;
00201 
00203    mode_query_func query;
00204    
00206    char *modeName;
00207 
00209    int modeID;
00210 
00213    int bitstream_version;
00214 
00216    encoder_init_func enc_init;
00217 
00219    encoder_destroy_func enc_destroy;
00220 
00222    encode_func enc;
00223 
00225    decoder_init_func dec_init;
00226 
00228    decoder_destroy_func dec_destroy;
00229 
00231    decode_func dec;
00232 
00234    encoder_ctl_func enc_ctl;
00235 
00237    decoder_ctl_func dec_ctl;
00238 
00239 } SpeexMode;
00240 
00250 void *speex_encoder_init(SpeexMode *mode);
00251 
00254 void speex_encoder_destroy(void *state);
00255 
00262 int speex_encode(void *state, float *in, SpeexBits *bits);
00263 
00271 int speex_encoder_ctl(void *state, int request, void *ptr);
00272 
00273 
00282 void *speex_decoder_init(SpeexMode *mode);
00283 
00288 void speex_decoder_destroy(void *state);
00289 
00298 int speex_decode(void *state, SpeexBits *bits, float *out);
00299 
00307 int speex_decoder_ctl(void *state, int request, void *ptr);
00308 
00309 
00316 int speex_mode_query(SpeexMode *mode, int request, void *ptr);
00317 
00318 
00320 extern SpeexMode speex_nb_mode;
00321 
00323 extern SpeexMode speex_wb_mode;
00324 
00326 extern SpeexMode speex_uwb_mode;
00327 
00328 #ifdef EPIC_48K
00329 
00330 extern SpeexMode speex_nb_48k_mode;
00331 #endif
00332 
00334 extern SpeexMode *speex_mode_list[SPEEX_NB_MODES];
00335 
00336 #ifdef __cplusplus
00337 }
00338 #endif
00339 
00340 
00341 #endif

Generated on Sun Sep 21 16:07:08 2003 for speex by doxygen 1.3.2