mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
MIMO: base classes update
This commit is contained in:
parent
054298f3e1
commit
ec6645b6bb
@ -308,7 +308,7 @@ void DSPDeviceMIMOEngine::workSampleSourceFifos()
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<SampleVector::const_iterator> vbegin;
|
||||
std::vector<SampleVector::iterator> vbegin;
|
||||
vbegin.resize(sampleFifo->getNbStreams());
|
||||
unsigned int amount = sampleFifo->remainderSync();
|
||||
|
||||
@ -362,7 +362,7 @@ void DSPDeviceMIMOEngine::workSampleSourceFifo(unsigned int streamIndex)
|
||||
return;
|
||||
}
|
||||
|
||||
SampleVector::const_iterator begin;
|
||||
SampleVector::iterator begin;
|
||||
unsigned int amount = sampleFifo->remainderAsync(streamIndex);
|
||||
|
||||
while ((amount > 0) && (m_inputMessageQueue.size() == 0))
|
||||
@ -413,7 +413,7 @@ void DSPDeviceMIMOEngine::workSamplesSink(const SampleVector::const_iterator& vb
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::workSamplesSource(SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int streamIndex)
|
||||
void DSPDeviceMIMOEngine::workSamplesSource(SampleVector::iterator& begin, unsigned int nbSamples, unsigned int streamIndex)
|
||||
{
|
||||
if (m_threadedBasebandSampleSources[streamIndex].size() == 0)
|
||||
{
|
||||
|
@ -382,7 +382,7 @@ private:
|
||||
void workSamplesSink(const SampleVector::const_iterator& vbegin, const SampleVector::const_iterator& vend, unsigned int streamIndex);
|
||||
void workSampleSourceFifos(); //!< transfer samples of all source streams (sync mode)
|
||||
void workSampleSourceFifo(unsigned int streamIndex); //!< transfer samples of one source stream (async mode)
|
||||
void workSamplesSource(SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int streamIndex);
|
||||
void workSamplesSource(SampleVector::iterator& begin, unsigned int nbSamples, unsigned int streamIndex);
|
||||
|
||||
State gotoIdle(int subsystemIndex); //!< Go to the idle state
|
||||
State gotoInit(int subsystemIndex); //!< Go to the acquisition init state from idle
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
virtual void startSources() = 0;
|
||||
virtual void stopSources() = 0;
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex) = 0;
|
||||
virtual void pull(const SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) = 0;
|
||||
virtual void pull(const SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) = 0;
|
||||
virtual bool handleMessage(const Message& cmd) = 0; //!< Processing of a message. Returns true if message has actually been processed
|
||||
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
|
||||
|
@ -100,7 +100,7 @@ void SampleMOFifo::readSync(
|
||||
emit dataSyncRead();
|
||||
}
|
||||
|
||||
void SampleMOFifo::writeSync(const std::vector<SampleVector::const_iterator>& vbegin, unsigned int amount)
|
||||
void SampleMOFifo::writeSync(const std::vector<SampleVector::iterator>& vbegin, unsigned int amount)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
unsigned int spaceLeft = m_size - m_writeHead;
|
||||
@ -198,7 +198,7 @@ void SampleMOFifo::readAsync(
|
||||
emit dataAsyncRead(stream);
|
||||
}
|
||||
|
||||
void SampleMOFifo::writeAsync(const SampleVector::const_iterator& begin, unsigned int amount, unsigned int stream)
|
||||
void SampleMOFifo::writeAsync(const SampleVector::iterator& begin, unsigned int amount, unsigned int stream)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
unsigned int spaceLeft = m_size - m_vWriteHead[stream];
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
unsigned int& ipart1Begin, unsigned int& ipart1End, // first part offsets where to read
|
||||
unsigned int& ipart2Begin, unsigned int& ipart2End // second part offsets
|
||||
);
|
||||
void writeSync(const std::vector<SampleVector::const_iterator>& vbegin, unsigned int amount); //!< copy write
|
||||
void writeSync(const std::vector<SampleVector::iterator>& vbegin, unsigned int amount); //!< copy write
|
||||
void writeSync( //!< in place write
|
||||
unsigned int amount,
|
||||
unsigned int& ipart1Begin, unsigned int& ipart1End, // first part offsets where to write
|
||||
@ -52,7 +52,7 @@ public:
|
||||
unsigned int& ipart2Begin, unsigned int& ipart2End,
|
||||
unsigned int stream
|
||||
);
|
||||
void writeAsync(const SampleVector::const_iterator& begin, unsigned int amount, unsigned int stream); //!< copy write
|
||||
void writeAsync(const SampleVector::iterator& begin, unsigned int amount, unsigned int stream); //!< copy write
|
||||
void writeAsync( //!< in place write
|
||||
unsigned int amount,
|
||||
unsigned int& ipart1Begin, unsigned int& ipart1End,
|
||||
|
@ -138,18 +138,28 @@ void UpSampleChannelizer::applyConfiguration()
|
||||
<< ", fc=" << m_currentCenterFrequency;
|
||||
}
|
||||
|
||||
void UpSampleChannelizer::applySetting(unsigned int log2Interp, unsigned int filterChainHash)
|
||||
void UpSampleChannelizer::applyConfiguration(int requestedSampleRate, qint64 requestedCenterFrequency)
|
||||
{
|
||||
m_requestedInputSampleRate = requestedSampleRate;
|
||||
m_requestedCenterFrequency = requestedCenterFrequency;
|
||||
applyConfiguration();
|
||||
}
|
||||
|
||||
void UpSampleChannelizer::setOutputSampleRate(int outputSampleRate)
|
||||
{
|
||||
m_outputSampleRate = outputSampleRate;
|
||||
applyConfiguration();
|
||||
}
|
||||
|
||||
void UpSampleChannelizer::setInterpolation(unsigned int log2Interp, unsigned int filterChainHash)
|
||||
{
|
||||
m_filterChainSetMode = true;
|
||||
std::vector<unsigned int> stageIndexes;
|
||||
m_currentCenterFrequency = m_outputSampleRate * HBFilterChainConverter::convertToIndexes(log2Interp, filterChainHash, stageIndexes);
|
||||
m_requestedCenterFrequency = m_currentCenterFrequency;
|
||||
|
||||
m_mutex.lock();
|
||||
freeFilterChain();
|
||||
m_currentCenterFrequency = m_outputSampleRate * setFilterChain(stageIndexes);
|
||||
m_mutex.unlock();
|
||||
|
||||
m_currentInputSampleRate = m_outputSampleRate / (1 << m_filterStages.size());
|
||||
m_requestedInputSampleRate = m_currentInputSampleRate;
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#define SDRBASE_DSP_UPSAMPLECHANNELIZER_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <algorithm>
|
||||
|
||||
#include "export.h"
|
||||
@ -42,6 +41,10 @@ public:
|
||||
virtual void pull(SampleVector::iterator begin, unsigned int nbSamples);
|
||||
virtual void pullOne(Sample& sample);
|
||||
|
||||
void setInterpolation(unsigned int log2Interp, unsigned int filterChainHash); //!< Define channelizer with interpolation factor and filter chain definition
|
||||
void applyConfiguration(int requestedSampleRate, qint64 requestedCenterFrequency); //!< Define channelizer with requested sample rate and center frequency (shift in the baseband)
|
||||
void setOutputSampleRate(int outputSampleRate);
|
||||
|
||||
protected:
|
||||
struct FilterStage {
|
||||
enum Mode {
|
||||
@ -79,10 +82,8 @@ protected:
|
||||
int m_currentCenterFrequency;
|
||||
SampleVector m_sampleBuffer;
|
||||
Sample m_sampleIn;
|
||||
QMutex m_mutex;
|
||||
|
||||
void applyConfiguration();
|
||||
void applySetting(unsigned int log2Interp, unsigned int filterChainHash);
|
||||
bool signalContainsChannel(Real sigStart, Real sigEnd, Real chanStart, Real chanEnd) const;
|
||||
Real createFilterChain(Real sigStart, Real sigEnd, Real chanStart, Real chanEnd);
|
||||
double setFilterChain(const std::vector<unsigned int>& stageIndexes); //!< returns offset in ratio of sample rate
|
||||
|
Loading…
Reference in New Issue
Block a user