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