view amrdiff/readone-efr.c @ 12:db5772dac3c3

ringing: generate WAV decodings of FR&EFR ringing signals for playback testing and subjective quality evaluation
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 Apr 2024 19:28:20 +0000
parents 5aeebdcbddad
children
line wrap: on
line source

/*
 * This program reads a single frame (the first one) from an EFR *.cod file
 * and emits this frame of 244 bits as comma-separated ASCII.  The intent is
 * to extract the DHF in a form convenient for inclusion in amrdiff source.
 */

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "etsi.h"

main(argc, argv)
	char **argv;
{
	char *filename;
	int bigend, rc;
	FILE *inf;
	uint8_t efr_bits[ETSI_ENC_NWORDS];

	if (argc != 3) {
usage:		fprintf(stderr, "usage: %s efr-cod-file be|le\n", argv[0]);
		exit(1);
	}
	filename = argv[1];
	if (!strcmp(argv[2], "be"))
		bigend = 1;
	else if (!strcmp(argv[2], "le"))
		bigend = 0;
	else
		goto usage;
	inf = fopen(filename, "r");
	if (!inf) {
		perror(filename);
		exit(1);
	}
	rc = read_etsi_bits(inf, bigend, efr_bits, ETSI_ENC_NWORDS, filename);
	if (!rc) {
		fprintf(stderr, "error: %s is empty\n", filename);
		exit(1);
	}
	emit_frame244(efr_bits);
	exit(0);
}