comparison pcmu2efr/gen160.c @ 15:528eef871e23

pcmu2efr project started
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 16 Apr 2024 23:30:49 +0000
parents
children f4420403219a
comparison
equal deleted inserted replaced
14:ec642bde2349 15:528eef871e23
1 /*
2 * The code in this module generates 160 versions of linearized seqsyncu,
3 * shifted by one sample each, intended for feeding to EFR and AMR encoders.
4 */
5
6 #include <stdint.h>
7
8 extern const uint8_t seqsyncu_last_frame[160];
9 extern const uint16_t pcmu_decode_table[256];
10
11 uint16_t linear_inputs[160][160];
12
13 static void
14 gen_first_seq(void)
15 {
16 unsigned n;
17
18 for (n = 0; n < 160; n++)
19 linear_inputs[0][n] = pcmu_decode_table[seqsyncu_last_frame[n]];
20 }
21
22 static void
23 gen_sequence_m(unsigned m)
24 {
25 unsigned n, s;
26
27 for (n = 0; n < m; n++)
28 linear_inputs[m][n] = 0x0008;
29 for (s = 0; n < 160; n++, s++)
30 linear_inputs[m][n] = linear_inputs[0][s];
31 }
32
33 void
34 generate_linear_inputs(void)
35 {
36 unsigned m;
37
38 gen_first_seq();
39 for (m = 1; m < 160; m++)
40 gen_sequence_m(m);
41 }