changeset 31:dd9a9368009e

pcma2efr: emit full input sequence
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 May 2024 05:56:13 +0000
parents 760bbae44c1f
children baf74dff5368
files .hgignore pcma2efr/Makefile pcma2efr/pcma-input.c
diffstat 3 files changed, 49 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Mon May 13 05:40:56 2024 +0000
+++ b/.hgignore	Mon May 13 05:56:13 2024 +0000
@@ -13,6 +13,8 @@
 ^pcma2efr/comb-diff$
 ^pcma2efr/comb-out$
 ^pcma2efr/dhf-check$
+^pcma2efr/pcma-input$
+^pcma2efr/pcma-input\.bin$
 
 ^pcmu2efr/all-outputs\.
 ^pcmu2efr/amrefr-out$
--- a/pcma2efr/Makefile	Mon May 13 05:40:56 2024 +0000
+++ b/pcma2efr/Makefile	Mon May 13 05:56:13 2024 +0000
@@ -1,7 +1,7 @@
 CC=	gcc
 CFLAGS=	-O2
-PROGS=	comb-diff comb-out dhf-check
-FILES=	all-outputs.gsmx all-outputs.inc
+PROGS=	comb-diff comb-out dhf-check pcma-input
+FILES=	all-outputs.gsmx all-outputs.inc pcma-input.bin
 
 COMB_DIFF_OBJS=	alaw-expand.o comb-diff.o gen-amr-2fr.o gen-efr.o gen160.o \
 		seqsynca.o
@@ -9,6 +9,7 @@
 		seqsynca.o
 DHF_CHECK_OBJS=	alaw-expand.o dhf-check.o gen-amr-2fr.o gen-efr.o gen160.o \
 		seqsynca.o
+PCMA_IN_OBJS=	pcma-input.o seqsynca.o
 
 all:	${PROGS} ${FILES}
 
@@ -21,6 +22,9 @@
 dhf-check:	${DHF_CHECK_OBJS}
 	${CC} ${CFLAGS} -o $@ ${DHF_CHECK_OBJS} -lgsmefr -ltwamr
 
+pcma-input:	${PCMA_IN_OBJS}
+	${CC} ${CFLAGS} -o $@ ${PCMA_IN_OBJS}
+
 # data outputs
 
 all-outputs.gsmx:	comb-out
@@ -29,5 +33,8 @@
 all-outputs.inc:	all-outputs.gsmx
 	../utils/gen-hex-c all-outputs.gsmx $@
 
+pcma-input.bin:	pcma-input
+	./pcma-input $@
+
 clean:
 	rm -f *.o ${PROGS} *.bin *.gsmx *.inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcma2efr/pcma-input.c	Mon May 13 05:56:13 2024 +0000
@@ -0,0 +1,38 @@
+/*
+ * This program emits the full sequence (3 EHFs and 2 copies of seqsynca)
+ * that needs to be fed to TRAU DL input from G.711 PCMA side to perform
+ * the test of reversing the EFR variant used and finding frame sync.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+
+extern const uint8_t seqsynca_last_frame[160];
+
+main(argc, argv)
+	char **argv;
+{
+	FILE *outf;
+	uint8_t ehf[160];
+
+	if (argc != 2) {
+		fprintf(stderr, "usage: %s pcma-out-file\n", argv[0]);
+		exit(1);
+	}
+	outf = fopen(argv[1], "w");
+	if (!outf) {
+		perror(argv[1]);
+		exit(1);
+	}
+	memset(ehf, 0xD5, 160);
+	fwrite(ehf, 1, 160, outf);
+	fwrite(ehf, 1, 160, outf);
+	fwrite(ehf, 1, 160, outf);
+	fwrite(seqsynca_last_frame, 1, 160, outf);
+	fwrite(seqsynca_last_frame, 1, 160, outf);
+	fclose(outf);
+	exit(0);
+}