diff options
author | Thomas Tsou <tom@tsou.cc> | 2013-11-09 22:25:46 -0500 |
---|---|---|
committer | Thomas Tsou <tom@tsou.cc> | 2013-11-15 23:35:07 -0500 |
commit | b075dd2f73560c7636446856a3b3c19a2556b4cf (patch) | |
tree | e5c6f5f1f5d2ca72db2f52f35b37215580d1f897 /Transceiver52M/sigProcLib.cpp | |
parent | 94edaaeee653a03f6734782169f6ba3c042371e1 (diff) |
Transceiver52M: Dynamically allocate correlation vectors
Stack allocating the correlation output generates a call to the copy
constructor of an zero valued vector. We can avoid this extra copy
constructor with a pointer reference and dynamic allocation.
Signed-off-by: Thomas Tsou <tom@tsou.cc>
Diffstat (limited to 'Transceiver52M/sigProcLib.cpp')
-rw-r--r-- | Transceiver52M/sigProcLib.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 12dcf00..d5f92b7 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1401,7 +1401,7 @@ int detectRACHBurst(signalVector &rxBurst, int rc, start, target, head, tail, len; float _toa; complex _amp; - signalVector corr; + signalVector *corr; CorrelationSequence *sync; if ((sps != 1) && (sps != 4)) @@ -1414,10 +1414,12 @@ int detectRACHBurst(signalVector &rxBurst, start = (target - head) * sps - 1; len = (head + tail) * sps; sync = gRACHSequence; - corr = signalVector(len); + corr = new signalVector(len); - rc = detectBurst(rxBurst, corr, sync, + rc = detectBurst(rxBurst, *corr, sync, thresh, sps, &_amp, &_toa, start, len); + delete corr; + if (rc < 0) { return -1; } else if (!rc) { @@ -1452,7 +1454,7 @@ int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh, int rc, start, target, head, tail, len; complex _amp; float _toa; - signalVector corr; + signalVector *corr; CorrelationSequence *sync; if ((tsc < 0) || (tsc > 7) || ((sps != 1) && (sps != 4))) @@ -1465,10 +1467,12 @@ int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh, start = (target - head) * sps - 1; len = (head + tail) * sps; sync = gMidambles[tsc]; - corr = signalVector(len); + corr = new signalVector(len); - rc = detectBurst(rxBurst, corr, sync, + rc = detectBurst(rxBurst, *corr, sync, thresh, sps, &_amp, &_toa, start, len); + delete corr; + if (rc < 0) { return -1; } else if (!rc) { |