[MERGED] osmo-trx[master]: sigProcLib: Constify demodulation functions burst argument.

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
Tue Mar 28 14:29:57 UTC 2017


Alexander Chemeris has submitted this change and it was merged.

Change subject: sigProcLib: Constify demodulation functions burst argument.
......................................................................


sigProcLib: Constify demodulation functions burst argument.

demodCommon() used to scale input vector in place which changed original data.
That's a bad practice and is not really necessary, so I've changed the code to
scale burst after it's copied to a new vector during a delay operation.

Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3
---
M Transceiver52M/sigProcLib.cpp
M Transceiver52M/sigProcLib.h
2 files changed, 10 insertions(+), 10 deletions(-)

Approvals:
  Tom Tsou: Looks good to me, approved
  Harald Welte: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index eaaae34..4c2222c 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -1253,7 +1253,7 @@
   }
 }
 
-signalVector *delayVector(signalVector *in, signalVector *out, float delay)
+signalVector *delayVector(const signalVector *in, signalVector *out, float delay)
 {
   int whole, index;
   float frac;
@@ -2060,7 +2060,7 @@
  * the output is downsampled prior to the 1 SPS modulation specific
  * stages.
  */
-static signalVector *demodCommon(signalVector &burst, int sps,
+static signalVector *demodCommon(const signalVector &burst, int sps,
                                  complex chan, float toa)
 {
   signalVector *delay, *dec;
@@ -2068,8 +2068,8 @@
   if ((sps != 1) && (sps != 4))
     return NULL;
 
-  scaleVector(burst, (complex) 1.0 / chan);
   delay = delayVector(&burst, NULL, -toa * (float) sps);
+  scaleVector(*delay, (complex) 1.0 / chan);
 
   if (sps == 1)
     return delay;
@@ -2085,7 +2085,7 @@
  * 4 SPS (if activated) to minimize distortion through the fractional
  * delay filters. Symbol rotation and after always operates at 1 SPS.
  */
-SoftVector *demodGmskBurst(signalVector &rxBurst, int sps,
+SoftVector *demodGmskBurst(const signalVector &rxBurst, int sps,
                            complex channel, float TOA)
 {
   SoftVector *bits;
@@ -2114,7 +2114,7 @@
  * through the fractional delay filters at 1 SPS renders signal
  * nearly unrecoverable.
  */
-SoftVector *demodEdgeBurst(signalVector &burst, int sps,
+SoftVector *demodEdgeBurst(const signalVector &burst, int sps,
                            complex chan, float toa)
 {
   SoftVector *bits;
@@ -2138,7 +2138,7 @@
   return bits;
 }
 
-SoftVector *demodAnyBurst(signalVector &burst, int sps, complex amp,
+SoftVector *demodAnyBurst(const signalVector &burst, int sps, complex amp,
                           float toa, CorrType type)
 {
   if (type == EDGE)
diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h
index a67b0ca..4318fe0 100644
--- a/Transceiver52M/sigProcLib.h
+++ b/Transceiver52M/sigProcLib.h
@@ -152,7 +152,7 @@
 float sinc(float x);
 
 /** Delay a vector */
-signalVector *delayVector(signalVector *in, signalVector *out, float delay);
+signalVector *delayVector(const signalVector *in, signalVector *out, float delay);
 
 /** Add two vectors in-place */
 bool addVector(signalVector &x,
@@ -311,7 +311,7 @@
         @param TOA The time-of-arrival of the received burst.
         @return The demodulated bit sequence.
 */
-SoftVector *demodGmskBurst(signalVector &rxBurst, int sps,
+SoftVector *demodGmskBurst(const signalVector &rxBurst, int sps,
                            complex channel, float TOA);
 
 /**
@@ -322,11 +322,11 @@
         @param TOA The time-of-arrival of the received burst.
         @return The demodulated bit sequence.
 */
-SoftVector *demodEdgeBurst(signalVector &rxBurst, int sps,
+SoftVector *demodEdgeBurst(const signalVector &rxBurst, int sps,
                            complex channel, float TOA);
 
 /** Demodulate burst basde on type and output soft bits */
-SoftVector *demodAnyBurst(signalVector &burst, int sps,
+SoftVector *demodAnyBurst(const signalVector &burst, int sps,
                           complex amp, float toa, CorrType type);
 
 #endif /* SIGPROCLIB_H */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3
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: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou <tom at tsou.cc>



More information about the gerrit-log mailing list