annotate libgsmefr/frame2params.c @ 523:86d4ec69b36c

miscutil: new program tw5a-dump
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 19 Sep 2024 04:13:28 +0000
parents 4ae1dd43e332
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement our EFR_frame2params() unpacking function.
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include "gsm_efr.h"
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 void EFR_frame2params(const uint8_t *frame, int16_t *params)
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 {
45
4ae1dd43e332 libgsmefr/frame2params.c: brown paper bag
Mychaela Falconia <falcon@freecalypso.org>
parents: 34
diff changeset
9 const uint8_t *c = frame;
34
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 /* EFR_MAGIC = (*c >> 4) & 0xF; */
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 params[0] = (*c++ & 0xF) << 3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 params[0] |= (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 params[1] = (*c++ & 0x1F) << 3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 params[1] |= (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 params[2] = (*c++ & 0x1F) << 4;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 params[2] |= (*c >> 4) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 params[3] = (*c++ & 0xF) << 4;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 params[3] |= (*c >> 4) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 params[4] = (*c++ & 0xF) << 2;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 params[4] |= (*c >> 6) & 0x3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 params[5] = (*c++ & 0x3F) << 3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 params[5] |= (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 params[6] = (*c >> 1) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 params[7] = (*c++ & 0x1) << 3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 params[7] |= (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 params[8] = (*c >> 1) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 params[9] = (*c++ & 0x1) << 3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 params[9] |= (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 params[10] = (*c >> 1) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 params[11] = (*c++ & 0x1) << 3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 params[11] |= (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 params[12] = (*c >> 2) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 params[13] = (*c++ & 0x3) << 1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 params[13] |= (*c >> 7) & 0x1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 params[14] = (*c >> 4) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 params[15] = (*c >> 1) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 params[16] = (*c++ & 0x1) << 2;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 params[16] |= (*c >> 6) & 0x3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 params[17] = (*c >> 1) & 0x1F;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 params[18] = (*c++ & 0x1) << 5;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 params[18] |= (*c >> 3) & 0x1F;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 params[19] = (*c++ & 0x7) << 1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 params[19] |= (*c >> 7) & 0x1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 params[20] = (*c >> 3) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 params[21] = (*c++ & 0x7) << 1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 params[21] |= (*c >> 7) & 0x1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 params[22] = (*c >> 3) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 params[23] = (*c++ & 0x7) << 1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 params[23] |= (*c >> 7) & 0x1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 params[24] = (*c >> 3) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 params[25] = *c++ & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 params[26] = (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 params[27] = (*c >> 2) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 params[28] = (*c++ & 0x3) << 1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 params[28] |= (*c >> 7) & 0x1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 params[29] = (*c >> 4) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 params[30] = (*c++ & 0xF) << 1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 params[30] |= (*c >> 7) & 0x1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 params[31] = (*c++ & 0x7F) << 2;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 params[31] |= (*c >> 6) & 0x3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 params[32] = (*c >> 2) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 params[33] = (*c++ & 0x3) << 2;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 params[33] |= (*c >> 6) & 0x3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 params[34] = (*c >> 2) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 params[35] = (*c++ & 0x3) << 2;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 params[35] |= (*c >> 6) & 0x3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 params[36] = (*c >> 2) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 params[37] = (*c++ & 0x3) << 2;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 params[37] |= (*c >> 6) & 0x3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 params[38] = (*c >> 3) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 params[39] = *c++ & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 params[40] = (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 params[41] = (*c >> 2) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 params[42] = (*c++ & 0x3) << 1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 params[42] |= (*c >> 7) & 0x1;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 params[43] = (*c >> 2) & 0x1F;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 params[44] = (*c++ & 0x3) << 4;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 params[44] |= (*c >> 4) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 params[45] = *c++ & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 params[46] = (*c >> 4) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 params[47] = *c++ & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 params[48] = (*c >> 4) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 params[49] = *c++ & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 params[50] = (*c >> 4) & 0xF;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 params[51] = (*c >> 1) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 params[52] = (*c++ & 0x1) << 2;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 params[52] |= (*c >> 6) & 0x3;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 params[53] = (*c >> 3) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 params[54] = *c++ & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 params[55] = (*c >> 5) & 0x7;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 params[56] = *c++ & 0x1F;
69b9cbca075b libgsmefr: implement frame unpacking
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 }