speex.h   speex.h 
/* Copyright (C) 2002 Jean-Marc Valin /* Copyright (C) 2002 Jean-Marc Valin
File: speex.h File: modes.h
Describes the different modes of the codec
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
*/ */
#ifndef SPEEX_H #ifndef SPEEX_MODES_H
#define SPEEX_H #define SPEEX_MODES_H
#include "modes.h" #ifdef __cplusplus
#include "bits.h" extern "C" {
#endif
/**Structure representing the full state of the encoder*/ #include "speex_bits.h"
typedef struct EncState {
int first; /* Is this the first frame? */
int frameSize; /* Size of frames */
int subframeSize; /* Size of sub-frames */
int nbSubframes; /* Number of sub-frames */
int windowSize; /* Analysis (LPC) window length */
int lpcSize; /* LPC order */
int bufSize; /* Buffer size */
int min_pitch; /* Minimum pitch value allowed */
int max_pitch; /* Maximum pitch value allowed */
int ol_pitch; /* Open-loop pitch */
int ol_voiced; /* Open-loop voiced/non-voiced decision */
float gamma1; /* Perceptual filter: A(z/gamma1) */
float gamma2; /* Perceptual filter: A(z/gamma2) */
float lag_factor; /* Lag windowing gaussian width */
float lpc_floor; /* Noise floor multiplier for A[0] in LPC analysi
s*/
float preemph; /* Pre-emphasis: P(z) = 1 - a*z^-1*/
float pre_mem; /* 1-element memory for pre-emphasis */
float pre_mem2; /* 1-element memory for pre-emphasis */
float *stack; /* Pseudo-stack allocation for temporary memory *
/
int os_fact; /* Over-sampling factor for fractional pitch */
int os_filt_ord2; /* Over-sampling filter size for fractional pitch
*/
float *os_exc; /* Over-sampled excitation for fractional pitch *
/
float *os_filt; /* Over-sampling filter for fractional pitch */
float *inBuf; /* Input buffer (original signal) */
float *frame; /* Start of original frame */
float *excBuf; /* Excitation buffer */
float *exc; /* Start of excitation frame */
float *swBuf; /* Weighted signal buffer */
float *sw; /* Start of weighted signal frame */
float *window; /* Temporary (Hanning) window */
float *buf2; /* 2nd temporary buffer */
float *autocorr; /* auto-correlation */
float *lagWindow; /* Window applied to auto-correlation */
float *lpc; /* LPCs for current frame */
float *lsp; /* LSPs for current frame */
float *qlsp; /* Quantized LSPs for current frame */
float *old_lsp; /* LSPs for previous frame */
float *old_qlsp; /* Quantized LSPs for previous frame */
float *interp_lsp; /* Interpolated LSPs */
float *interp_qlsp; /* Interpolated quantized LSPs */
float *interp_lpc; /* Interpolated LPCs */
float *interp_qlpc; /* Interpolated quantized LPCs */
float *bw_lpc1; /* LPCs after bandwidth expansion by gamma1 for p
erceptual weighting*/
float *bw_lpc2; /* LPCs after bandwidth expansion by gamma2 for p
erceptual weighting*/
float *rc; /* Reflection coefficients */
float *mem_sp, *mem_sw;
float *dmem1, *dmem2;
float *pi_gain;
lsp_quant_func lsp_quant; struct SpeexMode;
ltp_quant_func ltp_quant;
void *ltp_params;
innovation_quant_func innovation_quant;
void *innovation_params;
} EncState;
typedef struct DecState { typedef void *(*encoder_init_func)(struct SpeexMode *mode);
int first; /* Is this the first frame? */ typedef void (*encoder_destroy_func)(void *st);
int frameSize; /* Size of frames */ typedef void (*encode_func)(void *state, float *in, FrameBits *bits);
int subframeSize; /* Size of sub-frames */ typedef void *(*decoder_init_func)(struct SpeexMode *mode);
int nbSubframes; /* Number of sub-frames */ typedef void (*decoder_destroy_func)(void *st);
int windowSize; /* Analysis (LPC) window length */ typedef void (*decode_func)(void *state, FrameBits *bits, float *out);
int lpcSize; /* LPC order */
int bufSize; /* Buffer size */
int min_pitch; /* Minimum pitch value allowed */
int max_pitch; /* Maximum pitch value allowed */
float gamma1; /* Perceptual filter: A(z/gamma1) */
float gamma2; /* Perceptual filter: A(z/gamma2) */
float preemph; /* Pre-emphasis: P(z) = 1 - a*z^-1*/
float pre_mem; /* 1-element memory for pre-emphasis */
float *stack;
float *inBuf; /* Input buffer (original signal) */
float *frame; /* Start of original frame */
float *excBuf; /* Excitation buffer */
float *exc; /* Start of excitation frame */
float *qlsp; /* Quantized LSPs for current frame */
float *old_qlsp; /* Quantized LSPs for previous frame */
float *interp_qlsp; /* Interpolated quantized LSPs */
float *interp_qlpc; /* Interpolated quantized LPCs */
float *mem_sp;
float *pi_gain;
lsp_unquant_func lsp_unquant; /** Struct defining a Speex mode */
ltp_unquant_func ltp_unquant; typedef struct SpeexMode {
void *ltp_params; void *mode;
innovation_unquant_func innovation_unquant; encoder_init_func enc_init;
void *innovation_params; encoder_destroy_func enc_destroy;
} DecState; encode_func enc;
decoder_init_func dec_init;
decoder_destroy_func dec_destroy;
decode_func dec;
int frameSize;
} SpeexMode;
/**Initializes encoder state*/ /** Creates an encoder state ("object") from a mode */
void encoder_init(EncState *st, SpeexMode *mode); void *encoder_init(SpeexMode *mode);
/**De-allocates encoder state resources*/ /** Destroy a Speex encoder state */
void encoder_destroy(EncState *st); void encoder_destroy(void *state);
/**Encodes one frame*/ /** Encode a frame */
void encode(EncState *st, float *in, FrameBits *bits); void encode(void *state, float *in, FrameBits *bits);
/**Initializes decoder state*/ /** Creates a decoder state ("object") from a mode */
void decoder_init(DecState *st, SpeexMode *mode); void *decoder_init(SpeexMode *mode);
/**De-allocates decoder state resources*/ /** Destroy a Speex decoder state */
void decoder_destroy(DecState *st); void decoder_destroy(void *state);
/**Decodes one frame*/ /** Decode a frame */
void decode(DecState *st, FrameBits *bits, float *out); void decode(void *state, FrameBits *bits, float *out);
/** Default narrowband mode */
extern SpeexMode nb_mode;
/** Default wideband mode */
extern SpeexMode wb_mode;
#ifdef __cplusplus
}
#endif
#endif #endif
 End of changes. 13 change blocks. 
110 lines changed or deleted 49 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/