From daa2619bb3caef7a73d7500de5c335d3cac3481f Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 19 Feb 2017 04:46:15 +0100 Subject: [PATCH] New scope: activate trace cache --- sdrbase/dsp/scopevisng.cpp | 30 +++++++++++++++++++++++++++++- sdrbase/dsp/scopevisng.h | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/scopevisng.cpp b/sdrbase/dsp/scopevisng.cpp index 0308fd9d9..068cca961 100644 --- a/sdrbase/dsp/scopevisng.cpp +++ b/sdrbase/dsp/scopevisng.cpp @@ -620,13 +620,41 @@ bool ScopeVisNG::handleMessage(const Message& message) void ScopeVisNG::updateMaxTraceDelay() { int maxTraceDelay = 0; + bool allocateCache = false; + uint32_t projectorCounts[(int) nbProjectionTypes]; + memset(projectorCounts, 0, ((int) nbProjectionTypes)*sizeof(uint32_t)); + std::vector::iterator itData = m_traces.m_tracesData.begin(); + std::vector::iterator itCtrl = m_traces.m_tracesControl.begin(); - for (std::vector::iterator itData = m_traces.m_tracesData.begin(); itData != m_traces.m_tracesData.end(); ++itData) + for (; itData != m_traces.m_tracesData.end(); ++itData, ++itCtrl) { if (itData->m_traceDelay > maxTraceDelay) { maxTraceDelay = itData->m_traceDelay; } + + if (projectorCounts[(int) itData->m_projectionType] > 0) + { + allocateCache = true; + itCtrl->m_projector.setCacheMaster(false); + } + else + { + itCtrl->m_projector.setCacheMaster(true); + } + + projectorCounts[(int) itData->m_projectionType]++; + } + + itCtrl = m_traces.m_tracesControl.begin(); + + for (; itCtrl != m_traces.m_tracesControl.end(); ++itCtrl) + { + if (allocateCache) { + itCtrl->m_projector.setCache(m_projectorCache); + } else { + itCtrl->m_projector.setCache(0); + } } m_maxTraceDelay = maxTraceDelay; diff --git a/sdrbase/dsp/scopevisng.h b/sdrbase/dsp/scopevisng.h index 81d031934..d2b668aff 100644 --- a/sdrbase/dsp/scopevisng.h +++ b/sdrbase/dsp/scopevisng.h @@ -875,6 +875,7 @@ private: int m_maxTraceDelay; //!< Maximum trace delay TriggerComparator m_triggerComparator; //!< Compares sample level to trigger level QMutex m_mutex; + Real m_projectorCache[(int) nbProjectionTypes]; /** * Moves on to the next trigger if any or increments trigger count if in repeat mode