Background
Currently, processing algorithms (e.g., noise reduction, echo cancellation, etc.) for audio data signals are generally implemented in the frequency domain. In the digital signal processing of audio data, the time-frequency conversion needs to perform FFT/IFFT operation. Since the audio processing algorithm is implemented by framing. Each frame of audio data corresponds to different sampling rates, and the number of sampling points is generally 64/128/256 points, so that the 64/128/256-point FFT/IFFT is usually implemented by a radix-2 method for audio signals.
The defects of the prior art are as follows: the FFT/IFFT operation amount of the base 2 is larger than that of the base 4 and the mixed base; the default input of the FFT/IFFT is complex, and the operation amount of the FFT/IFFT is simplified without utilizing the characteristic that the audio is a real number signal; the existing algorithms are generally floating-point, and the operation cost is larger than that of a fixed point.
Fast Fourier Transform (FFT)/inverse fourier transform (IFFT) principles: the time domain signal obtains a frequency domain signal through Fourier transform; and the frequency domain signal obtains a time domain signal by utilizing inverse Fourier transform. Data sequence of length Nx(n)Discrete fourier transform ofX(k)Can be expressed as:
accordingly, by x (k) through Inverse Discrete Fourier Transform (IDFT) to x (n) can be expressed as:
wherein,
is a twiddle factor. The basic idea of Fast Fourier Transform (FFT) is to decompose the original N-point sequence into a series of short sequences in turn. The characteristics of the twiddle factors in DFT are fully utilized: symmetry, periodicity and reducibility, and the DFTs of these short sequences are obtained and combined appropriately to achieve the purposes of eliminating repetitive calculations, reducing multiplication operations and simplifying the structure. It can be known that the IFFT calculation is performed by performing an FFT operation after conjugating the input, and then dividing the result by the number N of IFFT points.
Disclosure of Invention
In order to solve the above drawbacks, the present invention provides a fast processing method for audio signals, which comprises the following steps:
step 1, extracting FFT/IFFT according to frequency: setting input audio informationNumber sequencex(n)Has a length of N =4LL is an integer, by pair performing DFTX(k)The remainder of dividing k by 4 is decomposed, the base 4 operations have a certain rule, each level of operations consists of N/4 butterfly operations, and the basic iterative formula of each butterfly operation is shown as a formula (1-1);
(2-1)
in the above equation (2-1), m represents the mth stage butterfly operation, k is the number of rows where the data is located, N is the number of points of the data to be calculated,
is a twiddle factor, order
,
,
,
The frequency-decimated butterflies of the
available radix 4 are shown in FIG. 2.
As can be seen from equation (2-1), a radix-4 butterfly requires 3 complex multiplications and 4 complex additions/subtractions. In conclusion, the radical4 log is needed for computing N-point FFT by frequency decimation algorithm4N = L stages of operation. Fig. 2 is a 16-point basis four FFT flow chart.
Step 2, extracting the change rule of the FFT butterfly operation data address according to the frequency domain: for the radix-4 DIF FFT, each stage of calculation is N input data consisting of a group of four data, and a butterfly operation is performed to obtain N output data. In fig. 2, the difference between adjacent data in the four data subjected to the butterfly operation at stage 1 is 4, the difference between adjacent data in the four data subjected to the butterfly operation at stage 2 is 1, the difference is D, and the number of stages in which the butterfly operation is performed is P, and then for N =4LPoint FFT, total log4N = L stages of operation, each stage of operation having N/4 butterfly units, and thus, the relationship of D and P is: d =4L-P;
Step 3, obtaining the change rule of the DIF rotation factor of the base 4: for the FFT algorithm extracted according to frequency, except for the last stage, the calculation results of all the butterfly units of the other stages need to be multiplied by twiddle factors. In FIG. 2, the
level 2 butterflies do not need to be multiplied by twiddle factors, and the
level 1 butterflies need to be multiplied by the corresponding 4 sets of twiddle factors. The corresponding group number of each stage is (N, N/4, N/16.. 1), and the indexes of the butterfly factors of each stage are respectively:
/
/
/
/1,
obtaining the sorting rule of the DIF FFT/IFFT output data of base 4: as shown in FIG. 2, the output order of radix-4 DIF FFT/IFFT is the reverse order of the input according to the 4-ary system, for example, 03 (4-ary system) corresponds to 30 (4-ary system). For all the radix-four FFT/IFFT, the output is obtained by the operation result of the last stage according to the reverse order of the 4-system number.
And 4, executing mixed base DIF FFT/IFFT: setting an input sequencex(n)Has a length of N =4L2, L is an integer. For this case, such as 32-point, 128-point FFT/IFFT, based on radix 4, the patent can implement adding radix 2 operation in the last stage. The difference value of the butterfly operation data address of the last stage of the radix-2 operation is 1. The operation formula is as follows:
(3-1)
step 5, calculating FFT of the real sequence: the inputs to the aforementioned FFT algorithm are all complex, but for audio signals, the inputs are all real. The FFT operation scheme of the real sequence comprises the following steps: simultaneously calculating two N-point real sequence FFTs by using one N-FFT; an N-FFT is used to compute an FFT of a real sequence of 2N points.
Detailed Description
The invention will be better embodied on the basis of the description with the attached drawings, and the method of the invention comprises the following steps:
step 1, extracting FFT/IFFT according to frequency: setting an input audio signal sequencex(n)Has a length of N =4LL is an integer, by pair performing DFTX(k)The remainder of dividing k by 4 is decomposed, the base 4 operations are all regular, each stage of operations is composed of N/4 butterfly operations, the basic iterative formula of each butterfly operation is shown as the following formula (2-1),
in the above equation (2-1), m represents the mth stage butterfly operation, k is the number of rows where the data is located, N is the number of points of the data to be calculated,
is a twiddle factor, order
,
,
,
The frequency-decimated butterflies of the
available radix 4 are shown in FIG. 2.
As can be seen from equation (2-1), a radix-4 butterfly requires 3 complex multiplications and 4 complex additions/subtractions. In summary, the computation of N-point FFT from radix-4 by frequency decimation algorithm requires log4N = L stages of operation. Fig. 2 is a 16-point basis four FFT flow chart.
Step 2, extracting the change rule of the FFT butterfly operation data address according to the frequency domain: for the radix-4 DIF FFT, each stage of calculation is N input data consisting of a group of four data, and a butterfly operation is performed to obtain N output data. In fig. 2, the difference between adjacent data in the four data subjected to the butterfly operation at stage 1 is 4, the difference between adjacent data in the four data subjected to the butterfly operation at stage 2 is 1, the difference is D, and the number of stages in which the butterfly operation is performed is P, and then for N =4LPoint FFT, total log4N = L stages of operation, each stage of operation having N/4 butterfly units, and thus, the relationship of D and P is: d =4L-P;
Step 3, obtaining the change rule of the DIF rotation factor of the base 4: for the FFT algorithm extracted according to frequency, except for the last stage, the calculation results of all the butterfly units of the other stages need to be multiplied by twiddle factors. In FIG. 2, the
level 2 butterflies do not need to be multiplied by twiddle factors, and the
level 1 butterflies need to be multiplied by the corresponding 4 sets of twiddle factors. The corresponding group number of each stage is (N, N/4, N/16.. 1), and the indexes of the butterfly factors of each stage are respectively:
/
/
/
/1,
obtaining the sorting rule of the DIF FFT/IFFT output data of base 4: as shown in FIG. 2, the output order of radix-4 DIF FFT/IFFT is the reverse order of the input according to the 4-ary system, for example, 03 (4-ary system) corresponds to 30 (4-ary system). For all the radix-four FFT/IFFT, the output sequence is obtained by reversing the data address of the last stage according to the 4-system number.
And 4, executing mixed base DIF FFT/IFFT: setting an input sequencex(n)Has a length of N =4L2, L is an integer. For this case, such as 32-point, 128-point FFT/IFFT, based on radix 4, the patent can implement adding radix 2 operation in the last stage. The difference value of the butterfly operation data address of the last stage of the radix-2 operation is 1. The operation formula is as follows:
taking 32 points as an example, the FFT implementation of the mixed base is described below: 1)the 32-point mixed base FFT can be realized by three stages of 4X4X2, the first two stages of
base 4 operation and the last stage of
base 2 operation; 2) the difference value of adjacent data of each stage is as follows: 8/2/1, respectively; 3) the number of the corresponding groups of each stage is 8/2/1, and the butterfly operation units in each group use the same set of butterfly factors circularly. The indexes of each stage of butterfly factors are as follows:
/
1; 4) for the output data of the last stage. And converting the data address into a 2-system, reversing the first 4 bits according to the 4-system, and reversing the last 1 bit according to the 2-system to obtain the output sequence of the FFT/IFFT.
Step 5, calculating FFT of the real sequence: the inputs to the aforementioned FFT algorithm are all complex, but for audio signals, the inputs are all real. For a real sequence n, it can be generally regarded as n + j0, and then the FFT operation is performed. Two algorithms are mentioned below to reduce the complexity and the computation of FFT for real signals: 1) two N-point real sequences are simultaneously calculated by using an N-FFT, and FFT operation is simultaneously carried out on left and right sound channel signals: assume that there are two N-point real signals:
(ii) a The corresponding frequency domain signal after FFT is
0≤k≤N-1。
Order:
wherein
Are all complex sequences. Therefore, the following steps are carried out:
correspondingly:
2) an N-FFT is used to compute an FFT of a real sequence of 2N points, assuming there is a real signal of 2N points:
correspondingly:
FIG. 3 is a fixed-point scheme for a DIF-based 4 butterfly unit, where auto scaling refers to a dynamic overflow checking scheme, if the input and output of each stage butterfly are set to (16, 15), so that the input signal is large and overflow is likely. Therefore, after each stage of operation is calculated, all values are traversed, and if a variable A exceeding an overflow allowable input value is found, the whole array is shifted to the right by one bit; if a variable 2A is found that exceeds the overflow enable input value, the entire array is right shifted by two bits. This ensures that smaller values of the input are not overscaled and larger values of data are also able to pass through the FFT operation.