1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-21 07:08:45 -04:00

Add Sliding FFT.

This commit is contained in:
John Greb
2015-01-11 19:30:48 +00:00
parent ad1c436a7e
commit 429b4dbbff
4 changed files with 86 additions and 2 deletions
+6 -1
View File
@@ -35,10 +35,14 @@ LoRaDemod::LoRaDemod(SampleSink* sampleSink) :
m_chirp = 0;
m_angle = 0;
loraFilter = new sfft(LORA_SFFT_LEN);
}
LoRaDemod::~LoRaDemod()
{
if (loraFilter)
delete loraFilter;
}
void LoRaDemod::configure(MessageQueue* messageQueue, Real Bandwidth)
@@ -50,7 +54,7 @@ void LoRaDemod::configure(MessageQueue* messageQueue, Real Bandwidth)
void LoRaDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool pO)
{
Complex ci;
cmplx bins[LORA_SFFT_LEN];
m_sampleBuffer.clear();
for(SampleVector::const_iterator it = begin; it < end; ++it) {
Complex c(it->real() / 32768.0, it->imag() / 32768.0);
@@ -61,6 +65,7 @@ void LoRaDemod::feed(SampleVector::const_iterator begin, SampleVector::const_ite
m_angle = (m_angle + m_chirp) & (SPREADFACTOR - 1);
Complex cangle(cos(M_PI*2*m_angle/SPREADFACTOR),-sin(M_PI*2*m_angle/SPREADFACTOR));
ci *= cangle;
loraFilter->run(ci, bins);
m_sampleBuffer.push_back(Sample(ci.real() * 32000, ci.imag() * 32000));
m_sampleDistanceRemain += (Real)m_sampleRate / m_Bandwidth;
}
+6
View File
@@ -23,9 +23,13 @@
#include "dsp/nco.h"
#include "dsp/interpolator.h"
#include "util/message.h"
#include "dsp/fftfilt.h"
#define SPREADFACTOR (1<<8)
/* It takes a lot of CPU to run the sliding FFT */
#define LORA_SFFT_LEN (128)
class LoRaDemod : public SampleSink {
public:
LoRaDemod(SampleSink* sampleSink);
@@ -66,6 +70,8 @@ private:
int m_chirp;
int m_angle;
sfft* loraFilter;
NCO m_nco;
Interpolator m_interpolator;
Real m_sampleDistanceRemain;