diff --git a/sdrbase/dsp/decimators.h b/sdrbase/dsp/decimators.h index 895fcf1f9..a49d0192a 100644 --- a/sdrbase/dsp/decimators.h +++ b/sdrbase/dsp/decimators.h @@ -492,6 +492,70 @@ void Decimators::decimate2_inf(SampleVector: } } +template +void Decimators::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len) +{ + StorageType xreal[2], yimag[2]; + + for (int pos = 0; pos < len - 7; pos += 8) + { + xreal[0] = buf[pos+2] << decimation_shifts::pre2; + yimag[0] = buf[pos+3] << decimation_shifts::pre2; + xreal[1] = buf[pos+6] << decimation_shifts::pre2; + yimag[1] = buf[pos+7] << decimation_shifts::pre2; + + m_decimator2.myDecimateSup( + buf[pos+0] << decimation_shifts::pre2, + buf[pos+1] << decimation_shifts::pre2, + &xreal[0], + &yimag[0], + buf[pos+4] << decimation_shifts::pre2, + buf[pos+5] << decimation_shifts::pre2, + &xreal[1], + &yimag[1]); + + (**it).setReal(xreal[0] >> decimation_shifts::post2); + (**it).setImag(yimag[0] >> decimation_shifts::post2); + ++(*it); + + (**it).setReal(xreal[1] >> decimation_shifts::post2); + (**it).setImag(yimag[1] >> decimation_shifts::post2); + ++(*it); + } +} + +template +void Decimators::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len) +{ + StorageType xreal[2], yimag[2]; + + for (int pos = 0; pos < len - 7; pos += 8) + { + xreal[0] = buf[pos+2] << decimation_shifts::pre2; + yimag[0] = buf[pos+3] << decimation_shifts::pre2; + xreal[1] = buf[pos+6] << decimation_shifts::pre2; + yimag[1] = buf[pos+7] << decimation_shifts::pre2; + + m_decimator2.myDecimateCen( + buf[pos+0] << decimation_shifts::pre2, + buf[pos+1] << decimation_shifts::pre2, + &xreal[0], + &yimag[0], + buf[pos+4] << decimation_shifts::pre2, + buf[pos+5] << decimation_shifts::pre2, + &xreal[1], + &yimag[1]); + + (**it).setReal(xreal[0] >> decimation_shifts::post2); + (**it).setImag(yimag[0] >> decimation_shifts::post2); + ++(*it); + + (**it).setReal(xreal[1] >> decimation_shifts::post2); + (**it).setImag(yimag[1] >> decimation_shifts::post2); + ++(*it); + } +} + // No filtering: bad for Rx OK for signal tracking //template //void Decimators::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len) @@ -537,37 +601,6 @@ void Decimators::decimate2_inf(SampleVector: // } //} -template -void Decimators::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len) -{ - StorageType xreal[2], yimag[2]; - - for (int pos = 0; pos < len - 7; pos += 8) - { - xreal[0] = buf[pos+2] << decimation_shifts::pre2; - yimag[0] = buf[pos+3] << decimation_shifts::pre2; - xreal[1] = buf[pos+6] << decimation_shifts::pre2; - yimag[1] = buf[pos+7] << decimation_shifts::pre2; - - m_decimator2.myDecimateSup( - buf[pos+0] << decimation_shifts::pre2, - buf[pos+1] << decimation_shifts::pre2, - &xreal[0], - &yimag[0], - buf[pos+4] << decimation_shifts::pre2, - buf[pos+5] << decimation_shifts::pre2, - &xreal[1], - &yimag[1]); - - (**it).setReal(xreal[0] >> decimation_shifts::post2); - (**it).setImag(yimag[0] >> decimation_shifts::post2); - ++(*it); - - (**it).setReal(xreal[1] >> decimation_shifts::post2); - (**it).setImag(yimag[1] >> decimation_shifts::post2); - ++(*it); - } -} template void Decimators::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len) @@ -1131,28 +1164,28 @@ void Decimators::decimate64_sup(SampleVector } } -template -void Decimators::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len) -{ - StorageType intbuf[2]; - - for (int pos = 0; pos < len - 3; pos += 4) - { - intbuf[0] = buf[pos+2] << decimation_shifts::pre2; - intbuf[1] = buf[pos+3] << decimation_shifts::pre2; - - 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::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len) +//{ +// StorageType intbuf[2]; +// +// for (int pos = 0; pos < len - 3; pos += 4) +// { +// intbuf[0] = buf[pos+2] << decimation_shifts::pre2; +// intbuf[1] = buf[pos+3] << decimation_shifts::pre2; +// +// 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::decimate2_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) diff --git a/sdrbase/dsp/inthalfbandfiltereo.h b/sdrbase/dsp/inthalfbandfiltereo.h index 0ab95a50f..e515a9e0c 100644 --- a/sdrbase/dsp/inthalfbandfiltereo.h +++ b/sdrbase/dsp/inthalfbandfiltereo.h @@ -572,6 +572,23 @@ public: advancePointer(); } + void myDecimateCen(int32_t x1, int32_t y1, int32_t *x2, int32_t *y2, int32_t x3, int32_t y3, int32_t *x4, int32_t *y4) + { + storeSample32(x1, y1); + advancePointer(); + + storeSample32(*x2, *y2); + doFIR(x2, y2); + advancePointer(); + + storeSample32(x3, y3); + advancePointer(); + + storeSample32(*x4, *y4); + doFIR(x4, y4); + advancePointer(); + } + void myDecimateInf(int32_t x1, int32_t y1, int32_t *x2, int32_t *y2, int32_t x3, int32_t y3, int32_t *x4, int32_t *y4) { storeSample32(-y1, x1);