Download presentation

Presentation is loading. Please wait.

Published byAllison Mills Modified over 2 years ago

1
Copyright © 2003 Texas Instruments. All rights reserved. DSP C5000 Chapter 19 Fast Fourier Transform

2
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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. 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 Where k are the index of the discrete frequencies and n the index of the time samples

3
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 3 Inverse Discrete Fourier Transform The inverse formula is: The inverse formula is: Where, again, k are the index of the discrete frequencies and n the index of the time samples. Where, again, k are the index of the discrete frequencies and n the index of the time samples. We have the following properties: We have the following properties: Discrete time periodic spectra Discrete time periodic spectra Periodic time discrete spectra Periodic time discrete spectra

4
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 4 DFT Computation We can write the DFT: We can write the DFT: We need: We need: N(N-1) complex + N(N-1) complex + N 2 complex × N 2 complex ×

5
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 5 Fast Fourier Transform 1 of 3 Cooley-Tukey algorithm: Cooley-Tukey algorithm: Based on decimation, leads to a factorization of computations. Based on decimation, leads to a factorization of computations. Let us first look at the classical radix 2 decimation in time. 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. 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: First we split the computation between odd and even samples:

6
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 6 Fast Fourier Transform 2 of 3 Using the following property: Using the following property: The DFT can be rewritten: The DFT can be rewritten: For k=0, 1, …, N-1 For k=0, 1, …, N-1

7
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 7 Fast Fourier Transform 3 of 3 Using the property that: Using the property that: The entire DFT can be computed with only k=0, 1, …,N/2-1. The entire DFT can be computed with only k=0, 1, …,N/2-1. and and

8
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 8Butterfly This leads to basic building block of the FFT,the butterfly. This leads to basic building block of the FFT,the butterfly. TFD N/2 x(0) x(2) x(N-2) x(1) x(3) x(N-1) X(0) X(1) X(N/2-1) X(N/2) X(N/2+1) X(N-1) W0W0W0W0 W1W1W1W1 W N/ We need: N/2(N/2-1) complex + for each N/2 DFT.N/2(N/2-1) complex + for each N/2 DFT. (N/2) 2 complex × for each DFT.(N/2) 2 complex × for each DFT. N/2 complex × at the input of the butterflies.N/2 complex × at the input of the butterflies. N complex + for the butter- flies.N complex + for the butter- flies. Grand total:Grand total: N 2 /2 complex + N/2(N/2+1) complex ×

9
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 9Recursion If 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=2 r this can be done until DFT of size 2 (i.e. butterfly with two elements). If 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=2 r this can be done until DFT of size 2 (i.e. butterfly with two elements). x(0) x(4) x(2) x(6) x(1) x(5) x(3) x(7) X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) W80W80W80W80 W81W81W81W81 W82W82W82W82 W83W83W83W W80W80W80W80 W80W80W80W80 W81W81W81W81 W81W81W81W81 W80W80W80W80 W80W80W80W80 W80W80W80W80 W80W80W80W80 W 8 0 =1 1 st stage 2 nd stage 3 rd stage

10
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 10 Number of Operations If N=2 r, we have r=log 2 (N) stages. For each one we have: If N=2 r, we have r=log 2 (N) stages. For each one we have: N/2 complex × (some of them are by 1). N/2 complex × (some of them are by 1). N complex +. N complex +. Thus the grand total of operations is: Thus the grand total of operations is: N/2 log 2 (N) complex ×. N/2 log 2 (N) complex ×. N log 2 (N) complex +. N log 2 (N) complex +. These counts can be compared with the ones for the DFT

11
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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. 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
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 12 Reverse Carry Propagation This scrambling when we use radix 2 FFT can be obtained by the Reverse Carry Propagation (RCP) algorithm. 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. 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. When the data arrive in natural order, they are scrambled in this way.

13
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 13 Algorithm Parameters 1 of 2 The FFT can be computed according to the following pseudo-code: The FFT can be computed according to the following pseudo-code: For each stage For each stage For each group of butterfly For each group of butterfly For each butterfly For each butterfly compute butterfly end end

14
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 14 Algorithm Parameters 2/2 The parameters are shown below: The parameters are shown below:

15
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 15 Scaling The DFT computation for each k is : The DFT computation for each k is : To prevent overflow we need to have: To prevent overflow we need to have: This is guaranteed provided a scale factor 1/N This is guaranteed provided a scale factor 1/N

16
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 16 Quantization Noise Quantization step is : Quantization step is : If words have b+1 bits and x(n) belongs to [-1,1] 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 power If we assume that each real multiplication gives rise to a noise source of power The total amount of noise power for each X(k) is given by The total amount of noise power for each X(k) is given by

17
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 17 Signal to Quantization Noise Ratio (SQNR) DFT case If we assume x(n) uniform in [-1,1], after scaling, variance of data become: If we assume x(n) uniform in [-1,1], after scaling, variance of data become: And because each X(k) comes from N summations: And because each X(k) comes from N summations: SQNR for DFT with scaling is given by: SQNR for DFT with scaling is given by: ENOB: 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. 16 bits per word

18
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 18 Signal to Quantization Noise Ratio (SQNR) FFT case 1 of 3 The computation of one X(k) requires N-1 butterflies: The computation of one X(k) requires N-1 butterflies: x(0) x(4) x(2) x(6) x(1) x(5) x(3) x(7) X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) W80W80W80W80 W81W81W81W81 W82W82W82W82 W83W83W83W W80W80W80W80 W80W80W80W80 W81W81W81W81 W81W81W81W81 W80W80W80W80 W80W80W80W80 W80W80W80W80 W80W80W80W80 N/2 butterflies of the 1 st stage N/4 butterflies of the 2 nd stage 1 butterfly of the last stage

19
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 19 Signal to Quantization Noise Ratio (SQNR) FFT case 2 of 3 Butterfly computation Butterfly computation To prevent overflow, we only need to scale the inputs of each butterfly by 1/2 To prevent overflow, we only need to scale the inputs of each butterfly by 1/2 X n (l) - W X n (k) X n+1 (l) X n+1 (k) X n (l) - W X n (k) X n+1 (l) X n+1 (k) 1/2 1/2 Because we have r stages, the global scaling factor for one output is: Because we have r stages, the global scaling factor for one output is:

20
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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. Quantization noise source at one stage is attenuated by scale factors of all the following stages. This gives an equivalent noise source of: This gives an equivalent noise source of: for each output. SQNR for FFT with scaling is given by: SQNR for FFT with scaling is given by: 16 bits per word

21
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 21 FFT Algorithm with Block Floating Point Scaling Input data in bit reverse order Set-up for next stage Set-up for next group Set-up for next butterfly Scale inputs of butterfly (×1/2) More butterflies ? More groups ? More stages ? End of algorithm Compute butterfly

22
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 22 Case Study C54x Use of audioFFT * Use of audioFFT * ( * ) this program is the same as \ti\examples\dsk5416\bios\audio except for some slight modifications that will be emphazised when necessary Blockprocessing PCM3002 ADC PCM3002 DAC pipRx pipTx inBuffer outBuffer

23
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 23 Audio Program Block processing is echo() function in audio.c : Block processing is echo() function in audio.c : In the original program: Data from input stream are copied directly in output stream. In the original program: Data from input stream are copied directly in output stream. In the modified program : In the modified program : The input stream is split between left and right in two separate buffers. The input stream is split between left and right in two separate buffers. Each buffer is processed Each buffer is processed Bit-reverse scrambling Bit-reverse scrambling Forward transform Forward transform Bit reverse scrambling Bit reverse scrambling Inverse transform Inverse transform Resulting left and right buffers are interleaved in the output stream. Resulting left and right buffers are interleaved in the output stream.

24
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 24 DSPLIB functions The DSP Library (DSPLIB) is a collection of high-level optimized DSP function modules for the C54x and C55x DSP platform. The 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
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 25 Block Processing 1 of 3 Echo( ) Echo( ) Include and declarations Include and declarations

26
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 26 Block Processing 2 of 3 Dsplib functions calls Dsplib functions calls

27
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 27 C54x DSPLIB Bit Reversal

28
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 28 Block Processing 3 of 3 Linker.cmd file Linker.cmd file

29
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 29 C54x DSPLIB FFT

30
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 30 To Run the Build Process Project options Project options

31
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 31 To Change the Size of the Processing Buffer Change buffer length declaration in echo function (audio.c) 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 the call to cfft and cifft according to the size of the FFT (must be hard coded) Change buffer alignment in linker.cmd file Change buffer alignment in linker.cmd file

32
Copyright © 2003 Texas Instruments. All rights reserved. ESIEE, Slide 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. 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. 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.

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google