From bdbfd85b901a31756726b634ecd0cbe5bff9a730 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 15 Sep 2015 23:36:28 +0200 Subject: [PATCH] Optimized central decimators --- include-gpl/dsp/decimators.h | 1258 ++++++++++++++++++++++++++++------ 1 file changed, 1047 insertions(+), 211 deletions(-) diff --git a/include-gpl/dsp/decimators.h b/include-gpl/dsp/decimators.h index 0b13c6f96..ed2c11998 100644 --- a/include-gpl/dsp/decimators.h +++ b/include-gpl/dsp/decimators.h @@ -204,217 +204,6 @@ void Decimators::decimate2_sup(SampleVector::iterator* it } } -template -void Decimators::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len) -{ - int pos = 0; - - while (pos < len - 1) - { - qint32 x0 = buf[pos+0] << decimation_shifts::pre2; - qint32 y0 = buf[pos+1] << decimation_shifts::pre2; - pos += 2; - - if (m_decimator2.workDecimateCenter(&x0, &y0)) - { - (**it).setReal(x0 >> decimation_shifts::post2); - (**it).setImag(y0 >> decimation_shifts::post2); - ++(*it); - } - } -} - -template -void Decimators::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len) -{ - int pos = 0; - - while (pos < len - 1) - { - qint32 x0 = buf[pos+0] << decimation_shifts::pre4; - qint32 y0 = buf[pos+1] << decimation_shifts::pre4; - pos += 2; - - if (m_decimator2.workDecimateCenter(&x0, &y0)) - { - qint32 x1 = x0; - qint32 y1 = y0; - - if (m_decimator4.workDecimateCenter(&x1, &y1)) - { - (**it).setReal(x0 >> decimation_shifts::post4); - (**it).setImag(y0 >> decimation_shifts::post4); - ++(*it); - } - } - } -} - -template -void Decimators::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len) -{ - int pos = 0; - - while (pos < len - 1) - { - qint32 x0 = buf[pos+0] << decimation_shifts::pre8; - qint32 y0 = buf[pos+1] << decimation_shifts::pre8; - pos += 2; - - if (m_decimator2.workDecimateCenter(&x0, &y0)) - { - qint32 x1 = x0; - qint32 y1 = y0; - - if (m_decimator4.workDecimateCenter(&x1, &y1)) - { - qint32 x2 = x1; - qint32 y2 = y1; - - if (m_decimator8.workDecimateCenter(&x2, &y2)) - { - (**it).setReal(x2 >> decimation_shifts::post8); - (**it).setImag(y2 >> decimation_shifts::post8); - ++(*it); - } - } - } - } -} - -template -void Decimators::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len) -{ - int pos = 0; - - while (pos < len - 1) - { - qint32 x0 = buf[pos+0] << decimation_shifts::pre16; - qint32 y0 = buf[pos+1] << decimation_shifts::pre16; - pos += 2; - - if (m_decimator2.workDecimateCenter(&x0, &y0)) - { - qint32 x1 = x0; - qint32 y1 = y0; - - if (m_decimator4.workDecimateCenter(&x1, &y1)) - { - qint32 x2 = x1; - qint32 y2 = y1; - - if (m_decimator8.workDecimateCenter(&x2, &y2)) - { - qint32 x3 = x2; - qint32 y3 = y2; - - if (m_decimator16.workDecimateCenter(&x3, &y3)) - { - (**it).setReal(x3 >> decimation_shifts::post16); - (**it).setImag(y3 >> decimation_shifts::post16); - ++(*it); - } - } - } - } - } -} - -template -void Decimators::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len) -{ - int pos = 0; - - while (pos < len - 1) - { - qint32 x0 = buf[pos+0] << decimation_shifts::pre32; - qint32 y0 = buf[pos+1] << decimation_shifts::pre32; - pos += 2; - - if (m_decimator2.workDecimateCenter(&x0, &y0)) - { - qint32 x1 = x0; - qint32 y1 = y0; - - if (m_decimator4.workDecimateCenter(&x1, &y1)) - { - qint32 x2 = x1; - qint32 y2 = y1; - - if (m_decimator8.workDecimateCenter(&x2, &y2)) - { - qint32 x3 = x2; - qint32 y3 = y2; - - if (m_decimator16.workDecimateCenter(&x3, &y3)) - { - qint32 x4 = x3; - qint32 y4 = y3; - - if (m_decimator32.workDecimateCenter(&x4, &y4)) - { - (**it).setReal(x4 >> decimation_shifts::post32); - (**it).setImag(y4 >> decimation_shifts::post32); - ++(*it); - } - } - } - } - } - } -} - - -template -void Decimators::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len) -{ - int pos = 0; - - while (pos < len - 1) - { - qint32 x0 = buf[pos+0] << decimation_shifts::pre64; - qint32 y0 = buf[pos+1] << decimation_shifts::pre64; - pos += 2; - - if (m_decimator2.workDecimateCenter(&x0, &y0)) - { - qint32 x1 = x0; - qint32 y1 = y0; - - if (m_decimator4.workDecimateCenter(&x1, &y1)) - { - qint32 x2 = x1; - qint32 y2 = y1; - - if (m_decimator8.workDecimateCenter(&x2, &y2)) - { - qint32 x3 = x2; - qint32 y3 = y2; - - if (m_decimator16.workDecimateCenter(&x3, &y3)) - { - qint32 x4 = x3; - qint32 y4 = y3; - - if (m_decimator32.workDecimateCenter(&x4, &y4)) - { - qint32 x5 = x4; - qint32 y5 = y4; - - if (m_decimator64.workDecimateCenter(&x5, &y5)) - { - (**it).setReal(x5 >> decimation_shifts::post64); - (**it).setImag(y5 >> decimation_shifts::post64); - ++(*it); - } - } - } - } - } - } - } -} - template void Decimators::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len) { @@ -699,4 +488,1051 @@ void Decimators::decimate64_sup(SampleVector::iterator* i } } +template +void Decimators::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + qint32 intbuf[2]; + + for (int pos = 0; pos < len - 3; pos += 4) + { + intbuf[0] = buf[pos+2]; + intbuf[1] = buf[pos+3]; + + m_decimator2.myDecimate( + buf[pos+0] << decimation_shifts::pre2, + buf[pos+1] << decimation_shifts::pre2, + &intbuf[0], + &intbuf[1]); + + (**it).setReal(intbuf[0] >> decimation_shifts::post2); + (**it).setImag(intbuf[1] >> decimation_shifts::post2); + ++(*it); + } +} + +template +void Decimators::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + qint32 intbuf[4]; + + for (int pos = 0; pos < len - 7; pos += 8) + { + intbuf[0] = buf[pos+2]; + intbuf[1] = buf[pos+3]; + intbuf[2] = buf[pos+6]; + intbuf[3] = buf[pos+7]; + + m_decimator2.myDecimate( + buf[pos+0] << decimation_shifts::pre4, + buf[pos+1] << decimation_shifts::pre4, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + buf[pos+4] << decimation_shifts::pre4, + buf[pos+5] << decimation_shifts::pre4, + &intbuf[2], + &intbuf[3]); + + m_decimator4.myDecimate( + intbuf[0], + intbuf[1], + &intbuf[2], + &intbuf[3]); + + (**it).setReal(intbuf[2] >> decimation_shifts::post4); + (**it).setImag(intbuf[3] >> decimation_shifts::post4); + ++(*it); + } +} + +template +void Decimators::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + qint32 intbuf[8]; + + for (int pos = 0; pos < len - 15; pos += 16) + { + intbuf[0] = buf[pos+2]; + intbuf[1] = buf[pos+3]; + intbuf[2] = buf[pos+6]; + intbuf[3] = buf[pos+7]; + intbuf[4] = buf[pos+10]; + intbuf[5] = buf[pos+11]; + intbuf[6] = buf[pos+14]; + intbuf[7] = buf[pos+15]; + + m_decimator2.myDecimate( + buf[pos+0] << decimation_shifts::pre8, + buf[pos+1] << decimation_shifts::pre8, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + buf[pos+4] << decimation_shifts::pre8, + buf[pos+5] << decimation_shifts::pre8, + &intbuf[2], + &intbuf[3]); + m_decimator2.myDecimate( + buf[pos+8] << decimation_shifts::pre8, + buf[pos+9] << decimation_shifts::pre8, + &intbuf[4], + &intbuf[5]); + m_decimator2.myDecimate( + buf[pos+12] << decimation_shifts::pre8, + buf[pos+13] << decimation_shifts::pre8, + &intbuf[6], + &intbuf[7]); + + m_decimator4.myDecimate( + intbuf[0], + intbuf[1], + &intbuf[2], + &intbuf[3]); + m_decimator4.myDecimate( + intbuf[4], + intbuf[5], + &intbuf[6], + &intbuf[7]); + + m_decimator8.myDecimate( + intbuf[2], + intbuf[3], + &intbuf[6], + &intbuf[7]); + + (**it).setReal(intbuf[6] >> decimation_shifts::post8); + (**it).setImag(intbuf[7] >> decimation_shifts::post8); + ++(*it); + } +} + +template +void Decimators::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + qint32 intbuf[16]; + + for (int pos = 0; pos < len - 31; pos += 32) + { + intbuf[0] = buf[pos+2]; + intbuf[1] = buf[pos+3]; + intbuf[2] = buf[pos+6]; + intbuf[3] = buf[pos+7]; + intbuf[4] = buf[pos+10]; + intbuf[5] = buf[pos+11]; + intbuf[6] = buf[pos+14]; + intbuf[7] = buf[pos+15]; + intbuf[8] = buf[pos+18]; + intbuf[9] = buf[pos+19]; + intbuf[10] = buf[pos+22]; + intbuf[11] = buf[pos+23]; + intbuf[12] = buf[pos+26]; + intbuf[13] = buf[pos+27]; + intbuf[14] = buf[pos+30]; + intbuf[15] = buf[pos+31]; + + m_decimator2.myDecimate( + buf[pos+0] << decimation_shifts::pre16, + buf[pos+1] << decimation_shifts::pre16, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + buf[pos+4] << decimation_shifts::pre16, + buf[pos+5] << decimation_shifts::pre16, + &intbuf[2], + &intbuf[3]); + m_decimator2.myDecimate( + buf[pos+8] << decimation_shifts::pre16, + buf[pos+9] << decimation_shifts::pre16, + &intbuf[4], + &intbuf[5]); + m_decimator2.myDecimate( + buf[pos+12] << decimation_shifts::pre16, + buf[pos+13] << decimation_shifts::pre16, + &intbuf[6], + &intbuf[7]); + m_decimator2.myDecimate( + buf[pos+16] << decimation_shifts::pre16, + buf[pos+17] << decimation_shifts::pre16, + &intbuf[8], + &intbuf[9]); + m_decimator2.myDecimate( + buf[pos+20] << decimation_shifts::pre16, + buf[pos+21] << decimation_shifts::pre16, + &intbuf[10], + &intbuf[11]); + m_decimator2.myDecimate( + buf[pos+24] << decimation_shifts::pre16, + buf[pos+25] << decimation_shifts::pre16, + &intbuf[12], + &intbuf[13]); + m_decimator2.myDecimate( + buf[pos+28] << decimation_shifts::pre16, + buf[pos+29] << decimation_shifts::pre16, + &intbuf[14], + &intbuf[15]); + + m_decimator4.myDecimate( + intbuf[0], + intbuf[1], + &intbuf[2], + &intbuf[3]); + m_decimator4.myDecimate( + intbuf[4], + intbuf[5], + &intbuf[6], + &intbuf[7]); + m_decimator4.myDecimate( + intbuf[8], + intbuf[9], + &intbuf[10], + &intbuf[11]); + m_decimator4.myDecimate( + intbuf[12], + intbuf[13], + &intbuf[14], + &intbuf[15]); + + m_decimator8.myDecimate( + intbuf[2], + intbuf[3], + &intbuf[6], + &intbuf[7]); + m_decimator8.myDecimate( + intbuf[10], + intbuf[11], + &intbuf[14], + &intbuf[15]); + + m_decimator16.myDecimate( + intbuf[6], + intbuf[7], + &intbuf[14], + &intbuf[15]); + + (**it).setReal(intbuf[14] >> decimation_shifts::post16); + (**it).setImag(intbuf[15] >> decimation_shifts::post16); + ++(*it); + } +} + +template +void Decimators::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + qint32 intbuf[32]; + + for (int pos = 0; pos < len - 63; pos += 64) + { + intbuf[0] = buf[pos+2]; + intbuf[1] = buf[pos+3]; + intbuf[2] = buf[pos+6]; + intbuf[3] = buf[pos+7]; + intbuf[4] = buf[pos+10]; + intbuf[5] = buf[pos+11]; + intbuf[6] = buf[pos+14]; + intbuf[7] = buf[pos+15]; + intbuf[8] = buf[pos+18]; + intbuf[9] = buf[pos+19]; + intbuf[10] = buf[pos+22]; + intbuf[11] = buf[pos+23]; + intbuf[12] = buf[pos+26]; + intbuf[13] = buf[pos+27]; + intbuf[14] = buf[pos+30]; + intbuf[15] = buf[pos+31]; + intbuf[16] = buf[pos+34]; + intbuf[17] = buf[pos+35]; + intbuf[18] = buf[pos+38]; + intbuf[19] = buf[pos+39]; + intbuf[20] = buf[pos+42]; + intbuf[21] = buf[pos+43]; + intbuf[22] = buf[pos+46]; + intbuf[23] = buf[pos+47]; + intbuf[24] = buf[pos+50]; + intbuf[25] = buf[pos+51]; + intbuf[26] = buf[pos+54]; + intbuf[27] = buf[pos+55]; + intbuf[28] = buf[pos+58]; + intbuf[29] = buf[pos+59]; + intbuf[30] = buf[pos+62]; + intbuf[31] = buf[pos+63]; + + m_decimator2.myDecimate( + buf[pos+0] << decimation_shifts::pre32, + buf[pos+1] << decimation_shifts::pre32, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + buf[pos+4] << decimation_shifts::pre32, + buf[pos+5] << decimation_shifts::pre32, + &intbuf[2], + &intbuf[3]); + m_decimator2.myDecimate( + buf[pos+8] << decimation_shifts::pre32, + buf[pos+9] << decimation_shifts::pre32, + &intbuf[4], + &intbuf[5]); + m_decimator2.myDecimate( + buf[pos+12] << decimation_shifts::pre32, + buf[pos+13] << decimation_shifts::pre32, + &intbuf[6], + &intbuf[7]); + m_decimator2.myDecimate( + buf[pos+16] << decimation_shifts::pre32, + buf[pos+17] << decimation_shifts::pre32, + &intbuf[8], + &intbuf[9]); + m_decimator2.myDecimate( + buf[pos+20] << decimation_shifts::pre32, + buf[pos+21] << decimation_shifts::pre32, + &intbuf[10], + &intbuf[11]); + m_decimator2.myDecimate( + buf[pos+24] << decimation_shifts::pre32, + buf[pos+25] << decimation_shifts::pre32, + &intbuf[12], + &intbuf[13]); + m_decimator2.myDecimate( + buf[pos+28] << decimation_shifts::pre32, + buf[pos+29] << decimation_shifts::pre32, + &intbuf[14], + &intbuf[15]); + m_decimator2.myDecimate( + buf[pos+32] << decimation_shifts::pre32, + buf[pos+33] << decimation_shifts::pre32, + &intbuf[16], + &intbuf[17]); + m_decimator2.myDecimate( + buf[pos+36] << decimation_shifts::pre32, + buf[pos+37] << decimation_shifts::pre32, + &intbuf[18], + &intbuf[19]); + m_decimator2.myDecimate( + buf[pos+40] << decimation_shifts::pre32, + buf[pos+41] << decimation_shifts::pre32, + &intbuf[20], + &intbuf[21]); + m_decimator2.myDecimate( + buf[pos+44] << decimation_shifts::pre32, + buf[pos+45] << decimation_shifts::pre32, + &intbuf[22], + &intbuf[23]); + m_decimator2.myDecimate( + buf[pos+48] << decimation_shifts::pre32, + buf[pos+49] << decimation_shifts::pre32, + &intbuf[24], + &intbuf[25]); + m_decimator2.myDecimate( + buf[pos+52] << decimation_shifts::pre32, + buf[pos+53] << decimation_shifts::pre32, + &intbuf[26], + &intbuf[27]); + m_decimator2.myDecimate( + buf[pos+56] << decimation_shifts::pre32, + buf[pos+57] << decimation_shifts::pre32, + &intbuf[28], + &intbuf[29]); + m_decimator2.myDecimate( + buf[pos+60] << decimation_shifts::pre32, + buf[pos+61] << decimation_shifts::pre32, + &intbuf[30], + &intbuf[31]); + + m_decimator4.myDecimate( + intbuf[0], + intbuf[1], + &intbuf[2], + &intbuf[3]); + m_decimator4.myDecimate( + intbuf[4], + intbuf[5], + &intbuf[6], + &intbuf[7]); + m_decimator4.myDecimate( + intbuf[8], + intbuf[9], + &intbuf[10], + &intbuf[11]); + m_decimator4.myDecimate( + intbuf[12], + intbuf[13], + &intbuf[14], + &intbuf[15]); + m_decimator4.myDecimate( + intbuf[16], + intbuf[17], + &intbuf[18], + &intbuf[19]); + m_decimator4.myDecimate( + intbuf[20], + intbuf[21], + &intbuf[22], + &intbuf[23]); + m_decimator4.myDecimate( + intbuf[24], + intbuf[25], + &intbuf[26], + &intbuf[27]); + m_decimator4.myDecimate( + intbuf[28], + intbuf[29], + &intbuf[30], + &intbuf[31]); + + m_decimator8.myDecimate( + intbuf[2], + intbuf[3], + &intbuf[6], + &intbuf[7]); + m_decimator8.myDecimate( + intbuf[10], + intbuf[11], + &intbuf[14], + &intbuf[15]); + m_decimator8.myDecimate( + intbuf[18], + intbuf[19], + &intbuf[22], + &intbuf[23]); + m_decimator8.myDecimate( + intbuf[26], + intbuf[27], + &intbuf[30], + &intbuf[31]); + + m_decimator16.myDecimate( + intbuf[6], + intbuf[7], + &intbuf[14], + &intbuf[15]); + m_decimator16.myDecimate( + intbuf[22], + intbuf[23], + &intbuf[30], + &intbuf[31]); + + m_decimator32.myDecimate( + intbuf[14], + intbuf[15], + &intbuf[30], + &intbuf[31]); + + (**it).setReal(intbuf[30] >> decimation_shifts::post32); + (**it).setImag(intbuf[31] >> decimation_shifts::post32); + ++(*it); + } +} + + +template +void Decimators::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + qint32 intbuf[63]; + + for (int pos = 0; pos < len - 127; pos += 128) + { + intbuf[0] = buf[pos+2]; + intbuf[1] = buf[pos+3]; + intbuf[2] = buf[pos+6]; + intbuf[3] = buf[pos+7]; + intbuf[4] = buf[pos+10]; + intbuf[5] = buf[pos+11]; + intbuf[6] = buf[pos+14]; + intbuf[7] = buf[pos+15]; + intbuf[8] = buf[pos+18]; + intbuf[9] = buf[pos+19]; + intbuf[10] = buf[pos+22]; + intbuf[11] = buf[pos+23]; + intbuf[12] = buf[pos+26]; + intbuf[13] = buf[pos+27]; + intbuf[14] = buf[pos+30]; + intbuf[15] = buf[pos+31]; + intbuf[16] = buf[pos+34]; + intbuf[17] = buf[pos+35]; + intbuf[18] = buf[pos+38]; + intbuf[19] = buf[pos+39]; + intbuf[20] = buf[pos+42]; + intbuf[21] = buf[pos+43]; + intbuf[22] = buf[pos+46]; + intbuf[23] = buf[pos+47]; + intbuf[24] = buf[pos+50]; + intbuf[25] = buf[pos+51]; + intbuf[26] = buf[pos+54]; + intbuf[27] = buf[pos+55]; + intbuf[28] = buf[pos+58]; + intbuf[29] = buf[pos+59]; + intbuf[30] = buf[pos+62]; + intbuf[31] = buf[pos+63]; + + intbuf[32] = buf[pos+66]; + intbuf[33] = buf[pos+67]; + intbuf[34] = buf[pos+70]; + intbuf[35] = buf[pos+71]; + intbuf[36] = buf[pos+74]; + intbuf[37] = buf[pos+75]; + intbuf[38] = buf[pos+78]; + intbuf[39] = buf[pos+79]; + intbuf[40] = buf[pos+82]; + intbuf[41] = buf[pos+83]; + intbuf[42] = buf[pos+86]; + intbuf[43] = buf[pos+87]; + intbuf[44] = buf[pos+90]; + intbuf[45] = buf[pos+91]; + intbuf[46] = buf[pos+94]; + intbuf[47] = buf[pos+95]; + intbuf[48] = buf[pos+98]; + intbuf[49] = buf[pos+99]; + intbuf[50] = buf[pos+102]; + intbuf[51] = buf[pos+103]; + intbuf[52] = buf[pos+106]; + intbuf[53] = buf[pos+107]; + intbuf[54] = buf[pos+110]; + intbuf[55] = buf[pos+111]; + intbuf[56] = buf[pos+114]; + intbuf[57] = buf[pos+115]; + intbuf[58] = buf[pos+118]; + intbuf[59] = buf[pos+119]; + intbuf[60] = buf[pos+122]; + intbuf[61] = buf[pos+123]; + intbuf[62] = buf[pos+126]; + intbuf[63] = buf[pos+127]; + + m_decimator2.myDecimate( + buf[pos+0] << decimation_shifts::pre64, + buf[pos+1] << decimation_shifts::pre64, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + buf[pos+4] << decimation_shifts::pre64, + buf[pos+5] << decimation_shifts::pre64, + &intbuf[2], + &intbuf[3]); + m_decimator2.myDecimate( + buf[pos+8] << decimation_shifts::pre64, + buf[pos+9] << decimation_shifts::pre64, + &intbuf[4], + &intbuf[5]); + m_decimator2.myDecimate( + buf[pos+12] << decimation_shifts::pre64, + buf[pos+13] << decimation_shifts::pre64, + &intbuf[6], + &intbuf[7]); + m_decimator2.myDecimate( + buf[pos+16] << decimation_shifts::pre64, + buf[pos+17] << decimation_shifts::pre64, + &intbuf[8], + &intbuf[9]); + m_decimator2.myDecimate( + buf[pos+20] << decimation_shifts::pre64, + buf[pos+21] << decimation_shifts::pre64, + &intbuf[10], + &intbuf[11]); + m_decimator2.myDecimate( + buf[pos+24] << decimation_shifts::pre64, + buf[pos+25] << decimation_shifts::pre64, + &intbuf[12], + &intbuf[13]); + m_decimator2.myDecimate( + buf[pos+28] << decimation_shifts::pre64, + buf[pos+29] << decimation_shifts::pre64, + &intbuf[14], + &intbuf[15]); + m_decimator2.myDecimate( + buf[pos+32] << decimation_shifts::pre64, + buf[pos+33] << decimation_shifts::pre64, + &intbuf[16], + &intbuf[17]); + m_decimator2.myDecimate( + buf[pos+36] << decimation_shifts::pre64, + buf[pos+37] << decimation_shifts::pre64, + &intbuf[18], + &intbuf[19]); + m_decimator2.myDecimate( + buf[pos+40] << decimation_shifts::pre64, + buf[pos+41] << decimation_shifts::pre64, + &intbuf[20], + &intbuf[21]); + m_decimator2.myDecimate( + buf[pos+44] << decimation_shifts::pre64, + buf[pos+45] << decimation_shifts::pre64, + &intbuf[22], + &intbuf[23]); + m_decimator2.myDecimate( + buf[pos+48] << decimation_shifts::pre64, + buf[pos+49] << decimation_shifts::pre64, + &intbuf[24], + &intbuf[25]); + m_decimator2.myDecimate( + buf[pos+52] << decimation_shifts::pre64, + buf[pos+53] << decimation_shifts::pre64, + &intbuf[26], + &intbuf[27]); + m_decimator2.myDecimate( + buf[pos+56] << decimation_shifts::pre64, + buf[pos+57] << decimation_shifts::pre64, + &intbuf[28], + &intbuf[29]); + m_decimator2.myDecimate( + buf[pos+60] << decimation_shifts::pre64, + buf[pos+61] << decimation_shifts::pre64, + &intbuf[30], + &intbuf[31]); + m_decimator2.myDecimate( + buf[pos+64] << decimation_shifts::pre64, + buf[pos+65] << decimation_shifts::pre64, + &intbuf[32], + &intbuf[33]); + m_decimator2.myDecimate( + buf[pos+68] << decimation_shifts::pre64, + buf[pos+69] << decimation_shifts::pre64, + &intbuf[34], + &intbuf[35]); + m_decimator2.myDecimate( + buf[pos+72] << decimation_shifts::pre64, + buf[pos+73] << decimation_shifts::pre64, + &intbuf[36], + &intbuf[37]); + m_decimator2.myDecimate( + buf[pos+76] << decimation_shifts::pre64, + buf[pos+77] << decimation_shifts::pre64, + &intbuf[38], + &intbuf[39]); + m_decimator2.myDecimate( + buf[pos+80] << decimation_shifts::pre64, + buf[pos+81] << decimation_shifts::pre64, + &intbuf[40], + &intbuf[41]); + m_decimator2.myDecimate( + buf[pos+84] << decimation_shifts::pre64, + buf[pos+85] << decimation_shifts::pre64, + &intbuf[42], + &intbuf[43]); + m_decimator2.myDecimate( + buf[pos+88] << decimation_shifts::pre64, + buf[pos+89] << decimation_shifts::pre64, + &intbuf[44], + &intbuf[45]); + m_decimator2.myDecimate( + buf[pos+92] << decimation_shifts::pre64, + buf[pos+93] << decimation_shifts::pre64, + &intbuf[46], + &intbuf[47]); + m_decimator2.myDecimate( + buf[pos+96] << decimation_shifts::pre64, + buf[pos+97] << decimation_shifts::pre64, + &intbuf[48], + &intbuf[49]); + m_decimator2.myDecimate( + buf[pos+100] << decimation_shifts::pre64, + buf[pos+101] << decimation_shifts::pre64, + &intbuf[50], + &intbuf[51]); + m_decimator2.myDecimate( + buf[pos+104] << decimation_shifts::pre64, + buf[pos+105] << decimation_shifts::pre64, + &intbuf[52], + &intbuf[53]); + m_decimator2.myDecimate( + buf[pos+108] << decimation_shifts::pre64, + buf[pos+109] << decimation_shifts::pre64, + &intbuf[54], + &intbuf[55]); + m_decimator2.myDecimate( + buf[pos+112] << decimation_shifts::pre64, + buf[pos+113] << decimation_shifts::pre64, + &intbuf[56], + &intbuf[57]); + m_decimator2.myDecimate( + buf[pos+116] << decimation_shifts::pre64, + buf[pos+117] << decimation_shifts::pre64, + &intbuf[58], + &intbuf[59]); + m_decimator2.myDecimate( + buf[pos+120] << decimation_shifts::pre64, + buf[pos+121] << decimation_shifts::pre64, + &intbuf[60], + &intbuf[61]); + m_decimator2.myDecimate( + buf[pos+124] << decimation_shifts::pre64, + buf[pos+125] << decimation_shifts::pre64, + &intbuf[62], + &intbuf[63]); + + m_decimator4.myDecimate( + intbuf[0], + intbuf[1], + &intbuf[2], + &intbuf[3]); + m_decimator4.myDecimate( + intbuf[4], + intbuf[5], + &intbuf[6], + &intbuf[7]); + m_decimator4.myDecimate( + intbuf[8], + intbuf[9], + &intbuf[10], + &intbuf[11]); + m_decimator4.myDecimate( + intbuf[12], + intbuf[13], + &intbuf[14], + &intbuf[15]); + m_decimator4.myDecimate( + intbuf[16], + intbuf[17], + &intbuf[18], + &intbuf[19]); + m_decimator4.myDecimate( + intbuf[20], + intbuf[21], + &intbuf[22], + &intbuf[23]); + m_decimator4.myDecimate( + intbuf[24], + intbuf[25], + &intbuf[26], + &intbuf[27]); + m_decimator4.myDecimate( + intbuf[28], + intbuf[29], + &intbuf[30], + &intbuf[31]); + m_decimator4.myDecimate( + intbuf[32], + intbuf[33], + &intbuf[34], + &intbuf[35]); + m_decimator4.myDecimate( + intbuf[36], + intbuf[37], + &intbuf[38], + &intbuf[39]); + m_decimator4.myDecimate( + intbuf[40], + intbuf[41], + &intbuf[42], + &intbuf[43]); + m_decimator4.myDecimate( + intbuf[44], + intbuf[45], + &intbuf[46], + &intbuf[47]); + m_decimator4.myDecimate( + intbuf[48], + intbuf[49], + &intbuf[50], + &intbuf[51]); + m_decimator4.myDecimate( + intbuf[52], + intbuf[53], + &intbuf[54], + &intbuf[55]); + m_decimator4.myDecimate( + intbuf[56], + intbuf[57], + &intbuf[58], + &intbuf[59]); + m_decimator4.myDecimate( + intbuf[60], + intbuf[61], + &intbuf[62], + &intbuf[63]); + + m_decimator8.myDecimate( + intbuf[2], + intbuf[3], + &intbuf[6], + &intbuf[7]); + m_decimator8.myDecimate( + intbuf[10], + intbuf[11], + &intbuf[14], + &intbuf[15]); + m_decimator8.myDecimate( + intbuf[18], + intbuf[19], + &intbuf[22], + &intbuf[23]); + m_decimator8.myDecimate( + intbuf[26], + intbuf[27], + &intbuf[30], + &intbuf[31]); + m_decimator8.myDecimate( + intbuf[34], + intbuf[35], + &intbuf[38], + &intbuf[39]); + m_decimator8.myDecimate( + intbuf[42], + intbuf[43], + &intbuf[46], + &intbuf[47]); + m_decimator8.myDecimate( + intbuf[50], + intbuf[51], + &intbuf[54], + &intbuf[55]); + m_decimator8.myDecimate( + intbuf[58], + intbuf[59], + &intbuf[62], + &intbuf[63]); + + m_decimator16.myDecimate( + intbuf[6], + intbuf[7], + &intbuf[14], + &intbuf[15]); + m_decimator16.myDecimate( + intbuf[22], + intbuf[23], + &intbuf[30], + &intbuf[31]); + m_decimator16.myDecimate( + intbuf[38], + intbuf[39], + &intbuf[46], + &intbuf[47]); + m_decimator16.myDecimate( + intbuf[54], + intbuf[55], + &intbuf[62], + &intbuf[63]); + + m_decimator32.myDecimate( + intbuf[14], + intbuf[15], + &intbuf[30], + &intbuf[31]); + m_decimator32.myDecimate( + intbuf[46], + intbuf[47], + &intbuf[62], + &intbuf[63]); + + m_decimator64.myDecimate( + intbuf[30], + intbuf[31], + &intbuf[62], + &intbuf[63]); + + (**it).setReal(intbuf[62] >> decimation_shifts::post64); + (**it).setImag(intbuf[63] >> decimation_shifts::post64); + ++(*it); + } +} + +/* +template +void Decimators::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + int pos = 0; + + while (pos < len - 1) + { + qint32 x0 = buf[pos+0] << decimation_shifts::pre2; + qint32 y0 = buf[pos+1] << decimation_shifts::pre2; + pos += 2; + + if (m_decimator2.workDecimateCenter(&x0, &y0)) + { + (**it).setReal(x0 >> decimation_shifts::post2); + (**it).setImag(y0 >> decimation_shifts::post2); + ++(*it); + } + } +} + +template +void Decimators::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + int pos = 0; + + while (pos < len - 1) + { + qint32 x0 = buf[pos+0] << decimation_shifts::pre4; + qint32 y0 = buf[pos+1] << decimation_shifts::pre4; + pos += 2; + + if (m_decimator2.workDecimateCenter(&x0, &y0)) + { + qint32 x1 = x0; + qint32 y1 = y0; + + if (m_decimator4.workDecimateCenter(&x1, &y1)) + { + (**it).setReal(x0 >> decimation_shifts::post4); + (**it).setImag(y0 >> decimation_shifts::post4); + ++(*it); + } + } + } +} + +template +void Decimators::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + int pos = 0; + + while (pos < len - 1) + { + qint32 x0 = buf[pos+0] << decimation_shifts::pre8; + qint32 y0 = buf[pos+1] << decimation_shifts::pre8; + pos += 2; + + if (m_decimator2.workDecimateCenter(&x0, &y0)) + { + qint32 x1 = x0; + qint32 y1 = y0; + + if (m_decimator4.workDecimateCenter(&x1, &y1)) + { + qint32 x2 = x1; + qint32 y2 = y1; + + if (m_decimator8.workDecimateCenter(&x2, &y2)) + { + (**it).setReal(x2 >> decimation_shifts::post8); + (**it).setImag(y2 >> decimation_shifts::post8); + ++(*it); + } + } + } + } +} + +template +void Decimators::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + int pos = 0; + + while (pos < len - 1) + { + qint32 x0 = buf[pos+0] << decimation_shifts::pre16; + qint32 y0 = buf[pos+1] << decimation_shifts::pre16; + pos += 2; + + if (m_decimator2.workDecimateCenter(&x0, &y0)) + { + qint32 x1 = x0; + qint32 y1 = y0; + + if (m_decimator4.workDecimateCenter(&x1, &y1)) + { + qint32 x2 = x1; + qint32 y2 = y1; + + if (m_decimator8.workDecimateCenter(&x2, &y2)) + { + qint32 x3 = x2; + qint32 y3 = y2; + + if (m_decimator16.workDecimateCenter(&x3, &y3)) + { + (**it).setReal(x3 >> decimation_shifts::post16); + (**it).setImag(y3 >> decimation_shifts::post16); + ++(*it); + } + } + } + } + } +} + +template +void Decimators::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + int pos = 0; + + while (pos < len - 1) + { + qint32 x0 = buf[pos+0] << decimation_shifts::pre32; + qint32 y0 = buf[pos+1] << decimation_shifts::pre32; + pos += 2; + + if (m_decimator2.workDecimateCenter(&x0, &y0)) + { + qint32 x1 = x0; + qint32 y1 = y0; + + if (m_decimator4.workDecimateCenter(&x1, &y1)) + { + qint32 x2 = x1; + qint32 y2 = y1; + + if (m_decimator8.workDecimateCenter(&x2, &y2)) + { + qint32 x3 = x2; + qint32 y3 = y2; + + if (m_decimator16.workDecimateCenter(&x3, &y3)) + { + qint32 x4 = x3; + qint32 y4 = y3; + + if (m_decimator32.workDecimateCenter(&x4, &y4)) + { + (**it).setReal(x4 >> decimation_shifts::post32); + (**it).setImag(y4 >> decimation_shifts::post32); + ++(*it); + } + } + } + } + } + } +} + + +template +void Decimators::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + int pos = 0; + + while (pos < len - 1) + { + qint32 x0 = buf[pos+0] << decimation_shifts::pre64; + qint32 y0 = buf[pos+1] << decimation_shifts::pre64; + pos += 2; + + if (m_decimator2.workDecimateCenter(&x0, &y0)) + { + qint32 x1 = x0; + qint32 y1 = y0; + + if (m_decimator4.workDecimateCenter(&x1, &y1)) + { + qint32 x2 = x1; + qint32 y2 = y1; + + if (m_decimator8.workDecimateCenter(&x2, &y2)) + { + qint32 x3 = x2; + qint32 y3 = y2; + + if (m_decimator16.workDecimateCenter(&x3, &y3)) + { + qint32 x4 = x3; + qint32 y4 = y3; + + if (m_decimator32.workDecimateCenter(&x4, &y4)) + { + qint32 x5 = x4; + qint32 y5 = y4; + + if (m_decimator64.workDecimateCenter(&x5, &y5)) + { + (**it).setReal(x5 >> decimation_shifts::post64); + (**it).setImag(y5 >> decimation_shifts::post64); + ++(*it); + } + } + } + } + } + } + } +} + + */ + #endif /* INCLUDE_GPL_DSP_DECIMATORS_H_ */