[MERGED] osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Alexander Chemeris gerrit-no-reply at lists.osmocom.org
Wed Mar 22 18:33:13 UTC 2017


Alexander Chemeris has submitted this change and it was merged.

Change subject: sigProcLib: make energyDetect() simpler by returning actual energy.
......................................................................


sigProcLib: make energyDetect() simpler by returning actual energy.

Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c
---
M Transceiver52M/Transceiver.cpp
M Transceiver52M/sigProcLib.cpp
M Transceiver52M/sigProcLib.h
3 files changed, 9 insertions(+), 17 deletions(-)

Approvals:
  Tom Tsou: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index f156ad4..3df482f 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -606,7 +606,7 @@
 {
   int rc;
   complex amp;
-  float toa, pow, max = -1.0, avg = 0.0;
+  float toa, max = -1.0, avg = 0.0;
   int max_i = -1;
   signalVector *burst;
   SoftVector *bits = NULL;
@@ -641,7 +641,7 @@
 
   /* Select the diversity channel with highest energy */
   for (size_t i = 0; i < radio_burst->chans(); i++) {
-    energyDetect(*radio_burst->getVector(i), 20 * mSPSRx, 0.0, &pow);
+    float pow = energyDetect(*radio_burst->getVector(i), 20 * mSPSRx);
     if (pow > max) {
       max = pow;
       max_i = i;
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index c1cf12e..41b18cf 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -1721,10 +1721,7 @@
   return (amp.abs()) / rms;
 }
 
-bool energyDetect(signalVector &rxBurst,
-		  unsigned windowLength,
-		  float detectThreshold,
-                  float *avgPwr)
+float energyDetect(signalVector &rxBurst, unsigned windowLength)
 {
 
   signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2;
@@ -1735,8 +1732,7 @@
     energy += windowItr->norm2();
     windowItr+=4;
   }
-  if (avgPwr) *avgPwr = energy/windowLength;
-  return (energy/windowLength > detectThreshold*detectThreshold);
+  return energy/windowLength;
 }
 
 /*
diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h
index 1b646cd..87c0229 100644
--- a/Transceiver52M/sigProcLib.h
+++ b/Transceiver52M/sigProcLib.h
@@ -176,17 +176,13 @@
 		 complex scale);
 
 /**
-        Energy detector, checks to see if received burst energy is above a threshold.
-        @param rxBurst The received GSM burst of interest.
+        Rough energy estimator.
+        @param rxBurst A GSM burst.
         @param windowLength The number of burst samples used to compute burst energy
-        @param detectThreshold The detection threshold, a linear value.
-        @param avgPwr The average power of the received burst.
-        @return True if burst energy is above threshold.
+        @return The average power of the received burst.
 */
-bool energyDetect(signalVector &rxBurst,
-		  unsigned windowLength,
-                  float detectThreshold,
-                  float *avgPwr = NULL);
+float energyDetect(signalVector &rxBurst,
+                   unsigned windowLength);
 
 /**
         RACH aka Access Burst correlator/detector.

-- 
To view, visit https://gerrit.osmocom.org/2136
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Alexander Chemeris <Alexander.Chemeris at gmail.com>
Gerrit-Reviewer: Alexander Chemeris <Alexander.Chemeris at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Tom Tsou <tom at tsou.cc>



More information about the gerrit-log mailing list