skeleton program
Dependencies: mbed
Revision 1:099f1a4c5fc8, committed 2017-03-29
- Comitter:
- rik
- Date:
- Wed Mar 29 08:42:31 2017 +0000
- Parent:
- 0:8c128e047ec9
- Commit message:
- first compile (full of bugs?)
Changed in this revision
--- a/FFT.cpp Tue Mar 28 08:48:23 2017 +0000
+++ b/FFT.cpp Wed Mar 29 08:42:31 2017 +0000
@@ -1,1 +1,132 @@
-#include "FFT.h"
\ No newline at end of file
+#include "FFT.h"
+
+
+// Calculates and subtracts the signal mean
+void subMean(float* data, int datalength){
+ float mean = 0;
+ float total = 0;
+ for (int i = 0; i < datalength; i++)
+ total += data[i]/datalength;
+ for (int i = 0; i < datalength; i++)
+ data[i] = data[i] - mean;
+}
+
+void reverseCooleyTukeyRadix2(float* data, complex_num* dataout, int datalength){
+
+ complex_num fftbuffer[256];
+ complex_num twiddlebuffer;
+
+ complex_num minusone;
+ minusone.real = -1;
+ minusone.imaginary = 0;
+
+ // copy iput to output first
+ for (int i = 0; i < datalength; i++){
+ dataout[i].real = data[i];
+ dataout[i].imaginary = 0;
+ }
+
+ for (int stage = 8; stage > -1; stage--){
+
+ unsigned int step = 1<<(stage+1);
+
+ for (unsigned int i = 0; i < 512; i = i+step){ // Crack it up in parts, i.e. for stage0 -> 512, stage1 -> 256 , 2>128, 3>64, 4>32, 5>16, 6>8, 7>4, 8>2, 9>1 --> 1024/2^stage OR IN STEPS: stage0 -> 2, stage1 -> 4, 2>8, 3>16, 4,32, 5>64, ......... 9>512 --> 1024 - 1024/2^stage+1
+ // Buffer the first 'half' of the thing, which is the first half step
+ for (unsigned int k = 0; k < step / 2; k++){
+ fftbuffer[k].real = dataout[i+k].real;
+ fftbuffer[k].imaginary = dataout[i+k].imaginary;
+ }
+
+ // Apply twiddle factors to the seconds half (half step) depending on stage and numbering
+ for (unsigned int k = 0; k < step / 2; k++){
+ // Read in the correct twiddle factor
+ // Twiddle factor is recalculated with k*(1024 / 2^stage+1) which can be recalculated to 1<<
+ twiddlebuffer.imaginary = twiddleLookupTable_Imaginary[k * (1<<(9-stage))];
+ twiddlebuffer.real = twiddleLookupTable_Real[k * (1 << (9 - stage))];
+
+ dataout[i + k + step / 2] = complex_multiply(dataout[i + k + step / 2], twiddlebuffer);
+ }
+
+ // Recalculate the first half by addition of the first and recalculated half
+ for (unsigned int k = 0; k < step / 2; k++)
+ dataout[i + k] = complex_add(dataout[i+k], dataout[i+k+step/2]);
+
+
+ // Multiply the second half with minus 1
+ for (unsigned int k = 0; k < step / 2; k++)
+ dataout[i + step / 2 + k] = complex_multiply(dataout[i + step/2+k], minusone);
+
+ // Add the buffered old values, with the new second half values
+ for (unsigned int k = 0; k < step / 2; k++)
+ dataout[i + step / 2 + k] = complex_add(dataout[i + step/2 + k], fftbuffer[k]);
+ }
+ }
+}
+
+void cooleyTukeyBack (float* dataout, complex_num* datain, int datalength){
+ complex_num fftbuffer[256];
+ complex_num twiddlebuffer;
+
+ complex_num minusone;
+ minusone.real = -1;
+ minusone.imaginary = 0;
+
+ for (int stage = 0; stage < 9; stage++){
+
+ unsigned int step = 1<<(stage+1);
+
+ for (unsigned int i = 0; i < 512; i = i+step){ // Crack it up in parts, i.e. for stage0 -> 512, stage1 -> 256 , 2>128, 3>64, 4>32, 5>16, 6>8, 7>4, 8>2, 9>1 --> 1024/2^stage OR IN STEPS: stage0 -> 2, stage1 -> 4, 2>8, 3>16, 4,32, 5>64, ......... 9>512 --> 1024 - 1024/2^stage+1
+ // Buffer the first 'half' of the thing, which is the first half step
+ for (unsigned int k = 0; k < step / 2; k++){
+ fftbuffer[k].real = datain[i+k].real;
+ fftbuffer[k].imaginary = datain[i+k].imaginary;
+ }
+
+ // Apply twiddle factors to the seconds half (half step) depending on stage and numbering
+ for (unsigned int k = 0; k < step / 2; k++){
+ // Read in the correct twiddle factor
+ // Twiddle factor is recalculated with N-k*(1024 / 2^stage+1) which can be recalculated to 1<<
+ twiddlebuffer.imaginary = twiddleLookupTable_Imaginary[512-(k * (1<<(9-stage)))];
+ twiddlebuffer.real = twiddleLookupTable_Real[512-(k * (1 << (9 - stage)))];
+
+ datain[i + k + step / 2] = complex_multiply(datain[i + k + step / 2], twiddlebuffer);
+ }
+
+ // Recalculate the first half by addition of the first and recalculated half
+ for (unsigned int k = 0; k < step / 2; k++)
+ datain[i + k] = complex_add(datain[i+k], datain[i+k+step/2]);
+
+
+ // Multiply the second half with minus 1
+ for (unsigned int k = 0; k < step / 2; k++)
+ datain[i + step / 2 + k] = complex_multiply(datain[i + step/2+k], minusone);
+
+ // Add the buffered old values, with the new second half values
+ for (unsigned int k = 0; k < step / 2; k++)
+ datain[i + step / 2 + k] = complex_add(datain[i + step/2 + k], fftbuffer[k]);
+ }
+ }
+ //first convert complex data back to magnitude data then divide by 1/N
+ for (int i = 0; i < 512; i++)
+ dataout[i] = (complex_magnitude(datain[i])/512);
+}
+
+void equalizer(complex_num* data){
+
+}
+
+void performEqualizer(float* datain, float* dataout, complex_num* freqdata, int datalength){
+ if (datalength == 512){
+ // - Calculating and substracting the mean -
+ subMean(datain, datalength);
+ // - Applying a hanning window - N multiplications
+ applyHanningTable(datain, datalength);
+ // It then applies a radix-2 Cooley Tukey FFT to create a fourier transform
+ reverseCooleyTukeyRadix2(datain, freqdata, datalength);
+ // It gets equalized
+ equalizer(freqdata);
+ // back to time domain
+ cooleyTukeyBack(dataout, freqdata, datalength);
+ }
+
+}
\ No newline at end of file
--- a/FFT.h Tue Mar 28 08:48:23 2017 +0000 +++ b/FFT.h Wed Mar 29 08:42:31 2017 +0000 @@ -14,6 +14,7 @@ #include "LookupTables.h" #include "complexmath.h" + // Do the Equalizer as described above void performEqualizer(float* datain,float* dataout, int datalength); @@ -21,7 +22,7 @@ void reverseCooleyTukeyRadix2(float* data, complex_num* dataout, int datalength); //perform the equalize function -void Equalizer(complex_num* data); +void equalizer(complex_num* data); //Performs a radix-2 cooley tukey FFT on the data array to transform back to time void cooleyTukeyBack (float* dataout,complex_num* data, int datalength); @@ -29,4 +30,5 @@ // Calculates and subtracts the signal mean void subMean(float* data, int datalength); + #endif \ No newline at end of file
--- a/LookupTables.cpp Tue Mar 28 08:48:23 2017 +0000
+++ b/LookupTables.cpp Wed Mar 29 08:42:31 2017 +0000
@@ -57,8 +57,8 @@
// Applies the hanning LUT to the supplied array of data
void applyHanningTable(float* data, int datasize){
- if (datasize == 1024){ // Only works for 10 bit data arrays
- for (int i = 0; i < 1024; i++){
+ if (datasize == 512){ // Only works for 9 bit data arrays
+ for (int i = 0; i < 512; i++){
data[i] *= hanningTable_f[i];
}
}
--- a/LookupTables.h Tue Mar 28 08:48:23 2017 +0000
+++ b/LookupTables.h Wed Mar 29 08:42:31 2017 +0000
@@ -26,23 +26,22 @@
////////////////// HANNING LOOKUP TABLE
// 10 bit hanning lookup table
-const float hanningTable_f[] = { 0, 9.43077e-006, 3.77227e-005, 8.48748e-005, 0.000150885, 0.000235751, 0.00033947, 0.000462038, 0.00060345, 0.0007637, 0.000942783, 0.00114069, 0.00135742, 0.00159296, 0.0018473, 0.00212043, 0.00241234, 0.00272303, 0.00305247, 0.00340066, 0.00376758, 0.00415322, 0.00455757, 0.0049806, 0.00542231, 0.00588268, 0.00636168, 0.00685931, 0.00737554, 0.00791035, 0.00846373, 0.00903565, 0.00962609, 0.010235, 0.0108624, 0.0115083, 0.0121726, 0.0128553, 0.0135564, 0.0142758, 0.0150135, 0.0157696, 0.0165439, 0.0173364, 0.0181472, 0.0189761, 0.0198232, 0.0206884, 0.0215716, 0.022473, 0.0233923, 0.0243296, 0.0252849, 0.026258, 0.027249, 0.0282579, 0.0292846, 0.030329, 0.0313911, 0.0324709, 0.0335684, 0.0346834, 0.035816, 0.0369661, 0.0381337, 0.0393187, 0.0405211, 0.0417408, 0.0429778, 0.044232, 0.0455035, 0.046792, 0.0480977, 0.0494204, 0.0507601, 0.0521168, 0.0534904, 0.0548808, 0.056288, 0.0577119, 0.0591525, 0.0606098, 0.0620836, 0.0635739, 0.0650807, 0.0666039, 0.0681435, 0.0696993, 0.0712714, 0.0728597, 0.0744641, 0.0760845, 0.0777209, 0.0793732, 0.0810414, 0.0827255, 0.0844252, 0.0861406, 0.0878717, 0.0896183, 0.0913804, 0.0931578, 0.0949507, 0.0967588, 0.0985821, 0.100421, 0.102274, 0.104143, 0.106026, 0.107924, 0.109838, 0.111765, 0.113708, 0.115665, 0.117637, 0.119623, 0.121623, 0.123638, 0.125666, 0.127709, 0.129766, 0.131837, 0.133922, 0.136021, 0.138133, 0.140259, 0.142399, 0.144552, 0.146718, 0.148898, 0.151091, 0.153297, 0.155517, 0.157749, 0.159994, 0.162252, 0.164523, 0.166806, 0.169102, 0.171411, 0.173732, 0.176065, 0.17841, 0.180768, 0.183137, 0.185519, 0.187912, 0.190317, 0.192734, 0.195163, 0.197603, 0.200054, 0.202517, 0.20499, 0.207475, 0.209972, 0.212479, 0.214996, 0.217525, 0.220064, 0.222614, 0.225174, 0.227745, 0.230326, 0.232917, 0.235518, 0.238129, 0.24075, 0.243381, 0.246021, 0.248671, 0.251331, 0.254, 0.256678, 0.259365, 0.262062, 0.264767, 0.267482, 0.270205, 0.272936, 0.275677, 0.278425, 0.281183, 0.283948, 0.286721, 0.289503, 0.292293, 0.29509, 0.297895, 0.300708, 0.303528, 0.306355, 0.30919, 0.312033, 0.314882, 0.317738, 0.320601, 0.323471, 0.326347, 0.32923, 0.33212, 0.335016, 0.337918, 0.340826, 0.34374, 0.34666, 0.349586, 0.352518, 0.355455, 0.358397, 0.361345, 0.364298, 0.367256, 0.37022, 0.373188, 0.376161, 0.379138, 0.382121, 0.385107, 0.388098, 0.391093, 0.394092, 0.397096, 0.400103, 0.403114, 0.406128, 0.409146, 0.412168, 0.415193, 0.418221, 0.421252, 0.424286, 0.427323, 0.430363, 0.433405, 0.43645, 0.439497, 0.442547, 0.445598, 0.448652, 0.451708, 0.454765, 0.457824, 0.460885, 0.463948, 0.467011, 0.470076, 0.473142, 0.476209, 0.479277, 0.482346, 0.485415, 0.488485, 0.491555, 0.494626, 0.497697, 0.500768, 0.503839, 0.506909, 0.50998, 0.51305, 0.51612, 0.519189, 0.522257, 0.525325, 0.528391, 0.531457, 0.534521, 0.537584, 0.540645, 0.543705, 0.546764, 0.54982, 0.552875, 0.555928, 0.558978, 0.562027, 0.565073, 0.568116, 0.571157, 0.574196, 0.577231, 0.580264, 0.583294, 0.58632, 0.589343, 0.592363, 0.595379, 0.598392, 0.601401, 0.604406, 0.607408, 0.610405, 0.613398, 0.616387, 0.619371, 0.622351, 0.625326, 0.628297, 0.631263, 0.634223, 0.637179, 0.640129, 0.643075, 0.646015, 0.648949, 0.651878, 0.654801, 0.657718, 0.660629, 0.663534, 0.666433, 0.669326, 0.672212, 0.675092, 0.677965, 0.680831, 0.683691, 0.686544, 0.689389, 0.692228, 0.695059, 0.697883, 0.7007, 0.703509, 0.70631, 0.709103, 0.711889, 0.714666, 0.717436, 0.720197, 0.72295, 0.725695, 0.728431, 0.731158, 0.733877, 0.736587, 0.739287, 0.741979, 0.744662, 0.747336, 0.75, 0.752655, 0.7553, 0.757936, 0.760562, 0.763178, 0.765784, 0.76838, 0.770966, 0.773542, 0.776107, 0.778662, 0.781207, 0.783741, 0.786264, 0.788776, 0.791278, 0.793768, 0.796248, 0.798716, 0.801173, 0.803619, 0.806053, 0.808476, 0.810887, 0.813286, 0.815673, 0.818049, 0.820413, 0.822764, 0.825103, 0.82743, 0.829745, 0.832047, 0.834337, 0.836614, 0.838879, 0.84113, 0.843369, 0.845595, 0.847808, 0.850007, 0.852194, 0.854367, 0.856527, 0.858673, 0.860806, 0.862925, 0.86503, 0.867122, 0.8692, 0.871264, 0.873314, 0.87535, 0.877372, 0.879379, 0.881372, 0.883351, 0.885315, 0.887265, 0.8892, 0.891121, 0.893027, 0.894917, 0.896793, 0.898655, 0.900501, 0.902331, 0.904147, 0.905948, 0.907733, 0.909503, 0.911257, 0.912996, 0.914719, 0.916427, 0.918119, 0.919795, 0.921455, 0.923099, 0.924728, 0.92634, 0.927936, 0.929517, 0.931081, 0.932628, 0.93416, 0.935675, 0.937173, 0.938655, 0.940121, 0.94157, 0.943002, 0.944418, 0.945817, 0.947199, 0.948564, 0.949912, 0.951243, 0.952557, 0.953854, 0.955134, 0.956397, 0.957643, 0.958871, 0.960082, 0.961276, 0.962452, 0.963611, 0.964752, 0.965876, 0.966983, 0.968071, 0.969142, 0.970195, 0.971231, 0.972249, 0.973249, 0.974231, 0.975195, 0.976141, 0.97707, 0.97798, 0.978872, 0.979746, 0.980603, 0.981441, 0.98226, 0.983062, 0.983846, 0.984611, 0.985358, 0.986086, 0.986796, 0.987488, 0.988162, 0.988817, 0.989454, 0.990072, 0.990671, 0.991253, 0.991815, 0.992359, 0.992885, 0.993392, 0.99388, 0.99435, 0.994801, 0.995233, 0.995647, 0.996042, 0.996418, 0.996776, 0.997115, 0.997435, 0.997736, 0.998019, 0.998282, 0.998527, 0.998753, 0.998961, 0.999149, 0.999319, 0.99947, 0.999602, 0.999715, 0.999809, 0.999884, 0.999941, 0.999979, 0.999998, 0.999998, 0.999979, 0.999941, 0.999884, 0.999809, 0.999715, 0.999602, 0.99947, 0.999319, 0.999149, 0.998961, 0.998753, 0.998527, 0.998282, 0.998019, 0.997736, 0.997435, 0.997115, 0.996776, 0.996418, 0.996042, 0.995647, 0.995233, 0.994801, 0.99435, 0.99388, 0.993392, 0.992885, 0.992359, 0.991815, 0.991253, 0.990671, 0.990072, 0.989454, 0.988817, 0.988162, 0.987488, 0.986796, 0.986086, 0.985358, 0.984611, 0.983846, 0.983062, 0.98226, 0.981441, 0.980603, 0.979746, 0.978872, 0.97798, 0.97707, 0.976141, 0.975195, 0.974231, 0.973249, 0.972249, 0.971231, 0.970195, 0.969142, 0.968071, 0.966983, 0.965876, 0.964752, 0.963611, 0.962452, 0.961276, 0.960082, 0.958871, 0.957643, 0.956397, 0.955134, 0.953854, 0.952557, 0.951243, 0.949912, 0.948564, 0.947199, 0.945817, 0.944418, 0.943002, 0.94157, 0.940121, 0.938655, 0.937173, 0.935675, 0.93416, 0.932628, 0.931081, 0.929517, 0.927936, 0.92634, 0.924728, 0.923099, 0.921455, 0.919795, 0.918119, 0.916427, 0.914719, 0.912996, 0.911257, 0.909503, 0.907733, 0.905948, 0.904147, 0.902331, 0.900501, 0.898655, 0.896793, 0.894917, 0.893027, 0.891121, 0.8892, 0.887265, 0.885315, 0.883351, 0.881372, 0.879379, 0.877372, 0.87535, 0.873314, 0.871264, 0.8692, 0.867122, 0.86503, 0.862925, 0.860806, 0.858673, 0.856527, 0.854367, 0.852194, 0.850007, 0.847808, 0.845595, 0.843369, 0.84113, 0.838879, 0.836614, 0.834337, 0.832047, 0.829745, 0.82743, 0.825103, 0.822764, 0.820413, 0.818049, 0.815673, 0.813286, 0.810887, 0.808476, 0.806053, 0.803619, 0.801173, 0.798716, 0.796248, 0.793768, 0.791278, 0.788776, 0.786264, 0.783741, 0.781207, 0.778662, 0.776107, 0.773542, 0.770966, 0.76838, 0.765784, 0.763178, 0.760562, 0.757936, 0.7553, 0.752655, 0.75, 0.747336, 0.744662, 0.741979, 0.739287, 0.736587, 0.733877, 0.731158, 0.728431, 0.725695, 0.72295, 0.720197, 0.717436, 0.714666, 0.711889, 0.709103, 0.70631, 0.703509, 0.7007, 0.697883, 0.695059, 0.692228, 0.689389, 0.686544, 0.683691, 0.680831, 0.677965, 0.675092, 0.672212, 0.669326, 0.666433, 0.663534, 0.660629, 0.657718, 0.654801, 0.651878, 0.648949, 0.646015, 0.643075, 0.640129, 0.637179, 0.634223, 0.631263, 0.628297, 0.625326, 0.622351, 0.619371, 0.616387, 0.613398, 0.610405, 0.607408, 0.604406, 0.601401, 0.598392, 0.595379, 0.592363, 0.589343, 0.58632, 0.583294, 0.580264, 0.577231, 0.574196, 0.571157, 0.568116, 0.565073, 0.562027, 0.558978, 0.555928, 0.552875, 0.54982, 0.546764, 0.543705, 0.540645, 0.537584, 0.534521, 0.531457, 0.528391, 0.525325, 0.522257, 0.519189, 0.51612, 0.51305, 0.50998, 0.506909, 0.503839, 0.500768, 0.497697, 0.494626, 0.491555, 0.488485, 0.485415, 0.482346, 0.479277, 0.476209, 0.473142, 0.470076, 0.467011, 0.463948, 0.460885, 0.457824, 0.454765, 0.451708, 0.448652, 0.445598, 0.442547, 0.439497, 0.43645, 0.433405, 0.430363, 0.427323, 0.424286, 0.421252, 0.418221, 0.415193, 0.412168, 0.409146, 0.406128, 0.403114, 0.400103, 0.397096, 0.394092, 0.391093, 0.388098, 0.385107, 0.382121, 0.379138, 0.376161, 0.373188, 0.37022, 0.367256, 0.364298, 0.361345, 0.358397, 0.355455, 0.352518, 0.349586, 0.34666, 0.34374, 0.340826, 0.337918, 0.335016, 0.33212, 0.32923, 0.326347, 0.323471, 0.320601, 0.317738, 0.314882, 0.312033, 0.30919, 0.306355, 0.303528, 0.300708, 0.297895, 0.29509, 0.292293, 0.289503, 0.286721, 0.283948, 0.281183, 0.278425, 0.275677, 0.272936, 0.270205, 0.267482, 0.264767, 0.262062, 0.259365, 0.256678, 0.254, 0.251331, 0.248671, 0.246021, 0.243381, 0.24075, 0.238129, 0.235518, 0.232917, 0.230326, 0.227745, 0.225174, 0.222614, 0.220064, 0.217525, 0.214996, 0.212479, 0.209972, 0.207475, 0.20499, 0.202517, 0.200054, 0.197603, 0.195163, 0.192734, 0.190317, 0.187912, 0.185519, 0.183137, 0.180768, 0.17841, 0.176065, 0.173732, 0.171411, 0.169102, 0.166806, 0.164523, 0.162252, 0.159994, 0.157749, 0.155517, 0.153297, 0.151091, 0.148898, 0.146718, 0.144552, 0.142399, 0.140259, 0.138133, 0.136021, 0.133922, 0.131837, 0.129766, 0.127709, 0.125666, 0.123638, 0.121623, 0.119623, 0.117637, 0.115665, 0.113708, 0.111765, 0.109838, 0.107924, 0.106026, 0.104143, 0.102274, 0.100421, 0.0985821, 0.0967588, 0.0949507, 0.0931578, 0.0913804, 0.0896183, 0.0878717, 0.0861406, 0.0844252, 0.0827255, 0.0810414, 0.0793732, 0.0777209, 0.0760845, 0.0744641, 0.0728597, 0.0712714, 0.0696993, 0.0681435, 0.0666039, 0.0650807, 0.0635739, 0.0620836, 0.0606098, 0.0591525, 0.0577119, 0.056288, 0.0548808, 0.0534904, 0.0521168, 0.0507601, 0.0494204, 0.0480977, 0.046792, 0.0455035, 0.044232, 0.0429778, 0.0417408, 0.0405211, 0.0393187, 0.0381337, 0.0369661, 0.035816, 0.0346834, 0.0335684, 0.0324709, 0.0313911, 0.030329, 0.0292846, 0.0282579, 0.027249, 0.026258, 0.0252849, 0.0243296, 0.0233923, 0.022473, 0.0215716, 0.0206884, 0.0198232, 0.0189761, 0.0181472, 0.0173364, 0.0165439, 0.0157696, 0.0150135, 0.0142758, 0.0135564, 0.0128553, 0.0121726, 0.0115083, 0.0108624, 0.010235, 0.00962609, 0.00903565, 0.00846373, 0.00791035, 0.00737554, 0.00685931, 0.00636168, 0.00588268, 0.00542231, 0.0049806, 0.00455757, 0.00415322, 0.00376758, 0.00340066, 0.00305247, 0.00272303, 0.00241234, 0.00212043, 0.0018473, 0.00159296, 0.00135742, 0.00114069, 0.000942783, 0.0007637, 0.00060345, 0.000462038, 0.00033947, 0.000235751, 0.000150885, 8.48748e-005, 3.77227e-005, 9.43077e-006, 0 };
-
+const float hanningTable_f[] = {0, 3.77966e-05, 0.000151181, 0.000340135, 0.000604631, 0.000944629, 0.00136008, 0.00185091, 0.00241706, 0.00305844, 0.00377495, 0.00456648, 0.00543291, 0.00637411, 0.00738995, 0.00848026, 0.00964488, 0.0108836, 0.0121963, 0.0135828, 0.0150428, 0.0165761, 0.0181825, 0.0198617, 0.0216136, 0.0234377, 0.0253339, 0.0273019, 0.0293413, 0.0314519, 0.0336334, 0.0358853, 0.0382074, 0.0405993, 0.0430607, 0.0455912, 0.0481903, 0.0508578, 0.0535932, 0.0563961, 0.059266, 0.0622026, 0.0652053, 0.0682738, 0.0714076, 0.0746061, 0.077869, 0.0811957, 0.0845857, 0.0880385, 0.0915536, 0.0951304, 0.0987685, 0.102467, 0.106226, 0.110044, 0.113922, 0.117857, 0.121851, 0.125901, 0.130009, 0.134172, 0.13839, 0.142663, 0.14699, 0.151371, 0.155804, 0.160289, 0.164826, 0.169413, 0.174051, 0.178737, 0.183472, 0.188255, 0.193085, 0.197962, 0.202884, 0.207851, 0.212862, 0.217917, 0.223014, 0.228153, 0.233334, 0.238554, 0.243814, 0.249113, 0.25445, 0.259824, 0.265234, 0.27068, 0.27616, 0.281674, 0.287222, 0.292801, 0.298412, 0.304053, 0.309724, 0.315423, 0.321151, 0.326905, 0.332686, 0.338492, 0.344323, 0.350177, 0.356053, 0.361952, 0.367871, 0.37381, 0.379768, 0.385745, 0.391739, 0.397749, 0.403774, 0.409814, 0.415868, 0.421935, 0.428013, 0.434102, 0.440201, 0.446309, 0.452426, 0.458549, 0.464679, 0.470814, 0.476953, 0.483096, 0.489242, 0.495389, 0.501537, 0.507685, 0.513831, 0.519975, 0.526117, 0.532254, 0.538387, 0.544513, 0.550633, 0.556746, 0.56285, 0.568944, 0.575028, 0.5811, 0.58716, 0.593207, 0.59924, 0.605258, 0.61126, 0.617246, 0.623213, 0.629162, 0.635091, 0.641, 0.646888, 0.652753, 0.658596, 0.664414, 0.670207, 0.675975, 0.681716, 0.68743, 0.693115, 0.698771, 0.704397, 0.709993, 0.715556, 0.721087, 0.726584, 0.732047, 0.737476, 0.742868, 0.748223, 0.753541, 0.758821, 0.764061, 0.769262, 0.774421, 0.77954, 0.784616, 0.789649, 0.794638, 0.799583, 0.804482, 0.809336, 0.814142, 0.818901, 0.823612, 0.828274, 0.832887, 0.837449, 0.84196, 0.846419, 0.850826, 0.85518, 0.85948, 0.863726, 0.867917, 0.872052, 0.876131, 0.880153, 0.884118, 0.888024, 0.891872, 0.895661, 0.89939, 0.903058, 0.906666, 0.910212, 0.913696, 0.917117, 0.920476, 0.92377, 0.927001, 0.930167, 0.933269, 0.936304, 0.939274, 0.942177, 0.945014, 0.947783, 0.950484, 0.953118, 0.955683, 0.958179, 0.960605, 0.962962, 0.965249, 0.967466, 0.969612, 0.971687, 0.973691, 0.975623, 0.977483, 0.979271, 0.980987, 0.98263, 0.9842, 0.985696, 0.98712, 0.988469, 0.989745, 0.990947, 0.992074, 0.993127, 0.994106, 0.99501, 0.995839, 0.996593, 0.997272, 0.997875, 0.998404, 0.998857, 0.999235, 0.999537, 0.999764, 0.999915, 0.999991, 0.999991, 0.999915, 0.999764, 0.999537, 0.999235, 0.998857, 0.998404, 0.997875, 0.997272, 0.996593, 0.995839, 0.99501, 0.994106, 0.993127, 0.992074, 0.990947, 0.989745, 0.988469, 0.98712, 0.985696, 0.9842, 0.98263, 0.980987, 0.979271, 0.977483, 0.975623, 0.973691, 0.971687, 0.969612, 0.967466, 0.965249, 0.962962, 0.960605, 0.958179, 0.955683, 0.953118, 0.950484, 0.947783, 0.945014, 0.942177, 0.939274, 0.936304, 0.933269, 0.930167, 0.927001, 0.92377, 0.920476, 0.917117, 0.913696, 0.910212, 0.906666, 0.903058, 0.89939, 0.895661, 0.891872, 0.888024, 0.884118, 0.880153, 0.876131, 0.872052, 0.867917, 0.863726, 0.85948, 0.85518, 0.850826, 0.846419, 0.84196, 0.837449, 0.832887, 0.828274, 0.823612, 0.818901, 0.814142, 0.809336, 0.804482, 0.799583, 0.794638, 0.789649, 0.784616, 0.77954, 0.774421, 0.769262, 0.764061, 0.758821, 0.753541, 0.748223, 0.742868, 0.737476, 0.732047, 0.726584, 0.721087, 0.715556, 0.709993, 0.704397, 0.698771, 0.693115, 0.68743, 0.681716, 0.675975, 0.670207, 0.664414, 0.658596, 0.652753, 0.646888, 0.641, 0.635091, 0.629162, 0.623213, 0.617246, 0.61126, 0.605258, 0.59924, 0.593207, 0.58716, 0.5811, 0.575028, 0.568944, 0.56285, 0.556746, 0.550633, 0.544513, 0.538387, 0.532254, 0.526117, 0.519975, 0.513831, 0.507685, 0.501537, 0.495389, 0.489242, 0.483096, 0.476953, 0.470814, 0.464679, 0.458549, 0.452426, 0.446309, 0.440201, 0.434102, 0.428013, 0.421935, 0.415868, 0.409814, 0.403774, 0.397749, 0.391739, 0.385745, 0.379768, 0.37381, 0.367871, 0.361952, 0.356053, 0.350177, 0.344323, 0.338492, 0.332686, 0.326905, 0.321151, 0.315423, 0.309724, 0.304053, 0.298412, 0.292801, 0.287222, 0.281674, 0.27616, 0.27068, 0.265234, 0.259824, 0.25445, 0.249113, 0.243814, 0.238554, 0.233334, 0.228153, 0.223014, 0.217917, 0.212862, 0.207851, 0.202884, 0.197962, 0.193085, 0.188255, 0.183472, 0.178737, 0.174051, 0.169413, 0.164826, 0.160289, 0.155804, 0.151371, 0.14699, 0.142663, 0.13839, 0.134172, 0.130009, 0.125901, 0.121851, 0.117857, 0.113922, 0.110044, 0.106226, 0.102467, 0.0987685, 0.0951304, 0.0915536, 0.0880385, 0.0845857, 0.0811957, 0.077869, 0.0746061, 0.0714076, 0.0682738, 0.0652053, 0.0622026, 0.059266, 0.0563961, 0.0535932, 0.0508578, 0.0481903, 0.0455912, 0.0430607, 0.0405993, 0.0382074, 0.0358853, 0.0336334, 0.0314519, 0.0293413, 0.0273019, 0.0253339, 0.0234377, 0.0216136, 0.0198617, 0.0181825, 0.0165761, 0.0150428, 0.0135828, 0.0121963, 0.0108836, 0.00964488, 0.00848026, 0.00738995, 0.00637411, 0.00543291, 0.00456648, 0.00377495, 0.00305844, 0.00241706, 0.00185091, 0.00136008, 0.000944629, 0.000604631, 0.000340135, 0.000151181, 3.77966e-05, 0};
// Applies the hanning LUT to the supplied array of data
void applyHanningTable(float* data, int datasize);
////////////////// END HANNING LOOKUP TABLE
////////////////// BIT REVERSING LOOKUP TABLE
-const int reversebit_lut_i[] = {0, 512, 256, 768, 128, 640, 384, 896, 64, 576, 320, 832, 192, 704, 448, 960, 32, 544, 288, 800, 160, 672, 416, 928, 96, 608, 352, 864, 224, 736, 480, 992, 16, 528, 272, 784, 144, 656, 400, 912, 80, 592, 336, 848, 208, 720, 464, 976, 48, 560, 304, 816, 176, 688, 432, 944, 112, 624, 368, 880, 240, 752, 496, 1008, 8, 520, 264, 776, 136, 648, 392, 904, 72, 584, 328, 840, 200, 712, 456, 968, 40, 552, 296, 808, 168, 680, 424, 936, 104, 616, 360, 872, 232, 744, 488, 1000, 24, 536, 280, 792, 152, 664, 408, 920, 88, 600, 344, 856, 216, 728, 472, 984, 56, 568, 312, 824, 184, 696, 440, 952, 120, 632, 376, 888, 248, 760, 504, 1016, 4, 516, 260, 772, 132, 644, 388, 900, 68, 580, 324, 836, 196, 708, 452, 964, 36, 548, 292, 804, 164, 676, 420, 932, 100, 612, 356, 868, 228, 740, 484, 996, 20, 532, 276, 788, 148, 660, 404, 916, 84, 596, 340, 852, 212, 724, 468, 980, 52, 564, 308, 820, 180, 692, 436, 948, 116, 628, 372, 884, 244, 756, 500, 1012, 12, 524, 268, 780, 140, 652, 396, 908, 76, 588, 332, 844, 204, 716, 460, 972, 44, 556, 300, 812, 172, 684, 428, 940, 108, 620, 364, 876, 236, 748, 492, 1004, 28, 540, 284, 796, 156, 668, 412, 924, 92, 604, 348, 860, 220, 732, 476, 988, 60, 572, 316, 828, 188, 700, 444, 956, 124, 636, 380, 892, 252, 764, 508, 1020, 2, 514, 258, 770, 130, 642, 386, 898, 66, 578, 322, 834, 194, 706, 450, 962, 34, 546, 290, 802, 162, 674, 418, 930, 98, 610, 354, 866, 226, 738, 482, 994, 18, 530, 274, 786, 146, 658, 402, 914, 82, 594, 338, 850, 210, 722, 466, 978, 50, 562, 306, 818, 178, 690, 434, 946, 114, 626, 370, 882, 242, 754, 498, 1010, 10, 522, 266, 778, 138, 650, 394, 906, 74, 586, 330, 842, 202, 714, 458, 970, 42, 554, 298, 810, 170, 682, 426, 938, 106, 618, 362, 874, 234, 746, 490, 1002, 26, 538, 282, 794, 154, 666, 410, 922, 90, 602, 346, 858, 218, 730, 474, 986, 58, 570, 314, 826, 186, 698, 442, 954, 122, 634, 378, 890, 250, 762, 506, 1018, 6, 518, 262, 774, 134, 646, 390, 902, 70, 582, 326, 838, 198, 710, 454, 966, 38, 550, 294, 806, 166, 678, 422, 934, 102, 614, 358, 870, 230, 742, 486, 998, 22, 534, 278, 790, 150, 662, 406, 918, 86, 598, 342, 854, 214, 726, 470, 982, 54, 566, 310, 822, 182, 694, 438, 950, 118, 630, 374, 886, 246, 758, 502, 1014, 14, 526, 270, 782, 142, 654, 398, 910, 78, 590, 334, 846, 206, 718, 462, 974, 46, 558, 302, 814, 174, 686, 430, 942, 110, 622, 366, 878, 238, 750, 494, 1006, 30, 542, 286, 798, 158, 670, 414, 926, 94, 606, 350, 862, 222, 734, 478, 990, 62, 574, 318, 830, 190, 702, 446, 958, 126, 638, 382, 894, 254, 766, 510, 1022, 1, 513, 257, 769, 129, 641, 385, 897, 65, 577, 321, 833, 193, 705, 449, 961, 33, 545, 289, 801, 161, 673, 417, 929, 97, 609, 353, 865, 225, 737, 481, 993, 17, 529, 273, 785, 145, 657, 401, 913, 81, 593, 337, 849, 209, 721, 465, 977, 49, 561, 305, 817, 177, 689, 433, 945, 113, 625, 369, 881, 241, 753, 497, 1009, 9, 521, 265, 777, 137, 649, 393, 905, 73, 585, 329, 841, 201, 713, 457, 969, 41, 553, 297, 809, 169, 681, 425, 937, 105, 617, 361, 873, 233, 745, 489, 1001, 25, 537, 281, 793, 153, 665, 409, 921, 89, 601, 345, 857, 217, 729, 473, 985, 57, 569, 313, 825, 185, 697, 441, 953, 121, 633, 377, 889, 249, 761, 505, 1017, 5, 517, 261, 773, 133, 645, 389, 901, 69, 581, 325, 837, 197, 709, 453, 965, 37, 549, 293, 805, 165, 677, 421, 933, 101, 613, 357, 869, 229, 741, 485, 997, 21, 533, 277, 789, 149, 661, 405, 917, 85, 597, 341, 853, 213, 725, 469, 981, 53, 565, 309, 821, 181, 693, 437, 949, 117, 629, 373, 885, 245, 757, 501, 1013, 13, 525, 269, 781, 141, 653, 397, 909, 77, 589, 333, 845, 205, 717, 461, 973, 45, 557, 301, 813, 173, 685, 429, 941, 109, 621, 365, 877, 237, 749, 493, 1005, 29, 541, 285, 797, 157, 669, 413, 925, 93, 605, 349, 861, 221, 733, 477, 989, 61, 573, 317, 829, 189, 701, 445, 957, 125, 637, 381, 893, 253, 765, 509, 1021, 3, 515, 259, 771, 131, 643, 387, 899, 67, 579, 323, 835, 195, 707, 451, 963, 35, 547, 291, 803, 163, 675, 419, 931, 99, 611, 355, 867, 227, 739, 483, 995, 19, 531, 275, 787, 147, 659, 403, 915, 83, 595, 339, 851, 211, 723, 467, 979, 51, 563, 307, 819, 179, 691, 435, 947, 115, 627, 371, 883, 243, 755, 499, 1011, 11, 523, 267, 779, 139, 651, 395, 907, 75, 587, 331, 843, 203, 715, 459, 971, 43, 555, 299, 811, 171, 683, 427, 939, 107, 619, 363, 875, 235, 747, 491, 1003, 27, 539, 283, 795, 155, 667, 411, 923, 91, 603, 347, 859, 219, 731, 475, 987, 59, 571, 315, 827, 187, 699, 443, 955, 123, 635, 379, 891, 251, 763, 507, 1019, 7, 519, 263, 775, 135, 647, 391, 903, 71, 583, 327, 839, 199, 711, 455, 967, 39, 551, 295, 807, 167, 679, 423, 935, 103, 615, 359, 871, 231, 743, 487, 999, 23, 535, 279, 791, 151, 663, 407, 919, 87, 599, 343, 855, 215, 727, 471, 983, 55, 567, 311, 823, 183, 695, 439, 951, 119, 631, 375, 887, 247, 759, 503, 1015, 15, 527, 271, 783, 143, 655, 399, 911, 79, 591, 335, 847, 207, 719, 463, 975, 47, 559, 303, 815, 175, 687, 431, 943, 111, 623, 367, 879, 239, 751, 495, 1007, 31, 543, 287, 799, 159, 671, 415, 927, 95, 607, 351, 863, 223, 735, 479, 991, 63, 575, 319, 831, 191, 703, 447, 959, 127, 639, 383, 895, 255, 767, 511, 1023};
-
+const int reversebit_lut_i[] = {0, 256, 128, 384, 64, 320, 192, 448, 32, 288, 160, 416, 96, 352, 224, 480, 16, 272, 144, 400, 80, 336, 208, 464, 48, 304, 176, 432, 112, 368, 240, 496, 8, 264, 136, 392, 72, 328, 200, 456, 40, 296, 168, 424, 104, 360, 232, 488, 24, 280, 152, 408, 88, 344, 216, 472, 56, 312, 184, 440, 120, 376, 248, 504, 4, 260, 132, 388, 68, 324, 196, 452, 36, 292, 164, 420, 100, 356, 228, 484, 20, 276, 148, 404, 84, 340, 212, 468, 52, 308, 180, 436, 116, 372, 244, 500, 12, 268, 140, 396, 76, 332, 204, 460, 44, 300, 172, 428, 108, 364, 236, 492, 28, 284, 156, 412, 92, 348, 220, 476, 60, 316, 188, 444, 124, 380, 252, 508, 2, 258, 130, 386, 66, 322, 194, 450, 34, 290, 162, 418, 98, 354, 226, 482, 18, 274, 146, 402, 82, 338, 210, 466, 50, 306, 178, 434, 114, 370, 242, 498, 10, 266, 138, 394, 74, 330, 202, 458, 42, 298, 170, 426, 106, 362, 234, 490, 26, 282, 154, 410, 90, 346, 218, 474, 58, 314, 186, 442, 122, 378, 250, 506, 6, 262, 134, 390, 70, 326, 198, 454, 38, 294, 166, 422, 102, 358, 230, 486, 22, 278, 150, 406, 86, 342, 214, 470, 54, 310, 182, 438, 118, 374, 246, 502, 14, 270, 142, 398, 78, 334, 206, 462, 46, 302, 174, 430, 110, 366, 238, 494, 30, 286, 158, 414, 94, 350, 222, 478, 62, 318, 190, 446, 126, 382, 254, 510, 1, 257, 129, 385, 65, 321, 193, 449, 33, 289, 161, 417, 97, 353, 225, 481, 17, 273, 145, 401, 81, 337, 209, 465, 49, 305, 177, 433, 113, 369, 241, 497, 9, 265, 137, 393, 73, 329, 201, 457, 41, 297, 169, 425, 105, 361, 233, 489, 25, 281, 153, 409, 89, 345, 217, 473, 57, 313, 185, 441, 121, 377, 249, 505, 5, 261, 133, 389, 69, 325, 197, 453, 37, 293, 165, 421, 101, 357, 229, 485, 21, 277, 149, 405, 85, 341, 213, 469, 53, 309, 181, 437, 117, 373, 245, 501, 13, 269, 141, 397, 77, 333, 205, 461, 45, 301, 173, 429, 109, 365, 237, 493, 29, 285, 157, 413, 93, 349, 221, 477, 61, 317, 189, 445, 125, 381, 253, 509, 3, 259, 131, 387, 67, 323, 195, 451, 35, 291, 163, 419, 99, 355, 227, 483, 19, 275, 147, 403, 83, 339, 211, 467, 51, 307, 179, 435, 115, 371, 243, 499, 11, 267, 139, 395, 75, 331, 203, 459, 43, 299, 171, 427, 107, 363, 235, 491, 27, 283, 155, 411, 91, 347, 219, 475, 59, 315, 187, 443, 123, 379, 251, 507, 7, 263, 135, 391, 71, 327, 199, 455, 39, 295, 167, 423, 103, 359, 231, 487, 23, 279, 151, 407, 87, 343, 215, 471, 55, 311, 183, 439, 119, 375, 247, 503, 15, 271, 143, 399, 79, 335, 207, 463, 47, 303, 175, 431, 111, 367, 239, 495, 31, 287, 159, 415, 95, 351, 223, 479, 63, 319, 191, 447, 127, 383, 255, 511};
////////////////// END BIT REVERSING LOOKUP TABLE
////////////////// TWIDDLEFACTOR LOOKUP TABLE
// Twiddle factors are complex, thus two look up tables, one for the real and one for the imaginary part
-const float twiddleLookupTable_Real[] = { 1, 0.999981, 0.999925, 0.999831, 0.999699, 0.999529, 0.999322, 0.999078, 0.998795, 0.998476, 0.998118, 0.997723, 0.99729, 0.99682, 0.996313, 0.995767, 0.995185, 0.994565, 0.993907, 0.993212, 0.99248, 0.99171, 0.990903, 0.990058, 0.989177, 0.988258, 0.987301, 0.986308, 0.985278, 0.98421, 0.983105, 0.981964, 0.980785, 0.97957, 0.978317, 0.977028, 0.975702, 0.974339, 0.97294, 0.971504, 0.970031, 0.968522, 0.966976, 0.965394, 0.963776, 0.962121, 0.960431, 0.958703, 0.95694, 0.955141, 0.953306, 0.951435, 0.949528, 0.947586, 0.945607, 0.943593, 0.941544, 0.939459, 0.937339, 0.935184, 0.932993, 0.930767, 0.928506, 0.92621, 0.92388, 0.921514, 0.919114, 0.916679, 0.91421, 0.911706, 0.909168, 0.906596, 0.903989, 0.901349, 0.898674, 0.895966, 0.893224, 0.890449, 0.88764, 0.884797, 0.881921, 0.879012, 0.87607, 0.873095, 0.870087, 0.867046, 0.863973, 0.860867, 0.857729, 0.854558, 0.851355, 0.84812, 0.844854, 0.841555, 0.838225, 0.834863, 0.83147, 0.828045, 0.824589, 0.821102, 0.817585, 0.814036, 0.810457, 0.806848, 0.803208, 0.799537, 0.795837, 0.792107, 0.788346, 0.784557, 0.780737, 0.776888, 0.77301, 0.769103, 0.765167, 0.761202, 0.757209, 0.753187, 0.749136, 0.745058, 0.740951, 0.736817, 0.732654, 0.728464, 0.724247, 0.720003, 0.715731, 0.711432, 0.707107, 0.702755, 0.698376, 0.693971, 0.689541, 0.685084, 0.680601, 0.676093, 0.671559, 0.667, 0.662416, 0.657807, 0.653173, 0.648514, 0.643832, 0.639124, 0.634393, 0.629638, 0.62486, 0.620057, 0.615232, 0.610383, 0.605511, 0.600616, 0.595699, 0.59076, 0.585798, 0.580814, 0.575808, 0.570781, 0.565732, 0.560662, 0.55557, 0.550458, 0.545325, 0.540171, 0.534998, 0.529804, 0.52459, 0.519356, 0.514103, 0.50883, 0.503538, 0.498228, 0.492898, 0.48755, 0.482184, 0.476799, 0.471397, 0.465977, 0.460539, 0.455084, 0.449611, 0.444122, 0.438616, 0.433094, 0.427555, 0.422, 0.41643, 0.410843, 0.405241, 0.399624, 0.393992, 0.388345, 0.382683, 0.377007, 0.371317, 0.365613, 0.359895, 0.354164, 0.348419, 0.342661, 0.33689, 0.331106, 0.32531, 0.319502, 0.313682, 0.30785, 0.302006, 0.296151, 0.290285, 0.284408, 0.27852, 0.272621, 0.266713, 0.260794, 0.254866, 0.248928, 0.24298, 0.237024, 0.231058, 0.225084, 0.219101, 0.21311, 0.207111, 0.201105, 0.19509, 0.189069, 0.18304, 0.177004, 0.170962, 0.164913, 0.158858, 0.152797, 0.14673, 0.140658, 0.134581, 0.128498, 0.122411, 0.116319, 0.110222, 0.104122, 0.0980171, 0.091909, 0.0857973, 0.0796824, 0.0735646, 0.0674439, 0.0613207, 0.0551952, 0.0490677, 0.0429383, 0.0368072, 0.0306748, 0.0245412, 0.0184067, 0.0122715, 0.00613588, 6.12323e-017, -0.00613588, -0.0122715, -0.0184067, -0.0245412, -0.0306748, -0.0368072, -0.0429383, -0.0490677, -0.0551952, -0.0613207, -0.0674439, -0.0735646, -0.0796824, -0.0857973, -0.091909, -0.0980171, -0.104122, -0.110222, -0.116319, -0.122411, -0.128498, -0.134581, -0.140658, -0.14673, -0.152797, -0.158858, -0.164913, -0.170962, -0.177004, -0.18304, -0.189069, -0.19509, -0.201105, -0.207111, -0.21311, -0.219101, -0.225084, -0.231058, -0.237024, -0.24298, -0.248928, -0.254866, -0.260794, -0.266713, -0.272621, -0.27852, -0.284408, -0.290285, -0.296151, -0.302006, -0.30785, -0.313682, -0.319502, -0.32531, -0.331106, -0.33689, -0.342661, -0.348419, -0.354164, -0.359895, -0.365613, -0.371317, -0.377007, -0.382683, -0.388345, -0.393992, -0.399624, -0.405241, -0.410843, -0.41643, -0.422, -0.427555, -0.433094, -0.438616, -0.444122, -0.449611, -0.455084, -0.460539, -0.465977, -0.471397, -0.476799, -0.482184, -0.48755, -0.492898, -0.498228, -0.503538, -0.50883, -0.514103, -0.519356, -0.52459, -0.529804, -0.534998, -0.540171, -0.545325, -0.550458, -0.55557, -0.560662, -0.565732, -0.570781, -0.575808, -0.580814, -0.585798, -0.59076, -0.595699, -0.600616, -0.605511, -0.610383, -0.615232, -0.620057, -0.62486, -0.629638, -0.634393, -0.639124, -0.643832, -0.648514, -0.653173, -0.657807, -0.662416, -0.667, -0.671559, -0.676093, -0.680601, -0.685084, -0.689541, -0.693971, -0.698376, -0.702755, -0.707107, -0.711432, -0.715731, -0.720003, -0.724247, -0.728464, -0.732654, -0.736817, -0.740951, -0.745058, -0.749136, -0.753187, -0.757209, -0.761202, -0.765167, -0.769103, -0.77301, -0.776888, -0.780737, -0.784557, -0.788346, -0.792107, -0.795837, -0.799537, -0.803208, -0.806848, -0.810457, -0.814036, -0.817585, -0.821102, -0.824589, -0.828045, -0.83147, -0.834863, -0.838225, -0.841555, -0.844854, -0.84812, -0.851355, -0.854558, -0.857729, -0.860867, -0.863973, -0.867046, -0.870087, -0.873095, -0.87607, -0.879012, -0.881921, -0.884797, -0.88764, -0.890449, -0.893224, -0.895966, -0.898674, -0.901349, -0.903989, -0.906596, -0.909168, -0.911706, -0.91421, -0.916679, -0.919114, -0.921514, -0.92388, -0.92621, -0.928506, -0.930767, -0.932993, -0.935184, -0.937339, -0.939459, -0.941544, -0.943593, -0.945607, -0.947586, -0.949528, -0.951435, -0.953306, -0.955141, -0.95694, -0.958703, -0.960431, -0.962121, -0.963776, -0.965394, -0.966976, -0.968522, -0.970031, -0.971504, -0.97294, -0.974339, -0.975702, -0.977028, -0.978317, -0.97957, -0.980785, -0.981964, -0.983105, -0.98421, -0.985278, -0.986308, -0.987301, -0.988258, -0.989177, -0.990058, -0.990903, -0.99171, -0.99248, -0.993212, -0.993907, -0.994565, -0.995185, -0.995767, -0.996313, -0.99682, -0.99729, -0.997723, -0.998118, -0.998476, -0.998795, -0.999078, -0.999322, -0.999529, -0.999699, -0.999831, -0.999925, -0.999981, -1, -0.999981, -0.999925, -0.999831, -0.999699, -0.999529, -0.999322, -0.999078, -0.998795, -0.998476, -0.998118, -0.997723, -0.99729, -0.99682, -0.996313, -0.995767, -0.995185, -0.994565, -0.993907, -0.993212, -0.99248, -0.99171, -0.990903, -0.990058, -0.989177, -0.988258, -0.987301, -0.986308, -0.985278, -0.98421, -0.983105, -0.981964, -0.980785, -0.97957, -0.978317, -0.977028, -0.975702, -0.974339, -0.97294, -0.971504, -0.970031, -0.968522, -0.966976, -0.965394, -0.963776, -0.962121, -0.960431, -0.958703, -0.95694, -0.955141, -0.953306, -0.951435, -0.949528, -0.947586, -0.945607, -0.943593, -0.941544, -0.939459, -0.937339, -0.935184, -0.932993, -0.930767, -0.928506, -0.92621, -0.92388, -0.921514, -0.919114, -0.916679, -0.91421, -0.911706, -0.909168, -0.906596, -0.903989, -0.901349, -0.898674, -0.895966, -0.893224, -0.890449, -0.88764, -0.884797, -0.881921, -0.879012, -0.87607, -0.873095, -0.870087, -0.867046, -0.863973, -0.860867, -0.857729, -0.854558, -0.851355, -0.84812, -0.844854, -0.841555, -0.838225, -0.834863, -0.83147, -0.828045, -0.824589, -0.821102, -0.817585, -0.814036, -0.810457, -0.806848, -0.803208, -0.799537, -0.795837, -0.792107, -0.788346, -0.784557, -0.780737, -0.776888, -0.77301, -0.769103, -0.765167, -0.761202, -0.757209, -0.753187, -0.749136, -0.745058, -0.740951, -0.736817, -0.732654, -0.728464, -0.724247, -0.720003, -0.715731, -0.711432, -0.707107, -0.702755, -0.698376, -0.693971, -0.689541, -0.685084, -0.680601, -0.676093, -0.671559, -0.667, -0.662416, -0.657807, -0.653173, -0.648514, -0.643832, -0.639124, -0.634393, -0.629638, -0.62486, -0.620057, -0.615232, -0.610383, -0.605511, -0.600616, -0.595699, -0.59076, -0.585798, -0.580814, -0.575808, -0.570781, -0.565732, -0.560662, -0.55557, -0.550458, -0.545325, -0.540171, -0.534998, -0.529804, -0.52459, -0.519356, -0.514103, -0.50883, -0.503538, -0.498228, -0.492898, -0.48755, -0.482184, -0.476799, -0.471397, -0.465977, -0.460539, -0.455084, -0.449611, -0.444122, -0.438616, -0.433094, -0.427555, -0.422, -0.41643, -0.410843, -0.405241, -0.399624, -0.393992, -0.388345, -0.382683, -0.377007, -0.371317, -0.365613, -0.359895, -0.354164, -0.348419, -0.342661, -0.33689, -0.331106, -0.32531, -0.319502, -0.313682, -0.30785, -0.302006, -0.296151, -0.290285, -0.284408, -0.27852, -0.272621, -0.266713, -0.260794, -0.254866, -0.248928, -0.24298, -0.237024, -0.231058, -0.225084, -0.219101, -0.21311, -0.207111, -0.201105, -0.19509, -0.189069, -0.18304, -0.177004, -0.170962, -0.164913, -0.158858, -0.152797, -0.14673, -0.140658, -0.134581, -0.128498, -0.122411, -0.116319, -0.110222, -0.104122, -0.0980171, -0.091909, -0.0857973, -0.0796824, -0.0735646, -0.0674439, -0.0613207, -0.0551952, -0.0490677, -0.0429383, -0.0368072, -0.0306748, -0.0245412, -0.0184067, -0.0122715, -0.00613588, -1.83697e-016, 0.00613588, 0.0122715, 0.0184067, 0.0245412, 0.0306748, 0.0368072, 0.0429383, 0.0490677, 0.0551952, 0.0613207, 0.0674439, 0.0735646, 0.0796824, 0.0857973, 0.091909, 0.0980171, 0.104122, 0.110222, 0.116319, 0.122411, 0.128498, 0.134581, 0.140658, 0.14673, 0.152797, 0.158858, 0.164913, 0.170962, 0.177004, 0.18304, 0.189069, 0.19509, 0.201105, 0.207111, 0.21311, 0.219101, 0.225084, 0.231058, 0.237024, 0.24298, 0.248928, 0.254866, 0.260794, 0.266713, 0.272621, 0.27852, 0.284408, 0.290285, 0.296151, 0.302006, 0.30785, 0.313682, 0.319502, 0.32531, 0.331106, 0.33689, 0.342661, 0.348419, 0.354164, 0.359895, 0.365613, 0.371317, 0.377007, 0.382683, 0.388345, 0.393992, 0.399624, 0.405241, 0.410843, 0.41643, 0.422, 0.427555, 0.433094, 0.438616, 0.444122, 0.449611, 0.455084, 0.460539, 0.465977, 0.471397, 0.476799, 0.482184, 0.48755, 0.492898, 0.498228, 0.503538, 0.50883, 0.514103, 0.519356, 0.52459, 0.529804, 0.534998, 0.540171, 0.545325, 0.550458, 0.55557, 0.560662, 0.565732, 0.570781, 0.575808, 0.580814, 0.585798, 0.59076, 0.595699, 0.600616, 0.605511, 0.610383, 0.615232, 0.620057, 0.62486, 0.629638, 0.634393, 0.639124, 0.643832, 0.648514, 0.653173, 0.657807, 0.662416, 0.667, 0.671559, 0.676093, 0.680601, 0.685084, 0.689541, 0.693971, 0.698376, 0.702755, 0.707107, 0.711432, 0.715731, 0.720003, 0.724247, 0.728464, 0.732654, 0.736817, 0.740951, 0.745058, 0.749136, 0.753187, 0.757209, 0.761202, 0.765167, 0.769103, 0.77301, 0.776888, 0.780737, 0.784557, 0.788346, 0.792107, 0.795837, 0.799537, 0.803208, 0.806848, 0.810457, 0.814036, 0.817585, 0.821102, 0.824589, 0.828045, 0.83147, 0.834863, 0.838225, 0.841555, 0.844854, 0.84812, 0.851355, 0.854558, 0.857729, 0.860867, 0.863973, 0.867046, 0.870087, 0.873095, 0.87607, 0.879012, 0.881921, 0.884797, 0.88764, 0.890449, 0.893224, 0.895966, 0.898674, 0.901349, 0.903989, 0.906596, 0.909168, 0.911706, 0.91421, 0.916679, 0.919114, 0.921514, 0.92388, 0.92621, 0.928506, 0.930767, 0.932993, 0.935184, 0.937339, 0.939459, 0.941544, 0.943593, 0.945607, 0.947586, 0.949528, 0.951435, 0.953306, 0.955141, 0.95694, 0.958703, 0.960431, 0.962121, 0.963776, 0.965394, 0.966976, 0.968522, 0.970031, 0.971504, 0.97294, 0.974339, 0.975702, 0.977028, 0.978317, 0.97957, 0.980785, 0.981964, 0.983105, 0.98421, 0.985278, 0.986308, 0.987301, 0.988258, 0.989177, 0.990058, 0.990903, 0.99171, 0.99248, 0.993212, 0.993907, 0.994565, 0.995185, 0.995767, 0.996313, 0.99682, 0.99729, 0.997723, 0.998118, 0.998476, 0.998795, 0.999078, 0.999322, 0.999529, 0.999699, 0.999831, 0.999925, 0.999981};
-const float twiddleLookupTable_Imaginary[] = { 0, -0.00613588, -0.0122715, -0.0184067, -0.0245412, -0.0306748, -0.0368072, -0.0429383, -0.0490677, -0.0551952, -0.0613207, -0.0674439, -0.0735646, -0.0796824, -0.0857973, -0.091909, -0.0980171, -0.104122, -0.110222, -0.116319, -0.122411, -0.128498, -0.134581, -0.140658, -0.14673, -0.152797, -0.158858, -0.164913, -0.170962, -0.177004, -0.18304, -0.189069, -0.19509, -0.201105, -0.207111, -0.21311, -0.219101, -0.225084, -0.231058, -0.237024, -0.24298, -0.248928, -0.254866, -0.260794, -0.266713, -0.272621, -0.27852, -0.284408, -0.290285, -0.296151, -0.302006, -0.30785, -0.313682, -0.319502, -0.32531, -0.331106, -0.33689, -0.342661, -0.348419, -0.354164, -0.359895, -0.365613, -0.371317, -0.377007, -0.382683, -0.388345, -0.393992, -0.399624, -0.405241, -0.410843, -0.41643, -0.422, -0.427555, -0.433094, -0.438616, -0.444122, -0.449611, -0.455084, -0.460539, -0.465977, -0.471397, -0.476799, -0.482184, -0.48755, -0.492898, -0.498228, -0.503538, -0.50883, -0.514103, -0.519356, -0.52459, -0.529804, -0.534998, -0.540171, -0.545325, -0.550458, -0.55557, -0.560662, -0.565732, -0.570781, -0.575808, -0.580814, -0.585798, -0.59076, -0.595699, -0.600616, -0.605511, -0.610383, -0.615232, -0.620057, -0.62486, -0.629638, -0.634393, -0.639124, -0.643832, -0.648514, -0.653173, -0.657807, -0.662416, -0.667, -0.671559, -0.676093, -0.680601, -0.685084, -0.689541, -0.693971, -0.698376, -0.702755, -0.707107, -0.711432, -0.715731, -0.720003, -0.724247, -0.728464, -0.732654, -0.736817, -0.740951, -0.745058, -0.749136, -0.753187, -0.757209, -0.761202, -0.765167, -0.769103, -0.77301, -0.776888, -0.780737, -0.784557, -0.788346, -0.792107, -0.795837, -0.799537, -0.803208, -0.806848, -0.810457, -0.814036, -0.817585, -0.821102, -0.824589, -0.828045, -0.83147, -0.834863, -0.838225, -0.841555, -0.844854, -0.84812, -0.851355, -0.854558, -0.857729, -0.860867, -0.863973, -0.867046, -0.870087, -0.873095, -0.87607, -0.879012, -0.881921, -0.884797, -0.88764, -0.890449, -0.893224, -0.895966, -0.898674, -0.901349, -0.903989, -0.906596, -0.909168, -0.911706, -0.91421, -0.916679, -0.919114, -0.921514, -0.92388, -0.92621, -0.928506, -0.930767, -0.932993, -0.935184, -0.937339, -0.939459, -0.941544, -0.943593, -0.945607, -0.947586, -0.949528, -0.951435, -0.953306, -0.955141, -0.95694, -0.958703, -0.960431, -0.962121, -0.963776, -0.965394, -0.966976, -0.968522, -0.970031, -0.971504, -0.97294, -0.974339, -0.975702, -0.977028, -0.978317, -0.97957, -0.980785, -0.981964, -0.983105, -0.98421, -0.985278, -0.986308, -0.987301, -0.988258, -0.989177, -0.990058, -0.990903, -0.99171, -0.99248, -0.993212, -0.993907, -0.994565, -0.995185, -0.995767, -0.996313, -0.99682, -0.99729, -0.997723, -0.998118, -0.998476, -0.998795, -0.999078, -0.999322, -0.999529, -0.999699, -0.999831, -0.999925, -0.999981, -1, -0.999981, -0.999925, -0.999831, -0.999699, -0.999529, -0.999322, -0.999078, -0.998795, -0.998476, -0.998118, -0.997723, -0.99729, -0.99682, -0.996313, -0.995767, -0.995185, -0.994565, -0.993907, -0.993212, -0.99248, -0.99171, -0.990903, -0.990058, -0.989177, -0.988258, -0.987301, -0.986308, -0.985278, -0.98421, -0.983105, -0.981964, -0.980785, -0.97957, -0.978317, -0.977028, -0.975702, -0.974339, -0.97294, -0.971504, -0.970031, -0.968522, -0.966976, -0.965394, -0.963776, -0.962121, -0.960431, -0.958703, -0.95694, -0.955141, -0.953306, -0.951435, -0.949528, -0.947586, -0.945607, -0.943593, -0.941544, -0.939459, -0.937339, -0.935184, -0.932993, -0.930767, -0.928506, -0.92621, -0.92388, -0.921514, -0.919114, -0.916679, -0.91421, -0.911706, -0.909168, -0.906596, -0.903989, -0.901349, -0.898674, -0.895966, -0.893224, -0.890449, -0.88764, -0.884797, -0.881921, -0.879012, -0.87607, -0.873095, -0.870087, -0.867046, -0.863973, -0.860867, -0.857729, -0.854558, -0.851355, -0.84812, -0.844854, -0.841555, -0.838225, -0.834863, -0.83147, -0.828045, -0.824589, -0.821102, -0.817585, -0.814036, -0.810457, -0.806848, -0.803208, -0.799537, -0.795837, -0.792107, -0.788346, -0.784557, -0.780737, -0.776888, -0.77301, -0.769103, -0.765167, -0.761202, -0.757209, -0.753187, -0.749136, -0.745058, -0.740951, -0.736817, -0.732654, -0.728464, -0.724247, -0.720003, -0.715731, -0.711432, -0.707107, -0.702755, -0.698376, -0.693971, -0.689541, -0.685084, -0.680601, -0.676093, -0.671559, -0.667, -0.662416, -0.657807, -0.653173, -0.648514, -0.643832, -0.639124, -0.634393, -0.629638, -0.62486, -0.620057, -0.615232, -0.610383, -0.605511, -0.600616, -0.595699, -0.59076, -0.585798, -0.580814, -0.575808, -0.570781, -0.565732, -0.560662, -0.55557, -0.550458, -0.545325, -0.540171, -0.534998, -0.529804, -0.52459, -0.519356, -0.514103, -0.50883, -0.503538, -0.498228, -0.492898, -0.48755, -0.482184, -0.476799, -0.471397, -0.465977, -0.460539, -0.455084, -0.449611, -0.444122, -0.438616, -0.433094, -0.427555, -0.422, -0.41643, -0.410843, -0.405241, -0.399624, -0.393992, -0.388345, -0.382683, -0.377007, -0.371317, -0.365613, -0.359895, -0.354164, -0.348419, -0.342661, -0.33689, -0.331106, -0.32531, -0.319502, -0.313682, -0.30785, -0.302006, -0.296151, -0.290285, -0.284408, -0.27852, -0.272621, -0.266713, -0.260794, -0.254866, -0.248928, -0.24298, -0.237024, -0.231058, -0.225084, -0.219101, -0.21311, -0.207111, -0.201105, -0.19509, -0.189069, -0.18304, -0.177004, -0.170962, -0.164913, -0.158858, -0.152797, -0.14673, -0.140658, -0.134581, -0.128498, -0.122411, -0.116319, -0.110222, -0.104122, -0.0980171, -0.091909, -0.0857973, -0.0796824, -0.0735646, -0.0674439, -0.0613207, -0.0551952, -0.0490677, -0.0429383, -0.0368072, -0.0306748, -0.0245412, -0.0184067, -0.0122715, -0.00613588, -1.22465e-016, 0.00613588, 0.0122715, 0.0184067, 0.0245412, 0.0306748, 0.0368072, 0.0429383, 0.0490677, 0.0551952, 0.0613207, 0.0674439, 0.0735646, 0.0796824, 0.0857973, 0.091909, 0.0980171, 0.104122, 0.110222, 0.116319, 0.122411, 0.128498, 0.134581, 0.140658, 0.14673, 0.152797, 0.158858, 0.164913, 0.170962, 0.177004, 0.18304, 0.189069, 0.19509, 0.201105, 0.207111, 0.21311, 0.219101, 0.225084, 0.231058, 0.237024, 0.24298, 0.248928, 0.254866, 0.260794, 0.266713, 0.272621, 0.27852, 0.284408, 0.290285, 0.296151, 0.302006, 0.30785, 0.313682, 0.319502, 0.32531, 0.331106, 0.33689, 0.342661, 0.348419, 0.354164, 0.359895, 0.365613, 0.371317, 0.377007, 0.382683, 0.388345, 0.393992, 0.399624, 0.405241, 0.410843, 0.41643, 0.422, 0.427555, 0.433094, 0.438616, 0.444122, 0.449611, 0.455084, 0.460539, 0.465977, 0.471397, 0.476799, 0.482184, 0.48755, 0.492898, 0.498228, 0.503538, 0.50883, 0.514103, 0.519356, 0.52459, 0.529804, 0.534998, 0.540171, 0.545325, 0.550458, 0.55557, 0.560662, 0.565732, 0.570781, 0.575808, 0.580814, 0.585798, 0.59076, 0.595699, 0.600616, 0.605511, 0.610383, 0.615232, 0.620057, 0.62486, 0.629638, 0.634393, 0.639124, 0.643832, 0.648514, 0.653173, 0.657807, 0.662416, 0.667, 0.671559, 0.676093, 0.680601, 0.685084, 0.689541, 0.693971, 0.698376, 0.702755, 0.707107, 0.711432, 0.715731, 0.720003, 0.724247, 0.728464, 0.732654, 0.736817, 0.740951, 0.745058, 0.749136, 0.753187, 0.757209, 0.761202, 0.765167, 0.769103, 0.77301, 0.776888, 0.780737, 0.784557, 0.788346, 0.792107, 0.795837, 0.799537, 0.803208, 0.806848, 0.810457, 0.814036, 0.817585, 0.821102, 0.824589, 0.828045, 0.83147, 0.834863, 0.838225, 0.841555, 0.844854, 0.84812, 0.851355, 0.854558, 0.857729, 0.860867, 0.863973, 0.867046, 0.870087, 0.873095, 0.87607, 0.879012, 0.881921, 0.884797, 0.88764, 0.890449, 0.893224, 0.895966, 0.898674, 0.901349, 0.903989, 0.906596, 0.909168, 0.911706, 0.91421, 0.916679, 0.919114, 0.921514, 0.92388, 0.92621, 0.928506, 0.930767, 0.932993, 0.935184, 0.937339, 0.939459, 0.941544, 0.943593, 0.945607, 0.947586, 0.949528, 0.951435, 0.953306, 0.955141, 0.95694, 0.958703, 0.960431, 0.962121, 0.963776, 0.965394, 0.966976, 0.968522, 0.970031, 0.971504, 0.97294, 0.974339, 0.975702, 0.977028, 0.978317, 0.97957, 0.980785, 0.981964, 0.983105, 0.98421, 0.985278, 0.986308, 0.987301, 0.988258, 0.989177, 0.990058, 0.990903, 0.99171, 0.99248, 0.993212, 0.993907, 0.994565, 0.995185, 0.995767, 0.996313, 0.99682, 0.99729, 0.997723, 0.998118, 0.998476, 0.998795, 0.999078, 0.999322, 0.999529, 0.999699, 0.999831, 0.999925, 0.999981, 1, 0.999981, 0.999925, 0.999831, 0.999699, 0.999529, 0.999322, 0.999078, 0.998795, 0.998476, 0.998118, 0.997723, 0.99729, 0.99682, 0.996313, 0.995767, 0.995185, 0.994565, 0.993907, 0.993212, 0.99248, 0.99171, 0.990903, 0.990058, 0.989177, 0.988258, 0.987301, 0.986308, 0.985278, 0.98421, 0.983105, 0.981964, 0.980785, 0.97957, 0.978317, 0.977028, 0.975702, 0.974339, 0.97294, 0.971504, 0.970031, 0.968522, 0.966976, 0.965394, 0.963776, 0.962121, 0.960431, 0.958703, 0.95694, 0.955141, 0.953306, 0.951435, 0.949528, 0.947586, 0.945607, 0.943593, 0.941544, 0.939459, 0.937339, 0.935184, 0.932993, 0.930767, 0.928506, 0.92621, 0.92388, 0.921514, 0.919114, 0.916679, 0.91421, 0.911706, 0.909168, 0.906596, 0.903989, 0.901349, 0.898674, 0.895966, 0.893224, 0.890449, 0.88764, 0.884797, 0.881921, 0.879012, 0.87607, 0.873095, 0.870087, 0.867046, 0.863973, 0.860867, 0.857729, 0.854558, 0.851355, 0.84812, 0.844854, 0.841555, 0.838225, 0.834863, 0.83147, 0.828045, 0.824589, 0.821102, 0.817585, 0.814036, 0.810457, 0.806848, 0.803208, 0.799537, 0.795837, 0.792107, 0.788346, 0.784557, 0.780737, 0.776888, 0.77301, 0.769103, 0.765167, 0.761202, 0.757209, 0.753187, 0.749136, 0.745058, 0.740951, 0.736817, 0.732654, 0.728464, 0.724247, 0.720003, 0.715731, 0.711432, 0.707107, 0.702755, 0.698376, 0.693971, 0.689541, 0.685084, 0.680601, 0.676093, 0.671559, 0.667, 0.662416, 0.657807, 0.653173, 0.648514, 0.643832, 0.639124, 0.634393, 0.629638, 0.62486, 0.620057, 0.615232, 0.610383, 0.605511, 0.600616, 0.595699, 0.59076, 0.585798, 0.580814, 0.575808, 0.570781, 0.565732, 0.560662, 0.55557, 0.550458, 0.545325, 0.540171, 0.534998, 0.529804, 0.52459, 0.519356, 0.514103, 0.50883, 0.503538, 0.498228, 0.492898, 0.48755, 0.482184, 0.476799, 0.471397, 0.465977, 0.460539, 0.455084, 0.449611, 0.444122, 0.438616, 0.433094, 0.427555, 0.422, 0.41643, 0.410843, 0.405241, 0.399624, 0.393992, 0.388345, 0.382683, 0.377007, 0.371317, 0.365613, 0.359895, 0.354164, 0.348419, 0.342661, 0.33689, 0.331106, 0.32531, 0.319502, 0.313682, 0.30785, 0.302006, 0.296151, 0.290285, 0.284408, 0.27852, 0.272621, 0.266713, 0.260794, 0.254866, 0.248928, 0.24298, 0.237024, 0.231058, 0.225084, 0.219101, 0.21311, 0.207111, 0.201105, 0.19509, 0.189069, 0.18304, 0.177004, 0.170962, 0.164913, 0.158858, 0.152797, 0.14673, 0.140658, 0.134581, 0.128498, 0.122411, 0.116319, 0.110222, 0.104122, 0.0980171, 0.091909, 0.0857973, 0.0796824, 0.0735646, 0.0674439, 0.0613207, 0.0551952, 0.0490677, 0.0429383, 0.0368072, 0.0306748, 0.0245412, 0.0184067, 0.0122715, 0.00613588};
+const float twiddleLookupTable_Real[] = {1.0000000, 0.9999250, 0.9996990, 0.9993220, 0.9987950, 0.9981180, 0.9972900, 0.9963130, 0.9951850, 0.9939070, 0.9924800, 0.9909030, 0.9891770, 0.9873010, 0.9852780, 0.9831050, 0.9807850, 0.9783170, 0.9757020, 0.9729400, 0.9700310, 0.9669760, 0.9637760, 0.9604310, 0.9569400, 0.9533060, 0.9495280, 0.9456070, 0.9415440, 0.9373390, 0.9329930, 0.9285060, 0.9238800, 0.9191140, 0.9142100, 0.9091680, 0.9039890, 0.8986740, 0.8932240, 0.8876400, 0.8819210, 0.8760700, 0.8700870, 0.8639730, 0.8577290, 0.8513550, 0.8448540, 0.8382250, 0.8314700, 0.8245890, 0.8175850, 0.8104570, 0.8032080, 0.7958370, 0.7883460, 0.7807370, 0.7730100, 0.7651670, 0.7572090, 0.7491360, 0.7409510, 0.7326540, 0.7242470, 0.7157310, 0.7071070, 0.6983760, 0.6895410, 0.6806010, 0.6715590, 0.6624160, 0.6531730, 0.6438320, 0.6343930, 0.6248600, 0.6152320, 0.6055110, 0.5956990, 0.5857980, 0.5758080, 0.5657320, 0.5555700, 0.5453250, 0.5349980, 0.5245900, 0.5141030, 0.5035380, 0.4928980, 0.4821840, 0.4713970, 0.4605390, 0.4496110, 0.4386160, 0.4275550, 0.4164300, 0.4052410, 0.3939920, 0.3826830, 0.3713170, 0.3598950, 0.3484190, 0.3368900, 0.3253100, 0.3136820, 0.3020060, 0.2902850, 0.2785200, 0.2667130, 0.2548660, 0.2429800, 0.2310580, 0.2191010, 0.2071110, 0.1950900, 0.1830400, 0.1709620, 0.1588580, 0.1467300, 0.1345810, 0.1224110, 0.1102220, 0.0980171, 0.0857973, 0.0735646, 0.0613207, 0.0490677, 0.0368072, 0.0245412, 0.0122715, 0.0000000, -0.0122715, -0.0245412, -0.0368072, -0.0490677, -0.0613207, -0.0735646, -0.0857973, -0.0980171, -0.1102220, -0.1224110, -0.1345810, -0.1467300, -0.1588580, -0.1709620, -0.1830400, -0.1950900, -0.2071110, -0.2191010, -0.2310580, -0.2429800, -0.2548660, -0.2667130, -0.2785200, -0.2902850, -0.3020060, -0.3136820, -0.3253100, -0.3368900, -0.3484190, -0.3598950, -0.3713170, -0.3826830, -0.3939920, -0.4052410, -0.4164300, -0.4275550, -0.4386160, -0.4496110, -0.4605390, -0.4713970, -0.4821840, -0.4928980, -0.5035380, -0.5141030, -0.5245900, -0.5349980, -0.5453250, -0.5555700, -0.5657320, -0.5758080, -0.5857980, -0.5956990, -0.6055110, -0.6152320, -0.6248600, -0.6343930, -0.6438320, -0.6531730, -0.6624160, -0.6715590, -0.6806010, -0.6895410, -0.6983760, -0.7071070, -0.7157310, -0.7242470, -0.7326540, -0.7409510, -0.7491360, -0.7572090, -0.7651670, -0.7730100, -0.7807370, -0.7883460, -0.7958370, -0.8032080, -0.8104570, -0.8175850, -0.8245890, -0.8314700, -0.8382250, -0.8448540, -0.8513550, -0.8577290, -0.8639730, -0.8700870, -0.8760700, -0.8819210, -0.8876400, -0.8932240, -0.8986740, -0.9039890, -0.9091680, -0.9142100, -0.9191140, -0.9238800, -0.9285060, -0.9329930, -0.9373390, -0.9415440, -0.9456070, -0.9495280, -0.9533060, -0.9569400, -0.9604310, -0.9637760, -0.9669760, -0.9700310, -0.9729400, -0.9757020, -0.9783170, -0.9807850, -0.9831050, -0.9852780, -0.9873010, -0.9891770, -0.9909030, -0.9924800, -0.9939070, -0.9951850, -0.9963130, -0.9972900, -0.9981180, -0.9987950, -0.9993220, -0.9996990, -0.9999250, -1.0000000, -0.9999250, -0.9996990, -0.9993220, -0.9987950, -0.9981180, -0.9972900, -0.9963130, -0.9951850, -0.9939070, -0.9924800, -0.9909030, -0.9891770, -0.9873010, -0.9852780, -0.9831050, -0.9807850, -0.9783170, -0.9757020, -0.9729400, -0.9700310, -0.9669760, -0.9637760, -0.9604310, -0.9569400, -0.9533060, -0.9495280, -0.9456070, -0.9415440, -0.9373390, -0.9329930, -0.9285060, -0.9238800, -0.9191140, -0.9142100, -0.9091680, -0.9039890, -0.8986740, -0.8932240, -0.8876400, -0.8819210, -0.8760700, -0.8700870, -0.8639730, -0.8577290, -0.8513550, -0.8448540, -0.8382250, -0.8314700, -0.8245890, -0.8175850, -0.8104570, -0.8032080, -0.7958370, -0.7883460, -0.7807370, -0.7730100, -0.7651670, -0.7572090, -0.7491360, -0.7409510, -0.7326540, -0.7242470, -0.7157310, -0.7071070, -0.6983760, -0.6895410, -0.6806010, -0.6715590, -0.6624160, -0.6531730, -0.6438320, -0.6343930, -0.6248600, -0.6152320, -0.6055110, -0.5956990, -0.5857980, -0.5758080, -0.5657320, -0.5555700, -0.5453250, -0.5349980, -0.5245900, -0.5141030, -0.5035380, -0.4928980, -0.4821840, -0.4713970, -0.4605390, -0.4496110, -0.4386160, -0.4275550, -0.4164300, -0.4052410, -0.3939920, -0.3826830, -0.3713170, -0.3598950, -0.3484190, -0.3368900, -0.3253100, -0.3136820, -0.3020060, -0.2902850, -0.2785200, -0.2667130, -0.2548660, -0.2429800, -0.2310580, -0.2191010, -0.2071110, -0.1950900, -0.1830400, -0.1709620, -0.1588580, -0.1467300, -0.1345810, -0.1224110, -0.1102220, -0.0980171, -0.0857973, -0.0735646, -0.0613207, -0.0490677, -0.0368072, -0.0245412, -0.0122715, -0.0000000, 0.0122715, 0.0245412, 0.0368072, 0.0490677, 0.0613207, 0.0735646, 0.0857973, 0.0980171, 0.1102220, 0.1224110, 0.1345810, 0.1467300, 0.1588580, 0.1709620, 0.1830400, 0.1950900, 0.2071110, 0.2191010, 0.2310580, 0.2429800, 0.2548660, 0.2667130, 0.2785200, 0.2902850, 0.3020060, 0.3136820, 0.3253100, 0.3368900, 0.3484190, 0.3598950, 0.3713170, 0.3826830, 0.3939920, 0.4052410, 0.4164300, 0.4275550, 0.4386160, 0.4496110, 0.4605390, 0.4713970, 0.4821840, 0.4928980, 0.5035380, 0.5141030, 0.5245900, 0.5349980, 0.5453250, 0.5555700, 0.5657320, 0.5758080, 0.5857980, 0.5956990, 0.6055110, 0.6152320, 0.6248600, 0.6343930, 0.6438320, 0.6531730, 0.6624160, 0.6715590, 0.6806010, 0.6895410, 0.6983760, 0.7071070, 0.7157310, 0.7242470, 0.7326540, 0.7409510, 0.7491360, 0.7572090, 0.7651670, 0.7730100, 0.7807370, 0.7883460, 0.7958370, 0.8032080, 0.8104570, 0.8175850, 0.8245890, 0.8314700, 0.8382250, 0.8448540, 0.8513550, 0.8577290, 0.8639730, 0.8700870, 0.8760700, 0.8819210, 0.8876400, 0.8932240, 0.8986740, 0.9039890, 0.9091680, 0.9142100, 0.9191140, 0.9238800, 0.9285060, 0.9329930, 0.9373390, 0.9415440, 0.9456070, 0.9495280, 0.9533060, 0.9569400, 0.9604310, 0.9637760, 0.9669760, 0.9700310, 0.9729400, 0.9757020, 0.9783170, 0.9807850, 0.9831050, 0.9852780, 0.9873010, 0.9891770, 0.9909030, 0.9924800, 0.9939070, 0.9951850, 0.9963130, 0.9972900, 0.9981180, 0.9987950, 0.9993220, 0.9996990, 0.9999250};
+
+const float twiddleLookupTable_Imaginary[] = {0.0000000, -0.0122715, -0.0245412, -0.0368072, -0.0490677, -0.0613207, -0.0735646, -0.0857973, -0.0980171, -0.1102220, -0.1224110, -0.1345810, -0.1467300, -0.1588580, -0.1709620, -0.1830400, -0.1950900, -0.2071110, -0.2191010, -0.2310580, -0.2429800, -0.2548660, -0.2667130, -0.2785200, -0.2902850, -0.3020060, -0.3136820, -0.3253100, -0.3368900, -0.3484190, -0.3598950, -0.3713170, -0.3826830, -0.3939920, -0.4052410, -0.4164300, -0.4275550, -0.4386160, -0.4496110, -0.4605390, -0.4713970, -0.4821840, -0.4928980, -0.5035380, -0.5141030, -0.5245900, -0.5349980, -0.5453250, -0.5555700, -0.5657320, -0.5758080, -0.5857980, -0.5956990, -0.6055110, -0.6152320, -0.6248600, -0.6343930, -0.6438320, -0.6531730, -0.6624160, -0.6715590, -0.6806010, -0.6895410, -0.6983760, -0.7071070, -0.7157310, -0.7242470, -0.7326540, -0.7409510, -0.7491360, -0.7572090, -0.7651670, -0.7730100, -0.7807370, -0.7883460, -0.7958370, -0.8032080, -0.8104570, -0.8175850, -0.8245890, -0.8314700, -0.8382250, -0.8448540, -0.8513550, -0.8577290, -0.8639730, -0.8700870, -0.8760700, -0.8819210, -0.8876400, -0.8932240, -0.8986740, -0.9039890, -0.9091680, -0.9142100, -0.9191140, -0.9238800, -0.9285060, -0.9329930, -0.9373390, -0.9415440, -0.9456070, -0.9495280, -0.9533060, -0.9569400, -0.9604310, -0.9637760, -0.9669760, -0.9700310, -0.9729400, -0.9757020, -0.9783170, -0.9807850, -0.9831050, -0.9852780, -0.9873010, -0.9891770, -0.9909030, -0.9924800, -0.9939070, -0.9951850, -0.9963130, -0.9972900, -0.9981180, -0.9987950, -0.9993220, -0.9996990, -0.9999250, -1.0000000, -0.9999250, -0.9996990, -0.9993220, -0.9987950, -0.9981180, -0.9972900, -0.9963130, -0.9951850, -0.9939070, -0.9924800, -0.9909030, -0.9891770, -0.9873010, -0.9852780, -0.9831050, -0.9807850, -0.9783170, -0.9757020, -0.9729400, -0.9700310, -0.9669760, -0.9637760, -0.9604310, -0.9569400, -0.9533060, -0.9495280, -0.9456070, -0.9415440, -0.9373390, -0.9329930, -0.9285060, -0.9238800, -0.9191140, -0.9142100, -0.9091680, -0.9039890, -0.8986740, -0.8932240, -0.8876400, -0.8819210, -0.8760700, -0.8700870, -0.8639730, -0.8577290, -0.8513550, -0.8448540, -0.8382250, -0.8314700, -0.8245890, -0.8175850, -0.8104570, -0.8032080, -0.7958370, -0.7883460, -0.7807370, -0.7730100, -0.7651670, -0.7572090, -0.7491360, -0.7409510, -0.7326540, -0.7242470, -0.7157310, -0.7071070, -0.6983760, -0.6895410, -0.6806010, -0.6715590, -0.6624160, -0.6531730, -0.6438320, -0.6343930, -0.6248600, -0.6152320, -0.6055110, -0.5956990, -0.5857980, -0.5758080, -0.5657320, -0.5555700, -0.5453250, -0.5349980, -0.5245900, -0.5141030, -0.5035380, -0.4928980, -0.4821840, -0.4713970, -0.4605390, -0.4496110, -0.4386160, -0.4275550, -0.4164300, -0.4052410, -0.3939920, -0.3826830, -0.3713170, -0.3598950, -0.3484190, -0.3368900, -0.3253100, -0.3136820, -0.3020060, -0.2902850, -0.2785200, -0.2667130, -0.2548660, -0.2429800, -0.2310580, -0.2191010, -0.2071110, -0.1950900, -0.1830400, -0.1709620, -0.1588580, -0.1467300, -0.1345810, -0.1224110, -0.1102220, -0.0980171, -0.0857973, -0.0735646, -0.0613207, -0.0490677, -0.0368072, -0.0245412, -0.0122715, -0.0000000, 0.0122715, 0.0245412, 0.0368072, 0.0490677, 0.0613207, 0.0735646, 0.0857973, 0.0980171, 0.1102220, 0.1224110, 0.1345810, 0.1467300, 0.1588580, 0.1709620, 0.1830400, 0.1950900, 0.2071110, 0.2191010, 0.2310580, 0.2429800, 0.2548660, 0.2667130, 0.2785200, 0.2902850, 0.3020060, 0.3136820, 0.3253100, 0.3368900, 0.3484190, 0.3598950, 0.3713170, 0.3826830, 0.3939920, 0.4052410, 0.4164300, 0.4275550, 0.4386160, 0.4496110, 0.4605390, 0.4713970, 0.4821840, 0.4928980, 0.5035380, 0.5141030, 0.5245900, 0.5349980, 0.5453250, 0.5555700, 0.5657320, 0.5758080, 0.5857980, 0.5956990, 0.6055110, 0.6152320, 0.6248600, 0.6343930, 0.6438320, 0.6531730, 0.6624160, 0.6715590, 0.6806010, 0.6895410, 0.6983760, 0.7071070, 0.7157310, 0.7242470, 0.7326540, 0.7409510, 0.7491360, 0.7572090, 0.7651670, 0.7730100, 0.7807370, 0.7883460, 0.7958370, 0.8032080, 0.8104570, 0.8175850, 0.8245890, 0.8314700, 0.8382250, 0.8448540, 0.8513550, 0.8577290, 0.8639730, 0.8700870, 0.8760700, 0.8819210, 0.8876400, 0.8932240, 0.8986740, 0.9039890, 0.9091680, 0.9142100, 0.9191140, 0.9238800, 0.9285060, 0.9329930, 0.9373390, 0.9415440, 0.9456070, 0.9495280, 0.9533060, 0.9569400, 0.9604310, 0.9637760, 0.9669760, 0.9700310, 0.9729400, 0.9757020, 0.9783170, 0.9807850, 0.9831050, 0.9852780, 0.9873010, 0.9891770, 0.9909030, 0.9924800, 0.9939070, 0.9951850, 0.9963130, 0.9972900, 0.9981180, 0.9987950, 0.9993220, 0.9996990, 0.9999250, 1.0000000, 0.9999250, 0.9996990, 0.9993220, 0.9987950, 0.9981180, 0.9972900, 0.9963130, 0.9951850, 0.9939070, 0.9924800, 0.9909030, 0.9891770, 0.9873010, 0.9852780, 0.9831050, 0.9807850, 0.9783170, 0.9757020, 0.9729400, 0.9700310, 0.9669760, 0.9637760, 0.9604310, 0.9569400, 0.9533060, 0.9495280, 0.9456070, 0.9415440, 0.9373390, 0.9329930, 0.9285060, 0.9238800, 0.9191140, 0.9142100, 0.9091680, 0.9039890, 0.8986740, 0.8932240, 0.8876400, 0.8819210, 0.8760700, 0.8700870, 0.8639730, 0.8577290, 0.8513550, 0.8448540, 0.8382250, 0.8314700, 0.8245890, 0.8175850, 0.8104570, 0.8032080, 0.7958370, 0.7883460, 0.7807370, 0.7730100, 0.7651670, 0.7572090, 0.7491360, 0.7409510, 0.7326540, 0.7242470, 0.7157310, 0.7071070, 0.6983760, 0.6895410, 0.6806010, 0.6715590, 0.6624160, 0.6531730, 0.6438320, 0.6343930, 0.6248600, 0.6152320, 0.6055110, 0.5956990, 0.5857980, 0.5758080, 0.5657320, 0.5555700, 0.5453250, 0.5349980, 0.5245900, 0.5141030, 0.5035380, 0.4928980, 0.4821840, 0.4713970, 0.4605390, 0.4496110, 0.4386160, 0.4275550, 0.4164300, 0.4052410, 0.3939920, 0.3826830, 0.3713170, 0.3598950, 0.3484190, 0.3368900, 0.3253100, 0.3136820, 0.3020060, 0.2902850, 0.2785200, 0.2667130, 0.2548660, 0.2429800, 0.2310580, 0.2191010, 0.2071110, 0.1950900, 0.1830400, 0.1709620, 0.1588580, 0.1467300, 0.1345810, 0.1224110, 0.1102220, 0.0980171, 0.0857973, 0.0735646, 0.0613207, 0.0490677, 0.0368072, 0.0245412, 0.0122715};
////////////////// END TWIDDLEFACTOR LOOKUP TABLE
--- a/main.cpp Tue Mar 28 08:48:23 2017 +0000
+++ b/main.cpp Wed Mar 29 08:42:31 2017 +0000
@@ -1,18 +1,20 @@
#include "mbed.h"
-#include "DFT.h"
+#include "FFT.h"
#include "LookupTables.h"
#include "complexmath.h"
#include <math.h>
-//TODO right values for the twiddle factors LUT equalizer LUT bitreverse LUT in LookupTables
+//TODO right values for the LUT equalizer
//TODO Build all functions in FFT.cpp
//TODO fix main for a test wave and communication to serial
Serial pc(USBTX, USBRX);
-float sampleDataIn [512];
+float sampleDataIn[512];
float sampleDataOut[512];
+complex_num freqValues[512];
+complex_num reordereddata[512];
int datalength = 512;//uitrekenen?
int main()
@@ -22,15 +24,51 @@
for (int i=0; i<511; i++){
if (i%128<64){
sampleDataIn[i]=1000;
- pc.printf ("%f,\t",sampleDatain[i]);
+ pc.printf ("%f,\t",sampleDataIn[i]);
}
else{
sampleDataIn[i]=0;
- pc.printf ("%f,\t",sampleDatain[i]);
+ pc.printf ("%f,\t",sampleDataIn[i]);
}
+ }
sampleDataIn[511]=0;
- pc.printf("%f]\r\n",sampleDataOut[511]);
- performEqualizer(&sampleDataIn, &sampleDataOut,datalength);
+ pc.printf("%f]\r\n",sampleDataIn[511]);
+ //dont performEqualizer(&sampleDataIn, &sampleDataOut, &freqValues, datalength); but seperate functions for testing purposes
+ // - Calculating and substracting the mean -
+ subMean(sampleDataIn, datalength);
+ pc.printf ("zero meaned:[");
+ for (int i=0; i<511; i++){
+ pc.printf ("%f,\t",sampleDataIn[i]);
+ }
+ pc.printf("%f]\r\n",sampleDataIn[511]);
+ // - Applying a hanning window - N multiplications
+ applyHanningTable(sampleDataIn, datalength);
+ pc.printf ("hanned:[");
+ for (int i=0; i<511; i++){
+ pc.printf ("%f,\t",sampleDataIn[i]);
+ }
+ pc.printf("%f]\r\n",sampleDataIn[511]);
+ // It then applies a radix-2 Cooley Tukey FFT to create a fourier transform
+ reverseCooleyTukeyRadix2(sampleDataIn, freqValues, datalength);
+
+ for (int i = 0; i < datalength; i++){
+ reordereddata[reversebit_lut_i[i]].real = freqValues[i].real;
+ reordereddata[reversebit_lut_i[i]].imaginary = freqValues[i].imaginary;
+ }
+ pc.printf ("real part of freqValues:[");
+ for (int i=0; i<511; i++){
+ pc.printf ("%f,\t",reordereddata[i].real);
+ }
+ pc.printf("%f]\r\n",reordereddata[511].real);
+ pc.printf ("imaginary part of freqValues:[");
+ for (int i=0; i<511; i++){
+ pc.printf ("%f,\t",reordereddata[i].imaginary);
+ }
+ pc.printf("%f]\r\n",reordereddata[511].imaginary);
+ // It gets equalized
+ //equalizer(complex_num* freqdata);
+ // back to time domain
+ cooleyTukeyBack(sampleDataOut, freqValues, datalength);
pc.printf ("Equalized data :[");
for (int i=0; i<511; i++) {
pc.printf ("%f,\t",sampleDataOut[i]);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 29 08:42:31 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/093f2bd7b9eb \ No newline at end of file