FreeCalypso > hg > gsm-codec-lib
comparison libgsmfrp/bad_frame.c @ 109:2361a7d8c1eb
libgsmfrp: randomize grid position params when muting speech,
following GSM 06.11 example solution in more detail
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 28 Nov 2022 04:15:20 +0000 |
parents | b2255a5d0519 |
children | f081a6850fb5 |
comparison
equal
deleted
inserted
replaced
108:3b64f255689a | 109:2361a7d8c1eb |
---|---|
25 frame[sub*7+7] |= (xmaxc & 1) << 7; | 25 frame[sub*7+7] |= (xmaxc & 1) << 7; |
26 } | 26 } |
27 return mute_flag; | 27 return mute_flag; |
28 } | 28 } |
29 | 29 |
30 static void random_grid_pos(struct gsmfr_preproc_state *st, gsm_byte *frame) | |
31 { | |
32 unsigned sub, Mc; | |
33 | |
34 for (sub = 0; sub < 4; sub++) { | |
35 Mc = gsmfr_preproc_prng(st, 2); | |
36 frame[sub*7+6] &= 0x9F; | |
37 frame[sub*7+6] |= Mc << 5; | |
38 } | |
39 } | |
40 | |
30 void gsmfr_preproc_bfi(struct gsmfr_preproc_state *st, int taf, gsm_byte *frame) | 41 void gsmfr_preproc_bfi(struct gsmfr_preproc_state *st, int taf, gsm_byte *frame) |
31 { | 42 { |
32 int mute; | 43 int mute; |
33 | 44 |
34 switch (st->rx_state) { | 45 switch (st->rx_state) { |
40 st->rx_state = SPEECH_MUTING; | 51 st->rx_state = SPEECH_MUTING; |
41 return; | 52 return; |
42 case SPEECH_MUTING: | 53 case SPEECH_MUTING: |
43 mute = reduce_xmaxc(st->speech_frame); | 54 mute = reduce_xmaxc(st->speech_frame); |
44 memcpy(frame, &st->speech_frame, sizeof(gsm_frame)); | 55 memcpy(frame, &st->speech_frame, sizeof(gsm_frame)); |
56 random_grid_pos(st, frame); | |
45 if (mute) | 57 if (mute) |
46 st->rx_state = NO_DATA; | 58 st->rx_state = NO_DATA; |
47 return; | 59 return; |
48 case COMFORT_NOISE: | 60 case COMFORT_NOISE: |
49 gsmfr_preproc_gen_cn(st, frame); | 61 gsmfr_preproc_gen_cn(st, frame); |