FreeCalypso > hg > gsm-net-reveng
annotate trau-decode/extr-efr.c @ 72:afebef67e8d4 default tip
tmo/CSD-tests: document Experiment 7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 Nov 2024 02:53:59 +0000 |
parents | 0565aaa84b17 |
children |
rev | line source |
---|---|
4
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
9
0565aaa84b17
trau-decode: implement trau-extr program
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
2 * This module implements the EFR decoding part of trau-extr. |
4
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <stdio.h> |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdint.h> |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <gsm_efr.h> |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "osmo_bits.h" |
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
5
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
13 static void |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
14 dbits_to_frame(d_bits, frame) |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
15 ubit_t *d_bits; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
16 uint8_t *frame; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
17 { |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
18 ubit_t intermed[248], *ip; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
19 uint8_t *op, mask; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
20 unsigned nb; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
21 |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
22 intermed[0] = 1; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
23 intermed[1] = 1; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
24 intermed[2] = 0; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
25 intermed[3] = 0; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
26 bcopy(d_bits + 1, intermed + 4, 38); |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
27 bcopy(d_bits + 42, intermed + 42, 53); |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
28 bcopy(d_bits + 98, intermed + 95, 50); |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
29 bcopy(d_bits + 151, intermed + 145, 53); |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
30 bcopy(d_bits + 207, intermed + 198, 50); |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
31 ip = intermed; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
32 op = frame; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
33 for (nb = 0; nb < EFR_RTP_FRAME_LEN; nb++) { |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
34 *op = 0; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
35 for (mask = 0x80; mask; mask >>= 1) { |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
36 if (*ip) |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
37 *op |= mask; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
38 ip++; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
39 } |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
40 op++; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
41 } |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
42 } |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
43 |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
44 void |
9
0565aaa84b17
trau-decode: implement trau-extr program
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
45 convert_efr_frame(d_bits, outf) |
5
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
46 ubit_t *d_bits; |
9
0565aaa84b17
trau-decode: implement trau-extr program
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
47 FILE *outf; |
5
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
48 { |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
49 uint8_t frame[EFR_RTP_FRAME_LEN]; |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
50 |
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
51 dbits_to_frame(d_bits, frame); |
9
0565aaa84b17
trau-decode: implement trau-extr program
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
52 fwrite(frame, 1, EFR_RTP_FRAME_LEN, outf); |
5
bf5c9fb431b8
trau-parse: implement EFR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
53 } |