comparison efrtest/etsi-pcm-out.c @ 435:9f354d2aea13

efrtest: split etsi-dec.c for code reuse
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 08 May 2024 05:25:47 +0000
parents efrtest/etsi-dec.c@da17c7f02c6c
children
comparison
equal deleted inserted replaced
434:ba5031723ab6 435:9f354d2aea13
1 /*
2 * This C module holds some functions that have been split off from
3 * etsi-dec.c, with the goal of making it easier to build both
4 * standard-EFR and AMR-EFR versions of the ETSI-format EFR decoder.
5 */
6
7 #include <stdio.h>
8 #include <stdint.h>
9
10 void
11 write_pcm_be(outf, pcm)
12 FILE *outf;
13 int16_t *pcm;
14 {
15 uint8_t bytes[320], *dp;
16 int16_t samp;
17 unsigned n;
18
19 dp = bytes;
20 for (n = 0; n < 160; n++) {
21 samp = pcm[n];
22 *dp++ = (samp >> 8) & 0xFF;
23 *dp++ = samp & 0xFF;
24 }
25 fwrite(bytes, 2, 160, outf);
26 }
27
28 void
29 write_pcm_le(outf, pcm)
30 FILE *outf;
31 int16_t *pcm;
32 {
33 uint8_t bytes[320], *dp;
34 int16_t samp;
35 unsigned n;
36
37 dp = bytes;
38 for (n = 0; n < 160; n++) {
39 samp = pcm[n];
40 *dp++ = samp & 0xFF;
41 *dp++ = (samp >> 8) & 0xFF;
42 }
43 fwrite(bytes, 2, 160, outf);
44 }