mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	Spectrum: reviewed histogram capping to phosphor palette and stroke value limits
This commit is contained in:
		
							parent
							
								
									635bea2059
								
							
						
					
					
						commit
						9158da20e0
					
				| @ -107,7 +107,7 @@ GLSpectrum::GLSpectrum(QWidget* parent) : | ||||
| 	m_histogramHoldoffBase = 4; // was 2
 | ||||
| 	m_histogramHoldoffCount = m_histogramHoldoffBase; | ||||
| 	m_histogramLateHoldoff = 20; // was 1
 | ||||
| 	m_histogramStroke = 40; // was 4
 | ||||
| 	m_histogramStroke = 4; | ||||
| 
 | ||||
| 	m_timeScale.setFont(font()); | ||||
| 	m_timeScale.setOrientation(Qt::Vertical); | ||||
| @ -175,12 +175,12 @@ void GLSpectrum::setDecay(int decay) | ||||
| 
 | ||||
| void GLSpectrum::setHistoHoldoffBase(int holdoffBase) | ||||
| { | ||||
| 	m_histogramHoldoffBase = holdoffBase < 0 ? 0 : holdoffBase > 20 ? 20 : holdoffBase; | ||||
| 	m_histogramHoldoffBase = holdoffBase < 0 ? 0 : holdoffBase > 240 ? 240 : holdoffBase; | ||||
| } | ||||
| 
 | ||||
| void GLSpectrum::setHistoStroke(int stroke) | ||||
| { | ||||
| 	m_histogramStroke = stroke < 4 ? 4 : stroke > 240 ? 240 : stroke; | ||||
| 	m_histogramStroke = stroke < 1 ? 1 : stroke > 40 ? 40 : stroke; | ||||
| } | ||||
| 
 | ||||
| void GLSpectrum::setSampleRate(qint32 sampleRate) | ||||
| @ -373,7 +373,7 @@ void GLSpectrum::updateHistogram(const std::vector<Real>& spectrum) | ||||
| 		{ | ||||
| 			for (int i = 0; i < fftMulSize; i++) | ||||
| 			{ | ||||
| 				if (*b > 16) // was 20
 | ||||
| 				if (*b > 20) // must be more than max value of m_decay
 | ||||
| 				{ | ||||
| 					*b = *b - sub; | ||||
| 				} | ||||
| @ -470,15 +470,20 @@ void GLSpectrum::updateHistogram(const std::vector<Real>& spectrum) | ||||
|         } | ||||
|     } | ||||
| #else | ||||
|     for(int i = 0; i < m_fftSize; i++) { | ||||
|     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) && (v <= 99)) | ||||
|         { | ||||
|             b = m_histogram + i * 100 + v; | ||||
|             if(*b < 220) | ||||
| 
 | ||||
|             // capping to 239 as palette values are [0..239]
 | ||||
|             if (*b + m_histogramStroke <= 239) { | ||||
|                 *b += m_histogramStroke; // was 4
 | ||||
|             else if(*b < 239) | ||||
|                 *b += 1; | ||||
|             } else { | ||||
|                 *b = 239; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| #endif | ||||
|  | ||||
| @ -68,7 +68,7 @@ void GLSpectrumGUI::resetToDefaults() | ||||
| 	m_powerRange = 100; | ||||
| 	m_decay = 0; | ||||
| 	m_histogramHoldoffBase = 0; | ||||
| 	m_histogramStroke = 40; | ||||
| 	m_histogramStroke = 4; | ||||
| 	m_displayGridIntensity = 5, | ||||
| 	m_displayWaterfall = true; | ||||
| 	m_invertedWaterfall = false; | ||||
| @ -135,7 +135,7 @@ bool GLSpectrumGUI::deserialize(const QByteArray& data) | ||||
| 		d.readBool(12, &m_invert, true); | ||||
| 		d.readS32(13, &m_displayGridIntensity, 5); | ||||
| 		d.readS32(14, &m_histogramHoldoffBase, 0); | ||||
| 		d.readS32(15, &m_histogramStroke, 40); | ||||
| 		d.readS32(15, &m_histogramStroke, 4); | ||||
| 		d.readBool(16, &m_displayCurrent, false); | ||||
| 		d.readS32(17, &m_displayTraceIntensity, 50); | ||||
| 		Real waterfallShare; | ||||
| @ -369,9 +369,6 @@ void GLSpectrumGUI::on_decay_valueChanged(int index) | ||||
| 
 | ||||
| void GLSpectrumGUI::on_holdoff_valueChanged(int index) | ||||
| { | ||||
| 	if (index < 0) { | ||||
| 		return; | ||||
| 	} | ||||
| 	m_histogramHoldoffBase = index; | ||||
| 	//ui->holdoff->setToolTip(QString("Holdoff: %1").arg(m_histogramHoldoffBase));
 | ||||
| 	if(m_glSpectrum != 0) { | ||||
| @ -381,9 +378,6 @@ void GLSpectrumGUI::on_holdoff_valueChanged(int index) | ||||
| 
 | ||||
| void GLSpectrumGUI::on_stroke_valueChanged(int index) | ||||
| { | ||||
| 	if (index < 4) { | ||||
| 		return; | ||||
| 	} | ||||
| 	m_histogramStroke = index; | ||||
| 	//ui->stroke->setToolTip(QString("Stroke: %1").arg(m_histogramStroke));
 | ||||
| 	if(m_glSpectrum != 0) { | ||||
|  | ||||
| @ -93,10 +93,10 @@ | ||||
|         <string>Stroke:</string> | ||||
|        </property> | ||||
|        <property name="minimum"> | ||||
|         <number>4</number> | ||||
|         <number>1</number> | ||||
|        </property> | ||||
|        <property name="maximum"> | ||||
|         <number>240</number> | ||||
|         <number>40</number> | ||||
|        </property> | ||||
|        <property name="pageStep"> | ||||
|         <number>1</number> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user