[asterisk-commits] branch mattf/asterisk-wideband r21232 - in
/team/mattf/asterisk-wideband: ./ ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Apr 18 15:57:55 MST 2006
Author: mattf
Date: Tue Apr 18 17:57:54 2006
New Revision: 21232
URL: http://svn.digium.com/view/asterisk?rev=21232&view=rev
Log:
Add preliminary g.722 codec, along with some (old) changes for wideband support
Added:
team/mattf/asterisk-wideband/codecs/codec_g722.c (with props)
Modified:
team/mattf/asterisk-wideband/codecs/Makefile
team/mattf/asterisk-wideband/codecs/codec_resample.c
team/mattf/asterisk-wideband/frame.c
team/mattf/asterisk-wideband/include/asterisk/frame.h
Modified: team/mattf/asterisk-wideband/codecs/Makefile
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-wideband/codecs/Makefile?rev=21232&r1=21231&r2=21232&view=diff
==============================================================================
--- team/mattf/asterisk-wideband/codecs/Makefile (original)
+++ team/mattf/asterisk-wideband/codecs/Makefile Tue Apr 18 17:57:54 2006
@@ -70,7 +70,7 @@
CODECS+=$(MODG723) $(MODSPEEX) $(MODILBC) codec_resample.so codec_lpc10.so \
codec_adpcm.so codec_ulaw.so codec_alaw.so codec_a_mu.so \
- codec_g726.so codec_resample.so
+ codec_g726.so codec_resample.so codec_g722.so
all: depend $(CODECS)
Added: team/mattf/asterisk-wideband/codecs/codec_g722.c
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-wideband/codecs/codec_g722.c?rev=21232&view=auto
==============================================================================
--- team/mattf/asterisk-wideband/codecs/codec_g722.c (added)
+++ team/mattf/asterisk-wideband/codecs/codec_g722.c Tue Apr 18 17:57:54 2006
@@ -1,0 +1,1200 @@
+/*
+ * Asterisk -- An open source telephony toolkit
+ *
+ * Copyright (C) 2006, Digium, Inc.
+ *
+ * Matthew Fredrickson <creslin at digium.com>
+ *
+ * Based on the performance optimized version of the g.722 codec
+ * from CMU. See ftp://ftp.cs.cmu.edu/project/speech/speech-compression/CCITT-ADPCM/64kbps/adpcm64_g722_efficient
+ * for additional copyright information
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "asterisk.h"
+#include "asterisk/lock.h"
+#include "asterisk/module.h"
+#include "asterisk/translate.h"
+
+AST_MUTEX_DEFINE_STATIC(localuser_lock);
+static int localusecnt = 0;
+
+static char *tdesc = "ITU G.722 Transcoder";
+
+static int q6[32] = {0, 35, 72, 110, 150, 190, 233, 276, 323,
+ 370, 422, 473, 530, 587, 650, 714, 786,
+ 858, 940, 1023, 1121, 1219, 1339, 1458,
+ 1612, 1765, 1980, 2195, 2557, 2919, 0, 0};
+
+static int iln[32] = {0, 63, 62, 31, 30, 29, 28, 27, 26, 25,
+ 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14,
+ 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 0 };
+
+static int ilp[32] = {0, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52,
+ 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41,
+ 40, 39, 38, 37, 36, 35, 34, 33, 32, 0 };
+
+static int qm4[16] =
+ {0, -20456, -12896, -8968,
+ -6288, -4240, -2584, -1200,
+ 20456, 12896, 8968, 6288,
+ 4240, 2584, 1200, 0 };
+
+static int qm6[64] =
+ {-136, -136, -136, -136,
+ -24808, -21904, -19008, -16704,
+ -14984, -13512, -12280, -11192,
+ -10232, -9360, -8576, -7856,
+ -7192, -6576, -6000, -5456,
+ -4944, -4464, -4008, -3576,
+ -3168, -2776, -2400, -2032,
+ -1688, -1360, -1040, -728,
+ 24808, 21904, 19008, 16704,
+ 14984, 13512, 12280, 11192,
+ 10232, 9360, 8576, 7856,
+ 7192, 6576, 6000, 5456,
+ 4944, 4464, 4008, 3576,
+ 3168, 2776, 2400, 2032,
+ 1688, 1360, 1040, 728,
+ 432, 136, -432, -136 } ;
+
+static int wl[8] = {-60, -30, 58, 172, 334, 538, 1198, 3042 };
+
+static int rl42[16] = {0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0 };
+
+static int ilb[32] = {2048, 2093, 2139, 2186, 2233, 2282, 2332,
+ 2383, 2435, 2489, 2543, 2599, 2656, 2714,
+ 2774, 2834, 2896, 2960, 3025, 3091, 3158,
+ 3228, 3298, 3371, 3444, 3520, 3597, 3676,
+ 3756, 3838, 3922, 4008 };
+
+static int ihn[3] = { 0, 1, 0 };
+
+static int rh2[4] = {2, 1, 2, 1};
+
+static int ihp[3] = { 0, 3, 2 } ;
+
+static int qm2[4] = {-7408, -1616, 7408, 1616};
+
+static int wh[3] = {0, -214, 798} ;
+
+#define BUFSIZE 8096
+
+struct g722_state {
+ /* Buffer stuff */
+ struct ast_frame f;
+ char offset[AST_FRIENDLY_OFFSET];
+ unsigned short obuf[BUFSIZE];
+ int osamps;
+ /* Main decode block */
+ int x[24];
+ int detlow;
+ int dethigh;
+ int slow;
+ int shigh;
+ int nbl;
+ int nbh;
+
+ /* Block 4l vars */
+ int sl;
+ int spl; /* possibly local */
+ int szl;
+ int rlt[3]; /* Possible problem */
+ int al[3];
+ int plt[3];
+ int dlt[7];
+ int bl[7];
+ int sgl[7];
+
+ /* Block 4H */
+ int sh;
+ int sph; /* possibly local */
+ int szh;
+ int rh[3];
+ int ah[3];
+ int ph[3];
+ int dh[7];
+ int bh[7];
+ int sgh[7];
+};
+
+struct g722_encoder_pvt {
+ struct g722_state g722;
+ int tail;
+};
+
+struct g722_decoder_pvt {
+ struct ast_frame f;
+ char offset[AST_FRIENDLY_OFFSET];
+ unsigned short obuf[BUFSIZE];
+ struct g722_state g722;
+ int tail;
+};
+
+/**************************** BLOCK 4L *******************************/
+
+static int block4l (struct g722_state *tmp, int dl)
+{
+ int wd1, wd2, wd3, wd4, wd5;
+/****************** pointer ****************************/
+ register int *sgp, *pltp, *alp, *dltp, *blp, *rltp;
+ register int *pltp_1, *dltp_1, *rltp_1;
+ int *rlt = tmp->rlt;
+ int *plt = tmp->plt;
+ int *dlt = tmp->dlt;
+ int *sg = tmp->sgl;
+/*************************************** BLOCK 4L, RECONS ***********/
+ *dlt = dl;
+
+ *rlt = tmp->sl + dl ;
+/*
+ if ( *rlt > 32767 ) *rlt = 32767;
+ else if ( *rlt < -32768 ) *rlt = -32768;
+*/
+/*************************************** BLOCK 4L, PARREC ***********/
+
+ *plt = dl + tmp->szl ;
+/*
+ if ( plt[0] > 32767 ) plt[0] = 32767;
+ else if ( plt[0] < -32768 ) plt[0] = -32768;
+*/
+/*****************************BLOCK 4L, UPPOL2*************************/
+ sgp = sg, pltp = plt, alp = tmp->al ;
+ *sgp++ = *pltp++ >> 15 ;
+ *sgp++ = *pltp++ >> 15 ;
+ *sgp++ = *pltp++ >> 15 ;
+
+ wd1 = *++alp << 2;
+
+ if ( wd1 > 32767 ) wd1 = 32767;
+ else if ( wd1 < -32768 ) wd1 = -32768;
+
+ wd2= ( *sg == *(sg+1) )? -wd1: wd1 ;
+ if ( wd2 > 32767 ) wd2 = 32767;
+
+ wd2 = wd2 >> 7 ;
+ wd3= ( *sg == *(sg+2) )? 128: -128 ;
+ wd4 = wd2 + wd3 ;
+ wd5 = (*++alp * 32512) >> 15 ;
+
+ *alp = wd4 + wd5 ;
+
+ if ( *alp > 12288 ) *alp = 12288 ;
+ else if ( *alp < -12288 ) *alp = -12288 ;
+
+/************************************* BLOCK 4L, UPPOL1 ***************/
+
+ *sg = *plt >> 15 ;
+ *(sg+1) = *(plt+1) >> 15 ;
+ wd1 = ( *sg == *(sg+1) )? 192 : -192 ;
+
+ wd2 = (*--alp * 32640) >> 15 ;
+
+ *alp = wd1 + wd2 ;
+/*
+ if ( *alp > 32767 ) *alp = 32767;
+ else if ( *alp < -32768 ) *alp = -32768;
+*/
+ wd3 = (15360 - *++alp) ;
+/*
+ if ( wd3 > 32767 ) wd3 = 32767;
+ else if ( wd3 < -32768 ) wd3 = -32768;
+*/
+ if ( *--alp > wd3) *alp = wd3 ;
+ else if ( *alp < -wd3) *alp = -wd3 ;
+
+/*************************************** BLOCK 4L, UPZERO ************/
+ wd1 = ( dl == 0 ) ? 0 : 128;
+ *sg = dl >> 15 ;
+ sgp = sg, dltp = dlt, blp = tmp->bl;
+
+ *++sgp = *++dltp >> 15 ;
+ wd2 = ( *sgp == *sg ) ? wd1 : -wd1 ;
+ wd3 = (*++blp * 32640) >> 15 ;
+ *blp = wd2 + wd3 ;
+/*
+ if ( *blp > 32767 ) *blp = 32767;
+ else if ( *blp < -32768 ) *blp = -32768;
+*/
+
+ *++sgp = *++dltp >> 15 ;
+ wd2 = ( *sgp == *sg ) ? wd1 : -wd1 ;
+ wd3 = (*++blp * 32640) >> 15 ;
+ *blp = wd2 + wd3 ;
+/*
+ if ( *blp > 32767 ) *blp = 32767;
+ else if ( *blp < -32768 ) *blp = -32768;
+*/
+
+ *++sgp = *++dltp >> 15 ;
+ wd2 = ( *sgp == *sg ) ? wd1 : -wd1 ;
+ wd3 = (*++blp * 32640) >> 15 ;
+ *blp = wd2 + wd3 ;
+/*
+ if ( *blp > 32767 ) *blp = 32767;
+ else if ( *blp < -32768 ) *blp = -32768;
+*/
+
+ *++sgp = *++dltp >> 15 ;
+ wd2 = ( *sgp == *sg ) ? wd1 : -wd1 ;
+ wd3 = (*++blp * 32640) >> 15 ;
+ *blp = wd2 + wd3 ;
+/*
+ if ( *blp > 32767 ) *blp = 32767;
+ else if ( *blp < -32768 ) *blp = -32768;
+*/
+
+ *++sgp = *++dltp >> 15 ;
+ wd2 = ( *sgp == *sg ) ? wd1 : -wd1 ;
+ wd3 = (*++blp * 32640) >> 15 ;
+ *blp = wd2 + wd3 ;
+/*
+ if ( *blp > 32767 ) *blp = 32767;
+ else if ( *blp < -32768 ) *blp = -32768;
+*/
+
+ *++sgp = *++dltp >> 15 ;
+ wd2 = ( *sgp == *sg ) ? wd1 : -wd1 ;
+ wd3 = (*++blp * 32640) >> 15 ;
+ *blp = wd2 + wd3 ;
+/*
+ if ( *blp > 32767 ) *blp = 32767;
+ else if ( *blp < -32768 ) *blp = -32768;
+*/
+
+/********************************* BLOCK 4L, DELAYA ******************/
+ dltp_1 = dltp - 1;
+ *dltp-- = *dltp_1-- ;
+ *dltp-- = *dltp_1-- ;
+ *dltp-- = *dltp_1-- ;
+ *dltp-- = *dltp_1-- ;
+ *dltp-- = *dltp_1-- ;
+ *dltp-- = *dltp_1-- ;
+
+ rltp =rlt+2, pltp = plt+2 ;
+ rltp_1 = rltp - 1, pltp_1 = pltp - 1;
+
+ *rltp-- = *rltp_1--;
+ *pltp-- = *pltp_1--;
+ *rltp-- = *rltp_1--;
+ *pltp-- = *pltp_1--;
+/********************************* BLOCK 4L, FILTEP ******************/
+
+ wd1 = ( *alp * *++rltp ) >> 14 ;
+
+ wd2 = ( *++alp * *++rltp ) >> 14 ;
+
+ tmp->spl = wd1 + wd2 ;
+/*
+ if ( spl > 32767 ) spl = 32767;
+ else if ( spl < -32768 ) spl = -32768;
+*/
+/*************************************** BLOCK 4L, FILTEZ ***********/
+
+ blp = blp - 6;
+ tmp->szl = (*++blp * *++dltp) >> 14 ;
+/*
+ if ( szl > 32767 ) szl = 32767;
+ else if ( szl < -32768 ) szl = -32768;
+*/
+ tmp->szl += (*++blp * *++dltp) >> 14 ;
+/*
+ if ( szl > 32767 ) szl = 32767;
+ else if ( szl < -32768 ) szl = -32768;
+*/
+ tmp->szl += (*++blp * *++dltp) >> 14 ;
+/*
+ if ( szl > 32767 ) szl = 32767;
+ else if ( szl < -32768 ) szl = -32768;
+*/
+ tmp->szl += (*++blp * *++dltp) >> 14 ;
+/*
+ if ( szl > 32767 ) szl = 32767;
+ else if ( szl < -32768 ) szl = -32768;
+*/
+ tmp->szl += (*++blp * *++dltp) >> 14 ;
+/*
+ if ( szl > 32767 ) szl = 32767;
+ else if ( szl < -32768 ) szl = -32768;
+*/
+ tmp->szl += (*++blp * *++dltp) >> 14 ;
+/*
+ if ( szl > 32767 ) szl = 32767;
+ else if ( szl < -32768 ) szl = -32768;
+*/
+/*********************************BLOCK 4L, PREDIC *******************/
+
+ tmp->sl = tmp->spl + tmp->szl ;
+/*
+ if ( sl > 32767 ) sl = 32767;
+ else if ( sl < -32768 ) sl = -32768;
+*/
+
+ return (tmp->sl) ;
+}
+/**************************** BLOCK 4H *******************************/
+
+static int block4h(struct g722_state *tmp, int d)
+{
+ int wd1, wd2, wd3, wd4, wd5;
+
+ register int *sgp, *bhp, *dhp, *php, *ahp, *rhp;
+ register int *dhp_1, *rhp_1, *php_1;
+ int *rh = tmp->rh;
+ int *ah = tmp->ah;
+ int *ph = tmp->ph;
+ int *dh = tmp->dh;
+ int *bh = tmp->bh;
+ int *sg = tmp->sgh;
+/*************************************** BLOCK 4H, RECONS ***********/
+
+ *dh = d;
+ *rh = tmp->sh + d ;
+/*
+ if ( rh[0] > 32767 ) rh[0] = 32767;
+ else if ( rh[0] < -32768 ) rh[0] = -32768;
+*/
+/*************************************** BLOCK 4H, PARREC ***********/
+
+ *ph = d + tmp->szh ;
+/*
+ if ( ph[0] > 32767 ) ph[0] = 32767;
+ else if ( ph[0] < -32768 ) ph[0] = -32768;
+*/
+/*****************************BLOCK 4H, UPPOL2*************************/
+ sgp = sg, php = ph, ahp = ah ;
+ *sg = *ph >> 15 ;
+ *++sgp = *++php >> 15 ;
+ *++sgp = *++php >> 15 ;
+ wd1 = (*++ahp) << 2;
+
+ if ( wd1 > 32767 ) wd1 = 32767;
+ else if ( wd1 < -32768 ) wd1 = -32768;
+
+ wd2 = ( *sg == *--sgp ) ? - wd1 : wd1;
+ if ( wd2 > 32767 ) wd2 = 32767;
+
+ wd2 = wd2 >> 7 ;
+ wd3 = ( *sg == *++sgp ) ? 128:-128 ;
+
+ wd4 = wd2 + wd3 ;
+ wd5 = (*++ahp * 32512) >> 15 ;
+
+ *ahp = wd4 + wd5 ;
+ if ( *ahp > 12288 ) *ahp = 12288 ;
+ else if ( *ahp < -12288 ) *ahp = -12288 ;
+/************************************* BLOCK 4H, UPPOL1 ***************/
+
+ *sg = *ph >> 15 ;
+ *--sgp = *--php >> 15 ;
+ wd1 = ( *sg == *sgp ) ? 192 : -192;
+
+ wd2 = (*--ahp * 32640) >> 15 ;
+
+ *ahp = wd1 + wd2 ;
+/*
+ if ( *ahp > 32767 ) *ahp = 32767;
+ else if ( *ahp < -32768 ) *ahp = -32768;
+*/
+ wd3 = (15360 - *++ahp) ;
+/*
+ if ( wd3 > 32767 ) wd3 = 32767;
+ else if ( wd3 < -32768 ) wd3 = -32768;
+*/
+ if ( *--ahp > wd3) *ahp = wd3 ;
+ else if ( *ahp < -wd3) *ahp = -wd3 ;
+
+/*************************************** BLOCK 4H, UPZERO ************/
+ wd1 = ( d == 0 ) ? 0 : 128;
+
+ *sg = d >> 15 ;
+ dhp = dh, bhp = bh;
+ *sgp = *++dhp >> 15 ;
+ wd2 = ( *sgp++ == *sg ) ? wd1 : -wd1;
+ wd3 = (*++bhp * 32640) >> 15 ;
+ *bhp = wd2 + wd3 ;
+/*
+ if ( *bhp > 32767 ) *bhp= 32767;
+ else if ( *bhp < -32768 ) *bhp = -32768;
+*/
+
+ *sgp = *++dhp >> 15 ;
+ wd2 = ( *sgp++ == *sg ) ? wd1 : -wd1;
+ wd3 = (*++bhp * 32640) >> 15 ;
+ *bhp = wd2 + wd3 ;
+/*
+ if ( *bhp > 32767 ) *bhp= 32767;
+ else if ( *bhp < -32768 ) *bhp = -32768;
+*/
+
+ *sgp = *++dhp >> 15 ;
+ wd2 = ( *sgp++ == *sg ) ? wd1 : -wd1;
+ wd3 = (*++bhp * 32640) >> 15 ;
+ *bhp = wd2 + wd3 ;
+/*
+ if ( *bhp > 32767 ) *bhp= 32767;
+ else if ( *bhp < -32768 ) *bhp = -32768;
+*/
+
+ *sgp = *++dhp >> 15 ;
+ wd2 = ( *sgp++ == *sg ) ? wd1 : -wd1;
+ wd3 = (*++bhp * 32640) >> 15 ;
+ *bhp = wd2 + wd3 ;
+/*
+ if ( *bhp > 32767 ) *bhp= 32767;
+ else if ( *bhp < -32768 ) *bhp = -32768;
+*/
+
+ *sgp = *++dhp >> 15 ;
+ wd2 = ( *sgp++ == *sg ) ? wd1 : -wd1;
+ wd3 = (*++bhp * 32640) >> 15 ;
+ *bhp = wd2 + wd3 ;
+/*
+ if ( *bhp > 32767 ) *bhp= 32767;
+ else if ( *bhp < -32768 ) *bhp = -32768;
+*/
+
+ *sgp = *++dhp >> 15 ;
+ wd2 = ( *sgp++ == *sg ) ? wd1 : -wd1;
+ wd3 = (*++bhp * 32640) >> 15 ;
+ *bhp = wd2 + wd3 ;
+/*
+ if ( *bhp > 32767 ) *bhp= 32767;
+ else if ( *bhp < -32768 ) *bhp = -32768;
+*/
+
+/********************************* BLOCK 4H, DELAYA ******************/
+ dhp_1 = dhp - 1;
+
+ *dhp-- = *dhp_1-- ;
+ *dhp-- = *dhp_1-- ;
+ *dhp-- = *dhp_1-- ;
+ *dhp-- = *dhp_1-- ;
+ *dhp-- = *dhp_1-- ;
+ *dhp-- = *dhp_1-- ;
+
+ rhp = rh+2;
+ php++;
+ rhp_1 = rhp - 1, php_1 = php - 1;
+
+ *rhp-- = *rhp_1-- ;
+ *php-- = *php_1-- ;
+ *rhp-- = *rhp_1-- ;
+ *php-- = *php_1-- ;
+/********************************* BLOCK 4H, FILTEP ******************/
+
+ wd1 = ( *ahp * *++rhp ) >> 14 ;
+
+ wd2 = ( *++ahp * *++rhp ) >> 14 ;
+
+ tmp->sph = wd1 + wd2 ;
+/*
+ if ( sph > 32767 ) sph = 32767;
+ if ( sph < -32768 ) sph = -32768;
+*/
+/*************************************** BLOCK 4H, FILTEZ ***********/
+
+ bhp = bhp -6;
+ tmp->szh = (*++bhp * *++dhp ) >> 14 ;
+/*
+ if ( szh > 32767 ) szh = 32767;
+ else if ( szh < -32768 ) szh = -32768;
+*/
+ tmp->szh += (*++bhp * *++dhp ) >> 14 ;
+/*
+ if ( szh > 32767 ) szh = 32767;
+ else if ( szh < -32768 ) szh = -32768;
+*/
+ tmp->szh += (*++bhp * *++dhp ) >> 14 ;
+/*
+ if ( szh > 32767 ) szh = 32767;
+ else if ( szh < -32768 ) szh = -32768;
+*/
+ tmp->szh += (*++bhp * *++dhp ) >> 14 ;
+/*
+ if ( szh > 32767 ) szh = 32767;
+ else if ( szh < -32768 ) szh = -32768;
+*/
+ tmp->szh += (*++bhp * *++dhp ) >> 14 ;
+/*
+ if ( szh > 32767 ) szh = 32767;
+ else if ( szh < -32768 ) szh = -32768;
+*/
+ tmp->szh += (*++bhp * *++dhp ) >> 14 ;
+/*
+ if ( szh > 32767 ) szh = 32767;
+ else if ( szh < -32768 ) szh = -32768;
+*/
+/*********************************BLOCK 4L, PREDIC *******************/
+
+ tmp->sh = tmp->sph + tmp->szh ;
+/*
+ if ( sh > 32767 ) sh = 32767;
+ if ( sh < -32768 ) sh = -32768;
+*/
+ return (tmp->sh) ;
+}
+
+static void g722_init_state(struct g722_state *p)
+{
+ memset(p, 0, sizeof(struct g722_state));
+ /* Init a few needed variables */
+ p->detlow = 32;
+ p->dethigh = 8;
+}
+
+static struct ast_translator_pvt * g722tolin16_new(void)
+{
+ struct g722_state *tmp;
+ tmp = malloc(sizeof(struct g722_state));
+ if (tmp) {
+ localusecnt++;
+ g722_init_state(tmp);
+ ast_update_use_count();
+ }
+ return (struct ast_translator_pvt *) tmp;
+}
+
+static struct ast_translator_pvt * lin16tog722_new(void)
+{
+ struct g722_state *tmp;
+ tmp = malloc(sizeof(struct g722_state));
+ if (tmp) {
+ localusecnt++;
+ g722_init_state(tmp);
+ ast_update_use_count();
+ }
+ return (struct ast_translator_pvt *) tmp;
+}
+
+static struct ast_frame * lin16tog722_frameout(struct ast_translator_pvt *p)
+{
+ struct g722_state *tmp = (struct g722_state *) p;
+
+ if (!tmp->osamps)
+ return NULL;
+
+ tmp->f.frametype = AST_FRAME_VOICE;
+ tmp->f.subclass = AST_FORMAT_G722;
+ tmp->f.datalen = tmp->osamps << 2;
+ tmp->f.samples = tmp->osamps;
+ tmp->f.mallocd = 0;
+ tmp->f.offset = AST_FRIENDLY_OFFSET;
+ tmp->f.src = __PRETTY_FUNCTION__;
+ tmp->f.data = tmp->obuf;
+ tmp->osamps = 0;
+
+ return &tmp->f;
+}
+
+static int lin16tog722_framein(struct ast_translator_pvt *p, struct ast_frame *f)
+{
+ struct g722_state *tmp = (struct g722_state *) p;
+ int ih2;
+ int dhigh;
+ register int hdu;
+ int ihigh = 0; /* Maybe don't need to init */
+ int mih;
+ int eh;
+ int il4;
+ int dlowt;
+ int ril;
+ int ilow = 0; /* Maybe don't need to init */
+ register int el, wd, mil;
+ int xlow, xhigh; /* low and high band pcm from qmf */
+ int sumeven, sumodd; /* even and odd tap accumulators */
+ int wd1, wd2, wd3;
+ int j, k = 1; /* counter */
+ int fd;
+ unsigned short *outdata;
+ short *datap;
+ register int *xp, *xp_2, *q6p;
+
+ if (!f->datalen)
+ return 0;
+
+ /* Prepare for work to start */
+ fd = f->datalen >> 2;
+ outdata = tmp->obuf;
+ datap = f->data;
+
+ /* Start decoding frames */
+ for(j = 0; j < fd;) {
+
+/* PROCESS PCM THROUGH THE QMF FILTER */
+
+nexttwodata:
+ xp = tmp->x + 23; xp_2 = tmp->x + 21;
+
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+ *xp-- = *xp_2--;
+
+
+ *xp = *datap++;
+ *--xp = *datap++;
+
+/* DISCARD EVERY OTHER QMF OUTPUT */
+
+ sumeven = *xp++ * 3;
+ sumodd = *xp++ * (-11);
+ sumeven += *xp++ * (-11);
+ sumodd += *xp++ * 53;
+ sumeven += *xp++ * 12;
+ sumodd += *xp++ * (-156);
+ sumeven += *xp++ * 32;
+ sumodd += *xp++ * 362;
+ sumeven += *xp++ * (-210);
+ sumodd += *xp++ * (-805);
+ sumeven += *xp++ * 951;
+ sumodd += *xp++ * 3876;
+ sumeven += *xp++ * 3876;
+ sumodd += *xp++ * 951;
+ sumeven += *xp++ * (-805);
+ sumodd += *xp++ * (-210);
+ sumeven += *xp++ * 362;
+ sumodd += *xp++ * 32;
+ sumeven += *xp++ * (-156);
+ sumodd += *xp++ * 12;
+ sumeven += *xp++ * 53;
+ sumodd += *xp++ * (-11);
+ sumeven += *xp++ * (-11);
+ sumodd += *xp++ * 3;
+
+ xlow = (sumeven + sumodd) >>13;
+ xhigh = (sumeven - sumodd) >>13;
+
+/*************************************** BLOCK 1L, SUBTRA ************/
+
+ el = xlow - tmp->slow ;
+
+ if ( el > 32767 ) el = 32767;
+ else if ( el < -32768 ) el = -32768;
+
+/*************************************** BLOCK 1L, QUANTL ************/
+
+ wd = (el >= 0 ) ? el: -(el+1) ;
+
+ q6p = q6;
+
+ mil = 1;
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+ wd2 = *++q6p * tmp->detlow ;
+ wd1 = wd2 >> 12 ;
+ if (wd >= wd1) mil++;
+ else goto next_ilow;
+
+next_ilow:
+ ilow = ( el < 0 ) ? iln[mil] : ilp[mil];
+
+/************************************** BLOCK 2L, INVQAL ************/
+
+ ril = ilow >> 2;
+ wd2 = qm4[ril];
+ dlowt = (tmp->detlow * wd2) >> 15;
+
+/************************************** BLOCK 3L, LOGSCL *************/
+
+ il4 = rl42[ril] ;
+
+ wd = (tmp->nbl * 127) >> 7;
+
+ tmp->nbl = wd + wl[il4];
+
+ if (tmp->nbl < 0) tmp->nbl = 0 ;
+ else if (tmp->nbl > 18432) tmp->nbl = 18432 ;
+
+/************************************** BLOCK 3L, SCALEL *************/
+ wd1 = (tmp->nbl >> 6) & 31 ;
+ wd2 = tmp->nbl >> 11 ;
+ wd3 =((8 - wd2) < 0) ? ilb[wd1]<<(wd2 - 8) : ilb[wd1]>>(8 - wd2);
+ tmp->detlow = wd3 << 2 ;
+/************************************** BLOCK 3L, DELAYA *************/
+
+ tmp->slow = block4l(tmp, dlowt) ;
+
+
+/*************************************** BLOCK 1H, SUBTRA ************/
+
+ eh = xhigh - tmp->shigh ;
+/*
+ if ( eh > 32767 ) eh = 32767;
+ else if ( eh < -32768 ) eh = -32768;
+*/
+/*************************************** BLOCK 1H, QUANTH ************/
+
+ wd = (eh >= 0)? eh : -(eh + 1);
+
+ hdu = 564 * tmp->dethigh;
+ wd1 = hdu >> 12;
+ mih = (wd >= wd1) ? 2 : 1;
+ ihigh = (eh < 0) ? ihn[mih] : ihp[mih] ;
+
+/************************************** BLOCK 2H, INVQAH ************/
+
+ wd2 = qm2[ihigh] ;
+ dhigh = (tmp->dethigh * wd2) >> 15 ;
+
+
+/************************************** BLOCK 3H, LOGSCH *************/
+
+ ih2 = rh2[ihigh] ;
+ wd = (tmp->nbh * 127) >> 7 ;
+ tmp->nbh = wd + wh[ih2] ;
+
+ if (tmp->nbh < 0) tmp->nbh = 0 ;
+ else if (tmp->nbh > 22528) tmp->nbh = 22528 ;
+
+/************************************** BLOCK 3H, SCALEH *************/
+ wd1 = (tmp->nbh >> 6) & 31 ;
+ wd2 = tmp->nbh >> 11 ;
+ wd3=((10-wd2) < 0)? ilb[wd1] << (wd2-10): ilb[wd1] >> (10-wd2) ;
+ tmp->dethigh = wd3 << 2 ;
+/************************************** BLOCK 3L, DELAYA *************/
+
+ tmp->shigh = block4h(tmp, dhigh) ;
+ if(k > 0){
+ outdata[j] = ilow;
+ outdata[j] = (outdata[j]<<2) + ihigh;
+ k = -k;
+ goto nexttwodata;
+ } else {
+ outdata[j] = (outdata[j]<<6) + ilow;
+ outdata[j] = (outdata[j]<<2) + ihigh;
+ k = -k;
+ }
+ j++;
+ }
+
+ tmp->osamps = fd;
+
+ return 0;
+}
+
+static int g722tolin16_framein(struct ast_translator_pvt *tmp, struct ast_frame *f)
+{
+ struct g722_state *p = (struct g722_state *) tmp;
+ int ilowr, dlowt, rlow;
+ int ihigh, dhigh, rhigh;
+ register int xout1;
+ register int wd1, wd2, wd3;
+ int *xd = p->x;
+ int *xs = p->x + 12;
+ register int *xdp, *xsp, *xdp_1, *xsp_1;
+ int j, k = 1;
+ unsigned short *decdatap = f->data;
+ short *pcmoutp = p->obuf;
+ int samplesRead = f->datalen << 2;
+
+ for(j=0; j < samplesRead;) {
+ ilowr = *decdatap >> 10;
+ ihigh = (*decdatap >> 8) & 3;
+
+nexttwodata:
+ /*********************** BLOCK 5L, LOW BAND INVQBL ****************/
+
+ wd2 = qm6[ilowr] ;
+ wd2 = (p->detlow * wd2 ) >> 15 ;
+ /******************************** BLOCK 5L, RECONS ****************/
+ rlow = p->slow + wd2 ;
+ /*
+ if (rlow > 32767) rlow = 32767;
+ if (rlow < -32768) rlow = -32768;
+ */
+ /******************************** BLOCK 6L, LIMIT ******************/
+ /*
+ if (rlow > 16383 ) rlow = 16383;
+ if (rlow < -16383 ) rlow = -16383;
+ */
+ /************************************** BLOCK 2L, INVQAL ************/
+
+ wd1 = ilowr >> 2 ;
+ wd2 = qm4[wd1] ;
+ dlowt = (p->detlow * wd2) >> 15 ;
+ /************************************** BLOCK 3L, LOGSCL *************/
+
+ wd2 = rl42[wd1] ;
+ wd1 = (p->nbl * 127) >> 7 ;
+ p->nbl = wd1 + wl[wd2] ;
+ if (p->nbl < 0)
+ p->nbl = 0;
+ else if (p->nbl > 18432)
+ p->nbl = 18432 ;
+ /************************************** BLOCK 3L, SCALEL *************/
+
+ wd1 = (p->nbl >> 6) & 31 ;
+ wd2 = p->nbl >> 11 ;
+ wd3= ((8 - wd2) < 0)? ilb[wd1] << (wd2 - 8) : ilb[wd1] >> (8 - wd2) ;
+ p->detlow = wd3 << 2 ;
+
+ p->slow = block4l(p, dlowt) ;
+ /************************************** BLOCK 2H, INVQAH ************/
+
+ wd2 = qm2[ihigh] ;
+ dhigh = (p->dethigh * wd2) >> 15 ;
+
+ rhigh = dhigh + p->shigh ;
+ /*
+ if (rhigh > 16383 ) rhigh = 16383 ;
+ if (rhigh < -16384 ) rhigh = -16384 ;
+ */
+ /************************************** BLOCK 2H, INVQAH ************/
+
+ wd2 = rh2[ihigh] ;
+ wd1 = (p->nbh * 127) >> 7 ;
+ p->nbh = wd1 + wh[wd2] ;
+
+
+ if (p->nbh < 0)
+ p->nbh = 0 ;
+ else if (p->nbh > 22528)
+ p->nbh = 22528 ;
+ /************************************** BLOCK 3H, SCALEH *************/
+
+ wd1 = (p->nbh >> 6) & 31 ;
+ wd2 = p->nbh >> 11 ;
+ wd3= ((10 - wd2) < 0)? ilb[wd1] << (wd2 - 10) : ilb[wd1] >> (10 - wd2) ;
+ p->dethigh = wd3 << 2 ;
+
+ p->shigh = block4h(p, dhigh) ;
+ /******************************* RECIEVE QMF ************************/
+
+ xdp=xd+11, xsp=xs+11, xdp_1=xd+10, xsp_1=xs+10;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ *xdp-- = *xdp_1--; *xsp-- = *xsp_1--;
+ /************************************* RECA ***************************/
+
+ *xdp = rlow - rhigh ;
+ /*
+ if (*xdp > 16383) *xdp = 16383;
+ if (*xdp < -16384) *xdp = -16384;
+ */
+
+ /************************************* RECA ***************************/
+
+ *xsp = rlow + rhigh ;
+ /*
+ if (*xsp > 16383) *xsp = 16383;
+ if (*xsp < -16384) *xsp = -16384;
+ */
+ /************************************* ACCUM C&D *************************/
+ /* qmf tap coefficients */
+ xout1 = *xdp++ * 3;
+ xout1 += *xdp++ * -11;
+ xout1 += *xdp++ * 12;
+ xout1 += *xdp++ * 32;
+ xout1 += *xdp++ * -210;
+ xout1 += *xdp++ * 951;
+ xout1 += *xdp++ * 3876;
+ xout1 += *xdp++ * -805;
+ xout1 += *xdp++ * 362;
+ xout1 += *xdp++ * -156;
+ xout1 += *xdp++ * 53;
+ xout1 += *xdp++ * -11;
+
+ *pcmoutp++ = xout1 >> 12 ;
+ /* fprintf (stdout, "%5d\n", xout1); output pcm */
+
+ xout1 = *xsp++ * -11;
+ xout1 += *xsp++ * 53;
+ xout1 += *xsp++ * -156;
+ xout1 += *xsp++ * 362;
+ xout1 += *xsp++ * -805;
+ xout1 += *xsp++ * 3876;
+ xout1 += *xsp++ * 951;
+ xout1 += *xsp++ * -210;
+ xout1 += *xsp++ * 32;
+ xout1 += *xsp++ * 12;
+ xout1 += *xsp++ * -11;
+ xout1 += *xsp++ * 3;
+
+ *pcmoutp++ = xout1 >> 12 ;
+ /* fprintf (stdout, "%5d\n", xout1); output pcm */
+
+ j++, j++;
+
+ k=-k;
+ /*
+ if (xout1 > 16383) xout1 = 16383 ;
+ if (xout1 < -16384) xout1 = -16384 ;
+ if (xout1 > 16383) xout1 = 16383 ;
+ if (xout1 < -16384) xout1 = -16384 ;
+ */
+ if(k<0){
+ ilowr = (*decdatap >> 2) & 63;
+ ihigh = (*decdatap++) & 3;
+ goto nexttwodata;
+ }
+ }
+ p->osamps = samplesRead;
+ return 0;
+}
+
+static struct ast_frame * g722tolin16_frameout(struct ast_translator_pvt *p)
+{
+ struct g722_state *tmp = (struct g722_state *) p;
+
+ if (!tmp->osamps)
+ return NULL;
+
+ tmp->f.frametype = AST_FRAME_VOICE;
+ tmp->f.subclass = AST_FORMAT_SLINEAR16;
+ tmp->f.datalen = tmp->osamps >> 2;
+ tmp->f.samples = tmp->osamps;
+ tmp->f.mallocd = 0;
+ tmp->f.offset = AST_FRIENDLY_OFFSET;
+ tmp->f.src = __PRETTY_FUNCTION__;
+ tmp->f.data = tmp->obuf;
+ tmp->osamps = 0;
+
+ return &tmp->f;
+}
+
+static void g722_destroy(struct ast_translator_pvt *pvt)
+{
+ free(pvt);
+ localusecnt--;
+ ast_update_use_count();
+}
+
+static struct ast_translator g722tolin16 = {
+ "g722tolin16",
+ AST_FORMAT_G722,
+ AST_FORMAT_SLINEAR16,
+ g722tolin16_new,
+ g722tolin16_framein,
+ g722tolin16_frameout,
+ g722_destroy,
+ NULL,
+};
+
+static struct ast_translator lin16tog722 = {
+ "lin16tog722",
+ AST_FORMAT_SLINEAR16,
+ AST_FORMAT_G722,
+ lin16tog722_new,
+ lin16tog722_framein,
+ lin16tog722_frameout,
+ g722_destroy,
+ NULL,
+};
+
+int reload(void)
+{
+ return 0;
+}
+
+int unload_module(void)
+{
+ int res;
+ ast_mutex_lock(&localuser_lock);
+ res = ast_unregister_translator(&lin16tog722);
+ if (!res)
+ res = ast_unregister_translator(&g722tolin16);
+ ast_mutex_unlock(&localuser_lock);
+ return res;
+}
+
+int load_module(void)
+{
+ int res;
+ ast_mutex_lock(&localuser_lock);
+ res = ast_register_translator(&g722tolin16);
+ if (!res)
+ res = ast_register_translator(&lin16tog722);
+ else
+ ast_unregister_translator(&g722tolin16);
+ return res;
+}
+
+char * description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ int res;
+ STANDARD_USECOUNT(res);
+ return res;
+}
+
+char * key(void)
+{
+ return ASTERISK_GPL_KEY;
+}
Propchange: team/mattf/asterisk-wideband/codecs/codec_g722.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/mattf/asterisk-wideband/codecs/codec_g722.c
------------------------------------------------------------------------------
svn:keywords = Author Date ID Revision
Propchange: team/mattf/asterisk-wideband/codecs/codec_g722.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/mattf/asterisk-wideband/codecs/codec_resample.c
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-wideband/codecs/codec_resample.c?rev=21232&r1=21231&r2=21232&view=diff
==============================================================================
--- team/mattf/asterisk-wideband/codecs/codec_resample.c (original)
+++ team/mattf/asterisk-wideband/codecs/codec_resample.c Tue Apr 18 17:57:54 2006
@@ -27,6 +27,9 @@
#include "asterisk/translate.h"
#include "asterisk/channel.h"
#include "libresample.h"
+
+/* #define CHECK_BOUNDS */
+#define HIGH_QUALITY
AST_MUTEX_DEFINE_STATIC(localuser_lock);
static int localusecnt = 0;
@@ -52,12 +55,30 @@
static struct ast_frame * resample_frameout(struct ast_translator_pvt *tmp)
{
int i;
+#ifdef CHECK_BOUNDS
+ int samp;
+#endif
+
if (!tmp->osamples)
return NULL;
/* Convert to short */
- for (i = 0; i < tmp->osamples; i++)
- tmp->sampbuf[i] = (short) tmp->obuf[i];
+ for (i = 0; i < tmp->osamples; i++) {
+#ifdef CHECK_BOUNDS
+ samp = (short) tmp->obuf[i];
+
+ /* Do some bounds checking on the output */
+ if (samp < -32768)
+ samp = -32768;
+ else if (samp > 32767)
+ samp = 32767;
+
+ tmp->sampbuf[i] = samp;
+#else
+ tmp->sampbuf[i] = tmp->obuf[i];
+
+#endif
+ }
tmp->f.frametype = AST_FRAME_VOICE;
tmp->f.subclass = AST_FORMAT_SLINEAR16;
@@ -103,7 +124,11 @@
if (h) {
memset(h, 0, sizeof(struct ast_translator_pvt));
h->resamplefactor = 2;
+#ifdef HIGH_QUALITY
+ h->resample_pvt = resample_open(1, h->resamplefactor, h->resamplefactor);
+#else
h->resample_pvt = resample_open(0, h->resamplefactor, h->resamplefactor);
+#endif
if (!h->resample_pvt) {
free(h);
return NULL;
Modified: team/mattf/asterisk-wideband/frame.c
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-wideband/frame.c?rev=21232&r1=21231&r2=21232&view=diff
==============================================================================
--- team/mattf/asterisk-wideband/frame.c (original)
+++ team/mattf/asterisk-wideband/frame.c Tue Apr 18 17:57:54 2006
@@ -92,6 +92,7 @@
{ 1, AST_FORMAT_SPEEX, "speex", "SpeeX", 8000 }, /*!< codec_speex.c */
{ 1, AST_FORMAT_ILBC, "ilbc", "iLBC", 8000 }, /*!< codec_ilbc.c */
{ 1, AST_FORMAT_SLINEAR16, "slin16", "16 bit Signed Linear PCM (16khz)", 16000 },
+ { 1, AST_FORMAT_G722, "g722", "G.722", 16000 },
{ 0, 0, "nothing", "undefined", -1 },
{ 0, 0, "nothing", "undefined", -1 },
{ 0, 0, "nothing", "undefined", -1 },
Modified: team/mattf/asterisk-wideband/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-wideband/include/asterisk/frame.h?rev=21232&r1=21231&r2=21232&view=diff
==============================================================================
--- team/mattf/asterisk-wideband/include/asterisk/frame.h (original)
+++ team/mattf/asterisk-wideband/include/asterisk/frame.h Tue Apr 18 17:57:54 2006
@@ -194,6 +194,8 @@
#define AST_FORMAT_ILBC (1 << 10)
/*! Signed Linear 16khz */
#define AST_FORMAT_SLINEAR16 (1 << 11)
+/*! Maximum audio format */
+#define AST_FORMAT_G722 (1 << 12)
/*! Maximum audio format */
#define AST_FORMAT_MAX_AUDIO (1 << 15)
/*! JPEG Images */
More information about the asterisk-commits
mailing list