diff options
Diffstat (limited to 'Transceiver52M/Resampler.cpp')
-rw-r--r-- | Transceiver52M/Resampler.cpp | 32 |
1 files changed, 2 insertions, 30 deletions
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 @@ void Resampler::computePath() } } -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 @@ int Resampler::rotate(float *in, size_t in_len, float *out, size_t out_len) 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 @@ size_t Resampler::len() 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 @@ Resampler::~Resampler() { releaseFilters(); - delete history; delete in_index; delete out_path; } |