mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-17 13:51:47 -05:00
Optimization of current spectrum line display by just storing a pointer to the current spectrum
This commit is contained in:
parent
69101c0629
commit
135170e6db
@ -99,7 +99,7 @@ private:
|
||||
|
||||
std::vector<Real> m_maxHold;
|
||||
bool m_displayMaxHold;
|
||||
std::vector<Real> m_current;
|
||||
const std::vector<Real> *m_currentSpectrum;
|
||||
bool m_displayCurrent;
|
||||
|
||||
Real m_waterfallShare;
|
||||
|
@ -36,6 +36,7 @@ GLSpectrum::GLSpectrum(QWidget* parent) :
|
||||
m_displayGridIntensity(5),
|
||||
m_invertedWaterfall(false),
|
||||
m_displayMaxHold(false),
|
||||
m_currentSpectrum(0),
|
||||
m_displayCurrent(false),
|
||||
m_leftMarginTextureAllocated(false),
|
||||
m_frequencyTextureAllocated(false),
|
||||
@ -88,9 +89,9 @@ GLSpectrum::GLSpectrum(QWidget* parent) :
|
||||
((quint8*)&m_histogramPalette[i])[3] = c.alpha();
|
||||
}
|
||||
|
||||
m_current.resize(m_fftSize);
|
||||
//m_current.resize(m_fftSize);
|
||||
|
||||
m_histogramHoldoffBase = 1; // was 4
|
||||
m_histogramHoldoffBase = 2; // was 4
|
||||
m_histogramHoldoffCount = m_histogramHoldoffBase;
|
||||
m_histogramLateHoldoff = 1; // was 20
|
||||
m_histogramStroke = 40; // was 4
|
||||
@ -236,9 +237,10 @@ void GLSpectrum::setDisplayMaxHold(bool display)
|
||||
|
||||
void GLSpectrum::setDisplayCurrent(bool display)
|
||||
{
|
||||
/*
|
||||
if(display && (m_current.size() < (uint)m_fftSize)) {
|
||||
m_current.resize(m_fftSize);
|
||||
}
|
||||
}*/
|
||||
|
||||
m_displayCurrent = display;
|
||||
m_changesPending = true;
|
||||
@ -367,14 +369,18 @@ void GLSpectrum::updateHistogram(const std::vector<Real>& spectrum)
|
||||
m_histogramHoldoffCount = m_histogramHoldoffBase;
|
||||
}
|
||||
|
||||
/*
|
||||
if(m_current.size() < (uint)m_fftSize)
|
||||
m_current.resize(m_fftSize);
|
||||
m_current.resize(m_fftSize);*/
|
||||
m_currentSpectrum = &spectrum;
|
||||
|
||||
#define NO_AVX
|
||||
#ifdef NO_AVX
|
||||
for(int i = 0; i < m_fftSize; i++) {
|
||||
int v = (int)((spectrum[i] - m_referenceLevel) * 100.0 / m_powerRange + 100.0);
|
||||
|
||||
if ((v >= 0) && (v <= 99)) {
|
||||
/*
|
||||
if (v < 0) {
|
||||
m_current[i] = m_referenceLevel - m_powerRange;
|
||||
}
|
||||
@ -382,8 +388,9 @@ void GLSpectrum::updateHistogram(const std::vector<Real>& spectrum)
|
||||
m_current[i] = m_referenceLevel;
|
||||
}
|
||||
else {
|
||||
*/
|
||||
//m_current[i] = m_referenceLevel - m_powerRange + (v * m_powerRange) / 99.0;
|
||||
m_current[i] = spectrum[i];
|
||||
//m_current[i] = spectrum[i];
|
||||
b = m_histogram + i * 100 + v;
|
||||
if(*b < 220)
|
||||
*b += m_histogramStroke; // was 4
|
||||
@ -799,7 +806,7 @@ void GLSpectrum::paintGL()
|
||||
}
|
||||
|
||||
// paint current spectrum line on top of histogram
|
||||
if(m_displayCurrent) {
|
||||
if ((m_displayCurrent) && m_currentSpectrum) {
|
||||
glPushMatrix();
|
||||
glTranslatef(m_glHistogramRect.x(), m_glHistogramRect.y(), 0);
|
||||
glScalef(m_glHistogramRect.width() / (float)(m_fftSize - 1), -m_glHistogramRect.height() / m_powerRange, 1);
|
||||
@ -811,7 +818,7 @@ void GLSpectrum::paintGL()
|
||||
Real bottom = -m_powerRange;
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for(int i = 0; i < m_fftSize; i++) {
|
||||
Real v = m_current[i] - m_referenceLevel;
|
||||
Real v = (*m_currentSpectrum)[i] - m_referenceLevel;
|
||||
if(v > 0)
|
||||
v = 0;
|
||||
else if(v < bottom)
|
||||
|
Loading…
Reference in New Issue
Block a user