sigProcLib: constify signalVector arguments for detectBurst() functions.

Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a
This commit is contained in:
Alexander Chemeris
2017-03-17 22:35:02 -07:00
parent 6e1dffd486
commit 1470fcdb5a
2 changed files with 24 additions and 23 deletions

View File

@@ -1707,7 +1707,7 @@ static float computePeakRatio(signalVector *corr,
return (amp.abs()) / rms; return (amp.abs()) / rms;
} }
float energyDetect(signalVector &rxBurst, unsigned windowLength) float energyDetect(const signalVector &rxBurst, unsigned windowLength)
{ {
signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2;
@@ -1729,12 +1729,13 @@ float energyDetect(signalVector &rxBurst, unsigned windowLength)
* For higher oversampling values, we assume the energy detector is in place * For higher oversampling values, we assume the energy detector is in place
* and we run full interpolating peak detection. * and we run full interpolating peak detection.
*/ */
static int detectBurst(signalVector &burst, static int detectBurst(const signalVector &burst,
signalVector &corr, CorrelationSequence *sync, signalVector &corr, CorrelationSequence *sync,
float thresh, int sps, complex *amp, float *toa, float thresh, int sps, complex *amp, float *toa,
int start, int len) int start, int len)
{ {
signalVector *corr_in, *dec = NULL; const signalVector *corr_in;
signalVector *dec = NULL;
if (sps == 4) { if (sps == 4) {
dec = downsampleBurst(burst); dec = downsampleBurst(burst);
@@ -1782,7 +1783,7 @@ static int detectBurst(signalVector &burst,
return 1; return 1;
} }
static float maxAmplitude(signalVector &burst) static float maxAmplitude(const signalVector &burst)
{ {
float max = 0.0; float max = 0.0;
for (size_t i = 0; i < burst.size(); i++) { for (size_t i = 0; i < burst.size(); i++) {
@@ -1803,7 +1804,7 @@ static float maxAmplitude(signalVector &burst)
* head: Search symbols before target * head: Search symbols before target
* tail: Search symbols after target * tail: Search symbols after target
*/ */
int detectGeneralBurst(signalVector &rxBurst, static int detectGeneralBurst(const signalVector &rxBurst,
float thresh, float thresh,
int sps, int sps,
complex &amp, complex &amp,
@@ -1858,7 +1859,7 @@ int detectGeneralBurst(signalVector &rxBurst,
* head: Search 8 symbols before target * head: Search 8 symbols before target
* tail: Search 8 symbols + maximum expected delay * tail: Search 8 symbols + maximum expected delay
*/ */
int detectRACHBurst(signalVector &burst, int detectRACHBurst(const signalVector &burst,
float threshold, float threshold,
int sps, int sps,
complex &amplitude, complex &amplitude,
@@ -1887,7 +1888,7 @@ int detectRACHBurst(signalVector &burst,
* head: Search 6 symbols before target * head: Search 6 symbols before target
* tail: Search 6 symbols + maximum expected delay * tail: Search 6 symbols + maximum expected delay
*/ */
int analyzeTrafficBurst(signalVector &burst, unsigned tsc, float threshold, int analyzeTrafficBurst(const signalVector &burst, unsigned tsc, float threshold,
int sps, complex &amplitude, float &toa, unsigned max_toa) int sps, complex &amplitude, float &toa, unsigned max_toa)
{ {
int rc, target, head, tail; int rc, target, head, tail;
@@ -1906,7 +1907,7 @@ int analyzeTrafficBurst(signalVector &burst, unsigned tsc, float threshold,
return rc; return rc;
} }
int detectEdgeBurst(signalVector &burst, unsigned tsc, float threshold, int detectEdgeBurst(const signalVector &burst, unsigned tsc, float threshold,
int sps, complex &amplitude, float &toa, unsigned max_toa) int sps, complex &amplitude, float &toa, unsigned max_toa)
{ {
int rc, target, head, tail; int rc, target, head, tail;
@@ -1925,7 +1926,7 @@ int detectEdgeBurst(signalVector &burst, unsigned tsc, float threshold,
return rc; return rc;
} }
int detectAnyBurst(signalVector &burst, unsigned tsc, float threshold, int detectAnyBurst(const signalVector &burst, unsigned tsc, float threshold,
int sps, CorrType type, complex &amp, float &toa, int sps, CorrType type, complex &amp, float &toa,
unsigned max_toa) unsigned max_toa)
{ {
@@ -1957,7 +1958,7 @@ int detectAnyBurst(signalVector &burst, unsigned tsc, float threshold,
return rc; return rc;
} }
signalVector *downsampleBurst(signalVector &burst) signalVector *downsampleBurst(const signalVector &burst)
{ {
signalVector *in, *out; signalVector *in, *out;

View File

@@ -201,7 +201,7 @@ void scaleVector(signalVector &x,
@param windowLength The number of burst samples used to compute burst energy @param windowLength The number of burst samples used to compute burst energy
@return The average power of the received burst. @return The average power of the received burst.
*/ */
float energyDetect(signalVector &rxBurst, float energyDetect(const signalVector &rxBurst,
unsigned windowLength); unsigned windowLength);
/** /**
@@ -216,7 +216,7 @@ float energyDetect(signalVector &rxBurst,
negative value (-SignalError) on error, negative value (-SignalError) on error,
zero (SIGERR_NONE) if no burst is detected zero (SIGERR_NONE) if no burst is detected
*/ */
int detectRACHBurst(signalVector &burst, int detectRACHBurst(const signalVector &burst,
float threshold, float threshold,
int sps, int sps,
complex &amplitude, complex &amplitude,
@@ -236,7 +236,7 @@ int detectRACHBurst(signalVector &burst,
negative value (-SignalError) on error, negative value (-SignalError) on error,
zero (SIGERR_NONE) if no burst is detected zero (SIGERR_NONE) if no burst is detected
*/ */
int analyzeTrafficBurst(signalVector &burst, int analyzeTrafficBurst(const signalVector &burst,
unsigned tsc, unsigned tsc,
float threshold, float threshold,
int sps, int sps,
@@ -257,7 +257,7 @@ int analyzeTrafficBurst(signalVector &burst,
negative value (-SignalError) on error, negative value (-SignalError) on error,
zero (SIGERR_NONE) if no burst is detected zero (SIGERR_NONE) if no burst is detected
*/ */
int detectEdgeBurst(signalVector &burst, int detectEdgeBurst(const signalVector &burst,
unsigned tsc, unsigned tsc,
float threshold, float threshold,
int sps, int sps,
@@ -278,7 +278,7 @@ int detectEdgeBurst(signalVector &burst,
negative value (-SignalError) on error, negative value (-SignalError) on error,
zero (SIGERR_NONE) if no burst is detected zero (SIGERR_NONE) if no burst is detected
*/ */
int detectAnyBurst(signalVector &burst, int detectAnyBurst(const signalVector &burst,
unsigned tsc, unsigned tsc,
float threshold, float threshold,
int sps, int sps,
@@ -292,7 +292,7 @@ int detectAnyBurst(signalVector &burst,
@param burst Input burst of at least 624 symbols @param burst Input burst of at least 624 symbols
@return Decimated signal vector of 156 symbols @return Decimated signal vector of 156 symbols
*/ */
signalVector *downsampleBurst(signalVector &burst); signalVector *downsampleBurst(const signalVector &burst);
/** /**
Decimate a vector. Decimate a vector.