diff libgsmhr1/tfo.c @ 582:7d0e565aa1ae

libgsmhr1: implement TFO wrapper around RxFE
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Feb 2025 23:24:17 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmhr1/tfo.c	Thu Feb 13 23:24:17 2025 +0000
@@ -0,0 +1,31 @@
+/*
+ * In this module we implement the TFO transform for HRv1.  Our implementation
+ * of this transform is a wrapper around our RxFE block that was specifically
+ * designed to be usable both for the full decoder and for TFO.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+#include "tw_gsmhr.h"
+#include "namespace.h"
+#include "rxfe.h"
+
+void gsmhr_tfo_xfrm(struct gsmhr_rxfe_state *st, int dtxd, const int16_t *ul,
+		    int16_t *dl)
+{
+	rxfe_main(st, ul, dl, dtxd, NULL, NULL, dl + 19);
+	if (dtxd) {
+		dl[18] = 0;	/* VAD=0 dummy setting */
+		if (!dl[19])	/* turn CN into re-emission of SID */
+			gsmhr_set_sid_cw_params(dl);
+	} else {
+		/* sans-DTX: VAD=1 SP=1 always */
+		dl[18] = 1;
+		dl[19] = 1;
+	}
+	/* homing logic */
+	if (!ul[18] &&
+	    !memcmp(ul, gsmhr_dhf_params, sizeof(int16_t) * GSMHR_NUM_PARAMS))
+		gsmhr_rxfe_reset(st);
+}