diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/Makefile ./G723.1/Makefile
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/Makefile	2004-09-01 02:52:08.000000000 +0100
+++ ./G723.1/Makefile	2005-06-08 12:17:59.000000000 +0100
@@ -8,20 +8,68 @@
 OBJSFX=.o
 EXESFX=
 
+# Optional, for ICC
+#ICCLIBS=-lsvml
+
 # IPP Dependencies
-IPPINCLS=-I$(IPPROOT)/include
-IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide
+#IPPINCLS=-I$(IPPROOT)/include
+#IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide
+
+# Comment the above two and uncomment these 
+# three lines to build statically linked version
+IPPINCLS=-I$(IPPROOT)/include -include $(IPPROOT)/tools/staticlib/ipp_$(IPPCORE).h
+IPPLIBS=-L$(IPPROOT)/lib -lippscmerged -lippsrmerged -lippsmerged -lippcore
+LDFLAGS=-static-libcxa
+
+# Optimizations, choose one set only depending on CPU type (or debug at bottom)
+#OPTIMIZE= -O2
+#IPPCORE=
+
+# For Pentium I
+#OPTIMIZE= -O6 -march=pentium  -mcpu=pentium -ffast-math -fomit-frame-pointer
+#IPPCORE=px
+
+# For PII
+#OPTIMIZE=-O6 -march=pentium2 -mcpu=pentium2 -ffast-math -fomit-frame-pointer 
+#IPPCORE=px
+
+# For PIII
+#OPTIMIZE= -O6 -mcpu=pentium3 -march=pentium3 -ffast-math -fomit-frame-pointer
+#IPPCORE=a6
+
+# For PIII no SSE
+#OPTIMIZE= -O6 -mcpu=pentium3 -march=pentium3 -ffast-math -fomit-frame-pointer -mno-sse
+#IPPCORE=a6
+
+# For P4
+OPTIMIZE= -O6 -march=pentium4 -mcpu=pentium4 -ffast-math -fomit-frame-pointer
+IPPCORE=w7
+# optional
+
+# For P4 no SSE
+#OPTIMIZE= -O6 -march=pentium4 -mcpu=pentium4 -ffast-math -fomit-frame-pointer -no-sse
+#IPPCORE=w7
+
+# For Athlon (untested)
+#OPTIMIZE= -O6 -march=athlon   -mcpu=athlon -ffast-math -fomit-frame-pointer
+#IPPCORE=a6
+
+# For debugging
+#OPTIMIZE= -O -g
+#IPPCORE=px
 
 # Compiler Specifics
-CCOPTS=-c -O2
+CCOPTS=-c $(OPTIMIZE)
 CCDEFS=-D__unix__ -DNDEBUG -DNO_SCRATCH_MEMORY_USED -DLINUX32
 CCINCLS=-I./include -I./vm/include $(IPPINCLS)
 
 LNKOUT=-o
 LNKOPTS=
-LNKLIBS=$(IPPLIBS) -lpthread
+LNKLIBS=$(IPPLIBS) -lpthread $(ICCLIBS)
+
+build: prepare_directory build_codec; @echo "Done"
+SOLINKOPTS=-shared $(LDFLAGS) -Xlinker -x
 
-build: prepare_directory build_encoder build_decoder; @echo "Done"
 
 ##### api object #####
 CPPSRC_API=$(wildcard ./api/*$(CPPSFX))
@@ -30,6 +78,17 @@
 CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX))
 OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM))
 
+############ Asterisk Codec ############
+
+OBJECT_CODEC=./bin/codec_g723.so
+CPPSRC_CODEC=$(wildcard ./samples/util_e$(CPPSFX) ./samples/util_d$(CPPSFX) ./samples/codec_g723.c )
+OBJSRC_CODEC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_CODEC))
+
+build_codec:	$(OBJECT_CODEC) ; @echo "done Asterisk codec"
+
+$(OBJECT_CODEC):	$(OBJSRC_CODEC) $(OBJECT_API)
+	$(CC) $(SOLINKOPTS) -o $@ $^ $(LNKLIBS)
+
 ##### link encoder example programs #####
 OBJECT_ENCODER=./bin/g723encoder$(EXESFX)
 CPPSRC_ENCODER=$(wildcard ./samples/g723encoder$(CPPSFX))
@@ -51,7 +110,8 @@
 	$(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS)
 
 ##### compile encoder & decoder objects all together #####
-OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_ENCODER) $(OBJSRC_DECODER)
+#OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_ENCODER) $(OBJSRC_DECODER)
+OBJECTS=$(OBJECT_API)  $(OBJECT_VM) $(OBJSRC_CODEC)
 $(OBJECTS): %$(OBJSFX): %$(CPPSFX)
 	$(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $<
 
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/samples/codec_g723.c ./G723.1/samples/codec_g723.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/samples/codec_g723.c	1970-01-01 01:00:00.000000000 +0100
+++ ./G723.1/samples/codec_g723.c	2005-05-05 14:01:13.000000000 +0100
@@ -0,0 +1,352 @@
+/*
+ * G723.1 codec for Asterisk
+ *
+ * Based on sample applications from Intel Performance Primitives (IPP)
+ * libraries.
+ *
+ * For Intel IPP licensing, see http://www.intel.com
+ *
+ * For G.723.1 royalty payments, see http://www.google.com 
+ *   The G.723.1 patent only exists in some countries, so you may not
+ *   need to pay for a license to use this mechanism.
+ *
+ * This source file is Copyright (C) 2004 Ready Technology Limited
+ * This code is provided for educational purposes and is not warranted
+ * to be fit for commercial use.  There is no warranty of any kind.
+ * 
+ * Author: daniel@readytechnology.co.uk
+ */
+
+#define _GNU_SOURCE
+
+#include <asterisk/lock.h>
+#include <asterisk/translate.h>
+#include <asterisk/module.h>
+#include <asterisk/logger.h>
+#include <asterisk/channel.h>
+#include <pthread.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <ippcore.h>
+#include <ipps.h>
+#include <ippsc.h>
+#include "g723encoder.h"
+#include "g723decoder.h"
+
+#include "slin_g723_ex.h"
+#include "g723_slin_ex.h"
+
+
+/**
+ * Each 24 byte G.723.1 frame is 30ms of 16bit signed linear sampled at 8kHz
+ */
+#define MY_G723_1_FRAME_SIZE 24
+#define MY_G723_1_SAMPLE_SIZE 240		
+
+#define G723_RATE_63 0
+#define G723_RATE_53 1
+
+#define DEFAULT_SEND_RATE G723_RATE_53
+
+AST_MUTEX_DEFINE_STATIC(localuser_lock);
+
+static int localusecnt=0;
+
+static int defaultSendRate;
+
+static char *tdesc = "G723.1/PCM16 (signed linear) Codec Translator, based on IPP";
+
+struct ast_translator_pvt {
+
+	struct ast_frame f;
+
+	G723Encoder_Obj *encoder;
+	G723Decoder_Obj *decoder;
+
+	int sendRate;
+
+	int maxbitsize;
+  	int inFrameSize;
+   	int outFrameSize;
+
+	short pcm_buf[8000];
+	unsigned char bitstream_buf[1000];
+
+	int tail;
+};
+
+#define g723_coder_pvt ast_translator_pvt
+
+static struct ast_translator_pvt *lintog723_new(void) {
+	int i;
+	struct g723_coder_pvt *tmp;
+	int eSize;
+
+	tmp = malloc(sizeof(struct g723_coder_pvt));
+	if(tmp) {
+
+		apiG723Encoder_Alloc(&eSize);
+		tmp->encoder = (G723Encoder_Obj*)ippsMalloc_8u(eSize);		
+		tmp->decoder = NULL;
+		tmp->sendRate = defaultSendRate;
+
+		// Init, no VAD or silence compression
+		apiG723Encoder_Init(tmp->encoder, 0);
+
+		tmp->tail = 0;
+		localusecnt++;
+	}
+	return tmp;
+}
+
+static struct ast_translator_pvt *g723tolin_new(void) {
+	int i;
+	struct g723_coder_pvt *tmp;
+	int dSize;
+
+	tmp = malloc(sizeof(struct g723_coder_pvt));
+	if(tmp) {
+
+		apiG723Decoder_Alloc(&dSize);
+		tmp->encoder = NULL;
+		tmp->decoder = (G723Decoder_Obj *)ippsMalloc_8u(dSize);
+
+		apiG723Decoder_Init(tmp->decoder, 0);
+
+		tmp->tail = 0;
+		localusecnt++;
+	}
+	return tmp;
+}
+
+static struct ast_frame *lintog723_sample(void) {
+	static struct ast_frame f;
+	f.frametype = AST_FRAME_VOICE;
+	f.subclass = AST_FORMAT_SLINEAR;
+	f.datalen = sizeof(slin_g723_ex);
+	f.samples = sizeof(slin_g723_ex) / 2;
+	f.mallocd = 0;
+	f.offset = 0;
+	f.src = __PRETTY_FUNCTION__;
+	f.data = slin_g723_ex;
+	return &f;
+}
+
+static struct ast_frame *g723tolin_sample(void) {
+	static struct ast_frame f;
+	f.frametype = AST_FRAME_VOICE;
+	f.subclass = AST_FORMAT_G723_1;
+	f.datalen = sizeof(g723_slin_ex);
+	f.samples = 240;
+	f.mallocd = 0;
+	f.offset = 0;
+	f.src = __PRETTY_FUNCTION__;
+	f.data = g723_slin_ex;
+	return &f;
+}
+
+/**
+ * Retrieve a frame that has already been decompressed
+ */
+static struct ast_frame *g723tolin_frameout(struct ast_translator_pvt *tmp) {
+	if(!tmp->tail)
+		return NULL;
+	tmp->f.frametype = AST_FRAME_VOICE;
+	tmp->f.subclass = AST_FORMAT_SLINEAR;
+	tmp->f.datalen = tmp->tail * 2;
+	tmp->f.samples = tmp->tail;
+	tmp->f.mallocd = 0;
+	tmp->f.offset = AST_FRIENDLY_OFFSET;
+	tmp->f.src = __PRETTY_FUNCTION__;
+	tmp->f.data = tmp->pcm_buf;
+	tmp->tail = 0;
+	return &tmp->f;
+}
+
+/**
+ * Accept a frame and decode it at the end of the current buffer
+ */
+static int g723tolin_framein(struct ast_translator_pvt *tmp, struct ast_frame *f) {
+	int x, i;
+	int frameInfo;
+	int frameSize;
+	int sampleSize = MY_G723_1_SAMPLE_SIZE;
+	char *frame = (char *)f->data;
+
+	int f_offset = 0;
+
+	while(f_offset < f->datalen) {
+
+		/* Determine the frame type */
+		frameInfo = frame[f_offset] & (short)0x0003;
+		switch(frameInfo) {
+		case 0:	/* Active frame, high rate, 24 bytes */
+			frameSize = 24;
+
+			break;
+		case 1: /* Active frame, low rate, 20 bytes */
+			frameSize = 20;
+
+			break;
+		case 2: /* Sid Frame, 4 bytes */
+			frameSize = 4;
+			break;
+
+		default: /* untransmitted */
+			frameSize = 1;
+			break;
+
+		}
+
+		if((f_offset + frameSize) > f->datalen) {
+			ast_log(LOG_WARNING, "Received a G.723.1 frame that was %d bytes from %s\n", f->datalen, f->src);
+			return -1;
+		}
+
+		if(tmp->tail + sampleSize < sizeof(tmp->pcm_buf) / 2) {
+			/* decode the frame */
+			apiG723Decode(tmp->decoder, frame + f_offset, 0, tmp->pcm_buf + tmp->tail);
+
+			tmp->tail += sampleSize;
+		} else {
+			ast_log(LOG_WARNING, "Out of G.723 buffer space\n");
+			return -1;
+		}
+		f_offset += frameSize;
+	}
+	return 0;
+}
+
+static int lintog723_framein(struct ast_translator_pvt *tmp, struct ast_frame *f) {
+	if(tmp->tail + f->datalen/2 < sizeof(tmp->pcm_buf) / 2) {
+		memcpy((tmp->pcm_buf + tmp->tail), f->data, f->datalen);
+		tmp->tail += f->datalen/2;
+	} else {
+		ast_log(LOG_WARNING, "Out of buffer space\n");
+		return -1;
+	}
+	return 0;
+}
+
+static struct ast_frame *lintog723_frameout(struct ast_translator_pvt *tmp) {
+	int x = 0, i;
+	int frameSize, sampleSize;
+
+	sampleSize = MY_G723_1_SAMPLE_SIZE;
+	switch(tmp->sendRate) {
+	case G723_RATE_63:
+		frameSize = 24;
+		break;
+	case G723_RATE_53:
+		frameSize = 20;
+		break;
+	default:
+		break;
+	}
+
+	if(tmp->tail < sampleSize)
+		return NULL;
+	tmp->f.frametype = AST_FRAME_VOICE;
+	tmp->f.subclass = AST_FORMAT_G723_1;
+	tmp->f.mallocd = 0;
+	tmp->f.offset = AST_FRIENDLY_OFFSET;
+	tmp->f.src = __PRETTY_FUNCTION__;
+	tmp->f.data = tmp->bitstream_buf;
+	while(tmp->tail >= sampleSize) {
+		if((x+1) * frameSize >= sizeof(tmp->bitstream_buf)) {
+			ast_log(LOG_WARNING, "Out of buffer space\n");
+			break;
+		}
+		/* Copy the frame to workspace, then encode it */
+		apiG723Encode(tmp->encoder, tmp->pcm_buf, tmp->sendRate, tmp->bitstream_buf + (x * frameSize));
+
+		tmp->tail -= sampleSize;
+		if(tmp->tail)
+			memmove(tmp->pcm_buf, tmp->pcm_buf + sampleSize, tmp->tail * 2);
+		x++;
+	}
+	tmp->f.datalen = x * frameSize;
+	tmp->f.samples = x * sampleSize;
+
+
+	return &(tmp->f);
+}
+
+static void g723_release(struct ast_translator_pvt *pvt) {
+	int i;
+	if(pvt->encoder != NULL) {
+		/* Free an encoder instance */
+		ippsFree(pvt->encoder);
+
+	} else {
+		/* Free a decoder instance */
+		ippsFree(pvt->decoder);
+	}
+
+	free(pvt);
+	localusecnt--;
+}
+
+static struct ast_translator g723tolin = {
+	"g723tolin",
+	AST_FORMAT_G723_1, AST_FORMAT_SLINEAR,
+	g723tolin_new,
+	g723tolin_framein,
+	g723tolin_frameout,
+	g723_release,
+	g723tolin_sample };
+
+static struct ast_translator lintog723 = {
+	"lintog723",
+	AST_FORMAT_SLINEAR, AST_FORMAT_G723_1,
+	lintog723_new,
+	lintog723_framein,
+	lintog723_frameout,
+	g723_release,
+	lintog723_sample };
+
+int load_module(void) {
+	int res;
+
+	/* We should read this from a config file */
+	defaultSendRate = DEFAULT_SEND_RATE;
+
+	res = ast_register_translator(&g723tolin);
+	if(!res)
+		res = ast_register_translator(&lintog723);
+	else
+		ast_unregister_translator(&g723tolin);
+	return res;
+}
+
+int unload_module(void) {
+	int res;
+	ast_mutex_lock(&localuser_lock);
+	res = ast_unregister_translator(&lintog723);
+	if(!res)
+		res = ast_unregister_translator(&g723tolin);
+	if(localusecnt)
+		res = -1;
+	ast_mutex_unlock(&localuser_lock);
+	return res;
+}
+
+char *description(void) {
+	return tdesc;
+}
+
+int usecount(void) {
+	int res;
+	STANDARD_USECOUNT(res);
+	return res;
+}
+
+char *key() {
+	return ASTERISK_GPL_KEY;
+}
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/samples/g723_slin_ex.h ./G723.1/samples/g723_slin_ex.h
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/samples/g723_slin_ex.h	1970-01-01 01:00:00.000000000 +0100
+++ ./G723.1/samples/g723_slin_ex.h	2005-05-05 14:01:13.000000000 +0100
@@ -0,0 +1,10 @@
+/*
+ * One frame of raw G723.1 data
+ */
+
+static unsigned char g723_slin_ex[] = {
+  0xf4, 0xda, 0x1, 0x35, 0x10, 0x7, 0x0, 0x8e, 
+  0x5a, 0x39, 0xdf, 0x83, 0x6e, 0x79, 0x9c, 0x83, 
+  0x4e, 0xec, 0xa5, 0x81, 0xe0, 0x3, 0x69, 0xe6
+   };
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/samples/print_bytes.c ./G723.1/samples/print_bytes.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/samples/print_bytes.c	1970-01-01 01:00:00.000000000 +0100
+++ ./G723.1/samples/print_bytes.c	2005-05-05 14:01:13.000000000 +0100
@@ -0,0 +1,14 @@
+
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+
+  int c;
+
+  while((c = fgetc(stdin)) != EOF)
+    printf("0x%x, ");
+
+  printf("\n");
+
+}
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/samples/slin_g723_ex.h ./G723.1/samples/slin_g723_ex.h
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G723.1/samples/slin_g723_ex.h	1970-01-01 01:00:00.000000000 +0100
+++ ./G723.1/samples/slin_g723_ex.h	2005-05-05 14:01:13.000000000 +0100
@@ -0,0 +1,43 @@
+/*
+ * Signed 16 bit audio data
+ *
+ */
+static signed short slin_g723_ex[] = {
+0x0873, 0x06d9, 0x038c, 0x0588, 0x0409, 0x033d, 0x0311, 0xff6c, 0xfeef, 0xfd3e,
+0xfdff, 0xff7a, 0xff6d, 0xffec, 0xff36, 0xfd62, 0xfda7, 0xfc6c, 0xfe67, 0xffe1,
+0x003d, 0x01cc, 0x0065, 0x002a, 0xff83, 0xfed9, 0xffba, 0xfece, 0xff42, 0xff16,
+0xfe85, 0xff31, 0xff02, 0xfdff, 0xfe32, 0xfe3f, 0xfed5, 0xff65, 0xffd4, 0x005b,
+0xff88, 0xff01, 0xfebd, 0xfe95, 0xff46, 0xffe1, 0x00e2, 0x0165, 0x017e, 0x01c9,
+0x0182, 0x0146, 0x00f9, 0x00ab, 0x006f, 0xffe8, 0xffd8, 0xffc4, 0xffb2, 0xfff9,
+0xfffe, 0x0023, 0x0018, 0x000b, 0x001a, 0xfff7, 0x0014, 0x000b, 0x0004, 0x000b,
+0xfff1, 0xff4f, 0xff3f, 0xff42, 0xff5e, 0xffd4, 0x0014, 0x0067, 0x0051, 0x003b,
+0x0034, 0xfff9, 0x000d, 0xff54, 0xff54, 0xff52, 0xff3f, 0xffcc, 0xffe6, 0x00fc,
+0x00fa, 0x00e4, 0x00f3, 0x0021, 0x0011, 0xffa1, 0xffab, 0xffdb, 0xffa5, 0x0009,
+0xffd2, 0xffe6, 0x0007, 0x0096, 0x00e4, 0x00bf, 0x00ce, 0x0048, 0xffe8, 0xffab,
+0xff8f, 0xffc3, 0xffc1, 0xfffc, 0x0002, 0xfff1, 0x000b, 0x00a7, 0x00c5, 0x00cc,
+0x015e, 0x00e4, 0x0094, 0x0029, 0xffc7, 0xffc3, 0xff86, 0xffe4, 0xffe6, 0xffec,
+0x000f, 0xffe3, 0x0028, 0x004b, 0xffaf, 0xffcb, 0xfedd, 0xfef8, 0xfe83, 0xfeba,
+0xff94, 0xff94, 0xffbe, 0xffa8, 0xff0d, 0xff32, 0xff58, 0x0021, 0x0087, 0x00be,
+0x0115, 0x007e, 0x0052, 0xfff0, 0xffc9, 0xffe8, 0xffc4, 0x0014, 0xfff0, 0xfff5,
+0xfffe, 0xffda, 0x000b, 0x0010, 0x006f, 0x006f, 0x0052, 0x0045, 0xffee, 0xffea,
+0xffcb, 0xffdf, 0xfffc, 0xfff0, 0x0012, 0xfff7, 0xfffe, 0x0018, 0x0050, 0x0066,
+0x0047, 0x0028, 0xfff7, 0xffe8, 0xffec, 0x0007, 0x001d, 0x0016, 0x00c4, 0x0093,
+0x007d, 0x0052, 0x00a5, 0x0091, 0x003c, 0x0041, 0xffd1, 0xffda, 0xffc6, 0xfff0,
+0x001d, 0xfffe, 0x0024, 0xffee, 0xfff3, 0xfff0, 0xffea, 0x0012, 0xfff3, 0xfff7,
+0xffda, 0xffca, 0xffda, 0xffdf, 0xfff3, 0xfff7, 0xff54, 0xff7c, 0xff8c, 0xffb9,
+0x0012, 0x0012, 0x004c, 0x0007, 0xff50, 0xff66, 0xff54, 0xffa9, 0xffdc, 0xfff9,
+0x0038, 0xfff9, 0x00d2, 0x0096, 0x008a, 0x0079, 0xfff5, 0x0019, 0xffad, 0xfffc,
+0x015e, 0x00e4, 0x0094, 0x0029, 0xffc7, 0xffc3, 0xff86, 0xffe4, 0xffe6, 0xffec,
+0x000f, 0xffe3, 0x0028, 0x004b, 0xffaf, 0xffcb, 0xfedd, 0xfef8, 0xfe83, 0xfeba,
+0xff94, 0xff94, 0xffbe, 0xffa8, 0xff0d, 0xff32, 0xff58, 0x0021, 0x0087, 0x00be,
+0x0115, 0x007e, 0x0052, 0xfff0, 0xffc9, 0xffe8, 0xffc4, 0x0014, 0xfff0, 0xfff5,
+0xfffe, 0xffda, 0x000b, 0x0010, 0x006f, 0x006f, 0x0052, 0x0045, 0xffee, 0xffea,
+0xffcb, 0xffdf, 0xfffc, 0xfff0, 0x0012, 0xfff7, 0xfffe, 0x0018, 0x0050, 0x0066,
+0x0047, 0x0028, 0xfff7, 0xffe8, 0xffec, 0x0007, 0x001d, 0x0016, 0x00c4, 0x0093,
+0x007d, 0x0052, 0x00a5, 0x0091, 0x003c, 0x0041, 0xffd1, 0xffda, 0xffc6, 0xfff0,
+0x001d, 0xfffe, 0x0024, 0xffee, 0xfff3, 0xfff0, 0xffea, 0x0012, 0xfff3, 0xfff7,
+0xffda, 0xffca, 0xffda, 0xffdf, 0xfff3, 0xfff7, 0xff54, 0xff7c, 0xff8c, 0xffb9,
+0x0012, 0x0012, 0x004c, 0x0007, 0xff50, 0xff66, 0xff54, 0xffa9, 0xffdc, 0xfff9,
+0x0038, 0xfff9, 0x00d2, 0x0096, 0x008a, 0x0079, 0xfff5, 0x0019, 0xffad, 0xfffc
+ };
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/Makefile ./G729-float/Makefile
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/Makefile	2004-09-01 02:52:08.000000000 +0100
+++ ./G729-float/Makefile	2005-09-03 22:04:28.000000000 +0100
@@ -8,20 +8,70 @@
 OBJSFX=.o
 EXESFX=
 
+# Optional, for ICC
+#ICCLIBS=-lsvml
+
 # IPP Dependencies
-IPPINCLS=-I$(IPPROOT)/include
-IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lippsr -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide
+#IPPINCLS=-I$(IPPROOT)/include
+#IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lippsr -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide
+
+# Comment the above two and uncomment these
+# three lines to build statically linked version
+IPPINCLS=-I$(IPPROOT)/include -include $(IPPROOT)/tools/staticlib/ipp_$(IPPCORE).h
+IPPLIBS=-L$(IPPROOT)/lib -lippscmerged -lippsrmerged -lippsmerged -lippcore
+LDFLAGS=-static
+#-libcxa
+
+
+# Optimizations, choose one set only depending on CPU type (or debug at bottom)
+#OPTIMIZE= -O2
+#IPPCORE=
+
+# For Pentium I
+#OPTIMIZE= -O6 -march=pentium  -mcpu=pentium -ffast-math -fomit-frame-pointer -DIPPCORE_NO_SSE
+#IPPCORE=px
+
+# For PII
+#OPTIMIZE=-O6 -march=pentium2 -mcpu=pentium2 -ffast-math -fomit-frame-pointer -DIPPCORE_NO_SSE
+#IPPCORE=px
+
+# For PIII
+#OPTIMIZE= -O6 -mcpu=pentium3 -march=pentium3 -ffast-math -fomit-frame-pointer
+#IPPCORE=a6
+
+# For PIII no SSE
+#OPTIMIZE= -O6 -mcpu=pentium3 -march=pentium3 -ffast-math -fomit-frame-pointer -mno-sse
+#IPPCORE=a6
+
+# For P4
+OPTIMIZE= -O6 -march=pentium4 -mcpu=pentium4 -ffast-math -fomit-frame-pointer
+IPPCORE=w7
+# optional
+
+# For P4 no SSE
+#OPTIMIZE= -O6 -march=pentium4 -mcpu=pentium4 -ffast-math -fomit-frame-pointer -no-sse
+#IPPCORE=w7
+
+# For Athlon (untested)
+#OPTIMIZE= -O6 -march=athlon   -mcpu=athlon -ffast-math -fomit-frame-pointer
+#IPPCORE=a6
+
+# For debugging
+#OPTIMIZE= -O  -g
+#IPPCORE=px
 
 # Compiler Specifics
-CCOPTS=-c -O2
+CCOPTS=-c $(OPTIMIZE) 
 CCDEFS=-D__unix__ -Dlinux -Dlinux32 -DNDEBUG -DLINUX32 -DNO_SCRATCH_MEMORY_USED
 CCINCLS=-I./include -I./vm/include $(IPPINCLS)
 
 LNKOUT=-o
-LNKOPTS=
-LNKLIBS=$(IPPLIBS) -lpthread -lm
+LNKOPTS= 
+LNKLIBS=$(IPPLIBS) -lpthread -lm $(ICCLIBS)
+
+SOLINKOPTS=-shared $(LDFLAGS) -Xlinker -x
 
-build: prepare_directory build_encoder build_decoder; @echo "Done"
+build: prepare_directory build_codec build_encoder build_decoder ; @echo "Done"
 
 ##### api object #####
 CPPSRC_API=$(wildcard ./api/*$(CPPSFX))
@@ -30,28 +80,49 @@
 CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX))
 OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM))
 
+############ Asterisk Codec ############
+OBJECT_CODEC=./bin/codec_g729.so
+CPPSRC_CODEC=$(wildcard ./samples/util_e$(CPPSFX) ./samples/util_d$(CPPSFX) ./samples/codec_g729.c )
+OBJSRC_CODEC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_CODEC))
+
+build_codec:	$(OBJECT_CODEC) ; @echo "done Asterisk codec"
+
+$(OBJECT_CODEC):	$(OBJSRC_CODEC) $(OBJECT_API)
+	$(CC) $(SOLINKOPTS) -o $@ $^ $(LNKLIBS)
+
 ##### link encoder example programs #####
 OBJECT_ENCODER=./bin/g729fpencoder$(EXESFX)
-CPPSRC_ENCODER=$(wildcard ./samples/encoder$(CPPSFX) ./samples/util_e$(CPPSFX) )
+OBJECT_MY_ENC=./bin/my_enc
+CPPSRC_ENCODER=$(wildcard ./samples/encoder$(CPPSFX) ./samples/util_e$(CPPSFX))
+CPPSRC_MY_ENC=$(wildcard ./samples/util_e$(CPPSFX) ./samples/my_enc.c)
 OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER))
+OBJSRC_MY_ENC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_MY_ENC))
 
-build_encoder: $(OBJECT_ENCODER) ; @echo "done encoder"
+build_encoder: $(OBJECT_ENCODER) $(OBJECT_MY_ENC) ; @echo "done encoder"
 
+$(OBJECT_MY_ENC): $(OBJSRC_MY_ENC) $(OBJECT_API) $(OBJECT_VM)
+	$(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 
 $(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM)
-	$(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS)
+	$(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 
 
 ##### link decoder example programs #####
 OBJECT_DECODER=./bin/g729fpdecoder$(EXESFX)
-CPPSRC_DECODER=$(wildcard ./samples/decoder$(CPPSFX) ./samples/util_d$(CPPSFX) )
+OBJECT_MY_DEC=./bin/my_dec
+CPPSRC_DECODER=$(wildcard ./samples/decoder$(CPPSFX) ./samples/util_d$(CPPSFX))
+CPPSRC_MY_DEC=$(wildcard ./samples/util_d$(CPPSFX) ./samples/my_dec.c)
 OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER))
+OBJSRC_MY_DEC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_MY_DEC))
 
-build_decoder: $(OBJECT_DECODER) ; @echo "done decoder"
+build_decoder: $(OBJECT_DECODER) $(OBJECT_MY_DEC) ; @echo "done decoder"
 
-$(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM)
+$(OBJECT_MY_DEC): $(OBJSRC_MY_DEC) $(OBJECT_API) $(OBJECT_VM)
 	$(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS)
+$(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM)
+	$(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 
 
 ##### compile encoder & decoder objects all together #####
-OBJECTS=$(OBJECT_API)  $(OBJECT_VM)$(OBJSRC_ENCODER) $(OBJSRC_DECODER)
+#OBJECTS=$(OBJECT_API)  $(OBJECT_VM) $(OBJSRC_CODEC)
+OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_CODEC) $(OBJSRC_ENCODER) $(OBJSRC_MY_ENC) $(OBJSRC_DECODER) $(OBJSRC_MY_DEC)
 $(OBJECTS): %$(OBJSFX): %$(CPPSFX)
 	$(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $<
 
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/codec_g729.c ./G729-float/samples/codec_g729.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/codec_g729.c	1970-01-01 01:00:00.000000000 +0100
+++ ./G729-float/samples/codec_g729.c	2005-09-03 20:25:29.000000000 +0100
@@ -0,0 +1,368 @@
+/*
+ * G729 codec for Asterisk
+ *
+ * Based on sample applications from Intel Performance Primitives (IPP)
+ * libraries.
+ *
+ * For Intel IPP licensing, see http://www.intel.com
+ *
+ * For G.729(,A,B) royalty payments, see http://www.sipro.com 
+ *   WARNING: please make sure you are sitting down before looking
+ *            at their price list.
+ *
+ * This source file is Copyright (C) 2004 Ready Technology Limited
+ * This code is provided for educational purposes and is not warranted
+ * to be fit for commercial use.  There is no warranty of any kind.
+ * 
+ * Author: daniel@readytechnology.co.uk
+ */
+
+#define _GNU_SOURCE
+
+#include <asterisk/lock.h>
+#include <asterisk/translate.h>
+#include <asterisk/module.h>
+#include <asterisk/logger.h>
+#include <asterisk/channel.h>
+#include <pthread.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "usc.h"
+#include <ippcore.h>
+#include <ipps.h>
+#include <ippsc.h>
+#include "encoder.h"
+#include "decoder.h"
+
+#include "slin_g729_ex.h"
+#include "g729_slin_ex.h"
+
+AST_MUTEX_DEFINE_STATIC(localuser_lock);
+
+static int localusecnt=0;
+
+static char *tdesc = "G729/PCM16 (signed linear) Codec Translator, based on IPP";
+
+static USC_Fxns *USC_CODEC_Fxns;
+
+struct ast_translator_pvt {
+
+	struct ast_frame f;
+
+	USC_CodecInfo pInfo;
+
+	USC_Handle codec;	/* the encoder or decoder handle */
+	USC_MemBank* pBanks;
+
+
+	USC_PCMStream pcmStream;	/* Signed linear data */
+	USC_Bitstream bitStream;	/* G.729 bits */
+
+	int nbanks;
+	int maxbitsize;
+  	int inFrameSize;
+   	int outFrameSize;
+
+	short pcm_buf[8000];
+	unsigned char bitstream_buf[1000];
+
+	int tail;
+};
+
+#define g729_coder_pvt ast_translator_pvt
+
+static struct ast_translator_pvt *lintog729_new(void) {
+	int i;
+	struct g729_coder_pvt *tmp;
+	tmp = malloc(sizeof(struct g729_coder_pvt));
+	if(tmp) {
+		USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &tmp->pInfo);
+		((USC_Option*)tmp->pInfo.params)->modes.truncate = 1;
+  		((USC_Option*)tmp->pInfo.params)->direction = 0;
+  		((USC_Option*)tmp->pInfo.params)->modes.vad = 0;
+		USC_CODEC_Fxns->std.NumAlloc(tmp->pInfo.params, &(tmp->nbanks));
+		if(!(tmp->pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*(tmp->nbanks)))) {
+                  ast_log(LOG_WARNING, "ippsMalloc_8u failed allocating %d bytes", sizeof(USC_MemBank)*(tmp->nbanks));
+                  /* printf("\nLow memory: %d bytes not allocated\n",sizeof(USC_MemBank)*nbanks); */
+                  return NULL;
+                }
+		USC_CODEC_Fxns->std.MemAlloc(tmp->pInfo.params, tmp->pBanks);
+		for(i=0; i<tmp->nbanks;i++) {
+			if(!(tmp->pBanks[i].pMem = ippsMalloc_8u(tmp->pBanks->nbytes))) {
+				ast_log(LOG_WARNING, "ippsMalloc_8u failed allocating %d bytes", sizeof(USC_MemBank)*(tmp->nbanks));
+				/* printf("\nLow memory: %d bytes not allocated\n",tmp->pBanks->nbytes); */
+				return NULL;
+			}
+		}
+
+		tmp->inFrameSize = getInFrameSize();
+		tmp->outFrameSize = getOutFrameSize();
+
+		/* tmp->bitstream_buf = ippsMalloc_8s(tmp->pInfo.maxbitsize); */
+
+		tmp->pcmStream.bitrate = tmp->pInfo.params->modes.bitrate;
+  		tmp->maxbitsize = tmp->pInfo.maxbitsize;
+  		USC_CODEC_Fxns->std.Init(tmp->pInfo.params, tmp->pBanks, &(tmp->codec));
+
+#ifndef IPPCORE_NO_SSE
+  		ippCoreSetFlushToZero( 1, NULL );
+#endif
+  		tmp->pcmStream.pcmType.bitPerSample = tmp->pInfo.pcmType->bitPerSample;
+  		tmp->pcmStream.pcmType.sample_frequency = tmp->pInfo.pcmType->sample_frequency;
+  		tmp->bitStream.nbytes  = tmp->maxbitsize;
+  		tmp->bitStream.pBuffer = tmp->bitstream_buf;
+
+		USC_CODEC_Fxns->std.Reinit(&((USC_Option*)tmp->pInfo.params)->modes, tmp->codec);
+
+		tmp->tail = 0;
+		localusecnt++;
+	}
+	return tmp;
+}
+
+static struct ast_translator_pvt *g729tolin_new(void) {
+	int i;
+	struct g729_coder_pvt *tmp;
+	tmp = malloc(sizeof(struct g729_coder_pvt));
+	if(tmp) {
+		USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &(tmp->pInfo));	
+		((USC_Option*)tmp->pInfo.params)->modes.bitrate = 0;
+  		((USC_Option*)tmp->pInfo.params)->modes.truncate = 1;
+  		((USC_Option*)tmp->pInfo.params)->direction = 1;
+
+		/* tmp->bitstream_buf = ippsMalloc_8s(size); */
+		
+		USC_CODEC_Fxns->std.NumAlloc(tmp->pInfo.params, &tmp->nbanks);
+		if(!(tmp->pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*(tmp->nbanks)))) {
+			ast_log(LOG_WARNING, "ippsMalloc_8u failed allocating %d bytes", sizeof(USC_MemBank)*(tmp->nbanks));
+			return NULL;
+		}
+		USC_CODEC_Fxns->std.MemAlloc(tmp->pInfo.params, tmp->pBanks);
+		for(i=0; i<tmp->nbanks;i++) {
+			if(!(tmp->pBanks[i].pMem = ippsMalloc_8u(tmp->pBanks->nbytes))) {
+				ast_log(LOG_WARNING, "ippsMalloc_8u failed allocating %d bytes", sizeof(USC_MemBank)*(tmp->nbanks));
+				/* printf("\nLow memory: %d bytes not allocated\n", tmp->pBanks->nbytes); */
+				return NULL;
+			}
+		}
+
+		tmp->outFrameSize = getOutFrameSize();
+
+		/* pcm_buf ippsMalloc_8s(getOutFrameSize()); */
+
+		tmp->maxbitsize = tmp->pInfo.maxbitsize;
+		USC_CODEC_Fxns->std.Init(tmp->pInfo.params, tmp->pBanks, &(tmp->codec));
+
+#ifndef IPPCORE_NO_SSE
+		ippCoreSetFlushToZero( 1, NULL );
+#endif
+
+		tmp->bitStream.nbytes  = tmp->maxbitsize;
+	  	tmp->bitStream.bitrate = 0;
+	        tmp->bitStream.frametype = 3;
+	        tmp->pcmStream.pBuffer = tmp->pcm_buf;
+		tmp->pcmStream.pcmType.bitPerSample = 0;
+	        tmp->pcmStream.pcmType.sample_frequency = 0;
+
+	        USC_CODEC_Fxns->std.Reinit(&((USC_Option*)tmp->pInfo.params)->modes, tmp->codec);
+
+		tmp->tail = 0;
+		localusecnt++;
+	}
+	return tmp;
+}
+
+static struct ast_frame *lintog729_sample(void) {
+	static struct ast_frame f;
+	f.frametype = AST_FRAME_VOICE;
+	f.subclass = AST_FORMAT_SLINEAR;
+	f.datalen = sizeof(slin_g729_ex);
+	f.samples = sizeof(slin_g729_ex) / 2;
+	f.mallocd = 0;
+	f.offset = 0;
+	f.src = __PRETTY_FUNCTION__;
+	f.data = slin_g729_ex;
+	return &f;
+}
+
+static struct ast_frame *g729tolin_sample(void) {
+	static struct ast_frame f;
+	f.frametype = AST_FRAME_VOICE;
+	f.subclass = AST_FORMAT_G729A;
+	f.datalen = sizeof(g729_slin_ex);
+	f.samples = 240;
+	f.mallocd = 0;
+	f.offset = 0;
+	f.src = __PRETTY_FUNCTION__;
+	f.data = g729_slin_ex;
+	return &f;
+}
+
+/**
+ * Retrieve a frame that has already been decompressed
+ */
+static struct ast_frame *g729tolin_frameout(struct ast_translator_pvt *tmp) {
+	if(!tmp->tail)
+		return NULL;
+	tmp->f.frametype = AST_FRAME_VOICE;
+	tmp->f.subclass = AST_FORMAT_SLINEAR;
+	tmp->f.datalen = tmp->tail * 2;
+	tmp->f.samples = tmp->tail;
+	tmp->f.mallocd = 0;
+	tmp->f.offset = AST_FRIENDLY_OFFSET;
+	tmp->f.src = __PRETTY_FUNCTION__;
+	tmp->f.data = tmp->pcm_buf;
+	tmp->tail = 0;
+	return &tmp->f;
+}
+
+/**
+ * Accept a frame and decode it at the end of the current buffer
+ */
+static int g729tolin_framein(struct ast_translator_pvt *tmp, struct ast_frame *f) {
+	int x, i;
+	int frameSize = 0;
+	
+/*	if(f->datalen % 10) {
+		ast_log(LOG_WARNING, "Received a G.729 frame that was %d bytes from %s\n", f->datalen, f->src);
+		return -1;
+	} */
+
+	for(x = 0; x < f->datalen; x += frameSize) {
+		if((f->datalen - x) == 2)
+			frameSize = 2;   /* VAD frame */
+		else
+			frameSize = 10;  /* Regular frame */
+		if(tmp->tail + 80 < sizeof(tmp->pcm_buf) / 2) {
+			/* decode the frame */
+			tmp->bitStream.pBuffer = f->data + x;
+			tmp->pcmStream.pBuffer = tmp->pcm_buf + tmp->tail;
+			USC_CODEC_Fxns->std.Decode (tmp->codec, &tmp->bitStream, &tmp->pcmStream);
+
+			tmp->tail += 80;
+		} else {
+			ast_log(LOG_WARNING, "Out of G.729 buffer space\n");
+			return -1;
+		}
+	}
+	return 0;
+}
+
+static int lintog729_framein(struct ast_translator_pvt *tmp, struct ast_frame *f) {
+	if(tmp->tail + f->datalen/2 < sizeof(tmp->pcm_buf) / 2) {
+		memcpy((tmp->pcm_buf + tmp->tail), f->data, f->datalen);
+		tmp->tail += f->datalen/2;
+	} else {
+		ast_log(LOG_WARNING, "Out of buffer space\n");
+		return -1;
+	}
+	return 0;
+}
+
+static struct ast_frame *lintog729_frameout(struct ast_translator_pvt *tmp) {
+
+
+	int x = 0, i;
+	if(tmp->tail < 80)
+		return NULL;
+	tmp->f.frametype = AST_FRAME_VOICE;
+	tmp->f.subclass = AST_FORMAT_G729A;
+	tmp->f.mallocd = 0;
+	tmp->f.offset = AST_FRIENDLY_OFFSET;
+	tmp->f.src = __PRETTY_FUNCTION__;
+	tmp->f.data = tmp->bitstream_buf;
+	while(tmp->tail >= 80) {
+		if((x+1) * 10 >= sizeof(tmp->bitstream_buf)) {
+			ast_log(LOG_WARNING, "Out of buffer space\n");
+			break;
+		}
+		/* Copy the frame to workspace, then encode it */
+		tmp->pcmStream.pBuffer = tmp->pcm_buf;
+		tmp->bitStream.pBuffer = tmp->bitstream_buf + (x * 10);
+		USC_CODEC_Fxns->std.Encode (tmp->codec, &tmp->pcmStream, &tmp->bitStream);
+
+		tmp->tail -= 80;
+		if(tmp->tail)
+			memmove(tmp->pcm_buf, tmp->pcm_buf + 80, tmp->tail * 2);
+		x++;
+	}
+	tmp->f.datalen = x * 10;
+	tmp->f.samples = x * 80;
+
+
+	return &(tmp->f);
+}
+
+static void g729_release(struct ast_translator_pvt *pvt) {
+	int i;
+	for(i = 0; i < pvt->nbanks; i++) {
+		if(pvt->pBanks[i].pMem)
+			ippsFree(pvt->pBanks[i].pMem);	
+		pvt->pBanks[i].pMem=NULL;
+	}
+	if(pvt->pBanks)
+		ippsFree(pvt->pBanks);
+	free(pvt);
+	localusecnt--;
+}
+
+static struct ast_translator g729tolin = {
+	"g729tolin",
+	AST_FORMAT_G729A, AST_FORMAT_SLINEAR,
+	g729tolin_new,
+	g729tolin_framein,
+	g729tolin_frameout,
+	g729_release,
+	g729tolin_sample };
+
+static struct ast_translator lintog729 = {
+	"lintog729",
+	AST_FORMAT_SLINEAR, AST_FORMAT_G729A,
+	lintog729_new,
+	lintog729_framein,
+	lintog729_frameout,
+	g729_release,
+	lintog729_sample };
+
+int load_module(void) {
+	USC_CODEC_Fxns = USC_GetCodecByName ();
+	int res;
+	res = ast_register_translator(&g729tolin);
+	if(!res)
+		res = ast_register_translator(&lintog729);
+	else
+		ast_unregister_translator(&g729tolin);
+	return res;
+}
+
+int unload_module(void) {
+	int res;
+	ast_mutex_lock(&localuser_lock);
+	res = ast_unregister_translator(&lintog729);
+	if(!res)
+		res = ast_unregister_translator(&g729tolin);
+	if(localusecnt)
+		res = -1;
+	ast_mutex_unlock(&localuser_lock);
+	return res;
+}
+
+char *description(void) {
+	return tdesc;
+}
+
+int usecount(void) {
+	int res;
+	STANDARD_USECOUNT(res);
+	return res;
+}
+
+char *key() {
+	return ASTERISK_GPL_KEY;
+}
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/decoder.c ./G729-float/samples/decoder.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/decoder.c	2004-09-01 02:52:08.000000000 +0100
+++ ./G729-float/samples/decoder.c	2005-09-03 21:10:48.000000000 +0100
@@ -448,10 +448,10 @@
    }  
    for (iTh=0; iTh < n_thread; iTh++) {
       for(i=0; i<nbanks;i++){
-         if(!(ThArg[iTh].pBanks[i].pMem)) ippsFree(ThArg[iTh].pBanks[i].pMem);
+         if((ThArg[iTh].pBanks[i].pMem)) ippsFree(ThArg[iTh].pBanks[i].pMem);
          ThArg[iTh].pBanks[i].pMem = NULL;
       }
-      if(!(ThArg[iTh].pBanks)) ippsFree(ThArg[iTh].pBanks);
+      if((ThArg[iTh].pBanks)) ippsFree(ThArg[iTh].pBanks);
       ThArg[iTh].pBanks = NULL;
       ippsFree(out_buff[iTh]);
       ippsFree(ThArg[iTh].bitstream_buf);
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/encoder.c ./G729-float/samples/encoder.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/encoder.c	2004-09-01 02:52:08.000000000 +0100
+++ ./G729-float/samples/encoder.c	2005-09-03 21:10:40.000000000 +0100
@@ -203,7 +203,7 @@
    int outFrameSize = 0;
    int emode = 0;
    
-   USC_CODEC_Fxns = USC_GetCodecByName ();
+   USC_CODEC_Fxns = USC_GetCodecByName_xx2 ();
    USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &pInfo); /* codec info */
    
    
@@ -212,7 +212,7 @@
       argv++;
       if ('-' == (*argv)[0]) { 
          if (!strncmp("-r",*argv,2)){ /* check if rate is specified */
-            if (text2rate(*argv+2, &rat_buff, &nRates, &pInfo)) {
+            if (text2rate_xx1(*argv+2, &rat_buff, &nRates, &pInfo)) {
                continue;
             }
          }else if (checkVad(*argv, &emode)) { /* check if vad is specified */
@@ -377,7 +377,7 @@
 
    /* compute the maximum size of the output */
    inFrameSize = getInFrameSize();
-   outFrameSize = getOutFrameSize();
+   outFrameSize = getOutFrameSize_xx3();
 
    in_len_cur = in_len;
    in_buff_cur = in_buff;
@@ -452,10 +452,10 @@
    }
    for (iTh=0; iTh < n_thread; iTh++) {
       for(i=0; i<nbanks;i++){
-         if(!(ThArg[iTh].pBanks[i].pMem)) ippsFree(ThArg[iTh].pBanks[i].pMem);
+         if((ThArg[iTh].pBanks[i].pMem)) ippsFree(ThArg[iTh].pBanks[i].pMem);
          ThArg[iTh].pBanks[i].pMem = NULL;
       }
-      if(!(ThArg[iTh].pBanks)) ippsFree(ThArg[iTh].pBanks);
+      if((ThArg[iTh].pBanks)) ippsFree(ThArg[iTh].pBanks);
       ThArg[iTh].pBanks = NULL;
       ippsFree(out_buff[iTh]);
       ippsFree(ThArg[iTh].bitstream_buf);
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/g729_slin_ex.h ./G729-float/samples/g729_slin_ex.h
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/g729_slin_ex.h	1970-01-01 01:00:00.000000000 +0100
+++ ./G729-float/samples/g729_slin_ex.h	2005-05-05 14:01:04.000000000 +0100
@@ -0,0 +1,7 @@
+/*
+ * One frame of raw G729 data
+ */
+
+static unsigned char g729_slin_ex[] = {
+  0xf9, 0xa3, 0xc9, 0xe0, 0x0, 0xfa, 0xdd, 0xa9, 0x97, 0x7d };
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/gen_test.c ./G729-float/samples/gen_test.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/gen_test.c	1970-01-01 01:00:00.000000000 +0100
+++ ./G729-float/samples/gen_test.c	2005-05-05 14:01:04.000000000 +0100
@@ -0,0 +1,16 @@
+
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+
+	int i;
+
+	FILE *f = fopen("test1.g729", "r");
+	for(i = 0; i < 10; i++)
+		printf("0x%x, ", fgetc(f));
+	fclose(f);
+
+  	return 0;
+
+}
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/my_dec.c ./G729-float/samples/my_dec.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/my_dec.c	1970-01-01 01:00:00.000000000 +0100
+++ ./G729-float/samples/my_dec.c	2005-09-03 22:13:18.000000000 +0100
@@ -0,0 +1,102 @@
+
+#include <stdio.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include "usc.h"
+#include <ippcore.h>
+#include <ipps.h>
+#include <ippsc.h>
+#include "decoder.h"
+
+
+int main(int argc, char *argv[]) {
+
+  char *bitstream_buf;
+  char *buf_out;
+  char *p;
+  char *f;
+  long file_size;
+  int i;
+
+  if(argc != 3) {
+    fprintf(stderr, "Usage: my_dec <audio.g729> <audio.raw>\n");
+    exit(-1);
+  }
+
+  fprintf(stderr, "Converting %s to %s\n", argv[1], argv[2]);
+
+
+  USC_Fxns *USC_CODEC_Fxns;
+  USC_CodecInfo pInfo;
+  USC_Handle decoder;
+
+  USC_Bitstream in;
+  USC_PCMStream out;
+  USC_MemBank* pBanks;
+
+  int nbanks = 0;
+  int maxbitsize;
+  int inFrameSize = 10;
+  int outFrameSize;
+
+  USC_CODEC_Fxns = USC_GetCodecByName ();
+  USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &pInfo); /* codec info */
+
+  ((USC_Option*)pInfo.params)->modes.bitrate = 0;
+  ((USC_Option*)pInfo.params)->modes.truncate = 1;
+  ((USC_Option*)pInfo.params)->direction = 1;
+
+  FILE *f_in = fopen(argv[1], "r");
+  FILE *f_out = fopen(argv[2], "w");
+
+  fseek(f_in, 0, SEEK_END);
+  file_size = ftell(f_in);
+  fseek(f_in, 0, SEEK_SET);
+
+  bitstream_buf = ippsMalloc_8s(file_size);
+  fread(bitstream_buf, file_size, 1, f_in);
+  p = bitstream_buf;
+  f = bitstream_buf + file_size;
+
+  USC_CODEC_Fxns->std.NumAlloc(pInfo.params, &nbanks);
+  pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*nbanks);
+  USC_CODEC_Fxns->std.MemAlloc(pInfo.params, pBanks);
+  for(i=0; i<nbanks;i++) {
+    if(!(pBanks[i].pMem = ippsMalloc_8u(pBanks->nbytes))) {
+      printf("\nLow memory: %d bytes not allocated\n",pBanks->nbytes);
+      return -1;
+    }
+  }
+
+  outFrameSize = getOutFrameSize();
+
+  buf_out = ippsMalloc_8s(getOutFrameSize());
+
+  maxbitsize = pInfo.maxbitsize;
+  USC_CODEC_Fxns->std.Init(pInfo.params, pBanks, &decoder);
+
+  ippCoreSetFlushToZero( 1, NULL );
+
+  in.nbytes  = maxbitsize;
+  in.bitrate = 0;
+  in.frametype = 3;
+  out.pBuffer = buf_out;
+  out.pcmType.bitPerSample = 0;
+  out.pcmType.sample_frequency = 0;
+
+  USC_CODEC_Fxns->std.Reinit(&((USC_Option*)pInfo.params)->modes, decoder);
+
+  while(p < f) {
+    in.pBuffer = p;
+    USC_CODEC_Fxns->std.Decode (decoder, &in, &out);
+    fwrite(out.pBuffer, outFrameSize, 1, f_out);
+
+    p += inFrameSize;
+  }
+  
+  fclose(f_out);
+  fclose(f_in);
+
+}
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/my_enc.c ./G729-float/samples/my_enc.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/my_enc.c	1970-01-01 01:00:00.000000000 +0100
+++ ./G729-float/samples/my_enc.c	2005-09-03 22:13:08.000000000 +0100
@@ -0,0 +1,100 @@
+
+#include <stdio.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include "usc.h"
+#include <ippcore.h>
+#include <ipps.h>
+#include <ippsc.h>
+#include "encoder.h"
+
+
+int main(int argc, char *argv[]) {
+
+  char *buf_in;
+  char *bitstream_buf;
+  char *p;
+  char *f;
+  long file_size;
+  int i;
+
+  if(argc != 3) {
+    fprintf(stderr, "Usage: my_enc audio.raw audio.g729\n");
+    exit(-1);
+  }
+  
+  fprintf(stderr, "Converting %s to %s\n", argv[1], argv[2]);
+
+  USC_Fxns *USC_CODEC_Fxns;
+  USC_CodecInfo pInfo;
+  USC_Handle encoder;
+
+  USC_PCMStream in;
+  USC_Bitstream out;
+  USC_MemBank* pBanks;
+
+  int nbanks = 0;
+  int maxbitsize;
+  int inFrameSize;
+  int outFrameSize = 0;
+
+  USC_CODEC_Fxns = USC_GetCodecByName_xx2 ();
+  USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &pInfo); /* codec info */
+  ((USC_Option*)pInfo.params)->modes.truncate = 1;
+  ((USC_Option*)pInfo.params)->direction = 0;
+  ((USC_Option*)pInfo.params)->modes.vad = 0;
+
+  FILE *f_in = fopen(argv[1], "r");
+  FILE *f_out = fopen(argv[2], "w");
+
+  fseek(f_in, 0, SEEK_END);
+  file_size = ftell(f_in);
+  fseek(f_in, 0, SEEK_SET);
+
+  buf_in = ippsMalloc_8s(file_size);
+  fread(buf_in, file_size, 1, f_in);
+  p = buf_in;
+  f = buf_in + file_size;
+
+  USC_CODEC_Fxns->std.NumAlloc(pInfo.params, &nbanks);
+  pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*nbanks);
+  USC_CODEC_Fxns->std.MemAlloc(pInfo.params, pBanks);
+  for(i=0; i<nbanks;i++) {
+    if(!(pBanks[i].pMem = ippsMalloc_8u(pBanks->nbytes))) {
+      printf("\nLow memory: %d bytes not allocated\n",pBanks->nbytes);
+      return -1;
+    }
+  }
+
+  inFrameSize = getInFrameSize();
+  outFrameSize = getOutFrameSize_xx3();
+
+  bitstream_buf = ippsMalloc_8s(pInfo.maxbitsize);
+
+  in.bitrate = pInfo.params->modes.bitrate;
+  maxbitsize = pInfo.maxbitsize;
+  USC_CODEC_Fxns->std.Init(pInfo.params, pBanks, &encoder);
+
+  ippCoreSetFlushToZero( 1, NULL );
+  in.pcmType.bitPerSample = pInfo.pcmType->bitPerSample;
+  in.pcmType.sample_frequency = pInfo.pcmType->sample_frequency;
+  out.nbytes  = maxbitsize;
+  out.pBuffer = bitstream_buf;
+
+  USC_CODEC_Fxns->std.Reinit(&((USC_Option*)pInfo.params)->modes, encoder);
+
+  while(p < f) {
+    in.pBuffer = p;
+    USC_CODEC_Fxns->std.Encode (encoder, &in, &out);
+    fwrite(out.pBuffer, 10, 1, f_out);
+    p += inFrameSize; 
+  }
+
+  fclose(f_out);
+  fclose(f_in);
+
+  return 0;
+}
+
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/slin_g729_ex.h ./G729-float/samples/slin_g729_ex.h
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/slin_g729_ex.h	1970-01-01 01:00:00.000000000 +0100
+++ ./G729-float/samples/slin_g729_ex.h	2005-05-05 14:01:04.000000000 +0100
@@ -0,0 +1,30 @@
+/*
+ * Signed 16 bit audio data
+ *
+ */
+static signed short slin_g729_ex[] = {
+0x0873, 0x06d9, 0x038c, 0x0588, 0x0409, 0x033d, 0x0311, 0xff6c, 0xfeef, 0xfd3e,
+0xfdff, 0xff7a, 0xff6d, 0xffec, 0xff36, 0xfd62, 0xfda7, 0xfc6c, 0xfe67, 0xffe1,
+0x003d, 0x01cc, 0x0065, 0x002a, 0xff83, 0xfed9, 0xffba, 0xfece, 0xff42, 0xff16,
+0xfe85, 0xff31, 0xff02, 0xfdff, 0xfe32, 0xfe3f, 0xfed5, 0xff65, 0xffd4, 0x005b,
+0xff88, 0xff01, 0xfebd, 0xfe95, 0xff46, 0xffe1, 0x00e2, 0x0165, 0x017e, 0x01c9,
+0x0182, 0x0146, 0x00f9, 0x00ab, 0x006f, 0xffe8, 0xffd8, 0xffc4, 0xffb2, 0xfff9,
+0xfffe, 0x0023, 0x0018, 0x000b, 0x001a, 0xfff7, 0x0014, 0x000b, 0x0004, 0x000b,
+0xfff1, 0xff4f, 0xff3f, 0xff42, 0xff5e, 0xffd4, 0x0014, 0x0067, 0x0051, 0x003b,
+0x0034, 0xfff9, 0x000d, 0xff54, 0xff54, 0xff52, 0xff3f, 0xffcc, 0xffe6, 0x00fc,
+0x00fa, 0x00e4, 0x00f3, 0x0021, 0x0011, 0xffa1, 0xffab, 0xffdb, 0xffa5, 0x0009,
+0xffd2, 0xffe6, 0x0007, 0x0096, 0x00e4, 0x00bf, 0x00ce, 0x0048, 0xffe8, 0xffab,
+0xff8f, 0xffc3, 0xffc1, 0xfffc, 0x0002, 0xfff1, 0x000b, 0x00a7, 0x00c5, 0x00cc,
+0x015e, 0x00e4, 0x0094, 0x0029, 0xffc7, 0xffc3, 0xff86, 0xffe4, 0xffe6, 0xffec,
+0x000f, 0xffe3, 0x0028, 0x004b, 0xffaf, 0xffcb, 0xfedd, 0xfef8, 0xfe83, 0xfeba,
+0xff94, 0xff94, 0xffbe, 0xffa8, 0xff0d, 0xff32, 0xff58, 0x0021, 0x0087, 0x00be,
+0x0115, 0x007e, 0x0052, 0xfff0, 0xffc9, 0xffe8, 0xffc4, 0x0014, 0xfff0, 0xfff5,
+0xfffe, 0xffda, 0x000b, 0x0010, 0x006f, 0x006f, 0x0052, 0x0045, 0xffee, 0xffea,
+0xffcb, 0xffdf, 0xfffc, 0xfff0, 0x0012, 0xfff7, 0xfffe, 0x0018, 0x0050, 0x0066,
+0x0047, 0x0028, 0xfff7, 0xffe8, 0xffec, 0x0007, 0x001d, 0x0016, 0x00c4, 0x0093,
+0x007d, 0x0052, 0x00a5, 0x0091, 0x003c, 0x0041, 0xffd1, 0xffda, 0xffc6, 0xfff0,
+0x001d, 0xfffe, 0x0024, 0xffee, 0xfff3, 0xfff0, 0xffea, 0x0012, 0xfff3, 0xfff7,
+0xffda, 0xffca, 0xffda, 0xffdf, 0xfff3, 0xfff7, 0xff54, 0xff7c, 0xff8c, 0xffb9,
+0x0012, 0x0012, 0x004c, 0x0007, 0xff50, 0xff66, 0xff54, 0xffa9, 0xffdc, 0xfff9,
+0x0038, 0xfff9, 0x00d2, 0x0096, 0x008a, 0x0079, 0xfff5, 0x0019, 0xffad, 0xfffc };
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/util_e.c ./G729-float/samples/util_e.c
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/util_e.c	2004-09-01 02:52:08.000000000 +0100
+++ ./G729-float/samples/util_e.c	2005-05-05 14:01:04.000000000 +0100
@@ -26,7 +26,7 @@
 */
 #include "util_e.h"
 
-USC_Fxns* USC_GetCodecByName (void)
+USC_Fxns* USC_GetCodecByName_xx2 (void)
 {
     return &USC_G729FP_Fxns;
 }
@@ -68,7 +68,7 @@
     return 0;
 }
 
-int text2rate(char *strRate, char **rat_buff, int *nRates, USC_CodecInfo *pInfo)
+int text2rate_xx1(char *strRate, char **rat_buff, int *nRates, USC_CodecInfo *pInfo)
 {
      if(!strcmp(strRate,"A")){
         ((USC_Option*)pInfo->params)->modes.bitrate=G729A_CODEC;
@@ -128,7 +128,7 @@
   return(G729_SPEECH_FRAME*sizeof(short));
 }
                     
-int getOutFrameSize(void)
+int getOutFrameSize_xx3(void)
 {
   return(BITSTREAM_FILE_FRAME_SIZE*sizeof(short));
 }
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/util_e.h ./G729-float/samples/util_e.h
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/G729-float/samples/util_e.h	2004-09-01 02:52:08.000000000 +0100
+++ ./G729-float/samples/util_e.h	2005-05-05 14:01:04.000000000 +0100
@@ -85,11 +85,11 @@
 /*
    GetCodecByName() - quest codec functions table by codec name
 */
-USC_Fxns* USC_GetCodecByName(void);
-int text2rate(char *strRate, char **rat_buff, int *nRates, USC_CodecInfo *pInfo);
+USC_Fxns* USC_GetCodecByName_xx2(void);
+int text2rate_xx1(char *strRate, char **rat_buff, int *nRates, USC_CodecInfo *pInfo);
 int checkVad(char *strVad, int *mode);
 int getInFrameSize(void);
-int getOutFrameSize(void);
+int getOutFrameSize_xx3(void);
 int Bits2Ref(USC_PCMStream in, USC_Bitstream out, char *out_buff_cur);
 
 #endif /*UTIL_E_H*/
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/README.Asterisk ./README.Asterisk
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/README.Asterisk	1970-01-01 01:00:00.000000000 +0100
+++ ./README.Asterisk	2005-09-03 22:55:30.000000000 +0100
@@ -0,0 +1,213 @@
+
+Revision 1.6 (2005-09-03)
+- unified G.723.1 and G.729 patches into a single diff, so you can
+  study both more easily
+- fix memory leak - thanks to Rafael for spotting the missing `!' in Intel's
+  code
+- compile the command line encoder and decoder for G.729 such that
+  they produce raw G.729 rather than ITU demonstration bitstreams.
+- add Debian packaging files
+- add runme.sh
+
+Revision 1.5
+- libimf.so and libimf.a notes
+
+Revision 1.4
+- static linking
+- compiler optimizations
+
+Revision 1.3
+- added Intel links
+- fixed patch command
+- added notes about build dependencies
+
+Step 1a
+-------
+Download the code from Intel
+
+cd /tmp
+wget ftp://download.intel.com/software/products/ipp/downloads/samples/l_ipp-sample-speech-coding_p_4.1.008.tgz
+wget ftp://download.intel.com/software/products/ipp/downloads/l_ipp_ia32_itanium_p_4_1_2.tar
+
+Step 1b
+-------
+
+Install Asterisk header files
+
+On Debian, just type
+
+  apt-get build-dep asterisk
+
+Specifically, you need the *.h files that come with Asterisk
+
+Step 2a
+-------
+
+Register with Intel
+
+See http://www.intel.com/software/products/ipp/
+
+a) register on Intel's site under the 'free non-commercial use' section
+b) obtain the license number and a license key file
+c) put the license key file in the place specified by Intel's documentation
+d) run the installer
+
+Step 2b
+-------
+
+Install IPP libraries.
+
+mkdir /tmp/ipp-tmp
+cd /tmp/ipp-tmp
+tar xf /tmp/l_ipp_ia32_itanium_p_4_1_2.tar
+
+Follow Intel's instructions to install IPP.  If using Debian, the Intel
+installed will stop half way, leaving a .rpm file sitting in a subdirectory
+of /tmp.  You can install the .rpm file using `alien' and then proceed.
+
+Intel's instructions and licensing information (including Open Source
+version information) are at http://www.intel.com/software/products/ipp/
+
+Once you've installed IPP and agreed to the license terms, you may need to
+copy the libraries from one PC to another (eg, from your development machine
+to a production server).  You just need to copy the contents of the following
+directory:
+
+/opt/intel/ipp41/ia32_itanium/sharedlib/
+
+without re-running the install process.
+
+If you use static linking, you DON'T need to copy the libraries onto
+every computer where you run the codec.  You only need the libraries
+on the computer where you compile the codec.
+
+Step 3
+------
+
+Install IPP sample code
+
+cd /usr/local/src
+tar xzf /tmp/l_ipp-sample-speech-coding_p_4.1.008.tgz
+
+Step 4
+------
+
+Apply my patch
+
+cd intel1/ipp_sample/speech-coding/
+patch -p1 < /tmp/ipp-060903.diff
+
+Step 4a
+-------
+
+Select compiler optimizations
+
+vi G729-float/Makefile
+vi G723.1/Makefile
+
+Step 5a
+-------
+
+If you have icc 8.0 libimf, move intel_cc_80/lib/libimf.so to 
+somewhere out of the way.  This will allow you to link libimf.a
+statically with codec_g729.so
+
+Step 5b
+-------
+
+**************************************
+* New:                               *
+* If NOT using Debian:               *
+*   chmod a+x runme.sh               *
+*   ./runme.sh                       *
+* or                                 *
+*   chmod a+x runme.sh               *
+*   ./runme.sh install               *
+*                                    *
+* If you are using Debian:           *
+*                                    *
+*  chmod a+x runme.sh debian/rules   *
+*  dpkg-buildpackage -rfakeroot      *
+**************************************
+
+Step 6
+------
+
+Deploy
+
+cp codec_g72*.so /usr/lib/asterisk/modules   
+   (the target location depends on your system)
+
+or just do ./runme.sh install
+
+or if using Debian, dpkg -i ../asterisk-ipp-codecs_1.0-1_i386.deb
+
+If you haven't used static linking (now the default),
+modify /etc/init.d/asterisk:
+
+export LD_LIBRARY_PATH=/opt/intel/ipp41/ia32_itanium/sharedlib:/opt/intel/ipp41/ia32_itanium/sharedlib/linux32:$LD_LIBRARY_PATH
+
+You may need to insert the following into your 
+sip.conf, iax.conf, h323.conf, etc:
+
+allow=g729
+
+Now restart Asterisk
+
+/etc/init.d/asterisk restart
+
+Step 7
+------
+
+Verify install
+
+At the shell prompt:
+# asterisk -r
+
+At the Asterisk prompt:
+>show translation
+
+If the G.723.1 and G.729 columns have -'s instead of numbers, then 
+the codecs are not working properly.
+
+============================
+COMMAND LINE ENCODER/DECODER
+============================
+
+G.729 only at present
+
+Do you want to record greetings and IVR messages in G.729 format so
+that your CPU doesn't have to transcode every time a call takes place?
+
+Most likely, yes, you do want this.
+
+Now you can.  The original Intel command line encoder and decoder utilities
+(g729fpencoder and g729fpdecoder) work with bitstream files in a
+special format used by the ITU test suite.  This is not the same format
+that Asterisk expects when reading/writing raw G.729.
+
+The utilities `my_enc' and `my_dec' have been designed to work
+with the raw format.  Files generated by `my_enc' can be read by Asterisk
+without any transcoding.
+
+Usage:
+
+	my_enc audio.raw audio.g729
+
+	my_dec audio.g729 audio.raw
+
+Where:
+	audio.raw must be 
+		- 16 bit signed linear audio, 
+		- mono, 
+		- 8000Hz sample rate
+
+To convert a WAV file into the raw uncompressed audio before feeding it
+to `my_enc', you would use the `sox' utility (available on all Unix systems):
+
+	sox audio.wav -t raw -r 8000 -s -w -c 1 audio.raw
+
+To convert a GSM file (such as those distributed with Asterisk), do:
+
+	sox audio.gsm -t raw -r 8000 -s -w -c 1 audio.raw
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/asterisk-ipp-codecs.dirs ./debian/asterisk-ipp-codecs.dirs
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/asterisk-ipp-codecs.dirs	1970-01-01 01:00:00.000000000 +0100
+++ ./debian/asterisk-ipp-codecs.dirs	2005-05-05 14:15:25.000000000 +0100
@@ -0,0 +1 @@
+usr/lib/asterisk/modules
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/asterisk-ipp-codecs.install ./debian/asterisk-ipp-codecs.install
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/asterisk-ipp-codecs.install	1970-01-01 01:00:00.000000000 +0100
+++ ./debian/asterisk-ipp-codecs.install	2005-05-05 14:15:45.000000000 +0100
@@ -0,0 +1 @@
+usr/lib/asterisk/modules
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/changelog ./debian/changelog
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/changelog	1970-01-01 01:00:00.000000000 +0100
+++ ./debian/changelog	2005-05-05 14:17:47.000000000 +0100
@@ -0,0 +1,6 @@
+asterisk-ipp-codecs (1.0-1) stable; urgency=low
+
+  * Initial Debian release.
+
+ -- Daniel Pocock <daniel@pocock.com.au>  Thu, 05 May 2005 14:00:00 +0100
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/control ./debian/control
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/control	1970-01-01 01:00:00.000000000 +0100
+++ ./debian/control	2005-05-05 14:21:26.000000000 +0100
@@ -0,0 +1,15 @@
+Source: asterisk-ipp-codecs
+Section: admin
+Priority: extra
+Maintainer: Daniel Pocock <daniel@pocock.com.au>
+Build-Depends: debhelper (>> 4.0.0), asterisk-dev
+
+Package: asterisk-ipp-codecs
+Architecture: i386
+Depends: asterisk
+Description: G.723.1 and G.729 modules for Asterisk
+ asterisk-ipp-codecs provides the G.723.1 and G.729 modules for Asterisk
+ in a binary format.  These codecs are patented and in most countries
+ you will need a license to use them legally.  Please see
+ http://www.readytechnology.co.uk/open/g729 for more details
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/rules ./debian/rules
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/debian/rules	1970-01-01 01:00:00.000000000 +0100
+++ ./debian/rules	2005-05-06 00:28:51.000000000 +0100
@@ -0,0 +1,83 @@
+#!/usr/bin/make -f
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+export DH_COMPAT=4
+
+CFLAGS = -Wall -g
+                                                                                
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+build:	build-stamp
+
+build-stamp:
+	dh_testdir
+	#$(MAKE)
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+
+	# Add here commands to clean up after the build process.
+#	-$(MAKE) clean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/tmp.
+	#$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+	$(CURDIR)/runme.sh install $(CURDIR)/debian/tmp
+
+	dh_install --sourcedir=debian/tmp
+
+binary-indep:	build install
+
+binary-arch:	build install
+	dh_testdir
+	dh_testroot
+#	dh_installdebconf
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+#	dh_installlogrotate
+#       dh_installemacsen
+#       dh_installpam
+#       dh_installmime
+#	dh_installinit --no-restart-on-upgrade --init-script=eqld -- start 05 1 2 3 4 5 . stop 95 0 6 .
+#	dh_installcron
+#	dh_installman
+#	dh_installinfo
+#       dh_undocumented
+#	dh_installchangelogs ChangeLog
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#       dh_makeshlibs
+	dh_installdeb
+#       dh_perl
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary:	binary-indep binary-arch
+.PHONY:	build clean binary-indep binary-arch binary install
+
diff -Nur /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/runme.sh ./runme.sh
--- /home/daniel/src/ipp-codecs/ipp_sample.original/speech-coding/runme.sh	1970-01-01 01:00:00.000000000 +0100
+++ ./runme.sh	2005-09-03 22:53:37.000000000 +0100
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# This script will build each of the Asterisk codecs for you
+
+# It also builds the modified command line utilities for encoding/decoding
+# raw G729 files
+
+ASTERISK_MODULES_DIR=/usr/lib/asterisk/modules
+
+SRC_DIR=`pwd`/${SRC_DIR}
+
+cd "${SRC_DIR}/G729-float"
+./build.sh
+
+cd "${SRC_DIR}/G723.1"
+./build.sh
+
+cd "${SRC_DIR}"
+
+echo ""
+echo "Unless you have manually edited the file G729-float/Makefile and"
+echo "G723.1/Makefile, the codecs are optimized for Pentium II"
+echo ""
+echo "This code will not run on Pentium I or lower"
+echo ""
+echo "If you have a more powerful processor than Pentium II, you are"
+echo "strongly encouraged to edit the Makefiles and select the "
+echo "optimizations for your processors.  This can give a performance"
+echo "boost of up to 30%"
+echo ""
+echo "To use the codecs, just copy codec_g729.so and codec_g723.so to"
+echo "your Asterisk modules directory, usually /usr/lib/asterisk/modules"
+echo "and restart Asterisk.  The Asterisk command \`show translation'"
+echo "will show you whether the modules loaded successfully."
+echo ""
+
+mv "${SRC_DIR}/G729-float/bin/codec_g729.so" "${SRC_DIR}"
+mv "${SRC_DIR}/G723.1/bin/codec_g723.so" "${SRC_DIR}"
+
+if [ "X${1}" == "Xinstall" ];
+then
+  DEST_DIR="${2}"
+  install -d "${DEST_DIR}${ASTERISK_MODULES_DIR}/"
+  install "${SRC_DIR}/codec_g729.so" "${DEST_DIR}${ASTERISK_MODULES_DIR}/"
+  install "${SRC_DIR}/codec_g723.so" "${DEST_DIR}${ASTERISK_MODULES_DIR}/"
+
+fi
