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 #pragma once
2 #include <libraries/ne10/NE10.h>
3 #include <vector>
4 #include <cmath>
5 #include <libraries/math_neon/math_neon.h>
6 
11 class Fft
12 {
13 public:
14  Fft(){};
15  Fft(unsigned int length){ setup(length); };
16  ~Fft(){ cleanup(); };
17  int setup(unsigned int length);
18  void cleanup();
22  void fft();
26  void fft(const std::vector<float>& input);
30  void ifft();
35  void ifft(const std::vector<float>& reInput, const std::vector<float>& imInput);
39  float& fdr(unsigned int n) { return frequencyDomain[n].r; };
43  float& fdi(unsigned int n) { return frequencyDomain[n].i; };
48  float fda(unsigned int n) { return sqrtf_neon(fdr(n) * fdr(n) + fdi(n) * fdi(n)); };
52  float& td(unsigned int n) { return timeDomain[n]; };
53  static bool isPowerOfTwo(unsigned int n);
54  static unsigned int roundUpToPowerOfTwo(unsigned int n);
55 private:
56  ne10_float32_t* timeDomain = nullptr;
57  ne10_fft_cpx_float32_t* frequencyDomain = nullptr;
58  ne10_fft_r2c_cfg_float32_t cfg = nullptr;
59  unsigned int length;
60 };
void ifft()
Definition: Fft.cpp:70
float & td(unsigned int n)
Definition: Fft.h:52
float & fdi(unsigned int n)
Definition: Fft.h:43
void fft()
Definition: Fft.cpp:56
float & fdr(unsigned int n)
Definition: Fft.h:39
float fda(unsigned int n)
Definition: Fft.h:48
Definition: Fft.h:11