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