iface: Add inner ring-buffer implementation

Two buffers, inner and outer, are used in the transceiver
implementation. The outer buffer interfaces with the device receive
interface to guarantee timestamp aligned and contiguously allocated
sample buffers. The inner buffer absorbs vector size differences between
GSM bursts (156 or 157 samples) and the resampler interface (typically
fixed multiples of 65).

Reimplement the inner buffer with a ring buffer that allows fixed size
segments on the outer (resampler) portion and variable lengths (GSM
side) on the inner side. Compared to the previous stack-like version,
this implementation removes unnecessary copying of buffer contents.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
diff --git a/Transceiver52M/Resampler.cpp b/Transceiver52M/Resampler.cpp
index e4b66a7..070adda 100644
--- a/Transceiver52M/Resampler.cpp
+++ b/Transceiver52M/Resampler.cpp
@@ -167,22 +167,13 @@
 	}
 }
 
-int Resampler::rotate(float *in, size_t in_len, float *out, size_t out_len)
+int Resampler::rotate(const float *in, size_t in_len, float *out, size_t out_len)
 {
 	int n, path;
-	int hist_len = filt_len - 1;
 
 	if (!check_vec_len(in_len, out_len, p, q))
 		return -1;
 
-	if (history_on) {
-		memcpy(&in[-2 * hist_len],
-		       history, hist_len * 2 * sizeof(float));
-	} else {
-		memset(&in[-2 * hist_len], 0,
-		       hist_len * 2 * sizeof(float));
-	}
-
 	/* Generate output from precomputed input/output paths */
 	for (size_t i = 0; i < out_len; i++) {
 		n = in_index[i]; 
@@ -194,27 +185,15 @@
 			      n, 1, 1, 0);
 	}
 
-	/* Save history */
-	if (history_on) {
-		memcpy(history, &in[2 * (in_len - hist_len)],
-		       hist_len * 2 * sizeof(float));
-	}
-
 	return out_len;
 }
 
 bool Resampler::init(float bw)
 {
-	size_t hist_len = filt_len - 1;
-
 	/* Filterbank filter internals */
 	if (initFilters(bw) < 0)
 		return false;
 
-	/* History buffer */
-	history = new float[2 * hist_len];
-	memset(history, 0, 2 * hist_len * sizeof(float));
-
 	/* Precompute filterbank paths */
 	in_index = new size_t[MAX_OUTPUT_LEN];
 	out_path = new size_t[MAX_OUTPUT_LEN];
@@ -228,14 +207,8 @@
 	return filt_len;
 }
 
-void Resampler::enableHistory(bool on)
-{
-	history_on = on;
-}
-
 Resampler::Resampler(size_t p, size_t q, size_t filt_len)
-	: in_index(NULL), out_path(NULL), partitions(NULL),
-	  history(NULL), history_on(true)
+	: in_index(NULL), out_path(NULL), partitions(NULL)
 {
 	this->p = p;
 	this->q = q;
@@ -246,7 +219,6 @@
 {
 	releaseFilters();
 
-	delete history;
 	delete in_index;
 	delete out_path;
 }