mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-23 18:52:28 -04:00
Scope: corrected mean power dB overlay displays
This commit is contained in:
parent
5f120fb2cb
commit
facb282c23
@ -465,10 +465,10 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
|
||||
}
|
||||
else if (projectionType == Projector::ProjectionMagDB)
|
||||
{
|
||||
// there is no processing advantage in direct calculation without projector
|
||||
// uint32_t magsq = begin->m_real*begin->m_real + begin->m_imag*begin->m_imag;
|
||||
// v = ((log10f(magsq/1073741824.0f)*0.2f - 2.0f*itData->m_ofs) + 2.0f)*itData->m_amp - 1.0f;
|
||||
float pdB = (*itCtl)->m_projector.run(*begin);
|
||||
Real re = begin->m_real / SDR_RX_SCALEF;
|
||||
Real im = begin->m_imag / SDR_RX_SCALEF;
|
||||
double magsq = re*re + im*im;
|
||||
float pdB = log10f(magsq) * 10.0f;
|
||||
float p = pdB - (100.0f * itData->m_ofs);
|
||||
v = ((p/50.0f) + 2.0f)*itData->m_amp - 1.0f;
|
||||
|
||||
@ -476,28 +476,29 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
|
||||
{
|
||||
if (traceCount == shift)
|
||||
{
|
||||
(*itCtl)->m_maxPow = -200.0f;
|
||||
(*itCtl)->m_maxPow = 0.0f;
|
||||
(*itCtl)->m_sumPow = 0.0f;
|
||||
(*itCtl)->m_nbPow = 1;
|
||||
}
|
||||
|
||||
if (pdB > -200.0f)
|
||||
if (magsq > 0.0f)
|
||||
{
|
||||
if (pdB > (*itCtl)->m_maxPow)
|
||||
if (magsq > (*itCtl)->m_maxPow)
|
||||
{
|
||||
(*itCtl)->m_maxPow = pdB;
|
||||
(*itCtl)->m_maxPow = magsq;
|
||||
}
|
||||
|
||||
(*itCtl)->m_sumPow += pdB;
|
||||
(*itCtl)->m_sumPow += magsq;
|
||||
(*itCtl)->m_nbPow++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_nbSamples == 1) && ((*itCtl)->m_nbPow > 0)) // on last sample create power display overlay
|
||||
{
|
||||
double avgPow = (*itCtl)->m_sumPow / (*itCtl)->m_nbPow;
|
||||
double peakToAvgPow = (*itCtl)->m_maxPow - avgPow;
|
||||
itData->m_textOverlay = QString("%1 %2 %3").arg((*itCtl)->m_maxPow, 0, 'f', 1).arg(avgPow, 0, 'f', 1).arg(peakToAvgPow, 4, 'f', 1, ' ');
|
||||
double avgPow = log10f((*itCtl)->m_sumPow / (*itCtl)->m_nbPow)*10.0;
|
||||
double peakPow = log10f((*itCtl)->m_maxPow)*10.0;
|
||||
double peakToAvgPow = peakPow - avgPow;
|
||||
itData->m_textOverlay = QString("%1 %2 %3").arg(peakPow, 0, 'f', 1).arg(avgPow, 0, 'f', 1).arg(peakToAvgPow, 4, 'f', 1, ' ');
|
||||
(*itCtl)->m_nbPow = 0;
|
||||
}
|
||||
}
|
||||
|
@ -681,8 +681,8 @@ private:
|
||||
{
|
||||
Projector m_projector; //!< Projector transform from complex trace to real (displayable) trace
|
||||
uint32_t m_traceCount[2]; //!< Count of samples processed (double buffered)
|
||||
Real m_maxPow; //!< Maximum power over the current trace for MagDB overlay display
|
||||
Real m_sumPow; //!< Cumulative power over the current trace for MagDB overlay display
|
||||
double m_maxPow; //!< Maximum power over the current trace for MagDB overlay display
|
||||
double m_sumPow; //!< Cumulative power over the current trace for MagDB overlay display
|
||||
int m_nbPow; //!< Number of power samples over the current trace for MagDB overlay display
|
||||
|
||||
TraceControl() : m_projector(Projector::ProjectionReal)
|
||||
|
Loading…
x
Reference in New Issue
Block a user