FreeCalypso > hg > vband-misc
changeset 26:1794bf0fbcf7
pcmu2efr: emit full PCMU input
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 12 May 2024 04:48:36 +0000 |
parents | 1f58ba0d79a4 |
children | 2095f3c23dad |
files | .hgignore pcmu2efr/Makefile pcmu2efr/pcmu-input.c |
diffstat | 3 files changed, 45 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Sun May 12 04:34:15 2024 +0000 +++ b/.hgignore Sun May 12 04:48:36 2024 +0000 @@ -13,6 +13,7 @@ ^pcmu2efr/comb-diff$ ^pcmu2efr/comb-out$ ^pcmu2efr/dhf-check$ +^pcmu2efr/pcmu-input$ ^pcmu2efr/stdefr-diff$ ^pcmu2efr/stdefr-out$
--- a/pcmu2efr/Makefile Sun May 12 04:34:15 2024 +0000 +++ b/pcmu2efr/Makefile Sun May 12 04:48:36 2024 +0000 @@ -1,6 +1,7 @@ CC= gcc CFLAGS= -O2 -PROGS= amrefr-out comb-diff comb-out dhf-check stdefr-diff stdefr-out +PROGS= amrefr-out comb-diff comb-out dhf-check pcmu-input stdefr-diff \ + stdefr-out AMREFR_OBJS= amrefr-out.o gen-amrefr.o gen160.o seqsyncu.o ulaw-expand.o COMB_DIFF_OBJS= comb-diff.o gen-amr-2fr.o gen-efr.o gen160.o seqsyncu.o \ @@ -9,6 +10,7 @@ ulaw-expand.o DHF_CHECK_OBJS= dhf-check.o gen-amr-2fr.o gen-efr.o gen160.o seqsyncu.o \ ulaw-expand.o +PCMU_IN_OBJS= pcmu-input.o seqsyncu.o STDEFR_OBJS= gen-efr.o gen160.o seqsyncu.o stdefr-out.o ulaw-expand.o STDEFRD_OBJS= gen-efr.o gen160.o seqsyncu.o stdefr-diff.o ulaw-expand.o @@ -26,6 +28,9 @@ dhf-check: ${DHF_CHECK_OBJS} ${CC} ${CFLAGS} -o $@ ${DHF_CHECK_OBJS} -lgsmefr -ltwamr +pcmu-input: ${PCMU_IN_OBJS} + ${CC} ${CFLAGS} -o $@ ${PCMU_IN_OBJS} + stdefr-diff: ${STDEFRD_OBJS} ${CC} ${CFLAGS} -o $@ ${STDEFRD_OBJS} -lgsmefr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pcmu2efr/pcmu-input.c Sun May 12 04:48:36 2024 +0000 @@ -0,0 +1,38 @@ +/* + * This program emits the full sequence (3 EHFs and 2 copies of seqsyncu) + * that needs to be fed to TRAU DL input from G.711 PCMU 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 seqsyncu_last_frame[160]; + +main(argc, argv) + char **argv; +{ + FILE *outf; + uint8_t ehf[160]; + + if (argc != 2) { + fprintf(stderr, "usage: %s pcmu-out-file\n", argv[0]); + exit(1); + } + outf = fopen(argv[1], "w"); + if (!outf) { + perror(argv[1]); + exit(1); + } + memset(ehf, 0xFE, 160); + fwrite(ehf, 1, 160, outf); + fwrite(ehf, 1, 160, outf); + fwrite(ehf, 1, 160, outf); + fwrite(seqsyncu_last_frame, 1, 160, outf); + fwrite(seqsyncu_last_frame, 1, 160, outf); + fclose(outf); + exit(0); +}