annotate hrutil/cod-parse.c @ 542:f2d0f2f15d5f

libgsmefr: add wrapper for TW-TS-001 RTP input
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 28 Sep 2024 06:38:08 +0000
parents bb36ef735f25
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
515
bb36ef735f25 hrutil: starting with gsmhr-cod-parse
Mychaela Falconia <falcon@freecalypso.org>
parents: 213
diff changeset
2 * This program reads an HRv1 *.cod file in ETSI test sequence format
bb36ef735f25 hrutil: starting with gsmhr-cod-parse
Mychaela Falconia <falcon@freecalypso.org>
parents: 213
diff changeset
3 * (encoder output format) and displays its content in human-readable form.
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdint.h>
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <strings.h>
515
bb36ef735f25 hrutil: starting with gsmhr-cod-parse
Mychaela Falconia <falcon@freecalypso.org>
parents: 213
diff changeset
11 #include "../libgsmhr1/tw_gsmhr.h"
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 main(argc, argv)
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 char **argv;
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {
148
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
16 char *infname;
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 FILE *inf;
148
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
18 int big_endian;
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 unsigned frame_no;
515
bb36ef735f25 hrutil: starting with gsmhr-cod-parse
Mychaela Falconia <falcon@freecalypso.org>
parents: 213
diff changeset
20 int16_t params[GSMHR_NUM_PARAMS_ENC];
bb36ef735f25 hrutil: starting with gsmhr-cod-parse
Mychaela Falconia <falcon@freecalypso.org>
parents: 213
diff changeset
21 int rc;
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
148
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
23 if (argc == 2 && argv[1][0] != '-') {
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
24 big_endian = 0;
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
25 infname = argv[1];
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
26 } else if (argc == 3 && !strcmp(argv[1], "-b")) {
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
27 big_endian = 1;
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
28 infname = argv[2];
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
29 } else {
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
30 fprintf(stderr, "usage: %s [-b] file.cod\n", argv[0]);
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 exit(1);
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
148
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
33 inf = fopen(infname, "r");
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 if (!inf) {
148
bbe5669f0f29 gsmefr-cod-parse: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 147
diff changeset
35 perror(infname);
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 exit(1);
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 }
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 for (frame_no = 0; ; frame_no++) {
515
bb36ef735f25 hrutil: starting with gsmhr-cod-parse
Mychaela Falconia <falcon@freecalypso.org>
parents: 213
diff changeset
39 rc = read_cod_frame(inf, big_endian, params, infname, frame_no);
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 if (!rc)
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 break;
515
bb36ef735f25 hrutil: starting with gsmhr-cod-parse
Mychaela Falconia <falcon@freecalypso.org>
parents: 213
diff changeset
42 printf("#%u: VAD=%d SP=%d\n", frame_no, params[18], params[19]);
bb36ef735f25 hrutil: starting with gsmhr-cod-parse
Mychaela Falconia <falcon@freecalypso.org>
parents: 213
diff changeset
43 print_frame_params(params);
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 }
213
46a6e6b6841a gsmefr-{cod,dec}-parse: missed exit(0) at the end
Mychaela Falconia <falcon@freecalypso.org>
parents: 148
diff changeset
45 exit(0);
115
5a63294fa321 gsmefr-cod-parse test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }