00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/g722.h - The ITU G.722 codec. 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2005 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 * Based on a single channel G.722 codec which is: 00026 * 00027 ***** Copyright (c) CMU 1993 ***** 00028 * Computer Science, Speech Group 00029 * Chengxiang Lu and Alex Hauptmann 00030 */ 00031 00032 00033 /*! \file */ 00034 00035 #if !defined(_SPANDSP_PRIVATE_G722_H_) 00036 #define _SPANDSP_PRIVATE_G722_H_ 00037 00038 /*! The per band parameters for both encoding and decoding G.722 */ 00039 typedef struct 00040 { 00041 int16_t nb; 00042 int16_t det; 00043 int16_t s; 00044 int16_t sz; 00045 int16_t r; 00046 int16_t p[2]; 00047 int16_t a[2]; 00048 int16_t b[6]; 00049 int16_t d[7]; 00050 } g722_band_t; 00051 00052 /*! 00053 G.722 encode state 00054 */ 00055 struct g722_encode_state_s 00056 { 00057 /*! TRUE if the operating in the special ITU test mode, with the band split filters 00058 disabled. */ 00059 int itu_test_mode; 00060 /*! TRUE if the G.722 data is packed */ 00061 int packed; 00062 /*! TRUE if encode from 8k samples/second */ 00063 int eight_k; 00064 /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */ 00065 int bits_per_sample; 00066 00067 /*! Signal history for the QMF */ 00068 int16_t x[12]; 00069 int16_t y[12]; 00070 int ptr; 00071 00072 g722_band_t band[2]; 00073 00074 uint32_t in_buffer; 00075 int in_bits; 00076 uint32_t out_buffer; 00077 int out_bits; 00078 }; 00079 00080 /*! 00081 G.722 decode state 00082 */ 00083 struct g722_decode_state_s 00084 { 00085 /*! TRUE if the operating in the special ITU test mode, with the band split filters 00086 disabled. */ 00087 int itu_test_mode; 00088 /*! TRUE if the G.722 data is packed */ 00089 int packed; 00090 /*! TRUE if decode to 8k samples/second */ 00091 int eight_k; 00092 /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */ 00093 int bits_per_sample; 00094 00095 /*! Signal history for the QMF */ 00096 int16_t x[12]; 00097 int16_t y[12]; 00098 int ptr; 00099 00100 g722_band_t band[2]; 00101 00102 uint32_t in_buffer; 00103 int in_bits; 00104 uint32_t out_buffer; 00105 int out_bits; 00106 }; 00107 00108 #endif 00109 /*- End of file ------------------------------------------------------------*/