annotate pcmu2efr/stdefr-out.c @ 16:17d8ff0944a8

top Makefile: add pcmu2efr
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 16 Apr 2024 23:31:32 +0000
parents 528eef871e23
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This program computes 160 possible EFR encoder outputs using standard EFR,
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * and writes the result out to a gsmx file.
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdint.h>
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 extern uint8_t standard_efr[160][31];
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 main(argc, argv)
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 char **argv;
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 {
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 FILE *outf;
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 if (argc != 2) {
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 fprintf(stderr, "usage: %s gsmx-out-file\n", argv[0]);
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 exit(1);
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 }
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 generate_linear_inputs();
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 generate_std_efr();
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 outf = fopen(argv[1], "w");
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 if (!outf) {
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 perror(argv[1]);
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 exit(1);
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 fwrite(standard_efr, 31, 160, outf);
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 fclose(outf);
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 exit(0);
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 }