mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
AIS mod and demod, IEEE 802.15.4 mod: scope and spectrum feed optimization
This commit is contained in:
parent
be1976729b
commit
8e924a3dba
@ -41,12 +41,14 @@ AISDemodSink::AISDemodSink(AISDemod *aisDemod) :
|
||||
m_magsqCount(0),
|
||||
m_messageQueueToChannel(nullptr),
|
||||
m_rxBuf(nullptr),
|
||||
m_train(nullptr)
|
||||
m_train(nullptr),
|
||||
m_sampleBufferIndex(0)
|
||||
{
|
||||
m_magsq = 0.0;
|
||||
|
||||
m_demodBuffer.resize(1<<12);
|
||||
m_demodBufferFill = 0;
|
||||
m_sampleBuffer.resize(m_sampleBufferSize);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||
@ -64,12 +66,15 @@ void AISDemodSink::sampleToScope(Complex sample)
|
||||
{
|
||||
Real r = std::real(sample) * SDR_RX_SCALEF;
|
||||
Real i = std::imag(sample) * SDR_RX_SCALEF;
|
||||
SampleVector m_sampleBuffer;
|
||||
m_sampleBuffer.push_back(Sample(r, i));
|
||||
std::vector<SampleVector::const_iterator> vbegin;
|
||||
vbegin.push_back(m_sampleBuffer.begin());
|
||||
m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin());
|
||||
m_sampleBuffer.clear();
|
||||
m_sampleBuffer[m_sampleBufferIndex++] = Sample(r, i);
|
||||
|
||||
if (m_sampleBufferIndex == m_sampleBufferSize)
|
||||
{
|
||||
std::vector<SampleVector::const_iterator> vbegin;
|
||||
vbegin.push_back(m_sampleBuffer.begin());
|
||||
m_scopeSink->feed(vbegin, m_sampleBufferSize);
|
||||
m_sampleBufferIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,6 +131,10 @@ private:
|
||||
QVector<qint16> m_demodBuffer;
|
||||
int m_demodBufferFill;
|
||||
|
||||
SampleVector m_sampleBuffer;
|
||||
static const int m_sampleBufferSize = AISDemodSettings::AISDEMOD_CHANNEL_SAMPLE_RATE / 20;
|
||||
int m_sampleBufferIndex;
|
||||
|
||||
void processOneSample(Complex &ci);
|
||||
MessageQueue *getMessageQueueToChannel() { return m_messageQueueToChannel; }
|
||||
void sampleToScope(Complex sample);
|
||||
|
@ -85,7 +85,7 @@ private:
|
||||
NoiseFigureSettings m_settings;
|
||||
ChannelAPI *m_channel;
|
||||
int m_channelSampleRate;
|
||||
|
||||
|
||||
int m_fftSequence;
|
||||
FFTEngine *m_fft;
|
||||
int m_fftCounter;
|
||||
@ -106,7 +106,6 @@ private:
|
||||
|
||||
void processOneSample(Complex &ci);
|
||||
MessageQueue *getMessageQueueToChannel() { return m_messageQueueToChannel; }
|
||||
void sampleToScope(Complex sample);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_NOISEFIGURESINK_H
|
||||
|
@ -32,6 +32,8 @@ IEEE_802_15_4_ModSource::IEEE_802_15_4_ModSource() :
|
||||
m_scrambler(0x108, 0x1fe, 1),
|
||||
m_spectrumSink(nullptr),
|
||||
m_scopeSink(nullptr),
|
||||
m_specSampleBufferIndex(0),
|
||||
m_scopeSampleBufferIndex(0),
|
||||
m_magsq(0.0),
|
||||
m_levelCalcCount(0),
|
||||
m_peakLevel(0.0f),
|
||||
@ -48,6 +50,8 @@ IEEE_802_15_4_ModSource::IEEE_802_15_4_ModSource() :
|
||||
m_lowpass.create(301, m_channelSampleRate, 22000.0 / 2.0);
|
||||
m_pulseShapeI.create(1, 6, m_channelSampleRate/300000, true);
|
||||
m_pulseShapeQ.create(1, 6, m_channelSampleRate/300000, true);
|
||||
m_specSampleBuffer.resize(m_specSampleBufferSize);
|
||||
m_scopeSampleBuffer.resize(m_scopeSampleBufferSize);
|
||||
applySettings(m_settings, true);
|
||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||
}
|
||||
@ -106,9 +110,14 @@ void IEEE_802_15_4_ModSource::sampleToSpectrum(Complex sample)
|
||||
{
|
||||
Real r = std::real(out) * SDR_TX_SCALEF;
|
||||
Real i = std::imag(out) * SDR_TX_SCALEF;
|
||||
m_sampleBuffer.push_back(Sample(r, i));
|
||||
m_spectrumSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), false);
|
||||
m_sampleBuffer.clear();
|
||||
m_specSampleBuffer[m_specSampleBufferIndex++] = Sample(r, i);
|
||||
|
||||
if (m_specSampleBufferIndex == m_specSampleBufferSize)
|
||||
{
|
||||
m_spectrumSink->feed(m_specSampleBuffer.begin(), m_specSampleBuffer.end(), false);
|
||||
m_specSampleBufferIndex = 0;
|
||||
}
|
||||
|
||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||
}
|
||||
}
|
||||
@ -120,10 +129,15 @@ void IEEE_802_15_4_ModSource::sampleToScope(Complex sample)
|
||||
{
|
||||
Real r = std::real(sample) * SDR_RX_SCALEF;
|
||||
Real i = std::imag(sample) * SDR_RX_SCALEF;
|
||||
m_sampleBuffer.push_back(Sample(r, i));
|
||||
std::vector<SampleVector::const_iterator> vbegin;
|
||||
m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin());
|
||||
m_sampleBuffer.clear();
|
||||
m_scopeSampleBuffer[m_scopeSampleBufferIndex++] = Sample(r, i);
|
||||
|
||||
if (m_scopeSampleBufferIndex == m_scopeSampleBufferSize)
|
||||
{
|
||||
std::vector<SampleVector::const_iterator> vbegin;
|
||||
vbegin.push_back(m_scopeSampleBuffer.begin());
|
||||
m_scopeSink->feed(vbegin, m_scopeSampleBufferSize);
|
||||
m_scopeSampleBufferIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,12 @@ private:
|
||||
|
||||
BasebandSampleSink* m_spectrumSink; // Spectrum GUI to display baseband waveform
|
||||
ScopeVis* m_scopeSink; // Scope GUI to display baseband waveform
|
||||
SampleVector m_sampleBuffer;
|
||||
SampleVector m_specSampleBuffer;
|
||||
int m_specSampleBufferIndex;
|
||||
static const int m_specSampleBufferSize = 1024;
|
||||
SampleVector m_scopeSampleBuffer;
|
||||
int m_scopeSampleBufferIndex;
|
||||
static const int m_scopeSampleBufferSize = 4800;
|
||||
Interpolator m_interpolator; // Interpolator to downsample to 4k in spectrum
|
||||
Real m_interpolatorDistance;
|
||||
Real m_interpolatorDistanceRemain;
|
||||
|
@ -41,10 +41,14 @@ AISModSource::AISModSource() :
|
||||
m_byteIdx(0),
|
||||
m_bitIdx(0),
|
||||
m_last5Bits(0),
|
||||
m_bitCount(0)
|
||||
m_bitCount(0),
|
||||
m_scopeSampleBufferIndex(0),
|
||||
m_specSampleBufferIndex(0)
|
||||
{
|
||||
m_demodBuffer.resize(1<<12);
|
||||
m_demodBufferFill = 0;
|
||||
m_scopeSampleBuffer.resize(m_scopeSampleBufferSize);
|
||||
m_specSampleBuffer.resize(m_specSampleBufferSize);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||
@ -113,9 +117,13 @@ void AISModSource::sampleToSpectrum(Complex sample)
|
||||
{
|
||||
Real r = std::real(sample) * SDR_TX_SCALEF;
|
||||
Real i = std::imag(sample) * SDR_TX_SCALEF;
|
||||
m_sampleBuffer.push_back(Sample(r, i));
|
||||
m_spectrumSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), false);
|
||||
m_sampleBuffer.clear();
|
||||
m_specSampleBuffer[m_specSampleBufferIndex++] = Sample(r, i);
|
||||
|
||||
if (m_specSampleBufferIndex == m_specSampleBufferSize)
|
||||
{
|
||||
m_spectrumSink->feed(m_specSampleBuffer.begin(), m_specSampleBuffer.end(), false);
|
||||
m_specSampleBufferIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,11 +133,15 @@ void AISModSource::sampleToScope(Complex sample)
|
||||
{
|
||||
Real r = std::real(sample) * SDR_RX_SCALEF;
|
||||
Real i = std::imag(sample) * SDR_RX_SCALEF;
|
||||
m_sampleBuffer.push_back(Sample(r, i));
|
||||
std::vector<SampleVector::const_iterator> vbegin;
|
||||
vbegin.push_back(m_sampleBuffer.begin());
|
||||
m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin());
|
||||
m_sampleBuffer.clear();
|
||||
m_scopeSampleBuffer[m_scopeSampleBufferIndex++] = Sample(r, i);
|
||||
|
||||
if (m_scopeSampleBufferIndex == m_scopeSampleBufferSize)
|
||||
{
|
||||
std::vector<SampleVector::const_iterator> vbegin;
|
||||
vbegin.push_back(m_scopeSampleBuffer.begin());
|
||||
m_scopeSink->feed(vbegin, m_scopeSampleBufferSize);
|
||||
m_scopeSampleBufferIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,6 @@ private:
|
||||
|
||||
BasebandSampleSink* m_spectrumSink; // Spectrum GUI to display baseband waveform
|
||||
ScopeVis* m_scopeSink; // Scope GUI to display baseband waveform
|
||||
SampleVector m_sampleBuffer;
|
||||
|
||||
Interpolator m_interpolator; // Interpolator to channel sample rate
|
||||
Real m_interpolatorDistance;
|
||||
@ -129,6 +128,14 @@ private:
|
||||
QVector<qint16> m_demodBuffer;
|
||||
int m_demodBufferFill;
|
||||
|
||||
SampleVector m_scopeSampleBuffer;
|
||||
static const int m_scopeSampleBufferSize = AISModSettings::AISMOD_SAMPLE_RATE / 20;
|
||||
int m_scopeSampleBufferIndex;
|
||||
|
||||
SampleVector m_specSampleBuffer;
|
||||
static const int m_specSampleBufferSize = 1024;
|
||||
int m_specSampleBufferIndex;
|
||||
|
||||
bool bitsValid(); // Are there and bits to transmit
|
||||
int getBit(); // Get bit from m_bits
|
||||
void addBit(int bit); // Add bit to m_bits, with zero stuffing
|
||||
|
Loading…
Reference in New Issue
Block a user