1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-29 11:18:56 -05:00

Audio CAT SISO: implement real else complex indicator

This commit is contained in:
f4exb 2023-06-18 00:44:20 +02:00
parent 65bf00a573
commit 107583759f
7 changed files with 42 additions and 18 deletions

View File

@ -269,37 +269,43 @@ class SDRBASE_API DSPSignalNotification : public Message {
MESSAGE_CLASS_DECLARATION
public:
DSPSignalNotification(int samplerate, qint64 centerFrequency) :
DSPSignalNotification(int samplerate, qint64 centerFrequency, bool realElseComplex = false) :
Message(),
m_sampleRate(samplerate),
m_centerFrequency(centerFrequency)
m_centerFrequency(centerFrequency),
m_realElseComplex(realElseComplex)
{ }
int getSampleRate() const { return m_sampleRate; }
qint64 getCenterFrequency() const { return m_centerFrequency; }
bool getRealElseComplex() const { return m_realElseComplex; }
private:
int m_sampleRate;
qint64 m_centerFrequency;
bool m_realElseComplex;
};
class SDRBASE_API DSPMIMOSignalNotification : public Message {
MESSAGE_CLASS_DECLARATION
public:
DSPMIMOSignalNotification(int samplerate, qint64 centerFrequency, bool sourceOrSink, unsigned int index) :
DSPMIMOSignalNotification(int samplerate, qint64 centerFrequency, bool sourceOrSink, unsigned int index, bool realElseComplex = false) :
Message(),
m_sampleRate(samplerate),
m_centerFrequency(centerFrequency),
m_realElseComplex(realElseComplex),
m_sourceOrSink(sourceOrSink),
m_index(index)
{ }
int getSampleRate() const { return m_sampleRate; }
qint64 getCenterFrequency() const { return m_centerFrequency; }
bool getRealElseComplex() const { return m_realElseComplex; }
bool getSourceOrSink() const { return m_sourceOrSink; }
unsigned int getIndex() const { return m_index; }
private:
int m_sampleRate;
qint64 m_centerFrequency;
bool m_realElseComplex;
bool m_sourceOrSink;
unsigned int m_index;
};

View File

@ -399,7 +399,9 @@ void DSPDeviceMIMOEngine::workSampleSourceFifo(unsigned int streamIndex)
*/
void DSPDeviceMIMOEngine::workSamplesSink(const SampleVector::const_iterator& vbegin, const SampleVector::const_iterator& vend, unsigned int streamIndex)
{
bool positiveOnly = false;
std::map<int, bool>::const_iterator rcIt = m_rxRealElseComplex.find(streamIndex);
bool positiveOnly = (rcIt == m_rxRealElseComplex.end() ? false : rcIt->second);
// DC and IQ corrections
// if (m_sourcesCorrections[streamIndex].m_dcOffsetCorrection) {
// iqCorrections(vbegin, vend, streamIndex, m_sourcesCorrections[streamIndex].m_iqImbalanceCorrection);
@ -483,8 +485,11 @@ void DSPDeviceMIMOEngine::workSamplesSource(SampleVector& data, unsigned int iBe
}
// possibly feed data to spectrum sink
std::map<int, bool>::const_iterator rcIt = m_txRealElseComplex.find(streamIndex);
bool positiveOnly = (rcIt == m_txRealElseComplex.end() ? false : rcIt->second);
if ((m_spectrumSink) && (!m_spectrumInputSourceElseSink) && (streamIndex == m_spectrumInputIndex)) {
m_spectrumSink->feed(begin, begin + nbSamples, false);
m_spectrumSink->feed(begin, begin + nbSamples, positiveOnly);
}
}
@ -1173,12 +1178,20 @@ void DSPDeviceMIMOEngine::handleInputMessages()
unsigned int istream = notif->getIndex();
int sampleRate = notif->getSampleRate();
qint64 centerFrequency = notif->getCenterFrequency();
bool realElseComplex = notif->getRealElseComplex();
qDebug() << "DeviceMIMOEngine::handleInputMessages: DSPMIMOSignalNotification:"
<< " sourceElseSink: " << sourceElseSink
<< " istream: " << istream
<< " sampleRate: " << sampleRate
<< " centerFrequency: " << centerFrequency;
<< " centerFrequency: " << centerFrequency
<< " realElseComplex" << realElseComplex;
if (sourceElseSink) {
m_rxRealElseComplex[istream] = realElseComplex;
} else {
m_txRealElseComplex[istream] = realElseComplex;
}
for (MIMOChannels::const_iterator it = m_mimoChannels.begin(); it != m_mimoChannels.end(); ++it)
{

View File

@ -324,8 +324,10 @@ private:
typedef std::list<BasebandSampleSink*> BasebandSampleSinks;
std::vector<BasebandSampleSinks> m_basebandSampleSinks; //!< ancillary sample sinks on main thread (per input stream)
std::map<int, bool> m_rxRealElseComplex; //!< map of real else complex indicators for device sources (by input stream)
typedef std::list<BasebandSampleSource*> BasebandSampleSources;
std::vector<BasebandSampleSources> m_basebandSampleSources; //!< channel sample sources (per output stream)
std::map<int, bool> m_txRealElseComplex; //!< map of real else complex indicators for device sinks (by input stream)
std::vector<IncrementalVector<Sample>> m_sourceSampleBuffers;
std::vector<IncrementalVector<Sample>> m_sourceZeroBuffers;
unsigned int m_sumIndex; //!< channel index when summing channels

View File

@ -36,7 +36,8 @@ DSPDeviceSinkEngine::DSPDeviceSinkEngine(uint32_t uid, QObject* parent) :
m_basebandSampleSources(),
m_spectrumSink(nullptr),
m_sampleRate(0),
m_centerFrequency(0)
m_centerFrequency(0),
m_realElseComplex(false)
{
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
connect(&m_syncMessenger, SIGNAL(messageSent()), this, SLOT(handleSynchronousMessages()), Qt::QueuedConnection);
@ -242,7 +243,7 @@ void DSPDeviceSinkEngine::workSamples(SampleVector& data, unsigned int iBegin, u
// possibly feed data to spectrum sink
if (m_spectrumSink) {
m_spectrumSink->feed(data.begin() + iBegin, data.begin() + iEnd, false);
m_spectrumSink->feed(data.begin() + iBegin, data.begin() + iEnd, m_realElseComplex);
}
}
@ -515,10 +516,12 @@ void DSPDeviceSinkEngine::handleInputMessages()
m_sampleRate = notif->getSampleRate();
m_centerFrequency = notif->getCenterFrequency();
m_realElseComplex = notif->getRealElseComplex();
qDebug() << "DSPDeviceSinkEngine::handleInputMessages: DSPSignalNotification:"
<< " m_sampleRate: " << m_sampleRate
<< " m_centerFrequency: " << m_centerFrequency;
<< " m_centerFrequency: " << m_centerFrequency
<< " m_realElseComplex" << m_realElseComplex;
// forward source changes to sources with immediate execution

View File

@ -103,6 +103,7 @@ private:
uint32_t m_sampleRate;
quint64 m_centerFrequency;
bool m_realElseComplex;
unsigned int m_sumIndex; //!< channel index when summing channels
void run();

View File

@ -35,6 +35,7 @@ DSPDeviceSourceEngine::DSPDeviceSourceEngine(uint uid, QObject* parent) :
m_basebandSampleSinks(),
m_sampleRate(0),
m_centerFrequency(0),
m_realElseComplex(false),
m_dcOffsetCorrection(false),
m_iqImbalanceCorrection(false),
m_iOffset(0),
@ -320,7 +321,7 @@ void DSPDeviceSourceEngine::work()
{
SampleSinkFifo* sampleFifo = m_deviceSampleSource->getSampleFifo();
std::size_t samplesDone = 0;
bool positiveOnly = false;
bool positiveOnly = m_realElseComplex;
while ((sampleFifo->fill() > 0) && (m_inputMessageQueue.size() == 0) && (samplesDone < m_sampleRate))
{
@ -335,14 +336,12 @@ void DSPDeviceSourceEngine::work()
if (part1begin != part1end)
{
// correct stuff
if (m_dcOffsetCorrection)
{
if (m_dcOffsetCorrection) {
iqCorrections(part1begin, part1end, m_iqImbalanceCorrection);
}
// feed data to direct sinks
for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); ++it)
{
for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); ++it) {
(*it)->feed(part1begin, part1end, positiveOnly);
}
@ -352,14 +351,12 @@ void DSPDeviceSourceEngine::work()
if(part2begin != part2end)
{
// correct stuff
if (m_dcOffsetCorrection)
{
if (m_dcOffsetCorrection) {
iqCorrections(part2begin, part2end, m_iqImbalanceCorrection);
}
// feed data to direct sinks
for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++)
{
for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++) {
(*it)->feed(part2begin, part2end, positiveOnly);
}
@ -655,6 +652,7 @@ void DSPDeviceSourceEngine::handleInputMessages()
m_sampleRate = notif->getSampleRate();
m_centerFrequency = notif->getCenterFrequency();
m_realElseComplex = notif->getRealElseComplex();
qDebug() << "DSPDeviceSourceEngine::handleInputMessages: DSPSignalNotification:"
<< " m_sampleRate: " << m_sampleRate

View File

@ -92,6 +92,7 @@ private:
uint m_sampleRate;
quint64 m_centerFrequency;
bool m_realElseComplex;
bool m_dcOffsetCorrection;
bool m_iqImbalanceCorrection;