mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
NFM demod: new discriminator
This commit is contained in:
parent
2f515d9379
commit
0861f71ff3
@ -150,9 +150,13 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
qint16 sample;
|
||||
|
||||
m_AGC.feed(ci);
|
||||
//m_AGC.feed(ci);
|
||||
|
||||
//double magsqRaw = m_AGC.getMagSq();
|
||||
long double magsqRaw; // = ci.real()*ci.real() + c.imag()*c.imag();
|
||||
|
||||
Real demod = m_phaseDiscri.phaseDiscriminator3(ci, magsqRaw);
|
||||
|
||||
double magsqRaw = m_AGC.getMagSq();
|
||||
Real magsq = magsqRaw / (1<<30);
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsqSum += magsq;
|
||||
@ -164,8 +168,6 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
m_magsqCount++;
|
||||
|
||||
Real demod = m_phaseDiscri.phaseDiscriminator2(ci);
|
||||
|
||||
//m_m2Sample = m_m1Sample;
|
||||
//m_m1Sample = ci;
|
||||
m_sampleCount++;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
const PluginDescriptor NFMPlugin::m_pluginDescriptor = {
|
||||
QString("NFM Demodulator"),
|
||||
QString("3.1.1"),
|
||||
QString("3.2.0"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -70,10 +70,47 @@ public:
|
||||
return (h1 - h2) * m_fmScaling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Second alternative
|
||||
*/
|
||||
Real phaseDiscriminator3(const Complex& sample, long double& magsq)
|
||||
{
|
||||
Real fltI = sample.real();
|
||||
Real fltQ = sample.imag();
|
||||
double fltNorm;
|
||||
Real fltNormI;
|
||||
Real fltNormQ;
|
||||
Real fltVal;
|
||||
|
||||
magsq = fltI*fltI + fltQ*fltQ;
|
||||
fltNorm = std::sqrt(magsq);
|
||||
|
||||
fltNormI= fltI/fltNorm;
|
||||
fltNormQ= fltQ/fltNorm;
|
||||
|
||||
fltVal = m_fltPreviousI*(fltNormQ - m_fltPreviousQ2);
|
||||
fltVal -= m_fltPreviousQ*(fltNormI - m_fltPreviousI2);
|
||||
fltVal += 2.0f;
|
||||
fltVal /= 2.0f; // normally it is /4
|
||||
|
||||
m_fltPreviousQ2 = m_fltPreviousQ;
|
||||
m_fltPreviousI2 = m_fltPreviousI;
|
||||
|
||||
m_fltPreviousQ = fltNormQ;
|
||||
m_fltPreviousI = fltNormI;
|
||||
|
||||
return fltVal * m_fmScaling;
|
||||
}
|
||||
|
||||
private:
|
||||
Complex m_m1Sample;
|
||||
Complex m_m2Sample;
|
||||
Real m_fmScaling;
|
||||
Real m_fltPreviousI;
|
||||
Real m_fltPreviousQ;
|
||||
Real m_fltPreviousI2;
|
||||
Real m_fltPreviousQ2;
|
||||
|
||||
};
|
||||
|
||||
#endif /* INCLUDE_DSP_PHASEDISCRI_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user