1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Device MIMO engine fixes

This commit is contained in:
f4exb 2019-09-24 02:10:58 +02:00
parent c5062ac10b
commit aca92c7d32
4 changed files with 30 additions and 5 deletions

View File

@ -301,13 +301,19 @@ void DSPDeviceMIMOEngine::workSampleSinkFifo(unsigned int sinkIndex)
std::size_t count = sampleFifo->readBegin(sampleFifo->fill(), &part1begin, &part1end, &part2begin, &part2end);
if (part1begin != part1end) { // first part of FIFO data
workSamplePart(part1begin, part1end, sinkIndex);
m_vectorBuffer.write(part1begin, part1end, false);
//workSamplePart(part1begin, part1end, sinkIndex);
}
if (part2begin != part2end) { // second part of FIFO data (used when block wraps around)
workSamplePart(part2begin, part2end, sinkIndex);
m_vectorBuffer.append(part2begin, part2end);
//workSamplePart(part2begin, part2end, sinkIndex);
}
SampleVector::iterator vbegin, vend;
m_vectorBuffer.read(vbegin, vend);
workSamplePart(vbegin, vend, sinkIndex);
sampleFifo->readCommit((unsigned int) count); // adjust FIFO pointers
samplesDone += count;
}

View File

@ -22,6 +22,7 @@
#include <QThread>
#include "dsp/dsptypes.h"
#include "dsp/samplesinkvector.h"
#include "util/message.h"
#include "util/messagequeue.h"
#include "util/syncmessenger.h"
@ -377,11 +378,13 @@ private:
BasebandSampleSink *m_spectrumSink; //!< The spectrum sink
bool m_spectrumInputSourceElseSink; //!< Source else sink stream to be used as spectrum sink input
unsigned int m_spectrumInputIndex; //!< Index of the stream to be used as spectrum sink input
SampleSinkVector m_vectorBuffer;
void run();
void workSampleSinkFifo(unsigned int sinkIndex); //!< transfer samples of one sink (asynchronously)
void workSampleSinkVector(unsigned int sinkIndex); //!< same but sample sink vector flavor (TODO: remove if unused)
void workSamplePart(const SampleVector::iterator& vbegin, const SampleVector::iterator& vend, unsigned int sinkIndex);
void workSamplePart(int count);
State gotoIdle(); //!< Go to the idle state
State gotoInit(); //!< Go to the acquisition init state from idle

View File

@ -30,7 +30,7 @@ SampleSinkVector::SampleSinkVector(const SampleSinkVector& other) :
SampleSinkVector::~SampleSinkVector()
{}
void SampleSinkVector::write(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end)
void SampleSinkVector::write(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool signal)
{
if (end - begin > m_sampleVector.size()) {
m_sampleVector.resize(end - begin);
@ -40,8 +40,23 @@ void SampleSinkVector::write(const SampleVector::const_iterator& begin, const Sa
m_dataSize = end - begin;
// m_begin = begin;
// m_end = end;
if (signal) {
emit dataReady();
}
}
void SampleSinkVector::append(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool signal)
{
if ((end - begin) + m_dataSize > m_sampleVector.size()) {
m_sampleVector.resize((end - begin) + m_dataSize);
}
std::copy(begin, end, m_sampleVector.begin() + m_dataSize);
m_dataSize += (end - begin);
if (signal) {
emit dataReady();
}
}
void SampleSinkVector::read(SampleVector::iterator& begin, SampleVector::iterator& end)
{

View File

@ -31,7 +31,8 @@ public:
SampleSinkVector(const SampleSinkVector& other);
~SampleSinkVector();
void write(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
void write(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool signal = true);
void append(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool signal = false);
void read(SampleVector::iterator& begin, SampleVector::iterator& end);
signals: