view pcmu2efr/dhf-check.c @ 55:f27bc1e17311

fr-sid/goodsp-frame41.gsmx: starting point This 33-byte binary file contains frame #41 from good_sp.cod from GSM 06.32 test sequence set, converted from ETSI *.cod format into our gsmx format. This frame is an example of a real FRv1 SID.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 22 Aug 2024 05:00:08 +0000
parents 2628a34fe75b
children
line wrap: on
line source

/*
 * This program generates both standard-EFR and AMR-EFR versions of
 * sample-shifted first encoder frame, and checks them against
 * both EFR and MR122 DHFs.
 */

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <gsm_efr.h>
#include <tw_amr.h>

extern uint8_t standard_efr[160][31];
extern uint8_t amr_efr[160][31];

static void
check_for_dhf(efr_frame, name, num)
	uint8_t *efr_frame;
	char *name;
	unsigned num;
{
	int16_t params[EFR_NUM_PARAMS];

	EFR_frame2params(efr_frame, params);
	if (!bcmp(params, amr_dhf_gsmefr, EFR_NUM_PARAMS * sizeof(int16_t)))
		printf("%s frame %u matches EFR DHF\n", name, num);
	else if (!bcmp(params, amr_dhf_mr122, EFR_NUM_PARAMS * sizeof(int16_t)))
		printf("%s frame %u matches MR122 DHF\n", name, num);
}

main(argc, argv)
	char **argv;
{
	unsigned n;

	generate_linear_inputs();
	generate_std_efr();
	generate_amr_efr();
	for (n = 0; n < 160; n++)
		check_for_dhf(standard_efr[n], "std EFR", n);
	for (n = 0; n < 160; n++)
		check_for_dhf(amr_efr[n], "AMR-EFR", n);
	exit(0);
}