1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-28 05:02:25 -04:00

Shifted interpolators by 2

This commit is contained in:
f4exb 2019-03-31 11:14:40 +02:00
parent 9c5c726b97
commit ca24d8e9f6

View File

@ -107,6 +107,8 @@ public:
// interleaved I/Q input buffer
void interpolate1(SampleVector::iterator* it, T* buf, qint32 len);
void interpolate2_cen(SampleVector::iterator* it, T* buf, qint32 len);
void interpolate2_inf(SampleVector::iterator* it, T* buf, qint32 len);
void interpolate2_sup(SampleVector::iterator* it, T* buf, qint32 len);
void interpolate4_cen(SampleVector::iterator* it, T* buf, qint32 len);
void interpolate8_cen(SampleVector::iterator* it, T* buf, qint32 len);
void interpolate16_cen(SampleVector::iterator* it, T* buf, qint32 len);
@ -165,6 +167,60 @@ void Interpolators<T, SdrBits, OutputBits>::interpolate2_cen(SampleVector::itera
}
}
template<typename T, uint SdrBits, uint OutputBits>
void Interpolators<T, SdrBits, OutputBits>::interpolate2_inf(SampleVector::iterator* it, T* buf, qint32 len)
{
qint32 intbuf[8];
for (int pos = 0; pos < len - 7; pos += 8)
{
intbuf[0] = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre2;
intbuf[1] = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre2;
m_interpolator2.myInterpolate(&intbuf[0], &intbuf[1], &intbuf[2], &intbuf[3]);
++(*it);
intbuf[4] = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre2;
intbuf[5] = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre2;
m_interpolator2.myInterpolate(&intbuf[4], &intbuf[5], &intbuf[6], &intbuf[7]);
++(*it);
buf[pos+0] = intbuf[1] >> interpolation_shifts<SdrBits, OutputBits>::post2; // + imag
buf[pos+1] = -(intbuf[0] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - real
buf[pos+2] = -(intbuf[2] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - real
buf[pos+3] = -(intbuf[3] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - imag
buf[pos+4] = -(intbuf[5] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - imag
buf[pos+5] = intbuf[4] >> interpolation_shifts<SdrBits, OutputBits>::post2; // + real
buf[pos+6] = intbuf[6] >> interpolation_shifts<SdrBits, OutputBits>::post2; // + real
buf[pos+7] = intbuf[7] >> interpolation_shifts<SdrBits, OutputBits>::post2; // + imag
}
}
template<typename T, uint SdrBits, uint OutputBits>
void Interpolators<T, SdrBits, OutputBits>::interpolate2_sup(SampleVector::iterator* it, T* buf, qint32 len)
{
qint32 intbuf[8];
for (int pos = 0; pos < len - 7; pos += 8)
{
intbuf[0] = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre2;
intbuf[1] = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre2;
m_interpolator2.myInterpolate(&intbuf[0], &intbuf[1], &intbuf[2], &intbuf[3]);
++(*it);
intbuf[4] = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre2;
intbuf[5] = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre2;
m_interpolator2.myInterpolate(&intbuf[4], &intbuf[5], &intbuf[6], &intbuf[7]);
++(*it);
buf[pos+0] = -(intbuf[1] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - imag
buf[pos+1] = intbuf[0] >> interpolation_shifts<SdrBits, OutputBits>::post2; // + real
buf[pos+2] = -(intbuf[2] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - real
buf[pos+3] = -(intbuf[3] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - imag
buf[pos+4] = intbuf[5] >> interpolation_shifts<SdrBits, OutputBits>::post2; // + imag
buf[pos+5] = -(intbuf[4] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - real
buf[pos+6] = intbuf[6] >> interpolation_shifts<SdrBits, OutputBits>::post2; // + real
buf[pos+7] = intbuf[7] >> interpolation_shifts<SdrBits, OutputBits>::post2; // + imag
}
}
template<typename T, uint SdrBits, uint OutputBits>
void Interpolators<T, SdrBits, OutputBits>::interpolate4_cen(SampleVector::iterator* it, T* buf, qint32 len)
{