1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -05:00

DSD Demod: compatibility with 24 bit samples in DSP

This commit is contained in:
f4exb 2018-01-24 23:57:36 +01:00
parent 4a442e97e7
commit c2594836b0
4 changed files with 15 additions and 10 deletions

View File

@ -65,8 +65,9 @@ DSDDemod::DSDDemod(DeviceSourceAPI *deviceAPI) :
m_audioBuffer.resize(1<<14);
m_audioBufferFill = 0;
m_sampleBuffer = new qint16[1<<17]; // 128 kS
m_sampleBuffer = new FixReal[1<<17]; // 128 kS
m_sampleBufferIndex = 0;
m_scaleFromShort = SDR_RX_SAMP_SZ < sizeof(short)*8 ? 1 : 1<<(SDR_RX_SAMP_SZ - sizeof(short)*8);
m_movingAverage.resize(16, 0);
m_magsq = 0.0f;
@ -126,7 +127,8 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
{
qint16 sample, delayedSample;
FixReal sample, delayedSample;
qint16 sampleDSD;
Real re = ci.real() / SDR_RX_SCALED;
Real im = ci.imag() / SDR_RX_SCALED;
@ -142,7 +144,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_magsqCount++;
Real demod = SDR_RX_SCALEF * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_demodGain;
Real demod = m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_demodGain; // [-1.0:1.0]
m_sampleCount++;
// AF processing
@ -170,17 +172,19 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
if (m_squelchOpen)
{
sample = demod;
sampleDSD = demod * 32768.0f; // DSD decoder takes int16 samples
sample = demod * SDR_RX_SCALEF; // scale to sample size
}
else
{
sampleDSD = 0;
sample = 0;
}
m_dsdDecoder.pushSample(sample);
m_dsdDecoder.pushSample(sampleDSD);
if (m_settings.m_enableCosineFiltering) { // show actual input to FSK demod
sample = m_dsdDecoder.getFilteredSample();
sample = m_dsdDecoder.getFilteredSample() * m_scaleFromShort;
}
if (m_sampleBufferIndex < (1<<17)) {
@ -199,7 +203,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
if (m_settings.m_syncOrConstellation)
{
Sample s(sample, m_dsdDecoder.getSymbolSyncSample());
Sample s(sample, m_dsdDecoder.getSymbolSyncSample() * m_scaleFromShort);
m_scopeSampleBuffer.push_back(s);
}
else

View File

@ -186,8 +186,9 @@ private:
SampleVector m_scopeSampleBuffer;
AudioVector m_audioBuffer;
uint m_audioBufferFill;
qint16 *m_sampleBuffer; //!< samples ring buffer
FixReal *m_sampleBuffer; //!< samples ring buffer
int m_sampleBufferIndex;
int m_scaleFromShort;
AudioFifo m_audioFifo1;
AudioFifo m_audioFifo2;

View File

@ -25,7 +25,7 @@
const PluginDescriptor DSDDemodPlugin::m_pluginDescriptor = {
QString("DSD Demodulator"),
QString("3.10.1"),
QString("3.11.1"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -26,7 +26,7 @@
const PluginDescriptor SDRdaemonSourcePlugin::m_pluginDescriptor = {
QString("SDRdaemon source input"),
QString("3.9.0"),
QString("3.11.1"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,