comparison hrutil/cod-parse.c @ 515:bb36ef735f25

hrutil: starting with gsmhr-cod-parse
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 30 Aug 2024 08:05:07 +0000
parents efrtest/cod-parse.c@46a6e6b6841a
children
comparison
equal deleted inserted replaced
514:67b13a6a63c9 515:bb36ef735f25
1 /*
2 * This program reads an HRv1 *.cod file in ETSI test sequence format
3 * (encoder output format) and displays its content in human-readable form.
4 */
5
6 #include <stdio.h>
7 #include <stdint.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <strings.h>
11 #include "../libgsmhr1/tw_gsmhr.h"
12
13 main(argc, argv)
14 char **argv;
15 {
16 char *infname;
17 FILE *inf;
18 int big_endian;
19 unsigned frame_no;
20 int16_t params[GSMHR_NUM_PARAMS_ENC];
21 int rc;
22
23 if (argc == 2 && argv[1][0] != '-') {
24 big_endian = 0;
25 infname = argv[1];
26 } else if (argc == 3 && !strcmp(argv[1], "-b")) {
27 big_endian = 1;
28 infname = argv[2];
29 } else {
30 fprintf(stderr, "usage: %s [-b] file.cod\n", argv[0]);
31 exit(1);
32 }
33 inf = fopen(infname, "r");
34 if (!inf) {
35 perror(infname);
36 exit(1);
37 }
38 for (frame_no = 0; ; frame_no++) {
39 rc = read_cod_frame(inf, big_endian, params, infname, frame_no);
40 if (!rc)
41 break;
42 printf("#%u: VAD=%d SP=%d\n", frame_no, params[18], params[19]);
43 print_frame_params(params);
44 }
45 exit(0);
46 }