# HG changeset patch # User Mychaela Falconia # Date 1715581582 0 # Node ID baf74dff53685f43048e6e73db5766609f187ea5 # Parent dd9a9368009e441341c31395ffd9001d0860f6c0 dhf: generate hex forms of EFR DHF diff -r dd9a9368009e -r baf74dff5368 .hgignore --- a/.hgignore Mon May 13 05:56:13 2024 +0000 +++ b/.hgignore Mon May 13 06:26:22 2024 +0000 @@ -6,6 +6,9 @@ ^amrdiff/readone-amr$ ^amrdiff/readone-efr$ +^dhf/efr-dhf-hex\.txt$ +^dhf/efr-dhf-hexout$ + ^dmw/gen-dmw-bin$ ^dmw/dmw-[au]law\. diff -r dd9a9368009e -r baf74dff5368 Makefile --- a/Makefile Mon May 13 05:56:13 2024 +0000 +++ b/Makefile Mon May 13 06:26:22 2024 +0000 @@ -1,4 +1,4 @@ -SUBDIR= amrdiff dmw pcma2efr pcmu2efr ringing utils +SUBDIR= amrdiff dhf dmw pcma2efr pcmu2efr ringing utils all: ${SUBDIR} diff -r dd9a9368009e -r baf74dff5368 dhf/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dhf/Makefile Mon May 13 06:26:22 2024 +0000 @@ -0,0 +1,15 @@ +CC= gcc +CFLAGS= -O2 +PROG= efr-dhf-hexout +OUTFILE=efr-dhf-hex.txt + +all: ${PROG} ${OUTFILE} + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} -o $@ $@.c -lgsmefr -ltwamr + +${OUTFILE}: ${PROG} + ./${PROG} > $@ + +clean: + rm -f *.o ${PROG} *.txt diff -r dd9a9368009e -r baf74dff5368 dhf/efr-dhf-hexout.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dhf/efr-dhf-hexout.c Mon May 13 06:26:22 2024 +0000 @@ -0,0 +1,38 @@ +/* + * This little program takes EFR and MR122 DHFs provided in array-of-params + * form by libtwamr, turns them into EFR RTP format using libgsmefr function, + * and emits those two RTP-encoded EFR frames in hex, for inclusion in other + * C sources. + */ + +#include +#include +#include +#include +#include + +static void +emit_one_frame(params, name) + const int16_t *params; + char *name; +{ + uint8_t efr_rtp[EFR_RTP_FRAME_LEN]; + unsigned n; + + EFR_params2frame(params, efr_rtp); + printf("%s:\n\n", name); + for (n = 0; n < EFR_RTP_FRAME_LEN; n++) { + printf("0x%02X,", efr_rtp[n]); + if (n == 15 || n == 30) + putchar('\n'); + } + putchar('\n'); +} + +main(argc, argv) + char **argv; +{ + emit_one_frame(amr_dhf_gsmefr, "EFR DHF"); + emit_one_frame(amr_dhf_mr122, "MR122 DHF"); + exit(0); +}