1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

Channel Analyzer: corrected suqared magnitude (power) display in dB

This commit is contained in:
Edouard Griffiths 2018-06-26 20:03:56 +02:00
parent 23ba4b9ec8
commit 7365b2dece
4 changed files with 8 additions and 4 deletions

View File

@ -156,6 +156,7 @@ void ChannelAnalyzer::processOneSample(Complex& c, fftfilt::cmplx *sideband)
Real re = m_sum.real() / SDR_RX_SCALEF;
Real im = m_sum.imag() / SDR_RX_SCALEF;
m_magsq = re*re + im*im;
m_channelPowerAvg(m_magsq);
std::complex<float> mix;
if (m_settings.m_pll)

View File

@ -30,6 +30,7 @@
#include "dsp/freqlockcomplex.h"
#include "audio/audiofifo.h"
#include "util/message.h"
#include "util/movingaverage.h"
#include "chanalyzersettings.h"
@ -188,6 +189,7 @@ public:
int getInputSampleRate() const { return m_inputSampleRate; }
int getChannelSampleRate() const { return m_settings.m_downSample ? m_settings.m_downSampleRate : m_inputSampleRate; }
double getMagSq() const { return m_magsq; }
double getMagSqAvg() const { return (double) m_channelPowerAvg; }
bool isPllLocked() const { return m_settings.m_pll && m_pll.locked(); }
Real getPllFrequency() const { return m_pll.getFreq(); }
Real getPllDeltaPhase() const { return m_pll.getDeltaPhi(); }
@ -236,6 +238,7 @@ private:
BasebandSampleSink* m_sampleSink;
SampleVector m_sampleBuffer;
MovingAverageUtil<double, double, 480> m_channelPowerAvg;
QMutex m_settingsMutex;
// void apply(bool force = false);

View File

@ -226,9 +226,9 @@ void ChannelAnalyzerGUI::channelMarkerHighlightedByCursor()
void ChannelAnalyzerGUI::tick()
{
double powDb = CalcDb::dbPower(m_channelAnalyzer->getMagSq());
m_channelPowerDbAvg(powDb);
ui->channelPower->setText(tr("%1 dB").arg((Real) m_channelPowerDbAvg, 0, 'f', 1));
m_channelPowerAvg(m_channelAnalyzer->getMagSqAvg());
double powDb = CalcDb::dbPower((double) m_channelPowerAvg);
ui->channelPower->setText(tr("%1 dB").arg(powDb, 0, 'f', 1));
if (m_channelAnalyzer->isPllLocked()) {
ui->pll->setStyleSheet("QToolButton { background-color : green; }");

View File

@ -68,7 +68,7 @@ private:
ChannelAnalyzerSettings m_settings;
bool m_doApplySettings;
int m_rate; //!< sample rate after final in-channel decimation (spanlog2)
MovingAverageUtil<Real, double, 40> m_channelPowerDbAvg;
MovingAverageUtil<double, double, 40> m_channelPowerAvg;
ChannelAnalyzer* m_channelAnalyzer;
SpectrumScopeNGComboVis* m_spectrumScopeComboVis;