Вы находитесь на странице: 1из 55

2D Fast Fourier Transform

Dr. Shyam Lal


shyamfec@nitk.edu.in
Department of E & C Engg.
Engg.
National Institute of Technology
Karnataka, Surathkal, Mangalore(KA)

3/1/2017 Vision, Graphics and their Applications 1


THE FAST FOURIER TRANSFORM
 Two Methods for Efficient computation of 2D DFT:
 Row--Column Decomposition
Row
 Vector Radix FFT Algorithm

3/1/2017 Vision, Graphics and their Applications 2


THE FAST FOURIER TRANSFORM
 Row--Column Decomposition:
Row

3/1/2017 Vision, Graphics and their Applications 3


THE FAST FOURIER TRANSFORM
 Row--Column Decomposition:
Row

3/1/2017 Vision, Graphics and their Applications 4


THE FAST FOURIER TRANSFORM
 Row--Column Decomposition:
Row

3/1/2017 Vision, Graphics and their Applications 5


THE FAST FOURIER TRANSFORM
 Computational Complexity:
 Direct 2D-
2D-DFT:
2 2
 No. of Complex multiplications N1 N 2
 Row--Column Decomposition:
Row
Row wise: 2
 No. of Complex multiplications N 2 N1
Column wise: 2
 No. of Complex Multiplications :
N1 N 2
 Total No. of Complex multiplications

for X(k1,k2) is
N1 N 2 ( N 1 + N2 )
3/1/2017 Vision, Graphics and their Applications 6
THE FAST FOURIER TRANSFORM

3/1/2017 Vision, Graphics and their Applications 7


Vector Radix FFT Algorithm
 Divide-and-
Divide- and-conquer algorithm:
 Operates as a recursive procedure
 Solves problem by dividing it into smaller problems
that are the same and then combining answers
 Examples of divide-
divide-and-
and-conquer algorithms
 1-D FFT
 Vector--Radix FFT
Vector

3/1/2017 Vision, Graphics and their Applications 8


Vector Radix FFT Algorithm
 1-D FFT

where G(K) and H(K) can be calculated by


using N/2-
N/2-point DFTs.
3/1/2017 9
Vector Radix FFT Algorithm
 2-D FFT

3/1/2017 10
Vector Radix FFT Algorithm
 2-D Decimation
Decimation--In
In--Time FFT algorithm

NOTE:
If n1 is Even =>n1=2m1 If n2 is Even =>n2=2m2
If n1 is Odd =>n1=2m1+1 If n2 is Odd =>n2=2m2+1

3/1/2017 11
Vector Radix FFT Algorithm
 2-D Decimation
Decimation--In
In--Time FFT algorithm

Xee(K1,K2)

Xeo(K1,K2)

Xoe(K1,K2)

Xoo(K1,K2)

3/1/2017 12
Vector Radix FFT Algorithm
 2-D Decimation
Decimation--In
In--Time FFT algorithm

3/1/2017 13
Vector Radix FFT Algorithm
 2-D Decimation
Decimation--In
In--Time FFT algorithm

3/1/2017 14
Vector Radix FFT Algorithm
 2-D Decimation
Decimation--In
In--Time FFT algorithm

3/1/2017 15
Vector Radix FFT Algorithm
 Implementation: Basic unit in structure is called
a Butterfly (even though it looks more like a
Butterfly in 1-
1-D case)
 Basic Butterfly:

3/1/2017 16
Vector Radix FFT Algorithm
k2 k1 k1 + k 2
X ( k1 , k 2 ) = S 00 ( k1 , k 2 ) + S 01 ( k1 , k 2 )W N + S10 ( k1 , k 2 )W N + S11 ( k1 , k 2 )W N

N N
1 1
2 2 m1 k 1 + m 2 k 2
S 00 ( k1 , k 2 ) = x ( 2 m1,2 m 2 )W N / 2
m =0 m =0
1 2
N N
1 1
2 2 m1 k 1 + m 2 k 2
S 01 ( k1, k 2 ) = x ( 2 m1 , 2 m 2 + 1)W
N /2
m =0 m =0
1 2
N N
1 1
2 2 m1 k 1 + m 2 k 2
S10 ( k1, k 2 ) = x ( 2 m1 + 1, 2 m )W
2 N /2
m1 = 0 m 2 = 0

N N
1 1
2 2 m k +m k
S11( k1, k 2 ) = x(2m1 + 1,2m2 + 1)WN 1/ 21 2 2
3/1/2017 m =0 m =0 17
1 2
Vector Radix FFT Algorithm
1. When n1 and n2 are even (Taking N=4)
m1 m2 x(2m1,2m2)
0 0 x(0,0)
0 1 x(0,2)
1 0 x(2,0)
1 1 x(2,2)

2. When n1 is even and n2 is odd


m1 m2 x(2m1,2m2+1)
0 0 x(0,1)
0 1 x(0,3)
1 0 x(2,1)
1
3/1/2017
1 x(2,3) 18
Vector Radix FFT Algorithm
3. When n1 odd and n2 is even
m1 m2 x(2m1+1,2m2)
0 0 x(1,0)
0 1 x(1,2)
1 0 x(3,0)
1 1 x(3,2)

4. When n1 and n2 are odd


m1 m2 x(2m1+1,2m2+1)
0 0 x(1,1)
0 1 x(1,3)
1 0 x(3,1)
1
3/1/2017
1 x(3,3) 19
Vector Radix FFT Algorithm

3/1/2017 20
Vector Radix FFT Algorithm
1 1 m k +m k
S 00 ( k1 , k 2 ) = x ( 2 m1,2 m 2 )W2 1 1 2 2
m =0 m =0
1 2
1 1
S 00 ( 0 , 0 ) =
x ( 2 m1 ,2 m 2 )
m1 =0 m 2 =0

1 1 m
S 00 ( 0,1) = x ( 2 m1,2 m 2 )W2 2
m =0 m =0
1 2
1 1 m
S 00 (1,0 ) = x ( 2 m1 , 2 m )W
2 2
1
m =0 m =0
1 2
1 1 m +m
S00 (1,1) = x(2m1,2m2 )W2 1 2
m =0 m =0
3/1/2017
1 2 21
Vector Radix FFT Algorithm
1 1 m k +m k
S 00 ( k1 , k 2 ) = x ( 2 m1,2 m 2 )W2 1 1 2 2
m =0 m =0
1 2
1 1
S 00 ( 0,0 ) = x ( 2 m1,2 m 2 ) = x ( 0,0) + x (0,2 ) + x ( 2,0 ) + x ( 2,2)
m =0 m =0
1 2
1 1 m
S 00 ( 0,1) = x ( 2 m1,2 m 2 )W2 2 = x ( 0,0)W20 + x (0,2 )W21 + x ( 2,0 )W20 + x ( 2,2)W21
m =0 m =0
1 2

= x ( 0,0 ) + x ( 0, 2 ) 1 + x ( 2,0 ) + x ( 2, 2 ) 1
= x ( 0,0 ) x ( 0, 2 ) + x ( 2,0 ) x ( 2 , 2 )
1 1 m
S 00 (1,0 ) = x ( 2 m1 , 2 m )W
2 2
1 = x ( 0,0 )W 0 + x ( 0, 2 )W 0 + x ( 2,0 )W 1 + x ( 2, 2 )W 1
2 2 2 2
m =0 m =0
3/1/2017 1 2 22
Vector Radix FFT Algorithm
1 1 m k +m k
S 00 ( k1 , k 2 ) = x ( 2 m1,2 m 2 )W2 1 1 2 2
m =0 m =0
1 2
1 1 m
S 00 (1,0 ) = x ( 2 m1,2 m 2 )W 2 1 = x (0,0)W20 + x (0,2 )W20 + x ( 2,0 )W21 + x ( 2,2)W21
m =0 m =0
1 2
= x ( 0 ,0 ) + x ( 0 , 2 ) x ( 2 ,0 ) x ( 2 , 2 )
1 1 m1 + m 2
S 00 (1,1) = x ( 2 m1 , 2 m )W
2 2 = x (0,0)W20 + x (0,2)W21 + x ( 2,0)W21 + x ( 2,2)W21+1
m1 = 0 m 2 = 0

= x ( 0 ,0 ) x ( 0 , 2 ) x ( 2 ,0 ) + x ( 2 , 2 )
S00(0,0)

S00(0,1)
S00(1,0)
3/1/2017 23
S00(1,1)
Vector Radix FFT Algorithm
1 1 m k +m k
S 01 ( k1 , k 2 ) = x ( 2 m1 ,2 m 2 + 1)W2 1 1 2 2
m =0 m =0
1 2
1 1
S 01 ( 0 , 0 ) = x ( 2 m1 , 2 m 2 + 1 )
m =0 m =0
1 2
1 1 m
S 01 ( 0,1) = x ( 2 m1 ,2 m 2 + 1)W2 2
m =0 m =0
1 2

1 1 m
S 01 (1, 0 ) = x ( 2 m1 , 2 m 2 + 1)W 2 1
m1 = 0 m 2 = 0

1 1 m1 + m 2
S 01 (1,1) = x ( 2 m1,2 m 2 + 1)W2
m1 = 0 m 2 = 0

3/1/2017 24
Vector Radix FFT Algorithm
1 1 m k +m k
S 01 ( k1 , k 2 ) = x ( 2 m1 , 2 m 2 + 1)W 2
1 1 2 2
m =0 m =0
1 2

1 1
S 01 ( 0,0 ) = x ( 2 m1,2 m 2 + 1) = x (0,1) + x (0,3) + x ( 2,1) + x ( 2,3)
m =0 m =0
1 2
1 1 m
S 01 ( 0,1) = x ( 2 m1 , 2 m 2 + 1)W 2
2
m =0 m =0
1 2

= x ( 0,1)W 20 + x ( 0,3)W 21 + x ( 2,1)W 20 + x ( 2,3)W 21


= x ( 0,1) x ( 0 ,3) + x ( 2,1) x ( 2,3)
1 1 m
S 01 (1,0 ) = x ( 2 m1 ,2 m 2 + 1)W 2 1 = x (0,1)W20 + x (0,3)W20 + x ( 2,1)W 21 + x ( 2,3)W21
m =0 m =0
1 2
3/1/2017 = x ( 0,1) + x ( 0,3) x ( 2,1) x ( 2,3) 25
Vector Radix FFT Algorithm
1 1 m +m
S 01 (1,1) = x ( 2 m1 , 2 m 2 + 1)W 2
1 2
m =0 m =0
1 2
1 1 m +m
S 01 (1,1) = x ( 2 m1 ,2 m 2 + 1)W2 1 2
m =0 m =0
1 2

= x ( 0,1)W 20 + x ( 0,3)W 21 + x ( 2,1)W 21 + x ( 2,3)W 22

= x ( 0,1) x ( 0 ,3) x ( 2,1) + x ( 2,3)


S01(0,0)

S01(0,1)

S10(1,0)

3/1/2017 S01(1,1) 26
Vector Radix FFT Algorithm
1 1 m k +m k
S10 ( k1 , k 2 ) = x ( 2 m1 + 1, 2 m )W
2 2
1 1 2 2
m =0 m =0
1 2
1 1
S10 ( 0,0 ) = x ( 2 m1 + 1,2 m 2 ) = x (1,0) + x (1,2) + x (3,0) + x (3,2 )
m =0 m =0
1 2
1 1 m2
S10 ( 0,1) = x ( 2 m1 + 1, 2 m )W
2 2 = x (1,0 )W 20 + x (1, 2 )W 21 + x (3,0 )W 20 + x (3, 2 )W 21
m1 = 0 m 2 = 0

= x (1,0 ) x (1, 2 ) + x (3,0 ) x (3, 2 )


1 1 m
S10 (1,0 ) = x ( 2 m1 + 1, 2 m 1 0 0 1 1
2 2 = x (1,0 )W 2 + x (1, 2 )W 2 + x (3,0 )W 2 + x (3, 2 )W 2
)W
m1 = 0 m 2 = 0

= x (1,0 ) + x (1, 2 ) x (3,0 ) x (3, 2 )


3/1/2017 27
Vector Radix FFT Algorithm
1 1 m1 + m 2
S10 (1,1) = x ( 2 m1 + 1,2 m 2 )W2 = x (1,0 )W 20 + x (1, 2 )W 21 + x (3,0 )W 21 + x (3, 2 )W 22
m =0 m =0
1 2

= x (1,0 ) x (1, 2 ) x (3,0 )W + x (3, 2 )

S10(0,0)

S10(0,1)

S10(1,0)

S10(1,1)

3/1/2017 28
Vector Radix FFT Algorithm
1 1 m k +m k
S11 ( k1 , k 2 ) = x ( 2 m1 + 1,2 m 2 + 1)W2 1 1 2 2
m =0 m =0
1 2
1 1
S11 ( 0,0 ) = x ( 2 m1 + 1, 2 m 2 + 1)W 0 = x (1,1) + x (1,3) + x (3,1), x (3,3)
2
m =0 m =0
1 2
1 1 m2
S11 ( 0,1) = x ( 2 m1 + 1, 2 m 2 + 1)W 2 = x (1,1)W 0 + x (1,3)W 1 + x (3,1)W 0 + x (3,3)W 1
2 2 2 2
m1 = 0 m 2 = 0

= x (1,1) x (1,3) + x (3,1) x (3,3)


1 1 m1
S11 (1,0 ) = x ( 2 m1 + 1,2 m 2 + 1)W2 = x (1,1)W20 + x (1,3)W20 + x (3,1)W21 + x (3,3)W21
m1 = 0 m 2 = 0

= x (1,1) + x (1,3) x (3,1) x (3,3)


3/1/2017 29
Vector Radix FFT Algorithm
1 1 m +m
S11 (1,1) = x ( 2 m1 + 1,2 m 2 + 1)W2 1 2
m =0 m =0
1 2

= x (1,1)W 20 + x (1,3)W 21 + x (3,1)W 21 + x (3,3)W 22

= x (1,1) x (1,3) x (3,1) + x (3,3)

S11(0,0)

S11(0,1)

S11(1,0)

S11(1,1)

3/1/2017 30
Vector Radix FFT Algorithm

3/1/2017 31
Vector Radix FFT Algorithm
k2 k1 k1 + k 2
X ( k1 , k 2 ) = S 00 ( k1 , k 2 ) + S 01 ( k1 , k 2 )W 4 + S10 ( k1 , k 2 )W 4 + S11 ( k1 , k 2 )W 4

Case -1. K1=0 and K2=0


X ( 0,0 ) = S 00 ( 0,0 ) + S 01 ( 0,0 ) + S10 ( 0,0 ) + S11 ( 0,0 )

X ( 2,0 ) = S 00 ( 0,0 ) + S 01 ( 0,0 ) S10 ( 0,0 ) S11 ( 0,0 )

X ( 0, 2 ) = S 00 ( 0,0 ) S 01 ( 0,0 ) + S10 ( 0,0 ) S11 ( 0,0 )

X ( 2, 2 ) = S 00 ( 0,0 ) S 01 ( 0,0 ) S10 ( 0,0 ) + S11 ( 0,0 )

3/1/2017 32
Vector Radix FFT Algorithm

-1
-1

-1

-1

-1
-1

3/1/2017 33
Vector Radix FFT Algorithm
k2 k1 k1 + k 2
X ( k1 , k 2 ) = S 00 ( k1 , k 2 ) + S 01 ( k1 , k 2 )W 4 + S10 ( k1 , k 2 )W 4 + S11 ( k1 , k 2 )W 4

Case -2. K1=0 and K2=1


X ( 0,1) = S 00 ( 0,1) + W 41S 01 ( 0,1) + S10 ( 0,1) + W 41S11 ( 0,1)

X ( 2,1) = S 00 ( 0,1) + W 41S 01 ( 0,1) S10 ( 0,1) W 41S11 ( 0,1)

X ( 0,3) = S 00 ( 0,1) W 41S 01 ( 0,1) + S10 ( 0,1) W 41S11 ( 0,1)

X ( 2,3) = S 00 ( 0,1) W 41S 01 ( 0,1) S10 ( 0,1) + W 41S11 ( 0,1)

3/1/2017 34
Vector Radix FFT Algorithm

3/1/2017 35
Vector Radix FFT Algorithm
k2 k1 k1 + k 2
X ( k1 , k 2 ) = S 00 ( k1 , k 2 ) + S 01 ( k1 , k 2 )W 4 + S10 ( k1 , k 2 )W 4 + S11 ( k1 , k 2 )W 4

Case -3. K1=1 and K2=0


X (1,0 ) = S 00 (1,0 ) + S 01 (1,0 ) + W 41S10 (1,0 ) + W 41S11 (1,0 )

X (3,0 ) = S 00 (1,0 ) + S 01 (1,0 ) W 41S10 (1,0 ) W 41S11 (1,0 )

X (1, 2 ) = S 00 (1,0 ) S 01 (1,0 ) + W 41S10 (1,0 ) W 41S11 (1,0 )

X (3, 2 ) = S 00 (1,0 ) S 01 (1,0 ) W 41S10 (1,0 ) + W 41S11 (1,0 )

3/1/2017 36
-1
-1

-1

-1

-1
-1

3/1/2017 37
Vector Radix FFT Algorithm
k2 k1 k1 + k 2
X ( k1 , k 2 ) = S 00 ( k1 , k 2 ) + S 01 ( k1 , k 2 )W 4 + S10 ( k1 , k 2 )W 4 + S11 ( k1 , k 2 )W 4

Case -4. K1=1 and K2=1


X (1,1) = S 00 (1,1) + W 41S 01 (1,1) + W 41S10 (1,1) + W 42 S11 (1,0 )

X (3,1) = S 00 (1,1) + W 41S 01 (1,1) W 41S10 (1,1) W 42 S11 (1,0 )

X (1,3) = S 00 (1,1) W 41S 01 (1,1) + W 41S10 (1,1) W 42 S11 (1,0 )

X (3,3) = S 00 (1,1) W 41S 01 (1,1) W 41S10 (1,1) + W 42 S11 (1,0 )

3/1/2017 38
-1
-1

-1

-1

-1
-1

3/1/2017 39
-1
-1

-1

-1

-1
-1

3/1/2017 40
Fig. Vector radix 4 x 4 DIT FFT structure
Vector Radix FFT Algorithm
 Example--1
Example
x(0,0) x(1,0) x(2,0) x(3,0)
1 2 3 4
x(0,1) x(1,1) x(2,1) x(3,1)
5 6 7 8
x(0,2) x(1,2) x(2,2) x(3,2)
9 10 11 12
x(0,3) x(1,3) x(2,3) x(3,3)
12 14 15 16

x(0,0) =1 x(0,1) =5 x(1,0) =2 x(1,1) =6


x(0,2) =9 x(0,3) =13 x(1,2)=10 x(1,3) =14
x(2,0)=3 x(2,1) =7 x(3,0) =4 x(3,1) =8
x(2,2)=11 x(2,3) =15 x(3,2)=12 X(3,3) =16
3/1/2017 41
Vector Radix FFT Algorithm
 Example--1: 2D DFT
Example
X(0,0) X(1,0) X(2,0) X(3,0)
136 -8+8j -8 -8-8j
X(0,1) X(1,1) X(2,1) X(3,1)
-32+32j 0 0 0
X(0,2) X(1,2) X(2,2) X(3,2)
-32 0 0 0
X(0,3) X(1,3) X(2,3) X(3,3)
-32-32j 0 0 0

3/1/2017 42
Vector Radix FFT Algorithm
 Example--2
Example
x(0,0) x(1,0) x(2,0) x(3,0)
1 2 3 4
x(0,1) x(1,1) x(2,1) x(3,1)
1 2 3 4
x(0,2) x(1,2) x(2,2) x(3,2)
1 2 3 4
x(0,3) x(1,3) x(2,3) x(3,3)
1 2 3 4

x(0,0) =1 x(0,1) =1 x(1,0) =2 x(1,1) =2


x(0,2) =1 x(0,3) =1 x(1,2) =2 x(1,3) =2
x(2,0)=3 x(2,1) =3 x(3,0) =4 x(3,1) =4
x(2,2)=3 x(2,3) =3 x(3,2) =4 X(3,3) =4
3/1/2017 43
Vector Radix FFT Algorithm
 Example: 2D DFT
X(0,0) X(1,0) X(2,0) X(3,0)
40 -8+8j -8 -8-8j
X(0,1) X(1,1) X(2,1) X(3,1)
0 0 0 0
X(0,2) X(1,2) X(2,2) X(3,2)
0 0 0 0
X(0,3) X(1,3) X(2,3) X(3,3)
0 0 0 0

3/1/2017 44
Computational Complexity of FFT
Algorithm
 Computational Complexity: 2 x 2 Butterfly

3/1/2017 45
Computational Complexity of FFT
Algorithm
 Computational Complexity of 1-
1-D FFT (2 Butterfly)

One complex
Addition

One complex One complex


3/1/2017 Multiplication Addition 46
Computational Complexity of FFT
Algorithm
 Example

a A

b B

c C
S11(k1,k2)

d D

Fig.(x) Vector radix 2 x 2 butterfly computation

3/1/2017 47
Vector Radix FFT Algorithm
 At the four nodes in the Fig.(x) by a, b, c, and d.
Then we can express
 X(k1,k2), X(k1+N/2,k2), X(k1, k2+N/2), X(k1+N/2,
k2+N/2) by

3/1/2017 48
Computational Complexity of FFT
Algorithm
 A vector radix 2 x 2 butterfly computation requires
eight additions. From the above discussion, each
vector radix 2 x 2 butterfly computation requires 3
multiplications and 8 additions.
 Since there are log2N stages and N2/4 butterflies in
each stage.
 The total number of arithmetic operations required
in computing the N x N- (3(N2/4)log2N
N-point DFT is (3(N
multiplications and 2N2log2N additions.
additions.

3/1/2017 49
Computational Complexity of FFT
Algorithm

3/1/2017 50
Computational Complexity of FFT
Algorithm
Computational Efficiency
Total No. complex multiplication required to
determine N x N point 2D DFT using FFT Algorithm
N2
N N FFT = 3 log ( N )
2
4

N N DFT = N 2 N 2
Direct 2D DFT
N N DFT N2N2
CRF = =
Computation Reduction N N FFT N2
3 log ( N )
Factor for Multiplication 4 2
3/1/2017 51
Computational Complexity of FFT
Algorithm
Computational Efficiency

N2
3 log ( N )
2
4
=
N N FFT
=
N N DFT N2N2

3/1/2017 52
Bit reversal in 2D DIT FFT Algorithm:
 Let us consider the signal flow graph of 4 x 4 DIT
FFT algorithm.
 We observe that the 2D sequence of input data is
shuffled as {x(0,0),x(0,2), x(2,0),x(2,2)},
x(2,0),x(2,2)}, {x(0,1),
x(0,3),x(2,1), x(2,3)}; {x(1,0),x(1,2),x(3,0),x(3,2)};
{x(1,1),x(1,3),x(3,1),X(3,3)}.
 And DFT sequence X(k X(k11,k
,k22) at the output is in
natural sequence.
sequence.
 The shuffling of the inputs sequence has well
defined format which is illustrated in table -1

3/1/2017 53
Bit reversal in 2D DIT FFT Algorithm:
 Table-1:Shuffling of the inputs sequence in bit
Table-
reversed order
order..
Memory Memory address Memory address of New Memory
address of of x(n1,n2) in x(n1,n2) in bit address of
x(n1,n2) binary reversed order x(n1,n2)
in decimal according to
reversed order
of bit
n1 n2 n1 n2 n1 n2 m1 m2
b1 b2 b1 b2 b2 b1 b2 b1
0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 1 0 1 1 0 1 0 2 2
2 2 1 0 1 0 0 1 0 1 1 1
3 3 1 1 1 1 1 1 1 1 3 3
3/1/2017 54
Bit reversal in 2D DIT FFT Algorithm

Fig.(a). Bit reversed order of input


Fig.(a). Input sequence(4x4) sequence(4X4)

3/1/2017 Fig.(a). Bit reversed order of input sequence(8X8) 55

Вам также может понравиться