annotate efrtest/etsi-pcm-out.c @ 448:a2065e7d68bc

top Makefile: move libtwamr to SUBDIR_LIBPROD
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 May 2024 01:30:26 +0000
parents 9f354d2aea13
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
96
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
435
9f354d2aea13 efrtest: split etsi-dec.c for code reuse
Mychaela Falconia <falcon@freecalypso.org>
parents: 150
diff changeset
2 * This C module holds some functions that have been split off from
9f354d2aea13 efrtest: split etsi-dec.c for code reuse
Mychaela Falconia <falcon@freecalypso.org>
parents: 150
diff changeset
3 * etsi-dec.c, with the goal of making it easier to build both
9f354d2aea13 efrtest: split etsi-dec.c for code reuse
Mychaela Falconia <falcon@freecalypso.org>
parents: 150
diff changeset
4 * standard-EFR and AMR-EFR versions of the ETSI-format EFR decoder.
96
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdint.h>
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
435
9f354d2aea13 efrtest: split etsi-dec.c for code reuse
Mychaela Falconia <falcon@freecalypso.org>
parents: 150
diff changeset
10 void
150
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
11 write_pcm_be(outf, pcm)
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
12 FILE *outf;
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
13 int16_t *pcm;
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
14 {
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
15 uint8_t bytes[320], *dp;
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
16 int16_t samp;
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
17 unsigned n;
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
18
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
19 dp = bytes;
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
20 for (n = 0; n < 160; n++) {
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
21 samp = pcm[n];
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
22 *dp++ = (samp >> 8) & 0xFF;
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
23 *dp++ = samp & 0xFF;
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
24 }
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
25 fwrite(bytes, 2, 160, outf);
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
26 }
da17c7f02c6c gsmefr-etsi-dec: add BE support
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
27
435
9f354d2aea13 efrtest: split etsi-dec.c for code reuse
Mychaela Falconia <falcon@freecalypso.org>
parents: 150
diff changeset
28 void
96
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 write_pcm_le(outf, pcm)
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 FILE *outf;
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 int16_t *pcm;
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 {
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 uint8_t bytes[320], *dp;
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 int16_t samp;
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 unsigned n;
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 dp = bytes;
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 for (n = 0; n < 160; n++) {
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 samp = pcm[n];
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 *dp++ = samp & 0xFF;
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 *dp++ = (samp >> 8) & 0xFF;
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 }
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 fwrite(bytes, 2, 160, outf);
9cf1355bc071 gsmefr-etsi-dec test program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 }