diff --git a/plugins/samplesource/rtlsdr/rtlsdrthread.cpp b/plugins/samplesource/rtlsdr/rtlsdrthread.cpp index 778d5acfa..8346668c7 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrthread.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrthread.cpp @@ -77,7 +77,7 @@ void RTLSDRThread::run() void RTLSDRThread::decimate2(SampleVector::iterator* it, const quint8* buf, qint32 len) { qint16 xreal, yimag; - for (int pos = 0; pos < len + 7; pos += 8) { + for (int pos = 0; pos < len - 7; pos += 8) { xreal = buf[pos+0] - buf[pos+3]; yimag = buf[pos+1] + buf[pos+2] - 255; Sample s( xreal << 3, yimag << 3 ); @@ -93,7 +93,7 @@ void RTLSDRThread::decimate2(SampleVector::iterator* it, const quint8* buf, qint void RTLSDRThread::decimate4(SampleVector::iterator* it, const quint8* buf, qint32 len) { qint16 xreal, yimag; - for (int pos = 0; pos < len + 7; pos += 8) { + for (int pos = 0; pos < len - 7; pos += 8) { xreal = buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]; yimag = buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]; Sample s( xreal << 4, yimag << 4 ); @@ -105,7 +105,7 @@ void RTLSDRThread::decimate4(SampleVector::iterator* it, const quint8* buf, qint void RTLSDRThread::decimate8(SampleVector::iterator* it, const quint8* buf, qint32 len) { qint16 xreal, yimag; - for (int pos = 0; pos < len + 15; pos += 8) { + for (int pos = 0; pos < len - 15; pos += 8) { xreal = buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]; yimag = buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]; pos += 8;