Transceiver52M: Rename samples-per-symbol variable names

Because repeatedly typing mSamplesPerSymbol is giving me
carpal tunnel syndrome. Replace with the much shorter,
easier to type, and just as clear name of 'sps'.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index cf72cae..b7f3511 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -216,22 +216,24 @@
   }
 }
 
-void initGMSKRotationTables(int samplesPerSymbol) {
-  GMSKRotation = new signalVector(157*samplesPerSymbol);
-  GMSKReverseRotation = new signalVector(157*samplesPerSymbol);
+void initGMSKRotationTables(int sps)
+{
+  GMSKRotation = new signalVector(157 * sps);
+  GMSKReverseRotation = new signalVector(157 * sps);
   signalVector::iterator rotPtr = GMSKRotation->begin();
   signalVector::iterator revPtr = GMSKReverseRotation->begin();
   float phase = 0.0;
   while (rotPtr != GMSKRotation->end()) {
     *rotPtr++ = expjLookup(phase);
     *revPtr++ = expjLookup(-phase);
-    phase += M_PI_F/2.0F/(float) samplesPerSymbol;
+    phase += M_PI_F / 2.0F / (float) sps;
   }
 }
 
-void sigProcLibSetup(int samplesPerSymbol) {
+void sigProcLibSetup(int sps)
+{
   initTrigTables();
-  initGMSKRotationTables(samplesPerSymbol);
+  initGMSKRotationTables(sps);
 }
 
 void GMSKRotate(signalVector &x) {
@@ -437,20 +439,19 @@
 }
 
 
-signalVector* generateGSMPulse(int symbolLength,
-			       int samplesPerSymbol)
+signalVector* generateGSMPulse(int sps, int symbolLength)
 {
 
-  int numSamples = samplesPerSymbol*symbolLength + 1;
+  int numSamples = sps * symbolLength + 1;
   signalVector *x = new signalVector(numSamples);
   signalVector::iterator xP = x->begin();
   int centerPoint = (numSamples-1)/2;
   for (int i = 0; i < numSamples; i++) {
-    float arg = (float) (i-centerPoint)/(float) samplesPerSymbol;
+    float arg = (float) (i - centerPoint) / (float) sps;
     *xP++ = 0.96*exp(-1.1380*arg*arg-0.527*arg*arg*arg*arg); // GSM pulse approx.
   }
 
-  float avgAbsval = sqrtf(vectorNorm2(*x)/samplesPerSymbol);
+  float avgAbsval = sqrtf(vectorNorm2(*x) / sps);
   xP = x->begin();
   for (int i = 0; i < numSamples; i++) 
     *xP++ /= avgAbsval;
@@ -566,12 +567,12 @@
 signalVector *modulateBurst(const BitVector &wBurst,
 			    const signalVector &gsmPulse,
 			    int guardPeriodLength,
-			    int samplesPerSymbol)
+			    int sps)
 {
 
   //static complex staticBurst[157];
 
-  int burstSize = samplesPerSymbol*(wBurst.size()+guardPeriodLength);
+  int burstSize = sps * (wBurst.size() + guardPeriodLength);
   //signalVector modBurst((complex *) staticBurst,0,burstSize);
   signalVector modBurst(burstSize);// = new signalVector(burstSize);
   modBurst.isRealOnly(true);
@@ -584,7 +585,7 @@
   *modBurstItr = 2.0*(wBurst[0] & 0x01)-1.0;
   signalVector::iterator prevVal = modBurstItr;
   for (unsigned int i = 1; i < wBurst.size(); i++) {
-    modBurstItr += samplesPerSymbol;
+    modBurstItr += sps;
     if (wBurst[i] & 0x01) 
       *modBurstItr = *prevVal * complex(0.0,1.0);
     else
@@ -595,7 +596,7 @@
   // if wBurst are the raw bits
   for (unsigned int i = 0; i < wBurst.size(); i++) {
     *modBurstItr = 2.0*(wBurst[i] & 0x01)-1.0;
-    modBurstItr += samplesPerSymbol;
+    modBurstItr += sps;
   }
 
   // shift up pi/2
@@ -837,7 +838,7 @@
 }
 
 bool generateMidamble(signalVector &gsmPulse,
-		      int samplesPerSymbol,
+		      int sps,
 		      int TSC)
 {
 
@@ -856,11 +857,11 @@
   signalVector *middleMidamble = modulateBurst(gTrainingSequence[TSC].segment(5,16),
 					 emptyPulse,
 					 0,
-					 samplesPerSymbol);
+					 sps);
   signalVector *midamble = modulateBurst(gTrainingSequence[TSC],
                                          gsmPulse,
                                          0,
-                                         samplesPerSymbol);
+                                         sps);
   
   if (midamble == NULL) return false;
   if (middleMidamble == NULL) return false;
@@ -886,7 +887,7 @@
 
   LOG(DEBUG) << "TOA: " << gMidambles[TSC]->TOA;
 
-  //gMidambles[TSC]->TOA -= 5*samplesPerSymbol;
+  //gMidambles[TSC]->TOA -= 5*sps;
 
   delete autocorr;
   delete midamble;
@@ -895,7 +896,7 @@
 }
 
 bool generateRACHSequence(signalVector &gsmPulse,
-			  int samplesPerSymbol)
+			  int sps)
 {
   
   if (gRACHSequence) {
@@ -906,7 +907,7 @@
   signalVector *RACHSeq = modulateBurst(gRACHSynchSequence,
 					gsmPulse,
 					0,
-					samplesPerSymbol);
+					sps);
 
   assert(RACHSeq);
 
@@ -928,7 +929,7 @@
 				
 bool detectRACHBurst(signalVector &rxBurst,
 		     float detectThreshold,
-		     int samplesPerSymbol,
+		     int sps,
 		     complex *amplitude,
 		     float* TOA)
 {
@@ -954,7 +955,7 @@
   LOG(DEBUG) << "RACH corr: " << correlatedRACH;
 
   float numSamples = 0.0;
-  for (int i = 57*samplesPerSymbol; i <= 107*samplesPerSymbol;i++) {
+  for (int i = 57 * sps; i <= 107 * sps; i++) {
     if (peakPtr+i >= correlatedRACH.end())
       break;
     valleyPower += (peakPtr+i)->norm2();
@@ -972,7 +973,7 @@
   LOG(DEBUG) << "RACH peakAmpl=" << peakAmpl << " RMS=" << RMS << " peakToMean=" << peakToMean;
   *amplitude = peakAmpl/(gRACHSequence->gain);
 
-  *TOA = (*TOA) - gRACHSequence->TOA - 8*samplesPerSymbol;
+  *TOA = (*TOA) - gRACHSequence->TOA - 8 * sps;
 
   LOG(DEBUG) << "RACH thresh: " << peakToMean;
 
@@ -1002,7 +1003,7 @@
 bool analyzeTrafficBurst(signalVector &rxBurst,
 			 unsigned TSC,
 			 float detectThreshold,
-			 int samplesPerSymbol,
+			 int sps,
 			 complex *amplitude,
 			 float *TOA,
 			 unsigned maxTOA,
@@ -1016,12 +1017,12 @@
   assert(TOA);
   assert(gMidambles[TSC]);
 
-  if (maxTOA < 3*samplesPerSymbol) maxTOA = 3*samplesPerSymbol;
+  if (maxTOA < 3*sps) maxTOA = 3*sps;
   unsigned spanTOA = maxTOA;
-  if (spanTOA < 5*samplesPerSymbol) spanTOA = 5*samplesPerSymbol;
+  if (spanTOA < 5*sps) spanTOA = 5*sps;
 
-  unsigned startIx = 66*samplesPerSymbol-spanTOA;
-  unsigned endIx = (66+16)*samplesPerSymbol+spanTOA;
+  unsigned startIx = 66*sps-spanTOA;
+  unsigned endIx = (66+16)*sps+spanTOA;
   unsigned windowLen = endIx - startIx;
   unsigned corrLen = 2*maxTOA+1;
 
@@ -1048,7 +1049,7 @@
   }
 
   int numRms = 0;
-  for (int i = 2*samplesPerSymbol; i <= 5*samplesPerSymbol;i++) {
+  for (int i = 2*sps; i <= 5*sps;i++) {
     if (peakPtr - i >= correlatedBurst.begin()) { 
       valleyPower += (peakPtr-i)->norm2();
       numRms++;
@@ -1081,30 +1082,36 @@
   LOG(DEBUG) << "autocorr: " << correlatedBurst;
   
   if (requestChannel && (peakToMean > detectThreshold)) {
-    float TOAoffset = maxTOA; //gMidambles[TSC]->TOA+(66*samplesPerSymbol-startIx);
+    float TOAoffset = maxTOA;
     delayVector(correlatedBurst,-(*TOA));
     // midamble only allows estimation of a 6-tap channel
-    signalVector channelVector(6*samplesPerSymbol);
+    signalVector chanVector(6 * sps);
     float maxEnergy = -1.0;
     int maxI = -1;
     for (int i = 0; i < 7; i++) {
-      if (TOAoffset+(i-5)*samplesPerSymbol + channelVector.size() > correlatedBurst.size()) continue;
-      if (TOAoffset+(i-5)*samplesPerSymbol < 0) continue;
-      correlatedBurst.segmentCopyTo(channelVector,(int) floor(TOAoffset+(i-5)*samplesPerSymbol),channelVector.size());
-      float energy = vectorNorm2(channelVector);
+      if (TOAoffset + (i-5) * sps + chanVector.size() > correlatedBurst.size())
+        continue;
+      if (TOAoffset + (i-5) * sps < 0)
+        continue;
+      correlatedBurst.segmentCopyTo(chanVector,
+                                    (int) floor(TOAoffset + (i - 5) * sps),
+                                    chanVector.size());
+      float energy = vectorNorm2(chanVector);
       if (energy > 0.95*maxEnergy) {
 	maxI = i;
 	maxEnergy = energy;
       }
     }
 	
-    *channelResponse = new signalVector(channelVector.size());
-    correlatedBurst.segmentCopyTo(**channelResponse,(int) floor(TOAoffset+(maxI-5)*samplesPerSymbol),(*channelResponse)->size());
-    scaleVector(**channelResponse,complex(1.0,0.0)/gMidambles[TSC]->gain);
+    *channelResponse = new signalVector(chanVector.size());
+    correlatedBurst.segmentCopyTo(**channelResponse,
+                                  (int) floor(TOAoffset + (maxI - 5) * sps),
+                                  (*channelResponse)->size());
+    scaleVector(**channelResponse, complex(1.0, 0.0) / gMidambles[TSC]->gain);
     LOG(DEBUG) << "channelResponse: " << **channelResponse;
     
     if (channelResponseOffset) 
-      *channelResponseOffset = 5*samplesPerSymbol-maxI;
+      *channelResponseOffset = 5 * sps - maxI;
       
   }
 
@@ -1131,7 +1138,7 @@
 
 SoftVector *demodulateBurst(signalVector &rxBurst,
 			 const signalVector &gsmPulse,
-			 int samplesPerSymbol,
+			 int sps,
 			 complex channel,
 			 float TOA) 
 
@@ -1146,8 +1153,8 @@
   GMSKReverseRotate(*shapedBurst);
 
   // run through slicer
-  if (samplesPerSymbol > 1) {
-     signalVector *decShapedBurst = decimateVector(*shapedBurst,samplesPerSymbol);
+  if (sps > 1) {
+     signalVector *decShapedBurst = decimateVector(*shapedBurst, sps);
      shapedBurst = decShapedBurst;
   }
 
@@ -1162,7 +1169,8 @@
   for (; shapedItr < shapedBurst->end(); shapedItr++) 
     *burstItr++ = shapedItr->real();
 
-  if (samplesPerSymbol > 1) delete shapedBurst;
+  if (sps > 1)
+    delete shapedBurst;
 
   return burstBits;
 
@@ -1456,7 +1464,7 @@
 // Assumes symbol-rate sampling!!!!
 SoftVector *equalizeBurst(signalVector &rxBurst,
 		       float TOA,
-		       int samplesPerSymbol,
+		       int sps,
 		       signalVector &w, // feedforward filter
 		       signalVector &b) // feedback filter
 {