Change in ...osmo-trx[master]: Transceiver: Get rid of SoftVector in struct trx_ul_burst_ind

pespin gerrit-no-reply at lists.osmocom.org
Thu Jul 4 22:09:41 UTC 2019


pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-trx/+/14643 )

Change subject: Transceiver: Get rid of SoftVector in struct trx_ul_burst_ind
......................................................................

Transceiver: Get rid of SoftVector in struct trx_ul_burst_ind

Make the interface using trx_ul_burst_ind more implementation agnostic
as well as easier to use. For instance, we don't care about SoftVector
size one returned from pullRadioVector(); we want to use nbits instead.
As a result, we no longer spend time normalizing guard periods. While at
it, change vectorSLicer to return void since it always returns true.

Change-Id: I726e5a98a43367a22c9a4ca5cbd9eb87e6765c7a
---
M Transceiver52M/Transceiver.cpp
M Transceiver52M/Transceiver.h
M Transceiver52M/sigProcLib.cpp
M Transceiver52M/sigProcLib.h
4 files changed, 29 insertions(+), 21 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 6e678ac..4fc277b 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -559,6 +559,7 @@
   int max_i = -1;
   signalVector *burst;
   GSM::Time burstTime;
+  SoftVector *rxBurst;
   TransceiverState *state = &mStates[chan];
 
   /* Blocking FIFO read */
@@ -644,17 +645,18 @@
   }
 
   bi->toa = toa;
-  bi->rxBurst = demodAnyBurst(*burst, mSPSRx, amp, toa, type);
+  rxBurst = demodAnyBurst(*burst, mSPSRx, amp, toa, type);
 
   /* EDGE demodulator returns 444 (gSlotLen * 3) bits */
-  if (bi->rxBurst->size() == EDGE_BURST_NBITS)
+  if (rxBurst->size() == EDGE_BURST_NBITS)
     bi->nbits = EDGE_BURST_NBITS;
   else /* size() here is actually gSlotLen + 8, due to guard periods */
     bi->nbits = gSlotLen;
 
   // Convert -1..+1 soft bits to 0..1 soft bits
-  vectorSlicer(bi->rxBurst);
+  vectorSlicer(bi->rx_burst, rxBurst->begin(), bi->nbits);
 
+  delete rxBurst;
   delete radio_burst;
   return true;
 }
@@ -914,6 +916,14 @@
 
 void Transceiver::logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi)
 {
+  std::ostringstream os;
+  for (size_t i=0; i < bi->nbits; i++) {
+    if (bi->rx_burst[i] > 0.5) os << "1";
+    else if (bi->rx_burst[i] > 0.25) os << "|";
+    else if (bi->rx_burst[i] > 0.0) os << "'";
+    else os << "-";
+  }
+
   LOG(DEBUG) << std::fixed << std::right
     << " chan: "   << chan
     << " time: "   << bi->tn << ":" << bi->fn
@@ -922,7 +932,7 @@
     << " noise: "  << std::setw(5) << std::setprecision(1) << (bi->noise - rssiOffset)
                    << "dBFS/" << std::setw(6) << -bi->noise << "dBm"
     << " TOA: "    << std::setw(5) << std::setprecision(2) << bi->toa
-    << " bits: "   << *(bi->rxBurst);
+    << " bits: "   << os;
 }
 
 void Transceiver::driveReceiveFIFO(size_t chan)
@@ -946,14 +956,12 @@
   osmo_store32be(bi.fn, &pkt->common.fn);
   pkt->v0.rssi = bi.rssi;
   osmo_store16be(TOAint, &pkt->v0.toa);
-  SoftVector::iterator burstItr = bi.rxBurst->begin();
 
   for (unsigned i = 0; i < bi.nbits; i++)
-    pkt->soft_bits[i] = (char) round((*burstItr++) * 255.0);
+    pkt->soft_bits[i] = (char) round(bi.rx_burst[i] * 255.0);
 
   /* +1: Historical reason. There's an uninitizalied byte in there: pkt->soft_bits[bi.nbits] */
   pkt->soft_bits[bi.nbits + 1] = '\0';
-  delete bi.rxBurst;
 
   mDataSockets[chan]->write(burstString, sizeof(struct trxd_hdr_v0) + bi.nbits + 2);
 }
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index 9975823..80047b3 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -35,8 +35,10 @@
 #include "config_defs.h"
 }
 
+#define MAX_RX_BURST_BUF_SIZE EDGE_BURST_NBITS
+
 struct trx_ul_burst_ind {
-        SoftVector *rxBurst;
+        float rx_burst[MAX_RX_BURST_BUF_SIZE]; /* soft bits normalized 0..1 */
         unsigned nbits; // number of symbols per slot in rxBurst, not counting guard periods
         uint32_t fn; // TDMA frame number
         uint8_t tn; // TDMA time-slot number
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index fcda5fa..cff7825 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -530,19 +530,17 @@
   return pulse;
 }
 
-bool vectorSlicer(SoftVector *x)
+/* Convert -1..+1 soft bits to 0..1 soft bits */
+void vectorSlicer(float *dest, const float *src, size_t len)
 {
-  SoftVector::iterator xP = x->begin();
-  SoftVector::iterator xPEnd = x->end();
-  while (xP < xPEnd) {
-    *xP = 0.5 * (*xP + 1.0f);
-    if (*xP > 1.0)
-      *xP = 1.0;
-    if (*xP < 0.0)
-      *xP = 0.0;
-    xP++;
-  }
-  return true;
+	size_t i;
+	for (i = 0; i < len; i++) {
+		dest[i] = 0.5 * (src[i] + 1.0f);
+		if (dest[i] > 1.0)
+			dest[i] = 1.0;
+		else if (dest[i] < 0.0)
+			dest[i] = 0.0;
+	}
 }
 
 static signalVector *rotateBurst(const BitVector &wBurst,
diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h
index 79a5c3f..bae2127 100644
--- a/Transceiver52M/sigProcLib.h
+++ b/Transceiver52M/sigProcLib.h
@@ -59,7 +59,7 @@
 void sigProcLibDestroy(void);
 
 /** Operate soft slicer on a soft-bit vector */
-bool vectorSlicer(SoftVector *x);
+void vectorSlicer(float *dest, const float *src, size_t len);
 
 /** GMSK modulate a GSM burst of bits */
 signalVector *modulateBurst(const BitVector &wBurst,

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14643
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I726e5a98a43367a22c9a4ca5cbd9eb87e6765c7a
Gerrit-Change-Number: 14643
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190704/97d88cf4/attachment.html>


More information about the gerrit-log mailing list