private/g726.h

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 
00026 #if !defined(_SPANDSP_PRIVATE_G726_H_)
00027 #define _SPANDSP_PRIVATE_G726_H_
00028 
00029 /*!
00030  * The following is the definition of the state structure
00031  * used by the G.726 encoder and decoder to preserve their internal
00032  * state between successive calls.  The meanings of the majority
00033  * of the state structure fields are explained in detail in the
00034  * ITU Recommendation G.726.  The field names are essentially indentical
00035  * to variable names in the bit level description of the coding algorithm
00036  * included in this recommendation.
00037  */
00038 struct g726_state_s
00039 {
00040     /*! The bit rate */
00041     int rate;
00042     /*! The external coding, for tandem operation */
00043     int ext_coding;
00044     /*! The number of bits per sample */
00045     int bits_per_sample;
00046     /*! One of the G.726_PACKING_xxx options */
00047     int packing;
00048 
00049     /*! Locked or steady state step size multiplier. */
00050     int32_t yl;
00051     /*! Unlocked or non-steady state step size multiplier. */
00052     int16_t yu;
00053     /*! int16_t term energy estimate. */
00054     int16_t dms;
00055     /*! Long term energy estimate. */
00056     int16_t dml;
00057     /*! Linear weighting coefficient of 'yl' and 'yu'. */
00058     int16_t ap;
00059     
00060     /*! Coefficients of pole portion of prediction filter. */
00061     int16_t a[2];
00062     /*! Coefficients of zero portion of prediction filter. */
00063     int16_t b[6];
00064     /*! Signs of previous two samples of a partially reconstructed signal. */
00065     int16_t pk[2];
00066     /*! Previous 6 samples of the quantized difference signal represented in
00067         an internal floating point format. */
00068     int16_t dq[6];
00069     /*! Previous 2 samples of the quantized difference signal represented in an
00070         internal floating point format. */
00071     int16_t sr[2];
00072     /*! Delayed tone detect */
00073     int td;
00074     
00075     /*! \brief The bit stream processing context. */
00076     bitstream_state_t bs;
00077 
00078     /*! \brief The current encoder function. */
00079     g726_encoder_func_t enc_func;
00080     /*! \brief The current decoder function. */
00081     g726_decoder_func_t dec_func;
00082 };
00083 
00084 #endif
00085 /*- End of file ------------------------------------------------------------*/

Generated on Thu Dec 9 21:11:49 2010 for spandsp by  doxygen 1.5.9