diff options
author | (no author) <(no author)@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-13 04:46:23 +0000 |
---|---|---|
committer | (no author) <(no author)@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-13 04:46:23 +0000 |
commit | d46468f42c6762ce7646e773c7d0919ed1f626d4 (patch) | |
tree | 5d62a34385385b3485137835b2629174ca0464cf /codecs | |
parent | f38bc8131c9eda8d0b0eabaafbaa53f4247989c4 (diff) |
This commit was manufactured by cvs2svn to create tag 'v0_9_0'.
git-svn-id: http://svn.digium.com/svn/asterisk/tags/v0_9_0@2684 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs')
-rwxr-xr-x | codecs/codec_adpcm.c | 44 | ||||
-rwxr-xr-x | codecs/gsm/Makefile | 6 | ||||
-rwxr-xr-x | codecs/lpc10/Makefile | 4 |
3 files changed, 24 insertions, 30 deletions
diff --git a/codecs/codec_adpcm.c b/codecs/codec_adpcm.c index 28e4a2794..6ca656a23 100755 --- a/codecs/codec_adpcm.c +++ b/codecs/codec_adpcm.c @@ -27,7 +27,6 @@ #include <unistd.h> #define BUFFER_SIZE 8096 /* size for the translation buffers */ -#define BUF_SHIFT 5 static ast_mutex_t localuser_lock = AST_MUTEX_INITIALIZER; static int localusecnt = 0; @@ -105,6 +104,8 @@ decode (unsigned char encoded, short *ssindex, short *signal, unsigned char *rke *signal = -2047; *next = 0; + +#ifdef AUTO_RETURN if( encoded & 0x7 ) *rkey = 0; else if ( ++(*rkey) == 24 ) { @@ -114,6 +115,7 @@ decode (unsigned char encoded, short *ssindex, short *signal, unsigned char *rke else if (*signal < 0) *next = 0x2; } +#endif *ssindex = *ssindex + indsft[(encoded & 7)]; if (*ssindex < 0) @@ -200,6 +202,10 @@ struct adpcm_decoder_pvt struct ast_frame f; char offset[AST_FRIENDLY_OFFSET]; /* Space to build offset */ short outbuf[BUFFER_SIZE]; /* Decoded signed linear values */ + short ssindex; + short signal; + unsigned char zero_count; + unsigned char next_flag; int tail; }; @@ -272,41 +278,21 @@ adpcmtolin_framein (struct ast_translator_pvt *pvt, struct ast_frame *f) { struct adpcm_decoder_pvt *tmp = (struct adpcm_decoder_pvt *) pvt; int x; - short signal; - short ssindex; unsigned char *b; - unsigned char zero_count; - unsigned char next_flag; - if (f->datalen < BUF_SHIFT) { - ast_log(LOG_WARNING, "Didn't have at least %d bytes of input\n", BUF_SHIFT); - return -1; - } - - if ((f->datalen - BUF_SHIFT) * 4 > sizeof(tmp->outbuf)) { + if (f->datalen * 4 > sizeof(tmp->outbuf)) { ast_log(LOG_WARNING, "Out of buffer space\n"); return -1; } - /* Reset ssindex and signal to frame's specified values */ b = f->data; - ssindex = b[0]; - if (ssindex < 0) - ssindex = 0; - if (ssindex > 48) - ssindex = 48; - - signal = (b[1] << 8) | b[2]; - - zero_count = b[3]; - next_flag = b[4]; - for (x=BUF_SHIFT;x<f->datalen;x++) { - decode((b[x] >> 4) & 0xf, &ssindex, &signal, &zero_count, &next_flag); - tmp->outbuf[tmp->tail++] = signal << 4; + for (x=0;x<f->datalen;x++) { + decode((b[x] >> 4) & 0xf, &tmp->ssindex, &tmp->signal, &tmp->zero_count, &tmp->next_flag); + tmp->outbuf[tmp->tail++] = tmp->signal << 4; - decode(b[x] & 0x0f, &ssindex, &signal, &zero_count, &next_flag); - tmp->outbuf[tmp->tail++] = signal << 4; + decode(b[x] & 0x0f, &tmp->ssindex, &tmp->signal, &tmp->zero_count, &tmp->next_flag); + tmp->outbuf[tmp->tail++] = tmp->signal << 4; } return 0; @@ -408,7 +394,7 @@ lintoadpcm_frameout (struct ast_translator_pvt *pvt) adpcm0 = adpcm (tmp->inbuf[i], &tmp->ssindex, &tmp->signal, &tmp->zero_count, &tmp->next_flag); adpcm1 = adpcm (tmp->inbuf[i+1], &tmp->ssindex, &tmp->signal, &tmp->zero_count, &tmp->next_flag); - tmp->outbuf[i/2 + BUF_SHIFT] = (adpcm0 << 4) | adpcm1; + tmp->outbuf[i/2] = (adpcm0 << 4) | adpcm1; }; @@ -419,7 +405,7 @@ lintoadpcm_frameout (struct ast_translator_pvt *pvt) tmp->f.offset = AST_FRIENDLY_OFFSET; tmp->f.src = __PRETTY_FUNCTION__; tmp->f.data = tmp->outbuf; - tmp->f.datalen = i_max / 2 + BUF_SHIFT; + tmp->f.datalen = i_max / 2; /* * If there is a signal left over (there should be no more than diff --git a/codecs/gsm/Makefile b/codecs/gsm/Makefile index 747de59e4..effdbcbac 100755 --- a/codecs/gsm/Makefile +++ b/codecs/gsm/Makefile @@ -40,10 +40,12 @@ WAV49 = -DWAV49 ifneq (${OSARCH},Darwin) ifneq (${PROC},x86_64) ifneq ($(shell uname -m),ppc) +ifneq ($(shell uname -m),alpha) OPTIMIZE+=-march=$(PROC) endif endif endif +endif PG = #PG = -g -pg @@ -200,10 +202,12 @@ GSM_SOURCES = $(SRC)/add.c \ ifeq (${OSARCH},Linux) ifneq (${PROC},x86_64) ifneq ($(shell uname -m),ppc) +ifneq ($(shell uname -m),alpha) GSM_SOURCES+= $(SRC)/k6opt.s endif endif endif +endif TOAST_SOURCES = $(SRC)/toast.c \ $(SRC)/toast_lin.c \ @@ -251,10 +255,12 @@ GSM_OBJECTS = $(SRC)/add.o \ ifeq (${OSARCH},Linux) ifneq (${PROC},x86_64) ifneq ($(shell uname -m), ppc) +ifneq ($(shell uname -m), alpha) GSM_OBJECTS+= $(SRC)/k6opt.o endif endif endif +endif TOAST_OBJECTS = $(SRC)/toast.o \ $(SRC)/toast_lin.o \ diff --git a/codecs/lpc10/Makefile b/codecs/lpc10/Makefile index e9dbd9d02..af8d907f6 100755 --- a/codecs/lpc10/Makefile +++ b/codecs/lpc10/Makefile @@ -25,14 +25,16 @@ WARNINGS = -Wall -Wno-comment -Wno-error CFLAGS = $(OPTIMIZE) -I$(LIB_TARGET_DIR) $(WARNINGS) -fPIC #CFLAGS+= $(shell if uname -m | grep -q 86; then echo "-mpentium" ; fi) -#fix for PPC processors +#fix for PPC processors and ALPHA too ifneq ($(OSARCH),Darwin) ifneq ($(PROC),ppc) ifneq ($(PROC),x86_64) +ifneq ($(PROC),alpha) CFLAGS+= -march=$(PROC) endif endif endif +endif LIB = $(LIB_TARGET_DIR)/liblpc10.a |