From ace0f4a3165000ddabebee8f4657db03744eac19 Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Tue, 13 Jul 2021 20:15:42 +0200 Subject: [PATCH] Performance improvements --- core/src/dsp/resampling.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/core/src/dsp/resampling.h b/core/src/dsp/resampling.h index 00fa637a..a1e6ac44 100644 --- a/core/src/dsp/resampling.h +++ b/core/src/dsp/resampling.h @@ -124,24 +124,19 @@ namespace dsp { while (inOffset < count) { volk_32f_x2_dot_prod_32f(&out.writeBuf[outIndex++], &buffer[inOffset], tapPhases[_counter], tapsPerPhase); _counter += _decim; - while (_counter >= _interp) { - _counter -= _interp; - inOffset++; - } + inOffset += (_counter / _interp); + _counter = (_counter % _interp); } - } if constexpr (std::is_same_v || std::is_same_v) { while (inOffset < count) { volk_32fc_32f_dot_prod_32fc((lv_32fc_t*)&out.writeBuf[outIndex++], (lv_32fc_t*)&buffer[inOffset], tapPhases[_counter], tapsPerPhase); _counter += _decim; - while (_counter >= _interp) { - _counter -= _interp; - inOffset++; - } + inOffset += (_counter / _interp); + _counter = (_counter % _interp); } } - + if (!out.swap(outIndex)) { return -1; } offset = inOffset - count;