FreeCalypso > hg > vband-misc
comparison amrdiff/readone-efr.c @ 4:5aeebdcbddad
readone-efr program written
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 03 Apr 2024 20:07:50 +0000 |
parents | amrdiff/readone-amr.c@75ba83624a29 |
children |
comparison
equal
deleted
inserted
replaced
3:82c2d1a2f608 | 4:5aeebdcbddad |
---|---|
1 /* | |
2 * This program reads a single frame (the first one) from an EFR *.cod file | |
3 * and emits this frame of 244 bits as comma-separated ASCII. The intent is | |
4 * to extract the DHF in a form convenient for inclusion in amrdiff source. | |
5 */ | |
6 | |
7 #include <stdio.h> | |
8 #include <stdint.h> | |
9 #include <stdlib.h> | |
10 #include <string.h> | |
11 #include <strings.h> | |
12 #include "etsi.h" | |
13 | |
14 main(argc, argv) | |
15 char **argv; | |
16 { | |
17 char *filename; | |
18 int bigend, rc; | |
19 FILE *inf; | |
20 uint8_t efr_bits[ETSI_ENC_NWORDS]; | |
21 | |
22 if (argc != 3) { | |
23 usage: fprintf(stderr, "usage: %s efr-cod-file be|le\n", argv[0]); | |
24 exit(1); | |
25 } | |
26 filename = argv[1]; | |
27 if (!strcmp(argv[2], "be")) | |
28 bigend = 1; | |
29 else if (!strcmp(argv[2], "le")) | |
30 bigend = 0; | |
31 else | |
32 goto usage; | |
33 inf = fopen(filename, "r"); | |
34 if (!inf) { | |
35 perror(filename); | |
36 exit(1); | |
37 } | |
38 rc = read_etsi_bits(inf, bigend, efr_bits, ETSI_ENC_NWORDS, filename); | |
39 if (!rc) { | |
40 fprintf(stderr, "error: %s is empty\n", filename); | |
41 exit(1); | |
42 } | |
43 emit_frame244(efr_bits); | |
44 exit(0); | |
45 } |