FreeCalypso > hg > gsm-codec-lib
comparison libgsmfr2/tfo_dtxd.c @ 532:5a3535470c95
libgsmfr2 TFO: implement DTXd function
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 19 Sep 2024 21:00:18 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
531:c7b1e796e91b | 532:5a3535470c95 |
---|---|
1 /* | |
2 * The function implemented in this module is a post-processor to be invoked | |
3 * after Rx DTX preproc functions if the Rx DTX handler block is used as a | |
4 * TFO transform with DTXd enabled. It selectively transforms certain | |
5 * preproc output frames (CN and silence frames specifically) into SID, | |
6 * thereby allowing the network operator to reap the benefits of DTX on | |
7 * the radio downlink leg. | |
8 */ | |
9 | |
10 #include <stdint.h> | |
11 #include "tw_gsmfr.h" | |
12 #include "pp_state.h" | |
13 | |
14 int gsmfr_tfo_xfrm_dtxd(struct gsmfr_preproc_state *st, uint8_t *frame) | |
15 { | |
16 uint8_t *p, sub; | |
17 | |
18 if (!st->dtxd_sid_flag) | |
19 return 1; /* SP=1: output is a speech frame */ | |
20 /* turn the output frame into SID */ | |
21 p = frame + 5; /* skip magic+LARc */ | |
22 for (sub = 0; sub < 4; sub++) { | |
23 *p++ = 0; | |
24 *p++ &= 0x1F; /* upper 5 bits of Xmaxc field */ | |
25 *p++ &= 0x80; /* and the lsb spilling into the next byte */ | |
26 *p++ = 0; | |
27 *p++ = 0; | |
28 *p++ = 0; | |
29 *p++ = 0; | |
30 } | |
31 return 0; /* SP=0: output is SID */ | |
32 } |