00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/g726.h - ITU G.726 codec. 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2006 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 * 00025 * $Id: g726.h,v 1.4 2009/04/12 09:12:11 steveu Exp $ 00026 */ 00027 00028 #if !defined(_SPANDSP_PRIVATE_G726_H_) 00029 #define _SPANDSP_PRIVATE_G726_H_ 00030 00031 /*! 00032 * The following is the definition of the state structure 00033 * used by the G.726 encoder and decoder to preserve their internal 00034 * state between successive calls. The meanings of the majority 00035 * of the state structure fields are explained in detail in the 00036 * ITU Recommendation G.726. The field names are essentially indentical 00037 * to variable names in the bit level description of the coding algorithm 00038 * included in this recommendation. 00039 */ 00040 struct g726_state_s 00041 { 00042 /*! The bit rate */ 00043 int rate; 00044 /*! The external coding, for tandem operation */ 00045 int ext_coding; 00046 /*! The number of bits per sample */ 00047 int bits_per_sample; 00048 /*! One of the G.726_PACKING_xxx options */ 00049 int packing; 00050 00051 /*! Locked or steady state step size multiplier. */ 00052 int32_t yl; 00053 /*! Unlocked or non-steady state step size multiplier. */ 00054 int16_t yu; 00055 /*! int16_t term energy estimate. */ 00056 int16_t dms; 00057 /*! Long term energy estimate. */ 00058 int16_t dml; 00059 /*! Linear weighting coefficient of 'yl' and 'yu'. */ 00060 int16_t ap; 00061 00062 /*! Coefficients of pole portion of prediction filter. */ 00063 int16_t a[2]; 00064 /*! Coefficients of zero portion of prediction filter. */ 00065 int16_t b[6]; 00066 /*! Signs of previous two samples of a partially reconstructed signal. */ 00067 int16_t pk[2]; 00068 /*! Previous 6 samples of the quantized difference signal represented in 00069 an internal floating point format. */ 00070 int16_t dq[6]; 00071 /*! Previous 2 samples of the quantized difference signal represented in an 00072 internal floating point format. */ 00073 int16_t sr[2]; 00074 /*! Delayed tone detect */ 00075 int td; 00076 00077 /*! \brief The bit stream processing context. */ 00078 bitstream_state_t bs; 00079 00080 /*! \brief The current encoder function. */ 00081 g726_encoder_func_t enc_func; 00082 /*! \brief The current decoder function. */ 00083 g726_decoder_func_t dec_func; 00084 }; 00085 00086 #endif 00087 /*- End of file ------------------------------------------------------------*/