1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 15:51:47 -05:00

PVS-Studio static analysis corrections (2) issue #137

This commit is contained in:
f4exb 2018-02-22 03:04:42 +01:00
parent f01b90094b
commit 2b846f5d28
48 changed files with 160 additions and 147 deletions

View File

@ -28,6 +28,11 @@
#include "deviceplutosdrbox.h"
DevicePlutoSDRBox::DevicePlutoSDRBox(const std::string& uri) :
m_devSampleRate(0),
m_LOppmTenths(0),
m_lpfFIREnable(false),
m_lpfFIRBW(100.0f),
m_lpfFIRlog2Decim(0),
m_lpfFIRRxGain(0),
m_lpfFIRTxGain(0),
m_ctx(0),
@ -39,7 +44,8 @@ DevicePlutoSDRBox::DevicePlutoSDRBox(const std::string& uri) :
m_chnTx0q(0),
m_rxBuf(0),
m_txBuf(0),
m_xoInitial(0)
m_xoInitial(0),
m_temp(0.0f)
{
m_ctx = iio_create_context_from_uri(uri.c_str());

View File

@ -1,10 +1,10 @@
/***************************************************************************
* This file is part of Qthid.
*
*
* Copyright (C) 2010 Howard Long, G6LVB
* CopyRight (C) 2011 Alexandru Csete, OZ9AEC
* Mario Lorenz, DL5MLO
*
*
* Qthid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -40,7 +40,7 @@ hid_device *fcdOpen(uint16_t usVID, uint16_t usPID, int whichdongle)
while (phdi && which)
{
phdi=phdi->next;
phdi=phdi->next;
which--;
}
@ -611,7 +611,6 @@ FCD_MODE_ENUM fcdBlWriteFirmware(hid_device *phd, char *pc, int64_t n64Size)
uint32_t u32AddrStart;
uint32_t u32AddrEnd;
uint32_t u32Addr;
BOOL bFinished=FALSE;
/*
phd = fcdOpen();
@ -671,7 +670,7 @@ FCD_MODE_ENUM fcdBlWriteFirmware(hid_device *phd, char *pc, int64_t n64Size)
// Write blocks
aucBufOut[0] = 0; // Report ID, ignored
aucBufOut[1] = FCD_CMD_BL_WRITE_FLASH_BLOCK;
for (u32Addr=u32AddrStart; u32Addr+47<u32AddrEnd && u32Addr+47<n64Size && !bFinished; u32Addr+=48)
for (u32Addr=u32AddrStart; u32Addr+47<u32AddrEnd && u32Addr+47<n64Size; u32Addr+=48)
{
memcpy(&aucBufOut[3], &pc[u32Addr], 48);
@ -681,7 +680,6 @@ FCD_MODE_ENUM fcdBlWriteFirmware(hid_device *phd, char *pc, int64_t n64Size)
if (aucBufIn[0]!=FCD_CMD_BL_WRITE_FLASH_BLOCK || aucBufIn[1]!=1)
{
bFinished = TRUE;
/*
fcdClose(phd);
phd = NULL;*/
@ -715,7 +713,6 @@ FCD_MODE_ENUM fcdBlVerifyFirmware(hid_device *phd, char *pc, int64_t n64Size)
uint32_t u32AddrStart;
uint32_t u32AddrEnd;
uint32_t u32Addr;
BOOL bFinished=FALSE;
/*
phd = fcdOpen();
@ -776,7 +773,7 @@ FCD_MODE_ENUM fcdBlVerifyFirmware(hid_device *phd, char *pc, int64_t n64Size)
// Read blocks
aucBufOut[0] = 0; // Report ID, ignored
aucBufOut[1] = FCD_CMD_BL_READ_FLASH_BLOCK;
for (u32Addr=u32AddrStart; u32Addr+47<u32AddrEnd && u32Addr+47<n64Size && !bFinished; u32Addr+=48)
for (u32Addr=u32AddrStart; u32Addr+47<u32AddrEnd && u32Addr+47<n64Size; u32Addr+=48)
{
hid_write(phd, aucBufOut, 65);
memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
@ -784,7 +781,6 @@ FCD_MODE_ENUM fcdBlVerifyFirmware(hid_device *phd, char *pc, int64_t n64Size)
if (aucBufIn[0]!=FCD_CMD_BL_READ_FLASH_BLOCK || aucBufIn[1]!=1)
{
bFinished = TRUE;
/*
fcdClose(phd);
phd = NULL;*/
@ -794,7 +790,6 @@ FCD_MODE_ENUM fcdBlVerifyFirmware(hid_device *phd, char *pc, int64_t n64Size)
if (memcmp(&aucBufIn[2],&pc[u32Addr],48)!=0)
{
bFinished = TRUE;
/*
fcdClose(phd);
phd = NULL;*/

View File

@ -43,6 +43,9 @@ HttpSession::HttpSession(const HttpSession& other)
HttpSession& HttpSession::operator= (const HttpSession& other)
{
if (this == &other) {
return *this;
}
HttpSessionData* oldPtr=dataPtr;
dataPtr=other.dataPtr;
if (dataPtr)

View File

@ -168,8 +168,6 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
float fltQ;
Complex ci;
qint16 * ptrBufferToRelease = 0;
//********** Let's rock and roll buddy ! **********
m_objSettingsMutex.lock();
@ -178,6 +176,7 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
#ifdef EXTENDED_DIRECT_SAMPLE
qint16 * ptrBufferToRelease = 0;
qint16 * ptrBuffer;
qint32 intLen;
@ -232,10 +231,12 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_scopeSampleBuffer.clear();
}
#ifdef EXTENDED_DIRECT_SAMPLE
if (ptrBufferToRelease != 0)
{
delete ptrBufferToRelease;
}
#endif
m_objSettingsMutex.unlock();
}

View File

@ -59,6 +59,9 @@ void ATVDemodSettings::resetToDefaults()
m_blnVSync = false;
m_blnInvertVideo = false;
m_intVideoTabIndex = 0;
m_fltLineTimeMultiplier = 1.0f;
m_fltTopTimeMultiplier = 1.0f;
m_rfSliderDivisor = 1;
m_intTVSampleRate = 0;
m_intNumberSamplePerLine = 0;

View File

@ -27,12 +27,10 @@ const unsigned int RDSDecoder::syndrome[5] = {383,14,303,663,748};
RDSDecoder::RDSDecoder()
{
m_reg = 0;
m_sync = NO_SYNC;
m_presync = false;
m_lastseenOffsetCounter = 0;
m_bitCounter = 0;
m_lastseenOffset = 0;
m_wrongBlocksCounter = 0;
m_blocksCounter = 0;
m_blockBitCounter = 0;
m_blockNumber = 0;

View File

@ -50,6 +50,13 @@ RDSDemod::RDSDemod()
m_parms.reading_frame = 0;
m_parms.dbit = 0;
m_prev = 0.0f;
memset(m_xv, 0, 6*sizeof(Real));
memset(m_yv, 0, 6*sizeof(Real));
memset(m_xw, 0, 2*sizeof(Real));
memset(m_yw, 0, 2*sizeof(Real));
m_report.acc = 0.0f;
m_report.fclk = 0.0f;
m_report.qua = 0.0f;
}
RDSDemod::~RDSDemod()

View File

@ -261,6 +261,9 @@ void RDSParser::clearUpdateFlags()
m_g14_updated = false;
m_g14_data_available = false;
m_g15_updated = false;
radiotext_AB_flag = false;
debug = false;
log = false;
}
void RDSParser::clearAllFields()
@ -272,6 +275,8 @@ void RDSParser::clearAllFields()
m_pi_area_coverage_index = 0;
m_pi_country_identification = 0;
m_pi_traffic_program = false;
pi_country_identification = 0;
pi_program_reference_number = 0;
// Group 00 data
m_g0_count = 0;
@ -854,7 +859,7 @@ void RDSParser::decode_type8(unsigned int *group, bool B)
bool T = (group[1] >> 4) & 0x1; // 0 = user message, 1 = tuning info
bool F = (group[1] >> 3) & 0x1; // 0 = multi-group, 1 = single-group
bool D = (group[2] > 15) & 0x1; // 1 = diversion recommended
bool D = (group[2] >> 15) & 0x1; // 1 = diversion recommended
m_g8_diversion_recommended = D;
static unsigned long int free_format[4];

View File

@ -11,6 +11,7 @@ const int LoRaDemodSettings::bandwidths[] = {7813,15625,20833,31250,62500};
const int LoRaDemodSettings::nb_bandwidths = 5;
LoRaDemodSettings::LoRaDemodSettings() :
m_centerFrequency(0),
m_channelMarker(0),
m_spectrumGUI(0)
{

View File

@ -537,8 +537,8 @@ void ATVModGUI::on_cameraManualFPSEnable_toggled(bool checked)
{
ATVMod::MsgConfigureCameraData* message = ATVMod::MsgConfigureCameraData::create(
ui->camSelect->currentIndex(),
checked,
ui->cameraManualFPS->value() / 10.0f);
ui->cameraManualFPS->value() / 10.0f,
checked);
m_atvMod->getInputMessageQueue()->push(message);
}
@ -547,8 +547,8 @@ void ATVModGUI::on_cameraManualFPS_valueChanged(int value)
ui->cameraManualFPSText->setText(tr("%1 FPS").arg(value / 10.0f, 0, 'f', 1));
ATVMod::MsgConfigureCameraData* message = ATVMod::MsgConfigureCameraData::create(
ui->camSelect->currentIndex(),
ui->cameraManualFPSEnable->isChecked(),
value / 10.0f);
value / 10.0f,
ui->cameraManualFPSEnable->isChecked());
m_atvMod->getInputMessageQueue()->push(message);
}

View File

@ -34,6 +34,7 @@ void UDPSinkSettings::resetToDefaults()
m_inputSampleRate = 48000;
m_inputFrequencyOffset = 0;
m_rfBandwidth = 12500;
m_lowCutoff = 0.0f;
m_fmDeviation = 2500;
m_amModFactor = 0.95;
m_channelMute = false;

View File

@ -136,7 +136,7 @@ bool BladerfOutput::start()
if((m_bladerfThread = new BladerfOutputThread(m_dev, &m_sampleSourceFifo)) == 0)
{
qFatal("BladerfOutput::start: out of memory");
qCritical("BladerfOutput::start: out of memory");
stop();
return false;
}

View File

@ -92,7 +92,7 @@ bool FileSinkOutput::start()
if((m_fileSinkThread = new FileSinkThread(&m_ofstream, &m_sampleSourceFifo)) == 0)
{
qFatal("out of memory");
qCritical("out of memory");
stop();
return false;
}
@ -303,7 +303,7 @@ void FileSinkOutput::applySettings(const FileSinkSettings& settings, bool force)
if (m_fileSinkThread != 0)
{
m_fileSinkThread->setSamplerate(m_settings.m_sampleRate);
m_fileSinkThread->setLog2Interpolation(m_settings.m_log2Interp);
}
forwardChange = true;

View File

@ -118,7 +118,7 @@ bool HackRFOutput::start()
if((m_hackRFThread = new HackRFOutputThread(m_dev, &m_sampleSourceFifo)) == 0)
{
qFatal("HackRFOutput::start: out of memory");
qCritical("HackRFOutput::start: out of memory");
stop();
return false;
}

View File

@ -376,7 +376,7 @@ bool LimeSDROutput::start()
if ((m_limeSDROutputThread = new LimeSDROutputThread(&m_streamId, &m_sampleSourceFifo)) == 0)
{
qFatal("LimeSDROutput::start: cannot create thread");
qCritical("LimeSDROutput::start: cannot create thread");
stop();
return false;
}

View File

@ -78,7 +78,7 @@ bool PlutoSDROutput::start()
if ((m_plutoSDROutputThread = new PlutoSDROutputThread(PLUTOSDR_BLOCKSIZE_SAMPLES, m_deviceShared.m_deviceParams->getBox(), &m_sampleSourceFifo)) == 0)
{
qFatal("PlutoSDROutput::start: cannot create thread");
qCritical("PlutoSDROutput::start: cannot create thread");
stop();
return false;
}
@ -314,7 +314,6 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
{
bool forwardChangeOwnDSP = false;
bool forwardChangeOtherDSP = false;
bool suspendOwnThread = false;
bool ownThreadWasRunning = false;
bool suspendAllOtherThreads = false; // All others means Rx in fact
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
@ -334,11 +333,6 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
(m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
{
suspendAllOtherThreads = true;
suspendOwnThread = true;
}
else
{
suspendOwnThread = true;
}
if (suspendAllOtherThreads)
@ -361,13 +355,10 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
}
}
if (suspendOwnThread)
if (m_plutoSDROutputThread && m_plutoSDROutputThread->isRunning())
{
if (m_plutoSDROutputThread && m_plutoSDROutputThread->isRunning())
{
m_plutoSDROutputThread->stopWork();
ownThreadWasRunning = true;
}
m_plutoSDROutputThread->stopWork();
ownThreadWasRunning = true;
}
// apply settings
@ -479,11 +470,8 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
}
}
if (suspendOwnThread)
{
if (ownThreadWasRunning) {
m_plutoSDROutputThread->startWork();
}
if (ownThreadWasRunning) {
m_plutoSDROutputThread->startWork();
}
// TODO: forward changes to other (Rx) DSP

View File

@ -66,7 +66,7 @@ bool SDRdaemonSinkOutput::start()
if((m_sdrDaemonSinkThread = new SDRdaemonSinkThread(&m_sampleSourceFifo)) == 0)
{
qFatal("out of memory");
qCritical("out of memory");
stop();
return false;
}

View File

@ -165,7 +165,7 @@ bool AirspyInput::start()
if((m_airspyThread = new AirspyThread(m_dev, &m_sampleFifo)) == 0)
{
qFatal("AirspyInput::start: out of memory");
qCritical("AirspyInput::start: out of memory");
stop();
return false;
}

View File

@ -158,7 +158,7 @@ bool AirspyHFInput::start()
if ((m_airspyHFThread = new AirspyHFThread(m_dev, &m_sampleFifo)) == 0)
{
qFatal("AirspyHFInput::start: out of memory");
qCritical("AirspyHFInput::start: out of memory");
stop();
return false;
}

View File

@ -157,7 +157,7 @@ bool AirspyHFIInput::start()
if ((m_airspyHFThread = new AirspyHFIThread(m_dev, &m_sampleFifo)) == 0)
{
qFatal("AirspyHFInput::start: out of memory");
qCritical("AirspyHFInput::start: out of memory");
stop();
return false;
}

View File

@ -147,7 +147,7 @@ bool BladerfInput::start()
if (m_running) stop();
if((m_bladerfThread = new BladerfInputThread(m_dev, &m_sampleFifo)) == 0) {
qFatal("BladerfInput::start: out of memory");
qCritical("BladerfInput::start: out of memory");
stop();
return false;
}

View File

@ -123,7 +123,7 @@ bool FCDProInput::start()
if ((m_FCDThread = new FCDProThread(&m_sampleFifo)) == NULL)
{
qFatal("out of memory");
qCritical("out of memory");
return false;
}

View File

@ -117,7 +117,7 @@ bool FCDProPlusInput::start()
if ((m_FCDThread = new FCDProPlusThread(&m_sampleFifo)) == NULL)
{
qFatal("out of memory");
qCritical("out of memory");
return false;
}

View File

@ -146,7 +146,7 @@ bool FileSourceInput::start()
//openFileStream();
if((m_fileSourceThread = new FileSourceThread(&m_ifstream, &m_sampleFifo)) == NULL) {
qFatal("out of memory");
qCritical("out of memory");
stop();
return false;
}

View File

@ -134,7 +134,7 @@ bool HackRFInput::start()
if ((m_hackRFThread = new HackRFInputThread(m_dev, &m_sampleFifo)) == 0)
{
qFatal("HackRFInput::start: out of memory");
qCritical("HackRFInput::start: out of memory");
stop();
return false;
}

View File

@ -395,7 +395,7 @@ bool LimeSDRInput::start()
if ((m_limeSDRInputThread = new LimeSDRInputThread(&m_streamId, &m_sampleFifo)) == 0)
{
qFatal("LimeSDRInput::start: cannot create thread");
qCritical("LimeSDRInput::start: cannot create thread");
stop();
return false;
}

View File

@ -74,7 +74,7 @@ bool PerseusInput::start()
if ((m_perseusThread = new PerseusThread(m_perseusDescriptor, &m_sampleFifo)) == 0)
{
qFatal("PerseusInput::start: cannot create thread");
qCritical("PerseusInput::start: cannot create thread");
stop();
return false;
}

View File

@ -87,7 +87,7 @@ bool PlutoSDRInput::start()
if ((m_plutoSDRInputThread = new PlutoSDRInputThread(PLUTOSDR_BLOCKSIZE_SAMPLES, m_deviceShared.m_deviceParams->getBox(), &m_sampleFifo)) == 0)
{
qFatal("PlutoSDRInput::start: cannot create thread");
qCritical("PlutoSDRInput::start: cannot create thread");
stop();
return false;
}
@ -344,7 +344,6 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
{
bool forwardChangeOwnDSP = false;
bool forwardChangeOtherDSP = false;
bool suspendOwnThread = false;
bool ownThreadWasRunning = false;
bool suspendAllOtherThreads = false; // All others means Tx in fact
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
@ -364,11 +363,6 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
(m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
{
suspendAllOtherThreads = true;
suspendOwnThread = true;
}
else
{
suspendOwnThread = true;
}
if (suspendAllOtherThreads)
@ -391,13 +385,10 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
}
}
if (suspendOwnThread)
if (m_plutoSDRInputThread && m_plutoSDRInputThread->isRunning())
{
if (m_plutoSDRInputThread && m_plutoSDRInputThread->isRunning())
{
m_plutoSDRInputThread->stopWork();
ownThreadWasRunning = true;
}
m_plutoSDRInputThread->stopWork();
ownThreadWasRunning = true;
}
// apply settings
@ -557,11 +548,8 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
}
}
if (suspendOwnThread)
{
if (ownThreadWasRunning) {
m_plutoSDRInputThread->startWork();
}
if (ownThreadWasRunning) {
m_plutoSDRInputThread->startWork();
}
// TODO: forward changes to other (Tx) DSP

View File

@ -189,7 +189,7 @@ bool RTLSDRInput::start()
if ((m_rtlSDRThread = new RTLSDRThread(m_dev, &m_sampleFifo)) == NULL)
{
qFatal("RTLSDRInput::start: out of memory");
qCritical("RTLSDRInput::start: out of memory");
stop();
return false;
}

View File

@ -170,7 +170,7 @@ bool SDRPlayInput::start()
if((m_sdrPlayThread = new SDRPlayThread(m_dev, &m_sampleFifo)) == 0)
{
qFatal("SDRPlayInput::start: failed to create thread");
qCritical("SDRPlayInput::start: failed to create thread");
return false;
}

View File

@ -76,7 +76,7 @@ bool TestSourceInput::start()
if ((m_testSourceThread = new TestSourceThread(&m_sampleFifo)) == 0)
{
qFatal("TestSourceInput::start: out of memory");
qCritical("TestSourceInput::start: out of memory");
stop();
return false;
}
@ -257,10 +257,10 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for
}
}
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_frequencyShift != settings.m_frequencyShift)
|| (m_settings.m_log2Decim != settings.m_log2Decim) || force)
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_frequencyShift != settings.m_frequencyShift)
|| (m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
qint64 deviceCenterFrequency = settings.m_centerFrequency;
int frequencyShift = settings.m_frequencyShift;

View File

@ -263,7 +263,7 @@ bool AudioFifo::create(uint32_t numSamples)
if(m_fifo != 0)
{
delete[] m_fifo;
m_fifo = NULL;
m_fifo = 0;
}
m_size = 0;
@ -271,12 +271,8 @@ bool AudioFifo::create(uint32_t numSamples)
m_head = 0;
m_tail = 0;
if((m_fifo = new qint8[numSamples * m_sampleSize]) == 0)
{
qDebug("out of memory");
return false;
}
m_fifo = new qint8[numSamples * m_sampleSize];
m_size = numSamples;
return true;
return m_fifo != 0;
}

View File

@ -196,7 +196,7 @@ bool ChannelMarker::deserialize(const QByteArray& data)
d.readU32(6, &u32tmp, 9999);
setUDPSendPort(u32tmp);
d.readS32(7, &tmp, 0);
if ((tmp >= 0) || (tmp < FScaleDisplay_none)) {
if ((tmp >= 0) && (tmp < FScaleDisplay_none)) {
setFrequencyScaleDisplayType((frequencyScaleDisplay_t) tmp);
} else {
setFrequencyScaleDisplayType(FScaleDisplay_freq);

View File

@ -287,7 +287,6 @@ void CWKeyer::nextStateIambic()
{
if (m_dash)
{
m_samplePointer = 0;
m_keyIambicState = KeyDash;
}
else if (!m_dot)
@ -314,7 +313,6 @@ void CWKeyer::nextStateIambic()
{
if (m_dot)
{
m_samplePointer = 0;
m_keyIambicState = KeyDot;
}
else if (!m_dash)

View File

@ -15,12 +15,11 @@ FFTEngine* FFTEngine::create()
#ifdef USE_FFTW
qDebug("FFTEngine::create: using FFTW engine");
return new FFTWEngine;
#endif // USE_FFTW
#ifdef USE_KISSFFT
#elif USE_KISSFFT
qDebug("FFTEngine::create: using KissFFT engine");
return new KissEngine;
#endif // USE_KISSFFT
#else // USE_KISSFFT
qCritical("FFTEngine::create: no engine built");
return NULL;
return 0;
#endif
}

View File

@ -78,6 +78,8 @@ void fftfilt::init_filter()
fftfilt::fftfilt(float f1, float f2, int len)
{
flen = len;
pass = 0;
window = 0;
init_filter();
create_filter(f1, f2);
}
@ -85,6 +87,8 @@ fftfilt::fftfilt(float f1, float f2, int len)
fftfilt::fftfilt(float f2, int len)
{
flen = len;
pass = 0;
window = 0;
init_filter();
create_dsb_filter(f2);
}

View File

@ -38,7 +38,6 @@ protected:
int flen;
int flen2;
g_fft<float> *fft;
g_fft<float> *ift;
cmplx *filter;
cmplx *filterOpp;
cmplx *data;
@ -50,7 +49,7 @@ protected:
inline float fsinc(float fc, int i, int len) {
return (i == len/2) ? 2.0 * fc:
sin(2 * M_PI * fc * (i - len/2)) / (M_PI * (i - len/2));
sin(2 * M_PI * fc * (i - (len/2))) / (M_PI * (i - (len/2)));
}
inline float _blackman(int i, int len) {

View File

@ -65,13 +65,13 @@ private:
// base fft methods
void riffts1(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, short *BRLow);
void ifrstage(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl);
void ifrstage(FFT_TYPE *ioptr, int M, FFT_TYPE *inUtbl);
void rifft8pt(FFT_TYPE *ioptr, FFT_TYPE scale);
void rifft4pt(FFT_TYPE *ioptr, FFT_TYPE scale);
void rifft2pt(FFT_TYPE *ioptr, FFT_TYPE scale);
void rifft1pt(FFT_TYPE *ioptr, FFT_TYPE scale);
void rffts1(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, short *BRLow);
void frstage(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl);
void frstage(FFT_TYPE *ioptr, int M, FFT_TYPE *inUtbl);
void rfft8pt(FFT_TYPE *ioptr);
void rfft4pt(FFT_TYPE *ioptr);
void rfft2pt(FFT_TYPE *ioptr);
@ -79,27 +79,27 @@ private:
void iffts1(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, short *BRLow);
void ifftrecurs(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, int Ustride,
int NDiffU, int StageCnt);
void ibfstages(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, int Ustride,
void ibfstages(FFT_TYPE *ioptr, int M, FFT_TYPE *inUtbl, int Ustride,
int NDiffU, int StageCnt);
void ibfR4(FFT_TYPE *ioptr, int M, int NDiffU);
void ibfR2(FFT_TYPE *ioptr, int M, int NDiffU);
void ifft8pt(FFT_TYPE *ioptr, FFT_TYPE scale);
void ifft4pt(FFT_TYPE *ioptr, FFT_TYPE scale);
void ifft2pt(FFT_TYPE *ioptr, FFT_TYPE scale);
void scbitrevR2(FFT_TYPE *ioptr, int M, short *BRLow, FFT_TYPE scale);
void scbitrevR2(FFT_TYPE *ioptr, int M, short *inBRLow, FFT_TYPE scale);
void ffts1(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, short *BRLow);
void fftrecurs(FFT_TYPE *ioptr, int M,
FFT_TYPE *Utbl, int Ustride, int NDiffU,
int StageCnt);
void bfstages(FFT_TYPE *ioptr, int M,
FFT_TYPE *Utbl, int Ustride,
FFT_TYPE *inUtbl, int Ustride,
int NDiffU, int StageCnt);
void bfR4(FFT_TYPE *ioptr, int M, int NDiffU);
void bfR2(FFT_TYPE *ioptr, int M, int NDiffU);
void fft8pt(FFT_TYPE *ioptr);
void fft4pt(FFT_TYPE *ioptr);
void fft2pt(FFT_TYPE *ioptr);
void bitrevR2(FFT_TYPE *ioptr, int M, short *BRLow);
void bitrevR2(FFT_TYPE *ioptr, int M, short *inBRLow);
void fftBRInit(int M, short *BRLow);
void fftCosInit(int M, FFT_TYPE *Utbl);
@ -182,7 +182,7 @@ void g_fft<FFT_TYPE>::fftBRInit(int M, short *BRLow)
// bit reverse and first radix 2 stage of forward or inverse fft
//------------------------------------------------------------------------------
template <typename FFT_TYPE>
void g_fft<FFT_TYPE>::bitrevR2(FFT_TYPE *ioptr, int M, short *BRLow)
void g_fft<FFT_TYPE>::bitrevR2(FFT_TYPE *ioptr, int M, short *inBRLow)
{
FFT_TYPE f0r;
FFT_TYPE f0i;
@ -229,9 +229,9 @@ void g_fft<FFT_TYPE>::bitrevR2(FFT_TYPE *ioptr, int M, short *BRLow)
for (; ioptr < iolimit; ioptr += POW2(M / 2 + 1)) {
for (Colstart = Nroot_1; Colstart >= 0; Colstart--) {
iCol = Nroot_1;
p0r = ioptr + Nroot_1_ColInc + BRLow[Colstart] * 4;
p0r = ioptr + Nroot_1_ColInc + inBRLow[Colstart] * 4;
IOP = ioptr + (Colstart << ColstartShift);
p1r = IOP + BRLow[iCol] * 4;
p1r = IOP + inBRLow[iCol] * 4;
f0r = *(p0r);
f0i = *(p0r + 1);
f1r = *(p0r + posA);
@ -290,7 +290,7 @@ void g_fft<FFT_TYPE>::bitrevR2(FFT_TYPE *ioptr, int M, short *BRLow)
f1r = *(p0r + posA);
f1i = *(p0r + posAi);
iCol -= 1;
p1r = IOP + BRLow[iCol] * 4;
p1r = IOP + inBRLow[iCol] * 4;
}
f2r = *(p0r + 2);
f2i = *(p0r + (2 + 1));
@ -840,7 +840,7 @@ void g_fft<FFT_TYPE>::bfR4(FFT_TYPE *ioptr, int M, int NDiffU)
// RADIX 8 Stages
//------------------------------------------------------------------------------
template <typename FFT_TYPE>
void g_fft<FFT_TYPE>::bfstages(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, int Ustride,
void g_fft<FFT_TYPE>::bfstages(FFT_TYPE *ioptr, int M, FFT_TYPE *inUtbl, int Ustride,
int NDiffU, int StageCnt)
{
unsigned int pos;
@ -876,8 +876,8 @@ void g_fft<FFT_TYPE>::bfstages(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, int Ustri
U2toU3 = (POW2(M) / 8) * Ustride;
for (; StageCnt > 0; StageCnt--) {
u0r = &Utbl[0];
u0i = &Utbl[POW2(M - 2) * Ustride];
u0r = &inUtbl[0];
u0i = &inUtbl[POW2(M - 2) * Ustride];
u1r = u0r;
u1i = u0i;
u2r = u0r;
@ -1228,7 +1228,7 @@ void g_fft<FFT_TYPE>::ffts1(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, short *BRLow
// scaled bit reverse and first radix 2 stage forward or inverse fft
//------------------------------------------------------------------------------
template <typename FFT_TYPE>
void g_fft<FFT_TYPE>::scbitrevR2(FFT_TYPE *ioptr, int M, short *BRLow, FFT_TYPE scale)
void g_fft<FFT_TYPE>::scbitrevR2(FFT_TYPE *ioptr, int M, short *inBRLow, FFT_TYPE scale)
{
FFT_TYPE f0r;
FFT_TYPE f0i;
@ -1275,9 +1275,9 @@ void g_fft<FFT_TYPE>::scbitrevR2(FFT_TYPE *ioptr, int M, short *BRLow, FFT_TYPE
for (; ioptr < iolimit; ioptr += POW2(M / 2 + 1)) {
for (Colstart = Nroot_1; Colstart >= 0; Colstart--) {
iCol = Nroot_1;
p0r = ioptr + Nroot_1_ColInc + BRLow[Colstart] * 4;
p0r = ioptr + Nroot_1_ColInc + inBRLow[Colstart] * 4;
IOP = ioptr + (Colstart << ColstartShift);
p1r = IOP + BRLow[iCol] * 4;
p1r = IOP + inBRLow[iCol] * 4;
f0r = *(p0r);
f0i = *(p0r + 1);
f1r = *(p0r + posA);
@ -1336,7 +1336,7 @@ void g_fft<FFT_TYPE>::scbitrevR2(FFT_TYPE *ioptr, int M, short *BRLow, FFT_TYPE
f1r = *(p0r + posA);
f1i = *(p0r + posAi);
iCol -= 1;
p1r = IOP + BRLow[iCol] * 4;
p1r = IOP + inBRLow[iCol] * 4;
}
f2r = *(p0r + 2);
f2i = *(p0r + (2 + 1));
@ -1886,7 +1886,7 @@ void g_fft<FFT_TYPE>::ibfR4(FFT_TYPE *ioptr, int M, int NDiffU)
// RADIX 8 Stages
//------------------------------------------------------------------------------
template <typename FFT_TYPE>
void g_fft<FFT_TYPE>::ibfstages(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, int Ustride,
void g_fft<FFT_TYPE>::ibfstages(FFT_TYPE *ioptr, int M, FFT_TYPE *inUtbl, int Ustride,
int NDiffU, int StageCnt)
{
unsigned int pos;
@ -1922,8 +1922,8 @@ void g_fft<FFT_TYPE>::ibfstages(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl, int Ustr
U2toU3 = (POW2(M) / 8) * Ustride;
for (; StageCnt > 0; StageCnt--) {
u0r = &Utbl[0];
u0i = &Utbl[POW2(M - 2) * Ustride];
u0r = &inUtbl[0];
u0i = &inUtbl[POW2(M - 2) * Ustride];
u1r = u0r;
u1i = u0i;
u2r = u0r;
@ -2567,7 +2567,7 @@ void g_fft<FFT_TYPE>::rfft8pt(FFT_TYPE *ioptr)
// Finish RFFT
//------------------------------------------------------------------------------
template <typename FFT_TYPE>
void g_fft<FFT_TYPE>::frstage(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl)
void g_fft<FFT_TYPE>::frstage(FFT_TYPE *ioptr, int M, FFT_TYPE *inUtbl)
{
unsigned int pos;
unsigned int posi;
@ -2587,7 +2587,7 @@ void g_fft<FFT_TYPE>::frstage(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl)
p0r = ioptr;
p1r = ioptr + pos / 2;
u0r = Utbl + POW2(M - 3);
u0r = inUtbl + POW2(M - 3);
w0r = *u0r, f0r = *(p0r);
f0i = *(p0r + 1);
@ -2622,8 +2622,8 @@ void g_fft<FFT_TYPE>::frstage(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl)
*(p1r + pos) = f5r;
*(p1r + posi) = f5i;
u0r = Utbl + 1;
u0i = Utbl + (POW2(M - 2) - 1);
u0r = inUtbl + 1;
u0i = inUtbl + (POW2(M - 2) - 1);
w0r = *u0r, w0i = *u0i;
@ -3038,7 +3038,7 @@ void g_fft<FFT_TYPE>::rifft8pt(FFT_TYPE *ioptr, FFT_TYPE scale)
// Start RIFFT
//------------------------------------------------------------------------------
template <typename FFT_TYPE>
void g_fft<FFT_TYPE>::ifrstage(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl)
void g_fft<FFT_TYPE>::ifrstage(FFT_TYPE *ioptr, int M, FFT_TYPE *inUtbl)
{
unsigned int pos;
unsigned int posi;
@ -3058,7 +3058,7 @@ void g_fft<FFT_TYPE>::ifrstage(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl)
p0r = ioptr;
p1r = ioptr + pos / 2;
u0r = Utbl + POW2(M - 3);
u0r = inUtbl + POW2(M - 3);
w0r = *u0r, f0r = *(p0r);
f0i = *(p0r + 1);
@ -3093,8 +3093,8 @@ void g_fft<FFT_TYPE>::ifrstage(FFT_TYPE *ioptr, int M, FFT_TYPE *Utbl)
*(p1r + pos) = f5r;
*(p1r + posi) = f5i;
u0r = Utbl + 1;
u0i = Utbl + (POW2(M - 2) - 1);
u0r = inUtbl + 1;
u0i = inUtbl + (POW2(M - 2) - 1);
w0r = *u0r, w0i = *u0i;

View File

@ -42,6 +42,7 @@ NCO::NCO()
{
initTable();
m_phase = 0;
m_phaseIncrement = 0;
}
void NCO::setFreq(Real freq, Real sampleRate)

View File

@ -44,6 +44,7 @@ NCOF::NCOF()
{
initTable();
m_phase = 0.0f;
m_phaseIncrement = 0.0f;
}
void NCOF::setFreq(Real freq, Real sampleRate)

View File

@ -4,7 +4,7 @@
#include "settings/mainsettings.h"
#include "commands/command.h"
MainSettings::MainSettings()
MainSettings::MainSettings() : m_audioDeviceInfo(0)
{
resetToDefaults();
}

View File

@ -20,6 +20,9 @@ void Preset::resetToDefaults()
m_channelConfigs.clear();
m_sourceId.clear();
m_sourceConfig.clear();
m_dcOffsetCorrection = false;
m_iqImbalanceCorrection = false;
m_sourceSequence = 0;
}
QByteArray Preset::serialize() const

View File

@ -29,9 +29,9 @@ public:
void configure(MessageQueue* msgQueue,
uint triggerIndex,
TriggerChannel triggerChannel,
Real triggerLevel,
bool triggerPositiveEdge,
TriggerChannel triggerChannel,
Real triggerLevel,
bool triggerPositiveEdge,
bool triggerBothEdges,
uint triggerPre,
uint triggerDelay,
@ -57,8 +57,8 @@ private:
uint getTriggerIndex() const { return m_triggerIndex; }
int getTriggerChannel() const { return m_triggerChannel; }
Real getTriggerLevel() const { return m_triggerLevel; }
Real getTriggerPositiveEdge() const { return m_triggerPositiveEdge; }
Real getTriggerBothEdges() const { return m_triggerBothEdges; }
bool getTriggerPositiveEdge() const { return m_triggerPositiveEdge; }
bool getTriggerBothEdges() const { return m_triggerBothEdges; }
uint getTriggerPre() const { return m_triggerPre; }
uint getTriggerDelay() const { return m_triggerDelay; }
uint getTriggerCounts() const { return m_triggerCounts; }
@ -66,8 +66,8 @@ private:
static MsgConfigureScopeVis* create(uint triggerIndex,
int triggerChannel,
Real triggerLevel,
bool triggerPositiveEdge,
Real triggerLevel,
bool triggerPositiveEdge,
bool triggerBothEdges,
uint triggerPre,
uint triggerDelay,
@ -98,8 +98,8 @@ private:
MsgConfigureScopeVis(uint triggerIndex,
int triggerChannel,
Real triggerLevel,
bool triggerPositiveEdge,
Real triggerLevel,
bool triggerPositiveEdge,
bool triggerBothEdges,
uint triggerPre,
uint triggerDelay,
@ -120,7 +120,7 @@ private:
/**
* TriggerState: (repeat at each successive non freerun trigger)
*
*
* send a Trigger condition +--------------------+
* dummy trace - Immediate m_triggerOneShot | |
* Config -------------> Untriggered ----------------------------------> Triggered ----------------> WaitForReset |

View File

@ -731,7 +731,8 @@ private:
m_nbSources(1),
m_memSize(m_nbTraceMemories),
m_currentMemIndex(0),
m_traceSize(m_traceChunkSize)
m_traceSize(m_traceChunkSize),
m_preTrigCount(0)
{
m_traceBackBuffers.resize(m_nbSources);
m_sourceFill.resize(m_nbSources);

View File

@ -197,9 +197,12 @@ void SpectrumVis::handleConfigure(int fftSize, int overlapPercent, FFTWindow::Fu
{
m_overlapPercent = 0;
}
else
{
m_overlapPercent = overlapPercent;
}
m_fftSize = fftSize;
m_overlapPercent = overlapPercent;
m_fft->configure(m_fftSize, false);
m_window.create(window, m_fftSize);
m_overlapSize = (m_fftSize * m_overlapPercent) / 100;

View File

@ -1279,10 +1279,10 @@ void GLSpectrum::applyChanges()
if (sidebands == ChannelMarker::usb) {
nw = dv->m_channelMarker->getLowCutoff(); // negative bandwidth
pw = dv->m_channelMarker->getBandwidth() / 2; // positive bandwidth
pw = (dv->m_channelMarker->getBandwidth() / 2); // positive bandwidth
} else if (sidebands == ChannelMarker::lsb) {
pw = dv->m_channelMarker->getLowCutoff();
nw = dv->m_channelMarker->getBandwidth() / 2;
nw = (dv->m_channelMarker->getBandwidth() / 2);
} else if (sidebands == ChannelMarker::vusb) {
nw = -dv->m_channelMarker->getOppositeBandwidth(); // negative bandwidth
pw = dv->m_channelMarker->getBandwidth(); // positive bandwidth
@ -1554,7 +1554,7 @@ void GLSpectrum::applyChanges()
m_histogramBuffer = new QImage(m_fftSize, 100, QImage::Format_RGB32);
if(m_histogramBuffer != NULL)
if(m_histogramBuffer != 0)
{
m_histogramBuffer->fill(qRgb(0x00, 0x00, 0x00));
m_glShaderHistogram.initTexture(*m_histogramBuffer, QOpenGLTexture::ClampToEdge);
@ -1581,15 +1581,21 @@ void GLSpectrum::applyChanges()
void GLSpectrum::mouseMoveEvent(QMouseEvent* event)
{
if(m_displayWaterfall && (m_displayWaterfall || m_displayHistogram || m_displayMaxHold || m_displayCurrent)) {
if(m_frequencyScaleRect.contains(event->pos())) {
if(m_cursorState == CSNormal) {
if (m_displayWaterfall || m_displayHistogram || m_displayMaxHold || m_displayCurrent)
{
if(m_frequencyScaleRect.contains(event->pos()))
{
if(m_cursorState == CSNormal)
{
setCursor(Qt::SizeVerCursor);
m_cursorState = CSSplitter;
return;
}
} else {
if(m_cursorState == CSSplitter) {
}
else
{
if(m_cursorState == CSSplitter)
{
setCursor(Qt::ArrowCursor);
m_cursorState = CSNormal;
return;

View File

@ -46,11 +46,14 @@ ValueDial::ValueDial(QWidget* parent, ColorMapper colorMapper) :
}
m_value = 0;
m_valueNew = 0;
m_valueMin = 0;
m_valueMax = 2200000;
m_numDigits = 7;
m_numDecimalPoints = m_numDigits / 3;
m_cursor = -1;
m_digitWidth = 0;
m_digitHeight = 0;
m_hightlightedDigit = -1;
m_text = formatText(m_value);

View File

@ -50,11 +50,14 @@ ValueDialZ::ValueDialZ(bool positiveOnly, QWidget* parent, ColorMapper colorMapp
}
m_value = 0;
m_valueNew = 0;
m_valueMin = m_positiveOnly ? 0 : -2200000;
m_valueMax = 2200000;
m_numDigits = 7;
m_numDecimalPoints = m_numDigits / 3;
m_cursor = -1;
m_digitWidth = 0;
m_digitHeight = 0;
m_hightlightedDigit = -1;
m_text = formatText(m_value);
@ -428,7 +431,7 @@ void ValueDialZ::wheelEvent(QWheelEvent* event)
setValue(m_valueNew);
emit changed(m_valueNew);
event->accept();
event->accept();
}
}