diff --git a/plugins/samplesource/rtlsdr/rtlsdrthread.cpp b/plugins/samplesource/rtlsdr/rtlsdrthread.cpp index 6c1ee8a17..46ec77e11 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrthread.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrthread.cpp @@ -88,7 +88,7 @@ void RTLSDRThread::run() } // Decimate according to specified log2 (ex: log2=4 => decim=16) -void RTLSDRThread::callback(const quint8* buf, qint32 len) +void RTLSDRThread::callback(const qint8* buf, qint32 len) { SampleVector::iterator it = m_convertBuffer.begin(); @@ -178,6 +178,9 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len) void RTLSDRThread::callbackHelper(unsigned char* buf, uint32_t len, void* ctx) { RTLSDRThread* thread = (RTLSDRThread*)ctx; - thread->callback(buf, len); + for (unsigned int i = 0; i < len; i++) { + buf[i] = buf[i] - 127; + } + thread->callback((qint8 *) buf, len); } diff --git a/plugins/samplesource/rtlsdr/rtlsdrthread.h b/plugins/samplesource/rtlsdr/rtlsdrthread.h index b5b35e080..8a9debf5f 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrthread.h +++ b/plugins/samplesource/rtlsdr/rtlsdrthread.h @@ -52,10 +52,10 @@ private: unsigned int m_log2Decim; int m_fcPos; - Decimators m_decimators; + Decimators m_decimators; void run(); - void callback(const quint8* buf, qint32 len); + void callback(const qint8* buf, qint32 len); static void callbackHelper(unsigned char* buf, uint32_t len, void* ctx); }; diff --git a/sdrbase/dsp/decimators.h b/sdrbase/dsp/decimators.h index ef5b64566..c4645c2da 100644 --- a/sdrbase/dsp/decimators.h +++ b/sdrbase/dsp/decimators.h @@ -83,18 +83,18 @@ struct decimation_shifts<16, 12> template<> struct decimation_shifts<16, 8> { - static const uint pre1 = 7; - static const uint pre2 = 6; + static const uint pre1 = 8; + static const uint pre2 = 7; static const uint post2 = 0; - static const uint pre4 = 5; + static const uint pre4 = 6; static const uint post4 = 0; - static const uint pre8 = 4; + static const uint pre8 = 5; static const uint post8 = 0; - static const uint pre16 = 3; + static const uint pre16 = 4; static const uint post16 = 0; - static const uint pre32 = 2; + static const uint pre32 = 3; static const uint post32 = 0; - static const uint pre64 = 1; + static const uint pre64 = 2; static const uint post64 = 0; };