Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Fft.h
1 #include <libraries/ne10/NE10.h>
2 #include <vector>
3 #include <cmath>
4 #include <libraries/math_neon/math_neon.h>
5 
10 class Fft
11 {
12 public:
13  Fft(){};
14  Fft(unsigned int length){ setup(length); };
15  ~Fft(){ cleanup(); };
16  int setup(unsigned int length);
17  void cleanup();
21  void fft();
25  void fft(const std::vector<float>& input);
26  void ifft();
30  float& fdr(unsigned int n) { return frequencyDomain[n].r; };
34  float& fdi(unsigned int n) { return frequencyDomain[n].i; };
39  float fda(unsigned int n) { return sqrtf_neon(fdr(n) * fdr(n) + fdi(n) * fdi(n)); };
43  float& td(unsigned int n) { return timeDomain[n]; };
44  static bool isPowerOfTwo(unsigned int n);
45  static unsigned int roundUpToPowerOfTwo(unsigned int n);
46 private:
47  ne10_float32_t* timeDomain = nullptr;
48  ne10_fft_cpx_float32_t* frequencyDomain = nullptr;
49  ne10_fft_r2c_cfg_float32_t cfg = nullptr;
50  unsigned int length;
51 };
float & td(unsigned int n)
Definition: Fft.h:43
float & fdi(unsigned int n)
Definition: Fft.h:34
void fft()
Definition: Fft.cpp:56
float & fdr(unsigned int n)
Definition: Fft.h:30
float fda(unsigned int n)
Definition: Fft.h:39
Definition: Fft.h:10