osmo-trx[master]: sigProcLib: Remove unused functions from public interface

2017-06-14 Thread Tom Tsou

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifc122aaff23414c363b4b00f99061eed8a6902d0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] osmo-trx[master]: sigProcLib: Remove unused functions from public interface

2017-06-14 Thread Tom Tsou
Tom Tsou has submitted this change and it was merged.

Change subject: sigProcLib: Remove unused functions from public interface
..


sigProcLib: Remove unused functions from public interface

Also remove entirely completely unused calls. Most of these
calls have been around since OpenBTS conception. Nearly a
decade is long enough time for deprecation.

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

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



diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index 9a8c824..3a9a529 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -46,9 +46,9 @@
 #define CLIP_THRESH3.0f
 
 /** Lookup tables for trigonometric approximation */
-float cosTable[TABLESIZE+1]; // add 1 element for wrap around
-float sinTable[TABLESIZE+1];
-float sincTable[TABLESIZE+1];
+static float cosTable[TABLESIZE+1]; // add 1 element for wrap around
+static float sinTable[TABLESIZE+1];
+static float sincTable[TABLESIZE+1];
 
 /** Constants */
 static const float M_PI_F = (float)M_PI;
@@ -64,7 +64,7 @@
 /* Precomputed fractional delay filters */
 static signalVector *delayFilters[DELAYFILTS];
 
-static Complex psk8_table[8] = {
+static const Complex psk8_table[8] = {
Complex(-0.70710678,  0.70710678),
Complex( 0.0, -1.0),
Complex( 0.0,  1.0),
@@ -172,67 +172,7 @@
   GSMPulse4 = NULL;
 }
 
-// dB relative to 1.0.
-// if > 1.0, then return 0 dB
-float dB(float x) {
-  
-  float arg = 1.0F;
-  float dB = 0.0F;
-  
-  if (x >= 1.0F) return 0.0F;
-  if (x <= 0.0F) return -200.0F;
-
-  float prevArg = arg;
-  float prevdB = dB;
-  float stepSize = 16.0F;
-  float dBstepSize = 12.0F;
-  while (stepSize > 1.0F) {
-do {
-  prevArg = arg;
-  prevdB = dB;
-  arg /= stepSize;
-  dB -= dBstepSize;
-} while (arg > x);
-arg = prevArg;
-dB = prevdB;
-stepSize *= 0.5F;
-dBstepSize -= 3.0F;
-  }
- return ((arg-x)*(dB-3.0F) + (x-arg*0.5F)*dB)/(arg - arg*0.5F);
-
-}
-
-// 10^(-dB/10), inverse of dB func.
-float dBinv(float x) {
-  
-  float arg = 1.0F;
-  float dB = 0.0F;
-  
-  if (x >= 0.0F) return 1.0F;
-  if (x <= -200.0F) return 0.0F;
-
-  float prevArg = arg;
-  float prevdB = dB;
-  float stepSize = 16.0F;
-  float dBstepSize = 12.0F;
-  while (stepSize > 1.0F) {
-do {
-  prevArg = arg;
-  prevdB = dB;
-  arg /= stepSize;
-  dB -= dBstepSize;
-} while (dB > x);
-arg = prevArg;
-dB = prevdB;
-stepSize *= 0.5F;
-dBstepSize -= 3.0F;
-  }
-
-  return ((dB-x)*(arg*0.5F)+(x-(dB-3.0F))*(arg))/3.0F;
-
-}
-
-float vectorNorm2(const signalVector ) 
+static float vectorNorm2(const signalVector )
 {
   signalVector::const_iterator xPtr = x.begin();
   float Energy = 0.0;
@@ -241,41 +181,6 @@
   }
   return Energy;
 }
-
-
-float vectorPower(const signalVector ) 
-{
-  return vectorNorm2(x)/x.size();
-}
-
-/** compute cosine via lookup table */
-float cosLookup(const float x)
-{
-  float arg = x*M_1_2PI_F;
-  while (arg > 1.0F) arg -= 1.0F;
-  while (arg < 0.0F) arg += 1.0F;
-
-  const float argT = arg*((float)TABLESIZE);
-  const int argI = (int)argT;
-  const float delta = argT-argI;
-  const float iDelta = 1.0F-delta;
-  return iDelta*cosTable[argI] + delta*cosTable[argI+1];
-}
-
-/** compute sine via lookup table */
-float sinLookup(const float x) 
-{
-  float arg = x*M_1_2PI_F;
-  while (arg > 1.0F) arg -= 1.0F;
-  while (arg < 0.0F) arg += 1.0F;
-
-  const float argT = arg*((float)TABLESIZE);
-  const int argI = (int)argT;
-  const float delta = argT-argI;
-  const float iDelta = 1.0F-delta;
-  return iDelta*sinTable[argI] + delta*sinTable[argI+1];
-}
-
 
 /** compute e^(-jx) via lookup table. */
 static complex expjLookup(float x)
@@ -401,11 +306,18 @@
   return true;
 }
 
-signalVector *convolve(const signalVector *x,
-const signalVector *h,
-signalVector *y,
-ConvType spanType, size_t start,
-size_t len, size_t step, int offset)
+/** Convolution type indicator */
+enum ConvType {
+  START_ONLY,
+  NO_DELAY,
+  CUSTOM,
+  UNDEFINED,
+};
+
+static signalVector *convolve(const signalVector *x, const signalVector *h,
+  signalVector *y, ConvType spanType,
+  size_t start = 0, size_t len = 0,
+  size_t step = 1, int offset = 0)
 {
   int rc;
   size_t head = 0, tail = 0;
@@ -652,29 +564,6 @@
   generateInvertC0Pulse(pulse);
 
   return pulse;
-}
-
-signalVector* reverseConjugate(signalVector *b)
-{
-signalVector *tmp = new signalVector(b->size());
-tmp->isReal(b->isReal());
-

osmo-trx[master]: sigProcLib: Remove unused functions from public interface

2017-06-12 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifc122aaff23414c363b4b00f99061eed8a6902d0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No