Waterfall brightness/overlap.

This commit is contained in:
John Greb 2014-06-10 12:24:52 +01:00
parent 243f3dbf69
commit bbe6d4505d
4 changed files with 13 additions and 14 deletions

View File

@ -80,12 +80,12 @@ void RTLSDRThread::decimate2(SampleVector::iterator* it, const quint8* buf, qint
for (int pos = 0; pos < len + 7; pos += 8) {
xreal = buf[pos+0] - buf[pos+3];
yimag = buf[pos+1] + buf[pos+2] - 255;
Sample s( xreal << 6, yimag << 6 );
Sample s( xreal << 3, yimag << 3 );
**it = s;
(*it)++;
xreal = buf[pos+7] - buf[pos+4];
yimag = 255 - buf[pos+5] - buf[pos+6];
Sample t( xreal << 6, yimag << 6 );
Sample t( xreal << 3, yimag << 3 );
**it = t;
(*it)++;
}
@ -96,7 +96,7 @@ void RTLSDRThread::decimate4(SampleVector::iterator* it, const quint8* buf, qint
for (int pos = 0; pos < len + 7; pos += 8) {
xreal = buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4];
yimag = buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6];
Sample s( xreal << 5, yimag << 5 );
Sample s( xreal << 3, yimag << 3 );
**it = s;
(*it)++;
}
@ -112,7 +112,7 @@ void RTLSDRThread::decimate8(SampleVector::iterator* it, const quint8* buf, qint
xreal += buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4];
yimag += buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6];
Sample s( xreal << 4, yimag << 4 );
Sample s( xreal << 3, yimag << 3 );
**it = s;
(*it)++;
}
@ -140,8 +140,9 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
{
qint16 xreal, yimag, phase;
SampleVector::iterator it = m_convertBuffer.begin();
int decimationFactor[] = {16, 8, 4, 2, 1, 0};
if (++localdecimation < (1 << (4 - m_decimation))) return;
if (++localdecimation < decimationFactor[m_decimation]) return;
localdecimation = 0;
switch(m_decimation) {
@ -152,10 +153,10 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
phase *= -1;
xreal = phase * (buf[pos+0] - 127);
yimag = phase * (buf[pos+1] - 127);
*it++ = Sample( xreal<<7,yimag<<7);
*it++ = Sample( xreal<<3,yimag<<3);
xreal = phase * (127 - buf[pos+3]);
yimag = phase * (buf[pos+2] - 127);
*it++ = Sample( xreal<<7,yimag<<7);
*it++ = Sample( xreal<<3,yimag<<3);
}
break;
case 1: // 1:2

View File

@ -20,7 +20,7 @@ SpectrumVis::SpectrumVis(GLSpectrum* glSpectrum) :
m_fftBufferFill(0),
m_glSpectrum(glSpectrum)
{
handleConfigure(1024, 10, FFTWindow::BlackmanHarris);
handleConfigure(1024, 0, FFTWindow::BlackmanHarris);
}
SpectrumVis::~SpectrumVis()

View File

@ -270,9 +270,7 @@ void GLSpectrum::updateWaterfall(const std::vector<Real>& spectrum)
quint32* pix = (quint32*)m_waterfallBuffer->scanLine(m_waterfallBufferPos);
for(int i = 0; i < m_fftSize; i++) {
Real vr = (int)((spectrum[i] - m_referenceLevel) * 2.4 * 100.0 / m_powerRange + 240.0);
int v = (int)vr;
int v = (int)((spectrum[i] - m_referenceLevel) * 2.4 * 100.0 / m_powerRange + 240.0);
if(v > 239)
v = 239;
else if(v < 0)

View File

@ -12,7 +12,7 @@ GLSpectrumGUI::GLSpectrumGUI(QWidget* parent) :
m_spectrumVis(NULL),
m_glSpectrum(NULL),
m_fftSize(1024),
m_fftOverlap(10),
m_fftOverlap(0),
m_fftWindow(FFTWindow::Hamming),
m_refLevel(0),
m_powerRange(100),
@ -47,7 +47,7 @@ void GLSpectrumGUI::setBuddies(MessageQueue* messageQueue, SpectrumVis* spectrum
void GLSpectrumGUI::resetToDefaults()
{
m_fftSize = 1024;
m_fftOverlap = 10;
m_fftOverlap = 0;
m_fftWindow = FFTWindow::Hamming;
m_refLevel = 0;
m_powerRange = 100;
@ -90,7 +90,7 @@ bool GLSpectrumGUI::deserialize(const QByteArray& data)
if(d.getVersion() == 1) {
d.readS32(1, &m_fftSize, 1024);
d.readS32(2, &m_fftOverlap, 10);
d.readS32(2, &m_fftOverlap, 0);
d.readS32(3, &m_fftWindow, FFTWindow::Hamming);
d.readReal(4, &m_refLevel, 0);
d.readReal(5, &m_powerRange, 100);