diff --git a/sdrbase/dsp/dspdevicemimoengine.cpp b/sdrbase/dsp/dspdevicemimoengine.cpp index e318c9f3d..72ebaf89d 100644 --- a/sdrbase/dsp/dspdevicemimoengine.cpp +++ b/sdrbase/dsp/dspdevicemimoengine.cpp @@ -308,7 +308,7 @@ void DSPDeviceMIMOEngine::workSampleSourceFifos() return; } - std::vector vbegin; + std::vector 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) { diff --git a/sdrbase/dsp/dspdevicemimoengine.h b/sdrbase/dsp/dspdevicemimoengine.h index a7026a1e1..b0e5afc20 100644 --- a/sdrbase/dsp/dspdevicemimoengine.h +++ b/sdrbase/dsp/dspdevicemimoengine.h @@ -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 diff --git a/sdrbase/dsp/mimochannel.h b/sdrbase/dsp/mimochannel.h index d1480bb32..d6d1082bf 100644 --- a/sdrbase/dsp/mimochannel.h +++ b/sdrbase/dsp/mimochannel.h @@ -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 diff --git a/sdrbase/dsp/samplemofifo.cpp b/sdrbase/dsp/samplemofifo.cpp index 3f33f4475..24046d81a 100644 --- a/sdrbase/dsp/samplemofifo.cpp +++ b/sdrbase/dsp/samplemofifo.cpp @@ -100,7 +100,7 @@ void SampleMOFifo::readSync( emit dataSyncRead(); } -void SampleMOFifo::writeSync(const std::vector& vbegin, unsigned int amount) +void SampleMOFifo::writeSync(const std::vector& 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]; diff --git a/sdrbase/dsp/samplemofifo.h b/sdrbase/dsp/samplemofifo.h index 0575343ca..7f0c950eb 100644 --- a/sdrbase/dsp/samplemofifo.h +++ b/sdrbase/dsp/samplemofifo.h @@ -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& vbegin, unsigned int amount); //!< copy write + void writeSync(const std::vector& 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, diff --git a/sdrbase/dsp/upsamplechannelizer.cpp b/sdrbase/dsp/upsamplechannelizer.cpp index 7a9f6ec04..0c2dbb25d 100644 --- a/sdrbase/dsp/upsamplechannelizer.cpp +++ b/sdrbase/dsp/upsamplechannelizer.cpp @@ -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 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; diff --git a/sdrbase/dsp/upsamplechannelizer.h b/sdrbase/dsp/upsamplechannelizer.h index d5c57261f..8f4727b62 100644 --- a/sdrbase/dsp/upsamplechannelizer.h +++ b/sdrbase/dsp/upsamplechannelizer.h @@ -20,7 +20,6 @@ #define SDRBASE_DSP_UPSAMPLECHANNELIZER_H_ #include -#include #include #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& stageIndexes); //!< returns offset in ratio of sample rate