changeset 435:9f354d2aea13

efrtest: split etsi-dec.c for code reuse
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 08 May 2024 05:25:47 +0000
parents ba5031723ab6
children e80632ccb745
files efrtest/Makefile efrtest/etsi-dec.c efrtest/etsi-pcm-out.c
diffstat 3 files changed, 46 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/efrtest/Makefile	Wed May 08 02:17:08 2024 +0000
+++ b/efrtest/Makefile	Wed May 08 05:25:47 2024 +0000
@@ -40,8 +40,8 @@
 gsmefr-encode-r:	encode-r.o ${LIBTEST} ${LIBEFR}
 	${CC} ${CFLAGS} -o $@ encode-r.o ${LIBTEST} ${LIBEFR}
 
-gsmefr-etsi-dec:	etsi-dec.o etsi-bit-rd.o ${LIBEFR}
-	${CC} ${CFLAGS} -o $@ etsi-dec.o etsi-bit-rd.o ${LIBEFR}
+gsmefr-etsi-dec:	etsi-dec.o etsi-bit-rd.o etsi-pcm-out.o ${LIBEFR}
+	${CC} ${CFLAGS} -o $@ etsi-dec.o etsi-bit-rd.o etsi-pcm-out.o ${LIBEFR}
 
 gsmefr-etsi-enc:	etsi-enc.o etsi-enc-common.o ${LIBEFR}
 	${CC} ${CFLAGS} -o $@ etsi-enc.o etsi-enc-common.o ${LIBEFR}
--- a/efrtest/etsi-dec.c	Wed May 08 02:17:08 2024 +0000
+++ b/efrtest/etsi-dec.c	Wed May 08 05:25:47 2024 +0000
@@ -16,42 +16,6 @@
 #include "../libgsmefr/gsm_efr.h"
 #include "etsi.h"
 
-static void
-write_pcm_be(outf, pcm)
-	FILE *outf;
-	int16_t *pcm;
-{
-	uint8_t bytes[320], *dp;
-	int16_t samp;
-	unsigned n;
-
-	dp = bytes;
-	for (n = 0; n < 160; n++) {
-		samp = pcm[n];
-		*dp++ = (samp >> 8) & 0xFF;
-		*dp++ = samp & 0xFF;
-	}
-	fwrite(bytes, 2, 160, outf);
-}
-
-static void
-write_pcm_le(outf, pcm)
-	FILE *outf;
-	int16_t *pcm;
-{
-	uint8_t bytes[320], *dp;
-	int16_t samp;
-	unsigned n;
-
-	dp = bytes;
-	for (n = 0; n < 160; n++) {
-		samp = pcm[n];
-		*dp++ = samp & 0xFF;
-		*dp++ = (samp >> 8) & 0xFF;
-	}
-	fwrite(bytes, 2, 160, outf);
-}
-
 main(argc, argv)
 	char **argv;
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/efrtest/etsi-pcm-out.c	Wed May 08 05:25:47 2024 +0000
@@ -0,0 +1,44 @@
+/*
+ * This C module holds some functions that have been split off from
+ * etsi-dec.c, with the goal of making it easier to build both
+ * standard-EFR and AMR-EFR versions of the ETSI-format EFR decoder.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+
+void
+write_pcm_be(outf, pcm)
+	FILE *outf;
+	int16_t *pcm;
+{
+	uint8_t bytes[320], *dp;
+	int16_t samp;
+	unsigned n;
+
+	dp = bytes;
+	for (n = 0; n < 160; n++) {
+		samp = pcm[n];
+		*dp++ = (samp >> 8) & 0xFF;
+		*dp++ = samp & 0xFF;
+	}
+	fwrite(bytes, 2, 160, outf);
+}
+
+void
+write_pcm_le(outf, pcm)
+	FILE *outf;
+	int16_t *pcm;
+{
+	uint8_t bytes[320], *dp;
+	int16_t samp;
+	unsigned n;
+
+	dp = bytes;
+	for (n = 0; n < 160; n++) {
+		samp = pcm[n];
+		*dp++ = samp & 0xFF;
+		*dp++ = (samp >> 8) & 0xFF;
+	}
+	fwrite(bytes, 2, 160, outf);
+}