annotate trau-decode/parse-amr.c @ 82:31a8d34b71ed

trau-parse: AMR 7k95 CRC
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 08 Feb 2025 21:42:53 +0000
parents 9eff2af191d5
children 5e2ecfd45fc3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
2 * Here we implement parsing/decoding of AMR frames as in 3GPP TS 48.060
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
3 * section 5.5.1.2, striving to decode and display as much as we can.
0
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdint.h>
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <strings.h>
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
11 #include "osmo_bits.h"
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
12
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
13 /*
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
14 * AMR TRAU parity (same as EFR)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
15 *
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
16 * g(x) = x^3 + x^1 + 1
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
17 */
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
18 static const struct osmo_crc8gen_code gsm0860_amr_crc3 = {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
19 .bits = 3,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
20 .poly = 0x3,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
21 .init = 0x0,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
22 .remainder = 0x7,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
23 };
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
24
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
25 static int saved_mode, saved_mode_valid;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
26
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
27 static char *fclass_names[4] = {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
28 "No_Speech", "Speech_Bad", "Speech_Degraded", "Speech_Good"
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
29 };
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
30
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
31 static char *nospch_class_names[8] = {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
32 "No_Data", "invalid", "invalid", "invalid",
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
33 "Sid_Bad", "Sid_Update", "Onset", "Sid_First"
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
34 };
0
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 static unsigned
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 bits_to_num(bits, nbits)
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
38 ubit_t *bits;
0
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 unsigned nbits;
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 {
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 unsigned accum;
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 unsigned n;
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 accum = 0;
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 for (n = 0; n < nbits; n++) {
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 accum <<= 1;
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 if (*bits)
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 accum |= 1;
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 bits++;
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 }
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 return accum;
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 }
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
54 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
55 decode_mode_0(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
56 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
57 {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
58 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
59
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
60 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
61 decode_mode_1(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
62 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
63 {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
64 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
65
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
66 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
67 decode_mode_2(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
68 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
69 {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
70 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
71
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
72 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
73 decode_mode_3(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
74 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
75 {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
76 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
77
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
78 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
79 decode_mode_4(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
80 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
81 {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
82 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
83
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
84 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
85 decode_mode_5(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
86 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
87 {
82
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
88 ubit_t crc_collect[64];
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
89 int crc1, crc2, crc3, crc4;
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
90
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
91 bcopy(c_bits, crc_collect, 25);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
92 bcopy(d_bits + 31, crc_collect + 25, 35);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
93 bcopy(d_bits + 83, crc_collect + 60, 2);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
94 crc_collect[62] = d_bits[87];
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
95 crc_collect[63] = d_bits[90];
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
96 crc1 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 64,
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
97 d_bits + 92);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
98 bcopy(d_bits + 95, crc_collect, 4);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
99 bcopy(d_bits + 118, crc_collect + 4, 2);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
100 bcopy(d_bits + 122, crc_collect + 6, 4);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
101 crc2 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 10,
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
102 d_bits + 127);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
103 bcopy(d_bits + 130, crc_collect, 8);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
104 bcopy(d_bits + 155, crc_collect + 8, 2);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
105 bcopy(d_bits + 159, crc_collect + 10, 4);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
106 crc3 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 14,
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
107 d_bits + 164);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
108 bcopy(d_bits + 167, crc_collect, 4);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
109 bcopy(d_bits + 190, crc_collect + 4, 2);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
110 bcopy(d_bits + 194, crc_collect + 6, 4);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
111 crc4 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 10,
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
112 d_bits + 199);
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
113 printf(" CRC %s %s %s %s\n",
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
114 crc1 ? "bad" : "good", crc2 ? "bad" : "good",
31a8d34b71ed trau-parse: AMR 7k95 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 81
diff changeset
115 crc3 ? "bad" : "good", crc4 ? "bad" : "good");
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
116 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
117
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
118 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
119 decode_mode_6(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
120 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
121 {
81
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
122 ubit_t crc_collect[82];
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
123 int crc1, crc2, crc3, crc4;
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
124
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
125 bcopy(c_bits, crc_collect, 25);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
126 bcopy(d_bits, crc_collect + 25, 45);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
127 bcopy(d_bits + 46, crc_collect + 70, 8);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
128 bcopy(d_bits + 85, crc_collect + 78, 2);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
129 bcopy(d_bits + 88, crc_collect + 80, 2);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
130 crc1 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 82,
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
131 d_bits + 92);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
132 bcopy(d_bits + 95, crc_collect, 4);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
133 bcopy(d_bits + 131, crc_collect + 4, 2);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
134 bcopy(d_bits + 134, crc_collect + 6, 2);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
135 crc2 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 8,
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
136 d_bits + 138);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
137 bcopy(d_bits + 141, crc_collect, 8);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
138 bcopy(d_bits + 180, crc_collect + 8, 2);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
139 bcopy(d_bits + 183, crc_collect + 10, 2);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
140 crc3 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 12,
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
141 d_bits + 187);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
142 bcopy(d_bits + 190, crc_collect, 4);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
143 bcopy(d_bits + 226, crc_collect + 4, 2);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
144 bcopy(d_bits + 229, crc_collect + 6, 2);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
145 bcopy(d_bits + 233, crc_collect + 8, 20);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
146 crc4 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 28,
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
147 d_bits + 253);
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
148 printf(" CRC %s %s %s %s\n",
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
149 crc1 ? "bad" : "good", crc2 ? "bad" : "good",
9eff2af191d5 trau-parse: AMR 10k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 80
diff changeset
150 crc3 ? "bad" : "good", crc4 ? "bad" : "good");
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
151 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
152
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
153 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
154 decode_mode_7(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
155 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
156 {
80
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
157 ubit_t crc_collect[69];
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
158 int crc1, crc2, crc3, crc4;
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
159
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
160 bcopy(c_bits, crc_collect, 25);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
161 bcopy(d_bits, crc_collect + 25, 29);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
162 bcopy(d_bits + 38, crc_collect + 54, 12);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
163 bcopy(d_bits + 86, crc_collect + 66, 3);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
164 crc1 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 69,
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
165 d_bits + 91);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
166 bcopy(d_bits + 94, crc_collect, 9);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
167 bcopy(d_bits + 139, crc_collect + 9, 3);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
168 crc2 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 12,
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
169 d_bits + 144);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
170 bcopy(d_bits + 147, crc_collect, 12);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
171 bcopy(d_bits + 195, crc_collect + 12, 3);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
172 crc3 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 15,
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
173 d_bits + 200);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
174 bcopy(d_bits + 203, crc_collect, 5);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
175 bcopy(d_bits + 209, crc_collect + 5, 3);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
176 bcopy(d_bits + 248, crc_collect + 8, 3);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
177 crc4 = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect, 11,
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
178 d_bits + 253);
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
179 printf(" CRC %s %s %s %s\n",
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
180 crc1 ? "bad" : "good", crc2 ? "bad" : "good",
58dfdb2fc6df trau-parse: AMR 12k2 CRC
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
181 crc3 ? "bad" : "good", crc4 ? "bad" : "good");
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
182 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
183
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
184 static void (*per_mode_decode[8])() = {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
185 decode_mode_0,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
186 decode_mode_1,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
187 decode_mode_2,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
188 decode_mode_3,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
189 decode_mode_4,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
190 decode_mode_5,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
191 decode_mode_6,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
192 decode_mode_7
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
193 };
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
194
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
195 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
196 decode_speech_frame(c_bits, d_bits, cm_hdr)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
197 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
198 unsigned cm_hdr;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
199 {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
200 unsigned mode;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
201
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
202 if (c_bits[11]) {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
203 if (!saved_mode_valid) {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
204 printf(" Mode unknown, cannot decode\n");
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
205 return;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
206 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
207 mode = saved_mode;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
208 saved_mode_valid = 0;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
209 } else {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
210 mode = cm_hdr;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
211 saved_mode = mode;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
212 saved_mode_valid = 1;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
213 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
214 printf(" Decoding per speech mode %u\n", mode);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
215 per_mode_decode[mode](c_bits, d_bits);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
216 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
217
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
218 static void
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
219 decode_nospeech_frame(c_bits, d_bits)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
220 ubit_t *c_bits, *d_bits;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
221 {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
222 ubit_t crc_collect[25 + 61];
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
223 int crc_stat;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
224
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
225 printf(" No_Spch_Class=%u%u%u (%s) CMI=%u CMR=%u\n",
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
226 d_bits[31], d_bits[32], d_bits[33],
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
227 nospch_class_names[bits_to_num(d_bits + 31, 3)],
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
228 bits_to_num(d_bits + 34, 3), bits_to_num(d_bits + 37, 3));
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
229 printf(" PAB=%u TAE=%u%u\n", d_bits[40], d_bits[41], d_bits[42]);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
230 bcopy(c_bits, crc_collect, 25);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
231 bcopy(d_bits + 31, crc_collect + 25, 61);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
232 crc_stat = osmo_crc8gen_check_bits(&gsm0860_amr_crc3, crc_collect,
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
233 25 + 61, d_bits + 92);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
234 printf(" CRC %s\n", crc_stat ? "bad" : "good");
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
235 if (crc_stat) {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
236 saved_mode_valid = 0;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
237 } else {
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
238 saved_mode = bits_to_num(d_bits + 34, 3);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
239 saved_mode_valid = 1;
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
240 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
241 }
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
242
78
00fd38c7c8fe trau-decode: factor out parse-amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
243 void
00fd38c7c8fe trau-decode: factor out parse-amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
244 print_amr_frame(frame_bits)
00fd38c7c8fe trau-decode: factor out parse-amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
245 uint8_t *frame_bits;
0
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 {
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
247 ubit_t c_bits[25], d_bits[256];
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
248 uint8_t fclass, cm_hdr;
0
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
250 bcopy(frame_bits + 17, c_bits, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
251 bcopy(frame_bits + 33, c_bits + 15, 10);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
252 bcopy(frame_bits + 43, d_bits, 5);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
253 bcopy(frame_bits + 49, d_bits + 5, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
254 bcopy(frame_bits + 65, d_bits + 20, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
255 bcopy(frame_bits + 81, d_bits + 35, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
256 bcopy(frame_bits + 97, d_bits + 50, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
257 bcopy(frame_bits + 113, d_bits + 65, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
258 bcopy(frame_bits + 129, d_bits + 80, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
259 bcopy(frame_bits + 145, d_bits + 95, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
260 bcopy(frame_bits + 161, d_bits + 110, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
261 bcopy(frame_bits + 177, d_bits + 125, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
262 bcopy(frame_bits + 193, d_bits + 140, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
263 bcopy(frame_bits + 209, d_bits + 155, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
264 bcopy(frame_bits + 225, d_bits + 170, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
265 bcopy(frame_bits + 241, d_bits + 185, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
266 bcopy(frame_bits + 257, d_bits + 200, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
267 bcopy(frame_bits + 273, d_bits + 215, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
268 bcopy(frame_bits + 289, d_bits + 230, 15);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
269 bcopy(frame_bits + 305, d_bits + 245, 11);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
270
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
271 printf(" C6-C11: %u\n", bits_to_num(c_bits + 5, 6));
78
00fd38c7c8fe trau-decode: factor out parse-amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
272 printf(" RIF=%u C13=%u Config_Prot=%u%u%u Msg_No=%u%u\n",
79
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
273 c_bits[11], c_bits[12], c_bits[13], c_bits[14], c_bits[15],
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
274 c_bits[16], c_bits[17]);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
275 fclass = bits_to_num(c_bits + 20, 2);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
276 cm_hdr = bits_to_num(c_bits + 22, 3);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
277 printf(" DTXd=%u TFOE=%u FClass=%u%u (%s) %s=%u\n",
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
278 c_bits[18], c_bits[19], c_bits[20], c_bits[21],
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
279 fclass_names[fclass], c_bits[11] ? "CMR" : "CMI", cm_hdr);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
280 if (fclass)
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
281 decode_speech_frame(c_bits, d_bits, cm_hdr);
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
282 else
8c1f20e845a1 trau-parse: more thorough AMR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
283 decode_nospeech_frame(c_bits, d_bits);
78
00fd38c7c8fe trau-decode: factor out parse-amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
284 printf(" T1=%u T2=%u T3=%u T4=%u\n", frame_bits[316],
00fd38c7c8fe trau-decode: factor out parse-amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
285 frame_bits[317], frame_bits[318], frame_bits[319]);
0
131e0f1972bb beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 }