diff --git a/etsi_codec-patches/README b/etsi_codec-patches/README new file mode 100644 index 0000000..7206947 --- /dev/null +++ b/etsi_codec-patches/README @@ -0,0 +1,6 @@ +This directory contains a series of patches against the TETRA codec reference +source code as published by the ETSI at in the file named + en_30039502v010301p0.zip + +Due to the use of uppercase file names in the zip file, you should use the "-L" +flag to the unzip program, which ensures all files are completely lower-case. diff --git a/etsi_codec-patches/build_as_32bit.patch b/etsi_codec-patches/build_as_32bit.patch new file mode 100644 index 0000000..3613f0e --- /dev/null +++ b/etsi_codec-patches/build_as_32bit.patch @@ -0,0 +1,26 @@ +Index: etsi/amr-code/makefile +=================================================================== +--- etsi.orig/amr-code/makefile 2011-05-29 11:40:11.000000000 +0200 ++++ etsi/amr-code/makefile 2011-05-29 11:40:17.000000000 +0200 +@@ -21,7 +21,7 @@ + + CC=gcc + +-CFLAGS = -g -I. -Wall ++CFLAGS = -g -I. -Wall -m32 + + SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ + tetra_op.c +Index: etsi/c-code/makefile +=================================================================== +--- etsi.orig/c-code/makefile 2011-05-29 11:40:02.000000000 +0200 ++++ etsi/c-code/makefile 2011-05-29 11:40:07.000000000 +0200 +@@ -23,7 +23,7 @@ + + CC=gcc + +-CFLAGS = -I. -Wall ++CFLAGS = -I. -Wall -m32 + + SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ + sub_dsp.c fbas_tet.c fexp_tet.c \ diff --git a/etsi_codec-patches/filename-case.patch b/etsi_codec-patches/filename-case.patch new file mode 100644 index 0000000..ccbce30 --- /dev/null +++ b/etsi_codec-patches/filename-case.patch @@ -0,0 +1,20 @@ +Index: etsi/amr-code/init_params.c +=================================================================== +--- etsi.orig/amr-code/init_params.c 2011-05-29 12:11:52.000000000 +0200 ++++ etsi/amr-code/init_params.c 2011-05-29 12:11:21.000000000 +0200 +@@ -26,11 +26,11 @@ + #include "const.tab" /* contains constants for channel coding/decoding */ + #include "arrays.h" /* contains constants for channel coding/decoding */ + +-#include "const_TETRA.tab" /* contains constants for channel coding/decoding */ +-#include "arrays_TETRA.tab" /* contains arrays for channel coding/decoding */ ++#include "const_tetra.tab" /* contains constants for channel coding/decoding */ ++#include "arrays_tetra.tab" /* contains arrays for channel coding/decoding */ + +-#include "const_AMR475.tab" /* contains constants for channel coding/decoding */ +-#include "arrays_AMR475.tab" /* contains arrays for channel coding/decoding */ ++#include "const_amr475.tab" /* contains constants for channel coding/decoding */ ++#include "arrays_amr475.tab" /* contains arrays for channel coding/decoding */ + + #define ALLOW_NEG(x) (((x) < 0) ? (((-x)%2 == 1) ? (-x)/2 - N1_2 + 1 : (x)/2 + 1) : (x)) + diff --git a/etsi_codec-patches/makefile-cleanups.patch b/etsi_codec-patches/makefile-cleanups.patch new file mode 100644 index 0000000..1120dce --- /dev/null +++ b/etsi_codec-patches/makefile-cleanups.patch @@ -0,0 +1,66 @@ +Index: etsi/amr-code/makefile +=================================================================== +--- etsi.orig/amr-code/makefile 2011-05-29 11:38:48.000000000 +0200 ++++ etsi/amr-code/makefile 2011-05-29 11:38:50.000000000 +0200 +@@ -21,7 +21,7 @@ + + CC=gcc + +-CFLAGS = -g -I. ++CFLAGS = -g -I. -Wall + + SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ + tetra_op.c +@@ -33,10 +33,10 @@ + + all: ccoder cdecoder + +-ccoder: ++ccoder: $(SRCS1) + $(CC) $(SRCS1) $(CFLAGS) -o ccoder + +-cdecoder: ++cdecoder: $(SRCS2) + $(CC) $(SRCS2) $(CFLAGS) -o cdecoder + + clean: +Index: etsi/c-code/makefile +=================================================================== +--- etsi.orig/c-code/makefile 2011-05-29 11:38:59.000000000 +0200 ++++ etsi/c-code/makefile 2011-05-29 11:39:31.000000000 +0200 +@@ -21,9 +21,9 @@ + + # macro definitions + +-CC=acc ++CC=gcc + +-CFLAGS = -I. ++CFLAGS = -I. -Wall + + SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ + sub_dsp.c fbas_tet.c fexp_tet.c \ +@@ -43,18 +43,18 @@ + + all: scoder ccoder sdecoder cdecoder + +-scoder: ++scoder: $(SRCS1) + $(CC) $(SRCS1) $(CFLAGS) -o scoder + +-ccoder: ++ccoder: $(SRCS2) + $(CC) $(SRCS2) $(CFLAGS) -o ccoder + +-sdecoder: ++sdecoder: $(SRCS3) + $(CC) $(SRCS3) $(CFLAGS) -o sdecoder + +-cdecoder: ++cdecoder: $(SRCS4) + $(CC) $(SRCS4) $(CFLAGS) -o cdecoder + + clean: +- rm -f core *.o ++ rm -f core *.o cdecoder sdecoder ccoder scoder + diff --git a/etsi_codec-patches/round_private.patch b/etsi_codec-patches/round_private.patch new file mode 100644 index 0000000..d62f0f9 --- /dev/null +++ b/etsi_codec-patches/round_private.patch @@ -0,0 +1,174 @@ +Index: etsi/amr-code/channel.h +=================================================================== +--- etsi.orig/amr-code/channel.h 2011-05-29 11:42:12.000000000 +0200 ++++ etsi/amr-code/channel.h 2011-05-29 11:42:23.000000000 +0200 +@@ -139,7 +139,7 @@ + Word16 negate(Word16 var1); /* Short negate, 1 */ + Word16 norm_l(Word32 L_var1); /* Long norm, 30 */ + Word16 norm_s(Word16 var1); /* Short norm, 15 */ +-Word16 round(Word32 L_var1); /* Round, 1 */ ++Word16 etsi_round(Word32 L_var1); /* Round, 1 */ + Word16 shl(Word16 var1, Word16 var2); /* Short shift left, 1 */ + Word16 shr(Word16 var1, Word16 var2); /* Short shift right, 1 */ + Word16 sub(Word16 var1, Word16 var2); /* Short sub, 1 */ +Index: etsi/amr-code/source.h +=================================================================== +--- etsi.orig/amr-code/source.h 2011-05-29 11:41:07.000000000 +0200 ++++ etsi/amr-code/source.h 2011-05-29 11:41:20.000000000 +0200 +@@ -164,7 +164,7 @@ + Word16 negate(Word16 var1); /* Short negate, 1 */ + Word16 norm_l(Word32 L_var1); /* Long norm, 30 */ + Word16 norm_s(Word16 var1); /* Short norm, 15 */ +-Word16 round(Word32 L_var1); /* Round, 1 */ ++Word16 etsi_round(Word32 L_var1); /* Round, 1 */ + Word16 shl(Word16 var1, Word16 var2); /* Short shift left, 1 */ + Word16 shr(Word16 var1, Word16 var2); /* Short shift right, 1 */ + Word16 sub(Word16 var1, Word16 var2); /* Short sub, 1 */ +Index: etsi/amr-code/tetra_op.c +=================================================================== +--- etsi.orig/amr-code/tetra_op.c 2011-05-29 11:41:07.000000000 +0200 ++++ etsi/amr-code/tetra_op.c 2011-05-29 11:41:54.000000000 +0200 +@@ -31,7 +31,7 @@ + * - negate() + * - norm_l() + * - norm_s() +-* - round() ++* - etsi_round() + * - sature() + * - shl() + * - shr() +@@ -1336,14 +1336,14 @@ + + /************************************************************************ + * +-* Function Name : round ++* Function Name : etsi_round + * + * Purpose : + * + * Round the lower 16 bits of the 32 bit input number into its MS 16 bits + * with saturation. Shift the resulting bits right by 16 and return the 16 + * bit number: +-* round(L_var1) = extract_h(L_add(L_var1,32768)) ++* etsi_round(L_var1) = extract_h(L_add(L_var1,32768)) + * + * Complexity Weight : 1 + * +@@ -1365,7 +1365,7 @@ + * + ************************************************************************/ + +-Word16 round(Word32 L_var1) ++Word16 etsi_round(Word32 L_var1) + { + Word16 var_out; + Word32 L_arrondi; +Index: etsi/c-code/channel.h +=================================================================== +--- etsi.orig/c-code/channel.h 2011-05-29 11:46:28.000000000 +0200 ++++ etsi/c-code/channel.h 2011-05-29 11:46:57.000000000 +0200 +@@ -130,7 +130,7 @@ + Word16 negate(Word16 var1); /* Short negate, 1 */ + Word16 norm_l(Word32 L_var1); /* Long norm, 30 */ + Word16 norm_s(Word16 var1); /* Short norm, 15 */ +-Word16 round(Word32 L_var1); /* Round, 1 */ ++Word16 etsi_round(Word32 L_var1); /* Round, 1 */ + Word16 shl(Word16 var1, Word16 var2); /* Short shift left, 1 */ + Word16 shr(Word16 var1, Word16 var2); /* Short shift right, 1 */ + Word16 sub(Word16 var1, Word16 var2); /* Short sub, 1 */ +Index: etsi/c-code/source.h +=================================================================== +--- etsi.orig/c-code/source.h 2011-05-29 11:46:28.000000000 +0200 ++++ etsi/c-code/source.h 2011-05-29 11:47:06.000000000 +0200 +@@ -164,7 +164,7 @@ + Word16 negate(Word16 var1); /* Short negate, 1 */ + Word16 norm_l(Word32 L_var1); /* Long norm, 30 */ + Word16 norm_s(Word16 var1); /* Short norm, 15 */ +-Word16 round(Word32 L_var1); /* Round, 1 */ ++Word16 etsi_round(Word32 L_var1); /* Round, 1 */ + Word16 shl(Word16 var1, Word16 var2); /* Short shift left, 1 */ + Word16 shr(Word16 var1, Word16 var2); /* Short shift right, 1 */ + Word16 sub(Word16 var1, Word16 var2); /* Short sub, 1 */ +Index: etsi/c-code/sub_dsp.c +=================================================================== +--- etsi.orig/c-code/sub_dsp.c 2011-05-29 11:46:28.000000000 +0200 ++++ etsi/c-code/sub_dsp.c 2011-05-29 11:47:19.000000000 +0200 +@@ -554,7 +554,7 @@ + + fac[0] = gamma; + for(i=1; i