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

Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c
This commit is contained in:
Alexander Chemeris
2017-03-15 23:23:36 +03:00
parent 14d13b67dc
commit 1dd05cf35a
3 changed files with 9 additions and 17 deletions

View File

@@ -1721,10 +1721,7 @@ static float computePeakRatio(signalVector *corr,
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 @@ bool energyDetect(signalVector &rxBurst,
energy += windowItr->norm2();
windowItr+=4;
}
if (avgPwr) *avgPwr = energy/windowLength;
return (energy/windowLength > detectThreshold*detectThreshold);
return energy/windowLength;
}
/*