From f4ac9bf114598a67e6a0f1da2154fab5f2028c6e Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 12 May 2018 07:25:53 +0200 Subject: [PATCH] RTL-SDR: fixed inf/sup decimators --- plugins/samplesource/rtlsdr/rtlsdrplugin.cpp | 2 +- sdrbase/dsp/decimators.h | 1 - sdrbase/dsp/decimatorsu.h | 2146 +++++++++++++++--- 3 files changed, 1887 insertions(+), 262 deletions(-) diff --git a/plugins/samplesource/rtlsdr/rtlsdrplugin.cpp b/plugins/samplesource/rtlsdr/rtlsdrplugin.cpp index bf9ed0ddc..7cd29731b 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrplugin.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrplugin.cpp @@ -14,7 +14,7 @@ const PluginDescriptor RTLSDRPlugin::m_pluginDescriptor = { QString("RTL-SDR Input"), - QString("3.14.6"), + QString("3.14.7"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/sdrbase/dsp/decimators.h b/sdrbase/dsp/decimators.h index 3de3fb5e7..ee54b56e9 100644 --- a/sdrbase/dsp/decimators.h +++ b/sdrbase/dsp/decimators.h @@ -282,7 +282,6 @@ public: // interleaved I/Q input buffer void decimate1(SampleVector::iterator* it, const T* buf, qint32 len); void decimate2_u(SampleVector::iterator* it, const T* buf, qint32 len); - void decimate2_inf_raw(SampleVector::iterator* it, const T* buf, qint32 len); void decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len); void decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len); void decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len); diff --git a/sdrbase/dsp/decimatorsu.h b/sdrbase/dsp/decimatorsu.h index 60c122b11..91a3f1994 100644 --- a/sdrbase/dsp/decimatorsu.h +++ b/sdrbase/dsp/decimatorsu.h @@ -233,384 +233,2010 @@ void DecimatorsU::decimate1(SampleVec template void DecimatorsU::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len) { - qint32 xreal, yimag; + StorageType buf2[4]; - for (int pos = 0; pos < len - 7; pos += 8) - { - xreal = (buf[pos+0] - buf[pos+3]) << decimation_shifts::pre2; - yimag = (buf[pos+1] + buf[pos+2] - 2*Shift) << decimation_shifts::pre2; - (**it).setReal(xreal >> decimation_shifts::post2); - (**it).setImag(yimag >> decimation_shifts::post2); - ++(*it); + for (int pos = 0; pos < len - 7; pos += 8) + { + m_decimator2.myDecimateInf( + buf[pos+0] << decimation_shifts::pre2, + buf[pos+1] << decimation_shifts::pre2, + buf[pos+2] << decimation_shifts::pre2, + buf[pos+3] << decimation_shifts::pre2, + buf[pos+4] << decimation_shifts::pre2, + buf[pos+5] << decimation_shifts::pre2, + buf[pos+6] << decimation_shifts::pre2, + buf[pos+7] << decimation_shifts::pre2, + &buf2[0]); - xreal = (buf[pos+7] - buf[pos+4]) << decimation_shifts::pre2; - yimag = (2*Shift - buf[pos+5] - buf[pos+6]) << decimation_shifts::pre2; - (**it).setReal(xreal >> decimation_shifts::post2); - (**it).setImag(yimag >> decimation_shifts::post2); - ++(*it); - } + (**it).setReal(buf2[0] >> decimation_shifts::post2); + (**it).setImag(buf2[1] >> decimation_shifts::post2); + ++(*it); + + (**it).setReal(buf2[2] >> decimation_shifts::post2); + (**it).setImag(buf2[3] >> decimation_shifts::post2); + ++(*it); + } } template void DecimatorsU::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len) { - StorageType xreal, yimag; + StorageType buf2[4]; - for (int pos = 0; pos < len - 7; pos += 8) - { - xreal = (buf[pos+1] - buf[pos+2]) << decimation_shifts::pre2; - yimag = (2*Shift - buf[pos+0] - buf[pos+3]) << decimation_shifts::pre2; - (**it).setReal(xreal >> decimation_shifts::post2); - (**it).setImag(yimag >> decimation_shifts::post2); - ++(*it); + for (int pos = 0; pos < len - 7; pos += 8) + { + m_decimator2.myDecimateSup( + buf[pos+0] << decimation_shifts::pre2, + buf[pos+1] << decimation_shifts::pre2, + buf[pos+2] << decimation_shifts::pre2, + buf[pos+3] << decimation_shifts::pre2, + buf[pos+4] << decimation_shifts::pre2, + buf[pos+5] << decimation_shifts::pre2, + buf[pos+6] << decimation_shifts::pre2, + buf[pos+7] << decimation_shifts::pre2, + &buf2[0]); - xreal = (buf[pos+6] - buf[pos+5]) << decimation_shifts::pre2; - yimag = (buf[pos+4] + buf[pos+7] - 2*Shift) << decimation_shifts::pre2; - (**it).setReal(xreal >> decimation_shifts::post2); - (**it).setImag(yimag >> decimation_shifts::post2); - ++(*it); - } + (**it).setReal(buf2[0] >> decimation_shifts::post2); + (**it).setImag(buf2[1] >> decimation_shifts::post2); + ++(*it); + + (**it).setReal(buf2[2] >> decimation_shifts::post2); + (**it).setImag(buf2[3] >> decimation_shifts::post2); + ++(*it); + } } template void DecimatorsU::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len) { - StorageType xreal, yimag; + StorageType buf2[8], buf4[4]; - for (int pos = 0; pos < len - 7; pos += 8) - { - xreal = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre4; - yimag = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre4; + for (int pos = 0; pos < len - 15; pos += 16) + { + m_decimator2.myDecimateInf( + buf[pos+0] << decimation_shifts::pre4, + buf[pos+1] << decimation_shifts::pre4, + buf[pos+2] << decimation_shifts::pre4, + buf[pos+3] << decimation_shifts::pre4, + buf[pos+4] << decimation_shifts::pre4, + buf[pos+5] << decimation_shifts::pre4, + buf[pos+6] << decimation_shifts::pre4, + buf[pos+7] << decimation_shifts::pre4, + &buf2[0]); - (**it).setReal(xreal >> decimation_shifts::post4); - (**it).setImag(yimag >> decimation_shifts::post4); + m_decimator2.myDecimateInf( + buf[pos+8] << decimation_shifts::pre4, + buf[pos+9] << decimation_shifts::pre4, + buf[pos+10] << decimation_shifts::pre4, + buf[pos+11] << decimation_shifts::pre4, + buf[pos+12] << decimation_shifts::pre4, + buf[pos+13] << decimation_shifts::pre4, + buf[pos+14] << decimation_shifts::pre4, + buf[pos+15] << decimation_shifts::pre4, + &buf2[4]); - ++(*it); - } + m_decimator4.myDecimateSup( + buf2[0], + buf2[1], + buf2[2], + buf2[3], + buf2[4], + buf2[5], + buf2[6], + buf2[7], + &buf4[0]); + + (**it).setReal(buf4[0] >> decimation_shifts::post4); + (**it).setImag(buf4[1] >> decimation_shifts::post4); + ++(*it); + + (**it).setReal(buf4[2] >> decimation_shifts::post4); + (**it).setImag(buf4[3] >> decimation_shifts::post4); + ++(*it); + } } template void DecimatorsU::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len) { - // Sup (USB): - // x y x y x y x y / x -> 1,-2,-5,6 / y -> -0,-3,4,7 - // [ rotate: 1, 0, -2, 3, -5, -4, 6, -7] - // Inf (LSB): - // x y x y x y x y / x -> 0,-3,-4,7 / y -> 1,2,-5,-6 - // [ rotate: 0, 1, -3, 2, -4, -5, 7, -6] - StorageType xreal, yimag; + StorageType buf2[8], buf4[4]; - for (int pos = 0; pos < len - 7; pos += 8) - { - xreal = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre4; - yimag = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) << decimation_shifts::pre4; + for (int pos = 0; pos < len - 15; pos += 16) + { + m_decimator2.myDecimateSup( + buf[pos+0] << decimation_shifts::pre4, + buf[pos+1] << decimation_shifts::pre4, + buf[pos+2] << decimation_shifts::pre4, + buf[pos+3] << decimation_shifts::pre4, + buf[pos+4] << decimation_shifts::pre4, + buf[pos+5] << decimation_shifts::pre4, + buf[pos+6] << decimation_shifts::pre4, + buf[pos+7] << decimation_shifts::pre4, + &buf2[0]); - (**it).setReal(xreal >> decimation_shifts::post4); - (**it).setImag(yimag >> decimation_shifts::post4); + m_decimator2.myDecimateSup( + buf[pos+8] << decimation_shifts::pre4, + buf[pos+9] << decimation_shifts::pre4, + buf[pos+10] << decimation_shifts::pre4, + buf[pos+11] << decimation_shifts::pre4, + buf[pos+12] << decimation_shifts::pre4, + buf[pos+13] << decimation_shifts::pre4, + buf[pos+14] << decimation_shifts::pre4, + buf[pos+15] << decimation_shifts::pre4, + &buf2[4]); - ++(*it); - } + m_decimator4.myDecimateInf( + buf2[0], + buf2[1], + buf2[2], + buf2[3], + buf2[4], + buf2[5], + buf2[6], + buf2[7], + &buf4[0]); + + (**it).setReal(buf4[0] >> decimation_shifts::post4); + (**it).setImag(buf4[1] >> decimation_shifts::post4); + ++(*it); + + (**it).setReal(buf4[2] >> decimation_shifts::post4); + (**it).setImag(buf4[3] >> decimation_shifts::post4); + ++(*it); + } } template -void DecimatorsU::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len) +void DecimatorsU::decimate8_inf(SampleVector::iterator* it, const T* buf __attribute__((unused)), qint32 len) { - StorageType xreal[2], yimag[2]; + for (int pos = 0; pos < len - 15; pos += 8) + { + (**it).setReal(0); + (**it).setImag(0); - for (int pos = 0; pos < len - 15; pos += 8) - { - xreal[0] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre8; - yimag[0] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre8; - pos += 8; - - xreal[1] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre8; - yimag[1] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre8; - - m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]); - - (**it).setReal(xreal[1] >> decimation_shifts::post8); - (**it).setImag(yimag[1] >> decimation_shifts::post8); - - ++(*it); - } + ++(*it); + } } template -void DecimatorsU::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len) +void DecimatorsU::decimate8_sup(SampleVector::iterator* it, const T* buf __attribute__((unused)), qint32 len) { - StorageType xreal[2], yimag[2]; + for (int pos = 0; pos < len - 15; pos += 8) + { + (**it).setReal(0); + (**it).setImag(0); - for (int pos = 0; pos < len - 15; pos += 8) - { - xreal[0] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre8; - yimag[0] = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) << decimation_shifts::pre8; - pos += 8; - - xreal[1] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre8; - yimag[1] = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) << decimation_shifts::pre8; - - m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]); - - (**it).setReal(xreal[1] >> decimation_shifts::post8); - (**it).setImag(yimag[1] >> decimation_shifts::post8); - - ++(*it); - } + ++(*it); + } } template void DecimatorsU::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len) { - // Offset tuning: 4x downsample and rotate, then - // downsample 4x more. [ rotate: 0, 1, -3, 2, -4, -5, 7, -6] - StorageType xreal[4], yimag[4]; + StorageType buf2[32], buf4[16], buf8[8], buf16[4]; - for (int pos = 0; pos < len - 31; ) - { - for (int i = 0; i < 4; i++) - { - xreal[i] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre16; - yimag[i] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre16; - pos += 8; - } + for (int pos = 0; pos < len - 63; pos += 64) + { + m_decimator2.myDecimateInf( + buf[pos+0] << decimation_shifts::pre16, + buf[pos+1] << decimation_shifts::pre16, + buf[pos+2] << decimation_shifts::pre16, + buf[pos+3] << decimation_shifts::pre16, + buf[pos+4] << decimation_shifts::pre16, + buf[pos+5] << decimation_shifts::pre16, + buf[pos+6] << decimation_shifts::pre16, + buf[pos+7] << decimation_shifts::pre16, + &buf2[0]); - m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]); - m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]); + m_decimator2.myDecimateInf( + buf[pos+8] << decimation_shifts::pre16, + buf[pos+9] << decimation_shifts::pre16, + buf[pos+10] << decimation_shifts::pre16, + buf[pos+11] << decimation_shifts::pre16, + buf[pos+12] << decimation_shifts::pre16, + buf[pos+13] << decimation_shifts::pre16, + buf[pos+14] << decimation_shifts::pre16, + buf[pos+15] << decimation_shifts::pre16, + &buf2[4]); - m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]); + m_decimator2.myDecimateInf( + buf[pos+16] << decimation_shifts::pre16, + buf[pos+17] << decimation_shifts::pre16, + buf[pos+18] << decimation_shifts::pre16, + buf[pos+19] << decimation_shifts::pre16, + buf[pos+20] << decimation_shifts::pre16, + buf[pos+21] << decimation_shifts::pre16, + buf[pos+22] << decimation_shifts::pre16, + buf[pos+23] << decimation_shifts::pre16, + &buf2[8]); - (**it).setReal(xreal[3] >> decimation_shifts::post16); - (**it).setImag(yimag[3] >> decimation_shifts::post16); + m_decimator2.myDecimateInf( + buf[pos+24] << decimation_shifts::pre16, + buf[pos+25] << decimation_shifts::pre16, + buf[pos+26] << decimation_shifts::pre16, + buf[pos+27] << decimation_shifts::pre16, + buf[pos+28] << decimation_shifts::pre16, + buf[pos+29] << decimation_shifts::pre16, + buf[pos+30] << decimation_shifts::pre16, + buf[pos+31] << decimation_shifts::pre16, + &buf2[12]); - ++(*it); - } + m_decimator2.myDecimateInf( + buf[pos+32] << decimation_shifts::pre16, + buf[pos+33] << decimation_shifts::pre16, + buf[pos+34] << decimation_shifts::pre16, + buf[pos+35] << decimation_shifts::pre16, + buf[pos+36] << decimation_shifts::pre16, + buf[pos+37] << decimation_shifts::pre16, + buf[pos+38] << decimation_shifts::pre16, + buf[pos+39] << decimation_shifts::pre16, + &buf2[16]); + + m_decimator2.myDecimateInf( + buf[pos+40] << decimation_shifts::pre16, + buf[pos+41] << decimation_shifts::pre16, + buf[pos+42] << decimation_shifts::pre16, + buf[pos+43] << decimation_shifts::pre16, + buf[pos+44] << decimation_shifts::pre16, + buf[pos+45] << decimation_shifts::pre16, + buf[pos+46] << decimation_shifts::pre16, + buf[pos+47] << decimation_shifts::pre16, + &buf2[20]); + + m_decimator2.myDecimateInf( + buf[pos+48] << decimation_shifts::pre16, + buf[pos+49] << decimation_shifts::pre16, + buf[pos+50] << decimation_shifts::pre16, + buf[pos+51] << decimation_shifts::pre16, + buf[pos+52] << decimation_shifts::pre16, + buf[pos+53] << decimation_shifts::pre16, + buf[pos+54] << decimation_shifts::pre16, + buf[pos+55] << decimation_shifts::pre16, + &buf2[24]); + + m_decimator2.myDecimateInf( + buf[pos+56] << decimation_shifts::pre16, + buf[pos+57] << decimation_shifts::pre16, + buf[pos+58] << decimation_shifts::pre16, + buf[pos+59] << decimation_shifts::pre16, + buf[pos+60] << decimation_shifts::pre16, + buf[pos+61] << decimation_shifts::pre16, + buf[pos+62] << decimation_shifts::pre16, + buf[pos+63] << decimation_shifts::pre16, + &buf2[28]); + + m_decimator4.myDecimateSup( + &buf2[0], + &buf4[0]); + + m_decimator4.myDecimateSup( + &buf2[8], + &buf4[4]); + + m_decimator4.myDecimateSup( + &buf2[16], + &buf4[8]); + + m_decimator4.myDecimateSup( + &buf2[24], + &buf4[12]); + + m_decimator8.myDecimateSup( + &buf4[0], + &buf8[0]); + + m_decimator8.myDecimateSup( + &buf4[8], + &buf8[4]); + + m_decimator16.myDecimateCen( + &buf8[0], + &buf16[0]); + + (**it).setReal(buf16[0] >> decimation_shifts::post16); + (**it).setImag(buf16[1] >> decimation_shifts::post16); + ++(*it); + + (**it).setReal(buf16[2] >> decimation_shifts::post16); + (**it).setImag(buf16[3] >> decimation_shifts::post16); + ++(*it); + } } template void DecimatorsU::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len) { - // Offset tuning: 4x downsample and rotate, then - // downsample 4x more. [ rotate: 1, 0, -2, 3, -5, -4, 6, -7] - StorageType xreal[4], yimag[4]; + StorageType buf2[32], buf4[16], buf8[8], buf16[4]; - for (int pos = 0; pos < len - 31; ) - { - for (int i = 0; i < 4; i++) - { - xreal[i] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre16; - yimag[i] = (buf[pos+4] + buf[pos+7] - buf[pos+0] - buf[pos+3]) << decimation_shifts::pre16; - pos += 8; - } + for (int pos = 0; pos < len - 63; pos += 64) + { + m_decimator2.myDecimateSup( + buf[pos+0] << decimation_shifts::pre16, + buf[pos+1] << decimation_shifts::pre16, + buf[pos+2] << decimation_shifts::pre16, + buf[pos+3] << decimation_shifts::pre16, + buf[pos+4] << decimation_shifts::pre16, + buf[pos+5] << decimation_shifts::pre16, + buf[pos+6] << decimation_shifts::pre16, + buf[pos+7] << decimation_shifts::pre16, + &buf2[0]); - m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]); - m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]); + m_decimator2.myDecimateSup( + buf[pos+8] << decimation_shifts::pre16, + buf[pos+9] << decimation_shifts::pre16, + buf[pos+10] << decimation_shifts::pre16, + buf[pos+11] << decimation_shifts::pre16, + buf[pos+12] << decimation_shifts::pre16, + buf[pos+13] << decimation_shifts::pre16, + buf[pos+14] << decimation_shifts::pre16, + buf[pos+15] << decimation_shifts::pre16, + &buf2[4]); - m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]); + m_decimator2.myDecimateSup( + buf[pos+16] << decimation_shifts::pre16, + buf[pos+17] << decimation_shifts::pre16, + buf[pos+18] << decimation_shifts::pre16, + buf[pos+19] << decimation_shifts::pre16, + buf[pos+20] << decimation_shifts::pre16, + buf[pos+21] << decimation_shifts::pre16, + buf[pos+22] << decimation_shifts::pre16, + buf[pos+23] << decimation_shifts::pre16, + &buf2[8]); - (**it).setReal(xreal[3] >> decimation_shifts::post16); - (**it).setImag(yimag[3] >> decimation_shifts::post16); + m_decimator2.myDecimateSup( + buf[pos+24] << decimation_shifts::pre16, + buf[pos+25] << decimation_shifts::pre16, + buf[pos+26] << decimation_shifts::pre16, + buf[pos+27] << decimation_shifts::pre16, + buf[pos+28] << decimation_shifts::pre16, + buf[pos+29] << decimation_shifts::pre16, + buf[pos+30] << decimation_shifts::pre16, + buf[pos+31] << decimation_shifts::pre16, + &buf2[12]); - ++(*it); - } + m_decimator2.myDecimateSup( + buf[pos+32] << decimation_shifts::pre16, + buf[pos+33] << decimation_shifts::pre16, + buf[pos+34] << decimation_shifts::pre16, + buf[pos+35] << decimation_shifts::pre16, + buf[pos+36] << decimation_shifts::pre16, + buf[pos+37] << decimation_shifts::pre16, + buf[pos+38] << decimation_shifts::pre16, + buf[pos+39] << decimation_shifts::pre16, + &buf2[16]); + + m_decimator2.myDecimateSup( + buf[pos+40] << decimation_shifts::pre16, + buf[pos+41] << decimation_shifts::pre16, + buf[pos+42] << decimation_shifts::pre16, + buf[pos+43] << decimation_shifts::pre16, + buf[pos+44] << decimation_shifts::pre16, + buf[pos+45] << decimation_shifts::pre16, + buf[pos+46] << decimation_shifts::pre16, + buf[pos+47] << decimation_shifts::pre16, + &buf2[20]); + + m_decimator2.myDecimateSup( + buf[pos+48] << decimation_shifts::pre16, + buf[pos+49] << decimation_shifts::pre16, + buf[pos+50] << decimation_shifts::pre16, + buf[pos+51] << decimation_shifts::pre16, + buf[pos+52] << decimation_shifts::pre16, + buf[pos+53] << decimation_shifts::pre16, + buf[pos+54] << decimation_shifts::pre16, + buf[pos+55] << decimation_shifts::pre16, + &buf2[24]); + + m_decimator2.myDecimateSup( + buf[pos+56] << decimation_shifts::pre16, + buf[pos+57] << decimation_shifts::pre16, + buf[pos+58] << decimation_shifts::pre16, + buf[pos+59] << decimation_shifts::pre16, + buf[pos+60] << decimation_shifts::pre16, + buf[pos+61] << decimation_shifts::pre16, + buf[pos+62] << decimation_shifts::pre16, + buf[pos+63] << decimation_shifts::pre16, + &buf2[28]); + + m_decimator4.myDecimateInf( + &buf2[0], + &buf4[0]); + + m_decimator4.myDecimateInf( + &buf2[8], + &buf4[4]); + + m_decimator4.myDecimateInf( + &buf2[16], + &buf4[8]); + + m_decimator4.myDecimateInf( + &buf2[24], + &buf4[12]); + + m_decimator8.myDecimateInf( + &buf4[0], + &buf8[0]); + + m_decimator8.myDecimateInf( + &buf4[8], + &buf8[4]); + + m_decimator16.myDecimateCen( + &buf8[0], + &buf16[0]); + + (**it).setReal(buf16[0] >> decimation_shifts::post16); + (**it).setImag(buf16[1] >> decimation_shifts::post16); + ++(*it); + + (**it).setReal(buf16[2] >> decimation_shifts::post16); + (**it).setImag(buf16[3] >> decimation_shifts::post16); + ++(*it); + } } template void DecimatorsU::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len) { - StorageType xreal[8], yimag[8]; + StorageType buf2[64], buf4[32], buf8[16], buf16[8], buf32[4]; - for (int pos = 0; pos < len - 63; ) - { - for (int i = 0; i < 8; i++) - { - xreal[i] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre32; - yimag[i] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre32; - pos += 8; - } + for (int pos = 0; pos < len - 127; pos += 128) + { + m_decimator2.myDecimateInf( + buf[pos+0] << decimation_shifts::pre32, + buf[pos+1] << decimation_shifts::pre32, + buf[pos+2] << decimation_shifts::pre32, + buf[pos+3] << decimation_shifts::pre32, + buf[pos+4] << decimation_shifts::pre32, + buf[pos+5] << decimation_shifts::pre32, + buf[pos+6] << decimation_shifts::pre32, + buf[pos+7] << decimation_shifts::pre32, + &buf2[0]); - m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]); - m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]); - m_decimator2.myDecimate(xreal[4], yimag[4], &xreal[5], &yimag[5]); - m_decimator2.myDecimate(xreal[6], yimag[6], &xreal[7], &yimag[7]); + m_decimator2.myDecimateInf( + buf[pos+8] << decimation_shifts::pre32, + buf[pos+9] << decimation_shifts::pre32, + buf[pos+10] << decimation_shifts::pre32, + buf[pos+11] << decimation_shifts::pre32, + buf[pos+12] << decimation_shifts::pre32, + buf[pos+13] << decimation_shifts::pre32, + buf[pos+14] << decimation_shifts::pre32, + buf[pos+15] << decimation_shifts::pre32, + &buf2[4]); - m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]); - m_decimator4.myDecimate(xreal[5], yimag[5], &xreal[7], &yimag[7]); + m_decimator2.myDecimateInf( + buf[pos+16] << decimation_shifts::pre32, + buf[pos+17] << decimation_shifts::pre32, + buf[pos+18] << decimation_shifts::pre32, + buf[pos+19] << decimation_shifts::pre32, + buf[pos+20] << decimation_shifts::pre32, + buf[pos+21] << decimation_shifts::pre32, + buf[pos+22] << decimation_shifts::pre32, + buf[pos+23] << decimation_shifts::pre32, + &buf2[8]); - m_decimator8.myDecimate(xreal[3], yimag[3], &xreal[7], &yimag[7]); + m_decimator2.myDecimateInf( + buf[pos+24] << decimation_shifts::pre32, + buf[pos+25] << decimation_shifts::pre32, + buf[pos+26] << decimation_shifts::pre32, + buf[pos+27] << decimation_shifts::pre32, + buf[pos+28] << decimation_shifts::pre32, + buf[pos+29] << decimation_shifts::pre32, + buf[pos+30] << decimation_shifts::pre32, + buf[pos+31] << decimation_shifts::pre32, + &buf2[12]); - (**it).setReal(xreal[7] >> decimation_shifts::post32); - (**it).setImag(yimag[7] >> decimation_shifts::post32); + m_decimator2.myDecimateInf( + buf[pos+32] << decimation_shifts::pre32, + buf[pos+33] << decimation_shifts::pre32, + buf[pos+34] << decimation_shifts::pre32, + buf[pos+35] << decimation_shifts::pre32, + buf[pos+36] << decimation_shifts::pre32, + buf[pos+37] << decimation_shifts::pre32, + buf[pos+38] << decimation_shifts::pre32, + buf[pos+39] << decimation_shifts::pre32, + &buf2[16]); - ++(*it); - } + m_decimator2.myDecimateInf( + buf[pos+40] << decimation_shifts::pre32, + buf[pos+41] << decimation_shifts::pre32, + buf[pos+42] << decimation_shifts::pre32, + buf[pos+43] << decimation_shifts::pre32, + buf[pos+44] << decimation_shifts::pre32, + buf[pos+45] << decimation_shifts::pre32, + buf[pos+46] << decimation_shifts::pre32, + buf[pos+47] << decimation_shifts::pre32, + &buf2[20]); + + m_decimator2.myDecimateInf( + buf[pos+48] << decimation_shifts::pre32, + buf[pos+49] << decimation_shifts::pre32, + buf[pos+50] << decimation_shifts::pre32, + buf[pos+51] << decimation_shifts::pre32, + buf[pos+52] << decimation_shifts::pre32, + buf[pos+53] << decimation_shifts::pre32, + buf[pos+54] << decimation_shifts::pre32, + buf[pos+55] << decimation_shifts::pre32, + &buf2[24]); + + m_decimator2.myDecimateInf( + buf[pos+56] << decimation_shifts::pre32, + buf[pos+57] << decimation_shifts::pre32, + buf[pos+58] << decimation_shifts::pre32, + buf[pos+59] << decimation_shifts::pre32, + buf[pos+60] << decimation_shifts::pre32, + buf[pos+61] << decimation_shifts::pre32, + buf[pos+62] << decimation_shifts::pre32, + buf[pos+63] << decimation_shifts::pre32, + &buf2[28]); + + m_decimator2.myDecimateInf( + buf[pos+64] << decimation_shifts::pre32, + buf[pos+65] << decimation_shifts::pre32, + buf[pos+66] << decimation_shifts::pre32, + buf[pos+67] << decimation_shifts::pre32, + buf[pos+68] << decimation_shifts::pre32, + buf[pos+69] << decimation_shifts::pre32, + buf[pos+70] << decimation_shifts::pre32, + buf[pos+71] << decimation_shifts::pre32, + &buf2[32]); + + m_decimator2.myDecimateInf( + buf[pos+72] << decimation_shifts::pre32, + buf[pos+73] << decimation_shifts::pre32, + buf[pos+74] << decimation_shifts::pre32, + buf[pos+75] << decimation_shifts::pre32, + buf[pos+76] << decimation_shifts::pre32, + buf[pos+77] << decimation_shifts::pre32, + buf[pos+78] << decimation_shifts::pre32, + buf[pos+79] << decimation_shifts::pre32, + &buf2[36]); + + m_decimator2.myDecimateInf( + buf[pos+80] << decimation_shifts::pre32, + buf[pos+81] << decimation_shifts::pre32, + buf[pos+82] << decimation_shifts::pre32, + buf[pos+83] << decimation_shifts::pre32, + buf[pos+84] << decimation_shifts::pre32, + buf[pos+85] << decimation_shifts::pre32, + buf[pos+86] << decimation_shifts::pre32, + buf[pos+87] << decimation_shifts::pre32, + &buf2[40]); + + m_decimator2.myDecimateInf( + buf[pos+88] << decimation_shifts::pre32, + buf[pos+89] << decimation_shifts::pre32, + buf[pos+90] << decimation_shifts::pre32, + buf[pos+91] << decimation_shifts::pre32, + buf[pos+92] << decimation_shifts::pre32, + buf[pos+93] << decimation_shifts::pre32, + buf[pos+94] << decimation_shifts::pre32, + buf[pos+95] << decimation_shifts::pre32, + &buf2[44]); + + m_decimator2.myDecimateInf( + buf[pos+96] << decimation_shifts::pre32, + buf[pos+97] << decimation_shifts::pre32, + buf[pos+98] << decimation_shifts::pre32, + buf[pos+99] << decimation_shifts::pre32, + buf[pos+100] << decimation_shifts::pre32, + buf[pos+101] << decimation_shifts::pre32, + buf[pos+102] << decimation_shifts::pre32, + buf[pos+103] << decimation_shifts::pre32, + &buf2[48]); + + m_decimator2.myDecimateInf( + buf[pos+104] << decimation_shifts::pre32, + buf[pos+105] << decimation_shifts::pre32, + buf[pos+106] << decimation_shifts::pre32, + buf[pos+107] << decimation_shifts::pre32, + buf[pos+108] << decimation_shifts::pre32, + buf[pos+109] << decimation_shifts::pre32, + buf[pos+110] << decimation_shifts::pre32, + buf[pos+111] << decimation_shifts::pre32, + &buf2[52]); + + m_decimator2.myDecimateInf( + buf[pos+112] << decimation_shifts::pre32, + buf[pos+113] << decimation_shifts::pre32, + buf[pos+114] << decimation_shifts::pre32, + buf[pos+115] << decimation_shifts::pre32, + buf[pos+116] << decimation_shifts::pre32, + buf[pos+117] << decimation_shifts::pre32, + buf[pos+118] << decimation_shifts::pre32, + buf[pos+119] << decimation_shifts::pre32, + &buf2[56]); + + m_decimator2.myDecimateInf( + buf[pos+120] << decimation_shifts::pre32, + buf[pos+121] << decimation_shifts::pre32, + buf[pos+122] << decimation_shifts::pre32, + buf[pos+123] << decimation_shifts::pre32, + buf[pos+124] << decimation_shifts::pre32, + buf[pos+125] << decimation_shifts::pre32, + buf[pos+126] << decimation_shifts::pre32, + buf[pos+127] << decimation_shifts::pre32, + &buf2[60]); + + m_decimator4.myDecimateSup( + &buf2[0], + &buf4[0]); + + m_decimator4.myDecimateSup( + &buf2[8], + &buf4[4]); + + m_decimator4.myDecimateSup( + &buf2[16], + &buf4[8]); + + m_decimator4.myDecimateSup( + &buf2[24], + &buf4[12]); + + m_decimator4.myDecimateSup( + &buf2[32], + &buf4[16]); + + m_decimator4.myDecimateSup( + &buf2[40], + &buf4[20]); + + m_decimator4.myDecimateSup( + &buf2[48], + &buf4[24]); + + m_decimator4.myDecimateSup( + &buf2[56], + &buf4[28]); + + m_decimator8.myDecimateSup( + &buf4[0], + &buf8[0]); + + m_decimator8.myDecimateSup( + &buf4[8], + &buf8[4]); + + m_decimator8.myDecimateSup( + &buf4[16], + &buf8[8]); + + m_decimator8.myDecimateSup( + &buf4[24], + &buf8[12]); + + m_decimator16.myDecimateSup( + &buf8[0], + &buf16[0]); + + m_decimator16.myDecimateSup( + &buf8[8], + &buf16[4]); + + m_decimator32.myDecimateCen( + &buf16[0], + &buf32[0]); + + (**it).setReal(buf32[0] >> decimation_shifts::post32); + (**it).setImag(buf32[1] >> decimation_shifts::post32); + ++(*it); + + (**it).setReal(buf32[2] >> decimation_shifts::post32); + (**it).setImag(buf32[3] >> decimation_shifts::post32); + ++(*it); + } } template void DecimatorsU::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len) { - StorageType xreal[8], yimag[8]; + StorageType buf2[64], buf4[32], buf8[16], buf16[8], buf32[4]; - for (int pos = 0; pos < len - 63; ) - { - for (int i = 0; i < 8; i++) - { - xreal[i] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre32; - yimag[i] = (buf[pos+4] + buf[pos+7] - buf[pos+0] - buf[pos+3]) << decimation_shifts::pre32; - pos += 8; - } + for (int pos = 0; pos < len - 127; pos += 128) + { + m_decimator2.myDecimateSup( + buf[pos+0] << decimation_shifts::pre32, + buf[pos+1] << decimation_shifts::pre32, + buf[pos+2] << decimation_shifts::pre32, + buf[pos+3] << decimation_shifts::pre32, + buf[pos+4] << decimation_shifts::pre32, + buf[pos+5] << decimation_shifts::pre32, + buf[pos+6] << decimation_shifts::pre32, + buf[pos+7] << decimation_shifts::pre32, + &buf2[0]); - m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]); - m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]); - m_decimator2.myDecimate(xreal[4], yimag[4], &xreal[5], &yimag[5]); - m_decimator2.myDecimate(xreal[6], yimag[6], &xreal[7], &yimag[7]); + m_decimator2.myDecimateSup( + buf[pos+8] << decimation_shifts::pre32, + buf[pos+9] << decimation_shifts::pre32, + buf[pos+10] << decimation_shifts::pre32, + buf[pos+11] << decimation_shifts::pre32, + buf[pos+12] << decimation_shifts::pre32, + buf[pos+13] << decimation_shifts::pre32, + buf[pos+14] << decimation_shifts::pre32, + buf[pos+15] << decimation_shifts::pre32, + &buf2[4]); - m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]); - m_decimator4.myDecimate(xreal[5], yimag[5], &xreal[7], &yimag[7]); + m_decimator2.myDecimateSup( + buf[pos+16] << decimation_shifts::pre32, + buf[pos+17] << decimation_shifts::pre32, + buf[pos+18] << decimation_shifts::pre32, + buf[pos+19] << decimation_shifts::pre32, + buf[pos+20] << decimation_shifts::pre32, + buf[pos+21] << decimation_shifts::pre32, + buf[pos+22] << decimation_shifts::pre32, + buf[pos+23] << decimation_shifts::pre32, + &buf2[8]); - m_decimator8.myDecimate(xreal[3], yimag[3], &xreal[7], &yimag[7]); + m_decimator2.myDecimateSup( + buf[pos+24] << decimation_shifts::pre32, + buf[pos+25] << decimation_shifts::pre32, + buf[pos+26] << decimation_shifts::pre32, + buf[pos+27] << decimation_shifts::pre32, + buf[pos+28] << decimation_shifts::pre32, + buf[pos+29] << decimation_shifts::pre32, + buf[pos+30] << decimation_shifts::pre32, + buf[pos+31] << decimation_shifts::pre32, + &buf2[12]); - (**it).setReal(xreal[7] >> decimation_shifts::post32); - (**it).setImag(yimag[7] >> decimation_shifts::post32); + m_decimator2.myDecimateSup( + buf[pos+32] << decimation_shifts::pre32, + buf[pos+33] << decimation_shifts::pre32, + buf[pos+34] << decimation_shifts::pre32, + buf[pos+35] << decimation_shifts::pre32, + buf[pos+36] << decimation_shifts::pre32, + buf[pos+37] << decimation_shifts::pre32, + buf[pos+38] << decimation_shifts::pre32, + buf[pos+39] << decimation_shifts::pre32, + &buf2[16]); - ++(*it); - } + m_decimator2.myDecimateSup( + buf[pos+40] << decimation_shifts::pre32, + buf[pos+41] << decimation_shifts::pre32, + buf[pos+42] << decimation_shifts::pre32, + buf[pos+43] << decimation_shifts::pre32, + buf[pos+44] << decimation_shifts::pre32, + buf[pos+45] << decimation_shifts::pre32, + buf[pos+46] << decimation_shifts::pre32, + buf[pos+47] << decimation_shifts::pre32, + &buf2[20]); + + m_decimator2.myDecimateSup( + buf[pos+48] << decimation_shifts::pre32, + buf[pos+49] << decimation_shifts::pre32, + buf[pos+50] << decimation_shifts::pre32, + buf[pos+51] << decimation_shifts::pre32, + buf[pos+52] << decimation_shifts::pre32, + buf[pos+53] << decimation_shifts::pre32, + buf[pos+54] << decimation_shifts::pre32, + buf[pos+55] << decimation_shifts::pre32, + &buf2[24]); + + m_decimator2.myDecimateSup( + buf[pos+56] << decimation_shifts::pre32, + buf[pos+57] << decimation_shifts::pre32, + buf[pos+58] << decimation_shifts::pre32, + buf[pos+59] << decimation_shifts::pre32, + buf[pos+60] << decimation_shifts::pre32, + buf[pos+61] << decimation_shifts::pre32, + buf[pos+62] << decimation_shifts::pre32, + buf[pos+63] << decimation_shifts::pre32, + &buf2[28]); + + m_decimator2.myDecimateSup( + buf[pos+64] << decimation_shifts::pre32, + buf[pos+65] << decimation_shifts::pre32, + buf[pos+66] << decimation_shifts::pre32, + buf[pos+67] << decimation_shifts::pre32, + buf[pos+68] << decimation_shifts::pre32, + buf[pos+69] << decimation_shifts::pre32, + buf[pos+70] << decimation_shifts::pre32, + buf[pos+71] << decimation_shifts::pre32, + &buf2[32]); + + m_decimator2.myDecimateSup( + buf[pos+72] << decimation_shifts::pre32, + buf[pos+73] << decimation_shifts::pre32, + buf[pos+74] << decimation_shifts::pre32, + buf[pos+75] << decimation_shifts::pre32, + buf[pos+76] << decimation_shifts::pre32, + buf[pos+77] << decimation_shifts::pre32, + buf[pos+78] << decimation_shifts::pre32, + buf[pos+79] << decimation_shifts::pre32, + &buf2[36]); + + m_decimator2.myDecimateSup( + buf[pos+80] << decimation_shifts::pre32, + buf[pos+81] << decimation_shifts::pre32, + buf[pos+82] << decimation_shifts::pre32, + buf[pos+83] << decimation_shifts::pre32, + buf[pos+84] << decimation_shifts::pre32, + buf[pos+85] << decimation_shifts::pre32, + buf[pos+86] << decimation_shifts::pre32, + buf[pos+87] << decimation_shifts::pre32, + &buf2[40]); + + m_decimator2.myDecimateSup( + buf[pos+88] << decimation_shifts::pre32, + buf[pos+89] << decimation_shifts::pre32, + buf[pos+90] << decimation_shifts::pre32, + buf[pos+91] << decimation_shifts::pre32, + buf[pos+92] << decimation_shifts::pre32, + buf[pos+93] << decimation_shifts::pre32, + buf[pos+94] << decimation_shifts::pre32, + buf[pos+95] << decimation_shifts::pre32, + &buf2[44]); + + m_decimator2.myDecimateSup( + buf[pos+96] << decimation_shifts::pre32, + buf[pos+97] << decimation_shifts::pre32, + buf[pos+98] << decimation_shifts::pre32, + buf[pos+99] << decimation_shifts::pre32, + buf[pos+100] << decimation_shifts::pre32, + buf[pos+101] << decimation_shifts::pre32, + buf[pos+102] << decimation_shifts::pre32, + buf[pos+103] << decimation_shifts::pre32, + &buf2[48]); + + m_decimator2.myDecimateSup( + buf[pos+104] << decimation_shifts::pre32, + buf[pos+105] << decimation_shifts::pre32, + buf[pos+106] << decimation_shifts::pre32, + buf[pos+107] << decimation_shifts::pre32, + buf[pos+108] << decimation_shifts::pre32, + buf[pos+109] << decimation_shifts::pre32, + buf[pos+110] << decimation_shifts::pre32, + buf[pos+111] << decimation_shifts::pre32, + &buf2[52]); + + m_decimator2.myDecimateSup( + buf[pos+112] << decimation_shifts::pre32, + buf[pos+113] << decimation_shifts::pre32, + buf[pos+114] << decimation_shifts::pre32, + buf[pos+115] << decimation_shifts::pre32, + buf[pos+116] << decimation_shifts::pre32, + buf[pos+117] << decimation_shifts::pre32, + buf[pos+118] << decimation_shifts::pre32, + buf[pos+119] << decimation_shifts::pre32, + &buf2[56]); + + m_decimator2.myDecimateSup( + buf[pos+120] << decimation_shifts::pre32, + buf[pos+121] << decimation_shifts::pre32, + buf[pos+122] << decimation_shifts::pre32, + buf[pos+123] << decimation_shifts::pre32, + buf[pos+124] << decimation_shifts::pre32, + buf[pos+125] << decimation_shifts::pre32, + buf[pos+126] << decimation_shifts::pre32, + buf[pos+127] << decimation_shifts::pre32, + &buf2[60]); + + m_decimator4.myDecimateInf( + &buf2[0], + &buf4[0]); + + m_decimator4.myDecimateInf( + &buf2[8], + &buf4[4]); + + m_decimator4.myDecimateInf( + &buf2[16], + &buf4[8]); + + m_decimator4.myDecimateInf( + &buf2[24], + &buf4[12]); + + m_decimator4.myDecimateInf( + &buf2[32], + &buf4[16]); + + m_decimator4.myDecimateInf( + &buf2[40], + &buf4[20]); + + m_decimator4.myDecimateInf( + &buf2[48], + &buf4[24]); + + m_decimator4.myDecimateInf( + &buf2[56], + &buf4[28]); + + m_decimator8.myDecimateInf( + &buf4[0], + &buf8[0]); + + m_decimator8.myDecimateInf( + &buf4[8], + &buf8[4]); + + m_decimator8.myDecimateInf( + &buf4[16], + &buf8[8]); + + m_decimator8.myDecimateInf( + &buf4[24], + &buf8[12]); + + m_decimator16.myDecimateInf( + &buf8[0], + &buf16[0]); + + m_decimator16.myDecimateInf( + &buf8[8], + &buf16[4]); + + m_decimator32.myDecimateCen( + &buf16[0], + &buf32[0]); + + (**it).setReal(buf32[0] >> decimation_shifts::post32); + (**it).setImag(buf32[1] >> decimation_shifts::post32); + ++(*it); + + (**it).setReal(buf32[2] >> decimation_shifts::post32); + (**it).setImag(buf32[3] >> decimation_shifts::post32); + ++(*it); + } } template void DecimatorsU::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len) { - StorageType xreal[16], yimag[16]; + StorageType buf2[128], buf4[64], buf8[32], buf16[16], buf32[8], buf64[4]; - for (int pos = 0; pos < len - 127; ) - { - for (int i = 0; i < 16; i++) - { - xreal[i] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre64; - yimag[i] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre64; - pos += 8; - } + for (int pos = 0; pos < len - 255; pos += 256) + { + m_decimator2.myDecimateInf( + buf[pos+0] << decimation_shifts::pre64, + buf[pos+1] << decimation_shifts::pre64, + buf[pos+2] << decimation_shifts::pre64, + buf[pos+3] << decimation_shifts::pre64, + buf[pos+4] << decimation_shifts::pre64, + buf[pos+5] << decimation_shifts::pre64, + buf[pos+6] << decimation_shifts::pre64, + buf[pos+7] << decimation_shifts::pre64, + &buf2[0]); - m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]); - m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]); - m_decimator2.myDecimate(xreal[4], yimag[4], &xreal[5], &yimag[5]); - m_decimator2.myDecimate(xreal[6], yimag[6], &xreal[7], &yimag[7]); - m_decimator2.myDecimate(xreal[8], yimag[8], &xreal[9], &yimag[9]); - m_decimator2.myDecimate(xreal[10], yimag[10], &xreal[11], &yimag[11]); - m_decimator2.myDecimate(xreal[12], yimag[12], &xreal[13], &yimag[13]); - m_decimator2.myDecimate(xreal[14], yimag[14], &xreal[15], &yimag[15]); + m_decimator2.myDecimateInf( + buf[pos+8] << decimation_shifts::pre64, + buf[pos+9] << decimation_shifts::pre64, + buf[pos+10] << decimation_shifts::pre64, + buf[pos+11] << decimation_shifts::pre64, + buf[pos+12] << decimation_shifts::pre64, + buf[pos+13] << decimation_shifts::pre64, + buf[pos+14] << decimation_shifts::pre64, + buf[pos+15] << decimation_shifts::pre64, + &buf2[4]); - m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]); - m_decimator4.myDecimate(xreal[5], yimag[5], &xreal[7], &yimag[7]); - m_decimator4.myDecimate(xreal[9], yimag[9], &xreal[11], &yimag[11]); - m_decimator4.myDecimate(xreal[13], yimag[13], &xreal[15], &yimag[15]); + m_decimator2.myDecimateInf( + buf[pos+16] << decimation_shifts::pre64, + buf[pos+17] << decimation_shifts::pre64, + buf[pos+18] << decimation_shifts::pre64, + buf[pos+19] << decimation_shifts::pre64, + buf[pos+20] << decimation_shifts::pre64, + buf[pos+21] << decimation_shifts::pre64, + buf[pos+22] << decimation_shifts::pre64, + buf[pos+23] << decimation_shifts::pre64, + &buf2[8]); - m_decimator8.myDecimate(xreal[3], yimag[3], &xreal[7], &yimag[7]); - m_decimator8.myDecimate(xreal[11], yimag[11], &xreal[15], &yimag[15]); + m_decimator2.myDecimateInf( + buf[pos+24] << decimation_shifts::pre64, + buf[pos+25] << decimation_shifts::pre64, + buf[pos+26] << decimation_shifts::pre64, + buf[pos+27] << decimation_shifts::pre64, + buf[pos+28] << decimation_shifts::pre64, + buf[pos+29] << decimation_shifts::pre64, + buf[pos+30] << decimation_shifts::pre64, + buf[pos+31] << decimation_shifts::pre64, + &buf2[12]); - m_decimator16.myDecimate(xreal[7], yimag[7], &xreal[15], &yimag[15]); + m_decimator2.myDecimateInf( + buf[pos+32] << decimation_shifts::pre64, + buf[pos+33] << decimation_shifts::pre64, + buf[pos+34] << decimation_shifts::pre64, + buf[pos+35] << decimation_shifts::pre64, + buf[pos+36] << decimation_shifts::pre64, + buf[pos+37] << decimation_shifts::pre64, + buf[pos+38] << decimation_shifts::pre64, + buf[pos+39] << decimation_shifts::pre64, + &buf2[16]); - (**it).setReal(xreal[15] >> decimation_shifts::post64); - (**it).setImag(yimag[15] >> decimation_shifts::post64); + m_decimator2.myDecimateInf( + buf[pos+40] << decimation_shifts::pre64, + buf[pos+41] << decimation_shifts::pre64, + buf[pos+42] << decimation_shifts::pre64, + buf[pos+43] << decimation_shifts::pre64, + buf[pos+44] << decimation_shifts::pre64, + buf[pos+45] << decimation_shifts::pre64, + buf[pos+46] << decimation_shifts::pre64, + buf[pos+47] << decimation_shifts::pre64, + &buf2[20]); - ++(*it); - } + m_decimator2.myDecimateInf( + buf[pos+48] << decimation_shifts::pre64, + buf[pos+49] << decimation_shifts::pre64, + buf[pos+50] << decimation_shifts::pre64, + buf[pos+51] << decimation_shifts::pre64, + buf[pos+52] << decimation_shifts::pre64, + buf[pos+53] << decimation_shifts::pre64, + buf[pos+54] << decimation_shifts::pre64, + buf[pos+55] << decimation_shifts::pre64, + &buf2[24]); + + m_decimator2.myDecimateInf( + buf[pos+56] << decimation_shifts::pre64, + buf[pos+57] << decimation_shifts::pre64, + buf[pos+58] << decimation_shifts::pre64, + buf[pos+59] << decimation_shifts::pre64, + buf[pos+60] << decimation_shifts::pre64, + buf[pos+61] << decimation_shifts::pre64, + buf[pos+62] << decimation_shifts::pre64, + buf[pos+63] << decimation_shifts::pre64, + &buf2[28]); + + m_decimator2.myDecimateInf( + buf[pos+64] << decimation_shifts::pre64, + buf[pos+65] << decimation_shifts::pre64, + buf[pos+66] << decimation_shifts::pre64, + buf[pos+67] << decimation_shifts::pre64, + buf[pos+68] << decimation_shifts::pre64, + buf[pos+69] << decimation_shifts::pre64, + buf[pos+70] << decimation_shifts::pre64, + buf[pos+71] << decimation_shifts::pre64, + &buf2[32]); + + m_decimator2.myDecimateInf( + buf[pos+72] << decimation_shifts::pre64, + buf[pos+73] << decimation_shifts::pre64, + buf[pos+74] << decimation_shifts::pre64, + buf[pos+75] << decimation_shifts::pre64, + buf[pos+76] << decimation_shifts::pre64, + buf[pos+77] << decimation_shifts::pre64, + buf[pos+78] << decimation_shifts::pre64, + buf[pos+79] << decimation_shifts::pre64, + &buf2[36]); + + m_decimator2.myDecimateInf( + buf[pos+80] << decimation_shifts::pre64, + buf[pos+81] << decimation_shifts::pre64, + buf[pos+82] << decimation_shifts::pre64, + buf[pos+83] << decimation_shifts::pre64, + buf[pos+84] << decimation_shifts::pre64, + buf[pos+85] << decimation_shifts::pre64, + buf[pos+86] << decimation_shifts::pre64, + buf[pos+87] << decimation_shifts::pre64, + &buf2[40]); + + m_decimator2.myDecimateInf( + buf[pos+88] << decimation_shifts::pre64, + buf[pos+89] << decimation_shifts::pre64, + buf[pos+90] << decimation_shifts::pre64, + buf[pos+91] << decimation_shifts::pre64, + buf[pos+92] << decimation_shifts::pre64, + buf[pos+93] << decimation_shifts::pre64, + buf[pos+94] << decimation_shifts::pre64, + buf[pos+95] << decimation_shifts::pre64, + &buf2[44]); + + m_decimator2.myDecimateInf( + buf[pos+96] << decimation_shifts::pre64, + buf[pos+97] << decimation_shifts::pre64, + buf[pos+98] << decimation_shifts::pre64, + buf[pos+99] << decimation_shifts::pre64, + buf[pos+100] << decimation_shifts::pre64, + buf[pos+101] << decimation_shifts::pre64, + buf[pos+102] << decimation_shifts::pre64, + buf[pos+103] << decimation_shifts::pre64, + &buf2[48]); + + m_decimator2.myDecimateInf( + buf[pos+104] << decimation_shifts::pre64, + buf[pos+105] << decimation_shifts::pre64, + buf[pos+106] << decimation_shifts::pre64, + buf[pos+107] << decimation_shifts::pre64, + buf[pos+108] << decimation_shifts::pre64, + buf[pos+109] << decimation_shifts::pre64, + buf[pos+110] << decimation_shifts::pre64, + buf[pos+111] << decimation_shifts::pre64, + &buf2[52]); + + m_decimator2.myDecimateInf( + buf[pos+112] << decimation_shifts::pre64, + buf[pos+113] << decimation_shifts::pre64, + buf[pos+114] << decimation_shifts::pre64, + buf[pos+115] << decimation_shifts::pre64, + buf[pos+116] << decimation_shifts::pre64, + buf[pos+117] << decimation_shifts::pre64, + buf[pos+118] << decimation_shifts::pre64, + buf[pos+119] << decimation_shifts::pre64, + &buf2[56]); + + m_decimator2.myDecimateInf( + buf[pos+120] << decimation_shifts::pre64, + buf[pos+121] << decimation_shifts::pre64, + buf[pos+122] << decimation_shifts::pre64, + buf[pos+123] << decimation_shifts::pre64, + buf[pos+124] << decimation_shifts::pre64, + buf[pos+125] << decimation_shifts::pre64, + buf[pos+126] << decimation_shifts::pre64, + buf[pos+127] << decimation_shifts::pre64, + &buf2[60]); + + m_decimator2.myDecimateInf( + buf[pos+128] << decimation_shifts::pre64, + buf[pos+129] << decimation_shifts::pre64, + buf[pos+130] << decimation_shifts::pre64, + buf[pos+131] << decimation_shifts::pre64, + buf[pos+132] << decimation_shifts::pre64, + buf[pos+133] << decimation_shifts::pre64, + buf[pos+134] << decimation_shifts::pre64, + buf[pos+135] << decimation_shifts::pre64, + &buf2[64]); + + m_decimator2.myDecimateInf( + buf[pos+136] << decimation_shifts::pre64, + buf[pos+137] << decimation_shifts::pre64, + buf[pos+138] << decimation_shifts::pre64, + buf[pos+139] << decimation_shifts::pre64, + buf[pos+140] << decimation_shifts::pre64, + buf[pos+141] << decimation_shifts::pre64, + buf[pos+142] << decimation_shifts::pre64, + buf[pos+143] << decimation_shifts::pre64, + &buf2[68]); + + m_decimator2.myDecimateInf( + buf[pos+144] << decimation_shifts::pre64, + buf[pos+145] << decimation_shifts::pre64, + buf[pos+146] << decimation_shifts::pre64, + buf[pos+147] << decimation_shifts::pre64, + buf[pos+148] << decimation_shifts::pre64, + buf[pos+149] << decimation_shifts::pre64, + buf[pos+150] << decimation_shifts::pre64, + buf[pos+151] << decimation_shifts::pre64, + &buf2[72]); + + m_decimator2.myDecimateInf( + buf[pos+152] << decimation_shifts::pre64, + buf[pos+153] << decimation_shifts::pre64, + buf[pos+154] << decimation_shifts::pre64, + buf[pos+155] << decimation_shifts::pre64, + buf[pos+156] << decimation_shifts::pre64, + buf[pos+157] << decimation_shifts::pre64, + buf[pos+158] << decimation_shifts::pre64, + buf[pos+159] << decimation_shifts::pre64, + &buf2[76]); + + m_decimator2.myDecimateInf( + buf[pos+160] << decimation_shifts::pre64, + buf[pos+161] << decimation_shifts::pre64, + buf[pos+162] << decimation_shifts::pre64, + buf[pos+163] << decimation_shifts::pre64, + buf[pos+164] << decimation_shifts::pre64, + buf[pos+165] << decimation_shifts::pre64, + buf[pos+166] << decimation_shifts::pre64, + buf[pos+167] << decimation_shifts::pre64, + &buf2[80]); + + m_decimator2.myDecimateInf( + buf[pos+168] << decimation_shifts::pre64, + buf[pos+169] << decimation_shifts::pre64, + buf[pos+170] << decimation_shifts::pre64, + buf[pos+171] << decimation_shifts::pre64, + buf[pos+172] << decimation_shifts::pre64, + buf[pos+173] << decimation_shifts::pre64, + buf[pos+174] << decimation_shifts::pre64, + buf[pos+175] << decimation_shifts::pre64, + &buf2[84]); + + m_decimator2.myDecimateInf( + buf[pos+176] << decimation_shifts::pre64, + buf[pos+177] << decimation_shifts::pre64, + buf[pos+178] << decimation_shifts::pre64, + buf[pos+179] << decimation_shifts::pre64, + buf[pos+180] << decimation_shifts::pre64, + buf[pos+181] << decimation_shifts::pre64, + buf[pos+182] << decimation_shifts::pre64, + buf[pos+183] << decimation_shifts::pre64, + &buf2[88]); + + m_decimator2.myDecimateInf( + buf[pos+184] << decimation_shifts::pre64, + buf[pos+185] << decimation_shifts::pre64, + buf[pos+186] << decimation_shifts::pre64, + buf[pos+187] << decimation_shifts::pre64, + buf[pos+188] << decimation_shifts::pre64, + buf[pos+189] << decimation_shifts::pre64, + buf[pos+190] << decimation_shifts::pre64, + buf[pos+191] << decimation_shifts::pre64, + &buf2[92]); + + m_decimator2.myDecimateInf( + buf[pos+192] << decimation_shifts::pre64, + buf[pos+193] << decimation_shifts::pre64, + buf[pos+194] << decimation_shifts::pre64, + buf[pos+195] << decimation_shifts::pre64, + buf[pos+196] << decimation_shifts::pre64, + buf[pos+197] << decimation_shifts::pre64, + buf[pos+198] << decimation_shifts::pre64, + buf[pos+199] << decimation_shifts::pre64, + &buf2[96]); + + m_decimator2.myDecimateInf( + buf[pos+200] << decimation_shifts::pre64, + buf[pos+201] << decimation_shifts::pre64, + buf[pos+202] << decimation_shifts::pre64, + buf[pos+203] << decimation_shifts::pre64, + buf[pos+204] << decimation_shifts::pre64, + buf[pos+205] << decimation_shifts::pre64, + buf[pos+206] << decimation_shifts::pre64, + buf[pos+207] << decimation_shifts::pre64, + &buf2[100]); + + m_decimator2.myDecimateInf( + buf[pos+208] << decimation_shifts::pre64, + buf[pos+209] << decimation_shifts::pre64, + buf[pos+210] << decimation_shifts::pre64, + buf[pos+211] << decimation_shifts::pre64, + buf[pos+212] << decimation_shifts::pre64, + buf[pos+213] << decimation_shifts::pre64, + buf[pos+214] << decimation_shifts::pre64, + buf[pos+215] << decimation_shifts::pre64, + &buf2[104]); + + m_decimator2.myDecimateInf( + buf[pos+216] << decimation_shifts::pre64, + buf[pos+217] << decimation_shifts::pre64, + buf[pos+218] << decimation_shifts::pre64, + buf[pos+219] << decimation_shifts::pre64, + buf[pos+220] << decimation_shifts::pre64, + buf[pos+221] << decimation_shifts::pre64, + buf[pos+222] << decimation_shifts::pre64, + buf[pos+223] << decimation_shifts::pre64, + &buf2[108]); + + m_decimator2.myDecimateInf( + buf[pos+224] << decimation_shifts::pre64, + buf[pos+225] << decimation_shifts::pre64, + buf[pos+226] << decimation_shifts::pre64, + buf[pos+227] << decimation_shifts::pre64, + buf[pos+228] << decimation_shifts::pre64, + buf[pos+229] << decimation_shifts::pre64, + buf[pos+230] << decimation_shifts::pre64, + buf[pos+231] << decimation_shifts::pre64, + &buf2[112]); + + m_decimator2.myDecimateInf( + buf[pos+232] << decimation_shifts::pre64, + buf[pos+233] << decimation_shifts::pre64, + buf[pos+234] << decimation_shifts::pre64, + buf[pos+235] << decimation_shifts::pre64, + buf[pos+236] << decimation_shifts::pre64, + buf[pos+237] << decimation_shifts::pre64, + buf[pos+238] << decimation_shifts::pre64, + buf[pos+239] << decimation_shifts::pre64, + &buf2[116]); + + m_decimator2.myDecimateInf( + buf[pos+240] << decimation_shifts::pre64, + buf[pos+241] << decimation_shifts::pre64, + buf[pos+242] << decimation_shifts::pre64, + buf[pos+243] << decimation_shifts::pre64, + buf[pos+244] << decimation_shifts::pre64, + buf[pos+245] << decimation_shifts::pre64, + buf[pos+246] << decimation_shifts::pre64, + buf[pos+247] << decimation_shifts::pre64, + &buf2[120]); + + m_decimator2.myDecimateInf( + buf[pos+248] << decimation_shifts::pre64, + buf[pos+249] << decimation_shifts::pre64, + buf[pos+250] << decimation_shifts::pre64, + buf[pos+251] << decimation_shifts::pre64, + buf[pos+252] << decimation_shifts::pre64, + buf[pos+253] << decimation_shifts::pre64, + buf[pos+254] << decimation_shifts::pre64, + buf[pos+255] << decimation_shifts::pre64, + &buf2[124]); + + m_decimator4.myDecimateSup( + &buf2[0], + &buf4[0]); + + m_decimator4.myDecimateSup( + &buf2[8], + &buf4[4]); + + m_decimator4.myDecimateSup( + &buf2[16], + &buf4[8]); + + m_decimator4.myDecimateSup( + &buf2[24], + &buf4[12]); + + m_decimator4.myDecimateSup( + &buf2[32], + &buf4[16]); + + m_decimator4.myDecimateSup( + &buf2[40], + &buf4[20]); + + m_decimator4.myDecimateSup( + &buf2[48], + &buf4[24]); + + m_decimator4.myDecimateSup( + &buf2[56], + &buf4[28]); + + m_decimator4.myDecimateSup( + &buf2[64], + &buf4[32]); + + m_decimator4.myDecimateSup( + &buf2[72], + &buf4[36]); + + m_decimator4.myDecimateSup( + &buf2[80], + &buf4[40]); + + m_decimator4.myDecimateSup( + &buf2[88], + &buf4[44]); + + m_decimator4.myDecimateSup( + &buf2[96], + &buf4[48]); + + m_decimator4.myDecimateSup( + &buf2[104], + &buf4[52]); + + m_decimator4.myDecimateSup( + &buf2[112], + &buf4[56]); + + m_decimator4.myDecimateSup( + &buf2[120], + &buf4[60]); + + m_decimator8.myDecimateSup( + &buf4[0], + &buf8[0]); + + m_decimator8.myDecimateSup( + &buf4[8], + &buf8[4]); + + m_decimator8.myDecimateSup( + &buf4[16], + &buf8[8]); + + m_decimator8.myDecimateSup( + &buf4[24], + &buf8[12]); + + m_decimator8.myDecimateSup( + &buf4[32], + &buf8[16]); + + m_decimator8.myDecimateSup( + &buf4[40], + &buf8[20]); + + m_decimator8.myDecimateSup( + &buf4[48], + &buf8[24]); + + m_decimator8.myDecimateSup( + &buf4[56], + &buf8[28]); + + m_decimator16.myDecimateSup( + &buf8[0], + &buf16[0]); + + m_decimator16.myDecimateSup( + &buf8[8], + &buf16[4]); + + m_decimator16.myDecimateSup( + &buf8[16], + &buf16[8]); + + m_decimator16.myDecimateSup( + &buf8[24], + &buf16[12]); + + m_decimator32.myDecimateSup( + &buf16[0], + &buf32[0]); + + m_decimator32.myDecimateSup( + &buf16[8], + &buf32[4]); + + m_decimator64.myDecimateCen( + &buf32[0], + &buf64[0]); + + (**it).setReal(buf64[0] >> decimation_shifts::post64); + (**it).setImag(buf64[1] >> decimation_shifts::post64); + ++(*it); + + (**it).setReal(buf64[2] >> decimation_shifts::post64); + (**it).setImag(buf64[3] >> decimation_shifts::post64); + ++(*it); + } } template void DecimatorsU::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len) { - StorageType xreal[16], yimag[16]; + StorageType buf2[128], buf4[64], buf8[32], buf16[16], buf32[8], buf64[4]; - for (int pos = 0; pos < len - 127; ) - { - for (int i = 0; i < 16; i++) - { - xreal[i] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre32; - yimag[i] = (buf[pos+4] + buf[pos+7] - buf[pos+0] - buf[pos+3]) << decimation_shifts::pre32; - pos += 8; - } + for (int pos = 0; pos < len - 255; pos += 256) + { + m_decimator2.myDecimateSup( + buf[pos+0] << decimation_shifts::pre64, + buf[pos+1] << decimation_shifts::pre64, + buf[pos+2] << decimation_shifts::pre64, + buf[pos+3] << decimation_shifts::pre64, + buf[pos+4] << decimation_shifts::pre64, + buf[pos+5] << decimation_shifts::pre64, + buf[pos+6] << decimation_shifts::pre64, + buf[pos+7] << decimation_shifts::pre64, + &buf2[0]); - m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]); - m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]); - m_decimator2.myDecimate(xreal[4], yimag[4], &xreal[5], &yimag[5]); - m_decimator2.myDecimate(xreal[6], yimag[6], &xreal[7], &yimag[7]); - m_decimator2.myDecimate(xreal[8], yimag[8], &xreal[9], &yimag[9]); - m_decimator2.myDecimate(xreal[10], yimag[10], &xreal[11], &yimag[11]); - m_decimator2.myDecimate(xreal[12], yimag[12], &xreal[13], &yimag[13]); - m_decimator2.myDecimate(xreal[14], yimag[14], &xreal[15], &yimag[15]); + m_decimator2.myDecimateSup( + buf[pos+8] << decimation_shifts::pre64, + buf[pos+9] << decimation_shifts::pre64, + buf[pos+10] << decimation_shifts::pre64, + buf[pos+11] << decimation_shifts::pre64, + buf[pos+12] << decimation_shifts::pre64, + buf[pos+13] << decimation_shifts::pre64, + buf[pos+14] << decimation_shifts::pre64, + buf[pos+15] << decimation_shifts::pre64, + &buf2[4]); - m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]); - m_decimator4.myDecimate(xreal[5], yimag[5], &xreal[7], &yimag[7]); - m_decimator4.myDecimate(xreal[9], yimag[9], &xreal[11], &yimag[11]); - m_decimator4.myDecimate(xreal[13], yimag[13], &xreal[15], &yimag[15]); + m_decimator2.myDecimateSup( + buf[pos+16] << decimation_shifts::pre64, + buf[pos+17] << decimation_shifts::pre64, + buf[pos+18] << decimation_shifts::pre64, + buf[pos+19] << decimation_shifts::pre64, + buf[pos+20] << decimation_shifts::pre64, + buf[pos+21] << decimation_shifts::pre64, + buf[pos+22] << decimation_shifts::pre64, + buf[pos+23] << decimation_shifts::pre64, + &buf2[8]); - m_decimator8.myDecimate(xreal[3], yimag[3], &xreal[7], &yimag[7]); - m_decimator8.myDecimate(xreal[11], yimag[11], &xreal[15], &yimag[15]); + m_decimator2.myDecimateSup( + buf[pos+24] << decimation_shifts::pre64, + buf[pos+25] << decimation_shifts::pre64, + buf[pos+26] << decimation_shifts::pre64, + buf[pos+27] << decimation_shifts::pre64, + buf[pos+28] << decimation_shifts::pre64, + buf[pos+29] << decimation_shifts::pre64, + buf[pos+30] << decimation_shifts::pre64, + buf[pos+31] << decimation_shifts::pre64, + &buf2[12]); - m_decimator16.myDecimate(xreal[7], yimag[7], &xreal[15], &yimag[15]); + m_decimator2.myDecimateSup( + buf[pos+32] << decimation_shifts::pre64, + buf[pos+33] << decimation_shifts::pre64, + buf[pos+34] << decimation_shifts::pre64, + buf[pos+35] << decimation_shifts::pre64, + buf[pos+36] << decimation_shifts::pre64, + buf[pos+37] << decimation_shifts::pre64, + buf[pos+38] << decimation_shifts::pre64, + buf[pos+39] << decimation_shifts::pre64, + &buf2[16]); - (**it).setReal(xreal[15] >> decimation_shifts::post64); - (**it).setImag(yimag[15] >> decimation_shifts::post64); + m_decimator2.myDecimateSup( + buf[pos+40] << decimation_shifts::pre64, + buf[pos+41] << decimation_shifts::pre64, + buf[pos+42] << decimation_shifts::pre64, + buf[pos+43] << decimation_shifts::pre64, + buf[pos+44] << decimation_shifts::pre64, + buf[pos+45] << decimation_shifts::pre64, + buf[pos+46] << decimation_shifts::pre64, + buf[pos+47] << decimation_shifts::pre64, + &buf2[20]); - ++(*it); - } + m_decimator2.myDecimateSup( + buf[pos+48] << decimation_shifts::pre64, + buf[pos+49] << decimation_shifts::pre64, + buf[pos+50] << decimation_shifts::pre64, + buf[pos+51] << decimation_shifts::pre64, + buf[pos+52] << decimation_shifts::pre64, + buf[pos+53] << decimation_shifts::pre64, + buf[pos+54] << decimation_shifts::pre64, + buf[pos+55] << decimation_shifts::pre64, + &buf2[24]); + + m_decimator2.myDecimateSup( + buf[pos+56] << decimation_shifts::pre64, + buf[pos+57] << decimation_shifts::pre64, + buf[pos+58] << decimation_shifts::pre64, + buf[pos+59] << decimation_shifts::pre64, + buf[pos+60] << decimation_shifts::pre64, + buf[pos+61] << decimation_shifts::pre64, + buf[pos+62] << decimation_shifts::pre64, + buf[pos+63] << decimation_shifts::pre64, + &buf2[28]); + + m_decimator2.myDecimateSup( + buf[pos+64] << decimation_shifts::pre64, + buf[pos+65] << decimation_shifts::pre64, + buf[pos+66] << decimation_shifts::pre64, + buf[pos+67] << decimation_shifts::pre64, + buf[pos+68] << decimation_shifts::pre64, + buf[pos+69] << decimation_shifts::pre64, + buf[pos+70] << decimation_shifts::pre64, + buf[pos+71] << decimation_shifts::pre64, + &buf2[32]); + + m_decimator2.myDecimateSup( + buf[pos+72] << decimation_shifts::pre64, + buf[pos+73] << decimation_shifts::pre64, + buf[pos+74] << decimation_shifts::pre64, + buf[pos+75] << decimation_shifts::pre64, + buf[pos+76] << decimation_shifts::pre64, + buf[pos+77] << decimation_shifts::pre64, + buf[pos+78] << decimation_shifts::pre64, + buf[pos+79] << decimation_shifts::pre64, + &buf2[36]); + + m_decimator2.myDecimateSup( + buf[pos+80] << decimation_shifts::pre64, + buf[pos+81] << decimation_shifts::pre64, + buf[pos+82] << decimation_shifts::pre64, + buf[pos+83] << decimation_shifts::pre64, + buf[pos+84] << decimation_shifts::pre64, + buf[pos+85] << decimation_shifts::pre64, + buf[pos+86] << decimation_shifts::pre64, + buf[pos+87] << decimation_shifts::pre64, + &buf2[40]); + + m_decimator2.myDecimateSup( + buf[pos+88] << decimation_shifts::pre64, + buf[pos+89] << decimation_shifts::pre64, + buf[pos+90] << decimation_shifts::pre64, + buf[pos+91] << decimation_shifts::pre64, + buf[pos+92] << decimation_shifts::pre64, + buf[pos+93] << decimation_shifts::pre64, + buf[pos+94] << decimation_shifts::pre64, + buf[pos+95] << decimation_shifts::pre64, + &buf2[44]); + + m_decimator2.myDecimateSup( + buf[pos+96] << decimation_shifts::pre64, + buf[pos+97] << decimation_shifts::pre64, + buf[pos+98] << decimation_shifts::pre64, + buf[pos+99] << decimation_shifts::pre64, + buf[pos+100] << decimation_shifts::pre64, + buf[pos+101] << decimation_shifts::pre64, + buf[pos+102] << decimation_shifts::pre64, + buf[pos+103] << decimation_shifts::pre64, + &buf2[48]); + + m_decimator2.myDecimateSup( + buf[pos+104] << decimation_shifts::pre64, + buf[pos+105] << decimation_shifts::pre64, + buf[pos+106] << decimation_shifts::pre64, + buf[pos+107] << decimation_shifts::pre64, + buf[pos+108] << decimation_shifts::pre64, + buf[pos+109] << decimation_shifts::pre64, + buf[pos+110] << decimation_shifts::pre64, + buf[pos+111] << decimation_shifts::pre64, + &buf2[52]); + + m_decimator2.myDecimateSup( + buf[pos+112] << decimation_shifts::pre64, + buf[pos+113] << decimation_shifts::pre64, + buf[pos+114] << decimation_shifts::pre64, + buf[pos+115] << decimation_shifts::pre64, + buf[pos+116] << decimation_shifts::pre64, + buf[pos+117] << decimation_shifts::pre64, + buf[pos+118] << decimation_shifts::pre64, + buf[pos+119] << decimation_shifts::pre64, + &buf2[56]); + + m_decimator2.myDecimateSup( + buf[pos+120] << decimation_shifts::pre64, + buf[pos+121] << decimation_shifts::pre64, + buf[pos+122] << decimation_shifts::pre64, + buf[pos+123] << decimation_shifts::pre64, + buf[pos+124] << decimation_shifts::pre64, + buf[pos+125] << decimation_shifts::pre64, + buf[pos+126] << decimation_shifts::pre64, + buf[pos+127] << decimation_shifts::pre64, + &buf2[60]); + + m_decimator2.myDecimateSup( + buf[pos+128] << decimation_shifts::pre64, + buf[pos+129] << decimation_shifts::pre64, + buf[pos+130] << decimation_shifts::pre64, + buf[pos+131] << decimation_shifts::pre64, + buf[pos+132] << decimation_shifts::pre64, + buf[pos+133] << decimation_shifts::pre64, + buf[pos+134] << decimation_shifts::pre64, + buf[pos+135] << decimation_shifts::pre64, + &buf2[64]); + + m_decimator2.myDecimateSup( + buf[pos+136] << decimation_shifts::pre64, + buf[pos+137] << decimation_shifts::pre64, + buf[pos+138] << decimation_shifts::pre64, + buf[pos+139] << decimation_shifts::pre64, + buf[pos+140] << decimation_shifts::pre64, + buf[pos+141] << decimation_shifts::pre64, + buf[pos+142] << decimation_shifts::pre64, + buf[pos+143] << decimation_shifts::pre64, + &buf2[68]); + + m_decimator2.myDecimateSup( + buf[pos+144] << decimation_shifts::pre64, + buf[pos+145] << decimation_shifts::pre64, + buf[pos+146] << decimation_shifts::pre64, + buf[pos+147] << decimation_shifts::pre64, + buf[pos+148] << decimation_shifts::pre64, + buf[pos+149] << decimation_shifts::pre64, + buf[pos+150] << decimation_shifts::pre64, + buf[pos+151] << decimation_shifts::pre64, + &buf2[72]); + + m_decimator2.myDecimateSup( + buf[pos+152] << decimation_shifts::pre64, + buf[pos+153] << decimation_shifts::pre64, + buf[pos+154] << decimation_shifts::pre64, + buf[pos+155] << decimation_shifts::pre64, + buf[pos+156] << decimation_shifts::pre64, + buf[pos+157] << decimation_shifts::pre64, + buf[pos+158] << decimation_shifts::pre64, + buf[pos+159] << decimation_shifts::pre64, + &buf2[76]); + + m_decimator2.myDecimateSup( + buf[pos+160] << decimation_shifts::pre64, + buf[pos+161] << decimation_shifts::pre64, + buf[pos+162] << decimation_shifts::pre64, + buf[pos+163] << decimation_shifts::pre64, + buf[pos+164] << decimation_shifts::pre64, + buf[pos+165] << decimation_shifts::pre64, + buf[pos+166] << decimation_shifts::pre64, + buf[pos+167] << decimation_shifts::pre64, + &buf2[80]); + + m_decimator2.myDecimateSup( + buf[pos+168] << decimation_shifts::pre64, + buf[pos+169] << decimation_shifts::pre64, + buf[pos+170] << decimation_shifts::pre64, + buf[pos+171] << decimation_shifts::pre64, + buf[pos+172] << decimation_shifts::pre64, + buf[pos+173] << decimation_shifts::pre64, + buf[pos+174] << decimation_shifts::pre64, + buf[pos+175] << decimation_shifts::pre64, + &buf2[84]); + + m_decimator2.myDecimateSup( + buf[pos+176] << decimation_shifts::pre64, + buf[pos+177] << decimation_shifts::pre64, + buf[pos+178] << decimation_shifts::pre64, + buf[pos+179] << decimation_shifts::pre64, + buf[pos+180] << decimation_shifts::pre64, + buf[pos+181] << decimation_shifts::pre64, + buf[pos+182] << decimation_shifts::pre64, + buf[pos+183] << decimation_shifts::pre64, + &buf2[88]); + + m_decimator2.myDecimateSup( + buf[pos+184] << decimation_shifts::pre64, + buf[pos+185] << decimation_shifts::pre64, + buf[pos+186] << decimation_shifts::pre64, + buf[pos+187] << decimation_shifts::pre64, + buf[pos+188] << decimation_shifts::pre64, + buf[pos+189] << decimation_shifts::pre64, + buf[pos+190] << decimation_shifts::pre64, + buf[pos+191] << decimation_shifts::pre64, + &buf2[92]); + + m_decimator2.myDecimateSup( + buf[pos+192] << decimation_shifts::pre64, + buf[pos+193] << decimation_shifts::pre64, + buf[pos+194] << decimation_shifts::pre64, + buf[pos+195] << decimation_shifts::pre64, + buf[pos+196] << decimation_shifts::pre64, + buf[pos+197] << decimation_shifts::pre64, + buf[pos+198] << decimation_shifts::pre64, + buf[pos+199] << decimation_shifts::pre64, + &buf2[96]); + + m_decimator2.myDecimateSup( + buf[pos+200] << decimation_shifts::pre64, + buf[pos+201] << decimation_shifts::pre64, + buf[pos+202] << decimation_shifts::pre64, + buf[pos+203] << decimation_shifts::pre64, + buf[pos+204] << decimation_shifts::pre64, + buf[pos+205] << decimation_shifts::pre64, + buf[pos+206] << decimation_shifts::pre64, + buf[pos+207] << decimation_shifts::pre64, + &buf2[100]); + + m_decimator2.myDecimateSup( + buf[pos+208] << decimation_shifts::pre64, + buf[pos+209] << decimation_shifts::pre64, + buf[pos+210] << decimation_shifts::pre64, + buf[pos+211] << decimation_shifts::pre64, + buf[pos+212] << decimation_shifts::pre64, + buf[pos+213] << decimation_shifts::pre64, + buf[pos+214] << decimation_shifts::pre64, + buf[pos+215] << decimation_shifts::pre64, + &buf2[104]); + + m_decimator2.myDecimateSup( + buf[pos+216] << decimation_shifts::pre64, + buf[pos+217] << decimation_shifts::pre64, + buf[pos+218] << decimation_shifts::pre64, + buf[pos+219] << decimation_shifts::pre64, + buf[pos+220] << decimation_shifts::pre64, + buf[pos+221] << decimation_shifts::pre64, + buf[pos+222] << decimation_shifts::pre64, + buf[pos+223] << decimation_shifts::pre64, + &buf2[108]); + + m_decimator2.myDecimateSup( + buf[pos+224] << decimation_shifts::pre64, + buf[pos+225] << decimation_shifts::pre64, + buf[pos+226] << decimation_shifts::pre64, + buf[pos+227] << decimation_shifts::pre64, + buf[pos+228] << decimation_shifts::pre64, + buf[pos+229] << decimation_shifts::pre64, + buf[pos+230] << decimation_shifts::pre64, + buf[pos+231] << decimation_shifts::pre64, + &buf2[112]); + + m_decimator2.myDecimateSup( + buf[pos+232] << decimation_shifts::pre64, + buf[pos+233] << decimation_shifts::pre64, + buf[pos+234] << decimation_shifts::pre64, + buf[pos+235] << decimation_shifts::pre64, + buf[pos+236] << decimation_shifts::pre64, + buf[pos+237] << decimation_shifts::pre64, + buf[pos+238] << decimation_shifts::pre64, + buf[pos+239] << decimation_shifts::pre64, + &buf2[116]); + + m_decimator2.myDecimateSup( + buf[pos+240] << decimation_shifts::pre64, + buf[pos+241] << decimation_shifts::pre64, + buf[pos+242] << decimation_shifts::pre64, + buf[pos+243] << decimation_shifts::pre64, + buf[pos+244] << decimation_shifts::pre64, + buf[pos+245] << decimation_shifts::pre64, + buf[pos+246] << decimation_shifts::pre64, + buf[pos+247] << decimation_shifts::pre64, + &buf2[120]); + + m_decimator2.myDecimateSup( + buf[pos+248] << decimation_shifts::pre64, + buf[pos+249] << decimation_shifts::pre64, + buf[pos+250] << decimation_shifts::pre64, + buf[pos+251] << decimation_shifts::pre64, + buf[pos+252] << decimation_shifts::pre64, + buf[pos+253] << decimation_shifts::pre64, + buf[pos+254] << decimation_shifts::pre64, + buf[pos+255] << decimation_shifts::pre64, + &buf2[124]); + + m_decimator4.myDecimateInf( + &buf2[0], + &buf4[0]); + + m_decimator4.myDecimateInf( + &buf2[8], + &buf4[4]); + + m_decimator4.myDecimateInf( + &buf2[16], + &buf4[8]); + + m_decimator4.myDecimateInf( + &buf2[24], + &buf4[12]); + + m_decimator4.myDecimateInf( + &buf2[32], + &buf4[16]); + + m_decimator4.myDecimateInf( + &buf2[40], + &buf4[20]); + + m_decimator4.myDecimateInf( + &buf2[48], + &buf4[24]); + + m_decimator4.myDecimateInf( + &buf2[56], + &buf4[28]); + + m_decimator4.myDecimateInf( + &buf2[64], + &buf4[32]); + + m_decimator4.myDecimateInf( + &buf2[72], + &buf4[36]); + + m_decimator4.myDecimateInf( + &buf2[80], + &buf4[40]); + + m_decimator4.myDecimateInf( + &buf2[88], + &buf4[44]); + + m_decimator4.myDecimateInf( + &buf2[96], + &buf4[48]); + + m_decimator4.myDecimateInf( + &buf2[104], + &buf4[52]); + + m_decimator4.myDecimateInf( + &buf2[112], + &buf4[56]); + + m_decimator4.myDecimateInf( + &buf2[120], + &buf4[60]); + + m_decimator8.myDecimateInf( + &buf4[0], + &buf8[0]); + + m_decimator8.myDecimateInf( + &buf4[8], + &buf8[4]); + + m_decimator8.myDecimateInf( + &buf4[16], + &buf8[8]); + + m_decimator8.myDecimateInf( + &buf4[24], + &buf8[12]); + + m_decimator8.myDecimateInf( + &buf4[32], + &buf8[16]); + + m_decimator8.myDecimateInf( + &buf4[40], + &buf8[20]); + + m_decimator8.myDecimateInf( + &buf4[48], + &buf8[24]); + + m_decimator8.myDecimateInf( + &buf4[56], + &buf8[28]); + + m_decimator16.myDecimateInf( + &buf8[0], + &buf16[0]); + + m_decimator16.myDecimateInf( + &buf8[8], + &buf16[4]); + + m_decimator16.myDecimateInf( + &buf8[16], + &buf16[8]); + + m_decimator16.myDecimateInf( + &buf8[24], + &buf16[12]); + + m_decimator32.myDecimateInf( + &buf16[0], + &buf32[0]); + + m_decimator32.myDecimateInf( + &buf16[8], + &buf32[4]); + + m_decimator64.myDecimateCen( + &buf32[0], + &buf64[0]); + + (**it).setReal(buf64[0] >> decimation_shifts::post64); + (**it).setImag(buf64[1] >> decimation_shifts::post64); + ++(*it); + + (**it).setReal(buf64[2] >> decimation_shifts::post64); + (**it).setImag(buf64[3] >> decimation_shifts::post64); + ++(*it); + } } template void DecimatorsU::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len) { - StorageType intbuf[2]; + StorageType buf2[4]; - for (int pos = 0; pos < len - 3; pos += 4) - { - intbuf[0] = (buf[pos+2] - Shift) << decimation_shifts::pre2; - intbuf[1] = (buf[pos+3] - Shift) << decimation_shifts::pre2; + for (int pos = 0; pos < len - 7; pos += 8) + { + m_decimator2.myDecimateCen( + buf[pos+0] << decimation_shifts::pre2, + buf[pos+1] << decimation_shifts::pre2, + buf[pos+2] << decimation_shifts::pre2, + buf[pos+3] << decimation_shifts::pre2, + buf[pos+4] << decimation_shifts::pre2, + buf[pos+5] << decimation_shifts::pre2, + buf[pos+6] << decimation_shifts::pre2, + buf[pos+7] << decimation_shifts::pre2, + &buf2[0]); - m_decimator2.myDecimate( - (buf[pos+0] - Shift) << decimation_shifts::pre2, - (buf[pos+1] - Shift) << decimation_shifts::pre2, - &intbuf[0], - &intbuf[1]); + (**it).setReal(buf2[0] >> decimation_shifts::post2); + (**it).setImag(buf2[1] >> decimation_shifts::post2); + ++(*it); - (**it).setReal(intbuf[0] >> decimation_shifts::post2); - (**it).setImag(intbuf[1] >> decimation_shifts::post2); - ++(*it); - } + (**it).setReal(buf2[2] >> decimation_shifts::post2); + (**it).setImag(buf2[3] >> decimation_shifts::post2); + ++(*it); + } } template void DecimatorsU::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len) { - StorageType intbuf[4]; + StorageType buf2[8], buf4[4]; - for (int pos = 0; pos < len - 7; pos += 8) - { - intbuf[0] = (buf[pos+2] - Shift) << decimation_shifts::pre4; - intbuf[1] = (buf[pos+3] - Shift) << decimation_shifts::pre4; - intbuf[2] = (buf[pos+6] - Shift) << decimation_shifts::pre4; - intbuf[3] = (buf[pos+7] - Shift) << decimation_shifts::pre4; + for (int pos = 0; pos < len - 15; pos += 16) + { + m_decimator2.myDecimateCen( + buf[pos+0] << decimation_shifts::pre4, + buf[pos+1] << decimation_shifts::pre4, + buf[pos+2] << decimation_shifts::pre4, + buf[pos+3] << decimation_shifts::pre4, + buf[pos+4] << decimation_shifts::pre4, + buf[pos+5] << decimation_shifts::pre4, + buf[pos+6] << decimation_shifts::pre4, + buf[pos+7] << decimation_shifts::pre4, + &buf2[0]); - m_decimator2.myDecimate( - (buf[pos+0] - Shift) << decimation_shifts::pre4, - (buf[pos+1] - Shift) << decimation_shifts::pre4, - &intbuf[0], - &intbuf[1]); - m_decimator2.myDecimate( - (buf[pos+4] - Shift) << decimation_shifts::pre4, - (buf[pos+5] - Shift) << decimation_shifts::pre4, - &intbuf[2], - &intbuf[3]); + m_decimator2.myDecimateCen( + buf[pos+8] << decimation_shifts::pre4, + buf[pos+9] << decimation_shifts::pre4, + buf[pos+10] << decimation_shifts::pre4, + buf[pos+11] << decimation_shifts::pre4, + buf[pos+12] << decimation_shifts::pre4, + buf[pos+13] << decimation_shifts::pre4, + buf[pos+14] << decimation_shifts::pre4, + buf[pos+15] << decimation_shifts::pre4, + &buf2[4]); - m_decimator4.myDecimate( - intbuf[0], - intbuf[1], - &intbuf[2], - &intbuf[3]); + m_decimator4.myDecimateCen( + &buf2[0], + &buf4[0]); - (**it).setReal(intbuf[2] >> decimation_shifts::post4); - (**it).setImag(intbuf[3] >> decimation_shifts::post4); - ++(*it); - } + (**it).setReal(buf4[0] >> decimation_shifts::post4); + (**it).setImag(buf4[1] >> decimation_shifts::post4); + ++(*it); + + (**it).setReal(buf4[2] >> decimation_shifts::post4); + (**it).setImag(buf4[3] >> decimation_shifts::post4); + ++(*it); + } } template