Implement C Code For FFT-128 - Group11
Implement C Code For FFT-128 - Group11
Implement C Code For FFT-128 - Group11
-The original array subscript I is arranged in order, then the next array must be obtained by adding 1 to
the previous array subscript, that is, it satisfied right-to-left carry rule. For example: the next number of
1011001 must be 1011010. Then after the code position is reversed, it will satisfy the the carry rule from
left to right, for example, the code point of 1011001 is in reverse order of 1001101, the next number is
1011010, and the code point in reverse order is 0101101. It can be seen that 0101101 is obtained by
adding 1 to 1001101 from left to right.
-When N=128, the original subscript is 1101111, which means that the decimal system is 111, and its
reverse order. It is 1111011, which means 123, so half of the traversal does not fully cover all situations.
So we should go from 1 to N-2 (the inverse of 0 and N-1). The framework is as follows:
Next, we consider how to get the reverse order J. The rules of carry from left to right can be understood
in this way. After adding 1 from left to right, if the highest bit is 1, then the bit becomes 0, and the
search continues, if it is still 1, the bit also becomes 0, until the next bit is 0, change 0 to 1, stop
searching; if the highest bit is 0, it will directly change to 1 and stop searching. Since we start from 1, the
reverse order of 1 must be N/2, Therefore, the initial value of J is set to FFTN/2, and the procedure is as
follows:
-First of structure programing, we should complete M-level operations, so we first need to have M
cycles, and secondly, for each level of butterfly operations, we know that a total of calculated times, but
not all calculations use the same twiddle factor, so you need to calculate each twiddle factor first. two
arrays are needed and corresponding to the real and imaginary parts respectively, so the overall
procedure of the FFT operation part is as follows:
-Long array, combined into a complex array, bring it into the FFT program to calculate the FFT, and then
derive the two arrays from the calculation results to perform separately.FFT results, and finally the FFT
results of the two arrays are subjected to a butterfly transform, and the final real FFT result is obtained.
-Set the hamming window function:
The above is the overall code of the optimization program, in which functions and arrays such as cos_fft
are defined as follows:
It is a summary of my original exploration of FFT
Implement C++ code for 128-points FFT(radix 4) alogorithm:
-Set FFT.h:
-Main c++ code: