2 Discrete Fourier Transform Allows us to compute an approximation of the Fourier Transform on a discrete set of frequencies from a discrete set of time samples.Where k are the index of the discrete frequencies and n the index of the time samples
3 Inverse Discrete Fourier Transform The inverse formula is:Where, again, k are the index of the discrete frequencies and n the index of the time samples.We have the following properties:Discrete time periodic spectraPeriodic time discrete spectra
4 DFT Computation We can write the DFT: We need: N(N-1) complex ‘+’ Each complex addition requires two real additions.Each complex multiplication requires 4 real multiplications and 3 real additions.
5 Fast Fourier Transform 1 of 3 Cooley-Tukey algorithm:Based on decimation, leads to a factorization of computations.Let us first look at the classical radix 2 decimation in time.This particular case of the algorithm requires the time sequence length to be a power of 2.First we split the computation between odd and even samples:
6 Fast Fourier Transform 2 of 3 Using the following property:The DFT can be rewritten:For k=0, 1, …, N-1
7 Fast Fourier Transform 3 of 3 Using the property that:The entire DFT can be computed with only k=0, 1, …,N/2-1.and
8 ButterflyThis leads to basic building block of the FFT, the butterfly.x(0)TFD N/2X(0)We need:N/2(N/2-1) complex ‘+’ for each N/2 DFT.(N/2)2 complex ‘×’ for each DFT.N/2 complex ‘×’ at the input of the butterflies.N complex ‘+’ for the butter-flies.Grand total:N2/2 complex ‘+’N/2(N/2+1) complex ‘×’x(2)X(1)x(N-2)X(N/2-1)x(1)W0TFD N/2X(N/2)-x(3)W1X(N/2+1)-x(N-1)WN/2-1X(N-1)-
9 RecursionIf N/2 is even, we can further split the computation of each DFT of size N/2 into two computations of half size DFT. When N=2r this can be done until DFT of size 2 (i.e. butterfly with two elements).3rd stage2nd stage1st stagex(0)X(0)W80x(4)X(1)-W80x(2)X(2)-W80W81x(6)X(3)--W80x(1)X(4)-W80=1W80W81x(5)X(5)--W80W82x(3)X(6)--W80W81W83x(7)X(7)---
10 Number of OperationsIf N=2r, we have r=log2(N) stages. For each one we have:N/2 complex ‘×’ (some of them are by ‘1’).N complex ‘+’.Thus the grand total of operations is:N/2 log2(N) complex ‘×’.N log2(N) complex ‘+’.These counts can be compared with the ones for the DFT
11 Shuffling the Data, Bit Reverse Ordering At each step of the algorithm, data are split between even and odd values. This results in scrambling the order.Recursion of the algorithm
12 Reverse Carry Propagation This scrambling when we use radix 2 FFT can be obtained by the Reverse Carry Propagation (RCP) algorithm.We start with address 0 then we add N/2 to obtain the next address. If there is a carry, it propagates towards the least significant bit.When the data arrive in natural order, they are scrambled in this way.
13 Algorithm Parameters 1 of 2 The FFT can be computed according to the following pseudo-code:For each stageFor each group of butterflyFor each butterflycompute butterflyend
14 Algorithm Parameters 2/2 The parameters are shown below:
15 Scaling The DFT computation for each k is : To prevent overflow we need to have:This is guaranteed provided a scale factor 1/N
16 Quantization Noise Quantization step is : If words have b+1 bits and x(n) belongs to [-1,1]If we assume that each real multiplication gives rise to a noise source of powerThe total amount of noise power for each X(k) is given by
17 Signal to Quantization Noise Ratio (SQNR) DFT case If we assume x(n) uniform in [-1,1], after scaling, variance of data become:And because each X(k) comes from N summations:SQNR for DFT with scaling is given by:16 bits per wordENOB: effective number of bits, gives the effective resolution given a SNR. Based on the assumption that 6dB of SNR equates to 1 bit of precision.
18 Signal to Quantization Noise Ratio (SQNR) FFT case 1 of 3 The computation of one X(k) requires N-1 butterflies:N/2 butterflies of the 1st stageN/4 butterflies of the 2nd stage1 butterfly of the last stagex(0)X(0)W80x(4)X(1)-W80x(2)X(2)-W80W81x(6)X(3)--W80x(1)X(4)-W80W81x(5)X(5)--W80W82x(3)X(6)--W80W81W83x(7)X(7)
19 Signal to Quantization Noise Ratio (SQNR) FFT case 2 of 3 Butterfly computationTo prevent overflow, we only need to scale the inputs of each butterfly by 1/2Xn(l)Xn+1(l)WXn(k)Xn+1(k)-1/2Because we have r stages, the global scaling factor for one output is:Xn(l)Xn+1(l)1/2WXn(k)Xn+1(k)-
20 Signal to Quantization Noise Ratio (SQNR) FFT case 3 of 3 Quantization noise source at one stage is attenuated by scale factors of all the following stages.This gives an equivalent noise source of:for each output.SQNR for FFT with scaling is given by:16 bits per word
21 FFT Algorithm with Block Floating Point Scaling Input data in bit reverse orderSet-up for next stageMore groups ?Set-up for next groupMore stages ?Set-up for next butterflyScale inputs of butterfly (×1/2)End of algorithmCompute butterflyMore butterflies ?
22 Case Study ‘C54x Use of audioFFT* inBuffer PCM3002 ADC pipRx Block processingpipTxPCM3002 DACoutBuffer(*) this program is the same as \ti\examples\dsk5416\bios\audio except for some slight modifications that will be emphazised when necessary
23 Audio Program Block processing is echo() function in audio.c : In the original program: Data from input stream are copied directly in output stream.In the modified program :The input stream is split between left and right in two separate buffers.Each buffer is processedBit-reverse scramblingForward transformBit reverse scramblingInverse transformResulting left and right buffers are interleaved in the output stream.
24 DSPLIB functionsThe DSP Library (DSPLIB) is a collection of high-level optimized DSP function modules for the ‘C54x and ‘C55x DSP platform.‘C54x DSPLIB functions for FFT computation
25 Block Processing 1 of 3Echo( )Include and declarations
31 To Change the Size of the Processing Buffer Change buffer length declaration in echo function (audio.c)Change the call to cfft and cifft according to the size of the FFT (must be hard coded)Change buffer alignment in linker .cmd file
32 Follow on Activities for TMS320C5416 DSK Application 8 for the the TMS320C5416 DSK uses the FFT as a spectrum analyzer to display the power in an audio signal at various frequencies.Rather than using the optimized library DSPLIB for the FFT, it uses a C code version that is slower, but can be stepped through line by line using Code Composer Studio.