changeset 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 3b64f255689a
children 913fe3c11890
files libgsmfrp/bad_frame.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmfrp/bad_frame.c	Mon Nov 28 04:00:18 2022 +0000
+++ b/libgsmfrp/bad_frame.c	Mon Nov 28 04:15:20 2022 +0000
@@ -27,6 +27,17 @@
 	return mute_flag;
 }
 
+static void random_grid_pos(struct gsmfr_preproc_state *st, gsm_byte *frame)
+{
+	unsigned sub, Mc;
+
+	for (sub = 0; sub < 4; sub++) {
+		Mc = gsmfr_preproc_prng(st, 2);
+		frame[sub*7+6] &= 0x9F;
+		frame[sub*7+6] |= Mc << 5;
+	}
+}
+
 void gsmfr_preproc_bfi(struct gsmfr_preproc_state *st, int taf, gsm_byte *frame)
 {
 	int mute;
@@ -42,6 +53,7 @@
 	case SPEECH_MUTING:
 		mute = reduce_xmaxc(st->speech_frame);
 		memcpy(frame, &st->speech_frame, sizeof(gsm_frame));
+		random_grid_pos(st, frame);
 		if (mute)
 			st->rx_state = NO_DATA;
 		return;