Added decimation class with unsigned to signed conversion with shift. Applied to RTL-SDR

This commit is contained in:
f4exb 2018-01-16 00:01:38 +01:00
parent 18fa3b6156
commit c7e1526930
4 changed files with 1329 additions and 8 deletions

View File

@ -88,7 +88,7 @@ void RTLSDRThread::run()
}
// Decimate according to specified log2 (ex: log2=4 => decim=16)
void RTLSDRThread::callback(const qint8* buf, qint32 len)
void RTLSDRThread::callback(const quint8* buf, qint32 len)
{
SampleVector::iterator it = m_convertBuffer.begin();
@ -178,9 +178,6 @@ void RTLSDRThread::callback(const qint8* buf, qint32 len)
void RTLSDRThread::callbackHelper(unsigned char* buf, uint32_t len, void* ctx)
{
RTLSDRThread* thread = (RTLSDRThread*)ctx;
for (unsigned int i = 0; i < len; i++) {
buf[i] = buf[i] - 127;
}
thread->callback((qint8 *) buf, len);
thread->callback(buf, len);
}

View File

@ -24,7 +24,7 @@
#include <rtl-sdr.h>
#include "dsp/samplesinkfifo.h"
#include "dsp/decimators.h"
#include "dsp/decimatorsu.h"
class RTLSDRThread : public QThread {
Q_OBJECT
@ -52,10 +52,10 @@ private:
unsigned int m_log2Decim;
int m_fcPos;
Decimators<qint8, SDR_SAMP_SZ, 8> m_decimators;
DecimatorsU<quint8, SDR_SAMP_SZ, 8, 127> m_decimators;
void run();
void callback(const qint8* buf, qint32 len);
void callback(const quint8* buf, qint32 len);
static void callbackHelper(unsigned char* buf, uint32_t len, void* ctx);
};

View File

@ -96,6 +96,7 @@ set(sdrbase_HEADERS
dsp/cwkeyer.h
dsp/cwkeyersettings.h
dsp/decimators.h
dsp/decimatorsu.h
dsp/interpolators.h
dsp/dspcommands.h
dsp/dspengine.h

1323
sdrbase/dsp/decimatorsu.h Normal file

File diff suppressed because it is too large Load Diff