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

2017-03-22 Thread Alexander Chemeris
Hello Max, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/2136

to look at the new patch set (#2).

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/36/2136/2

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, );
+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 ,
- unsigned windowLength,
- float detectThreshold,
-  float *avgPwr)
+float energyDetect(signalVector , 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 ,
- unsigned windowLength,
-  float detectThreshold,
-  float *avgPwr = NULL);
+float energyDetect(signalVector ,
+   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: newpatchset
Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Alexander Chemeris 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Tom Tsou 


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

2017-03-20 Thread Alexander Chemeris

Review at  https://gerrit.osmocom.org/2136

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, 10 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/36/2136/1

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, );
+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..f9e21f0 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -1721,10 +1721,8 @@
   return (amp.abs()) / rms;
 }
 
-bool energyDetect(signalVector ,
- unsigned windowLength,
- float detectThreshold,
-  float *avgPwr)
+float energyDetect(signalVector ,
+  unsigned windowLength)
 {
 
   signalVector::const_iterator windowItr = rxBurst.begin(); 
//+rxBurst.size()/2 - 5*windowLength/2;
@@ -1735,8 +1733,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 ,
- unsigned windowLength,
-  float detectThreshold,
-  float *avgPwr = NULL);
+float energyDetect(signalVector ,
+   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: newchange
Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Alexander Chemeris