diff options
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm/COPYRIGHT | 16 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm/ChangeLog | 92 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm/code.c | 14 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm/config.h | 50 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm/gsm.h.orig | 71 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm/gsm_implode.c | 654 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm/private.h | 1 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm/proto.h | 10 |
8 files changed, 467 insertions, 441 deletions
diff --git a/pjmedia/src/pjmedia-codec/gsm/COPYRIGHT b/pjmedia/src/pjmedia-codec/gsm/COPYRIGHT new file mode 100644 index 00000000..eba0e523 --- /dev/null +++ b/pjmedia/src/pjmedia-codec/gsm/COPYRIGHT @@ -0,0 +1,16 @@ +Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, +Technische Universitaet Berlin + +Any use of this software is permitted provided that this notice is not +removed and that neither the authors nor the Technische Universitaet Berlin +are deemed to have made any representations as to the suitability of this +software for any purpose nor are held responsible for any defects of +this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + +As a matter of courtesy, the authors request to be informed about uses +this software has found, about bugs in this software, and about any +improvements that may be of general interest. + +Berlin, 28.11.1994 +Jutta Degener +Carsten Bormann diff --git a/pjmedia/src/pjmedia-codec/gsm/ChangeLog b/pjmedia/src/pjmedia-codec/gsm/ChangeLog new file mode 100644 index 00000000..248ba263 --- /dev/null +++ b/pjmedia/src/pjmedia-codec/gsm/ChangeLog @@ -0,0 +1,92 @@ + +Fri Jun 2 06:27:56 2006 Jutta Degener (jutta@pobox.com) + + * Release 1.0 Patchlevel 12 + src/code.c: removed modifiable static storage that made the library + non-reentrant. (Thanks to Paul Gibbs for pointing out the bug.) + +Sat Mar 18 11:48:28 2006 Jutta Degener (jutta@pobox.com) + + * Release 1.0 Patchlevel 11 + src/gsm_implode.c: fix WAV49 implode + move source archive location + +Fri Jul 5 19:26:37 1996 Jutta Degener (jutta@cs.tu-berlin.de) + + * Release 1.0 Patchlevel 10 + src/toast_alaw.c: exchanged A-law tables for something + slightly more A-law. + +Tue Jul 2 12:18:20 1996 Jutta Degener (jutta@cs.tu-berlin.de) + + * Release 1.0 Patchlevel 9 + src/long_term.c: in FLOAT_MUL mode, an array was accessed past its end + src/gsm_option.c: three options related to WAV #49 packing + src/gsm_encode.c: support WAV #49-style encoding. + src/gsm_decode.c: support WAV #49-style decoding. + tls/sour.c: generate the WAV bit shifting code, encode + tls/ginger.c: generate the WAV bit shifting code, decode + The WAV code goes back to an inofficial patch #8 that + Jeff Chilton sent us (hence the jump from 7 to 9). + src/toast.c: add _fsetmode() calls to set stdin/stdout to + binary (from an OS/2 port by Arnd Gronenberg.) + +Tue Mar 7 01:55:10 1995 Jutta Degener (jutta@cs.tu-berlin.de) + + * Release 1.0 Patchlevel 7 + src/long_term.c: Yet another 16-bit overflow + src/toast.c: -C option to toast, cuts LPC time + src/gsm_option.c: corresponding LPC_CUT option to GSM library + +Fri Dec 30 23:33:50 1994 Jutta Degener (jutta@cs.tu-berlin.de) + + * Release 1.0 Patchlevel 6 + src/lpc.c: fixed 16-bit addition overflow in Autocorrelation code + src/add.c: gsm_L_asl should fall back on gsm_L_asr, not gsm_asr + +Mon Nov 28 20:49:57 1994 Jutta Degener (jutta@cs.tu-berlin.de) + + * Release 1.0 Patchlevel 5 + src/toast_audio.c: initialization should return -1 on error + src/gsm_destroy.c: #include configuration header file + src/add.c: gsm_sub should cast its parameters to longword + man/*: bug reports to {jutta,cabo}@cs.tu-berlin.de, not to toast@tub + inc/private.h: longword long by default, not int + inc/toast.h: read/write fopen modes "rb" and "wb", not just "r" + src/toast.c: better (or different, anyway) error handling in process() + +Tue May 10 19:41:34 1994 Jutta Degener (jutta at kugelbus) + + * Release 1.0 Patchlevel 4 + inc/private.h: GSM_ADD should cast to ulongword, not to unsigned. + src/long_term.c: missing cast to longword. + add-test/add_test.c: Test macros too, not only functions, + thanks to Simao Ferraz de Campos Neto, simao@dragon.cpqd.ansp.br + General cleanup: remove unused variables, add function prototypes. + +Tue Jan 25 22:53:40 1994 Jutta Degener (jutta at kugelbus) + + * Release 1.0 Patchlevel 3 + changed rpe.c's STEP macro to work with 16-bit integers, + thanks to Dr Alex Lee (alexlee@solomon.technet.sg); + removed non-fatal bugs from add-test.dta, private.h + and toast_audio.c, thanks to P. Emanuelsson. + +Fri Jan 29 19:02:12 1993 Jutta Degener (jutta at kraftbus) + + * Release 1.0 Patchlevel 2 + fixed L_add(0,-1) in src/add.c and inc/private.h, + thanks to Raphael Trommer at AT&T Bell Laboratories; + various other ANSI C compatibility details + +Fri Oct 30 17:58:54 1992 Jutta Degener (jutta at kraftbus) + + * Release 1.0 Patchlevel 1 + Switched uid/gid in toast's [f]chown calls. + +Wed Oct 28 14:12:35 1992 Carsten Bormann (cabo at kubus) + + * Release 1.0: released + Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + Universitaet Berlin. See the accompanying file "COPYRIGHT" for + details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. diff --git a/pjmedia/src/pjmedia-codec/gsm/code.c b/pjmedia/src/pjmedia-codec/gsm/code.c index cc5a9b8b..65dd0a33 100644 --- a/pjmedia/src/pjmedia-codec/gsm/code.c +++ b/pjmedia/src/pjmedia-codec/gsm/code.c @@ -15,10 +15,6 @@ # include "proto.h" extern char * memcpy P((char *, char *, int)); #endif -
-#ifdef HAS_STRING_H
-#include <string.h>
-#endif
#include "private.h" #include "gsm.h" @@ -63,8 +59,6 @@ void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc), word * dp = S->dp0 + 120; /* [ -120...-1 ] */ word * dpp = dp; /* [ 0...39 ] */ - static word e[50]; - word so[160]; Gsm_Preprocess (S, s, so); @@ -76,23 +70,23 @@ void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc), Gsm_Long_Term_Predictor ( S, so+k*40, /* d [0..39] IN */ dp, /* dp [-120..-1] IN */ - e + 5, /* e [0..39] OUT */ + S->e + 5, /* e [0..39] OUT */ dpp, /* dpp [0..39] OUT */ Nc++, bc++); Gsm_RPE_Encoding ( S, - e + 5, /* e ][0..39][ IN/OUT */ + S->e + 5,/* e ][0..39][ IN/OUT */ xmaxc++, Mc++, xMc ); /* * Gsm_Update_of_reconstructed_short_time_residual_signal - * ( dpp, e + 5, dp ); + * ( dpp, S->e + 5, dp ); */ { register int i; register longword ltmp; for (i = 0; i <= 39; i++) - dp[ i ] = GSM_ADD( e[5 + i], dpp[i] ); + dp[ i ] = GSM_ADD( S->e[5 + i], dpp[i] ); } dp += 40; dpp += 40; diff --git a/pjmedia/src/pjmedia-codec/gsm/config.h b/pjmedia/src/pjmedia-codec/gsm/config.h index 2603c42c..dfb1eadb 100644 --- a/pjmedia/src/pjmedia-codec/gsm/config.h +++ b/pjmedia/src/pjmedia-codec/gsm/config.h @@ -9,31 +9,29 @@ #ifndef CONFIG_H #define CONFIG_H -//#define SIGHANDLER_T int // * signal handlers are void */ -//#define HAS_SYSV_SIGNAL 1 // * sigs not blocked/reset? */ - -#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */ -//#define HAS_LIMITS_H 1 // * /usr/include/limits.h */ -#define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */ -//#define HAS_ERRNO_DECL 1 // * errno.h declares errno */ - -#define HAS_FSTAT 1 /* fstat syscall */ -#define HAS_FCHMOD 1 /* fchmod syscall */ -#define HAS_CHMOD 1 /* chmod syscall */ -#define HAS_FCHOWN 1 /* fchown syscall */ -#define HAS_CHOWN 1 /* chown syscall */ -//#define HAS__FSETMODE 1 // * _fsetmode -- set file mode */ - -#define HAS_STRING_H 1 /* /usr/include/string.h */ -//#define HAS_STRINGS_H 1 // * /usr/include/strings.h */ - -#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */ -#define HAS_UTIME 1 /* POSIX utime(path, times) */ -//#define HAS_UTIMES 1 // * use utimes() syscall instead*/ -#define HAS_UTIME_H 1 /* UTIME header file */ -//#define HAS_UTIMBUF 1 // * struct utimbuf */ -//#define HAS_UTIMEUSEC 1 // * microseconds in utimbuf? */ - +/*efine SIGHANDLER_T int /* signal handlers are void */ +/*efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */ + +#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */ +#define HAS_LIMITS_H 1 /* /usr/include/limits.h */ +#define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */ +#define HAS_ERRNO_DECL 1 /* errno.h declares errno */ + +#define HAS_FSTAT 1 /* fstat syscall */ +#define HAS_FCHMOD 1 /* fchmod syscall */ +#define HAS_CHMOD 1 /* chmod syscall */ +#define HAS_FCHOWN 1 /* fchown syscall */ +#define HAS_CHOWN 1 /* chown syscall */ +/*efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */ + +#define HAS_STRING_H 1 /* /usr/include/string.h */ +/*efine HAS_STRINGS_H 1 /* /usr/include/strings.h */ + +#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */ +#define HAS_UTIME 1 /* POSIX utime(path, times) */ +/*efine HAS_UTIMES 1 /* use utimes() syscall instead */ +#define HAS_UTIME_H 1 /* UTIME header file */ +#define HAS_UTIMBUF 1 /* struct utimbuf */ +/*efine HAS_UTIMEUSEC 1 /* microseconds in utimbuf? */ #endif /* CONFIG_H */ - diff --git a/pjmedia/src/pjmedia-codec/gsm/gsm.h.orig b/pjmedia/src/pjmedia-codec/gsm/gsm.h.orig deleted file mode 100644 index bfb96e9f..00000000 --- a/pjmedia/src/pjmedia-codec/gsm/gsm.h.orig +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm.h,v 1.10 1996/07/02 10:15:22 jutta Exp $*/ - -#ifndef GSM_H -#define GSM_H - -#ifdef __cplusplus -# define NeedFunctionPrototypes 1 -#endif - -#if __STDC__ -# define NeedFunctionPrototypes 1 -#endif - -#ifdef _NO_PROTO -# undef NeedFunctionPrototypes -#endif - -#ifdef NeedFunctionPrototypes -# include <stdio.h> /* for FILE * */ -#endif - -#undef GSM_P -#if NeedFunctionPrototypes -# define GSM_P( protos ) protos -#else -# define GSM_P( protos ) ( /* protos */ ) -#endif - -/* - * Interface - */ - -typedef struct gsm_state * gsm; -typedef short gsm_signal; /* signed 16 bit */ -typedef unsigned char gsm_byte; -typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */ - -#define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */ - -#define GSM_PATCHLEVEL 9 -#define GSM_MINOR 0 -#define GSM_MAJOR 1 - -#define GSM_OPT_VERBOSE 1 -#define GSM_OPT_FAST 2 -#define GSM_OPT_LTP_CUT 3 -#define GSM_OPT_WAV49 4 -#define GSM_OPT_FRAME_INDEX 5 -#define GSM_OPT_FRAME_CHAIN 6 - -extern gsm gsm_create GSM_P((void)); -extern void gsm_destroy GSM_P((gsm)); - -extern int gsm_print GSM_P((FILE *, gsm, gsm_byte *)); -extern int gsm_option GSM_P((gsm, int, int *)); - -extern void gsm_encode GSM_P((gsm, gsm_signal *, gsm_byte *)); -extern int gsm_decode GSM_P((gsm, gsm_byte *, gsm_signal *)); - -extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *)); -extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *)); - -#undef GSM_P - -#endif /* GSM_H */ diff --git a/pjmedia/src/pjmedia-codec/gsm/gsm_implode.c b/pjmedia/src/pjmedia-codec/gsm/gsm_implode.c index 39b79cbd..6c5672b8 100644 --- a/pjmedia/src/pjmedia-codec/gsm/gsm_implode.c +++ b/pjmedia/src/pjmedia-codec/gsm/gsm_implode.c @@ -116,400 +116,406 @@ void gsm_implode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c) if (s->wav_fmt) { uword sr = 0; - if (s->frame_index == 0) { - - sr = *c++; - LARc[0] = sr & 0x3f; sr >>= 6; - sr |= (uword)*c++ << 2; - LARc[1] = sr & 0x3f; sr >>= 6; - sr |= (uword)*c++ << 4; - LARc[2] = sr & 0x1f; sr >>= 5; - LARc[3] = sr & 0x1f; sr >>= 5; - sr |= (uword)*c++ << 2; - LARc[4] = sr & 0xf; sr >>= 4; - LARc[5] = sr & 0xf; sr >>= 4; - sr |= (uword)*c++ << 2; /* 5 */ - LARc[6] = sr & 0x7; sr >>= 3; - LARc[7] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[0] = sr & 0x7f; sr >>= 7; - bc[0] = sr & 0x3; sr >>= 2; - Mc[0] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[0] = sr & 0x3f; sr >>= 6; -#undef xmc + if (s->frame_index) { + sr = sr >> 6 | LARc[0] << 10; + sr = sr >> 6 | LARc[1] << 10; + *c++ = sr >> 4; + sr = sr >> 5 | LARc[2] << 11; + *c++ = sr >> 7; + sr = sr >> 5 | LARc[3] << 11; + sr = sr >> 4 | LARc[4] << 12; + *c++ = sr >> 6; + sr = sr >> 4 | LARc[5] << 12; + sr = sr >> 3 | LARc[6] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | LARc[7] << 13; + sr = sr >> 7 | Nc[0] << 9; + *c++ = sr >> 5; + sr = sr >> 2 | bc[0] << 14; + sr = sr >> 2 | Mc[0] << 14; + sr = sr >> 6 | xmaxc[0] << 10; + *c++ = sr >> 3; +#undef xmc #define xmc (source + 12) - xmc[0] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[1] = sr & 0x7; sr >>= 3; - xmc[2] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[3] = sr & 0x7; sr >>= 3; - xmc[4] = sr & 0x7; sr >>= 3; - xmc[5] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 10 */ - xmc[6] = sr & 0x7; sr >>= 3; - xmc[7] = sr & 0x7; sr >>= 3; - xmc[8] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[9] = sr & 0x7; sr >>= 3; - xmc[10] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[11] = sr & 0x7; sr >>= 3; - xmc[12] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[1] = sr & 0x7f; sr >>= 7; - bc[1] = sr & 0x3; sr >>= 2; - Mc[1] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[1] = sr & 0x3f; sr >>= 6; + + sr = sr >> 3 | xmc[0] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[1] << 13; + sr = sr >> 3 | xmc[2] << 13; + sr = sr >> 3 | xmc[3] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[4] << 13; + sr = sr >> 3 | xmc[5] << 13; + sr = sr >> 3 | xmc[6] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[7] << 13; + sr = sr >> 3 | xmc[8] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[9] << 13; + sr = sr >> 3 | xmc[10] << 13; + sr = sr >> 3 | xmc[11] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[12] << 13; + sr = sr >> 7 | Nc[1] << 9; + *c++ = sr >> 5; + sr = sr >> 2 | bc[1] << 14; + sr = sr >> 2 | Mc[1] << 14; + sr = sr >> 6 | xmaxc[1] << 10; + *c++ = sr >> 3; #undef xmc #define xmc (source + 29 - 13) - xmc[13] = sr & 0x7; sr >>= 3; - sr = *c++; /* 15 */ - xmc[14] = sr & 0x7; sr >>= 3; - xmc[15] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[16] = sr & 0x7; sr >>= 3; - xmc[17] = sr & 0x7; sr >>= 3; - xmc[18] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[19] = sr & 0x7; sr >>= 3; - xmc[20] = sr & 0x7; sr >>= 3; - xmc[21] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[22] = sr & 0x7; sr >>= 3; - xmc[23] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[24] = sr & 0x7; sr >>= 3; - xmc[25] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; /* 20 */ - Nc[2] = sr & 0x7f; sr >>= 7; - bc[2] = sr & 0x3; sr >>= 2; - Mc[2] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[2] = sr & 0x3f; sr >>= 6; + + sr = sr >> 3 | xmc[13] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[14] << 13; + sr = sr >> 3 | xmc[15] << 13; + sr = sr >> 3 | xmc[16] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[17] << 13; + sr = sr >> 3 | xmc[18] << 13; + sr = sr >> 3 | xmc[19] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[20] << 13; + sr = sr >> 3 | xmc[21] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[22] << 13; + sr = sr >> 3 | xmc[23] << 13; + sr = sr >> 3 | xmc[24] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[25] << 13; + sr = sr >> 7 | Nc[2] << 9; + *c++ = sr >> 5; + sr = sr >> 2 | bc[2] << 14; + sr = sr >> 2 | Mc[2] << 14; + sr = sr >> 6 | xmaxc[2] << 10; + *c++ = sr >> 3; #undef xmc #define xmc (source + 46 - 26) - xmc[26] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[27] = sr & 0x7; sr >>= 3; - xmc[28] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[29] = sr & 0x7; sr >>= 3; - xmc[30] = sr & 0x7; sr >>= 3; - xmc[31] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[32] = sr & 0x7; sr >>= 3; - xmc[33] = sr & 0x7; sr >>= 3; - xmc[34] = sr & 0x7; sr >>= 3; - sr = *c++; /* 25 */ - xmc[35] = sr & 0x7; sr >>= 3; - xmc[36] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[37] = sr & 0x7; sr >>= 3; - xmc[38] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[3] = sr & 0x7f; sr >>= 7; - bc[3] = sr & 0x3; sr >>= 2; - Mc[3] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[3] = sr & 0x3f; sr >>= 6; + + sr = sr >> 3 | xmc[26] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[27] << 13; + sr = sr >> 3 | xmc[28] << 13; + sr = sr >> 3 | xmc[29] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[30] << 13; + sr = sr >> 3 | xmc[31] << 13; + sr = sr >> 3 | xmc[32] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[33] << 13; + sr = sr >> 3 | xmc[34] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[35] << 13; + sr = sr >> 3 | xmc[36] << 13; + sr = sr >> 3 | xmc[37] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[38] << 13; + sr = sr >> 7 | Nc[3] << 9; + *c++ = sr >> 5; + sr = sr >> 2 | bc[3] << 14; + sr = sr >> 2 | Mc[3] << 14; + sr = sr >> 6 | xmaxc[3] << 10; + *c++ = sr >> 3; #undef xmc #define xmc (source + 63 - 39) - xmc[39] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[40] = sr & 0x7; sr >>= 3; - xmc[41] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; /* 30 */ - xmc[42] = sr & 0x7; sr >>= 3; - xmc[43] = sr & 0x7; sr >>= 3; - xmc[44] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[45] = sr & 0x7; sr >>= 3; - xmc[46] = sr & 0x7; sr >>= 3; - xmc[47] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[48] = sr & 0x7; sr >>= 3; - xmc[49] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[50] = sr & 0x7; sr >>= 3; - xmc[51] = sr & 0x7; sr >>= 3; - - s->frame_chain = sr & 0xf; + sr = sr >> 3 | xmc[39] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[40] << 13; + sr = sr >> 3 | xmc[41] << 13; + sr = sr >> 3 | xmc[42] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[43] << 13; + sr = sr >> 3 | xmc[44] << 13; + sr = sr >> 3 | xmc[45] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[46] << 13; + sr = sr >> 3 | xmc[47] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[48] << 13; + sr = sr >> 3 | xmc[49] << 13; + sr = sr >> 3 | xmc[50] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[51] << 13; + sr = sr >> 4; + *c = sr >> 8; + s->frame_chain = *c; } else { - sr = s->frame_chain; - sr |= (uword)*c++ << 4; /* 1 */ - LARc[0] = sr & 0x3f; sr >>= 6; - LARc[1] = sr & 0x3f; sr >>= 6; - sr = *c++; - LARc[2] = sr & 0x1f; sr >>= 5; - sr |= (uword)*c++ << 3; - LARc[3] = sr & 0x1f; sr >>= 5; - LARc[4] = sr & 0xf; sr >>= 4; - sr |= (uword)*c++ << 2; - LARc[5] = sr & 0xf; sr >>= 4; - LARc[6] = sr & 0x7; sr >>= 3; - LARc[7] = sr & 0x7; sr >>= 3; - sr = *c++; /* 5 */ - Nc[0] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[0] = sr & 0x3; sr >>= 2; - Mc[0] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[0] = sr & 0x3f; sr >>= 6; -#undef xmc + sr = sr >> 4 | s->frame_chain << 12; + sr = sr >> 6 | LARc[0] << 10; + *c++ = sr >> 6; + sr = sr >> 6 | LARc[1] << 10; + *c++ = sr >> 8; + sr = sr >> 5 | LARc[2] << 11; + sr = sr >> 5 | LARc[3] << 11; + *c++ = sr >> 6; + sr = sr >> 4 | LARc[4] << 12; + sr = sr >> 4 | LARc[5] << 12; + *c++ = sr >> 6; + sr = sr >> 3 | LARc[6] << 13; + sr = sr >> 3 | LARc[7] << 13; + *c++ = sr >> 8; + sr = sr >> 7 | Nc[0] << 9; + sr = sr >> 2 | bc[0] << 14; + *c++ = sr >> 7; + sr = sr >> 2 | Mc[0] << 14; + sr = sr >> 6 | xmaxc[0] << 10; + *c++ = sr >> 7; +#undef xmc #define xmc (source + 12) - xmc[0] = sr & 0x7; sr >>= 3; - xmc[1] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[2] = sr & 0x7; sr >>= 3; - xmc[3] = sr & 0x7; sr >>= 3; - xmc[4] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[5] = sr & 0x7; sr >>= 3; - xmc[6] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; /* 10 */ - xmc[7] = sr & 0x7; sr >>= 3; - xmc[8] = sr & 0x7; sr >>= 3; - xmc[9] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[10] = sr & 0x7; sr >>= 3; - xmc[11] = sr & 0x7; sr >>= 3; - xmc[12] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[1] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[1] = sr & 0x3; sr >>= 2; - Mc[1] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[1] = sr & 0x3f; sr >>= 6; + + sr = sr >> 3 | xmc[0] << 13; + sr = sr >> 3 | xmc[1] << 13; + sr = sr >> 3 | xmc[2] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[3] << 13; + sr = sr >> 3 | xmc[4] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[5] << 13; + sr = sr >> 3 | xmc[6] << 13; + sr = sr >> 3 | xmc[7] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[8] << 13; + sr = sr >> 3 | xmc[9] << 13; + sr = sr >> 3 | xmc[10] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[11] << 13; + sr = sr >> 3 | xmc[12] << 13; + *c++ = sr >> 8; + sr = sr >> 7 | Nc[1] << 9; + sr = sr >> 2 | bc[1] << 14; + *c++ = sr >> 7; + sr = sr >> 2 | Mc[1] << 14; + sr = sr >> 6 | xmaxc[1] << 10; + *c++ = sr >> 7; #undef xmc #define xmc (source + 29 - 13) - xmc[13] = sr & 0x7; sr >>= 3; - xmc[14] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 15 */ - xmc[15] = sr & 0x7; sr >>= 3; - xmc[16] = sr & 0x7; sr >>= 3; - xmc[17] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[18] = sr & 0x7; sr >>= 3; - xmc[19] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[20] = sr & 0x7; sr >>= 3; - xmc[21] = sr & 0x7; sr >>= 3; - xmc[22] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[23] = sr & 0x7; sr >>= 3; - xmc[24] = sr & 0x7; sr >>= 3; - xmc[25] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[2] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; /* 20 */ - bc[2] = sr & 0x3; sr >>= 2; - Mc[2] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[2] = sr & 0x3f; sr >>= 6; + + sr = sr >> 3 | xmc[13] << 13; + sr = sr >> 3 | xmc[14] << 13; + sr = sr >> 3 | xmc[15] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[16] << 13; + sr = sr >> 3 | xmc[17] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[18] << 13; + sr = sr >> 3 | xmc[19] << 13; + sr = sr >> 3 | xmc[20] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[21] << 13; + sr = sr >> 3 | xmc[22] << 13; + sr = sr >> 3 | xmc[23] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[24] << 13; + sr = sr >> 3 | xmc[25] << 13; + *c++ = sr >> 8; + sr = sr >> 7 | Nc[2] << 9; + sr = sr >> 2 | bc[2] << 14; + *c++ = sr >> 7; + sr = sr >> 2 | Mc[2] << 14; + sr = sr >> 6 | xmaxc[2] << 10; + *c++ = sr >> 7; #undef xmc #define xmc (source + 46 - 26) - xmc[26] = sr & 0x7; sr >>= 3; - xmc[27] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[28] = sr & 0x7; sr >>= 3; - xmc[29] = sr & 0x7; sr >>= 3; - xmc[30] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[31] = sr & 0x7; sr >>= 3; - xmc[32] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[33] = sr & 0x7; sr >>= 3; - xmc[34] = sr & 0x7; sr >>= 3; - xmc[35] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 25 */ - xmc[36] = sr & 0x7; sr >>= 3; - xmc[37] = sr & 0x7; sr >>= 3; - xmc[38] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[3] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[3] = sr & 0x3; sr >>= 2; - Mc[3] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[3] = sr & 0x3f; sr >>= 6; + + sr = sr >> 3 | xmc[26] << 13; + sr = sr >> 3 | xmc[27] << 13; + sr = sr >> 3 | xmc[28] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[29] << 13; + sr = sr >> 3 | xmc[30] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[31] << 13; + sr = sr >> 3 | xmc[32] << 13; + sr = sr >> 3 | xmc[33] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[34] << 13; + sr = sr >> 3 | xmc[35] << 13; + sr = sr >> 3 | xmc[36] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[37] << 13; + sr = sr >> 3 | xmc[38] << 13; + *c++ = sr >> 8; + sr = sr >> 7 | Nc[3] << 9; + sr = sr >> 2 | bc[3] << 14; + *c++ = sr >> 7; + sr = sr >> 2 | Mc[3] << 14; + sr = sr >> 6 | xmaxc[3] << 10; + *c++ = sr >> 7; #undef xmc #define xmc (source + 63 - 39) - xmc[39] = sr & 0x7; sr >>= 3; - xmc[40] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[41] = sr & 0x7; sr >>= 3; - xmc[42] = sr & 0x7; sr >>= 3; - xmc[43] = sr & 0x7; sr >>= 3; - sr = *c++; /* 30 */ - xmc[44] = sr & 0x7; sr >>= 3; - xmc[45] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[46] = sr & 0x7; sr >>= 3; - xmc[47] = sr & 0x7; sr >>= 3; - xmc[48] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[49] = sr & 0x7; sr >>= 3; - xmc[50] = sr & 0x7; sr >>= 3; - xmc[51] = sr & 0x7; sr >>= 3; + sr = sr >> 3 | xmc[39] << 13; + sr = sr >> 3 | xmc[40] << 13; + sr = sr >> 3 | xmc[41] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[42] << 13; + sr = sr >> 3 | xmc[43] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[44] << 13; + sr = sr >> 3 | xmc[45] << 13; + sr = sr >> 3 | xmc[46] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[47] << 13; + sr = sr >> 3 | xmc[48] << 13; + sr = sr >> 3 | xmc[49] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[50] << 13; + sr = sr >> 3 | xmc[51] << 13; + *c++ = sr >> 8; } } else #endif { - *c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */ - | ((LARc[0] >> 2) & 0xF); - *c++ = ((LARc[0] & 0x3) << 6) - | (LARc[1] & 0x3F); - *c++ = ((LARc[2] & 0x1F) << 3) - | ((LARc[3] >> 2) & 0x7); - *c++ = ((LARc[3] & 0x3) << 6) - | ((LARc[4] & 0xF) << 2) - | ((LARc[5] >> 2) & 0x3); - *c++ = ((LARc[5] & 0x3) << 6) - | ((LARc[6] & 0x7) << 3) - | (LARc[7] & 0x7); + *c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */ + | ((LARc[0] >> 2) & 0xF); + *c++ = ((LARc[0] & 0x3) << 6) + | (LARc[1] & 0x3F); + *c++ = ((LARc[2] & 0x1F) << 3) + | ((LARc[3] >> 2) & 0x7); + *c++ = ((LARc[3] & 0x3) << 6) + | ((LARc[4] & 0xF) << 2) + | ((LARc[5] >> 2) & 0x3); + *c++ = ((LARc[5] & 0x3) << 6) + | ((LARc[6] & 0x7) << 3) + | (LARc[7] & 0x7); - *c++ = ((Nc[0] & 0x7F) << 1) + *c++ = ((Nc[0] & 0x7F) << 1) - | ((bc[0] >> 1) & 0x1); - *c++ = ((bc[0] & 0x1) << 7) + | ((bc[0] >> 1) & 0x1); + *c++ = ((bc[0] & 0x1) << 7) - | ((Mc[0] & 0x3) << 5) + | ((Mc[0] & 0x3) << 5) - | ((xmaxc[0] >> 1) & 0x1F); - *c++ = ((xmaxc[0] & 0x1) << 7) + | ((xmaxc[0] >> 1) & 0x1F); + *c++ = ((xmaxc[0] & 0x1) << 7) #undef xmc #define xmc (source + 12) - | ((xmc[0] & 0x7) << 4) - | ((xmc[1] & 0x7) << 1) - | ((xmc[2] >> 2) & 0x1); - *c++ = ((xmc[2] & 0x3) << 6) - | ((xmc[3] & 0x7) << 3) - | (xmc[4] & 0x7); - *c++ = ((xmc[5] & 0x7) << 5) /* 10 */ - | ((xmc[6] & 0x7) << 2) - | ((xmc[7] >> 1) & 0x3); - *c++ = ((xmc[7] & 0x1) << 7) - | ((xmc[8] & 0x7) << 4) - | ((xmc[9] & 0x7) << 1) - | ((xmc[10] >> 2) & 0x1); - *c++ = ((xmc[10] & 0x3) << 6) - | ((xmc[11] & 0x7) << 3) - | (xmc[12] & 0x7); + | ((xmc[0] & 0x7) << 4) + | ((xmc[1] & 0x7) << 1) + | ((xmc[2] >> 2) & 0x1); + *c++ = ((xmc[2] & 0x3) << 6) + | ((xmc[3] & 0x7) << 3) + | (xmc[4] & 0x7); + *c++ = ((xmc[5] & 0x7) << 5) /* 10 */ + | ((xmc[6] & 0x7) << 2) + | ((xmc[7] >> 1) & 0x3); + *c++ = ((xmc[7] & 0x1) << 7) + | ((xmc[8] & 0x7) << 4) + | ((xmc[9] & 0x7) << 1) + | ((xmc[10] >> 2) & 0x1); + *c++ = ((xmc[10] & 0x3) << 6) + | ((xmc[11] & 0x7) << 3) + | (xmc[12] & 0x7); - *c++ = ((Nc[1] & 0x7F) << 1) + *c++ = ((Nc[1] & 0x7F) << 1) - | ((bc[1] >> 1) & 0x1); - *c++ = ((bc[1] & 0x1) << 7) + | ((bc[1] >> 1) & 0x1); + *c++ = ((bc[1] & 0x1) << 7) - | ((Mc[1] & 0x3) << 5) + | ((Mc[1] & 0x3) << 5) - | ((xmaxc[1] >> 1) & 0x1F); - *c++ = ((xmaxc[1] & 0x1) << 7) + | ((xmaxc[1] >> 1) & 0x1F); + *c++ = ((xmaxc[1] & 0x1) << 7) #undef xmc #define xmc (source + 29 - 13) - | ((xmc[13] & 0x7) << 4) - | ((xmc[14] & 0x7) << 1) - | ((xmc[15] >> 2) & 0x1); - *c++ = ((xmc[15] & 0x3) << 6) - | ((xmc[16] & 0x7) << 3) - | (xmc[17] & 0x7); - *c++ = ((xmc[18] & 0x7) << 5) - | ((xmc[19] & 0x7) << 2) - | ((xmc[20] >> 1) & 0x3); - *c++ = ((xmc[20] & 0x1) << 7) - | ((xmc[21] & 0x7) << 4) - | ((xmc[22] & 0x7) << 1) - | ((xmc[23] >> 2) & 0x1); - *c++ = ((xmc[23] & 0x3) << 6) - | ((xmc[24] & 0x7) << 3) - | (xmc[25] & 0x7); + | ((xmc[13] & 0x7) << 4) + | ((xmc[14] & 0x7) << 1) + | ((xmc[15] >> 2) & 0x1); + *c++ = ((xmc[15] & 0x3) << 6) + | ((xmc[16] & 0x7) << 3) + | (xmc[17] & 0x7); + *c++ = ((xmc[18] & 0x7) << 5) + | ((xmc[19] & 0x7) << 2) + | ((xmc[20] >> 1) & 0x3); + *c++ = ((xmc[20] & 0x1) << 7) + | ((xmc[21] & 0x7) << 4) + | ((xmc[22] & 0x7) << 1) + | ((xmc[23] >> 2) & 0x1); + *c++ = ((xmc[23] & 0x3) << 6) + | ((xmc[24] & 0x7) << 3) + | (xmc[25] & 0x7); - *c++ = ((Nc[2] & 0x7F) << 1) /* 20 */ + *c++ = ((Nc[2] & 0x7F) << 1) /* 20 */ - | ((bc[2] >> 1) & 0x1); - *c++ = ((bc[2] & 0x1) << 7) + | ((bc[2] >> 1) & 0x1); + *c++ = ((bc[2] & 0x1) << 7) - | ((Mc[2] & 0x3) << 5) + | ((Mc[2] & 0x3) << 5) - | ((xmaxc[2] >> 1) & 0x1F); - *c++ = ((xmaxc[2] & 0x1) << 7) + | ((xmaxc[2] >> 1) & 0x1F); + *c++ = ((xmaxc[2] & 0x1) << 7) #undef xmc #define xmc (source + 46 - 26) - | ((xmc[26] & 0x7) << 4) - | ((xmc[27] & 0x7) << 1) - | ((xmc[28] >> 2) & 0x1); - *c++ = ((xmc[28] & 0x3) << 6) - | ((xmc[29] & 0x7) << 3) - | (xmc[30] & 0x7); - *c++ = ((xmc[31] & 0x7) << 5) - | ((xmc[32] & 0x7) << 2) - | ((xmc[33] >> 1) & 0x3); - *c++ = ((xmc[33] & 0x1) << 7) - | ((xmc[34] & 0x7) << 4) - | ((xmc[35] & 0x7) << 1) - | ((xmc[36] >> 2) & 0x1); - *c++ = ((xmc[36] & 0x3) << 6) - | ((xmc[37] & 0x7) << 3) - | (xmc[38] & 0x7); + | ((xmc[26] & 0x7) << 4) + | ((xmc[27] & 0x7) << 1) + | ((xmc[28] >> 2) & 0x1); + *c++ = ((xmc[28] & 0x3) << 6) + | ((xmc[29] & 0x7) << 3) + | (xmc[30] & 0x7); + *c++ = ((xmc[31] & 0x7) << 5) + | ((xmc[32] & 0x7) << 2) + | ((xmc[33] >> 1) & 0x3); + *c++ = ((xmc[33] & 0x1) << 7) + | ((xmc[34] & 0x7) << 4) + | ((xmc[35] & 0x7) << 1) + | ((xmc[36] >> 2) & 0x1); + *c++ = ((xmc[36] & 0x3) << 6) + | ((xmc[37] & 0x7) << 3) + | (xmc[38] & 0x7); - *c++ = ((Nc[3] & 0x7F) << 1) + *c++ = ((Nc[3] & 0x7F) << 1) - | ((bc[3] >> 1) & 0x1); - *c++ = ((bc[3] & 0x1) << 7) + | ((bc[3] >> 1) & 0x1); + *c++ = ((bc[3] & 0x1) << 7) - | ((Mc[3] & 0x3) << 5) + | ((Mc[3] & 0x3) << 5) - | ((xmaxc[3] >> 1) & 0x1F); - *c++ = ((xmaxc[3] & 0x1) << 7) + | ((xmaxc[3] >> 1) & 0x1F); + *c++ = ((xmaxc[3] & 0x1) << 7) #undef xmc #define xmc (source + 63 - 39) - | ((xmc[39] & 0x7) << 4) - | ((xmc[40] & 0x7) << 1) - | ((xmc[41] >> 2) & 0x1); - *c++ = ((xmc[41] & 0x3) << 6) /* 30 */ - | ((xmc[42] & 0x7) << 3) - | (xmc[43] & 0x7); - *c++ = ((xmc[44] & 0x7) << 5) - | ((xmc[45] & 0x7) << 2) - | ((xmc[46] >> 1) & 0x3); - *c++ = ((xmc[46] & 0x1) << 7) - | ((xmc[47] & 0x7) << 4) - | ((xmc[48] & 0x7) << 1) - | ((xmc[49] >> 2) & 0x1); - *c++ = ((xmc[49] & 0x3) << 6) - | ((xmc[50] & 0x7) << 3) - | (xmc[51] & 0x7); + | ((xmc[39] & 0x7) << 4) + | ((xmc[40] & 0x7) << 1) + | ((xmc[41] >> 2) & 0x1); + *c++ = ((xmc[41] & 0x3) << 6) /* 30 */ + | ((xmc[42] & 0x7) << 3) + | (xmc[43] & 0x7); + *c++ = ((xmc[44] & 0x7) << 5) + | ((xmc[45] & 0x7) << 2) + | ((xmc[46] >> 1) & 0x3); + *c++ = ((xmc[46] & 0x1) << 7) + | ((xmc[47] & 0x7) << 4) + | ((xmc[48] & 0x7) << 1) + | ((xmc[49] >> 2) & 0x1); + *c++ = ((xmc[49] & 0x3) << 6) + | ((xmc[50] & 0x7) << 3) + | (xmc[51] & 0x7); } } diff --git a/pjmedia/src/pjmedia-codec/gsm/private.h b/pjmedia/src/pjmedia-codec/gsm/private.h index fea56942..0c942550 100644 --- a/pjmedia/src/pjmedia-codec/gsm/private.h +++ b/pjmedia/src/pjmedia-codec/gsm/private.h @@ -18,6 +18,7 @@ typedef unsigned long ulongword; /* unsigned longword */ struct gsm_state { word dp0[ 280 ]; + word e[ 50 ]; /* code.c */ word z1; /* preprocessing.c, Offset_com. */ longword L_z2; /* Offset_com. */ diff --git a/pjmedia/src/pjmedia-codec/gsm/proto.h b/pjmedia/src/pjmedia-codec/gsm/proto.h index f1b2f0dd..2851c086 100644 --- a/pjmedia/src/pjmedia-codec/gsm/proto.h +++ b/pjmedia/src/pjmedia-codec/gsm/proto.h @@ -8,16 +8,6 @@ #ifndef PROTO_H #define PROTO_H -
-#ifdef _MSC_VER
-# pragma warning(push, 3)
-# pragma warning(disable: 4131) // .. uses old-style declarato
-# pragma warning(disable: 4244) // conversion from 'x ' to 'y', possible loss of data
-# pragma warning(disable: 4761) // integral size mismatch
-#endif
-
-#define NeedFunctionPrototypes 1
-
#if __cplusplus # define NeedFunctionPrototypes 1 |