g722.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * 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 General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025  *
00026  * Based on a single channel G.722 codec which is:
00027  *
00028  *****    Copyright (c) CMU    1993      *****
00029  * Computer Science, Speech Group
00030  * Chengxiang Lu and Alex Hauptmann
00031  *
00032  * $Id: g722.h,v 1.8 2006/01/11 07:44:30 steveu Exp $
00033  */
00034 
00035 
00036 /*! \file */
00037 
00038 #if !defined(_G722_H_)
00039 #define _G722_H_
00040 
00041 /*! \page g722_page G.722 encoding and decoding
00042 \section g722_page_sec_1 What does it do?
00043 The G.722 module is a bit exact implementation of the ITU G.722 specification for all three
00044 specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests.
00045 
00046 \section g722_page_sec_2 How does it work?
00047 ???.
00048 */
00049 
00050 typedef struct
00051 {
00052     /*! TRUE if the operating in the special ITU test mode, with the band split filters
00053              disabled. */
00054     int itu_test_mode;
00055     /*! TRUE if the G.722 data is packed */
00056     int packed;
00057     /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
00058     int bits_per_sample;
00059 
00060     /*! Signal history for the QMF */
00061     int x[24];
00062 
00063     struct
00064     {
00065         int s;
00066         int sp;
00067         int sz;
00068         int r[3];
00069         int a[3];
00070         int ap[3];
00071         int p[3];
00072         int d[7];
00073         int b[7];
00074         int bp[7];
00075         int sg[7];
00076         int nb;
00077         int det;
00078     } band[2];
00079 
00080     unsigned int in_buffer;
00081     int in_bits;
00082     unsigned int out_buffer;
00083     int out_bits;
00084 } g722_encode_state_t;
00085 
00086 typedef struct
00087 {
00088     /*! TRUE if the operating in the special ITU test mode, with the band split filters
00089              disabled. */
00090     int itu_test_mode;
00091     /*! TRUE if the G.722 data is packed */
00092     int packed;
00093     /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
00094     int bits_per_sample;
00095 
00096     int xd[12];
00097     int xs[12];
00098 
00099     struct
00100     {
00101         int s;
00102         int sp;
00103         int sz;
00104         int r[3];
00105         int a[3];
00106         int ap[3];
00107         int p[3];
00108         int d[7];
00109         int b[7];
00110         int bp[7];
00111         int sg[7];
00112         int nb;
00113         int det;
00114     } band[2];
00115     
00116     unsigned int in_buffer;
00117     int in_bits;
00118     unsigned int out_buffer;
00119     int out_bits;
00120 } g722_decode_state_t;
00121 
00122 #ifdef __cplusplus
00123 extern "C" {
00124 #endif
00125 
00126 g722_encode_state_t *g722_encode_init(g722_encode_state_t *s, int rate, int packed);
00127 int g722_encode_release(g722_encode_state_t *s);
00128 int g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len);
00129 
00130 g722_decode_state_t *g722_decode_init(g722_decode_state_t *s, int rate, int packed);
00131 int g722_decode_release(g722_decode_state_t *s);
00132 int g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len);
00133 
00134 #ifdef __cplusplus
00135 }
00136 #endif
00137 
00138 #endif

Generated on Fri Nov 10 09:40:23 2006 for libspandsp by  doxygen 1.5.1