mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-29 03:09:14 -05:00
GLScope redesign: ScopeVis: processTraces by start iterator and length. TraceBackBuffer: m_endPoint is now private
This commit is contained in:
parent
657d2d5996
commit
4283159e6a
@ -301,13 +301,13 @@ void ScopeVis::processMemoryTrace()
|
||||
traceMemoryIndex += GLScopeSettings::m_nbTraceMemories;
|
||||
}
|
||||
|
||||
SampleVector::const_iterator mend = m_traceDiscreteMemory.at(traceMemoryIndex).m_endPoint;
|
||||
SampleVector::const_iterator mend = m_traceDiscreteMemory.at(traceMemoryIndex).getEndPoint();
|
||||
SampleVector::const_iterator mbegin = mend - m_traceSize;
|
||||
SampleVector::const_iterator mbegin_tb = mbegin - m_maxTraceDelay;
|
||||
m_nbSamples = m_traceSize + m_maxTraceDelay;
|
||||
|
||||
processTraces(mbegin_tb, mbegin, true); // traceback
|
||||
processTraces(mbegin, mend, false);
|
||||
processTraces(mbegin_tb, m_maxTraceDelay, true); // traceback
|
||||
processTraces(mbegin, m_traceSize, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,7 +408,8 @@ void ScopeVis::processTrace(const std::vector<SampleVector::const_iterator>& vbe
|
||||
{
|
||||
int remainder;
|
||||
int count = end - begin; // number of samples in traceback buffer past the current point
|
||||
SampleVector::iterator mend = m_traceDiscreteMemory.current().current();
|
||||
SampleVector::iterator mend;
|
||||
m_traceDiscreteMemory.current().current(mend);
|
||||
SampleVector::iterator mbegin = mend - count;
|
||||
|
||||
if (m_traceStart) // start of trace processing
|
||||
@ -424,27 +425,27 @@ void ScopeVis::processTrace(const std::vector<SampleVector::const_iterator>& vbe
|
||||
// process until begin point
|
||||
|
||||
if (m_maxTraceDelay > 0) { // trace back
|
||||
processTraces(mbegin - m_preTriggerDelay - m_maxTraceDelay, mbegin - m_preTriggerDelay, true);
|
||||
processTraces(mbegin - m_preTriggerDelay - m_maxTraceDelay, m_maxTraceDelay, true);
|
||||
}
|
||||
|
||||
if (m_preTriggerDelay > 0) { // pre-trigger
|
||||
processTraces(mbegin - m_preTriggerDelay, mbegin);
|
||||
processTraces(mbegin - m_preTriggerDelay, m_preTriggerDelay);
|
||||
}
|
||||
|
||||
// process the rest of the trace
|
||||
|
||||
remainder = processTraces(mbegin, mend);
|
||||
remainder = processTraces(mbegin, count);
|
||||
m_traceStart = false;
|
||||
}
|
||||
else // process the current trace
|
||||
{
|
||||
remainder = processTraces(mbegin, mend);
|
||||
remainder = processTraces(mbegin, count);
|
||||
}
|
||||
|
||||
if (remainder >= 0) // finished
|
||||
{
|
||||
mbegin = mend - remainder;
|
||||
m_traceDiscreteMemory.current().m_endPoint = mbegin;
|
||||
m_traceDiscreteMemory.current().setEndPoint(mbegin);
|
||||
m_traceDiscreteMemory.store(m_preTriggerDelay+remainder); // next memory trace.
|
||||
m_triggerState = TriggerUntriggered;
|
||||
m_triggerWaitForReset = m_triggerOneShot;
|
||||
@ -506,9 +507,10 @@ bool ScopeVis::nextTrigger()
|
||||
}
|
||||
}
|
||||
|
||||
int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool traceBack)
|
||||
int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, int ilength, bool traceBack)
|
||||
{
|
||||
SampleVector::const_iterator begin(cbegin);
|
||||
SampleVector::const_iterator end(cbegin + ilength);
|
||||
uint32_t shift = (m_timeOfsProMill / 1000.0) * m_traceSize;
|
||||
uint32_t length = m_traceSize / m_timeBase;
|
||||
|
||||
|
@ -529,7 +529,6 @@ private:
|
||||
struct TraceBackBuffer
|
||||
{
|
||||
TraceBuffer m_traceBuffer;
|
||||
SampleVector::iterator m_endPoint;
|
||||
|
||||
TraceBackBuffer() {
|
||||
m_endPoint = m_traceBuffer.getCurrent();
|
||||
@ -551,8 +550,8 @@ private:
|
||||
return m_traceBuffer.absoluteFill();
|
||||
}
|
||||
|
||||
SampleVector::iterator current() {
|
||||
return m_traceBuffer.getCurrent();
|
||||
void current(SampleVector::iterator& it) {
|
||||
m_traceBuffer.getCurrent(it);
|
||||
}
|
||||
|
||||
QByteArray serialize() const
|
||||
@ -592,6 +591,17 @@ private:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void setEndPoint(const SampleVector::iterator& endPoint) {
|
||||
m_endPoint = endPoint;
|
||||
}
|
||||
|
||||
SampleVector::iterator getEndPoint() {
|
||||
return m_endPoint;
|
||||
}
|
||||
|
||||
private:
|
||||
SampleVector::iterator m_endPoint;
|
||||
};
|
||||
|
||||
struct TraceBackDiscreteMemory
|
||||
@ -632,7 +642,7 @@ private:
|
||||
uint32_t nextMemIndex = m_currentMemIndex < (m_memSize-1) ? m_currentMemIndex+1 : 0;
|
||||
m_traceBackBuffers[nextMemIndex].reset();
|
||||
m_traceBackBuffers[nextMemIndex].write(
|
||||
m_traceBackBuffers[m_currentMemIndex].m_endPoint - samplesToReport,
|
||||
m_traceBackBuffers[m_currentMemIndex].getEndPoint() - samplesToReport,
|
||||
samplesToReport
|
||||
);
|
||||
m_currentMemIndex = nextMemIndex;
|
||||
@ -1078,7 +1088,7 @@ private:
|
||||
* - if finished it returns the number of unprocessed samples left in the buffer
|
||||
* - if not finished it returns -1
|
||||
*/
|
||||
int processTraces(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool traceBack = false);
|
||||
int processTraces(const SampleVector::const_iterator& begin, int length, bool traceBack = false);
|
||||
|
||||
/**
|
||||
* Get maximum trace delay
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
}
|
||||
|
||||
typename std::vector<T>::iterator getCurrent() { return m_data.begin() + m_currentPosition + m_size; }
|
||||
void getCurrent(typename std::vector<T>::iterator& it) { it = m_data.begin() + m_currentPosition + m_size; }
|
||||
typename std::vector<T>::const_iterator begin() const { return m_data.begin(); }
|
||||
typename std::vector<T>::iterator begin() { return m_data.begin(); }
|
||||
unsigned int absoluteFill() const { return m_currentPosition; }
|
||||
|
Loading…
Reference in New Issue
Block a user