1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00

UDP source: optimization for FM modes

This commit is contained in:
f4exb 2018-01-28 03:06:30 +01:00
parent b57793607c
commit 4c22be880c
2 changed files with 20 additions and 4 deletions

View File

@ -207,15 +207,13 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatNFM)
{
Real discri = m_squelchOpen ? m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0;
FixReal demod = (FixReal) (SDR_RX_SCALEF * discri);
udpWrite(demod, demod);
udpWriteNorm(discri, discri);
m_outMovingAverage.feed(discri*discri);
}
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatNFMMono)
{
Real discri = m_squelchOpen ? m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0;
FixReal demod = (FixReal) (SDR_RX_SCALEF * discri);
udpWriteMono(demod);
udpWriteNormMono(discri);
m_outMovingAverage.feed(discri*discri);
}
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatLSBMono) // Monaural LSB

View File

@ -317,6 +317,24 @@ protected:
}
}
void udpWriteNorm(Real real, Real imag)
{
if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) {
m_udpBuffer16->write(Sample16(real*32768.0, imag*32768.0));
} else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) {
m_udpBuffer24->write(Sample24(real*8388608.0, imag*8388608.0));
}
}
void udpWriteNormMono(Real sample)
{
if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) {
m_udpBufferMono16->write(sample*32768.0);
} else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) {
m_udpBufferMono24->write(sample*8388608.0);
}
}
};
#endif // INCLUDE_UDPSRC_H