changeset 30:760bbae44c1f

pcma2efr: emit the set of computed frames
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 May 2024 05:40:56 +0000
parents fc4544e3687b
children dd9a9368009e
files .hgignore Makefile pcma2efr/Makefile pcma2efr/comb-out.c
diffstat 4 files changed, 56 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Mon May 13 02:49:26 2024 +0000
+++ b/.hgignore	Mon May 13 05:40:56 2024 +0000
@@ -9,7 +9,9 @@
 ^dmw/gen-dmw-bin$
 ^dmw/dmw-[au]law\.
 
+^pcma2efr/all-outputs\.
 ^pcma2efr/comb-diff$
+^pcma2efr/comb-out$
 ^pcma2efr/dhf-check$
 
 ^pcmu2efr/all-outputs\.
--- a/Makefile	Mon May 13 02:49:26 2024 +0000
+++ b/Makefile	Mon May 13 05:40:56 2024 +0000
@@ -2,6 +2,7 @@
 
 all:	${SUBDIR}
 
+pcma2efr:	utils
 pcmu2efr:	utils
 ringing:	utils
 
--- a/pcma2efr/Makefile	Mon May 13 02:49:26 2024 +0000
+++ b/pcma2efr/Makefile	Mon May 13 05:40:56 2024 +0000
@@ -1,19 +1,33 @@
 CC=	gcc
 CFLAGS=	-O2
-PROGS=	comb-diff dhf-check
+PROGS=	comb-diff comb-out dhf-check
+FILES=	all-outputs.gsmx all-outputs.inc
 
 COMB_DIFF_OBJS=	alaw-expand.o comb-diff.o gen-amr-2fr.o gen-efr.o gen160.o \
 		seqsynca.o
+COMB_OUT_OBJS=	alaw-expand.o comb-out.o gen-amr-2fr.o gen-efr.o gen160.o \
+		seqsynca.o
 DHF_CHECK_OBJS=	alaw-expand.o dhf-check.o gen-amr-2fr.o gen-efr.o gen160.o \
 		seqsynca.o
 
-all:	${PROGS}
+all:	${PROGS} ${FILES}
 
 comb-diff:	${COMB_DIFF_OBJS}
 	${CC} ${CFLAGS} -o $@ ${COMB_DIFF_OBJS} -lgsmefr -ltwamr
 
+comb-out:	${COMB_OUT_OBJS}
+	${CC} ${CFLAGS} -o $@ ${COMB_OUT_OBJS} -lgsmefr -ltwamr
+
 dhf-check:	${DHF_CHECK_OBJS}
 	${CC} ${CFLAGS} -o $@ ${DHF_CHECK_OBJS} -lgsmefr -ltwamr
 
+# data outputs
+
+all-outputs.gsmx:	comb-out
+	./comb-out $@
+
+all-outputs.inc:	all-outputs.gsmx
+	../utils/gen-hex-c all-outputs.gsmx $@
+
 clean:
 	rm -f *.o ${PROGS} *.bin *.gsmx *.inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcma2efr/comb-out.c	Mon May 13 05:40:56 2024 +0000
@@ -0,0 +1,37 @@
+/*
+ * This program computes 160 possible EFR encoder outputs using standard EFR,
+ * then 160 possible outputs in AMR-EFR, then writes out all 320 frames
+ * to a gsmx output file.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+
+extern uint8_t standard_efr[160][31];
+extern uint8_t amr_efr[160][31];
+
+main(argc, argv)
+	char **argv;
+{
+	FILE *outf;
+
+	if (argc != 2) {
+		fprintf(stderr, "usage: %s gsmx-out-file\n", argv[0]);
+		exit(1);
+	}
+	generate_linear_inputs();
+	generate_std_efr();
+	generate_amr_efr();
+	outf = fopen(argv[1], "w");
+	if (!outf) {
+		perror(argv[1]);
+		exit(1);
+	}
+	fwrite(standard_efr, 31, 160, outf);
+	fwrite(amr_efr, 31, 160, outf);
+	fclose(outf);
+	exit(0);
+}