mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 01:18:38 -05:00
IQ swap: initial implementation in plugins
This commit is contained in:
parent
9508e8b88a
commit
cc5d614f67
@ -50,8 +50,8 @@ const qint64 AirspyInput::loHighLimitFreq = 1900000000L;
|
||||
AirspyInput::AirspyInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_dev(0),
|
||||
m_airspyThread(0),
|
||||
m_dev(nullptr),
|
||||
m_airspyThread(nullptr),
|
||||
m_deviceDescription("Airspy"),
|
||||
m_running(false)
|
||||
{
|
||||
@ -181,6 +181,7 @@ bool AirspyInput::start()
|
||||
m_airspyThread = new AirspyThread(m_dev, &m_sampleFifo);
|
||||
m_airspyThread->setSamplerate(m_sampleRates[m_settings.m_devSampleRateIndex]);
|
||||
m_airspyThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_airspyThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_airspyThread->setFcPos((int) m_settings.m_fcPos);
|
||||
|
||||
m_airspyThread->startWork();
|
||||
@ -213,11 +214,11 @@ void AirspyInput::stop()
|
||||
qDebug("AirspyInput::stop");
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_airspyThread != 0)
|
||||
if (m_airspyThread)
|
||||
{
|
||||
m_airspyThread->stopWork();
|
||||
delete m_airspyThread;
|
||||
m_airspyThread = 0;
|
||||
m_airspyThread = nullptr;
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
@ -401,7 +402,7 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
{
|
||||
qCritical("AirspyInput::applySettings: could not set sample rate index %u (%d S/s): %s", settings.m_devSampleRateIndex, m_sampleRates[settings.m_devSampleRateIndex], airspy_error_name(rc));
|
||||
}
|
||||
else if (m_airspyThread != 0)
|
||||
else if (m_airspyThread)
|
||||
{
|
||||
qDebug("AirspyInput::applySettings: sample rate set to index: %u (%d S/s)", settings.m_devSampleRateIndex, m_sampleRates[settings.m_devSampleRateIndex]);
|
||||
m_airspyThread->setSamplerate(m_sampleRates[settings.m_devSampleRateIndex]);
|
||||
@ -414,13 +415,22 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_airspyThread != 0)
|
||||
if (m_airspyThread)
|
||||
{
|
||||
m_airspyThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug() << "AirspyInput: set decimation to " << (1<<settings.m_log2Decim);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_airspyThread) {
|
||||
m_airspyThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
@ -462,7 +472,7 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
{
|
||||
if (m_airspyThread != 0)
|
||||
if (m_airspyThread)
|
||||
{
|
||||
m_airspyThread->setFcPos((int) settings.m_fcPos);
|
||||
qDebug() << "AirspyInput: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
|
@ -41,6 +41,7 @@ void AirspySettings::resetToDefaults()
|
||||
m_iqCorrection = false;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
@ -70,6 +71,7 @@ QByteArray AirspySettings::serialize() const
|
||||
s.writeString(16, m_reverseAPIAddress);
|
||||
s.writeU32(17, m_reverseAPIPort);
|
||||
s.writeU32(18, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(19, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -116,6 +118,7 @@ bool AirspySettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(18, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(19, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ struct AirspySettings {
|
||||
bool m_iqCorrection;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
@ -33,7 +33,8 @@ AirspyThread::AirspyThread(struct airspy_device* dev, SampleSinkFifo* sampleFifo
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_samplerate(10),
|
||||
m_log2Decim(0),
|
||||
m_fcPos(0)
|
||||
m_fcPos(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
m_this = this;
|
||||
std::fill(m_buf, m_buf + 2*AIRSPY_BLOCKSIZE, 0);
|
||||
@ -112,13 +113,13 @@ void AirspyThread::run()
|
||||
}
|
||||
|
||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||
void AirspyThread::callback(const qint16* buf, qint32 len)
|
||||
void AirspyThread::callbackIQ(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, buf, len);
|
||||
m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -127,22 +128,22 @@ void AirspyThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -153,22 +154,22 @@ void AirspyThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -179,22 +180,22 @@ void AirspyThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -205,10 +206,108 @@ void AirspyThread::callback(const qint16* buf, qint32 len)
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void AirspyThread::callbackQI(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimatorsQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
int AirspyThread::rx_callback(airspy_transfer_t* transfer)
|
||||
{
|
||||
qint32 bytes_to_write = transfer->sample_count * sizeof(qint16);
|
||||
m_this->callback((qint16 *) transfer->samples, bytes_to_write);
|
||||
return 0;
|
||||
|
||||
if (m_this->m_iqOrder) {
|
||||
m_this->callbackIQ((qint16 *) transfer->samples, bytes_to_write);
|
||||
} else {
|
||||
m_this->callbackQI((qint16 *) transfer->samples, bytes_to_write);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
void setSamplerate(uint32_t samplerate);
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -54,12 +55,15 @@ private:
|
||||
int m_samplerate;
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
bool m_iqOrder;
|
||||
static AirspyThread *m_this;
|
||||
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
void callbackIQ(const qint16* buf, qint32 len);
|
||||
void callbackQI(const qint16* buf, qint32 len);
|
||||
static int rx_callback(airspy_transfer_t* transfer);
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ AirspyHFInput::AirspyHFInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_dev(0),
|
||||
m_airspyHFThread(0),
|
||||
m_airspyHFThread(nullptr),
|
||||
m_deviceDescription("AirspyHF"),
|
||||
m_running(false)
|
||||
{
|
||||
@ -181,6 +181,7 @@ bool AirspyHFInput::start()
|
||||
}
|
||||
|
||||
m_airspyHFThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_airspyHFThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_airspyHFThread->startWork();
|
||||
|
||||
mutexLocker.unlock();
|
||||
@ -210,11 +211,11 @@ void AirspyHFInput::stop()
|
||||
qDebug("AirspyHFInput::stop");
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_airspyHFThread != 0)
|
||||
if (m_airspyHFThread)
|
||||
{
|
||||
m_airspyHFThread->stopWork();
|
||||
delete m_airspyHFThread;
|
||||
m_airspyHFThread = 0;
|
||||
m_airspyHFThread = nullptr;
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
@ -445,7 +446,7 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
{
|
||||
qCritical("AirspyHFInput::applySettings: could not set sample rate index %u (%d S/s)", sampleRateIndex, m_sampleRates[sampleRateIndex]);
|
||||
}
|
||||
else if (m_airspyHFThread != 0)
|
||||
else if (m_airspyHFThread)
|
||||
{
|
||||
qDebug("AirspyHFInput::applySettings: sample rate set to index: %u (%d S/s)", sampleRateIndex, m_sampleRates[sampleRateIndex]);
|
||||
m_airspyHFThread->setSamplerate(m_sampleRates[sampleRateIndex]);
|
||||
@ -458,13 +459,22 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_airspyHFThread != 0)
|
||||
if (m_airspyHFThread)
|
||||
{
|
||||
m_airspyHFThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug() << "AirspyInput: set decimation to " << (1<<settings.m_log2Decim);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_airspyHFThread) {
|
||||
m_airspyHFThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
|
||||
{
|
||||
reverseAPIKeys.append("LOppmTenths");
|
||||
@ -477,7 +487,7 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
||||
{
|
||||
qCritical("AirspyHFInput::applySettings: could not set LO ppm correction to %f", settings.m_LOppmTenths / 10.0f);
|
||||
}
|
||||
else if (m_airspyHFThread != 0)
|
||||
else if (m_airspyHFThread)
|
||||
{
|
||||
qDebug("AirspyHFInput::applySettings: LO ppm correction set to %f", settings.m_LOppmTenths / 10.0f);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ void AirspyHFSettings::resetToDefaults()
|
||||
m_log2Decim = 0;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_bandIndex = 0;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
@ -69,6 +70,7 @@ QByteArray AirspyHFSettings::serialize() const
|
||||
s.writeU32(18, m_attenuatorSteps);
|
||||
s.writeBool(19, m_dcBlock);
|
||||
s.writeBool(20, m_iqCorrection);
|
||||
s.writeBool(21, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -115,6 +117,7 @@ bool AirspyHFSettings::deserialize(const QByteArray& data)
|
||||
d.readU32(18, &m_attenuatorSteps, 0);
|
||||
d.readBool(19, &m_dcBlock, false);
|
||||
d.readBool(20, &m_iqCorrection, false);
|
||||
d.readBool(21, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ struct AirspyHFSettings
|
||||
quint32 m_log2Decim;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
quint32 m_bandIndex;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
|
@ -31,7 +31,8 @@ AirspyHFThread::AirspyHFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFif
|
||||
m_convertBuffer(AIRSPYHF_BLOCKSIZE),
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_samplerate(10),
|
||||
m_log2Decim(0)
|
||||
m_log2Decim(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
memset((char*) m_buf, 0, 2*AIRSPYHF_BLOCKSIZE*sizeof(qint16));
|
||||
m_this = this;
|
||||
@ -102,32 +103,32 @@ void AirspyHFThread::run()
|
||||
}
|
||||
|
||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||
void AirspyHFThread::callback(const float* buf, qint32 len)
|
||||
void AirspyHFThread::callbackIQ(const float* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 0:
|
||||
m_decimators.decimate1(&it, buf, len);
|
||||
m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
break;
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -136,10 +137,49 @@ void AirspyHFThread::callback(const float* buf, qint32 len)
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void AirspyHFThread::callbackQI(const float* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 0:
|
||||
m_decimatorsQI.decimate1(&it, buf, len);
|
||||
break;
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
int AirspyHFThread::rx_callback(airspyhf_transfer_t* transfer)
|
||||
{
|
||||
qint32 nbIAndQ = transfer->sample_count * 2;
|
||||
m_this->callback((float *) transfer->samples, nbIAndQ);
|
||||
return 0;
|
||||
|
||||
if (m_this->m_iqOrder) {
|
||||
m_this->callbackIQ((float *) transfer->samples, nbIAndQ);
|
||||
} else {
|
||||
m_this->callbackQI((float *) transfer->samples, nbIAndQ);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
void stopWork();
|
||||
void setSamplerate(uint32_t samplerate);
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -52,12 +53,15 @@ private:
|
||||
|
||||
int m_samplerate;
|
||||
unsigned int m_log2Decim;
|
||||
bool m_iqOrder;
|
||||
static AirspyHFThread *m_this;
|
||||
|
||||
DecimatorsFI m_decimators;
|
||||
DecimatorsFI<true> m_decimatorsIQ;
|
||||
DecimatorsFI<false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void callback(const float* buf, qint32 len);
|
||||
void callbackIQ(const float* buf, qint32 len);
|
||||
void callbackQI(const float* buf, qint32 len);
|
||||
static int rx_callback(airspyhf_transfer_t* transfer);
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@ Bladerf1Input::Bladerf1Input(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_dev(0),
|
||||
m_bladerfThread(0),
|
||||
m_bladerfThread(nullptr),
|
||||
m_deviceDescription("BladeRFInput"),
|
||||
m_running(false)
|
||||
{
|
||||
@ -163,6 +163,7 @@ bool Bladerf1Input::start()
|
||||
m_bladerfThread = new Bladerf1InputThread(m_dev, &m_sampleFifo);
|
||||
m_bladerfThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_bladerfThread->setFcPos((int) m_settings.m_fcPos);
|
||||
m_bladerfThread->setIQOrder(m_settings.m_iqOrder);
|
||||
|
||||
m_bladerfThread->startWork();
|
||||
|
||||
@ -206,11 +207,11 @@ void Bladerf1Input::stop()
|
||||
{
|
||||
// QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if(m_bladerfThread != 0)
|
||||
if(m_bladerfThread)
|
||||
{
|
||||
m_bladerfThread->stopWork();
|
||||
delete m_bladerfThread;
|
||||
m_bladerfThread = 0;
|
||||
m_bladerfThread = nullptr;
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
@ -514,7 +515,7 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
|
||||
{
|
||||
reverseAPIKeys.append("fcPos");
|
||||
|
||||
if (m_bladerfThread != 0)
|
||||
if (m_bladerfThread)
|
||||
{
|
||||
m_bladerfThread->setFcPos((int) settings.m_fcPos);
|
||||
qDebug() << "BladerfInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
@ -526,13 +527,22 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_bladerfThread != 0)
|
||||
if (m_bladerfThread)
|
||||
{
|
||||
m_bladerfThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug() << "BladerfInput::applySettings: set decimation to " << (1<<settings.m_log2Decim);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_bladerfThread) {
|
||||
m_bladerfThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ void BladeRF1InputSettings::resetToDefaults()
|
||||
m_xb200Filter = BLADERF_XB200_AUTO_1DB;
|
||||
m_dcBlock = false;
|
||||
m_iqCorrection = false;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
@ -68,6 +69,7 @@ QByteArray BladeRF1InputSettings::serialize() const
|
||||
s.writeString(14, m_reverseAPIAddress);
|
||||
s.writeU32(15, m_reverseAPIPort);
|
||||
s.writeU32(16, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(17, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -114,6 +116,7 @@ bool BladeRF1InputSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(16, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(17, &m_iqOrder);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ struct BladeRF1InputSettings {
|
||||
bladerf_xb200_filter m_xb200Filter;
|
||||
bool m_dcBlock;
|
||||
bool m_iqCorrection;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
@ -31,7 +31,8 @@ Bladerf1InputThread::Bladerf1InputThread(struct bladerf* dev, SampleSinkFifo* sa
|
||||
m_convertBuffer(BLADERF_BLOCKSIZE),
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_log2Decim(0),
|
||||
m_fcPos(0)
|
||||
m_fcPos(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
std::fill(m_buf, m_buf + 2*BLADERF_BLOCKSIZE, 0);
|
||||
}
|
||||
@ -79,20 +80,24 @@ void Bladerf1InputThread::run()
|
||||
break;
|
||||
}
|
||||
|
||||
callback(m_buf, 2 * BLADERF_BLOCKSIZE);
|
||||
if (m_iqOrder) {
|
||||
callbackIQ(m_buf, 2 * BLADERF_BLOCKSIZE);
|
||||
} else {
|
||||
callbackQI(m_buf, 2 * BLADERF_BLOCKSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||
void Bladerf1InputThread::callback(const qint16* buf, qint32 len)
|
||||
void Bladerf1InputThread::callbackIQ(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, buf, len);
|
||||
m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -101,22 +106,22 @@ void Bladerf1InputThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -127,22 +132,22 @@ void Bladerf1InputThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -153,22 +158,116 @@ void Bladerf1InputThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void Bladerf1InputThread::callbackQI(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimatorsQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
void stopWork();
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -51,11 +52,14 @@ private:
|
||||
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
bool m_iqOrder;
|
||||
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
void callbackIQ(const qint16* buf, qint32 len);
|
||||
void callbackQI(const qint16* buf, qint32 len);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_BLADERFINPUTTHREAD_H
|
||||
|
@ -50,7 +50,7 @@ BladeRF2Input::BladeRF2Input(DeviceAPI *deviceAPI) :
|
||||
m_settings(),
|
||||
m_deviceDescription("BladeRF2Input"),
|
||||
m_running(false),
|
||||
m_thread(0)
|
||||
m_thread(nullptr)
|
||||
{
|
||||
openDevice();
|
||||
|
||||
@ -209,7 +209,7 @@ void BladeRF2Input::init()
|
||||
|
||||
BladeRF2InputThread *BladeRF2Input::findThread()
|
||||
{
|
||||
if (m_thread == 0) // this does not own the thread
|
||||
if (!m_thread) // this does not own the thread
|
||||
{
|
||||
BladeRF2InputThread *bladerf2InputThread = 0;
|
||||
|
||||
@ -251,7 +251,7 @@ void BladeRF2Input::moveThreadToBuddy()
|
||||
if (buddySource)
|
||||
{
|
||||
buddySource->setThread(m_thread);
|
||||
m_thread = 0; // zero for others
|
||||
m_thread = nullptr; // zero for others
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -323,6 +323,7 @@ bool BladeRF2Input::start()
|
||||
delete bladerf2InputThread;
|
||||
bladerf2InputThread = new BladeRF2InputThread(m_deviceShared.m_dev->getDev(), requestedChannel+1);
|
||||
m_thread = bladerf2InputThread; // take ownership
|
||||
bladerf2InputThread->setIQOrder(m_settings.m_iqOrder);
|
||||
|
||||
for (int i = 0; i < nbOriginalChannels; i++) // restore original FIFO references
|
||||
{
|
||||
@ -423,7 +424,7 @@ void BladeRF2Input::stop()
|
||||
qDebug("BladeRF2Input::stop: SI mode. Just stop and delete the thread");
|
||||
bladerf2InputThread->stopWork();
|
||||
delete bladerf2InputThread;
|
||||
m_thread = 0;
|
||||
m_thread = nullptr;
|
||||
|
||||
// remove old thread address from buddies (reset in all buddies)
|
||||
const std::vector<DeviceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||
@ -453,7 +454,7 @@ void BladeRF2Input::stop()
|
||||
}
|
||||
|
||||
delete bladerf2InputThread;
|
||||
m_thread = 0;
|
||||
m_thread = nullptr;
|
||||
|
||||
if (stillActiveFIFO)
|
||||
{
|
||||
@ -844,7 +845,7 @@ bool BladeRF2Input::applySettings(const BladeRF2InputSettings& settings, bool fo
|
||||
reverseAPIKeys.append("fcPos");
|
||||
BladeRF2InputThread *inputThread = findThread();
|
||||
|
||||
if (inputThread != 0)
|
||||
if (inputThread)
|
||||
{
|
||||
inputThread->setFcPos(requestedChannel, (int) settings.m_fcPos);
|
||||
qDebug() << "BladeRF2Input::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
@ -857,13 +858,23 @@ bool BladeRF2Input::applySettings(const BladeRF2InputSettings& settings, bool fo
|
||||
forwardChangeOwnDSP = true;
|
||||
BladeRF2InputThread *inputThread = findThread();
|
||||
|
||||
if (inputThread != 0)
|
||||
if (inputThread)
|
||||
{
|
||||
inputThread->setLog2Decimation(requestedChannel, settings.m_log2Decim);
|
||||
qDebug() << "BladeRF2Input::applySettings: set decimation to " << (1<<settings.m_log2Decim);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
BladeRF2InputThread *inputThread = findThread();
|
||||
|
||||
if (inputThread) {
|
||||
inputThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ void BladeRF2InputSettings::resetToDefaults()
|
||||
m_iqCorrection = false;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
@ -66,6 +67,7 @@ QByteArray BladeRF2InputSettings::serialize() const
|
||||
s.writeString(14, m_reverseAPIAddress);
|
||||
s.writeU32(15, m_reverseAPIPort);
|
||||
s.writeU32(16, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(17, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -110,6 +112,7 @@ bool BladeRF2InputSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(16, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(17, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ struct BladeRF2InputSettings {
|
||||
bool m_iqCorrection;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
@ -23,7 +23,8 @@ BladeRF2InputThread::BladeRF2InputThread(struct bladerf* dev, unsigned int nbRxC
|
||||
QThread(parent),
|
||||
m_running(false),
|
||||
m_dev(dev),
|
||||
m_nbChannels(nbRxChannels)
|
||||
m_nbChannels(nbRxChannels),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
qDebug("BladeRF2InputThread::BladeRF2InputThread");
|
||||
m_channels = new Channel[nbRxChannels];
|
||||
@ -105,10 +106,17 @@ void BladeRF2InputThread::run()
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_nbChannels > 1) {
|
||||
if (m_nbChannels > 1)
|
||||
{
|
||||
callbackMI(m_buf, DeviceBladeRF2::blockSize);
|
||||
} else {
|
||||
callbackSI(m_buf, 2*DeviceBladeRF2::blockSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_iqOrder) {
|
||||
callbackSIIQ(m_buf, 2*DeviceBladeRF2::blockSize);
|
||||
} else {
|
||||
callbackSIQI(m_buf, 2*DeviceBladeRF2::blockSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
qDebug("BladeRF2InputThread::run: stop running loop");
|
||||
@ -198,19 +206,24 @@ void BladeRF2InputThread::callbackMI(const qint16* buf, qint32 samplesPerChannel
|
||||
|
||||
for (unsigned int channel = 0; channel < m_nbChannels; channel++)
|
||||
{
|
||||
if (m_channels[channel].m_sampleFifo) {
|
||||
callbackSI(&buf[2*samplesPerChannel*channel], 2*samplesPerChannel, channel);
|
||||
if (m_channels[channel].m_sampleFifo)
|
||||
{
|
||||
if (m_iqOrder) {
|
||||
callbackSIIQ(&buf[2*samplesPerChannel*channel], 2*samplesPerChannel, channel);
|
||||
} else {
|
||||
callbackSIQI(&buf[2*samplesPerChannel*channel], 2*samplesPerChannel, channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BladeRF2InputThread::callbackSI(const qint16* buf, qint32 len, unsigned int channel)
|
||||
void BladeRF2InputThread::callbackSIIQ(const qint16* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimators.decimate1(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -219,22 +232,22 @@ void BladeRF2InputThread::callbackSI(const qint16* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators.decimate2_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators.decimate4_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators.decimate8_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators.decimate16_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators.decimate32_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators.decimate64_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -245,22 +258,22 @@ void BladeRF2InputThread::callbackSI(const qint16* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators.decimate2_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators.decimate4_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators.decimate8_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators.decimate16_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators.decimate32_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators.decimate64_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -271,22 +284,22 @@ void BladeRF2InputThread::callbackSI(const qint16* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -297,3 +310,95 @@ void BladeRF2InputThread::callbackSI(const qint16* buf, qint32 len, unsigned int
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void BladeRF2InputThread::callbackSIQI(const qint16* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimatorsQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_channels[channel].m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsQI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsQI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsQI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsQI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsQI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsQI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsQI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsQI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsQI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsQI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsQI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsQI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
int getFcPos(unsigned int channel) const;
|
||||
void setFifo(unsigned int channel, SampleSinkFifo *sampleFifo);
|
||||
SampleSinkFifo *getFifo(unsigned int channel);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
struct Channel
|
||||
@ -59,7 +60,8 @@ private:
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
||||
|
||||
Channel() :
|
||||
m_sampleFifo(0),
|
||||
@ -79,10 +81,12 @@ private:
|
||||
Channel *m_channels; //!< Array of channels dynamically allocated for the given number of Rx channels
|
||||
qint16 *m_buf; //!< Full buffer for SISO or MIMO operation
|
||||
unsigned int m_nbChannels;
|
||||
bool m_iqOrder;
|
||||
|
||||
void run();
|
||||
unsigned int getNbFifos();
|
||||
void callbackSI(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSIIQ(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSIQI(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackMI(const qint16* buf, qint32 samplesPerChannel);
|
||||
};
|
||||
|
||||
|
@ -45,7 +45,7 @@ FCDProInput::FCDProInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_dev(0),
|
||||
m_settings(),
|
||||
m_FCDThread(0),
|
||||
m_FCDThread(nullptr),
|
||||
m_deviceDescription(fcd_traits<Pro>::displayedName),
|
||||
m_running(false)
|
||||
{
|
||||
@ -138,6 +138,9 @@ bool FCDProInput::start()
|
||||
}
|
||||
|
||||
m_FCDThread = new FCDProThread(&m_sampleFifo, &m_fcdFIFO);
|
||||
m_FCDThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_FCDThread->setFcPos(m_settings.m_fcPos);
|
||||
m_FCDThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_FCDThread->startWork();
|
||||
|
||||
// mutexLocker.unlock();
|
||||
@ -374,7 +377,7 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_FCDThread != 0)
|
||||
if (m_FCDThread)
|
||||
{
|
||||
m_FCDThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug() << "FCDProInput::applySettings: set decimation to " << (1<<settings.m_log2Decim);
|
||||
@ -385,13 +388,24 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
|
||||
{
|
||||
reverseAPIKeys.append("fcPos");
|
||||
|
||||
if (m_FCDThread != 0) {
|
||||
if (m_FCDThread) {
|
||||
m_FCDThread->setFcPos((int) settings.m_fcPos);
|
||||
}
|
||||
|
||||
qDebug() << "FCDProInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_FCDThread) {
|
||||
m_FCDThread->setIQOrder((int) settings.m_iqOrder);
|
||||
}
|
||||
|
||||
qDebug() << "FCDProInput::applySettings: set IQ order to %s" << (settings.m_iqOrder ? "IQ" : "QI");
|
||||
}
|
||||
|
||||
if ((m_settings.m_lnaGainIndex != settings.m_lnaGainIndex) || force)
|
||||
{
|
||||
reverseAPIKeys.append("lnaGainIndex");
|
||||
|
@ -50,6 +50,7 @@ void FCDProSettings::resetToDefaults()
|
||||
m_fcPos = FC_POS_CENTER;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
@ -88,6 +89,7 @@ QByteArray FCDProSettings::serialize() const
|
||||
s.writeString(25, m_reverseAPIAddress);
|
||||
s.writeU32(26, m_reverseAPIPort);
|
||||
s.writeU32(27, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(28, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -143,6 +145,7 @@ bool FCDProSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(27, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(28, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ struct FCDProSettings {
|
||||
bool m_iqCorrection;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
@ -34,7 +34,8 @@ FCDProThread::FCDProThread(SampleSinkFifo* sampleFifo, AudioFifo *fcdFIFO, QObje
|
||||
m_log2Decim(0),
|
||||
m_fcPos(2),
|
||||
m_convertBuffer(fcd_traits<Pro>::convBufSize), // nb samples
|
||||
m_sampleFifo(sampleFifo)
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
start();
|
||||
}
|
||||
@ -80,7 +81,12 @@ void FCDProThread::run()
|
||||
|
||||
while (m_running)
|
||||
{
|
||||
work(fcd_traits<Pro>::convBufSize);
|
||||
if (m_iqOrder) {
|
||||
workIQ(fcd_traits<Pro>::convBufSize);
|
||||
} else {
|
||||
workQI(fcd_traits<Pro>::convBufSize);
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(200));
|
||||
}
|
||||
|
||||
@ -88,14 +94,14 @@ void FCDProThread::run()
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
void FCDProThread::work(unsigned int n_items)
|
||||
void FCDProThread::workIQ(unsigned int n_items)
|
||||
{
|
||||
uint32_t nbRead = m_fcdFIFO->read((unsigned char *) m_buf, n_items); // number of samples
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate1(&it, m_buf, 2*nbRead);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,22 +110,22 @@ void FCDProThread::work(unsigned int n_items)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate2_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate4_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate8_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate16_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate32_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate64_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -130,22 +136,22 @@ void FCDProThread::work(unsigned int n_items)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate2_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate4_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate8_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate16_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate32_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate64_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -156,22 +162,116 @@ void FCDProThread::work(unsigned int n_items)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate2_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate4_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate8_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate16_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate32_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate64_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void FCDProThread::workQI(unsigned int n_items)
|
||||
{
|
||||
uint32_t nbRead = m_fcdFIFO->read((unsigned char *) m_buf, n_items); // number of samples
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimatorsQI.decimate1(&it, m_buf, 2*nbRead);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infradyne
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supradyne
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // Centered
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
void stopWork();
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
AudioFifo* m_fcdFIFO;
|
||||
@ -48,14 +49,18 @@ private:
|
||||
bool m_running;
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
bool m_iqOrder;
|
||||
|
||||
qint16 m_buf[fcd_traits<Pro>::convBufSize*2]; // stereo (I, Q)
|
||||
SampleVector m_convertBuffer;
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, false> m_decimatorsQI;
|
||||
|
||||
|
||||
void run();
|
||||
void work(unsigned int n_items);
|
||||
void workIQ(unsigned int n_items);
|
||||
void workQI(unsigned int n_items);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_FCDPROTHREAD_H
|
||||
|
@ -45,7 +45,7 @@ FCDProPlusInput::FCDProPlusInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_dev(0),
|
||||
m_settings(),
|
||||
m_FCDThread(0),
|
||||
m_FCDThread(nullptr),
|
||||
m_deviceDescription(fcd_traits<ProPlus>::displayedName),
|
||||
m_running(false)
|
||||
{
|
||||
@ -140,6 +140,9 @@ bool FCDProPlusInput::start()
|
||||
}
|
||||
|
||||
m_FCDThread = new FCDProPlusThread(&m_sampleFifo, &m_fcdFIFO);
|
||||
m_FCDThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_FCDThread->setFcPos(m_settings.m_fcPos);
|
||||
m_FCDThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_FCDThread->startWork();
|
||||
|
||||
// mutexLocker.unlock();
|
||||
@ -375,7 +378,7 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_FCDThread != 0)
|
||||
if (m_FCDThread)
|
||||
{
|
||||
m_FCDThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug() << "FCDProPlusInput::applySettings: set decimation to " << (1<<settings.m_log2Decim);
|
||||
@ -386,13 +389,24 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for
|
||||
{
|
||||
reverseAPIKeys.append("fcPos");
|
||||
|
||||
if (m_FCDThread != 0) {
|
||||
if (m_FCDThread) {
|
||||
m_FCDThread->setFcPos((int) settings.m_fcPos);
|
||||
}
|
||||
|
||||
qDebug() << "FCDProPlusInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_FCDThread) {
|
||||
m_FCDThread->setIQOrder((int) settings.m_iqOrder);
|
||||
}
|
||||
|
||||
qDebug() << "FCDProPlusInput::applySettings: set IQ order to %s" << (settings.m_iqOrder ? "IQ" : "QI");
|
||||
}
|
||||
|
||||
if ((m_settings.m_lnaGain != settings.m_lnaGain) || force)
|
||||
{
|
||||
reverseAPIKeys.append("lnaGain");
|
||||
|
@ -41,6 +41,7 @@ void FCDProPlusSettings::resetToDefaults()
|
||||
m_iqImbalance = false;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
@ -69,6 +70,7 @@ QByteArray FCDProPlusSettings::serialize() const
|
||||
s.writeString(15, m_reverseAPIAddress);
|
||||
s.writeU32(16, m_reverseAPIPort);
|
||||
s.writeU32(17, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(18, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -114,6 +116,8 @@ bool FCDProPlusSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(17, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(18, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -42,6 +42,7 @@ struct FCDProPlusSettings {
|
||||
bool m_iqImbalance;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
@ -33,7 +33,8 @@ FCDProPlusThread::FCDProPlusThread(SampleSinkFifo* sampleFifo, AudioFifo *fcdFIF
|
||||
m_log2Decim(0),
|
||||
m_fcPos(2),
|
||||
m_convertBuffer(fcd_traits<ProPlus>::convBufSize), // nb samples
|
||||
m_sampleFifo(sampleFifo)
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
start();
|
||||
}
|
||||
@ -79,7 +80,12 @@ void FCDProPlusThread::run()
|
||||
|
||||
while (m_running)
|
||||
{
|
||||
work(fcd_traits<ProPlus>::convBufSize);
|
||||
if (m_iqOrder) {
|
||||
workIQ(fcd_traits<ProPlus>::convBufSize);
|
||||
} else {
|
||||
workQI(fcd_traits<ProPlus>::convBufSize);
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100));
|
||||
}
|
||||
|
||||
@ -87,14 +93,14 @@ void FCDProPlusThread::run()
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
void FCDProPlusThread::work(unsigned int n_items)
|
||||
void FCDProPlusThread::workIQ(unsigned int n_items)
|
||||
{
|
||||
uint32_t nbRead = m_fcdFIFO->read((unsigned char *) m_buf, n_items); // number of samples
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate1(&it, m_buf, 2*nbRead);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -103,22 +109,22 @@ void FCDProPlusThread::work(unsigned int n_items)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate2_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate4_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate8_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate16_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate32_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate64_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -129,22 +135,22 @@ void FCDProPlusThread::work(unsigned int n_items)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate2_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate4_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate8_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate16_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate32_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate64_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -155,22 +161,116 @@ void FCDProPlusThread::work(unsigned int n_items)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate2_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate4_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate8_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate16_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate32_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, m_buf, 2*nbRead);
|
||||
m_decimatorsIQ.decimate64_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void FCDProPlusThread::workQI(unsigned int n_items)
|
||||
{
|
||||
uint32_t nbRead = m_fcdFIFO->read((unsigned char *) m_buf, n_items); // number of samples
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimatorsQI.decimate1(&it, m_buf, 2*nbRead);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infradyne
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_inf(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supradyne
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_sup(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // Centered
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, m_buf, 2*nbRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
void stopWork();
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
AudioFifo* m_fcdFIFO;
|
||||
@ -49,13 +50,16 @@ private:
|
||||
bool m_running;
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
bool m_iqOrder;
|
||||
|
||||
qint16 m_buf[fcd_traits<ProPlus>::convBufSize*2]; // stereo (I, Q)
|
||||
SampleVector m_convertBuffer;
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void work(unsigned int n_items);
|
||||
void workIQ(unsigned int n_items);
|
||||
void workQI(unsigned int n_items);
|
||||
};
|
||||
#endif // INCLUDE_FCDTHREAD_H
|
||||
|
@ -46,8 +46,8 @@ MESSAGE_CLASS_DEFINITION(HackRFInput::MsgStartStop, Message)
|
||||
HackRFInput::HackRFInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_dev(0),
|
||||
m_hackRFThread(0),
|
||||
m_dev(nullptr),
|
||||
m_hackRFThread(nullptr),
|
||||
m_deviceDescription("HackRF"),
|
||||
m_running(false)
|
||||
{
|
||||
@ -155,7 +155,7 @@ bool HackRFInput::start()
|
||||
m_hackRFThread->setSamplerate(m_settings.m_devSampleRate);
|
||||
m_hackRFThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_hackRFThread->setFcPos((int) m_settings.m_fcPos);
|
||||
|
||||
m_hackRFThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_hackRFThread->startWork();
|
||||
|
||||
qDebug("HackRFInput::startInput: started");
|
||||
@ -186,11 +186,11 @@ void HackRFInput::stop()
|
||||
qDebug("HackRFInput::stop");
|
||||
// QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_hackRFThread != 0)
|
||||
if (m_hackRFThread)
|
||||
{
|
||||
m_hackRFThread->stopWork();
|
||||
delete m_hackRFThread;
|
||||
m_hackRFThread = 0;
|
||||
m_hackRFThread = nullptr;
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
@ -402,7 +402,7 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_hackRFThread != 0)
|
||||
if (m_hackRFThread)
|
||||
{
|
||||
qDebug("HackRFInput::applySettings: sample rate set to %llu S/s", settings.m_devSampleRate);
|
||||
m_hackRFThread->setSamplerate(settings.m_devSampleRate);
|
||||
@ -416,13 +416,22 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_hackRFThread != 0)
|
||||
if (m_hackRFThread)
|
||||
{
|
||||
m_hackRFThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug() << "HackRFInput: set decimation to " << (1<<settings.m_log2Decim);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_hackRFThread) {
|
||||
m_hackRFThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
@ -470,7 +479,7 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
{
|
||||
if (m_hackRFThread != 0)
|
||||
if (m_hackRFThread)
|
||||
{
|
||||
m_hackRFThread->setFcPos((int) settings.m_fcPos);
|
||||
qDebug() << "HackRFInput: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
|
@ -43,6 +43,7 @@ void HackRFInputSettings::resetToDefaults()
|
||||
m_fileRecordName = "";
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
m_reverseAPIPort = 8888;
|
||||
@ -70,6 +71,7 @@ QByteArray HackRFInputSettings::serialize() const
|
||||
s.writeU32(17, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(18, m_transverterMode);
|
||||
s.writeS64(19, m_transverterDeltaFrequency);
|
||||
s.writeBool(20, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -115,6 +117,7 @@ bool HackRFInputSettings::deserialize(const QByteArray& data)
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(18, &m_transverterMode, false);
|
||||
d.readS64(19, &m_transverterDeltaFrequency, 0);
|
||||
d.readBool(20, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ struct HackRFInputSettings {
|
||||
QString m_fileRecordName;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
|
@ -31,7 +31,8 @@ HackRFInputThread::HackRFInputThread(hackrf_device* dev, SampleSinkFifo* sampleF
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_samplerate(10),
|
||||
m_log2Decim(0),
|
||||
m_fcPos(0)
|
||||
m_fcPos(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
std::fill(m_buf, m_buf + 2*HACKRF_BLOCKSIZE, 0);
|
||||
}
|
||||
@ -122,13 +123,13 @@ void HackRFInputThread::run()
|
||||
}
|
||||
|
||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||
void HackRFInputThread::callback(const qint8* buf, qint32 len)
|
||||
void HackRFInputThread::callbackIQ(const qint8* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, buf, len);
|
||||
m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -137,22 +138,22 @@ void HackRFInputThread::callback(const qint8* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -163,22 +164,22 @@ void HackRFInputThread::callback(const qint8* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup_txsync(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -189,22 +190,22 @@ void HackRFInputThread::callback(const qint8* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -215,11 +216,109 @@ void HackRFInputThread::callback(const qint8* buf, qint32 len)
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void HackRFInputThread::callbackQI(const qint8* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimatorsQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_inf_txsync(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_sup_txsync(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
int HackRFInputThread::rx_callback(hackrf_transfer* transfer)
|
||||
{
|
||||
HackRFInputThread *thread = (HackRFInputThread *) transfer->rx_ctx;
|
||||
qint32 bytes_to_write = transfer->valid_length;
|
||||
thread->callback((qint8 *) transfer->buffer, bytes_to_write);
|
||||
return 0;
|
||||
|
||||
if (thread->m_iqOrder) {
|
||||
thread->callbackIQ((qint8 *) transfer->buffer, bytes_to_write);
|
||||
} else {
|
||||
thread->callbackQI((qint8 *) transfer->buffer, bytes_to_write);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
void setSamplerate(uint32_t samplerate);
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -54,11 +55,14 @@ private:
|
||||
int m_samplerate;
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
bool m_iqOrder;
|
||||
|
||||
Decimators<qint32, qint8, SDR_RX_SAMP_SZ, 8> m_decimators;
|
||||
Decimators<qint32, qint8, SDR_RX_SAMP_SZ, 8, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint8, SDR_RX_SAMP_SZ, 8, false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void callback(const qint8* buf, qint32 len);
|
||||
void callbackIQ(const qint8* buf, qint32 len);
|
||||
void callbackQI(const qint8* buf, qint32 len);
|
||||
static int rx_callback(hackrf_transfer* transfer);
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgStartStop, Message)
|
||||
LimeSDRInput::LimeSDRInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_limeSDRInputThread(0),
|
||||
m_limeSDRInputThread(nullptr),
|
||||
m_deviceDescription("LimeSDRInput"),
|
||||
m_running(false),
|
||||
m_channelAcquired(false)
|
||||
@ -422,7 +422,7 @@ bool LimeSDRInput::start()
|
||||
applySettings(m_settings, true);
|
||||
|
||||
m_limeSDRInputThread->setLog2Decimation(m_settings.m_log2SoftDecim);
|
||||
|
||||
m_limeSDRInputThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_limeSDRInputThread->startWork();
|
||||
|
||||
m_deviceShared.m_thread = m_limeSDRInputThread;
|
||||
@ -439,7 +439,7 @@ void LimeSDRInput::stop()
|
||||
{
|
||||
m_limeSDRInputThread->stopWork();
|
||||
delete m_limeSDRInputThread;
|
||||
m_limeSDRInputThread = 0;
|
||||
m_limeSDRInputThread = nullptr;
|
||||
}
|
||||
|
||||
m_deviceShared.m_thread = 0;
|
||||
@ -1096,6 +1096,15 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_limeSDRInputThread) {
|
||||
m_limeSDRInputThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
|
||||
{
|
||||
reverseAPIKeys.append("antennaPath");
|
||||
|
@ -46,6 +46,7 @@ void LimeSDRInputSettings::resetToDefaults()
|
||||
m_extClockFreq = 10000000; // 10 MHz
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_gpioDir = 0;
|
||||
m_gpioPins = 0;
|
||||
@ -85,6 +86,7 @@ QByteArray LimeSDRInputSettings::serialize() const
|
||||
s.writeString(25, m_reverseAPIAddress);
|
||||
s.writeU32(26, m_reverseAPIPort);
|
||||
s.writeU32(27, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(28, m_iqOrder);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -141,6 +143,7 @@ bool LimeSDRInputSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(27, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(28, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ struct LimeSDRInputSettings
|
||||
uint32_t m_extClockFreq; //!< Frequency (Hz) of external clock source
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
uint8_t m_gpioDir; //!< GPIO pin direction LSB first; 0 input, 1 output
|
||||
uint8_t m_gpioPins; //!< GPIO pins to write; LSB first
|
||||
|
@ -27,7 +27,8 @@ LimeSDRInputThread::LimeSDRInputThread(lms_stream_t* stream, SampleSinkFifo* sam
|
||||
m_stream(stream),
|
||||
m_convertBuffer(DeviceLimeSDR::blockSize),
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_log2Decim(0)
|
||||
m_log2Decim(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
std::fill(m_buf, m_buf + 2*DeviceLimeSDR::blockSize, 0);
|
||||
}
|
||||
@ -94,39 +95,43 @@ void LimeSDRInputThread::run()
|
||||
break;
|
||||
}
|
||||
|
||||
callback(m_buf, 2 * res);
|
||||
if (m_iqOrder) {
|
||||
callbackIQ(m_buf, 2 * res);
|
||||
} else {
|
||||
callbackQI(m_buf, 2 * res);
|
||||
}
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||
void LimeSDRInputThread::callback(const qint16* buf, qint32 len)
|
||||
void LimeSDRInputThread::callbackIQ(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 0:
|
||||
m_decimators.decimate1(&it, buf, len);
|
||||
m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
break;
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -135,3 +140,36 @@ void LimeSDRInputThread::callback(const qint16* buf, qint32 len)
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void LimeSDRInputThread::callbackQI(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 0:
|
||||
m_decimatorsQI.decimate1(&it, buf, len);
|
||||
break;
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
virtual void setDeviceSampleRate(int sampleRate) { (void) sampleRate; }
|
||||
virtual bool isRunning() { return m_running; }
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -54,11 +55,14 @@ private:
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
|
||||
unsigned int m_log2Decim; // soft decimation
|
||||
bool m_iqOrder;
|
||||
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
void callbackIQ(const qint16* buf, qint32 len);
|
||||
void callbackQI(const qint16* buf, qint32 len);
|
||||
};
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ PerseusInput::PerseusInput(DeviceAPI *deviceAPI) :
|
||||
m_fileSink(0),
|
||||
m_deviceDescription("PerseusInput"),
|
||||
m_running(false),
|
||||
m_perseusThread(0),
|
||||
m_perseusThread(nullptr),
|
||||
m_perseusDescriptor(0)
|
||||
{
|
||||
openDevice();
|
||||
@ -86,6 +86,7 @@ bool PerseusInput::start()
|
||||
|
||||
applySettings(m_settings, true);
|
||||
|
||||
m_perseusThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_perseusThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_perseusThread->startWork();
|
||||
|
||||
@ -96,11 +97,11 @@ bool PerseusInput::start()
|
||||
|
||||
void PerseusInput::stop()
|
||||
{
|
||||
if (m_perseusThread != 0)
|
||||
if (m_perseusThread)
|
||||
{
|
||||
m_perseusThread->stopWork();
|
||||
delete m_perseusThread;
|
||||
m_perseusThread = 0;
|
||||
m_perseusThread = nullptr;
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
@ -341,13 +342,22 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_perseusThread != 0)
|
||||
if (m_perseusThread)
|
||||
{
|
||||
m_perseusThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug("PerseusInput: set decimation to %d", (1<<settings.m_log2Decim));
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_perseusThread) {
|
||||
m_perseusThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ void PerseusSettings::resetToDefaults()
|
||||
m_log2Decim = 0;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_adcDither = false;
|
||||
m_adcPreamp = false;
|
||||
m_wideBand = false;
|
||||
@ -60,6 +61,7 @@ QByteArray PerseusSettings::serialize() const
|
||||
s.writeString(11, m_reverseAPIAddress);
|
||||
s.writeU32(12, m_reverseAPIPort);
|
||||
s.writeU32(13, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(14, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -107,6 +109,7 @@ bool PerseusSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(13, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(14, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ struct PerseusSettings
|
||||
quint32 m_log2Decim;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
bool m_adcDither;
|
||||
bool m_adcPreamp;
|
||||
bool m_wideBand;
|
||||
|
@ -27,7 +27,8 @@ PerseusThread::PerseusThread(perseus_descr* dev, SampleSinkFifo* sampleFifo, QOb
|
||||
m_dev(dev),
|
||||
m_convertBuffer(PERSEUS_NBSAMPLES),
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_log2Decim(0)
|
||||
m_log2Decim(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
m_this = this;
|
||||
std::fill(m_buf, m_buf + 2*PERSEUS_NBSAMPLES, 0);
|
||||
@ -90,20 +91,42 @@ void PerseusThread::run()
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
void PerseusThread::callback(const uint8_t* buf, qint32 len)
|
||||
void PerseusThread::callbackIQ(const uint8_t* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 0:
|
||||
m_decimators32.decimate1(&it, (TripleByteLE<qint32>*) buf, len);
|
||||
m_decimators32IQ.decimate1(&it, (TripleByteLE<qint32>*) buf, len);
|
||||
break;
|
||||
case 1:
|
||||
m_decimators64.decimate2_cen(&it, (TripleByteLE<qint64>*) buf, len);
|
||||
m_decimators64IQ.decimate2_cen(&it, (TripleByteLE<qint64>*) buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators64.decimate4_cen(&it, (TripleByteLE<qint64>*) buf, len);
|
||||
m_decimators64IQ.decimate4_cen(&it, (TripleByteLE<qint64>*) buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void PerseusThread::callbackQI(const uint8_t* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 0:
|
||||
m_decimators32QI.decimate1(&it, (TripleByteLE<qint32>*) buf, len);
|
||||
break;
|
||||
case 1:
|
||||
m_decimators64QI.decimate2_cen(&it, (TripleByteLE<qint64>*) buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators64QI.decimate4_cen(&it, (TripleByteLE<qint64>*) buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -116,7 +139,13 @@ int PerseusThread::rx_callback(void *buf, int buf_size, void *extra)
|
||||
{
|
||||
(void) extra;
|
||||
qint32 nbIAndQ = buf_size / 3; // 3 bytes per I or Q
|
||||
m_this->callback((uint8_t*) buf, nbIAndQ);
|
||||
return 0;
|
||||
|
||||
if (m_this->m_iqOrder) {
|
||||
m_this->callbackIQ((uint8_t*) buf, nbIAndQ);
|
||||
} else {
|
||||
m_this->callbackQI((uint8_t*) buf, nbIAndQ);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
void startWork();
|
||||
void stopWork();
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -51,13 +52,17 @@ private:
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
|
||||
unsigned int m_log2Decim;
|
||||
bool m_iqOrder;
|
||||
static PerseusThread *m_this;
|
||||
|
||||
Decimators<qint32, TripleByteLE<qint32>, SDR_RX_SAMP_SZ, 24> m_decimators32; // for no decimation (accumulator is int32)
|
||||
Decimators<qint32, TripleByteLE<qint64>, SDR_RX_SAMP_SZ, 24> m_decimators64; // for actual decimation (accumulator is int64)
|
||||
Decimators<qint32, TripleByteLE<qint32>, SDR_RX_SAMP_SZ, 24, true> m_decimators32IQ; // for no decimation (accumulator is int32)
|
||||
Decimators<qint32, TripleByteLE<qint64>, SDR_RX_SAMP_SZ, 24, true> m_decimators64IQ; // for actual decimation (accumulator is int64)
|
||||
Decimators<qint32, TripleByteLE<qint32>, SDR_RX_SAMP_SZ, 24, false> m_decimators32QI; // for no decimation (accumulator is int32)
|
||||
Decimators<qint32, TripleByteLE<qint64>, SDR_RX_SAMP_SZ, 24, false> m_decimators64QI; // for actual decimation (accumulator is int64)
|
||||
|
||||
void run();
|
||||
void callback(const uint8_t* buf, qint32 len); // inner call back
|
||||
void callbackIQ(const uint8_t* buf, qint32 len); // inner call back
|
||||
void callbackQI(const uint8_t* buf, qint32 len);
|
||||
static int rx_callback(void *buf, int buf_size, void *extra); // call back from Perseus
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,7 @@ PlutoSDRInput::PlutoSDRInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceDescription("PlutoSDRInput"),
|
||||
m_running(false),
|
||||
m_plutoRxBuffer(0),
|
||||
m_plutoSDRInputThread(0)
|
||||
m_plutoSDRInputThread(nullptr)
|
||||
{
|
||||
m_deviceSampleRates.m_addaConnvRate = 0;
|
||||
m_deviceSampleRates.m_bbRateHz = 0;
|
||||
@ -115,6 +115,7 @@ bool PlutoSDRInput::start()
|
||||
applySettings(m_settings, true);
|
||||
|
||||
m_plutoSDRInputThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_plutoSDRInputThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_plutoSDRInputThread->startWork();
|
||||
|
||||
m_deviceShared.m_thread = m_plutoSDRInputThread;
|
||||
@ -125,14 +126,14 @@ bool PlutoSDRInput::start()
|
||||
|
||||
void PlutoSDRInput::stop()
|
||||
{
|
||||
if (m_plutoSDRInputThread != 0)
|
||||
if (m_plutoSDRInputThread)
|
||||
{
|
||||
m_plutoSDRInputThread->stopWork();
|
||||
delete m_plutoSDRInputThread;
|
||||
m_plutoSDRInputThread = 0;
|
||||
m_plutoSDRInputThread = nullptr;
|
||||
}
|
||||
|
||||
m_deviceShared.m_thread = 0;
|
||||
m_deviceShared.m_thread = nullptr;
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
@ -585,7 +586,7 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
||||
|
||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||
{
|
||||
if (m_plutoSDRInputThread != 0)
|
||||
if (m_plutoSDRInputThread)
|
||||
{
|
||||
m_plutoSDRInputThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug() << "PlutoSDRInput::applySettings: set soft decimation to " << (1<<settings.m_log2Decim);
|
||||
@ -594,6 +595,13 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
||||
forwardChangeOwnDSP = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
if (m_plutoSDRInputThread) {
|
||||
m_plutoSDRInputThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
|
||||
{
|
||||
plutoBox->setLOPPMTenths(settings.m_LOppmTenths);
|
||||
@ -625,7 +633,7 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
{
|
||||
if (m_plutoSDRInputThread != 0)
|
||||
if (m_plutoSDRInputThread)
|
||||
{
|
||||
m_plutoSDRInputThread->setFcPos(settings.m_fcPos);
|
||||
qDebug() << "PlutoSDRInput::applySettings: set fcPos to " << settings.m_fcPos;
|
||||
|
@ -48,6 +48,7 @@ void PlutoSDRInputSettings::resetToDefaults()
|
||||
m_gainMode = GAIN_MANUAL;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
@ -82,6 +83,7 @@ QByteArray PlutoSDRInputSettings::serialize() const
|
||||
s.writeBool(22, m_hwBBDCBlock);
|
||||
s.writeBool(23, m_hwRFDCBlock);
|
||||
s.writeBool(24, m_hwIQCorrection);
|
||||
s.writeBool(25, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -153,6 +155,7 @@ bool PlutoSDRInputSettings::deserialize(const QByteArray& data)
|
||||
d.readBool(22, &m_hwBBDCBlock, true);
|
||||
d.readBool(23, &m_hwRFDCBlock, true);
|
||||
d.readBool(24, &m_hwIQCorrection, true);
|
||||
d.readBool(25, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ struct PlutoSDRInputSettings {
|
||||
GainMode m_gainMode;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
@ -31,7 +31,8 @@ PlutoSDRInputThread::PlutoSDRInputThread(uint32_t blocksizeSamples, DevicePlutoS
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_log2Decim(0),
|
||||
m_fcPos(PlutoSDRInputSettings::FC_POS_CENTER),
|
||||
m_phasor(0)
|
||||
m_phasor(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
m_buf = new qint16[blocksizeSamples*2]; // (I,Q) -> 2 * int16_t
|
||||
m_bufConv = new qint16[blocksizeSamples*2]; // (I,Q) -> 2 * int16_t
|
||||
@ -139,21 +140,24 @@ void PlutoSDRInputThread::run()
|
||||
ihs++;
|
||||
}
|
||||
|
||||
//m_sampleFifo->write((unsigned char *) m_buf, ihs*sizeof(int16_t));
|
||||
convert(m_buf, 2*m_blockSizeSamples); // size given in number of int16_t (I and Q interleaved)
|
||||
if (m_iqOrder) {
|
||||
convertIQ(m_buf, 2*m_blockSizeSamples); // size given in number of int16_t (I and Q interleaved)
|
||||
} else {
|
||||
convertQI(m_buf, 2*m_blockSizeSamples);
|
||||
}
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||
void PlutoSDRInputThread::convert(const qint16* buf, qint32 len)
|
||||
void PlutoSDRInputThread::convertIQ(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, buf, len);
|
||||
m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -162,22 +166,22 @@ void PlutoSDRInputThread::convert(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -188,22 +192,22 @@ void PlutoSDRInputThread::convert(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -214,22 +218,22 @@ void PlutoSDRInputThread::convert(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -240,3 +244,95 @@ void PlutoSDRInputThread::convert(const qint16* buf, qint32 len)
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void PlutoSDRInputThread::convertQI(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimatorsQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
virtual bool isRunning() { return m_running; }
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -59,12 +60,14 @@ private:
|
||||
unsigned int m_log2Decim; // soft decimation
|
||||
int m_fcPos;
|
||||
float m_phasor;
|
||||
bool m_iqOrder;
|
||||
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void convert(const qint16* buf, qint32 len);
|
||||
|
||||
void convertIQ(const qint16* buf, qint32 len);
|
||||
void convertQI(const qint16* buf, qint32 len);
|
||||
};
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ RTLSDRInput::RTLSDRInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_dev(0),
|
||||
m_rtlSDRThread(0),
|
||||
m_rtlSDRThread(nullptr),
|
||||
m_deviceDescription(),
|
||||
m_running(false)
|
||||
{
|
||||
@ -207,7 +207,7 @@ bool RTLSDRInput::start()
|
||||
m_rtlSDRThread->setSamplerate(m_settings.m_devSampleRate);
|
||||
m_rtlSDRThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_rtlSDRThread->setFcPos((int) m_settings.m_fcPos);
|
||||
|
||||
m_rtlSDRThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_rtlSDRThread->startWork();
|
||||
|
||||
mutexLocker.unlock();
|
||||
@ -233,11 +233,11 @@ void RTLSDRInput::stop()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_rtlSDRThread != 0)
|
||||
if (m_rtlSDRThread)
|
||||
{
|
||||
m_rtlSDRThread->stopWork();
|
||||
delete m_rtlSDRThread;
|
||||
m_rtlSDRThread = 0;
|
||||
m_rtlSDRThread = nullptr;
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
@ -434,7 +434,7 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
forwardChange = true;
|
||||
|
||||
if (m_rtlSDRThread != 0) {
|
||||
if (m_rtlSDRThread) {
|
||||
m_rtlSDRThread->setLog2Decimation(settings.m_log2Decim);
|
||||
}
|
||||
|
||||
@ -445,7 +445,7 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
{
|
||||
reverseAPIKeys.append("fcPos");
|
||||
|
||||
if (m_rtlSDRThread != 0) {
|
||||
if (m_rtlSDRThread) {
|
||||
m_rtlSDRThread->setFcPos((int) settings.m_fcPos);
|
||||
}
|
||||
|
||||
@ -465,6 +465,15 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
reverseAPIKeys.append("transverterDeltaFrequency");
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_rtlSDRThread) {
|
||||
m_rtlSDRThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_fcPos != settings.m_fcPos)
|
||||
|| (m_settings.m_log2Decim != settings.m_log2Decim)
|
||||
|
@ -38,6 +38,7 @@ void RTLSDRSettings::resetToDefaults()
|
||||
m_agc = false;
|
||||
m_noModMode = false;
|
||||
m_transverterMode = false;
|
||||
m_iqOrder = true;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_rfBandwidth = 2500 * 1000; // Hz
|
||||
m_fileRecordName = "";
|
||||
@ -70,6 +71,7 @@ QByteArray RTLSDRSettings::serialize() const
|
||||
s.writeString(17, m_reverseAPIAddress);
|
||||
s.writeU32(18, m_reverseAPIPort);
|
||||
s.writeU32(19, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(20, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -116,6 +118,7 @@ bool RTLSDRSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(19, &utmp, 0);
|
||||
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
|
||||
d.readBool(20, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ struct RTLSDRSettings {
|
||||
bool m_agc;
|
||||
bool m_noModMode;
|
||||
bool m_transverterMode;
|
||||
bool m_iqOrder;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
quint32 m_rfBandwidth; //!< RF filter bandwidth in Hz
|
||||
QString m_fileRecordName;
|
||||
|
@ -32,7 +32,8 @@ RTLSDRThread::RTLSDRThread(rtlsdr_dev_t* dev, SampleSinkFifo* sampleFifo, QObjec
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_samplerate(288000),
|
||||
m_log2Decim(4),
|
||||
m_fcPos(0)
|
||||
m_fcPos(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -89,13 +90,13 @@ void RTLSDRThread::run()
|
||||
}
|
||||
|
||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||
void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||
void RTLSDRThread::callbackIQ(const quint8* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, buf, len);
|
||||
m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,22 +105,22 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -130,22 +131,22 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -156,22 +157,118 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
|
||||
if(!m_running)
|
||||
rtlsdr_cancel_async(m_dev);
|
||||
}
|
||||
|
||||
void RTLSDRThread::callbackQI(const quint8* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimatorsQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infradyne
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supradyne
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // Centered
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -187,7 +284,12 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||
|
||||
void RTLSDRThread::callbackHelper(unsigned char* buf, uint32_t len, void* ctx)
|
||||
{
|
||||
RTLSDRThread* thread = (RTLSDRThread*)ctx;
|
||||
thread->callback(buf, len);
|
||||
RTLSDRThread* thread = (RTLSDRThread*) ctx;
|
||||
|
||||
if (thread->m_iqOrder) {
|
||||
thread->callbackIQ(buf, len);
|
||||
} else {
|
||||
thread->callbackQI(buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
void setSamplerate(int samplerate);
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -52,11 +53,14 @@ private:
|
||||
int m_samplerate;
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
bool m_iqOrder;
|
||||
|
||||
DecimatorsU<qint32, quint8, SDR_RX_SAMP_SZ, 8, 127> m_decimators;
|
||||
DecimatorsU<qint32, quint8, SDR_RX_SAMP_SZ, 8, 127, true> m_decimatorsIQ;
|
||||
DecimatorsU<qint32, quint8, SDR_RX_SAMP_SZ, 8, 127, false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void callback(const quint8* buf, qint32 len);
|
||||
void callbackIQ(const quint8* buf, qint32 len);
|
||||
void callbackQI(const quint8* buf, qint32 len);
|
||||
|
||||
static void callbackHelper(unsigned char* buf, uint32_t len, void* ctx);
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ SDRPlayInput::SDRPlayInput(DeviceAPI *deviceAPI) :
|
||||
m_variant(SDRPlayUndef),
|
||||
m_settings(),
|
||||
m_dev(0),
|
||||
m_sdrPlayThread(0),
|
||||
m_sdrPlayThread(nullptr),
|
||||
m_deviceDescription("SDRPlay"),
|
||||
m_devNumber(0),
|
||||
m_running(false)
|
||||
@ -185,7 +185,7 @@ bool SDRPlayInput::start()
|
||||
m_sdrPlayThread = new SDRPlayThread(m_dev, &m_sampleFifo);
|
||||
m_sdrPlayThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
m_sdrPlayThread->setFcPos((int) m_settings.m_fcPos);
|
||||
|
||||
m_sdrPlayThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_sdrPlayThread->startWork();
|
||||
|
||||
// mutexLocker.unlock();
|
||||
@ -216,11 +216,11 @@ void SDRPlayInput::stop()
|
||||
{
|
||||
// QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if(m_sdrPlayThread != 0)
|
||||
if(m_sdrPlayThread)
|
||||
{
|
||||
m_sdrPlayThread->stopWork();
|
||||
delete m_sdrPlayThread;
|
||||
m_sdrPlayThread = 0;
|
||||
m_sdrPlayThread = nullptr;
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
@ -524,7 +524,7 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
|
||||
{
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
|
||||
if (m_sdrPlayThread != 0)
|
||||
if (m_sdrPlayThread)
|
||||
{
|
||||
m_sdrPlayThread->setLog2Decimation(settings.m_log2Decim);
|
||||
qDebug() << "SDRPlayInput::applySettings: set decimation to " << (1<<settings.m_log2Decim);
|
||||
@ -535,13 +535,24 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
|
||||
{
|
||||
reverseAPIKeys.append("fcPos");
|
||||
|
||||
if (m_sdrPlayThread != 0)
|
||||
if (m_sdrPlayThread)
|
||||
{
|
||||
m_sdrPlayThread->setFcPos((int) settings.m_fcPos);
|
||||
qDebug() << "SDRPlayInput: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_sdrPlayThread)
|
||||
{
|
||||
m_sdrPlayThread->setIQOrder((int) settings.m_iqOrder);
|
||||
qDebug() << "SDRPlayInput: set IQ order to " << (settings.m_iqOrder ? "IQ" : "QI");
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ void SDRPlaySettings::resetToDefaults()
|
||||
m_lnaOn = false;
|
||||
m_mixerAmpOn = false;
|
||||
m_basebandGain = 29;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
@ -71,6 +72,7 @@ QByteArray SDRPlaySettings::serialize() const
|
||||
s.writeString(16, m_reverseAPIAddress);
|
||||
s.writeU32(17, m_reverseAPIPort);
|
||||
s.writeU32(18, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(19, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -117,6 +119,7 @@ bool SDRPlaySettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(18, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(19, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ struct SDRPlaySettings {
|
||||
bool m_lnaOn;
|
||||
bool m_mixerAmpOn;
|
||||
int m_basebandGain;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
@ -28,7 +28,8 @@ SDRPlayThread::SDRPlayThread(mirisdr_dev_t* dev, SampleSinkFifo* sampleFifo, QOb
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_samplerate(288000),
|
||||
m_log2Decim(0),
|
||||
m_fcPos(0)
|
||||
m_fcPos(0),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -89,16 +90,22 @@ void SDRPlayThread::run()
|
||||
void SDRPlayThread::callbackHelper(unsigned char* buf, uint32_t len, void* ctx)
|
||||
{
|
||||
SDRPlayThread* thread = (SDRPlayThread*) ctx;
|
||||
thread->callback((const qint16*) buf, len/2);
|
||||
|
||||
if (thread->m_iqOrder) {
|
||||
thread->callbackIQ((const qint16*) buf, len/2);
|
||||
} else {
|
||||
thread->callbackQI((const qint16*) buf, len/2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SDRPlayThread::callback(const qint16* buf, qint32 len)
|
||||
void SDRPlayThread::callbackIQ(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, buf, len);
|
||||
m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -107,22 +114,22 @@ void SDRPlayThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -133,22 +140,22 @@ void SDRPlayThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -159,22 +166,22 @@ void SDRPlayThread::callback(const qint16* buf, qint32 len)
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -190,3 +197,100 @@ void SDRPlayThread::callback(const qint16* buf, qint32 len)
|
||||
}
|
||||
}
|
||||
|
||||
void SDRPlayThread::callbackQI(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimatorsQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infradyne
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supradyne
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // Centered
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
|
||||
if(!m_running)
|
||||
{
|
||||
mirisdr_cancel_async(m_dev);
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
void setSamplerate(int samplerate);
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@ -52,11 +53,14 @@ private:
|
||||
int m_samplerate;
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
bool m_iqOrder;
|
||||
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
void callbackIQ(const qint16* buf, qint32 len);
|
||||
void callbackQI(const qint16* buf, qint32 len);
|
||||
|
||||
static void callbackHelper(unsigned char* buf, uint32_t len, void* ctx);
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ SoapySDRInput::SoapySDRInput(DeviceAPI *deviceAPI) :
|
||||
m_settings(),
|
||||
m_deviceDescription("SoapySDRInput"),
|
||||
m_running(false),
|
||||
m_thread(0)
|
||||
m_thread(nullptr)
|
||||
{
|
||||
openDevice();
|
||||
initGainSettings(m_settings);
|
||||
@ -395,7 +395,7 @@ void SoapySDRInput::init()
|
||||
|
||||
SoapySDRInputThread *SoapySDRInput::findThread()
|
||||
{
|
||||
if (m_thread == 0) // this does not own the thread
|
||||
if (!m_thread) // this does not own the thread
|
||||
{
|
||||
SoapySDRInputThread *soapySDRInputThread = 0;
|
||||
|
||||
@ -437,7 +437,7 @@ void SoapySDRInput::moveThreadToBuddy()
|
||||
if (buddySource)
|
||||
{
|
||||
buddySource->setThread(m_thread);
|
||||
m_thread = 0; // zero for others
|
||||
m_thread = nullptr; // zero for others
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -604,7 +604,7 @@ void SoapySDRInput::stop()
|
||||
qDebug("SoapySDRInput::stop: SI mode. Just stop and delete the thread");
|
||||
soapySDRInputThread->stopWork();
|
||||
delete soapySDRInputThread;
|
||||
m_thread = 0;
|
||||
m_thread = nullptr;
|
||||
|
||||
// remove old thread address from buddies (reset in all buddies)
|
||||
const std::vector<DeviceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||
@ -636,7 +636,7 @@ void SoapySDRInput::stop()
|
||||
}
|
||||
|
||||
delete soapySDRInputThread;
|
||||
m_thread = 0;
|
||||
m_thread = nullptr;
|
||||
|
||||
if (highestActiveChannelIndex >= 0) // there is at least one channel still active
|
||||
{
|
||||
@ -975,7 +975,7 @@ bool SoapySDRInput::applySettings(const SoapySDRInputSettings& settings, bool fo
|
||||
{
|
||||
reverseAPIKeys.append("fcPos");
|
||||
|
||||
if (inputThread != 0)
|
||||
if (inputThread)
|
||||
{
|
||||
inputThread->setFcPos(requestedChannel, (int) settings.m_fcPos);
|
||||
qDebug() << "SoapySDRInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
|
||||
@ -988,13 +988,25 @@ bool SoapySDRInput::applySettings(const SoapySDRInputSettings& settings, bool fo
|
||||
forwardChangeOwnDSP = true;
|
||||
SoapySDRInputThread *inputThread = findThread();
|
||||
|
||||
if (inputThread != 0)
|
||||
if (inputThread)
|
||||
{
|
||||
inputThread->setLog2Decimation(requestedChannel, settings.m_log2Decim);
|
||||
qDebug() << "SoapySDRInput::applySettings: set decimation to " << (1<<settings.m_log2Decim);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
SoapySDRInputThread *inputThread = findThread();
|
||||
|
||||
if (inputThread)
|
||||
{
|
||||
inputThread->setIQOrder(settings.m_iqOrder);
|
||||
qDebug() << "SoapySDRInput::applySettings: set IQ order to " << (settings.m_iqOrder ? "IQ" : "QI");
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ void SoapySDRInputSettings::resetToDefaults()
|
||||
m_softIQCorrection = false;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_antenna = "NONE";
|
||||
m_bandwidth = 1000000;
|
||||
@ -82,6 +83,7 @@ QByteArray SoapySDRInputSettings::serialize() const
|
||||
s.writeString(24, m_reverseAPIAddress);
|
||||
s.writeU32(25, m_reverseAPIPort);
|
||||
s.writeU32(26, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(27, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -144,6 +146,7 @@ bool SoapySDRInputSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(26, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(27, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ struct SoapySDRInputSettings {
|
||||
bool m_softIQCorrection;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
QString m_antenna;
|
||||
quint32 m_bandwidth;
|
||||
|
@ -32,7 +32,8 @@ SoapySDRInputThread::SoapySDRInputThread(SoapySDR::Device* dev, unsigned int nbR
|
||||
m_dev(dev),
|
||||
m_sampleRate(0),
|
||||
m_nbChannels(nbRxChannels),
|
||||
m_decimatorType(DecimatorFloat)
|
||||
m_decimatorType(DecimatorFloat),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
qDebug("SoapySDRInputThread::SoapySDRInputThread");
|
||||
m_channels = new Channel[nbRxChannels];
|
||||
@ -155,28 +156,57 @@ void SoapySDRInputThread::run()
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_nbChannels > 1)
|
||||
if (m_iqOrder)
|
||||
{
|
||||
callbackMI(buffs, numElems*2); // size given in number of I or Q samples (2 items per sample)
|
||||
if (m_nbChannels > 1)
|
||||
{
|
||||
callbackMIIQ(buffs, numElems*2); // size given in number of I or Q samples (2 items per sample)
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_decimatorType)
|
||||
{
|
||||
case Decimator8:
|
||||
callbackSI8IQ((const qint8*) buffs[0], numElems*2);
|
||||
break;
|
||||
case Decimator12:
|
||||
callbackSI12IQ((const qint16*) buffs[0], numElems*2);
|
||||
break;
|
||||
case Decimator16:
|
||||
callbackSI16IQ((const qint16*) buffs[0], numElems*2);
|
||||
break;
|
||||
case DecimatorFloat:
|
||||
default:
|
||||
callbackSIFIQ((const float*) buffs[0], numElems*2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_decimatorType)
|
||||
if (m_nbChannels > 1)
|
||||
{
|
||||
case Decimator8:
|
||||
callbackSI8((const qint8*) buffs[0], numElems*2);
|
||||
break;
|
||||
case Decimator12:
|
||||
callbackSI12((const qint16*) buffs[0], numElems*2);
|
||||
break;
|
||||
case Decimator16:
|
||||
callbackSI16((const qint16*) buffs[0], numElems*2);
|
||||
break;
|
||||
case DecimatorFloat:
|
||||
default:
|
||||
callbackSIF((const float*) buffs[0], numElems*2);
|
||||
callbackMIQI(buffs, numElems*2); // size given in number of I or Q samples (2 items per sample)
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_decimatorType)
|
||||
{
|
||||
case Decimator8:
|
||||
callbackSI8QI((const qint8*) buffs[0], numElems*2);
|
||||
break;
|
||||
case Decimator12:
|
||||
callbackSI12QI((const qint16*) buffs[0], numElems*2);
|
||||
break;
|
||||
case Decimator16:
|
||||
callbackSI16QI((const qint16*) buffs[0], numElems*2);
|
||||
break;
|
||||
case DecimatorFloat:
|
||||
default:
|
||||
callbackSIFQI((const float*) buffs[0], numElems*2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
qDebug("SoapySDRInputThread::run: stop running loop");
|
||||
@ -253,35 +283,57 @@ SampleSinkFifo *SoapySDRInputThread::getFifo(unsigned int channel)
|
||||
}
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackMI(std::vector<void *>& buffs, qint32 samplesPerChannel)
|
||||
void SoapySDRInputThread::callbackMIIQ(std::vector<void *>& buffs, qint32 samplesPerChannel)
|
||||
{
|
||||
for(unsigned int ichan = 0; ichan < m_nbChannels; ichan++)
|
||||
{
|
||||
switch (m_decimatorType)
|
||||
{
|
||||
case Decimator8:
|
||||
callbackSI8((const qint8*) buffs[ichan], samplesPerChannel, ichan);
|
||||
callbackSI8IQ((const qint8*) buffs[ichan], samplesPerChannel, ichan);
|
||||
break;
|
||||
case Decimator12:
|
||||
callbackSI12((const qint16*) buffs[ichan], samplesPerChannel, ichan);
|
||||
callbackSI12IQ((const qint16*) buffs[ichan], samplesPerChannel, ichan);
|
||||
break;
|
||||
case Decimator16:
|
||||
callbackSI16((const qint16*) buffs[ichan], samplesPerChannel, ichan);
|
||||
callbackSI16IQ((const qint16*) buffs[ichan], samplesPerChannel, ichan);
|
||||
break;
|
||||
case DecimatorFloat:
|
||||
default:
|
||||
callbackSIF((const float*) buffs[ichan], samplesPerChannel, ichan);
|
||||
callbackSIFIQ((const float*) buffs[ichan], samplesPerChannel, ichan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSI8(const qint8* buf, qint32 len, unsigned int channel)
|
||||
void SoapySDRInputThread::callbackMIQI(std::vector<void *>& buffs, qint32 samplesPerChannel)
|
||||
{
|
||||
for(unsigned int ichan = 0; ichan < m_nbChannels; ichan++)
|
||||
{
|
||||
switch (m_decimatorType)
|
||||
{
|
||||
case Decimator8:
|
||||
callbackSI8QI((const qint8*) buffs[ichan], samplesPerChannel, ichan);
|
||||
break;
|
||||
case Decimator12:
|
||||
callbackSI12QI((const qint16*) buffs[ichan], samplesPerChannel, ichan);
|
||||
break;
|
||||
case Decimator16:
|
||||
callbackSI16QI((const qint16*) buffs[ichan], samplesPerChannel, ichan);
|
||||
break;
|
||||
case DecimatorFloat:
|
||||
default:
|
||||
callbackSIFQI((const float*) buffs[ichan], samplesPerChannel, ichan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSI8IQ(const qint8* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimators8.decimate1(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -290,22 +342,22 @@ void SoapySDRInputThread::callbackSI8(const qint8* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators8.decimate2_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators8.decimate4_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators8.decimate8_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators8.decimate16_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators8.decimate32_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators8.decimate64_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -316,22 +368,22 @@ void SoapySDRInputThread::callbackSI8(const qint8* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators8.decimate2_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators8.decimate4_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators8.decimate8_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators8.decimate16_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators8.decimate32_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators8.decimate64_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -342,22 +394,22 @@ void SoapySDRInputThread::callbackSI8(const qint8* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators8.decimate2_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators8.decimate4_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators8.decimate8_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators8.decimate16_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators8.decimate32_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators8.decimate64_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8IQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -368,13 +420,13 @@ void SoapySDRInputThread::callbackSI8(const qint8* buf, qint32 len, unsigned int
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSI12(const qint16* buf, qint32 len, unsigned int channel)
|
||||
void SoapySDRInputThread::callbackSI8QI(const qint8* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimators12.decimate1(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -383,22 +435,22 @@ void SoapySDRInputThread::callbackSI12(const qint16* buf, qint32 len, unsigned i
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators12.decimate2_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators12.decimate4_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators12.decimate8_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators12.decimate16_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators12.decimate32_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators12.decimate64_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -409,22 +461,22 @@ void SoapySDRInputThread::callbackSI12(const qint16* buf, qint32 len, unsigned i
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators12.decimate2_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators12.decimate4_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators12.decimate8_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators12.decimate16_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators12.decimate32_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators12.decimate64_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -435,22 +487,22 @@ void SoapySDRInputThread::callbackSI12(const qint16* buf, qint32 len, unsigned i
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators12.decimate2_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators12.decimate4_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators12.decimate8_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators12.decimate16_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators12.decimate32_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators12.decimate64_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators8QI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -461,13 +513,13 @@ void SoapySDRInputThread::callbackSI12(const qint16* buf, qint32 len, unsigned i
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSI16(const qint16* buf, qint32 len, unsigned int channel)
|
||||
void SoapySDRInputThread::callbackSI12IQ(const qint16* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimators16.decimate1(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -476,22 +528,22 @@ void SoapySDRInputThread::callbackSI16(const qint16* buf, qint32 len, unsigned i
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16.decimate2_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16.decimate4_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16.decimate8_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16.decimate16_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16.decimate32_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16.decimate64_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -502,22 +554,22 @@ void SoapySDRInputThread::callbackSI16(const qint16* buf, qint32 len, unsigned i
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16.decimate2_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16.decimate4_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16.decimate8_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16.decimate16_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16.decimate32_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16.decimate64_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -528,22 +580,22 @@ void SoapySDRInputThread::callbackSI16(const qint16* buf, qint32 len, unsigned i
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16.decimate2_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16.decimate4_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16.decimate8_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16.decimate16_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16.decimate32_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16.decimate64_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12IQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -554,13 +606,13 @@ void SoapySDRInputThread::callbackSI16(const qint16* buf, qint32 len, unsigned i
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSIF(const float* buf, qint32 len, unsigned int channel)
|
||||
void SoapySDRInputThread::callbackSI12QI(const qint16* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimatorsFloat.decimate1(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -569,22 +621,22 @@ void SoapySDRInputThread::callbackSIF(const float* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloat.decimate2_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloat.decimate4_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloat.decimate8_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloat.decimate16_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloat.decimate32_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloat.decimate64_inf(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -595,22 +647,22 @@ void SoapySDRInputThread::callbackSIF(const float* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloat.decimate2_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloat.decimate4_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloat.decimate8_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloat.decimate16_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloat.decimate32_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloat.decimate64_sup(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -621,22 +673,394 @@ void SoapySDRInputThread::callbackSIF(const float* buf, qint32 len, unsigned int
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloat.decimate2_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloat.decimate4_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloat.decimate8_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloat.decimate16_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloat.decimate32_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloat.decimate64_cen(&it, buf, len);
|
||||
m_channels[channel].m_decimators12QI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSI16IQ(const qint16* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimators16IQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_channels[channel].m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16IQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16IQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16IQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16IQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16IQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16IQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16IQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16IQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16IQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16IQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16IQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16IQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16IQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16IQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16IQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16IQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16IQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16IQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSI16QI(const qint16* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimators16QI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_channels[channel].m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16QI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16QI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16QI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16QI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16QI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16QI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16QI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16QI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16QI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16QI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16QI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16QI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimators16QI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimators16QI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimators16QI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimators16QI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimators16QI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimators16QI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSIFIQ(const float* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_channels[channel].m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloatIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_channels[channel].m_sampleFifo->write(m_channels[channel].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void SoapySDRInputThread::callbackSIFQI(const float* buf, qint32 len, unsigned int channel)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[channel].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[channel].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_channels[channel].m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate2_inf(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate4_inf(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate8_inf(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate16_inf(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate32_inf(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate64_inf(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate2_sup(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate4_sup(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate8_sup(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate16_sup(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate32_sup(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate64_sup(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_channels[channel].m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_channels[channel].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[channel].m_decimatorsFloatQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
int getFcPos(unsigned int channel) const;
|
||||
void setFifo(unsigned int channel, SampleSinkFifo *sampleFifo);
|
||||
SampleSinkFifo *getFifo(unsigned int channel);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
struct Channel
|
||||
@ -61,10 +62,14 @@ private:
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
Decimators<qint32, qint8, SDR_RX_SAMP_SZ, 8> m_decimators8;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators12;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators16;
|
||||
DecimatorsFI m_decimatorsFloat;
|
||||
Decimators<qint32, qint8, SDR_RX_SAMP_SZ, 8, true> m_decimators8IQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimators12IQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, true> m_decimators16IQ;
|
||||
Decimators<qint32, qint8, SDR_RX_SAMP_SZ, 8, false> m_decimators8QI;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimators12QI;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, false> m_decimators16QI;
|
||||
DecimatorsFI<true> m_decimatorsFloatIQ;
|
||||
DecimatorsFI<false> m_decimatorsFloatQI;
|
||||
|
||||
Channel() :
|
||||
m_sampleFifo(0),
|
||||
@ -93,14 +98,23 @@ private:
|
||||
unsigned int m_sampleRate;
|
||||
unsigned int m_nbChannels;
|
||||
DecimatorType m_decimatorType;
|
||||
bool m_iqOrder;
|
||||
|
||||
void run();
|
||||
unsigned int getNbFifos();
|
||||
void callbackSI8(const qint8* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSI12(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSI16(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSIF(const float* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackMI(std::vector<void *>& buffs, qint32 samplesPerChannel);
|
||||
|
||||
void callbackSI8IQ(const qint8* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSI12IQ(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSI16IQ(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSIFIQ(const float* buf, qint32 len, unsigned int channel = 0);
|
||||
|
||||
void callbackSI8QI(const qint8* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSI12QI(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSI16QI(const qint16* buf, qint32 len, unsigned int channel = 0);
|
||||
void callbackSIFQI(const float* buf, qint32 len, unsigned int channel = 0);
|
||||
|
||||
void callbackMIIQ(std::vector<void *>& buffs, qint32 samplesPerChannel);
|
||||
void callbackMIQI(std::vector<void *>& buffs, qint32 samplesPerChannel);
|
||||
};
|
||||
|
||||
|
||||
|
@ -131,9 +131,9 @@ private:
|
||||
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 8> m_decimators_8;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators_12;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators_16;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 8, true> m_decimators_8;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimators_12;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, true> m_decimators_16;
|
||||
|
||||
std::map<int, int> m_timerHistogram;
|
||||
uint32_t m_histoCounter;
|
||||
|
@ -52,7 +52,7 @@ MESSAGE_CLASS_DEFINITION(XTRXInput::MsgStartStop, Message)
|
||||
XTRXInput::XTRXInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_XTRXInputThread(0),
|
||||
m_XTRXInputThread(nullptr),
|
||||
m_deviceDescription("XTRXInput"),
|
||||
m_running(false)
|
||||
{
|
||||
@ -201,9 +201,9 @@ void XTRXInput::init()
|
||||
|
||||
XTRXInputThread *XTRXInput::findThread()
|
||||
{
|
||||
if (m_XTRXInputThread == 0) // this does not own the thread
|
||||
if (!m_XTRXInputThread) // this does not own the thread
|
||||
{
|
||||
XTRXInputThread *xtrxInputThread = 0;
|
||||
XTRXInputThread *xtrxInputThread = nullptr;
|
||||
|
||||
// find a buddy that has allocated the thread
|
||||
const std::vector<DeviceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||
@ -243,7 +243,7 @@ void XTRXInput::moveThreadToBuddy()
|
||||
if (buddySource)
|
||||
{
|
||||
buddySource->setThread(m_XTRXInputThread);
|
||||
m_XTRXInputThread = 0; // zero for others
|
||||
m_XTRXInputThread = nullptr; // zero for others
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -308,8 +308,9 @@ bool XTRXInput::start()
|
||||
xtrxInputThread->stopWork();
|
||||
delete xtrxInputThread;
|
||||
xtrxInputThread = new XTRXInputThread(m_deviceShared.m_dev->getDevice(), 2); // MI mode (2 channels)
|
||||
m_XTRXInputThread = xtrxInputThread; // take ownership
|
||||
xtrxInputThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_deviceShared.m_thread = xtrxInputThread;
|
||||
m_XTRXInputThread = xtrxInputThread; // take ownership
|
||||
|
||||
for (int i = 0; i < 2; i++) // restore original FIFO references
|
||||
{
|
||||
@ -394,8 +395,8 @@ void XTRXInput::stop()
|
||||
qDebug("XTRXInput::stop: SI mode. Just stop and delete the thread");
|
||||
xtrxInputThread->stopWork();
|
||||
delete xtrxInputThread;
|
||||
m_XTRXInputThread = 0;
|
||||
m_deviceShared.m_thread = 0;
|
||||
m_XTRXInputThread = nullptr;
|
||||
m_deviceShared.m_thread = nullptr;
|
||||
|
||||
// remove old thread address from buddies (reset in all buddies)
|
||||
const std::vector<DeviceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||
@ -410,6 +411,7 @@ void XTRXInput::stop()
|
||||
m_XTRXInputThread = xtrxInputThread; // take ownership
|
||||
m_deviceShared.m_thread = xtrxInputThread;
|
||||
|
||||
xtrxInputThread->setIQOrder(m_settings.m_iqOrder);
|
||||
xtrxInputThread->setFifo(requestedChannel, &m_sampleFifo);
|
||||
xtrxInputThread->setLog2Decimation(requestedChannel, m_settings.m_log2SoftDecim);
|
||||
|
||||
@ -1040,6 +1042,17 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (inputThread)
|
||||
{
|
||||
inputThread->setIQOrder(settings.m_iqOrder);
|
||||
qDebug() << "XTRXInput::applySettings: set IQ order to " << (settings.m_iqOrder ? "IQ" : "QI");
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
|
||||
{
|
||||
reverseAPIKeys.append("antennaPath");
|
||||
|
@ -43,6 +43,7 @@ void XTRXInputSettings::resetToDefaults()
|
||||
m_extClock = false;
|
||||
m_extClockFreq = 0; // Auto
|
||||
m_pwrmode = 1;
|
||||
m_iqOrder = true;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
@ -76,6 +77,7 @@ QByteArray XTRXInputSettings::serialize() const
|
||||
s.writeString(23, m_reverseAPIAddress);
|
||||
s.writeU32(24, m_reverseAPIPort);
|
||||
s.writeU32(25, m_reverseAPIDeviceIndex);
|
||||
s.writeBool(26, m_iqOrder);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -127,6 +129,7 @@ bool XTRXInputSettings::deserialize(const QByteArray& data)
|
||||
|
||||
d.readU32(25, &uintval, 0);
|
||||
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||
d.readBool(26, &m_iqOrder, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ struct XTRXInputSettings
|
||||
bool m_extClock; //!< True if external clock source
|
||||
uint32_t m_extClockFreq; //!< Frequency (Hz) of external clock source
|
||||
uint32_t m_pwrmode;
|
||||
bool m_iqOrder;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
@ -29,7 +29,8 @@ XTRXInputThread::XTRXInputThread(struct xtrx_dev *dev, unsigned int nbChannels,
|
||||
m_running(false),
|
||||
m_dev(dev),
|
||||
m_nbChannels(nbChannels),
|
||||
m_uniqueChannelIndex(uniqueChannelIndex)
|
||||
m_uniqueChannelIndex(uniqueChannelIndex),
|
||||
m_iqOrder(true)
|
||||
{
|
||||
qDebug("XTRXInputThread::XTRXInputThread: nbChannels: %u uniqueChannelIndex: %u", nbChannels, uniqueChannelIndex);
|
||||
m_channels = new Channel[2];
|
||||
@ -150,10 +151,17 @@ void XTRXInputThread::run()
|
||||
qDebug("XTRXInputThread::run: overflow");
|
||||
}
|
||||
|
||||
if (m_nbChannels > 1) {
|
||||
if (m_nbChannels > 1)
|
||||
{
|
||||
callbackMI((const qint16*) buffs[0], (const qint16*) buffs[1], 2 * nfo.out_samples);
|
||||
} else {
|
||||
callbackSI((const qint16*) buffs[0], 2 * nfo.out_samples);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_iqOrder) {
|
||||
callbackSIIQ((const qint16*) buffs[0], 2 * nfo.out_samples);
|
||||
} else {
|
||||
callbackSIQI((const qint16*) buffs[0], 2 * nfo.out_samples);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,35 +231,73 @@ SampleSinkFifo *XTRXInputThread::getFifo(unsigned int channel)
|
||||
}
|
||||
}
|
||||
|
||||
void XTRXInputThread::callbackSI(const qint16* buf, qint32 len)
|
||||
void XTRXInputThread::callbackSIIQ(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[m_uniqueChannelIndex].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[m_uniqueChannelIndex].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[m_uniqueChannelIndex].m_decimators.decimate1(&it, buf, len);
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsIQ.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_channels[m_uniqueChannelIndex].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[m_uniqueChannelIndex].m_decimators.decimate2_cen(&it, buf, len);
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsIQ.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[m_uniqueChannelIndex].m_decimators.decimate4_cen(&it, buf, len);
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsIQ.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[m_uniqueChannelIndex].m_decimators.decimate8_cen(&it, buf, len);
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsIQ.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[m_uniqueChannelIndex].m_decimators.decimate16_cen(&it, buf, len);
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsIQ.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[m_uniqueChannelIndex].m_decimators.decimate32_cen(&it, buf, len);
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsIQ.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[m_uniqueChannelIndex].m_decimators.decimate64_cen(&it, buf, len);
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsIQ.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_channels[m_uniqueChannelIndex].m_sampleFifo->write(m_channels[m_uniqueChannelIndex].m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void XTRXInputThread::callbackSIQI(const qint16* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator it = m_channels[m_uniqueChannelIndex].m_convertBuffer.begin();
|
||||
|
||||
if (m_channels[m_uniqueChannelIndex].m_log2Decim == 0)
|
||||
{
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsQI.decimate1(&it, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_channels[m_uniqueChannelIndex].m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsQI.decimate2_cen(&it, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsQI.decimate4_cen(&it, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsQI.decimate8_cen(&it, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsQI.decimate16_cen(&it, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsQI.decimate32_cen(&it, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_channels[m_uniqueChannelIndex].m_decimatorsQI.decimate64_cen(&it, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -267,10 +313,21 @@ void XTRXInputThread::callbackMI(const qint16* buf0, const qint16* buf1, qint32
|
||||
|
||||
// channel 0
|
||||
m_uniqueChannelIndex = 0;
|
||||
callbackSI(buf0, len);
|
||||
|
||||
if (m_iqOrder) {
|
||||
callbackSIIQ(buf0, len);
|
||||
} else {
|
||||
callbackSIQI(buf0, len);
|
||||
}
|
||||
|
||||
// channel 1
|
||||
m_uniqueChannelIndex = 1;
|
||||
callbackSI(buf1, len);
|
||||
|
||||
if (m_iqOrder) {
|
||||
callbackSIIQ(buf1, len);
|
||||
} else {
|
||||
callbackSIQI(buf1, len);
|
||||
}
|
||||
|
||||
m_uniqueChannelIndex = uniqueChannelIndex;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
unsigned int getLog2Decimation(unsigned int channel) const;
|
||||
void setFifo(unsigned int channel, SampleSinkFifo *sampleFifo);
|
||||
SampleSinkFifo *getFifo(unsigned int channel);
|
||||
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
|
||||
|
||||
private:
|
||||
struct Channel
|
||||
@ -54,7 +55,8 @@ private:
|
||||
SampleVector m_convertBuffer;
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
unsigned int m_log2Decim;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
||||
|
||||
Channel() :
|
||||
m_sampleFifo(0),
|
||||
@ -73,10 +75,12 @@ private:
|
||||
Channel *m_channels; //!< Array of channels dynamically allocated for the given number of Rx channels
|
||||
unsigned int m_nbChannels;
|
||||
unsigned int m_uniqueChannelIndex;
|
||||
bool m_iqOrder;
|
||||
|
||||
void run();
|
||||
unsigned int getNbFifos();
|
||||
void callbackSI(const qint16* buf, qint32 len);
|
||||
void callbackSIQI(const qint16* buf, qint32 len);
|
||||
void callbackSIIQ(const qint16* buf, qint32 len);
|
||||
void callbackMI(const qint16* buf0, const qint16* buf1, qint32 len);
|
||||
};
|
||||
|
||||
|
@ -388,7 +388,7 @@ struct TripleByteLE<qint64>
|
||||
#endif
|
||||
|
||||
/** Decimators with integer input and integer output */
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
class Decimators
|
||||
{
|
||||
public:
|
||||
@ -442,60 +442,68 @@ public:
|
||||
|
||||
private:
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator64; // 6th stages
|
||||
#else
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQorder> m_decimator64; // 6th stages
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 1; pos += 2)
|
||||
{
|
||||
xreal = buf[pos+0];
|
||||
yimag = buf[pos+1];
|
||||
xreal = IQorder ? buf[pos+0] : buf[pos+1];
|
||||
yimag = IQorder ? buf[pos+1] : buf[pos+0];
|
||||
(**it).setReal(xreal << decimation_shifts<SdrBits, InputBits>::pre1); // Valgrind optim (2 - comment not repeated)
|
||||
(**it).setImag(yimag << decimation_shifts<SdrBits, InputBits>::pre1);
|
||||
++(*it); // Valgrind optim (comment not repeated)
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_u(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate2_u(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
xreal = (buf[pos+0] - buf[pos+3]) << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
yimag = (buf[pos+1] + buf[pos+2] - 255) << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
xreal = IQorder ?
|
||||
(buf[pos+0] - buf[pos+3]) << decimation_shifts<SdrBits, InputBits>::pre2 :
|
||||
(buf[pos+1] + buf[pos+2] - 255) << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
yimag = IQorder ?
|
||||
(buf[pos+1] + buf[pos+2] - 255) << decimation_shifts<SdrBits, InputBits>::pre2 :
|
||||
(buf[pos+0] - buf[pos+3]) << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
(**it).setReal(xreal >> decimation_shifts<SdrBits, InputBits>::post2);
|
||||
(**it).setImag(yimag >> decimation_shifts<SdrBits, InputBits>::post2);
|
||||
++(*it);
|
||||
|
||||
xreal = (buf[pos+7] - buf[pos+4]) << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
yimag = (255 - buf[pos+5] - buf[pos+6]) << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
xreal = IQorder ?
|
||||
(buf[pos+7] - buf[pos+4]) << decimation_shifts<SdrBits, InputBits>::pre2 :
|
||||
(255 - buf[pos+5] - buf[pos+6]) << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
yimag = IQorder ?
|
||||
(255 - buf[pos+5] - buf[pos+6]) << decimation_shifts<SdrBits, InputBits>::pre2 :
|
||||
(buf[pos+7] - buf[pos+4]) << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
(**it).setReal(xreal >> decimation_shifts<SdrBits, InputBits>::post2);
|
||||
(**it).setImag(yimag >> decimation_shifts<SdrBits, InputBits>::post2);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[4];
|
||||
|
||||
@ -522,8 +530,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_inf(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[4];
|
||||
|
||||
@ -550,8 +558,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_sup(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[4];
|
||||
|
||||
@ -578,8 +586,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_cen(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[8], buf4[4];
|
||||
|
||||
@ -628,8 +636,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_inf(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate4_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[8], buf4[4];
|
||||
|
||||
@ -678,8 +686,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_inf_txsync(Sample
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[8], buf4[4];
|
||||
|
||||
@ -728,8 +736,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_sup(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate4_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[8], buf4[4];
|
||||
|
||||
@ -778,8 +786,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_sup_txsync(Sample
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[8], buf4[4];
|
||||
|
||||
@ -821,8 +829,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_cen(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[16], buf4[8], buf8[4];
|
||||
|
||||
@ -894,8 +902,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_inf(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate8_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[16], buf4[8], buf8[4];
|
||||
|
||||
@ -937,8 +945,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_inf_txsync(Sample
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[16], buf4[8], buf8[4];
|
||||
|
||||
@ -1010,8 +1018,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_sup(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate8_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[16], buf4[8], buf8[4];
|
||||
|
||||
@ -1053,8 +1061,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_sup_txsync(Sample
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType intbuf[8];
|
||||
|
||||
@ -1113,8 +1121,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_cen(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[32], buf4[16], buf8[8], buf16[4];
|
||||
|
||||
@ -1246,8 +1254,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_inf(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate16_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[32], buf4[16], buf8[8], buf16[4];
|
||||
|
||||
@ -1296,8 +1304,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_inf_txsync(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[32], buf4[16], buf8[8], buf16[4];
|
||||
|
||||
@ -1429,8 +1437,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_sup(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate16_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[32], buf4[16], buf8[8], buf16[4];
|
||||
|
||||
@ -1479,8 +1487,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_sup_txsync(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType intbuf[16];
|
||||
|
||||
@ -1588,8 +1596,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_cen(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[64], buf4[32], buf8[16], buf16[8], buf32[4];
|
||||
|
||||
@ -1841,8 +1849,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_inf(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate32_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[64], buf4[32], buf8[16], buf16[8], buf32[4];
|
||||
|
||||
@ -1898,8 +1906,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_inf_txsync(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[64], buf4[32], buf8[16], buf16[8], buf32[4];
|
||||
|
||||
@ -2151,8 +2159,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_sup(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate32_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[64], buf4[32], buf8[16], buf16[8], buf32[4];
|
||||
|
||||
@ -2208,8 +2216,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_sup_txsync(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType intbuf[32];
|
||||
|
||||
@ -2414,8 +2422,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_cen(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[128], buf4[64], buf8[32], buf16[16], buf32[8], buf64[4];
|
||||
|
||||
@ -2907,8 +2915,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_inf(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate64_inf_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[128], buf4[64], buf8[32], buf16[16], buf32[8], buf64[4];
|
||||
|
||||
@ -2971,8 +2979,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_inf_txsync(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[128], buf4[64], buf8[32], buf16[16], buf32[8], buf64[4];
|
||||
|
||||
@ -3036,8 +3044,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_sup(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType intbuf[64];
|
||||
|
||||
@ -3436,8 +3444,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_cen(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate64_sup_txsync(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[128], buf4[64], buf8[32], buf16[16], buf32[8], buf64[4];
|
||||
|
||||
@ -3503,8 +3511,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_sup_txsync(Sampl
|
||||
|
||||
// ==============================================================================================================
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate1(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate1(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
|
||||
@ -3518,8 +3526,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate1(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_u(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate2_u(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
StorageType xreal, yimag;
|
||||
|
||||
@ -3541,8 +3549,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_u(SampleVector::i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate2_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
StorageType intbuf[2];
|
||||
|
||||
@ -3563,8 +3571,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_cen(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate4_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
StorageType intbuf[4];
|
||||
|
||||
@ -3598,8 +3606,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_cen(SampleVector:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate8_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
StorageType intbuf[8];
|
||||
|
||||
@ -3659,8 +3667,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_cen(SampleVector:
|
||||
}
|
||||
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate16_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
StorageType intbuf[16];
|
||||
|
||||
@ -3768,8 +3776,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_cen(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate32_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
StorageType intbuf[32];
|
||||
|
||||
@ -3974,8 +3982,8 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_cen(SampleVector
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, bool IQorder>
|
||||
void Decimators<StorageType, T, SdrBits, InputBits, IQorder>::decimate64_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
StorageType intbuf[64];
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -51,7 +51,7 @@ struct decimation_scale<16>
|
||||
};
|
||||
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
class DecimatorsIF {
|
||||
public:
|
||||
// interleaved I/Q input buffer
|
||||
@ -75,73 +75,73 @@ public:
|
||||
void decimate64_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ);
|
||||
void decimate64_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ);
|
||||
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER, IQOrder> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER, IQOrder> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER, IQOrder> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER, IQOrder> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER, IQOrder> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEOF<DECIMATORS_IF_FILTER_ORDER, IQOrder> m_decimator64; // 6th stages
|
||||
};
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate1(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate1(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < nbIAndQ - 1; pos += 2)
|
||||
{
|
||||
xreal = buf[pos+0] * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = buf[pos+1] * decimation_scale<InputBits>::scaleIn;
|
||||
xreal = (IQOrder ? buf[pos+0] : buf[pos+1]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (IQOrder ? buf[pos+1] : buf[pos+0]) * decimation_scale<InputBits>::scaleIn;
|
||||
(**it).setReal(xreal);
|
||||
(**it).setImag(yimag);
|
||||
++(*it); // Valgrind optim (comment not repeated)
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate2_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate2_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < nbIAndQ - 7; pos += 8)
|
||||
{
|
||||
xreal = (buf[pos+0] - buf[pos+3]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (buf[pos+1] + buf[pos+2]) * decimation_scale<InputBits>::scaleIn;
|
||||
xreal = (IQOrder ? (buf[pos+0] - buf[pos+3]) : (buf[pos+1] + buf[pos+2])) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (IQOrder ? (buf[pos+1] + buf[pos+2]) : (buf[pos+0] - buf[pos+3])) * decimation_scale<InputBits>::scaleIn;
|
||||
(**it).setReal(xreal);
|
||||
(**it).setImag(yimag);
|
||||
++(*it);
|
||||
|
||||
xreal = (buf[pos+7] - buf[pos+4]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (- buf[pos+5] - buf[pos+6]) * decimation_scale<InputBits>::scaleIn;
|
||||
xreal = (IQOrder ? (buf[pos+7] - buf[pos+4]) : (- buf[pos+5] - buf[pos+6])) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (IQOrder ? (- buf[pos+5] - buf[pos+6]) : (buf[pos+7] - buf[pos+4])) * decimation_scale<InputBits>::scaleIn;
|
||||
(**it).setReal(xreal);
|
||||
(**it).setImag(yimag);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate2_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate2_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < nbIAndQ - 7; pos += 8)
|
||||
{
|
||||
xreal = (buf[pos+1] - buf[pos+2]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (- buf[pos+0] - buf[pos+3]) * decimation_scale<InputBits>::scaleIn;
|
||||
xreal = (IQOrder ? (buf[pos+1] - buf[pos+2]) : (- buf[pos+0] - buf[pos+3])) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (IQOrder ? (- buf[pos+0] - buf[pos+3]) : (buf[pos+1] - buf[pos+2])) * decimation_scale<InputBits>::scaleIn;
|
||||
(**it).setReal(xreal);
|
||||
(**it).setImag(yimag);
|
||||
++(*it);
|
||||
|
||||
xreal = (buf[pos+6] - buf[pos+5]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (buf[pos+4] + buf[pos+7]) * decimation_scale<InputBits>::scaleIn;
|
||||
xreal = (IQOrder ? (buf[pos+6] - buf[pos+5]) : (buf[pos+4] + buf[pos+7])) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (IQOrder ? (buf[pos+4] + buf[pos+7]) : (buf[pos+6] - buf[pos+5])) * decimation_scale<InputBits>::scaleIn;
|
||||
(**it).setReal(xreal);
|
||||
(**it).setImag(yimag);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate2_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate2_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float intbuf[2];
|
||||
|
||||
@ -163,15 +163,19 @@ void DecimatorsIF<T, InputBits>::decimate2_cen(FSampleVector::iterator* it, cons
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate4_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate4_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < nbIAndQ - 7; pos += 8)
|
||||
{
|
||||
xreal = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) * decimation_scale<InputBits>::scaleIn;
|
||||
xreal = IQOrder ?
|
||||
(buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) * decimation_scale<InputBits>::scaleIn :
|
||||
(buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = IQOrder ?
|
||||
(buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) * decimation_scale<InputBits>::scaleIn :
|
||||
(buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) * decimation_scale<InputBits>::scaleIn;
|
||||
|
||||
(**it).setReal(xreal);
|
||||
(**it).setImag(yimag);
|
||||
@ -180,15 +184,19 @@ void DecimatorsIF<T, InputBits>::decimate4_inf(FSampleVector::iterator* it, cons
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate4_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate4_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < nbIAndQ - 7; pos += 8)
|
||||
{
|
||||
xreal = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) * decimation_scale<InputBits>::scaleIn;
|
||||
xreal = IQOrder ?
|
||||
(buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) * decimation_scale<InputBits>::scaleIn :
|
||||
(- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) * decimation_scale<InputBits>::scaleIn;
|
||||
yimag = IQOrder ?
|
||||
(- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) * decimation_scale<InputBits>::scaleIn :
|
||||
(buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) * decimation_scale<InputBits>::scaleIn;
|
||||
|
||||
(**it).setReal(xreal);
|
||||
(**it).setImag(yimag);
|
||||
@ -197,8 +205,8 @@ void DecimatorsIF<T, InputBits>::decimate4_sup(FSampleVector::iterator* it, cons
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate4_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate4_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float intbuf[4];
|
||||
|
||||
@ -232,8 +240,8 @@ void DecimatorsIF<T, InputBits>::decimate4_cen(FSampleVector::iterator* it, cons
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate8_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate8_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal[2], yimag[2];
|
||||
|
||||
@ -255,8 +263,8 @@ void DecimatorsIF<T, InputBits>::decimate8_inf(FSampleVector::iterator* it, cons
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate8_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate8_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal[2], yimag[2];
|
||||
|
||||
@ -278,8 +286,8 @@ void DecimatorsIF<T, InputBits>::decimate8_sup(FSampleVector::iterator* it, cons
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate8_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate8_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float intbuf[8];
|
||||
|
||||
@ -338,8 +346,8 @@ void DecimatorsIF<T, InputBits>::decimate8_cen(FSampleVector::iterator* it, cons
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate16_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate16_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal[4], yimag[4];
|
||||
|
||||
@ -364,8 +372,8 @@ void DecimatorsIF<T, InputBits>::decimate16_inf(FSampleVector::iterator* it, con
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate16_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate16_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal[4], yimag[4];
|
||||
|
||||
@ -390,8 +398,8 @@ void DecimatorsIF<T, InputBits>::decimate16_sup(FSampleVector::iterator* it, con
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate16_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate16_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float intbuf[16];
|
||||
|
||||
@ -499,8 +507,8 @@ void DecimatorsIF<T, InputBits>::decimate16_cen(FSampleVector::iterator* it, con
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate32_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate32_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal[8], yimag[8];
|
||||
|
||||
@ -530,8 +538,8 @@ void DecimatorsIF<T, InputBits>::decimate32_inf(FSampleVector::iterator* it, con
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate32_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate32_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal[8], yimag[8];
|
||||
|
||||
@ -561,8 +569,8 @@ void DecimatorsIF<T, InputBits>::decimate32_sup(FSampleVector::iterator* it, con
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate32_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate32_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float intbuf[32];
|
||||
|
||||
@ -767,8 +775,8 @@ void DecimatorsIF<T, InputBits>::decimate32_cen(FSampleVector::iterator* it, con
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate64_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate64_inf(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal[16], yimag[16];
|
||||
|
||||
@ -807,8 +815,8 @@ void DecimatorsIF<T, InputBits>::decimate64_inf(FSampleVector::iterator* it, con
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate64_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate64_sup(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float xreal[16], yimag[16];
|
||||
|
||||
@ -847,8 +855,8 @@ void DecimatorsIF<T, InputBits>::decimate64_sup(FSampleVector::iterator* it, con
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint InputBits>
|
||||
void DecimatorsIF<T, InputBits>::decimate64_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
template<typename T, uint InputBits, bool IQOrder>
|
||||
void DecimatorsIF<T, InputBits, IQOrder>::decimate64_cen(FSampleVector::iterator* it, const T* buf, qint32 nbIAndQ)
|
||||
{
|
||||
float intbuf[64];
|
||||
|
||||
|
@ -173,7 +173,7 @@ struct decimation_shifts<24, 8>
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
class DecimatorsU
|
||||
{
|
||||
public:
|
||||
@ -200,39 +200,39 @@ public:
|
||||
|
||||
private:
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO<qint64, qint64, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator64; // 6th stages
|
||||
#else
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO<qint32, qint32, DECIMATORS_HB_FILTER_ORDER, IQOrder> m_decimator64; // 6th stages
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 1; pos += 2)
|
||||
{
|
||||
xreal = buf[pos+0] - Shift;
|
||||
yimag = buf[pos+1] - Shift;
|
||||
xreal = IQOrder ? buf[pos+0] - Shift : buf[pos+1] - Shift;
|
||||
yimag = IQOrder ? buf[pos+1] - Shift : buf[pos+0] - Shift;
|
||||
(**it).setReal(xreal << decimation_shifts<SdrBits, InputBits>::pre1); // Valgrind optim (2 - comment not repeated)
|
||||
(**it).setImag(yimag << decimation_shifts<SdrBits, InputBits>::pre1);
|
||||
++(*it); // Valgrind optim (comment not repeated)
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[4];
|
||||
|
||||
@ -259,8 +259,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate2_inf(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[4];
|
||||
|
||||
@ -287,8 +287,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate2_sup(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[8], buf4[4];
|
||||
|
||||
@ -337,8 +337,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate4_inf(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[8], buf4[4];
|
||||
|
||||
@ -387,8 +387,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate4_sup(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[16], buf4[8], buf8[4];
|
||||
|
||||
@ -463,8 +463,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate8_inf(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[16], buf4[8], buf8[4];
|
||||
|
||||
@ -539,8 +539,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate8_sup(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[32], buf4[16], buf8[8], buf16[4];
|
||||
|
||||
@ -679,8 +679,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate16_inf(Samp
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[32], buf4[16], buf8[8], buf16[4];
|
||||
|
||||
@ -819,8 +819,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate16_sup(Samp
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[64], buf4[32], buf8[16], buf16[8], buf32[4];
|
||||
|
||||
@ -1087,8 +1087,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate32_inf(Samp
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[64], buf4[32], buf8[16], buf16[8], buf32[4];
|
||||
|
||||
@ -1355,8 +1355,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate32_sup(Samp
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[128], buf4[64], buf8[32], buf16[16], buf32[8], buf64[4];
|
||||
|
||||
@ -1879,8 +1879,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate64_inf(Samp
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[128], buf4[64], buf8[32], buf16[16], buf32[8], buf64[4];
|
||||
|
||||
@ -2403,8 +2403,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate64_sup(Samp
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[4];
|
||||
|
||||
@ -2431,8 +2431,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate2_cen(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType buf2[8], buf4[4];
|
||||
|
||||
@ -2474,8 +2474,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate4_cen(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType intbuf[8];
|
||||
|
||||
@ -2534,8 +2534,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate8_cen(Sampl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType intbuf[16];
|
||||
|
||||
@ -2643,8 +2643,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate16_cen(Samp
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType intbuf[32];
|
||||
|
||||
@ -2849,8 +2849,8 @@ void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate32_cen(Samp
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename StorageType, typename T, uint SdrBits, uint InputBits, int Shift, bool IQOrder>
|
||||
void DecimatorsU<StorageType, T, SdrBits, InputBits, Shift, IQOrder>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
StorageType intbuf[64];
|
||||
|
||||
|
@ -164,43 +164,43 @@ void DownChannelizer::applyDecimation()
|
||||
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
DownChannelizer::FilterStage::FilterStage(Mode mode) :
|
||||
m_filter(new IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>),
|
||||
m_filter(new IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER, true>),
|
||||
m_workFunction(0),
|
||||
m_mode(mode),
|
||||
m_sse(true)
|
||||
{
|
||||
switch(mode) {
|
||||
case ModeCenter:
|
||||
m_workFunction = &IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateCenter;
|
||||
m_workFunction = &IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER, true>::workDecimateCenter;
|
||||
break;
|
||||
|
||||
case ModeLowerHalf:
|
||||
m_workFunction = &IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateLowerHalf;
|
||||
m_workFunction = &IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER, true>::workDecimateLowerHalf;
|
||||
break;
|
||||
|
||||
case ModeUpperHalf:
|
||||
m_workFunction = &IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateUpperHalf;
|
||||
m_workFunction = &IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER, true>::workDecimateUpperHalf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
DownChannelizer::FilterStage::FilterStage(Mode mode) :
|
||||
m_filter(new IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>),
|
||||
m_filter(new IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER, true>),
|
||||
m_workFunction(0),
|
||||
m_mode(mode),
|
||||
m_sse(true)
|
||||
{
|
||||
switch(mode) {
|
||||
case ModeCenter:
|
||||
m_workFunction = &IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateCenter;
|
||||
m_workFunction = &IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER, true>::workDecimateCenter;
|
||||
break;
|
||||
|
||||
case ModeLowerHalf:
|
||||
m_workFunction = &IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateLowerHalf;
|
||||
m_workFunction = &IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER, true>::workDecimateLowerHalf;
|
||||
break;
|
||||
|
||||
case ModeUpperHalf:
|
||||
m_workFunction = &IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateUpperHalf;
|
||||
m_workFunction = &IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER, true>::workDecimateUpperHalf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -53,11 +53,11 @@ protected:
|
||||
};
|
||||
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
typedef bool (IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* s);
|
||||
IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
typedef bool (IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER, true>::*WorkFunction)(Sample* s);
|
||||
IntHalfbandFilterEO<qint64, qint64, DOWNCHANNELIZER_HB_FILTER_ORDER, true>* m_filter;
|
||||
#else
|
||||
typedef bool (IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* s);
|
||||
IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
typedef bool (IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER, true>::*WorkFunction)(Sample* s);
|
||||
IntHalfbandFilterEO<qint32, qint32, DOWNCHANNELIZER_HB_FILTER_ORDER, true>* m_filter;
|
||||
#endif
|
||||
|
||||
WorkFunction m_workFunction;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "dsp/hbfiltertraits.h"
|
||||
|
||||
template<typename EOStorageType, typename AccuType, uint32_t HBFilterOrder>
|
||||
template<typename EOStorageType, typename AccuType, uint32_t HBFilterOrder, bool IQorder>
|
||||
class IntHalfbandFilterEO {
|
||||
public:
|
||||
IntHalfbandFilterEO()
|
||||
@ -800,17 +800,17 @@ protected:
|
||||
{
|
||||
if ((m_ptr % 2) == 0)
|
||||
{
|
||||
m_even[0][m_ptr/2] = sampleI;
|
||||
m_even[1][m_ptr/2] = sampleQ;
|
||||
m_even[0][m_ptr/2 + m_size] = sampleI;
|
||||
m_even[1][m_ptr/2 + m_size] = sampleQ;
|
||||
m_even[0][m_ptr/2] = IQorder ? sampleI : sampleQ;
|
||||
m_even[1][m_ptr/2] = IQorder ? sampleQ : sampleI;
|
||||
m_even[0][m_ptr/2 + m_size] = IQorder ? sampleI : sampleQ;
|
||||
m_even[1][m_ptr/2 + m_size] = IQorder ? sampleQ : sampleI;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_odd[0][m_ptr/2] = sampleI;
|
||||
m_odd[1][m_ptr/2] = sampleQ;
|
||||
m_odd[0][m_ptr/2 + m_size] = sampleI;
|
||||
m_odd[1][m_ptr/2 + m_size] = sampleQ;
|
||||
m_odd[0][m_ptr/2] = IQorder ? sampleI : sampleQ;
|
||||
m_odd[1][m_ptr/2] = IQorder ? sampleQ : sampleI;
|
||||
m_odd[0][m_ptr/2 + m_size] = IQorder ? sampleI : sampleQ;
|
||||
m_odd[1][m_ptr/2 + m_size] = IQorder ? sampleQ : sampleI;
|
||||
}
|
||||
}
|
||||
|
||||
@ -818,17 +818,17 @@ protected:
|
||||
{
|
||||
if ((m_ptr % 2) == 0)
|
||||
{
|
||||
m_even[0][m_ptr/2] = x;
|
||||
m_even[1][m_ptr/2] = y;
|
||||
m_even[0][m_ptr/2 + m_size] = x;
|
||||
m_even[1][m_ptr/2 + m_size] = y;
|
||||
m_even[0][m_ptr/2] = IQorder ? x : y;
|
||||
m_even[1][m_ptr/2] = IQorder ? y : x;
|
||||
m_even[0][m_ptr/2 + m_size] = IQorder ? x : y;
|
||||
m_even[1][m_ptr/2 + m_size] = IQorder ? y : x;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_odd[0][m_ptr/2] = x;
|
||||
m_odd[1][m_ptr/2] = y;
|
||||
m_odd[0][m_ptr/2 + m_size] = x;
|
||||
m_odd[1][m_ptr/2 + m_size] = y;
|
||||
m_odd[0][m_ptr/2] = IQorder ? x : y;
|
||||
m_odd[1][m_ptr/2] = IQorder ? y : x;
|
||||
m_odd[0][m_ptr/2 + m_size] = IQorder ? x : y;
|
||||
m_odd[1][m_ptr/2 + m_size] = IQorder ? y : x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "dsp/hbfiltertraits.h"
|
||||
#include "export.h"
|
||||
|
||||
template<uint32_t HBFilterOrder>
|
||||
template<uint32_t HBFilterOrder, bool IQOrder>
|
||||
class IntHalfbandFilterEOF {
|
||||
public:
|
||||
IntHalfbandFilterEOF();
|
||||
@ -152,17 +152,17 @@ protected:
|
||||
{
|
||||
if ((m_ptr % 2) == 0)
|
||||
{
|
||||
m_even[0][m_ptr/2] = x;
|
||||
m_even[1][m_ptr/2] = y;
|
||||
m_even[0][m_ptr/2 + m_size] = x;
|
||||
m_even[1][m_ptr/2 + m_size] = y;
|
||||
m_even[0][m_ptr/2] = IQOrder ? x : y;
|
||||
m_even[1][m_ptr/2] = IQOrder ? y : x;
|
||||
m_even[0][m_ptr/2 + m_size] = IQOrder ? x : y;
|
||||
m_even[1][m_ptr/2 + m_size] = IQOrder ? y : x;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_odd[0][m_ptr/2] = x;
|
||||
m_odd[1][m_ptr/2] = y;
|
||||
m_odd[0][m_ptr/2 + m_size] = x;
|
||||
m_odd[1][m_ptr/2 + m_size] = y;
|
||||
m_odd[0][m_ptr/2] = IQOrder ? x : y;
|
||||
m_odd[1][m_ptr/2] = IQOrder ? y : x;
|
||||
m_odd[0][m_ptr/2 + m_size] = IQOrder ? x : y;
|
||||
m_odd[1][m_ptr/2 + m_size] = IQOrder ? y : x;
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,8 +233,8 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
template<uint32_t HBFilterOrder>
|
||||
IntHalfbandFilterEOF<HBFilterOrder>::IntHalfbandFilterEOF()
|
||||
template<uint32_t HBFilterOrder, bool IQOrder>
|
||||
IntHalfbandFilterEOF<HBFilterOrder, IQOrder>::IntHalfbandFilterEOF()
|
||||
{
|
||||
m_size = HBFIRFilterTraits<HBFilterOrder>::hbOrder/2;
|
||||
|
||||
|
@ -68,10 +68,10 @@ private:
|
||||
std::uniform_real_distribution<float> m_uniform_distribution_f;
|
||||
std::uniform_int_distribution<qint16> m_uniform_distribution_s16;
|
||||
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimatorsII;
|
||||
DecimatorsIF<qint16, 12> m_decimatorsIF;
|
||||
DecimatorsFI m_decimatorsFI;
|
||||
DecimatorsFF m_decimatorsFF;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsII;
|
||||
DecimatorsIF<qint16, 12, true> m_decimatorsIF;
|
||||
DecimatorsFI<true> m_decimatorsFI;
|
||||
DecimatorsFF<true> m_decimatorsFF;
|
||||
|
||||
SampleVector m_convertBuffer;
|
||||
FSampleVector m_convertBufferF;
|
||||
|
Loading…
Reference in New Issue
Block a user