diff --git a/libs/codec/gsm/inc/config.h b/libs/codec/gsm/inc/config.h
index 07b21d17c0..1973b6363e 100644
--- a/libs/codec/gsm/inc/config.h
+++ b/libs/codec/gsm/inc/config.h
@@ -1,51 +1,38 @@
/*
+ * config.h
+ *
* 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$*/
#ifndef CONFIG_H
#define CONFIG_H
-#if 0
-efine SIGHANDLER_T int /* signal handlers are void */
-efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */
-#endif
+/*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 */
-#if 0
-efine HAS_LIMITS_H 1 /* /usr/include/limits.h */
-#endif
+/*efine HAS_LIMITS_H 1 * /usr/include/limits.h */
#define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */
-#if 0
-efine HAS_ERRNO_DECL 1 /* errno.h declares errno */
-#endif
+/*efine 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 */
-#if 0
-efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */
-#endif
+/*efine HAS__FSETMODE 1 * _fsetmode -- set file mode */
#define HAS_STRING_H 1 /* /usr/include/string.h */
-#if 0
-efine HAS_STRINGS_H 1 /* /usr/include/strings.h */
-#endif
+/*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) */
-#if 0
-efine HAS_UTIMES 1 /* use utimes() syscall instead */
-#endif
+/*efine HAS_UTIMES 1 * use utimes() syscall instead */
#define HAS_UTIME_H 1 /* UTIME header file */
-#if 0
-efine HAS_UTIMBUF 1 /* struct utimbuf */
-efine HAS_UTIMEUSEC 1 /* microseconds in utimbuf? */
-#endif
+/*efine HAS_UTIMBUF 1 * struct utimbuf */
+/*efine HAS_UTIMEUSEC 1 * microseconds in utimbuf? */
#endif /* CONFIG_H */
diff --git a/libs/codec/gsm/inc/gsm.h b/libs/codec/gsm/inc/gsm.h
index 32a0b48279..cf0145d2fb 100644
--- a/libs/codec/gsm/inc/gsm.h
+++ b/libs/codec/gsm/inc/gsm.h
@@ -1,10 +1,11 @@
/*
+ * gsm.h
+ *
* 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$*/
#ifndef GSM_H
#define GSM_H
diff --git a/libs/codec/gsm/inc/private.h b/libs/codec/gsm/inc/private.h
index c77ee66e46..f0ee16d72a 100644
--- a/libs/codec/gsm/inc/private.h
+++ b/libs/codec/gsm/inc/private.h
@@ -1,10 +1,11 @@
/*
+ * private.h
+ *
* 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$*/
#ifndef PRIVATE_H
#define PRIVATE_H
@@ -98,49 +99,6 @@ extern word gsm_asr P((word a, int n));
# define GSM_L_MULT(a, b) /* word a, word b */ \
(((longword)(a) * (longword)(b)) << 1)
-#if defined(__GNUC__) && defined(__i386__)
-
-static __inline__ int GSM_L_ADD(int a, int b)
-{
- __asm__ __volatile__(
-
- "addl %2,%0; jno 0f; movl $0x7fffffff,%0; adcl $0,%0; 0:"
- : "=r" (a)
- : "0" (a), "ir" (b)
- : "cc"
- );
- return(a);
-}
-
-static __inline__ short GSM_ADD(short a, short b)
-{
- __asm__ __volatile__(
- "addw %2,%0; jno 0f; movw $0x7fff,%0; adcw $0,%0; 0:"
- : "=r" (a)
- : "0" (a), "ir" (b)
- : "cc"
- );
- return(a);
-}
-
-static __inline__ short GSM_SUB(short a, short b)
-{
- __asm__ __volatile__(
- "subw %2,%0; jno 0f; movw $0x7fff,%0; adcw $0,%0; 0:"
- : "=r" (a)
- : "0" (a), "ir" (b)
- : "cc"
- );
- return(a);
-}
-
-#else
-
-#ifdef WIN32
-#define inline __inline
-#define __inline__ __inline
-#endif
-
# define GSM_L_ADD(a, b) \
( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \
: (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
@@ -149,21 +107,20 @@ static __inline__ short GSM_SUB(short a, short b)
: (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \
? MAX_LONGWORD : utmp))
-static inline word GSM_ADD(a, b)
-{
- register longword ltmp;
- ltmp = (longword) (a) + (longword) (b);
- return (word)((ulongword) (ltmp - MIN_WORD) > MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp);
-};
+/*
+ * # define GSM_ADD(a, b) \
+ * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \
+ * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
+ */
+/* Nonportable, but faster: */
-static inline word GSM_SUB(a, b)
-{
- register longword ltmp;
- ltmp = (longword) (a) - (longword) (b);
- return (word)(ltmp >= MAX_WORD ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp);
-};
+#define GSM_ADD(a, b) \
+ ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \
+ MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp)
-#endif
+# define GSM_SUB(a, b) \
+ ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \
+ ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
# define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a))
diff --git a/libs/codec/gsm/inc/proto.h b/libs/codec/gsm/inc/proto.h
index 17a5f745b5..7858c4e9ec 100644
--- a/libs/codec/gsm/inc/proto.h
+++ b/libs/codec/gsm/inc/proto.h
@@ -1,10 +1,11 @@
/*
+ * proto.h
+ *
* 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$*/
#ifndef PROTO_H
#define PROTO_H
diff --git a/libs/codec/gsm/inc/unproto.h b/libs/codec/gsm/inc/unproto.h
index ce09e1a80f..3cdb71c2bf 100644
--- a/libs/codec/gsm/inc/unproto.h
+++ b/libs/codec/gsm/inc/unproto.h
@@ -1,10 +1,11 @@
/*
+ * unproto.h
+ *
* 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$*/
#ifdef PROTO_H /* sic */
#undef PROTO_H
diff --git a/libs/codec/gsm/libgsm.vcproj b/libs/codec/gsm/libgsm.vcproj
index 025c913051..4acd21cb68 100644
--- a/libs/codec/gsm/libgsm.vcproj
+++ b/libs/codec/gsm/libgsm.vcproj
@@ -156,10 +156,6 @@
RelativePath=".\src\code.c"
>
-
-
@@ -181,29 +177,17 @@
>
-
-
-
-
-
-
diff --git a/libs/codec/gsm/src/add.c b/libs/codec/gsm/src/add.c
index 0e65c5d7cd..58eae6c1fb 100644
--- a/libs/codec/gsm/src/add.c
+++ b/libs/codec/gsm/src/add.c
@@ -1,10 +1,11 @@
/*
+ * add.c
+ *
* 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$ */
/*
* See private.h for the more commonly used macro versions.
@@ -23,19 +24,19 @@
word gsm_add P2((a,b), word a, word b)
{
longword sum = (longword)a + (longword)b;
- return (word)saturate(sum);
+ return (word) saturate(sum);
}
word gsm_sub P2((a,b), word a, word b)
{
longword diff = (longword)a - (longword)b;
- return (word)saturate(diff);
+ return (word) saturate(diff);
}
word gsm_mult P2((a,b), word a, word b)
{
if (a == MIN_WORD && b == MIN_WORD) return MAX_WORD;
- else return (word)SASR( (longword)a * (longword)b, 15 );
+ else return (word) SASR( (longword)a * (longword)b, 15 );
}
word gsm_mult_r P2((a,b), word a, word b)
@@ -44,7 +45,7 @@ word gsm_mult_r P2((a,b), word a, word b)
else {
longword prod = (longword)a * (longword)b + 16384;
prod >>= 15;
- return (word)(prod & 0xFFFF);
+ return (word) (prod & 0xFFFF);
}
}
diff --git a/libs/codec/gsm/src/code.c b/libs/codec/gsm/src/code.c
index cd744e76c5..aceebec61b 100644
--- a/libs/codec/gsm/src/code.c
+++ b/libs/codec/gsm/src/code.c
@@ -1,17 +1,18 @@
/*
+ * code.c
+ *
* 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$ */
#include "config.h"
#ifdef HAS_STRING_H
#include
#else
-# include "proto.h"
+#include "proto.h"
extern char * memcpy P((char *, char *, int));
#endif
@@ -85,8 +86,9 @@ void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc),
*/
{ register int i;
+ register longword ltmp;
for (i = 0; i <= 39; i++)
- dp[ i ] = GSM_ADD( e[5 + i], dpp[i] );
+ dp[ i ] = (word) GSM_ADD( e[5 + i], dpp[i] );
}
dp += 40;
dpp += 40;
diff --git a/libs/codec/gsm/src/debug.c b/libs/codec/gsm/src/debug.c
deleted file mode 100644
index 031a7f895b..0000000000
--- a/libs/codec/gsm/src/debug.c
+++ /dev/null
@@ -1,76 +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$ */
-
-#include "private.h"
-
-#ifndef NDEBUG
-
-/* If NDEBUG _is_ defined and no debugging should be performed,
- * calls to functions in this module are #defined to nothing
- * in private.h.
- */
-
-#include
-#include "proto.h"
-
-void gsm_debug_words P4( (name, from, to, ptr),
- char * name,
- int from,
- int to,
- word * ptr)
-{
- int nprinted = 0;
-
- fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
- while (from <= to) {
- fprintf(stderr, "%d ", ptr[ from ] );
- from++;
- if (nprinted++ >= 7) {
- nprinted = 0;
- if (from < to) putc('\n', stderr);
- }
- }
- putc('\n', stderr);
-}
-
-void gsm_debug_longwords P4( (name, from, to, ptr),
- char * name,
- int from,
- int to,
- longword * ptr)
-{
- int nprinted = 0;
-
- fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
- while (from <= to) {
-
- fprintf(stderr, "%d ", ptr[ from ] );
- from++;
- if (nprinted++ >= 7) {
- nprinted = 0;
- if (from < to) putc('\n', stderr);
- }
- }
- putc('\n', stderr);
-}
-
-void gsm_debug_longword P2( (name, value),
- char * name,
- longword value )
-{
- fprintf(stderr, "%s: %d\n", name, (long)value );
-}
-
-void gsm_debug_word P2( (name, value),
- char * name,
- word value )
-{
- fprintf(stderr, "%s: %d\n", name, (long)value);
-}
-
-#endif
diff --git a/libs/codec/gsm/src/decode.c b/libs/codec/gsm/src/decode.c
index 0c647ee148..935c440159 100644
--- a/libs/codec/gsm/src/decode.c
+++ b/libs/codec/gsm/src/decode.c
@@ -1,10 +1,11 @@
/*
+ * decode.c
+ *
* 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$ */
#include
@@ -22,12 +23,13 @@ static void Postprocessing P2((S,s),
{
register int k;
register word msr = S->msr;
+ register longword ltmp; /* for GSM_ADD */
register word tmp;
for (k = 160; k--; s++) {
- tmp = (word)GSM_MULT_R( msr, 28180 );
- msr = GSM_ADD(*s, tmp); /* Deemphasis */
- *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
+ tmp = (word) GSM_MULT_R( msr, 28180 );
+ msr = (word) GSM_ADD(*s, tmp); /* Deemphasis */
+ *s = (word) GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
}
S->msr = msr;
}
diff --git a/libs/codec/gsm/src/gsm_create.c b/libs/codec/gsm/src/gsm_create.c
index 884549ea3f..baafe0f643 100644
--- a/libs/codec/gsm/src/gsm_create.c
+++ b/libs/codec/gsm/src/gsm_create.c
@@ -1,10 +1,11 @@
/*
+ * gsm_create.c
+ *
* 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.
*/
-static char const ident[] = "$Header$";
#include "config.h"
diff --git a/libs/codec/gsm/src/gsm_decode.c b/libs/codec/gsm/src/gsm_decode.c
index 0fa6d3e1d7..235a003268 100644
--- a/libs/codec/gsm/src/gsm_decode.c
+++ b/libs/codec/gsm/src/gsm_decode.c
@@ -1,10 +1,11 @@
/*
+ * gsm_decode.c
+ *
* 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$ */
#include "private.h"
diff --git a/libs/codec/gsm/src/gsm_destroy.c b/libs/codec/gsm/src/gsm_destroy.c
index a92c00649f..17045540fc 100644
--- a/libs/codec/gsm/src/gsm_destroy.c
+++ b/libs/codec/gsm/src/gsm_destroy.c
@@ -1,10 +1,11 @@
/*
+ * gsm_destroy.c
+ *
* 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$ */
#include "gsm.h"
#include "config.h"
diff --git a/libs/codec/gsm/src/gsm_encode.c b/libs/codec/gsm/src/gsm_encode.c
index 4a2392edfc..927a05ea24 100644
--- a/libs/codec/gsm/src/gsm_encode.c
+++ b/libs/codec/gsm/src/gsm_encode.c
@@ -1,10 +1,11 @@
/*
+ * gsm_encode.c
+ *
* 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$ */
#include "private.h"
#include "gsm.h"
diff --git a/libs/codec/gsm/src/gsm_explode.c b/libs/codec/gsm/src/gsm_explode.c
deleted file mode 100644
index 9c831a723c..0000000000
--- a/libs/codec/gsm/src/gsm_explode.c
+++ /dev/null
@@ -1,417 +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$ */
-
-#include "private.h"
-#include "gsm.h"
-#include "proto.h"
-
-int gsm_explode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
-{
-# define LARc target
-# define Nc *((gsm_signal (*) [17])(target + 8))
-# define bc *((gsm_signal (*) [17])(target + 9))
-# define Mc *((gsm_signal (*) [17])(target + 10))
-# define xmaxc *((gsm_signal (*) [17])(target + 11))
-
-
-#ifdef WAV49
- if (s->wav_fmt) {
-
- uword sr = 0;
-
- if (s->frame_index == 1) {
-
- 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
-#define xmc (target + 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;
-#undef xmc
-#define xmc (target + 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;
-
-#undef xmc
-#define xmc (target + 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;
-#undef xmc
-#define xmc (target + 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;
- }
- 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
-#define xmc (target + 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;
-#undef xmc
-#define xmc (target + 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;
-#undef xmc
-#define xmc (target + 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;
-
-#undef xmc
-#define xmc (target + 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;
- }
- }
- else
-#endif
- {
- /* GSM_MAGIC = (*c >> 4) & 0xF; */
-
- if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
-
- LARc[0] = (*c++ & 0xF) << 2; /* 1 */
- LARc[0] |= (*c >> 6) & 0x3;
- LARc[1] = *c++ & 0x3F;
- LARc[2] = (*c >> 3) & 0x1F;
- LARc[3] = (*c++ & 0x7) << 2;
- LARc[3] |= (*c >> 6) & 0x3;
- LARc[4] = (*c >> 2) & 0xF;
- LARc[5] = (*c++ & 0x3) << 2;
- LARc[5] |= (*c >> 6) & 0x3;
- LARc[6] = (*c >> 3) & 0x7;
- LARc[7] = *c++ & 0x7;
-
- Nc[0] = (*c >> 1) & 0x7F;
-
- bc[0] = (*c++ & 0x1) << 1;
- bc[0] |= (*c >> 7) & 0x1;
-
- Mc[0] = (*c >> 5) & 0x3;
-
- xmaxc[0] = (*c++ & 0x1F) << 1;
- xmaxc[0] |= (*c >> 7) & 0x1;
-
-#undef xmc
-#define xmc (target + 12)
-
- xmc[0] = (*c >> 4) & 0x7;
- xmc[1] = (*c >> 1) & 0x7;
- xmc[2] = (*c++ & 0x1) << 2;
- xmc[2] |= (*c >> 6) & 0x3;
- xmc[3] = (*c >> 3) & 0x7;
- xmc[4] = *c++ & 0x7;
- xmc[5] = (*c >> 5) & 0x7;
- xmc[6] = (*c >> 2) & 0x7;
- xmc[7] = (*c++ & 0x3) << 1; /* 10 */
- xmc[7] |= (*c >> 7) & 0x1;
- xmc[8] = (*c >> 4) & 0x7;
- xmc[9] = (*c >> 1) & 0x7;
- xmc[10] = (*c++ & 0x1) << 2;
- xmc[10] |= (*c >> 6) & 0x3;
- xmc[11] = (*c >> 3) & 0x7;
- xmc[12] = *c++ & 0x7;
-
- Nc[1] = (*c >> 1) & 0x7F;
-
- bc[1] = (*c++ & 0x1) << 1;
- bc[1] |= (*c >> 7) & 0x1;
-
- Mc[1] = (*c >> 5) & 0x3;
-
- xmaxc[1] = (*c++ & 0x1F) << 1;
- xmaxc[1] |= (*c >> 7) & 0x1;
-
-#undef xmc
-#define xmc (target + 29 - 13)
-
- xmc[13] = (*c >> 4) & 0x7;
- xmc[14] = (*c >> 1) & 0x7;
- xmc[15] = (*c++ & 0x1) << 2;
- xmc[15] |= (*c >> 6) & 0x3;
- xmc[16] = (*c >> 3) & 0x7;
- xmc[17] = *c++ & 0x7;
- xmc[18] = (*c >> 5) & 0x7;
- xmc[19] = (*c >> 2) & 0x7;
- xmc[20] = (*c++ & 0x3) << 1;
- xmc[20] |= (*c >> 7) & 0x1;
- xmc[21] = (*c >> 4) & 0x7;
- xmc[22] = (*c >> 1) & 0x7;
- xmc[23] = (*c++ & 0x1) << 2;
- xmc[23] |= (*c >> 6) & 0x3;
- xmc[24] = (*c >> 3) & 0x7;
- xmc[25] = *c++ & 0x7;
-
- Nc[2] = (*c >> 1) & 0x7F;
-
- bc[2] = (*c++ & 0x1) << 1; /* 20 */
- bc[2] |= (*c >> 7) & 0x1;
-
- Mc[2] = (*c >> 5) & 0x3;
-
- xmaxc[2] = (*c++ & 0x1F) << 1;
- xmaxc[2] |= (*c >> 7) & 0x1;
-
-#undef xmc
-#define xmc (target + 46 - 26)
-
- xmc[26] = (*c >> 4) & 0x7;
- xmc[27] = (*c >> 1) & 0x7;
- xmc[28] = (*c++ & 0x1) << 2;
- xmc[28] |= (*c >> 6) & 0x3;
- xmc[29] = (*c >> 3) & 0x7;
- xmc[30] = *c++ & 0x7;
- xmc[31] = (*c >> 5) & 0x7;
- xmc[32] = (*c >> 2) & 0x7;
- xmc[33] = (*c++ & 0x3) << 1;
- xmc[33] |= (*c >> 7) & 0x1;
- xmc[34] = (*c >> 4) & 0x7;
- xmc[35] = (*c >> 1) & 0x7;
- xmc[36] = (*c++ & 0x1) << 2;
- xmc[36] |= (*c >> 6) & 0x3;
- xmc[37] = (*c >> 3) & 0x7;
- xmc[38] = *c++ & 0x7;
-
- Nc[3] = (*c >> 1) & 0x7F;
-
- bc[3] = (*c++ & 0x1) << 1;
- bc[3] |= (*c >> 7) & 0x1;
-
- Mc[3] = (*c >> 5) & 0x3;
-
- xmaxc[3] = (*c++ & 0x1F) << 1;
- xmaxc[3] |= (*c >> 7) & 0x1;
-
-#undef xmc
-#define xmc (target + 63 - 39)
-
- xmc[39] = (*c >> 4) & 0x7;
- xmc[40] = (*c >> 1) & 0x7;
- xmc[41] = (*c++ & 0x1) << 2;
- xmc[41] |= (*c >> 6) & 0x3;
- xmc[42] = (*c >> 3) & 0x7;
- xmc[43] = *c++ & 0x7; /* 30 */
- xmc[44] = (*c >> 5) & 0x7;
- xmc[45] = (*c >> 2) & 0x7;
- xmc[46] = (*c++ & 0x3) << 1;
- xmc[46] |= (*c >> 7) & 0x1;
- xmc[47] = (*c >> 4) & 0x7;
- xmc[48] = (*c >> 1) & 0x7;
- xmc[49] = (*c++ & 0x1) << 2;
- xmc[49] |= (*c >> 6) & 0x3;
- xmc[50] = (*c >> 3) & 0x7;
- xmc[51] = *c & 0x7; /* 33 */
- }
-
- return 0;
-}
diff --git a/libs/codec/gsm/src/gsm_implode.c b/libs/codec/gsm/src/gsm_implode.c
deleted file mode 100644
index 171836d133..0000000000
--- a/libs/codec/gsm/src/gsm_implode.c
+++ /dev/null
@@ -1,515 +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$ */
-
-#include "private.h"
-
-#include "gsm.h"
-#include "proto.h"
-
-void gsm_implode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c)
-{
- /* variable size index
-
- GSM_MAGIC 4 -
-
- LARc[0] 6 0
- LARc[1] 6 1
- LARc[2] 5 2
- LARc[3] 5 3
- LARc[4] 4 4
- LARc[5] 4 5
- LARc[6] 3 6
- LARc[7] 3 7
-
- Nc[0] 7 8
- bc[0] 2 9
- Mc[0] 2 10
- xmaxc[0] 6 11
- xmc[0] 3 12
- xmc[1] 3 13
- xmc[2] 3 14
- xmc[3] 3 15
- xmc[4] 3 16
- xmc[5] 3 17
- xmc[6] 3 18
- xmc[7] 3 19
- xmc[8] 3 20
- xmc[9] 3 21
- xmc[10] 3 22
- xmc[11] 3 23
- xmc[12] 3 24
-
- Nc[1] 7 25
- bc[1] 2 26
- Mc[1] 2 27
- xmaxc[1] 6 28
- xmc[13] 3 29
- xmc[14] 3 30
- xmc[15] 3 31
- xmc[16] 3 32
- xmc[17] 3 33
- xmc[18] 3 34
- xmc[19] 3 35
- xmc[20] 3 36
- xmc[21] 3 37
- xmc[22] 3 38
- xmc[23] 3 39
- xmc[24] 3 40
- xmc[25] 3 41
-
- Nc[2] 7 42
- bc[2] 2 43
- Mc[2] 2 44
- xmaxc[2] 6 45
- xmc[26] 3 46
- xmc[27] 3 47
- xmc[28] 3 48
- xmc[29] 3 49
- xmc[30] 3 50
- xmc[31] 3 51
- xmc[32] 3 52
- xmc[33] 3 53
- xmc[34] 3 54
- xmc[35] 3 55
- xmc[36] 3 56
- xmc[37] 3 57
- xmc[38] 3 58
-
- Nc[3] 7 59
- bc[3] 2 60
- Mc[3] 2 61
- xmaxc[3] 6 62
- xmc[39] 3 63
- xmc[40] 3 64
- xmc[41] 3 65
- xmc[42] 3 66
- xmc[43] 3 67
- xmc[44] 3 68
- xmc[45] 3 69
- xmc[46] 3 70
- xmc[47] 3 71
- xmc[48] 3 72
- xmc[49] 3 73
- xmc[50] 3 74
- xmc[51] 3 75
- */
-
- /* There are 76 parameters per frame. The first eight are
- * unique. The remaining 68 are four identical subframes of
- * 17 parameters each. gsm_implode converts from a representation
- * of these parameters as values in one array of signed words
- * to the "packed" version of a GSM frame.
- */
-
-# define LARc source
-# define Nc *((gsm_signal (*) [17])(source + 8))
-# define bc *((gsm_signal (*) [17])(source + 9))
-# define Mc *((gsm_signal (*) [17])(source + 10))
-# define xmaxc *((gsm_signal (*) [17])(source + 11))
-
-#ifdef WAV49
- 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
-#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;
-#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;
-#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;
-#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;
- }
- 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
-#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;
-#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;
-#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;
-#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;
- }
- }
- 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++ = ((Nc[0] & 0x7F) << 1)
-
-
- | ((bc[0] >> 1) & 0x1);
- *c++ = ((bc[0] & 0x1) << 7)
-
-
- | ((Mc[0] & 0x3) << 5)
-
- | ((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);
-
-
- *c++ = ((Nc[1] & 0x7F) << 1)
-
-
- | ((bc[1] >> 1) & 0x1);
- *c++ = ((bc[1] & 0x1) << 7)
-
-
- | ((Mc[1] & 0x3) << 5)
-
-
- | ((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);
-
-
- *c++ = ((Nc[2] & 0x7F) << 1) /* 20 */
-
-
- | ((bc[2] >> 1) & 0x1);
- *c++ = ((bc[2] & 0x1) << 7)
-
-
- | ((Mc[2] & 0x3) << 5)
-
-
- | ((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);
-
-
- *c++ = ((Nc[3] & 0x7F) << 1)
-
-
- | ((bc[3] >> 1) & 0x1);
- *c++ = ((bc[3] & 0x1) << 7)
-
-
- | ((Mc[3] & 0x3) << 5)
-
-
- | ((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);
- }
-}
diff --git a/libs/codec/gsm/src/lpc.c b/libs/codec/gsm/src/gsm_lpc.c
similarity index 83%
rename from libs/codec/gsm/src/lpc.c
rename to libs/codec/gsm/src/gsm_lpc.c
index 9d8df0b58f..2646ef4e24 100644
--- a/libs/codec/gsm/src/lpc.c
+++ b/libs/codec/gsm/src/gsm_lpc.c
@@ -1,10 +1,11 @@
/*
+ * gsm_lpc.c
+ *
* 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$ */
#include
#include
@@ -14,10 +15,6 @@
#include "gsm.h"
#include "proto.h"
-#ifdef K6OPT
-#include "k6opt.h"
-#endif
-
#undef P
/*
@@ -48,19 +45,12 @@ static void Autocorrelation P2((s, L_ACF),
/* Search for the maximum.
*/
-#ifndef K6OPT
smax = 0;
for (k = 0; k <= 159; k++) {
temp = GSM_ABS( s[k] );
if (temp > smax) smax = temp;
}
-#else
- {
- longword lmax;
- lmax = k6maxmin(s,160,NULL);
- smax = (lmax > MAX_WORD) ? MAX_WORD : lmax;
- }
-#endif
+
/* Computation of the scaling factor.
*/
if (smax == 0) scalauto = 0;
@@ -73,7 +63,6 @@ static void Autocorrelation P2((s, L_ACF),
*/
if (scalauto > 0) {
-# ifndef K6OPT
# ifdef USE_FLOAT_MUL
# define SCALE(n) \
@@ -84,7 +73,7 @@ static void Autocorrelation P2((s, L_ACF),
# else
# define SCALE(n) \
case n: for (k = 0; k <= 159; k++) \
- s[k] = (word)GSM_MULT_R( s[k], 16384 >> (n-1) );\
+ s[k] = (word) GSM_MULT_R( s[k], 16384 >> (n-1) );\
break;
# endif /* USE_FLOAT_MUL */
@@ -95,10 +84,6 @@ static void Autocorrelation P2((s, L_ACF),
SCALE(4)
}
# undef SCALE
-
-# else /* K6OPT */
- k6vsraw(s,160,scalauto);
-# endif
}
# ifdef USE_FLOAT_MUL
else for (k = 0; k <= 159; k++) float_s[k] = (float) s[k];
@@ -106,7 +91,6 @@ static void Autocorrelation P2((s, L_ACF),
/* Compute the L_ACF[..].
*/
-#ifndef K6OPT
{
# ifdef USE_FLOAT_MUL
register float * sp = float_s;
@@ -153,24 +137,11 @@ static void Autocorrelation P2((s, L_ACF),
for (k = 9; k--; L_ACF[k] <<= 1) ;
}
-
-#else
- {
- int k;
- for (k=0; k<9; k++) {
- L_ACF[k] = 2*k6iprod(s,s+k,160-k);
- }
- }
-#endif
/* Rescaling of the array s[0..159]
*/
if (scalauto > 0) {
assert(scalauto <= 4);
-#ifndef K6OPT
for (k = 160; k--; *s++ <<= scalauto) ;
-# else /* K6OPT */
- k6vsllw(s,160,scalauto);
-# endif
}
}
@@ -211,6 +182,7 @@ static void Reflection_coefficients P2( (L_ACF, r),
{
register int i, m, n;
register word temp;
+ register longword ltmp;
word ACF[9]; /* 0..8 */
word P[ 9]; /* 0..8 */
word K[ 9]; /* 2..8 */
@@ -229,7 +201,7 @@ static void Reflection_coefficients P2( (L_ACF, r),
assert(temp >= 0 && temp < 32);
/* ? overflow ? */
- for (i = 0; i <= 8; i++) ACF[i] = (word)SASR( L_ACF[i] << temp, 16 );
+ for (i = 0; i <= 8; i++) ACF[i] = (word) SASR( L_ACF[i] << temp, 16 );
/* Initialize array P[..] and K[..] for the recursion.
*/
@@ -257,15 +229,15 @@ static void Reflection_coefficients P2( (L_ACF, r),
/* Schur recursion
*/
- temp = (word)GSM_MULT_R( P[1], *r );
- P[0] = GSM_ADD( P[0], temp );
+ temp = (word) GSM_MULT_R( P[1], *r );
+ P[0] = (word) GSM_ADD( P[0], temp );
for (m = 1; m <= 8 - n; m++) {
- temp = (word)GSM_MULT_R( K[ m ], *r );
- P[m] = GSM_ADD( P[ m+1 ], temp );
+ temp = (word) GSM_MULT_R( K[ m ], *r );
+ P[m] = (word) GSM_ADD( P[ m+1 ], temp );
- temp = (word)GSM_MULT_R( P[ m+1 ], *r );
- K[m] = GSM_ADD( K[ m ], temp );
+ temp = (word) GSM_MULT_R( P[ m+1 ], *r );
+ K[m] = (word) GSM_ADD( K[ m ], temp );
}
}
}
@@ -318,6 +290,7 @@ static void Quantization_and_coding P1((LAR),
)
{
register word temp;
+ longword ltmp;
/* This procedure needs four tables; the following equations
@@ -332,8 +305,8 @@ static void Quantization_and_coding P1((LAR),
# undef STEP
# define STEP( A, B, MAC, MIC ) \
temp = (word)GSM_MULT( A, *LAR ); \
- temp = GSM_ADD( temp, B ); \
- temp = GSM_ADD( temp, 256 ); \
+ temp = (word) GSM_ADD( temp, B ); \
+ temp = (word) GSM_ADD( temp, 256 ); \
temp = (word)SASR( temp, 9 ); \
*LAR = temp>MAC ? MAC - MIC : (temp
-
-#include "private.h"
-
-#include "gsm.h"
-#include "proto.h"
-
-int gsm_print P3((f, s, c), FILE * f, gsm s, gsm_byte * c)
-{
- word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
-
- /* GSM_MAGIC = (*c >> 4) & 0xF; */
-
- if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
-
- LARc[0] = (*c++ & 0xF) << 2; /* 1 */
- LARc[0] |= (*c >> 6) & 0x3;
- LARc[1] = *c++ & 0x3F;
- LARc[2] = (*c >> 3) & 0x1F;
- LARc[3] = (*c++ & 0x7) << 2;
- LARc[3] |= (*c >> 6) & 0x3;
- LARc[4] = (*c >> 2) & 0xF;
- LARc[5] = (*c++ & 0x3) << 2;
- LARc[5] |= (*c >> 6) & 0x3;
- LARc[6] = (*c >> 3) & 0x7;
- LARc[7] = *c++ & 0x7;
-
-
- Nc[0] = (*c >> 1) & 0x7F;
- bc[0] = (*c++ & 0x1) << 1;
- bc[0] |= (*c >> 7) & 0x1;
- Mc[0] = (*c >> 5) & 0x3;
- xmaxc[0] = (*c++ & 0x1F) << 1;
- xmaxc[0] |= (*c >> 7) & 0x1;
- xmc[0] = (*c >> 4) & 0x7;
- xmc[1] = (*c >> 1) & 0x7;
- xmc[2] = (*c++ & 0x1) << 2;
- xmc[2] |= (*c >> 6) & 0x3;
- xmc[3] = (*c >> 3) & 0x7;
- xmc[4] = *c++ & 0x7;
- xmc[5] = (*c >> 5) & 0x7;
- xmc[6] = (*c >> 2) & 0x7;
- xmc[7] = (*c++ & 0x3) << 1; /* 10 */
- xmc[7] |= (*c >> 7) & 0x1;
- xmc[8] = (*c >> 4) & 0x7;
- xmc[9] = (*c >> 1) & 0x7;
- xmc[10] = (*c++ & 0x1) << 2;
- xmc[10] |= (*c >> 6) & 0x3;
- xmc[11] = (*c >> 3) & 0x7;
- xmc[12] = *c++ & 0x7;
-
- Nc[1] = (*c >> 1) & 0x7F;
- bc[1] = (*c++ & 0x1) << 1;
- bc[1] |= (*c >> 7) & 0x1;
- Mc[1] = (*c >> 5) & 0x3;
- xmaxc[1] = (*c++ & 0x1F) << 1;
- xmaxc[1] |= (*c >> 7) & 0x1;
- xmc[13] = (*c >> 4) & 0x7;
- xmc[14] = (*c >> 1) & 0x7;
- xmc[15] = (*c++ & 0x1) << 2;
- xmc[15] |= (*c >> 6) & 0x3;
- xmc[16] = (*c >> 3) & 0x7;
- xmc[17] = *c++ & 0x7;
- xmc[18] = (*c >> 5) & 0x7;
- xmc[19] = (*c >> 2) & 0x7;
- xmc[20] = (*c++ & 0x3) << 1;
- xmc[20] |= (*c >> 7) & 0x1;
- xmc[21] = (*c >> 4) & 0x7;
- xmc[22] = (*c >> 1) & 0x7;
- xmc[23] = (*c++ & 0x1) << 2;
- xmc[23] |= (*c >> 6) & 0x3;
- xmc[24] = (*c >> 3) & 0x7;
- xmc[25] = *c++ & 0x7;
-
-
- Nc[2] = (*c >> 1) & 0x7F;
- bc[2] = (*c++ & 0x1) << 1; /* 20 */
- bc[2] |= (*c >> 7) & 0x1;
- Mc[2] = (*c >> 5) & 0x3;
- xmaxc[2] = (*c++ & 0x1F) << 1;
- xmaxc[2] |= (*c >> 7) & 0x1;
- xmc[26] = (*c >> 4) & 0x7;
- xmc[27] = (*c >> 1) & 0x7;
- xmc[28] = (*c++ & 0x1) << 2;
- xmc[28] |= (*c >> 6) & 0x3;
- xmc[29] = (*c >> 3) & 0x7;
- xmc[30] = *c++ & 0x7;
- xmc[31] = (*c >> 5) & 0x7;
- xmc[32] = (*c >> 2) & 0x7;
- xmc[33] = (*c++ & 0x3) << 1;
- xmc[33] |= (*c >> 7) & 0x1;
- xmc[34] = (*c >> 4) & 0x7;
- xmc[35] = (*c >> 1) & 0x7;
- xmc[36] = (*c++ & 0x1) << 2;
- xmc[36] |= (*c >> 6) & 0x3;
- xmc[37] = (*c >> 3) & 0x7;
- xmc[38] = *c++ & 0x7;
-
- Nc[3] = (*c >> 1) & 0x7F;
- bc[3] = (*c++ & 0x1) << 1;
- bc[3] |= (*c >> 7) & 0x1;
- Mc[3] = (*c >> 5) & 0x3;
- xmaxc[3] = (*c++ & 0x1F) << 1;
- xmaxc[3] |= (*c >> 7) & 0x1;
-
- xmc[39] = (*c >> 4) & 0x7;
- xmc[40] = (*c >> 1) & 0x7;
- xmc[41] = (*c++ & 0x1) << 2;
- xmc[41] |= (*c >> 6) & 0x3;
- xmc[42] = (*c >> 3) & 0x7;
- xmc[43] = *c++ & 0x7; /* 30 */
- xmc[44] = (*c >> 5) & 0x7;
- xmc[45] = (*c >> 2) & 0x7;
- xmc[46] = (*c++ & 0x3) << 1;
- xmc[46] |= (*c >> 7) & 0x1;
- xmc[47] = (*c >> 4) & 0x7;
- xmc[48] = (*c >> 1) & 0x7;
- xmc[49] = (*c++ & 0x1) << 2;
- xmc[49] |= (*c >> 6) & 0x3;
- xmc[50] = (*c >> 3) & 0x7;
- xmc[51] = *c & 0x7; /* 33 */
-
- fprintf(f,
- "LARc:\t%2.2d %2.2d %2.2d %2.2d %2.2d %2.2d %2.2d %2.2d\n",
- LARc[0],LARc[1],LARc[2],LARc[3],LARc[4],LARc[5],LARc[6],LARc[7]);
-
- fprintf(f, "#1: Nc %4.4d bc %d Mc %d xmaxc %d\n",
- Nc[0], bc[0], Mc[0], xmaxc[0]);
- fprintf(f,
-"\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n",
- xmc[0],xmc[1],xmc[2],xmc[3],xmc[4],xmc[5],xmc[6],
- xmc[7],xmc[8],xmc[9],xmc[10],xmc[11],xmc[12] );
-
- fprintf(f, "#2: Nc %4.4d bc %d Mc %d xmaxc %d\n",
- Nc[1], bc[1], Mc[1], xmaxc[1]);
- fprintf(f,
-"\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n",
- xmc[13+0],xmc[13+1],xmc[13+2],xmc[13+3],xmc[13+4],xmc[13+5],
- xmc[13+6], xmc[13+7],xmc[13+8],xmc[13+9],xmc[13+10],xmc[13+11],
- xmc[13+12] );
-
- fprintf(f, "#3: Nc %4.4d bc %d Mc %d xmaxc %d\n",
- Nc[2], bc[2], Mc[2], xmaxc[2]);
- fprintf(f,
-"\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n",
- xmc[26+0],xmc[26+1],xmc[26+2],xmc[26+3],xmc[26+4],xmc[26+5],
- xmc[26+6], xmc[26+7],xmc[26+8],xmc[26+9],xmc[26+10],xmc[26+11],
- xmc[26+12] );
-
- fprintf(f, "#4: Nc %4.4d bc %d Mc %d xmaxc %d\n",
- Nc[3], bc[3], Mc[3], xmaxc[3]);
- fprintf(f,
-"\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n",
- xmc[39+0],xmc[39+1],xmc[39+2],xmc[39+3],xmc[39+4],xmc[39+5],
- xmc[39+6], xmc[39+7],xmc[39+8],xmc[39+9],xmc[39+10],xmc[39+11],
- xmc[39+12] );
-
- return 0;
-}
diff --git a/libs/codec/gsm/src/k6opt.h b/libs/codec/gsm/src/k6opt.h
deleted file mode 100644
index 2a4b118c23..0000000000
--- a/libs/codec/gsm/src/k6opt.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* k6opt.h vector functions optimized for MMX extensions to x86
- *
- * Copyright (C) 1999 by Stanley J. Brooks
- *
- * 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;
- * not even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE.
- *
- * Chicago, 03.12.1999
- * Stanley J. Brooks
- */
-
-extern void Weighting_filter P2((e, x),
- const word * e, /* signal [-5..0.39.44] IN */
- word * x /* signal [0..39] OUT */
-)
-;
-
-extern longword k6maxcc P3((wt,dp,Nc_out),
- const word *wt,
- const word *dp,
- word * Nc_out /* OUT */
-)
-;
-/*
- * k6maxmin(p,n,out[])
- * input p[n] is array of shorts (require n>0)
- * returns (long) maximum absolute value..
- * if out!=NULL, also returns out[0] the maximum and out[1] the minimum
- */
-extern longword k6maxmin P3((p,n,out),
- const word *p,
- int n,
- word *out /* out[0] is max, out[1] is min */
-)
-;
-
-extern longword k6iprod P3((p,q,n),
- const word *p,
- const word *q,
- int n
-)
-;
-
-/*
- * k6vsraw(p,n,bits)
- * input p[n] is array of shorts (require n>0)
- * shift/round each to the right by bits>=0 bits.
- */
-extern void k6vsraw P3((p,n,bits),
- const word *p,
- int n,
- int bits
-)
-;
-
-/*
- * k6vsllw(p,n,bits)
- * input p[n] is array of shorts (require n>0)
- * shift each to the left by bits>=0 bits.
- */
-extern void k6vsllw P3((p,n,bits),
- const word *p,
- int n,
- int bits
-)
-;
-
-#if 1 /* there isn't any significant speed gain from mmx here: */
-extern void Short_term_analysis_filteringx P4((u0,rp0,k_n,s),
- register word * u0,
- register word * rp0, /* [0..7] IN */
- register int k_n, /* k_end - k_start */
- register word * s /* [0..n-1] IN/OUT */
-)
-;
-/*
-#define Short_term_analysis_filtering Short_term_analysis_filteringx
-*/
-#endif
diff --git a/libs/codec/gsm/src/k6opt.s b/libs/codec/gsm/src/k6opt.s
deleted file mode 100644
index 85d28e15b3..0000000000
--- a/libs/codec/gsm/src/k6opt.s
+++ /dev/null
@@ -1,739 +0,0 @@
- .file "k6opt.s"
- .version "01.01"
-/* gcc2_compiled.: */
-.section .rodata
- .align 4
- .type coefs,@object
- .size coefs,24
-coefs:
- .value -134
- .value -374
- .value 0
- .value 2054
- .value 5741
- .value 8192
- .value 5741
- .value 2054
- .value 0
- .value -374
- .value -134
- .value 0
-.text
- .align 4
-/* void Weighting_filter (const short *e, short *x) */
-.globl Weighting_filter
- .type Weighting_filter,@function
-Weighting_filter:
- pushl %ebp
- movl %esp,%ebp
- pushl %edi
- pushl %esi
- pushl %ebx
- movl 12(%ebp),%edi
- movl 8(%ebp),%ebx
- addl $-10,%ebx
- emms
- movl $0x1000,%eax; movd %eax,%mm5 /* for rounding */
- movq coefs,%mm1
- movq coefs+8,%mm2
- movq coefs+16,%mm3
- xorl %esi,%esi
- .p2align 2
-.L21:
- movq (%ebx,%esi,2),%mm0
- pmaddwd %mm1,%mm0
-
- movq 8(%ebx,%esi,2),%mm4
- pmaddwd %mm2,%mm4
- paddd %mm4,%mm0
-
- movq 16(%ebx,%esi,2),%mm4
- pmaddwd %mm3,%mm4
- paddd %mm4,%mm0
-
- movq %mm0,%mm4
- punpckhdq %mm0,%mm4 /* mm4 has high int32 of mm0 dup'd */
- paddd %mm4,%mm0;
-
- paddd %mm5,%mm0 /* add for roundoff */
- psrad $13,%mm0
- packssdw %mm0,%mm0
- movd %mm0,%eax /* ax has result */
- movw %ax,(%edi,%esi,2)
- incl %esi
- cmpl $39,%esi
- jle .L21
- emms
- popl %ebx
- popl %esi
- popl %edi
- leave
- ret
-.Lfe1:
- .size Weighting_filter,.Lfe1-Weighting_filter
-
-.macro ccstep n
-.if \n
- movq \n(%edi),%mm1
- movq \n(%esi),%mm2
-.else
- movq (%edi),%mm1
- movq (%esi),%mm2
-.endif
- pmaddwd %mm2,%mm1
- paddd %mm1,%mm0
-.endm
-
- .align 4
-/* long k6maxcc(const short *wt, const short *dp, short *Nc_out) */
-.globl k6maxcc
- .type k6maxcc,@function
-k6maxcc:
- pushl %ebp
- movl %esp,%ebp
- pushl %edi
- pushl %esi
- pushl %ebx
- emms
- movl 8(%ebp),%edi
- movl 12(%ebp),%esi
- movl $0,%edx /* will be maximum inner-product */
- movl $40,%ebx
- movl %ebx,%ecx /* will be index of max inner-product */
- subl $80,%esi
- .p2align 2
-.L41:
- movq (%edi),%mm0
- movq (%esi),%mm2
- pmaddwd %mm2,%mm0
- ccstep 8
- ccstep 16
- ccstep 24
- ccstep 32
- ccstep 40
- ccstep 48
- ccstep 56
- ccstep 64
- ccstep 72
-
- movq %mm0,%mm1
- punpckhdq %mm0,%mm1 /* mm1 has high int32 of mm0 dup'd */
- paddd %mm1,%mm0;
- movd %mm0,%eax /* eax has result */
-
- cmpl %edx,%eax
- jle .L40
- movl %eax,%edx
- movl %ebx,%ecx
- .p2align 2
-.L40:
- subl $2,%esi
- incl %ebx
- cmpl $120,%ebx
- jle .L41
- movl 16(%ebp),%eax
- movw %cx,(%eax)
- movl %edx,%eax
- emms
- popl %ebx
- popl %esi
- popl %edi
- leave
- ret
-.Lfe2:
- .size k6maxcc,.Lfe2-k6maxcc
-
-
- .align 4
-/* long k6iprod (const short *p, const short *q, int n) */
-.globl k6iprod
- .type k6iprod,@function
-k6iprod:
- pushl %ebp
- movl %esp,%ebp
- pushl %edi
- pushl %esi
- emms
- pxor %mm0,%mm0
- movl 8(%ebp),%esi
- movl 12(%ebp),%edi
- movl 16(%ebp),%eax
- leal -32(%esi,%eax,2),%edx /* edx = top - 32 */
-
- cmpl %edx,%esi; ja .L202
-
- .p2align 2
-.L201:
- ccstep 0
- ccstep 8
- ccstep 16
- ccstep 24
-
- addl $32,%esi
- addl $32,%edi
- cmpl %edx,%esi; jbe .L201
-
- .p2align 2
-.L202:
- addl $24,%edx /* now edx = top-8 */
- cmpl %edx,%esi; ja .L205
-
- .p2align 2
-.L203:
- ccstep 0
-
- addl $8,%esi
- addl $8,%edi
- cmpl %edx,%esi; jbe .L203
-
- .p2align 2
-.L205:
- addl $4,%edx /* now edx = top-4 */
- cmpl %edx,%esi; ja .L207
-
- movd (%edi),%mm1
- movd (%esi),%mm2
- pmaddwd %mm2,%mm1
- paddd %mm1,%mm0
-
- addl $4,%esi
- addl $4,%edi
-
- .p2align 2
-.L207:
- addl $2,%edx /* now edx = top-2 */
- cmpl %edx,%esi; ja .L209
-
- movswl (%edi),%eax
- movd %eax,%mm1
- movswl (%esi),%eax
- movd %eax,%mm2
- pmaddwd %mm2,%mm1
- paddd %mm1,%mm0
-
- .p2align 2
-.L209:
- movq %mm0,%mm1
- punpckhdq %mm0,%mm1 /* mm1 has high int32 of mm0 dup'd */
- paddd %mm1,%mm0;
- movd %mm0,%eax /* eax has result */
-
- emms
- popl %esi
- popl %edi
- leave
- ret
-.Lfe3:
- .size k6iprod,.Lfe3-k6iprod
-
-
- .align 4
-/* void k6vsraw P3((short *p, int n, int bits) */
-.globl k6vsraw
- .type k6vsraw,@function
-k6vsraw:
- pushl %ebp
- movl %esp,%ebp
- pushl %esi
- movl 8(%ebp),%esi
- movl 16(%ebp),%ecx
- andl %ecx,%ecx; jle .L399
- movl 12(%ebp),%eax
- leal -16(%esi,%eax,2),%edx /* edx = top - 16 */
- emms
- movd %ecx,%mm3
- movq ones,%mm2
- psllw %mm3,%mm2; psrlw $1,%mm2
- cmpl %edx,%esi; ja .L306
-
- .p2align 2
-.L302: /* 8 words per iteration */
- movq (%esi),%mm0
- movq 8(%esi),%mm1
- paddsw %mm2,%mm0
- psraw %mm3,%mm0;
- paddsw %mm2,%mm1
- psraw %mm3,%mm1;
- movq %mm0,(%esi)
- movq %mm1,8(%esi)
- addl $16,%esi
- cmpl %edx,%esi
- jbe .L302
-
- .p2align 2
-.L306:
- addl $12,%edx /* now edx = top-4 */
- cmpl %edx,%esi; ja .L310
-
- .p2align 2
-.L308: /* do up to 6 words, two at a time */
- movd (%esi),%mm0
- paddsw %mm2,%mm0
- psraw %mm3,%mm0;
- movd %mm0,(%esi)
- addl $4,%esi
- cmpl %edx,%esi
- jbe .L308
-
- .p2align 2
-.L310:
- addl $2,%edx /* now edx = top-2 */
- cmpl %edx,%esi; ja .L315
-
- movzwl (%esi),%eax
- movd %eax,%mm0
- paddsw %mm2,%mm0
- psraw %mm3,%mm0;
- movd %mm0,%eax
- movw %ax,(%esi)
-
- .p2align 2
-.L315:
- emms
-.L399:
- popl %esi
- leave
- ret
-.Lfe4:
- .size k6vsraw,.Lfe4-k6vsraw
-
- .align 4
-/* void k6vsllw P3((short *p, int n, int bits) */
-.globl k6vsllw
- .type k6vsllw,@function
-k6vsllw:
- pushl %ebp
- movl %esp,%ebp
- pushl %esi
- movl 8(%ebp),%esi
- movl 16(%ebp),%ecx
- andl %ecx,%ecx; jle .L499
- movl 12(%ebp),%eax
- leal -16(%esi,%eax,2),%edx /* edx = top - 16 */
- emms
- movd %ecx,%mm3
- cmpl %edx,%esi; ja .L406
-
- .p2align 2
-.L402: /* 8 words per iteration */
- movq (%esi),%mm0
- movq 8(%esi),%mm1
- psllw %mm3,%mm0;
- psllw %mm3,%mm1;
- movq %mm0,(%esi)
- movq %mm1,8(%esi)
- addl $16,%esi
- cmpl %edx,%esi
- jbe .L402
-
- .p2align 2
-.L406:
- addl $12,%edx /* now edx = top-4 */
- cmpl %edx,%esi; ja .L410
-
- .p2align 2
-.L408: /* do up to 6 words, two at a time */
- movd (%esi),%mm0
- psllw %mm3,%mm0;
- movd %mm0,(%esi)
- addl $4,%esi
- cmpl %edx,%esi
- jbe .L408
-
- .p2align 2
-.L410:
- addl $2,%edx /* now edx = top-2 */
- cmpl %edx,%esi; ja .L415
-
- movzwl (%esi),%eax
- movd %eax,%mm0
- psllw %mm3,%mm0;
- movd %mm0,%eax
- movw %ax,(%esi)
-
- .p2align 2
-.L415:
- emms
-.L499:
- popl %esi
- leave
- ret
-.Lfe5:
- .size k6vsllw,.Lfe5-k6vsllw
-
-
-.section .rodata
- .align 4
- .type extremes,@object
- .size extremes,8
-extremes:
- .long 0x80008000
- .long 0x7fff7fff
- .type ones,@object
- .size ones,8
-ones:
- .long 0x00010001
- .long 0x00010001
-
-.text
- .align 4
-/* long k6maxmin (const short *p, int n, short *out) */
-.globl k6maxmin
- .type k6maxmin,@function
-k6maxmin:
- pushl %ebp
- movl %esp,%ebp
- pushl %esi
- emms
- movl 8(%ebp),%esi
- movl 12(%ebp),%eax
- leal -8(%esi,%eax,2),%edx
-
- cmpl %edx,%esi
- jbe .L52
- movd extremes,%mm0
- movd extremes+4,%mm1
- jmp .L58
-
- .p2align 2
-.L52:
- movq (%esi),%mm0 /* mm0 will be max's */
- movq %mm0,%mm1 /* mm1 will be min's */
- addl $8,%esi
- cmpl %edx,%esi
- ja .L56
-
- .p2align 2
-.L54:
- movq (%esi),%mm2
-
- movq %mm2,%mm3
- pcmpgtw %mm0,%mm3 /* mm3 is bitmask for words where mm2 > mm0 */
- movq %mm3,%mm4
- pand %mm2,%mm3 /* mm3 is mm2 masked to new max's */
- pandn %mm0,%mm4 /* mm4 is mm0 masked to its max's */
- por %mm3,%mm4
- movq %mm4,%mm0 /* now mm0 is updated max's */
-
- movq %mm1,%mm3
- pcmpgtw %mm2,%mm3 /* mm3 is bitmask for words where mm2 < mm1 */
- pand %mm3,%mm2 /* mm2 is mm2 masked to new min's */
- pandn %mm1,%mm3 /* mm3 is mm1 masked to its min's */
- por %mm3,%mm2
- movq %mm2,%mm1 /* now mm1 is updated min's */
-
- addl $8,%esi
- cmpl %edx,%esi
- jbe .L54
-
- .p2align 2
-.L56: /* merge down the 4-word max/mins to lower 2 words */
-
- movq %mm0,%mm2
- psrlq $32,%mm2
- movq %mm2,%mm3
- pcmpgtw %mm0,%mm3 /* mm3 is bitmask for words where mm2 > mm0 */
- pand %mm3,%mm2 /* mm2 is mm2 masked to new max's */
- pandn %mm0,%mm3 /* mm3 is mm0 masked to its max's */
- por %mm3,%mm2
- movq %mm2,%mm0 /* now mm0 is updated max's */
-
- movq %mm1,%mm2
- psrlq $32,%mm2
- movq %mm1,%mm3
- pcmpgtw %mm2,%mm3 /* mm3 is bitmask for words where mm2 < mm1 */
- pand %mm3,%mm2 /* mm2 is mm2 masked to new min's */
- pandn %mm1,%mm3 /* mm3 is mm1 masked to its min's */
- por %mm3,%mm2
- movq %mm2,%mm1 /* now mm1 is updated min's */
-
- .p2align 2
-.L58:
- addl $4,%edx /* now dx = top-4 */
- cmpl %edx,%esi
- ja .L62
- /* here, there are >= 2 words of input remaining */
- movd (%esi),%mm2
-
- movq %mm2,%mm3
- pcmpgtw %mm0,%mm3 /* mm3 is bitmask for words where mm2 > mm0 */
- movq %mm3,%mm4
- pand %mm2,%mm3 /* mm3 is mm2 masked to new max's */
- pandn %mm0,%mm4 /* mm4 is mm0 masked to its max's */
- por %mm3,%mm4
- movq %mm4,%mm0 /* now mm0 is updated max's */
-
- movq %mm1,%mm3
- pcmpgtw %mm2,%mm3 /* mm3 is bitmask for words where mm2 < mm1 */
- pand %mm3,%mm2 /* mm2 is mm2 masked to new min's */
- pandn %mm1,%mm3 /* mm3 is mm1 masked to its min's */
- por %mm3,%mm2
- movq %mm2,%mm1 /* now mm1 is updated min's */
-
- addl $4,%esi
-
- .p2align 2
-.L62:
- /* merge down the 2-word max/mins to 1 word */
-
- movq %mm0,%mm2
- psrlq $16,%mm2
- movq %mm2,%mm3
- pcmpgtw %mm0,%mm3 /* mm3 is bitmask for words where mm2 > mm0 */
- pand %mm3,%mm2 /* mm2 is mm2 masked to new max's */
- pandn %mm0,%mm3 /* mm3 is mm0 masked to its max's */
- por %mm3,%mm2
- movd %mm2,%ecx /* cx is max so far */
-
- movq %mm1,%mm2
- psrlq $16,%mm2
- movq %mm1,%mm3
- pcmpgtw %mm2,%mm3 /* mm3 is bitmask for words where mm2 < mm1 */
- pand %mm3,%mm2 /* mm2 is mm2 masked to new min's */
- pandn %mm1,%mm3 /* mm3 is mm1 masked to its min's */
- por %mm3,%mm2
- movd %mm2,%eax /* ax is min so far */
-
- addl $2,%edx /* now dx = top-2 */
- cmpl %edx,%esi
- ja .L65
-
- /* here, there is one word of input left */
- cmpw (%esi),%cx
- jge .L64
- movw (%esi),%cx
- .p2align 2
-.L64:
- cmpw (%esi),%ax
- jle .L65
- movw (%esi),%ax
-
- .p2align 2
-.L65: /* (finally!) cx is the max, ax the min */
- movswl %cx,%ecx
- movswl %ax,%eax
-
- movl 16(%ebp),%edx /* ptr to output max,min vals */
- andl %edx,%edx; jz .L77
- movw %cx,(%edx) /* max */
- movw %ax,2(%edx) /* min */
- .p2align 2
-.L77:
- /* now calculate max absolute val */
- negl %eax
- cmpl %ecx,%eax
- jge .L81
- movl %ecx,%eax
- .p2align 2
-.L81:
- emms
- popl %esi
- leave
- ret
-.Lfe6:
- .size k6maxmin,.Lfe6-k6maxmin
-
-/* void Short_term_analysis_filtering (short *u0, const short *rp0, int kn, short *s) */
- .equiv pm_u0,8
- .equiv pm_rp0,12
- .equiv pm_kn,16
- .equiv pm_s,20
- .equiv lv_u_top,-4
- .equiv lv_s_top,-8
- .equiv lv_rp,-40 /* local version of rp0 with each word twice */
- .align 4
-.globl Short_term_analysis_filteringx
- .type Short_term_analysis_filteringx,@function
-Short_term_analysis_filteringx:
- pushl %ebp
- movl %esp,%ebp
- subl $40,%esp
- pushl %edi
- pushl %esi
-
- movl pm_rp0(%ebp),%esi;
- leal lv_rp(%ebp),%edi;
- cld
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- emms
- movl $0x4000,%eax;
- movd %eax,%mm4;
- punpckldq %mm4,%mm4 /* (0x00004000,0x00004000) for rounding dword product pairs */
-
- movl pm_u0(%ebp),%eax
- addl $16,%eax
- movl %eax,lv_u_top(%ebp) /* UTOP */
- movl pm_s(%ebp),%edx /* edx is local s ptr throughout below */
- movl pm_kn(%ebp),%eax
- leal (%edx,%eax,2),%eax
- movl %eax,lv_s_top(%ebp)
- cmpl %eax,%edx
- jae .L179
- .p2align 2
-.L181:
- leal lv_rp(%ebp),%esi /* RP */
- movl pm_u0(%ebp),%edi /* U */
- movw (%edx),%ax /* (0,DI) */
- roll $16,%eax
- movw (%edx),%ax /* (DI,DI) */
- .p2align 2
-.L185: /* RP is %esi */
- movl %eax,%ecx
- movw (%edi),%ax /* (DI,U) */
- movd (%esi),%mm3 /* mm3 is (0,0,RP,RP) */
- movw %cx,(%edi)
-
- movd %eax,%mm2 /* mm2 is (0,0,DI,U) */
- rorl $16,%eax
- movd %eax,%mm1 /* mm1 is (0,0,U,DI) */
-
- movq %mm1,%mm0
- pmullw %mm3,%mm0
- pmulhw %mm3,%mm1
- punpcklwd %mm1,%mm0 /* mm0 is (RP*U,RP*DI) */
- paddd %mm4,%mm0 /* mm4 is 0x00004000,0x00004000 */
- psrad $15,%mm0 /* (RP*U,RP*DI) adjusted */
- packssdw %mm0,%mm0 /* (*,*,RP*U,RP*DI) adjusted and saturated to word */
- paddsw %mm2,%mm0 /* mm0 is (?,?, DI', U') */
- movd %mm0,%eax /* (DI,U') */
-
- addl $2,%edi
- addl $4,%esi
- cmpl lv_u_top(%ebp),%edi
- jb .L185
-
- rorl $16,%eax
- movw %ax,(%edx) /* last DI goes to *s */
- addl $2,%edx /* next s */
- cmpl lv_s_top(%ebp),%edx
- jb .L181
- .p2align 2
-.L179:
- emms
- popl %esi
- popl %edi
- leave
- ret
-.Lfe7:
- .size Short_term_analysis_filteringx,.Lfe7-Short_term_analysis_filteringx
-
-.end
-
-/* 'as' macro's seem to be case-insensitive */
-.macro STEP n
-.if \n
- movd \n(%esi),%mm3 /* mm3 is (0,0,RP,RP) */
-.else
- movd (%esi),%mm3 /* mm3 is (0,0,RP,RP) */
-.endif
- movq %mm5,%mm1;
- movd %mm4,%ecx; movw %cx,%ax /* (DI,U) */
- psllq $48,%mm1; psrlq $16,%mm4; por %mm1,%mm4
- psllq $48,%mm0; psrlq $16,%mm5; por %mm0,%mm5
-
- movd %eax,%mm2 /* mm2 is (0,0,DI,U) */
- rorl $16,%eax
- movd %eax,%mm1 /* mm1 is (0,0,U,DI) */
-
- movq %mm1,%mm0
- pmullw %mm3,%mm0
- pmulhw %mm3,%mm1
- punpcklwd %mm1,%mm0 /* mm0 is (RP*U,RP*DI) */
- paddd %mm6,%mm0 /* mm6 is 0x00004000,0x00004000 */
- psrad $15,%mm0 /* (RP*U,RP*DI) adjusted */
- packssdw %mm0,%mm0 /* (*,*,RP*U,RP*DI) adjusted and saturated to word */
- paddsw %mm2,%mm0 /* mm0 is (?,?, DI', U') */
- movd %mm0,%eax /* (DI,U') */
-.endm
-
-/* void Short_term_analysis_filtering (short *u0, const short *rp0, int kn, short *s) */
- .equiv pm_u0,8
- .equiv pm_rp0,12
- .equiv pm_kn,16
- .equiv pm_s,20
- .equiv lv_rp_top,-4
- .equiv lv_s_top,-8
- .equiv lv_rp,-40 /* local version of rp0 with each word twice */
- .align 4
-.globl Short_term_analysis_filteringx
- .type Short_term_analysis_filteringx,@function
-Short_term_analysis_filteringx:
- pushl %ebp
- movl %esp,%ebp
- subl $56,%esp
- pushl %edi
- pushl %esi
- pushl %ebx
-
- movl pm_rp0(%ebp),%esi;
- leal lv_rp(%ebp),%edi;
- cld
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- lodsw; stosw; stosw
- movl %edi,lv_rp_top(%ebp)
- emms
-
- movl $0x4000,%eax;
- movd %eax,%mm6;
- punpckldq %mm6,%mm6 /* (0x00004000,0x00004000) for rounding dword product pairs */
-
- movl pm_u0(%ebp),%ebx
- movq (%ebx),%mm4; movq 8(%ebx),%mm5 /* the 8 u's */
- movl pm_s(%ebp),%edx /* edx is local s ptr throughout below */
- movl pm_kn(%ebp),%eax
- leal (%edx,%eax,2),%eax
- movl %eax,lv_s_top(%ebp)
- cmpl %eax,%edx
- jae .L179
- .p2align 2
-.L181:
- leal lv_rp(%ebp),%esi /* RP */
- movw (%edx),%ax /* (0,DI) */
- roll $16,%eax
- movw (%edx),%ax /* (DI,DI) */
- movd %eax,%mm0
- .p2align 2
-.L185: /* RP is %esi */
- step 0
- step 4
- step 8
- step 12
-/*
- step 16
- step 20
- step 24
- step 28
-*/
- addl $16,%esi
- cmpl lv_rp_top(%ebp),%esi
- jb .L185
-
- rorl $16,%eax
- movw %ax,(%edx) /* last DI goes to *s */
- addl $2,%edx /* next s */
- cmpl lv_s_top(%ebp),%edx
- jb .L181
-.L179:
- movq %mm4,(%ebx); movq %mm5,8(%ebx) /* the 8 u's */
- emms
- popl %ebx
- popl %esi
- popl %edi
- leave
- ret
-.Lfe7:
- .size Short_term_analysis_filteringx,.Lfe7-Short_term_analysis_filteringx
- .ident "GCC: (GNU) 2.95.2 19991109 (Debian GNU/Linux)"
diff --git a/libs/codec/gsm/src/long_term.c b/libs/codec/gsm/src/long_term.c
index 3965e96925..3239fef52c 100644
--- a/libs/codec/gsm/src/long_term.c
+++ b/libs/codec/gsm/src/long_term.c
@@ -1,10 +1,11 @@
/*
+ * long_term.c
+ *
* 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$ */
#include
#include
@@ -13,9 +14,7 @@
#include "gsm.h"
#include "proto.h"
-#ifdef K6OPT
-#include "k6opt.h"
-#endif
+
/*
* 4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION
*/
@@ -199,9 +198,6 @@ static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
/* Search for the maximum cross-correlation and coding of the LTP lag
*/
-# ifdef K6OPT
- L_max = k6maxcc(wt,dp,&Nc);
-# else
L_max = 0;
Nc = 40; /* index for the maximum cross-correlation */
@@ -239,7 +235,7 @@ static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
L_max = L_result;
}
}
-# endif
+
*Nc_out = Nc;
L_max <<= 1;
@@ -278,8 +274,8 @@ static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
temp = gsm_norm( L_power );
- R = (word)SASR( L_max << temp, 16 );
- S = (word)SASR( L_power << temp, 16 );
+ R = (word) SASR( L_max << temp, 16 );
+ S = (word) SASR( L_power << temp, 16 );
/* Coding of the LTP gain
*/
@@ -852,12 +848,13 @@ static void Long_term_analysis_filtering P6((bc,Nc,dp,d,dpp,e),
*/
{
register int k;
+ register longword ltmp;
# undef STEP
# define STEP(BP) \
for (k = 0; k <= 39; k++) { \
- dpp[k] = (word)GSM_MULT_R( BP, dp[k - Nc]); \
- e[k] = GSM_SUB( d[k], dpp[k] ); \
+ dpp[k] = (word) GSM_MULT_R( BP, dp[k - Nc]); \
+ e[k] = (word) GSM_SUB( d[k], dpp[k] ); \
}
switch (bc) {
@@ -920,6 +917,7 @@ void Gsm_Long_Term_Synthesis_Filtering P5((S,Ncr,bcr,erp,drp),
* table 4.3b.
*/
{
+ register longword ltmp; /* for ADD */
register int k;
word brp, drpp, Nr;
@@ -939,8 +937,8 @@ void Gsm_Long_Term_Synthesis_Filtering P5((S,Ncr,bcr,erp,drp),
assert(brp != MIN_WORD);
for (k = 0; k <= 39; k++) {
- drpp = (word)GSM_MULT_R( brp, drp[ k - Nr ] );
- drp[k] = GSM_ADD( erp[k], drpp );
+ drpp = (word) GSM_MULT_R( brp, drp[ k - Nr ] );
+ drp[k] = (word) GSM_ADD( erp[k], drpp );
}
/*
diff --git a/libs/codec/gsm/src/preprocess.c b/libs/codec/gsm/src/preprocess.c
index 2036054490..bebc7c33c2 100644
--- a/libs/codec/gsm/src/preprocess.c
+++ b/libs/codec/gsm/src/preprocess.c
@@ -1,10 +1,11 @@
/*
+ * preprocess.c
+ *
* 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$ */
#include
#include
@@ -42,10 +43,14 @@ void Gsm_Preprocess P3((S, s, so),
word mp = S->mp;
word s1;
+ longword L_s2;
+ longword L_temp;
+ word msp, lsp;
word SO;
+ longword ltmp; /* for ADD */
ulongword utmp; /* for L_ADD */
register int k = 160;
@@ -54,8 +59,7 @@ void Gsm_Preprocess P3((S, s, so),
/* 4.2.1 Downscaling of the input signal
*/
- /* SO = SASR( *s, 3 ) << 2;*/
- SO = SASR( *s, 1 ) & ~3;
+ SO = SASR( *s, 3 ) << 2;
s++;
assert (SO >= -0x4000); /* downscaled by */
@@ -77,41 +81,21 @@ void Gsm_Preprocess P3((S, s, so),
assert(s1 != MIN_WORD);
- /* SJB Remark: float might be faster than the mess that follows */
-
/* Compute the recursive part
*/
+ L_s2 = s1;
+ L_s2 <<= 15;
/* Execution of a 31 bv 16 bits multiplication
*/
- {
- word msp;
-#ifndef __GNUC__
- word lsp;
-#endif
- longword L_s2;
- longword L_temp;
-
- L_s2 = s1;
- L_s2 <<= 15;
-#ifndef __GNUC__
- msp = (word)SASR( L_z2, 15 );
- lsp = (word)(L_z2 & 0x7fff); /* gsm_L_sub(L_z2,(msp<<15)); */
+
+ msp = (word) SASR( L_z2, 15 );
+ lsp = (word) (L_z2-((longword)msp<<15)); /* gsm_L_sub(L_z2,(msp<<15)); */
L_s2 += GSM_MULT_R( lsp, 32735 );
L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/
L_z2 = GSM_L_ADD( L_temp, L_s2 );
- /* above does L_z2 = L_z2 * 0x7fd5/0x8000 + L_s2 */
-#else
- L_z2 = ((long long)L_z2*32735 + 0x4000)>>15;
- /* alternate (ansi) version of above line does slightly different rounding:
- * L_temp = L_z2 >> 9;
- * L_temp += L_temp >> 5;
- * L_temp = (++L_temp) >> 1;
- * L_z2 = L_z2 - L_temp;
- */
- L_z2 = GSM_L_ADD(L_z2,L_s2);
-#endif
+
/* Compute sof[k] with rounding
*/
L_temp = GSM_L_ADD( L_z2, 16384 );
@@ -119,10 +103,9 @@ void Gsm_Preprocess P3((S, s, so),
/* 4.2.3 Preemphasis
*/
- msp = (word)GSM_MULT_R( mp, -28180 );
- mp = (word)SASR( L_temp, 15 );
- *so++ = GSM_ADD( mp, msp );
- }
+ msp = (word) GSM_MULT_R( mp, -28180 );
+ mp = (word) SASR( L_temp, 15 );
+ *so++ = (word) GSM_ADD( mp, msp );
}
S->z1 = z1;
diff --git a/libs/codec/gsm/src/rpe.c b/libs/codec/gsm/src/rpe.c
index ec0fc300d1..f5648a24a3 100644
--- a/libs/codec/gsm/src/rpe.c
+++ b/libs/codec/gsm/src/rpe.c
@@ -1,10 +1,11 @@
/*
+ * rpe.c
+ *
* 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$ */
#include
#include
@@ -18,9 +19,7 @@
*/
/* 4.2.13 */
-#ifdef K6OPT
-#include "k6opt.h"
-#else
+
static void Weighting_filter P2((e, x),
register word * e, /* signal [-5..0.39.44] IN */
word * x /* signal [0..39] OUT */
@@ -108,11 +107,10 @@ static void Weighting_filter P2((e, x),
*/
L_result = SASR( L_result, 13 );
- x[k] = (word)( L_result < MIN_WORD ? MIN_WORD
- : (L_result > MAX_WORD ? MAX_WORD : L_result ));
+ x[k] = (word) (( L_result < MIN_WORD ? MIN_WORD
+ : (L_result > MAX_WORD ? MAX_WORD : L_result )));
}
}
-#endif /* K6OPT */
/* 4.2.14 */
@@ -334,7 +332,7 @@ static void APCM_quantization P5((xM,xMc,mant_out,exp_out,xmaxc_out),
assert(temp1 >= 0 && temp1 < 16);
temp = xM[i] << temp1;
- temp = (word)GSM_MULT( temp, temp2 );
+ temp = (word) GSM_MULT( temp, temp2 );
temp = SASR(temp, 12);
xMc[i] = temp + 4; /* see note below */
}
@@ -362,6 +360,7 @@ static void APCM_inverse_quantization P4((xMc,mant,exp,xMp),
{
int i;
word temp, temp1, temp2, temp3;
+ longword ltmp;
assert( mant >= 0 && mant <= 7 );
@@ -378,8 +377,8 @@ static void APCM_inverse_quantization P4((xMc,mant,exp,xMp),
assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */
temp <<= 12; /* 16 bit signed */
- temp = (word)GSM_MULT_R( temp1, temp );
- temp = GSM_ADD( temp, temp3 );
+ temp = (word) GSM_MULT_R( temp1, temp );
+ temp = (word) GSM_ADD( temp, temp3 );
*xMp++ = gsm_asr( temp, temp2 );
}
}
diff --git a/libs/codec/gsm/src/short_term.c b/libs/codec/gsm/src/short_term.c
index 32a86727e1..efb0b7b488 100644
--- a/libs/codec/gsm/src/short_term.c
+++ b/libs/codec/gsm/src/short_term.c
@@ -1,10 +1,11 @@
/*
+ * short_term.c
+ *
* 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$ */
#include
#include
@@ -13,12 +14,7 @@
#include "gsm.h"
#include "proto.h"
-#ifdef K6OPT
-#include "k6opt.h"
-#define Short_term_analysis_filtering Short_term_analysis_filteringx
-
-#endif
/*
* SHORT TERM ANALYSIS FILTERING SECTION
*/
@@ -30,6 +26,7 @@ static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp),
word * LARpp) /* out: decoded .. */
{
register word temp1 /* , temp2 */;
+ register long ltmp; /* for GSM_ADD */
/* This procedure requires for efficient implementation
* two tables.
@@ -56,10 +53,10 @@ static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp),
#undef STEP
#define STEP( B, MIC, INVA ) \
- temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
- temp1 = GSM_SUB( temp1, B << 1 ); \
- temp1 = (word)GSM_MULT_R( INVA, temp1 ); \
- *LARpp++ = GSM_ADD( temp1, temp1 );
+ temp1 = (word) GSM_ADD( *LARc++, MIC ) << 10; \
+ temp1 = (word) GSM_SUB( temp1, B << 1 ); \
+ temp1 = (word) GSM_MULT_R( INVA, temp1 ); \
+ *LARpp++ = (word) GSM_ADD( temp1, temp1 );
STEP( 0, -32, 13107 );
STEP( 0, -32, 13107 );
@@ -98,10 +95,11 @@ static void Coefficients_0_12 P3((LARpp_j_1, LARpp_j, LARp),
register word * LARp)
{
register int i;
+ register longword ltmp;
for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) {
- *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
- *LARp = GSM_ADD( *LARp, SASR( *LARpp_j_1, 1));
+ *LARp = (word) GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
+ *LARp = (word) GSM_ADD( *LARp, SASR( *LARpp_j_1, 1));
}
}
@@ -111,8 +109,9 @@ static void Coefficients_13_26 P3((LARpp_j_1, LARpp_j, LARp),
register word * LARp)
{
register int i;
+ register longword ltmp;
for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
- *LARp = GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 ));
+ *LARp = (word) GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 ));
}
}
@@ -122,10 +121,11 @@ static void Coefficients_27_39 P3((LARpp_j_1, LARpp_j, LARp),
register word * LARp)
{
register int i;
+ register longword ltmp;
for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
- *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
- *LARp = GSM_ADD( *LARp, SASR( *LARpp_j, 1 ));
+ *LARp = (word) GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
+ *LARp = (word) GSM_ADD( *LARp, SASR( *LARpp_j, 1 ));
}
}
@@ -152,6 +152,7 @@ static void LARp_to_rp P1((LARp),
{
register int i;
register word temp;
+ register longword ltmp;
for (i = 1; i <= 8; i++, LARp++) {
@@ -168,28 +169,21 @@ static void LARp_to_rp P1((LARp),
temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp);
*LARp = - ((temp < 11059) ? temp << 1
: ((temp < 20070) ? temp + 11059
- : GSM_ADD( temp >> 2, 26112 )));
+ : (word) GSM_ADD( temp >> 2, 26112 )));
} else {
temp = *LARp;
*LARp = (temp < 11059) ? temp << 1
: ((temp < 20070) ? temp + 11059
- : GSM_ADD( temp >> 2, 26112 ));
+ : (word) GSM_ADD( temp >> 2, 26112 ));
}
}
}
/* 4.2.10 */
-#ifndef Short_term_analysis_filtering
-
-/* SJB Remark:
- * I tried 2 MMX versions of this function, neither is significantly
- * faster than the C version which follows. MMX might be useful if
- * one were processing 2 input streams in parallel.
- */
-static void Short_term_analysis_filtering P4((u0,rp0,k_n,s),
- register word * u0,
- register word * rp0, /* [0..7] IN */
+static void Short_term_analysis_filtering P4((S,rp,k_n,s),
+ struct gsm_state * S,
+ register word * rp, /* [0..7] IN */
register int k_n, /* k_end - k_start */
register word * s /* [0..n-1] IN/OUT */
)
@@ -201,45 +195,45 @@ static void Short_term_analysis_filtering P4((u0,rp0,k_n,s),
* coefficient), it is assumed that the computation begins with index
* k_start (for arrays d[..] and s[..]) and stops with index k_end
* (k_start and k_end are defined in 4.2.9.1). This procedure also
- * needs to keep the array u0[0..7] in memory for each call.
+ * needs to keep the array u[0..7] in memory for each call.
*/
{
- register word * u_top = u0 + 8;
- register word * s_top = s + k_n;
+ register word * u = S->u;
+ register int i;
+ register word di, zzz, ui, sav, rpi;
+ register longword ltmp;
- while (s < s_top) {
- register word *u, *rp ;
- register longword di, u_out;
- di = u_out = *s;
- for (rp=rp0, u=u0; u>15);
- di = di + (((rpi*ui)+0x4000)>>15);
- /* make the common case fastest: */
- if ((u_out == (word)u_out) && (di == (word)di)) continue;
- /* otherwise do slower fixup (saturation) */
- if (u_out>MAX_WORD) u_out=MAX_WORD;
- else if (u_outMAX_WORD) di=MAX_WORD;
- else if (diu;
register int i;
float uf[8],
@@ -269,15 +263,6 @@ static void Fast_Short_term_analysis_filtering P4((u,rp,k_n,s),
}
#endif /* ! (defined (USE_FLOAT_MUL) && defined (FAST)) */
-/*
- * SJB Remark: modified Short_term_synthesis_filtering() below
- * for significant (abt 35%) speedup of decompression.
- * (gcc-2.95, k6 cpu)
- * Please don't change this without benchmarking decompression
- * to see that you haven't harmed speed.
- * This function burns most of CPU time for untoasting.
- * Unfortunately, didn't see any good way to benefit from mmx.
- */
static void Short_term_synthesis_filtering P5((S,rrp,k,wt,sr),
struct gsm_state * S,
register word * rrp, /* [0..7] IN */
@@ -288,36 +273,34 @@ static void Short_term_synthesis_filtering P5((S,rrp,k,wt,sr),
{
register word * v = S->v;
register int i;
- register longword sri;
+ register word sri, tmp1, tmp2;
+ register longword ltmp; /* for GSM_ADD & GSM_SUB */
while (k--) {
sri = *wt++;
for (i = 8; i--;) {
- register longword tmp1, tmp2;
/* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) );
*/
tmp1 = rrp[i];
tmp2 = v[i];
+ tmp2 = (word) ( tmp1 == MIN_WORD && tmp2 == MIN_WORD
+ ? MAX_WORD
+ : 0x0FFFF & (( (longword)tmp1 * (longword)tmp2
+ + 16384) >> 15)) ;
+
+ sri = (word) GSM_SUB( sri, tmp2 );
- tmp2 = (( tmp1 * tmp2 + 16384) >> 15) ;
- /* saturation done below */
- sri -= tmp2;
- if (sri != (word)sri) {
- sri = (sri<0)? MIN_WORD:MAX_WORD;
- }
/* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) );
*/
+ tmp1 = (word) ( tmp1 == MIN_WORD && sri == MIN_WORD
+ ? MAX_WORD
+ : 0x0FFFF & (( (longword)tmp1 * (longword)sri
+ + 16384) >> 15)) ;
- tmp1 = (( tmp1 * sri + 16384) >> 15) ;
- /* saturation done below */
- tmp1 += v[i];
- if (tmp1 != (word)tmp1) {
- tmp1 = (tmp1<0)? MIN_WORD:MAX_WORD;
- }
- v[i+1] = (word)tmp1;
+ v[i+1] = (word) GSM_ADD( v[i], tmp1);
}
- *sr++ = v[0] = (word)sri;
+ *sr++ = v[0] = sri;
}
}
@@ -388,20 +371,19 @@ void Gsm_Short_Term_Analysis_Filter P3((S,LARc,s),
Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
LARp_to_rp( LARp );
- FILTER( S->u, LARp, 13, s);
+ FILTER( S, LARp, 13, s);
Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
LARp_to_rp( LARp );
- FILTER( S->u, LARp, 14, s + 13);
+ FILTER( S, LARp, 14, s + 13);
Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
LARp_to_rp( LARp );
- FILTER( S->u, LARp, 13, s + 27);
+ FILTER( S, LARp, 13, s + 27);
Coefficients_40_159( LARpp_j, LARp);
LARp_to_rp( LARp );
- FILTER( S->u, LARp, 120, s + 40);
-
+ FILTER( S, LARp, 120, s + 40);
}
void Gsm_Short_Term_Synthesis_Filter P4((S, LARcr, wt, s),
diff --git a/libs/codec/gsm/src/table.c b/libs/codec/gsm/src/table.c
index bdca9fa4d0..e54c9bfe5b 100644
--- a/libs/codec/gsm/src/table.c
+++ b/libs/codec/gsm/src/table.c
@@ -1,10 +1,11 @@
/*
+ * table.c
+ *
* 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$ */
/* Most of these tables are inlined at their point of use.
*/