1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

Optimize AM demod

This commit is contained in:
f4exb 2015-10-05 00:54:14 +02:00
parent bae3632fad
commit 876c257aaf

View File

@ -72,14 +72,17 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector
for (SampleVector::const_iterator it = begin; it != end; ++it)
{
Complex c(it->real() / 32768.0, it->imag() / 32768.0);
//Complex c(it->real() / 32768.0, it->imag() / 32768.0);
Complex c(it->real(), it->imag());
c *= m_nco.nextIQ();
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, c, &ci))
{
m_sampleBuffer.push_back(Sample(ci.real() * 32767.0, ci.imag() * 32767.0));
//m_sampleBuffer.push_back(Sample(ci.real() * 32767.0, ci.imag() * 32767.0));
m_sampleBuffer.push_back(Sample(ci.real(), ci.imag()));
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
magsq /= (1<<30);
m_movingAverage.feed(magsq);
m_magsq = m_movingAverage.average();