computation of dfttwins.ee.nctu.edu.tw/courses/dsp_08/dsp9.pdf · nctu ee 1 computation of dft •...
TRANSCRIPT
DSP (2007) Computation of DFT
NCTU EE 1
Computation of DFT
• Efficient algorithms for computing DFT – Fast Fourier Transform. (a) Compute only a few points out of all N points (b) Compute all N points
• What are the efficiency criteria? Number of multiplications Number of additions Chip area in VLSI implementation
DFT as a Linear Transformation • Matrix representation of DFT
Definition of DFT:
1,,1,0,)(1)(
1,,1,0,)()(1
0
1
0
−==
−==
∑
∑−
=
−
−
=
NnWkXN
nx
NkWnxkXN
k
knN
N
n
knN
K
K
where
Let ,
)1(
)1()0(
,
)1(
)1()0(
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−
=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−
=
NX
XX
Nx
xx
NNMM
Xx
and
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
−−−−
−
−
)1)(1()1(2)1(
)1(242
12
1
11
1111
NNN
NN
NN
NNNN
NNNN
N
WWW
WWWWWW
L
MLMMM
L
L
L
W
Thus,
NN
NNN
NNN
N
NN
XW
XWxxWX
*
1
1IDFTpoint -
point DFT-
=
==
−
Because the matrix (transformation) NW has a specific structure and because k
NW has par-
ticular values (for some k and n), we can reduce the number of arithmetic operations for computing this transform.
DSP (2007) Computation of DFT
NCTU EE 2
Example 3] 2 1 0[][ =nx
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−−−−
−−=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
jj
jj
WWWWWWWWW
WWWWWWWWWWWWWWWW
111111
111111
111
1111
14
24
34
24
04
24
34
24
14
94
64
34
04
64
44
24
04
34
24
14
04
04
04
04
04
4W
Only additions are needed to compute this specific transform. (This is a well-known radix-4 FFT)
Thus, the DFT of ][nx is
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−−−+−
==
j
j
22222
6
444 xWX
Fast Fourier Transform -- Highly efficient algorithms for computing DFT • General principle: Divide-and-conquer • Specific properties of k
NW
Complex conjugate symmetry: *)( knN
knN WW =−
Symmetry: kN
NkN WW −=+ 2
Periodicity: kN
NkN WW =+
Particular values of k and n: e.g., radix-4 FFT (no multiplications) • Direct computation of DFT
( ) ( ) ( ) ( )[ ]( ) ( ) ( ) ( )[ ]∑
∑−
=
−
=
⎭⎬⎫
⎩⎨⎧
+⋅+⋅−⋅
=
−=⋅=
1
0
1
0
Re][ImIm][ReIm][ImRe][Re
1,,1,0 ,][][
N
nkn
Nkn
N
knN
knN
N
n
knN
WnxWnxjWnxWnx
NkWnxkX K
For each k, we need N complex multiplications and N-1 complex additions. 4N real multiplications and 4N-2 real additions.
We will show how to use the properties of kNW to reduce computations.
• Radix-2 algorithms: Decimation-in-time; Decimation-in-frequency • Composite N algorithms: Cooley-Tukey; Prime factor • Winograd algorithm • Chirp transform algorithm
DSP (2007) Computation of DFT
NCTU EE 3
Radix-2 Decimation-in-time Algorithms -- Assume N-point DFT and ν2=N
Idea: N-point DFT 2
N -point DFT 4N -point DFT
4N -point DFT
2N -point DFT 4
N -point DFT
4
N -point DFT
Sequence: ]1[]2[]3[]2[]1[]0[ −Nxnxxxxx LL
Even index: ]2[]2[]0[ −Nxxx L Odd index: ]1[]3[]1[ −Nxxx L
2/2/
2222
12
0
12
0
)12(2
12
odd
2
even
1
0
]12[]2[
][][
1,,1,0 ,][][
NN
jN
j
N
N
r
N
r
krN
rkN
rn
n
knN
rn
n
knN
N
n
knN
WeeW
WrxWrx
WnxWnx
NkWnxkX
===
++=
+=
−==
⎟⎠⎞
⎜⎝⎛−⎟
⎠⎞
⎜⎝⎛−
−
=
−
=
+
+==
−
=
∑ ∑
∑∑∑
ππ
Q
4342143421
K
][][
]12[]2[][
point DFT-2
12
02/
point DFT-2
12
02/
kHWkG
WrxWWrxkX
kN
N
N
r
rkN
kN
N
N
r
rkN
+=
++= ∑∑−
=
−
= 444 3444 2144 344 21
DSP (2007) Computation of DFT
NCTU EE 4
Comparison: (a) Direct computation of N-point DFT (N frequency samples): ~ 2N complex multiplications and 2N complex adds
(b) Direct computation of 2
N -point DFT:
~ 2
2 ⎟⎠⎞
⎜⎝⎛ N complex multiplications and 2
2 ⎟⎠⎞
⎜⎝⎛ N complex adds
+ additional N complex multis and N complex adds
~ (Total:) 22
222 NNNN +=⎟
⎠⎞
⎜⎝⎛+ complex multis and adds
(c) N2log -stage FFT
Since ν2=N , we can further break 2
N -point DFT into two 4
N -point DFT and
so on.
At each stage: ~ N complex multis and adds
Total: ~ NN 2log complex multis and adds (--> NN2log
2)
DSP (2007) Computation of DFT
NCTU EE 5
Number of points, N
Direct Computation: Complex Multis
FFT: Complex Multis
Speed Im-provement Factor
4 16 4 4.08 64 12 5.3
16 256 32 864 4,096 192 21.3
256 65,536 1,024 64.01024 1,048,576 5,120 204.8
Butterfly: Basic unit in FFT
Two multiplications:
One multiplication:
DSP (2007) Computation of DFT
NCTU EE 6
In-place computations Only two registers are needed for computing a butterfly unit.
][][][
][][][
11
11
qXWpXqX
qXWpXpX
mr
Nmm
mr
Nmm
−−
−−
−=
+=
Advantage: less storage! In order to retain the in-place computation property, the input data are accessed in the
bit-reversed order. Note: The outputs are in the normal order (same as the “position”)
Position Binary equivalent Bit reversed Sequence index
6 110 011 3 2 010 010 2
Remark: Index 3 input data is placed at position 6.
We may also place the inputs in the normal order; then the outputs are in the bit-reversed order.
DSP (2007) Computation of DFT
NCTU EE 7
If we try to maintain the normal order of both inputs and outputs, then in-place compu-tation structure is destroyed.
DSP (2007) Computation of DFT
NCTU EE 8
Radix-2 Decimation-in-frequency Algorithms Dividing the output sequence ][kX into smaller pieces.
1,,1,0,)()(1
0−== ∑
−
=NkWnxkX
N
n
knN K
If k is even, rk 2= .
∑
∑
∑ ∑
∑ ∑
∑
−
=
−
=
+
−
=
−
=
⎟⎠⎞
⎜⎝⎛ +
−
=
−
=
−
=
⋅⎟⎠⎞
⎜⎝⎛
⎥⎦⎤
⎢⎣⎡ ++=
⋅⎟⎠⎞
⎜⎝⎛
⎥⎦⎤
⎢⎣⎡ ++=
==
⋅⎥⎦⎤
⎢⎣⎡ ++=
+←+=
−==
12
02
12
0
2
22]2[2
12
0
12
0
22
2
12
0
1
2
22
1
0
2][
2][
2][
)2(][][
12
,,1,0 ,][]2[
N
n
nrN
N
n
nrN
rnN
rNN
rnN
NnrN
N
n
N
n
Nnr
Nnr
N
N
n
N
Nn
nrN
nrN
N
n
knN
WNnxnx
WNnxnx
WWWW
WNnxWnx
NnnWnxWnx
NrWnxrX
Q
L
Similarly, if k is odd, 12 += rk .
∑−
=⋅⋅⎟
⎠⎞
⎜⎝⎛
⎥⎦⎤
⎢⎣⎡ +−=+
12
022
][]12[
N
n
nrN
nN WWNnxnxrX
⎪⎪
⎩
⎪⎪
⎨
⎧
⋅⋅⎟⎠⎞
⎜⎝⎛
⎥⎦⎤
⎢⎣⎡ +−=+
⋅⎟⎠⎞
⎜⎝⎛
⎥⎦⎤
⎢⎣⎡ ++=
∑
∑−
=
−
=
12
02
12
02
2][]12[
2][]2[
N
n
nrN
nN
N
n
nrN
WWNnxnxrX
WNnxnxrX
Let
⎪⎪⎩
⎪⎪⎨
⎧
⎥⎦⎤
⎢⎣⎡ +−=
⎥⎦⎤
⎢⎣⎡ ++=
2][][
2][][
Nnxnxnh
Nnxnxng
DSP (2007) Computation of DFT
NCTU EE 9
We can further break ]2[ rX into even and odd groups … Again, we can reduce the two-multiplication butterfly into one multiplication. Hence, the
computational complexity is bout NN2log
2. The in-place computation property holds if the
outputs are in bit-reversed order (when inputs are in the normal order).
DSP (2007) Computation of DFT
NCTU EE 10
FFT for Composite N -- Cooley-Tukey Algorithm: 21NNN =
⎪⎪⎩
⎪⎪⎨
⎧
⎩⎨⎧
−≤≤−≤≤
+=
⎩⎨⎧
−≤≤−≤≤
+=
1010
:index Freq.
1010
:index Time
22
11211
22
11212
NkNk
kNkk
NnNn
nnNn
Remark: ),( 21 nnn ↔ and ),( 21 kkk ↔
Goal: Decompose N-point DFT into two stages:
1N -point DFT⊗ 2N -point DFT
( )( )
44444444 344444444 21
3214444 34444 21
43421321321
point-
1
0factor
twiddlepoint-
1
0212
1
0
1
0 1
212
1
0
1
0212
211
1
0
2
2
2
222
21
1
1
1
111
2
2
1
1
1221
222
21121
111
112
2
2
1
1
212211
][
][
][
][
10 ,][][
N
N
n
nkN
nkN
N
N
n
nkN
N
n
N
n
nkNNN
W
nNkN
nkN
W
nkNN
N
n
N
n
nnNkNkN
N
n
knN
WWWnnNx
WWWWnnNx
WnnNx
kNkX
NkWnxkX
nkN
nkN
∑ ∑
∑ ∑
∑ ∑
∑
−
=
−
=
−
=
−
=
−
=
−
=
++
−
=
⋅
⎪⎪⎭
⎪⎪⎬
⎫
⎪⎪⎩
⎪⎪⎨
⎧
⋅⎥⎦
⎤⎢⎣
⎡⋅+=
⋅⋅⋅⋅+=
⋅+=
+=
−≤≤=
Procedure
(1) Compute 1N -point DFT: (row transform)
∑−
=⋅+=
1
021212
1
1
111
][],[N
n
nkNWnnNxknG
(2) Multiply twiddle factors: ],[],[~
121221 knGWknG nk
N ⋅=
(3) Compute 2N -point DFT: (column transform)
∑−
=⋅=+
1
012211
2
2
222
],[~][N
n
nkNWknGkNkX
DSP (2007) Computation of DFT
NCTU EE 11
(Computation of N=15-point DFT by means of 3-point and 5-point DFTs.)
DSP (2007) Computation of DFT
NCTU EE 12
Extension: νNNNN L21=
21 Ifpoint DFT-for tionsmultiplica ofnumber )(Let
NNNNN
=≡μ
⎪⎩
⎪⎨
⎧
⋅=
⋅
)(: transfrmcolumn 3.:factors twiddle2.
)(:ormrow transf 1.
21
21
12
NNNNN
NN
μ
μ
⎟⎟⎠
⎞⎜⎜⎝
⎛++=
+⋅+⋅=
1)()()()()(
2
2
1
1
2112
NN
NNN
NNNNNNμμ
μμμ
In general, ⎟⎟⎠
⎞⎜⎜⎝
⎛−+= ∑
=
ννμμ
1)1()()(
i i
i
NNNN
In fact, the term ( )1−ν should be ( )2
1−ν because rearranging the butterfly structure
would make half of the branches becoming “1”.
Special Case: 221 ==== νNNN L
Radix-2: 221 ==== νNNN L and N2log=ν
( )2
1)( −= νμ NN multiplications because )2(μ requires no multiplications.
Radix-4: 421 ==== νNNN L and N4log=ν
( )2
1)( −= νμ NN multiplications because )4(μ requires no multiplications. This FFT
has fewer stages than Radix-2 ==> fewer multiplications.
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−−−−
−−=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
jj
jj
WWWWWWWWW
WWWWWWWWWWWWWWWW
111111
111111
111
1111
14
24
34
24
04
24
34
24
14
94
64
34
04
64
44
24
04
34
24
14
04
04
04
04
04
4W
DSP (2007) Computation of DFT
NCTU EE 13
Inverse FFT IDFT: ∑
−
=
−⋅=1
0][1][
N
k
knNWkX
Nnx (*)
DFT: ∑−
=⋅=
1
0][][
N
n
nkNWnxkX
Hence, take the conjugate of (*) :
( )
( )
[ ])( DFT1
][1
][1
][1][
*
1
0
*
1
0
*
*1
0
*
kXN
WkXN
WkXN
WkXN
nx
N
k
knN
N
k
knN
N
k
knN
=
⋅=
⋅=
⎟⎠⎞
⎜⎝⎛ ⋅=
∑
∑
∑
−
=
−
=
−
−
=
−
Take the conjugate of the above equation:
[ ]( )[ ]( )**
**
)(FFT 1
)(DFT 1][
kXN
kXN
nx
=
=
Thus, we can use the FFT algorithm to compute the inverse DFT.