FreeCalypso > hg > vband-misc
changeset 39:ab7c80f6f02d
ae-dec-dhf: initial generation
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 14 May 2024 08:13:01 +0000 |
parents | e96e8d8973c0 |
children | e38e8d0fba70 |
files | .hgignore ae-dec-dhf/Makefile ae-dec-dhf/gen-test-frames.c |
diffstat | 3 files changed, 79 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Tue May 14 05:36:38 2024 +0000 +++ b/.hgignore Tue May 14 08:13:01 2024 +0000 @@ -1,18 +1,21 @@ syntax: regexp \.[oa]$ +\.bin$ \.inc$ +\.gsm$ +\.gsmx$ + +^ae-dec-dhf/gen-test-frames$ ^amrdiff/amrdiff$ ^amrdiff/readone-amr$ ^amrdiff/readone-efr$ -^dhf/efr-dhf\.gsmx$ ^dhf/efr-dhf-bytes\.c$ ^dhf/efr-dhf-hexout$ ^dhf/emit-dhfbin-0610$ ^dhf/emit-dhfbin-efr$ -^dhf/fr1-dhf\.gsm$ ^dhf/mr122-dhf-bytes\.c$ ^dmw/gen-dmw-bin$ @@ -23,7 +26,6 @@ ^pcma2efr/comb-out$ ^pcma2efr/dhf-check$ ^pcma2efr/pcma-input$ -^pcma2efr/pcma-input\.bin$ ^pcmu2efr/all-outputs\. ^pcmu2efr/amrefr-out$ @@ -31,7 +33,6 @@ ^pcmu2efr/comb-out$ ^pcmu2efr/dhf-check$ ^pcmu2efr/pcmu-input$ -^pcmu2efr/pcmu-input\.bin$ ^pcmu2efr/stdefr-diff$ ^pcmu2efr/stdefr-out$
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ae-dec-dhf/Makefile Tue May 14 08:13:01 2024 +0000 @@ -0,0 +1,15 @@ +CC= gcc +CFLAGS= -O2 +PROG= gen-test-frames +FILES= test-frames.gsmx + +all: ${PROG} ${FILES} + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} -o $@ $@.c -lgsmefr -ltwamr + +test-frames.gsmx: ${PROG} + ./${PROG} $@ + +clean: + rm -f *.o ${PROG} *.robe *.ul *.gsmx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ae-dec-dhf/gen-test-frames.c Tue May 14 08:13:01 2024 +0000 @@ -0,0 +1,59 @@ +/* + * This program generates some test EFR frames that are meant to be fed + * to the uplink input of the alien GSM network under study, seeking to + * test if the AMR-EFR hybrid decoder's handling of DHF matches our model. + */ + +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <gsm_efr.h> +#include <tw_amr.h> + +static FILE *outf; + +static void +emit_mr122_dhf() +{ + uint8_t frame[EFR_RTP_FRAME_LEN]; + + EFR_params2frame(amr_dhf_mr122, frame); + fwrite(frame, 1, EFR_RTP_FRAME_LEN, outf); +} + +static void +emit_mixed_dhf() +{ + int16_t params[EFR_NUM_PARAMS]; + uint8_t frame[EFR_RTP_FRAME_LEN]; + + memcpy(params, amr_dhf_gsmefr, sizeof(int16_t) * 18); + memcpy(params + 18, amr_dhf_mr122 + 18, sizeof(int16_t) * 39); + EFR_params2frame(params, frame); + fwrite(frame, 1, EFR_RTP_FRAME_LEN, outf); +} + +main(argc, argv) + char **argv; +{ + if (argc != 2) { + fprintf(stderr, "usage: %s gsmx-out-file\n", argv[0]); + exit(1); + } + outf = fopen(argv[1], "w"); + if (!outf) { + perror(argv[1]); + exit(1); + } + emit_mr122_dhf(); + emit_mr122_dhf(); + emit_mixed_dhf(); + fwrite(EFR_decoder_homing_frame, 1, EFR_RTP_FRAME_LEN, outf); + emit_mixed_dhf(); + emit_mixed_dhf(); + emit_mr122_dhf(); + fclose(outf); + exit(0); +}