view dhf/efr-dhf-hexout.c @ 32:baf74dff5368

dhf: generate hex forms of EFR DHF
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 May 2024 06:26:22 +0000
parents
children 307fe06fabec
line wrap: on
line source

/*
 * 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 <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <gsm_efr.h>
#include <tw_amr.h>

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);
}