-
Notifications
You must be signed in to change notification settings - Fork 7
/
FastFourier.h
42 lines (40 loc) · 1.19 KB
/
FastFourier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "SdrberryTypeDefs.h"
#include <atomic>
#include <cmath>
#include <complex>
#include <fftw3.h>
#include <liquid/liquid.h>
#include <vector>
#include <mutex>
class FastFourier
{
public:
FastFourier();
FastFourier(int nbins, float rs, float downMixFrequency);
~FastFourier();
void Process(const IQSampleVector &input);
int Size();
void SetBins(int bins);
std::vector<float> GetSquaredBins();
std::vector<float> GetLineatSquaredBins();
void SetInvert(bool inv);
void SetParameters(int nbins, float resampleRate = 0.0f, float downMixFrequency = 0.0f);
IQSampleVector GetBins();
void ProcessForward(IQSampleVector &input);
void ProcessBackward(IQSampleVector &output);
void SpectrumPower(std::vector<float> &power, float offset = 0.0f);
void ProcessfftBins(const std::vector<float> &factor);
private:
const int type = LIQUID_FFT_FORWARD;
int flags = 0; // FFT flags (typically ignored)
int numberOffBins;
std::vector<std::complex<float>> fftBins;
std::vector<float> hammingWindow;
std::vector<std::complex<float>> inputData;
msresamp_crcf resampleHandle{nullptr};
bool invert{false};
float resampleRate{};
nco_crcf ncoMixerHandle{nullptr};
std::mutex mutexSingleEntry;
};