mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-23 18:52:28 -04:00
Waterfall brightness/overlap.
This commit is contained in:
parent
243f3dbf69
commit
bbe6d4505d
@ -80,12 +80,12 @@ void RTLSDRThread::decimate2(SampleVector::iterator* it, const quint8* buf, qint
|
|||||||
for (int pos = 0; pos < len + 7; pos += 8) {
|
for (int pos = 0; pos < len + 7; pos += 8) {
|
||||||
xreal = buf[pos+0] - buf[pos+3];
|
xreal = buf[pos+0] - buf[pos+3];
|
||||||
yimag = buf[pos+1] + buf[pos+2] - 255;
|
yimag = buf[pos+1] + buf[pos+2] - 255;
|
||||||
Sample s( xreal << 6, yimag << 6 );
|
Sample s( xreal << 3, yimag << 3 );
|
||||||
**it = s;
|
**it = s;
|
||||||
(*it)++;
|
(*it)++;
|
||||||
xreal = buf[pos+7] - buf[pos+4];
|
xreal = buf[pos+7] - buf[pos+4];
|
||||||
yimag = 255 - buf[pos+5] - buf[pos+6];
|
yimag = 255 - buf[pos+5] - buf[pos+6];
|
||||||
Sample t( xreal << 6, yimag << 6 );
|
Sample t( xreal << 3, yimag << 3 );
|
||||||
**it = t;
|
**it = t;
|
||||||
(*it)++;
|
(*it)++;
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ void RTLSDRThread::decimate4(SampleVector::iterator* it, const quint8* buf, qint
|
|||||||
for (int pos = 0; pos < len + 7; pos += 8) {
|
for (int pos = 0; pos < len + 7; pos += 8) {
|
||||||
xreal = buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4];
|
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];
|
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 = s;
|
||||||
(*it)++;
|
(*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];
|
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];
|
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 = s;
|
||||||
(*it)++;
|
(*it)++;
|
||||||
}
|
}
|
||||||
@ -140,8 +140,9 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
|||||||
{
|
{
|
||||||
qint16 xreal, yimag, phase;
|
qint16 xreal, yimag, phase;
|
||||||
SampleVector::iterator it = m_convertBuffer.begin();
|
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;
|
localdecimation = 0;
|
||||||
|
|
||||||
switch(m_decimation) {
|
switch(m_decimation) {
|
||||||
@ -152,10 +153,10 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
|||||||
phase *= -1;
|
phase *= -1;
|
||||||
xreal = phase * (buf[pos+0] - 127);
|
xreal = phase * (buf[pos+0] - 127);
|
||||||
yimag = phase * (buf[pos+1] - 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]);
|
xreal = phase * (127 - buf[pos+3]);
|
||||||
yimag = phase * (buf[pos+2] - 127);
|
yimag = phase * (buf[pos+2] - 127);
|
||||||
*it++ = Sample( xreal<<7,yimag<<7);
|
*it++ = Sample( xreal<<3,yimag<<3);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: // 1:2
|
case 1: // 1:2
|
||||||
|
@ -20,7 +20,7 @@ SpectrumVis::SpectrumVis(GLSpectrum* glSpectrum) :
|
|||||||
m_fftBufferFill(0),
|
m_fftBufferFill(0),
|
||||||
m_glSpectrum(glSpectrum)
|
m_glSpectrum(glSpectrum)
|
||||||
{
|
{
|
||||||
handleConfigure(1024, 10, FFTWindow::BlackmanHarris);
|
handleConfigure(1024, 0, FFTWindow::BlackmanHarris);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpectrumVis::~SpectrumVis()
|
SpectrumVis::~SpectrumVis()
|
||||||
|
@ -270,9 +270,7 @@ void GLSpectrum::updateWaterfall(const std::vector<Real>& spectrum)
|
|||||||
quint32* pix = (quint32*)m_waterfallBuffer->scanLine(m_waterfallBufferPos);
|
quint32* pix = (quint32*)m_waterfallBuffer->scanLine(m_waterfallBufferPos);
|
||||||
|
|
||||||
for(int i = 0; i < m_fftSize; i++) {
|
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)((spectrum[i] - m_referenceLevel) * 2.4 * 100.0 / m_powerRange + 240.0);
|
||||||
int v = (int)vr;
|
|
||||||
|
|
||||||
if(v > 239)
|
if(v > 239)
|
||||||
v = 239;
|
v = 239;
|
||||||
else if(v < 0)
|
else if(v < 0)
|
||||||
|
@ -12,7 +12,7 @@ GLSpectrumGUI::GLSpectrumGUI(QWidget* parent) :
|
|||||||
m_spectrumVis(NULL),
|
m_spectrumVis(NULL),
|
||||||
m_glSpectrum(NULL),
|
m_glSpectrum(NULL),
|
||||||
m_fftSize(1024),
|
m_fftSize(1024),
|
||||||
m_fftOverlap(10),
|
m_fftOverlap(0),
|
||||||
m_fftWindow(FFTWindow::Hamming),
|
m_fftWindow(FFTWindow::Hamming),
|
||||||
m_refLevel(0),
|
m_refLevel(0),
|
||||||
m_powerRange(100),
|
m_powerRange(100),
|
||||||
@ -47,7 +47,7 @@ void GLSpectrumGUI::setBuddies(MessageQueue* messageQueue, SpectrumVis* spectrum
|
|||||||
void GLSpectrumGUI::resetToDefaults()
|
void GLSpectrumGUI::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_fftSize = 1024;
|
m_fftSize = 1024;
|
||||||
m_fftOverlap = 10;
|
m_fftOverlap = 0;
|
||||||
m_fftWindow = FFTWindow::Hamming;
|
m_fftWindow = FFTWindow::Hamming;
|
||||||
m_refLevel = 0;
|
m_refLevel = 0;
|
||||||
m_powerRange = 100;
|
m_powerRange = 100;
|
||||||
@ -90,7 +90,7 @@ bool GLSpectrumGUI::deserialize(const QByteArray& data)
|
|||||||
|
|
||||||
if(d.getVersion() == 1) {
|
if(d.getVersion() == 1) {
|
||||||
d.readS32(1, &m_fftSize, 1024);
|
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.readS32(3, &m_fftWindow, FFTWindow::Hamming);
|
||||||
d.readReal(4, &m_refLevel, 0);
|
d.readReal(4, &m_refLevel, 0);
|
||||||
d.readReal(5, &m_powerRange, 100);
|
d.readReal(5, &m_powerRange, 100);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user