MIMO: adapt to sample source FIFO redesign and Tx code reorganization

This commit is contained in:
f4exb
2019-12-29 06:04:02 +01:00
parent 567c4b194d
commit 29f33435ad
18 changed files with 203 additions and 499 deletions
+7 -1
View File
@@ -48,7 +48,7 @@ TestMOSync::TestMOSync(DeviceAPI *deviceAPI) :
m_feedSpectrumIndex(0)
{
m_mimoType = MIMOHalfSynchronous;
m_sampleMOFifo.init(2, 4096*64);
m_sampleMOFifo.init(2, SampleMOFifo::getSizePolicy(m_settings.m_sampleRate));
m_deviceAPI->setNbSourceStreams(0);
m_deviceAPI->setNbSinkStreams(2);
}
@@ -254,6 +254,12 @@ bool TestMOSync::applySettings(const TestMOSyncSettings& settings, bool force)
forwardChangeTxDSP = true;
}
if ((m_settings.m_sampleRate != settings.m_sampleRate)
|| (m_settings.m_log2Interp != settings.m_log2Interp) || force)
{
m_sampleMOFifo.resize(SampleMOFifo::getSizePolicy(m_settings.m_sampleRate));
}
if ((m_settings.m_sampleRate != settings.m_sampleRate) || force)
{
if (m_sinkThread) {
@@ -19,7 +19,6 @@
#include "testmosyncsettings.h"
const unsigned int TestMOSyncSettings::m_msThrottle = 50U;
const unsigned int TestMOSyncSettings::m_blockSize = 16384U;
TestMOSyncSettings::TestMOSyncSettings()
{
@@ -33,7 +33,6 @@ struct TestMOSyncSettings {
fcPos_t m_fcPosTx;
static const unsigned int m_msThrottle;
static const unsigned int m_blockSize;
TestMOSyncSettings();
void resetToDefaults();
@@ -27,16 +27,17 @@
TestMOSyncThread::TestMOSyncThread(QObject* parent) :
QThread(parent),
m_running(false),
m_buf(nullptr),
m_log2Interp(0),
m_throttlems(TestMOSyncSettings::m_msThrottle),
m_throttleToggle(false),
m_blockSize(TestMOSyncSettings::m_blockSize),
m_samplesRemainder(0),
m_samplerate(0),
m_feedSpectrumIndex(0),
m_spectrumSink(nullptr)
{
qDebug("TestMOSyncThread::TestMOSyncThread");
m_buf = new qint16[2*m_blockSize*2];
setSamplerate(48000);
}
TestMOSyncThread::~TestMOSyncThread()
@@ -52,6 +53,7 @@ TestMOSyncThread::~TestMOSyncThread()
void TestMOSyncThread::startWork()
{
qDebug("TestMOSyncThread::startWork");
m_startWaitMutex.lock();
m_elapsedTimer.start();
start();
@@ -65,6 +67,7 @@ void TestMOSyncThread::startWork()
void TestMOSyncThread::stopWork()
{
qDebug("TestMOSyncThread::stopWork");
m_running = false;
wait();
}
@@ -107,7 +110,11 @@ void TestMOSyncThread::setSamplerate(int samplerate)
m_samplerate = samplerate;
m_samplesChunkSize = (m_samplerate * m_throttlems) / 1000;
m_blockSize = (m_samplerate * 50) / 1000;
delete[] m_buf;
if (m_buf) {
delete[] m_buf;
}
m_buf = new qint16[2*m_blockSize*2];
if (wasRunning) {
@@ -181,7 +188,14 @@ void TestMOSyncThread::callbackPart(qint16* buf, qint32 nSamples, int iBegin)
{
for (unsigned int channel = 0; channel < 2; channel++)
{
qDebug("TestMOSyncThread::callbackPart: nSamples: %d channel: %u", nSamples, channel);
SampleVector::iterator begin = m_sampleFifo->getData(channel).begin() + iBegin;
// m_testVector.allocate(nSamples/(1<<m_log2Interp), Sample{16384, 0});
// std::copy(
// m_testVector.m_vector.begin(),
// m_testVector.m_vector.begin() + nSamples/(1<<m_log2Interp),
// begin
// );
if (m_log2Interp == 0)
{
@@ -289,6 +303,7 @@ void TestMOSyncThread::tick()
}
int chunkSize = std::min((int) m_samplesChunkSize, m_samplerate) + m_samplesRemainder;
qDebug("TestMOSyncThread::tick: chunkSize: %d m_samplesRemainder: %u m_blockSize: %u",chunkSize, m_samplesRemainder, m_blockSize);
while (chunkSize >= m_blockSize)
{
@@ -306,6 +321,7 @@ void TestMOSyncThread::feedSpectrum(int16_t *buf, unsigned int bufSize)
return;
}
qDebug("TestMOSyncThread::feedSpectrum: bufSize: %u", bufSize);
m_samplesVector.allocate(bufSize/2);
Sample16 *s16Buf = (Sample16*) buf;
@@ -84,6 +84,7 @@ private:
unsigned int m_feedSpectrumIndex;
BasebandSampleSink* m_spectrumSink;
IncrementalVector<Sample> m_samplesVector;
IncrementalVector<Sample> m_testVector;
void run();
unsigned int getNbFifos();