From 1450289e0f86df311a7c7044b074e68c7c4bff79 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 28 Sep 2015 02:39:48 +0200 Subject: [PATCH] Fixed glitches in channel analyzer decimation --- CMakeLists.txt | 4 ++-- plugins/channel/chanalyzer/chanalyzer.cpp | 13 +++++----- plugins/channel/chanalyzer/chanalyzer.h | 1 + sdrbase/dsp/scopevis.cpp | 29 +++++++++++++++++++---- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d24b3a239..8e192c903 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,8 +33,8 @@ ENDIF() ############################################################################## #include(${QT_USE_FILE}) -#set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" ) -set( QT_DEFINITIONS "${QT_DEFINITIONS}" ) +set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" ) +#set( QT_DEFINITIONS "${QT_DEFINITIONS}" ) add_definitions(${QT_DEFINITIONS}) if(MSVC) diff --git a/plugins/channel/chanalyzer/chanalyzer.cpp b/plugins/channel/chanalyzer/chanalyzer.cpp index b07d77334..e9b753bff 100644 --- a/plugins/channel/chanalyzer/chanalyzer.cpp +++ b/plugins/channel/chanalyzer/chanalyzer.cpp @@ -38,6 +38,7 @@ ChannelAnalyzer::ChannelAnalyzer(SampleSink* sampleSink) : m_nco.setFreq(m_frequency, m_sampleRate); m_nco_test.setFreq(m_frequency, m_sampleRate); m_undersampleCount = 0; + m_sum = 0; m_usb = true; m_ssb = true; SSBFilter = new fftfilt(m_LowCutoff / m_sampleRate, m_Bandwidth / m_sampleRate, ssbFftLen); @@ -62,7 +63,7 @@ void ChannelAnalyzer::configure(MessageQueue* messageQueue, void ChannelAnalyzer::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly) { - fftfilt::cmplx *sideband, sum; + fftfilt::cmplx *sideband; int n_out; int decim = 1< (int)(m_trace.size() - m_fill)) + { count = m_trace.size() - m_fill; + } + std::vector::iterator it = m_trace.begin() + m_fill; - for(int i = 0; i < count; ++i) { + + for(int i = 0; i < count; ++i) + { *it++ = Complex(begin->real() / 32768.0, begin->imag() / 32768.0); ++begin; } + m_fill += count; - if(m_fill >= m_trace.size()) { + + if(m_fill >= m_trace.size()) + { m_glScope->newTrace(m_trace, m_sampleRate); m_fill = 0; } @@ -123,6 +132,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect } } } + if(m_triggerState == Untriggered) { while(begin < end) @@ -172,20 +182,31 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect ++begin; } } + if(m_triggerState == Triggered) { int count = end - begin; + if(count > (int)(m_trace.size() - m_fill)) + { count = m_trace.size() - m_fill; + } + std::vector::iterator it = m_trace.begin() + m_fill; - for(int i = 0; i < count; ++i) { + + for(int i = 0; i < count; ++i) + { *it++ = Complex(begin->real() / 32768.0, begin->imag() / 32768.0); ++begin; } + m_fill += count; - if(m_fill >= m_trace.size()) { + + if(m_fill >= m_trace.size()) + { m_glScope->newTrace(m_trace, m_sampleRate); m_fill = 0; + if (m_triggerOneShot) { m_triggerState = WaitForReset; } else {