sigProcLib: Slice SoftVector instead of signalVector for GMSK demod.
This makes it similar to 8-PSK demod and also saves a bit of lines ofcode and
should give us a tiny improvement in performance.
Ideally we need to remove vector slicing at all, because in osmo-bts-trx
we convert back to +-1.0 again (actually to +-127, but it doesn't mater).
So we should rather transmit +-1.0 values to avoid double conversion.
Change-Id: If9ed6f0f80fbe88c994b2f9c3cae91d0d57f4442
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index 0a1fd44..56a1a58 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -737,20 +737,6 @@
return true;
}
-bool vectorSlicer(signalVector *x)
-{
-
- signalVector::iterator xP = x->begin();
- signalVector::iterator xPEnd = x->end();
- while (xP < xPEnd) {
- *xP = (complex) (0.5*(xP->real()+1.0F));
- if (xP->real() > 1.0) *xP = 1.0;
- if (xP->real() < 0.0) *xP = 0.0;
- xP++;
- }
- return true;
-}
-
static signalVector *rotateBurst(const BitVector &wBurst,
int guardPeriodLength, int sps)
{
@@ -2020,6 +2006,22 @@
}
/*
+ * Convert signalVector to SoftVector by taking real part of the signal.
+ */
+static SoftVector *signalToSoftVector(signalVector *dec)
+{
+ SoftVector *bits = new SoftVector(dec->size());
+
+ SoftVector::iterator bit_itr = bits->begin();
+ signalVector::iterator burst_itr = dec->begin();
+
+ for (; burst_itr < dec->end(); burst_itr++)
+ *bit_itr++ = burst_itr->real();
+
+ return bits;
+}
+
+/*
* Shared portion of GMSK and EDGE demodulators consisting of timing
* recovery and single tap channel correction. For 4 SPS (if activated),
* the output is downsampled prior to the 1 SPS modulation specific
@@ -2062,18 +2064,12 @@
/* Shift up by a quarter of a frequency */
GMSKReverseRotate(*dec, 1);
- vectorSlicer(dec);
-
- bits = new SoftVector(dec->size());
-
- SoftVector::iterator bit_itr = bits->begin();
- signalVector::iterator burst_itr = dec->begin();
-
- for (; burst_itr < dec->end(); burst_itr++)
- *bit_itr++ = burst_itr->real();
-
+ /* Take real part of the signal */
+ bits = signalToSoftVector(dec);
delete dec;
+ vectorSlicer(bits);
+
return bits;
}
diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h
index 7dca71f..ed72430 100644
--- a/Transceiver52M/sigProcLib.h
+++ b/Transceiver52M/sigProcLib.h
@@ -101,8 +101,8 @@
unsigned startIx = 0,
unsigned len = 0);
-/** Operate soft slicer on real-valued portion of vector */
-bool vectorSlicer(signalVector *x);
+/** Operate soft slicer on a soft-bit vector */
+bool vectorSlicer(SoftVector *x);
/** GMSK modulate a GSM burst of bits */
signalVector *modulateBurst(const BitVector &wBurst,