1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-18 14:21:49 -05:00

Deep redesign: use the Decimators class for BladeRF also

This commit is contained in:
f4exb 2015-08-27 04:20:56 +02:00
parent 03004b2eb9
commit bb35ad6925
2 changed files with 27 additions and 18 deletions

View File

@ -87,6 +87,7 @@ void BladerfThread::run()
m_running = false; m_running = false;
} }
/*
void BladerfThread::decimate1(SampleVector::iterator* it, const qint16* buf, qint32 len) void BladerfThread::decimate1(SampleVector::iterator* it, const qint16* buf, qint32 len)
{ {
qint16 xreal, yimag; qint16 xreal, yimag;
@ -227,7 +228,7 @@ void BladerfThread::decimate32_cen(SampleVector::iterator* it, const qint16* buf
} }
} }
*/ */
/*
void BladerfThread::decimate2_cen(SampleVector::iterator* it, const qint16* buf, qint32 len) void BladerfThread::decimate2_cen(SampleVector::iterator* it, const qint16* buf, qint32 len)
{ {
for (int pos = 0; pos < len - 3; pos += 4) { for (int pos = 0; pos < len - 3; pos += 4) {
@ -591,6 +592,7 @@ void BladerfThread::decimate32_sup(SampleVector::iterator* it, const qint16* buf
(*it)++; (*it)++;
} }
} }
*/
// Decimate according to specified log2 (ex: log2=4 => decim=16) // Decimate according to specified log2 (ex: log2=4 => decim=16)
void BladerfThread::callback(const qint16* buf, qint32 len) void BladerfThread::callback(const qint16* buf, qint32 len)
@ -599,7 +601,7 @@ void BladerfThread::callback(const qint16* buf, qint32 len)
if (m_log2Decim == 0) if (m_log2Decim == 0)
{ {
decimate1(&it, buf, len); m_decimators.decimate1(&it, buf, len);
} }
else else
{ {
@ -608,19 +610,19 @@ void BladerfThread::callback(const qint16* buf, qint32 len)
switch (m_log2Decim) switch (m_log2Decim)
{ {
case 1: case 1:
decimate2(&it, buf, len); m_decimators.decimate2(&it, buf, len);
break; break;
case 2: case 2:
decimate4(&it, buf, len); m_decimators.decimate4(&it, buf, len);
break; break;
case 3: case 3:
decimate8(&it, buf, len); m_decimators.decimate8(&it, buf, len);
break; break;
case 4: case 4:
decimate16(&it, buf, len); m_decimators.decimate16(&it, buf, len);
break; break;
case 5: case 5:
decimate32(&it, buf, len); m_decimators.decimate32(&it, buf, len);
break; break;
default: default:
break; break;
@ -631,19 +633,19 @@ void BladerfThread::callback(const qint16* buf, qint32 len)
switch (m_log2Decim) switch (m_log2Decim)
{ {
case 1: case 1:
decimate2_sup(&it, buf, len); m_decimators.decimate2_sup(&it, buf, len);
break; break;
case 2: case 2:
decimate4_sup(&it, buf, len); m_decimators.decimate4_sup(&it, buf, len);
break; break;
case 3: case 3:
decimate8_sup(&it, buf, len); m_decimators.decimate8_sup(&it, buf, len);
break; break;
case 4: case 4:
decimate16_sup(&it, buf, len); m_decimators.decimate16_sup(&it, buf, len);
break; break;
case 5: case 5:
decimate32_sup(&it, buf, len); m_decimators.decimate32_sup(&it, buf, len);
break; break;
default: default:
break; break;
@ -654,19 +656,19 @@ void BladerfThread::callback(const qint16* buf, qint32 len)
switch (m_log2Decim) switch (m_log2Decim)
{ {
case 1: case 1:
decimate2_cen(&it, buf, len); m_decimators.decimate2_cen(&it, buf, len);
break; break;
case 2: case 2:
decimate4_cen(&it, buf, len); m_decimators.decimate4_cen(&it, buf, len);
break; break;
case 3: case 3:
decimate8_cen(&it, buf, len); m_decimators.decimate8_cen(&it, buf, len);
break; break;
case 4: case 4:
decimate16_cen(&it, buf, len); m_decimators.decimate16_cen(&it, buf, len);
break; break;
case 5: case 5:
decimate32_cen(&it, buf, len); m_decimators.decimate32_cen(&it, buf, len);
break; break;
default: default:
break; break;

View File

@ -22,7 +22,8 @@
#include <QWaitCondition> #include <QWaitCondition>
#include <libbladeRF.h> #include <libbladeRF.h>
#include "dsp/samplefifo.h" #include "dsp/samplefifo.h"
#include "dsp/inthalfbandfilter.h" //#include "dsp/inthalfbandfilter.h"
#include "dsp/decimators.h"
#define BLADERF_BLOCKSIZE (1<<14) #define BLADERF_BLOCKSIZE (1<<14)
@ -53,13 +54,18 @@ private:
unsigned int m_log2Decim; unsigned int m_log2Decim;
int m_fcPos; int m_fcPos;
/*
IntHalfbandFilter m_decimator2; // 1st stages IntHalfbandFilter m_decimator2; // 1st stages
IntHalfbandFilter m_decimator4; // 2nd stages IntHalfbandFilter m_decimator4; // 2nd stages
IntHalfbandFilter m_decimator8; // 3rd stages IntHalfbandFilter m_decimator8; // 3rd stages
IntHalfbandFilter m_decimator16; // 4th stages IntHalfbandFilter m_decimator16; // 4th stages
IntHalfbandFilter m_decimator32; // 5th stages IntHalfbandFilter m_decimator32; // 5th stages
*/
Decimators<qint16> m_decimators;
void run(); void run();
/*
void decimate1(SampleVector::iterator* it, const qint16* buf, qint32 len); void decimate1(SampleVector::iterator* it, const qint16* buf, qint32 len);
void decimate2_u(SampleVector::iterator* it, const quint16* buf, qint32 len); void decimate2_u(SampleVector::iterator* it, const quint16* buf, qint32 len);
void decimate2(SampleVector::iterator* it, const qint16* buf, qint32 len); void decimate2(SampleVector::iterator* it, const qint16* buf, qint32 len);
@ -77,6 +83,7 @@ private:
void decimate32(SampleVector::iterator* it, const qint16* buf, qint32 len); void decimate32(SampleVector::iterator* it, const qint16* buf, qint32 len);
void decimate32_sup(SampleVector::iterator* it, const qint16* buf, qint32 len); void decimate32_sup(SampleVector::iterator* it, const qint16* buf, qint32 len);
void decimate32_cen(SampleVector::iterator* it, const qint16* buf, qint32 len); void decimate32_cen(SampleVector::iterator* it, const qint16* buf, qint32 len);
*/
void callback(const qint16* buf, qint32 len); void callback(const qint16* buf, qint32 len);
}; };