Top Banner
Chapter 9. Computation of Discrete Fourier Transform 9.1 Introduction 9.2 Decimation-in-Time Factorization 9.3 Decimation-in-Frequency Factorization 9.4 Application of FFT 9.5 Fast Computation of DCT 9.6 Matrix Approach 9.7 Prime Factor Algorithm BGL/SNU
44

Chapter 9. Computation of Discrete Fourier Transform

Jan 19, 2016

Download

Documents

varick

Chapter 9. Computation of Discrete Fourier Transform. 9.1 Introduction 9.2 Decimation-in-Time Factorization 9.3 Decimation-in-Frequency Factorization 9.4 Application of FFT 9.5 Fast Computation of DCT 9.6 Matrix Approach 9.7 Prime Factor Algorithm. BGL/SNU. 1. Introduction. BGL/SNU. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 9. Computation of Discrete Fourier Transform

Chapter 9. Computation of Discrete Fourier Transform

9.1 Introduction

9.2 Decimation-in-Time Factorization

9.3 Decimation-in-Frequency Factorization

9.4 Application of FFT

9.5 Fast Computation of DCT

9.6 Matrix Approach

9.7 Prime Factor Algorithm

BGL/SNU

Page 2: Chapter 9. Computation of Discrete Fourier Transform

1. Introduction

1,,1,0,][1

][: IDFT

1,,1,0,][][: DFT

,thenNotation Use-

1,,1,0,][1

][: IDFT

1,,1,0,][][: DFT

1

0

1

0

2

1

0

2

1

0

2

NnWkXN

nx

NkWnxkX

eW

NnekXN

nx

NkenxkX

N

k

knN

N

n

knN

Nj

N

N

k

nN

jk

N

n

nN

jk

BGL/SNU

Page 3: Chapter 9. Computation of Discrete Fourier Transform

????knNW of meaning the s What'-

manner.circular in clockwise

origin the from counted

circleunit the on points N

the amongpoint kn the th

0NW

1NW

2NW

3NW

4NW

5NW

6NW

7NW

8NW

)(

(NOTE)

Pj

P

N

Nj

PPN

N

NN

NN

eeWW

WWW 22

1/

12

2/ ,1,1

BGL/SNU

Page 4: Chapter 9. Computation of Discrete Fourier Transform

?NW of view in DFT is What -

up. themsum then and

,,, torespect

1)-x(N,x(1),(0),multiply x)1(10 kN

Nk

NN WWW

08W

kW8kW 2

8

kW 38

kW 48

kW 58

kW 78

)0(x

)3(x)2(x

)4(x

)5(x

)6(x)7(x

)1(x

kW 68

BGL/SNU

Page 5: Chapter 9. Computation of Discrete Fourier Transform

)4(3,2,1,0,][][3

04

NkWnxkXn

kn

]3[ˆ

]2[ˆ

]1[ˆ

]0[ˆ

100

0011

100

0011

]3[

]2[

]1[

]0[

1010

0101

1010

0101

100

0011

100

0011

]3[

]2[

]1[

]0[

11W- 1

111- 1

1 W1

111 1

]3[

]2[

]1[

]0[

]3[

]2[

]1[

]0[

9630

6420

3210

0000

x

x

x

x

W

W

x

x

x

x

W

W

x

x

x

x

W

x

x

x

x

WWWW

WWWW

WWWW

WWWW

X

X

X

X

- Example of fast computation

BGL/SNU

Page 6: Chapter 9. Computation of Discrete Fourier Transform

]0[x

]1[x

]2[x

]3[x

]0[X

]1[X

]2[X

]3[X1

1

]3[x̂

]2[x̂

]1[x̂

]0[x̂

1

W

W

8

12 : additions of #

24 : tionsmultiplica of #

BGL/SNU

Page 7: Chapter 9. Computation of Discrete Fourier Transform

2. Decimation-in-Time Factorization

)(,.2/

12/

02/

)(,.2/

12/

02/

12/

0

)12(12/

0

2

,,

.

1

0

]12[]2[

]12[]2[

)2(1,,1,0,][][

kHDFTptN

N

r

rkN

kN

kGDFTptN

N

r

rkN

N

r

krN

N

r

rkN

oddnevenn

DFTptN

N

n

knN

WrxWWrx

WrxWrx

NNkWnxkX

BGL/SNU

Page 8: Chapter 9. Computation of Discrete Fourier Transform

8)( Neg]0[x]1[x

]7[x

]0[X]1[X

]7[X

DFT

pt.-N

]0[x]2[x]4[x

]0[X]1[X]2[X

DFT

pt.-2

N

]3[X]6[x

]0[G

]1[G]2[G

]3[G

]1[x]3[x]5[x

]4[X]5[X]6[X

DFT

pt.-2

N

]7[X]7[x

]0[H

]1[H]2[H

]3[H

0NW

1NW

3NW

2NW

4NW

5NW

6NW

7NW

BGL/SNU

Page 9: Chapter 9. Computation of Discrete Fourier Transform

graph flow Final

]0[x

]2[x

]4[x

]6[x

]1[x

]3[x

]5[x

]7[x

]0[X

]1[X

]2[X

]3[X

]4[X

]5[X

]6[X

]7[X

0NW

1NW

3NW

2NW

4NW

5NW

6NW

7NW

0NW

0NW

0NW

0NW

4NW

4NW

4NW

4NW

0NW

2NW

4NW

6NW

0NW

2NW

4NW

6NW

000

100

010

110

001

101

011

111

000

100

010

110

001

101

011

111

)( reversedbit )(natural

BGL/SNU

Page 10: Chapter 9. Computation of Discrete Fourier Transform

reversed.-bit : ordering datainput -

scompuation phase-in -

N/22 : additons

N/21 : tionsmultiplica

(complex) nscomputatio of # total

/butterflyy2/butterfl : additons

y1/butterfly2/butterfl : tionsmultiplica

(complex) nscomputatio # -

N/2/stage# : sbutterflie -

Nlogstages# : processing cascaded -

Remarks

2

NN

NN

2

2

log

log2

2

18W

58W

18W

1

1

BGL/SNU

Page 11: Chapter 9. Computation of Discrete Fourier Transform

Decimation-in-time FFT flow graphs

BGL/SNU

Page 12: Chapter 9. Computation of Discrete Fourier Transform

Decimation-in-time FFT flow graphs

BGL/SNU

Page 13: Chapter 9. Computation of Discrete Fourier Transform

Decimation-in-time FFT flow graphs

BGL/SNU

Page 14: Chapter 9. Computation of Discrete Fourier Transform

(Sande- Tuckey) FFT

nkN

k

N

n

N

n

nkN

kN

N

N

n

nkN

N

Nn

nkN

N

n

nkN

N

n

nkN

WN

nxnx

WN

nxWWnx

WnxWnx

NNkWnxkX

]}2

[)1(][{

]2

[][

][][

2 ,1,...,1,0 ,][][

12

0

12

0

2

12

0

1

2

12

0

1

0

3. Decimation-in-frequency Factorization

BGL/SNU

Page 15: Chapter 9. Computation of Discrete Fourier Transform

12

0 2

12

0 2

]}2

[][{]12[

12

,...,1,0 ,]}2

[][{]2[

N

n

nN

nrN

N

n

nrN

WWN

nxnxrX

NrW

NnxnxrX

g(n)

h(n)

g[0]

g[1] g[2] g[3]

h[0] h[1] h[2] h[3]

X[0]

X[2] X[4] X[6]

X[1] X[3] X[5] X[7]

x[0] x[1] x[2] x[3]

x[4] x[5] x[6] x[7]

48

38

28

18

W 1

W 1

W 1

W 1

DFT2

ptN

DFT2

ptN

Page 16: Chapter 9. Computation of Discrete Fourier Transform

Final flow graph

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

]

3N

2N

1N

0N

W 1

W 1

W 1

W 1

2N

0N

2N

0N

W 1

W 1

W 1

W 1

0N

0N

0N

0N

W 1

W 1

W 1

W 1

BGL/SNU

Page 17: Chapter 9. Computation of Discrete Fourier Transform

-Remarks

)(log2

:

2:

log:

2

2

complexNN

N

N - # Stages

- # butterflies

- # computations

- inplace computations

- output data ordering : bit-reversed

-Question

The flow graph for D-I-F is obtained by reversing.

The direction of the flow graph for D-I-T. Why?

-Omit Sections 9.5-9.7BGL/SNU

Page 18: Chapter 9. Computation of Discrete Fourier Transform

(1) Spectrum Analysis

-

is the spectrum of x[n] , n=0,1,…,N-1

- Inverse transform can be done through the same mechanism

i) Take the complex conjugate of X[k]

ii) Pass it through the FFT process,

But with one shift right(/2) operation at each stage

iii) Finally, take the complex conjugate of the result

1,...,1,0, ][k][ 1

0

Nk WnxX N

n

nkN

]][2

1[][

1 x[n]

1

0

1

0

WkX WkXN

N

k

nkN

N

k

nkN

4. Applications of FFT

BGL/SNU

Page 19: Chapter 9. Computation of Discrete Fourier Transform

(2) Convolution ( Filtering )

- Operation reduction : NN

N 22 log

2

h[n]x[n] y[n]

N 2N N

x[n]

0 N-1 n

h[n]

0 N-1 n

y[n

0 2N-2 n

22,...,1,0

],[][

][][][1

0

Nn

knhkx

nhnxnyN

k

#computation(multi)?

1+2+…+N+N-1+…+1+0=N2

Page 20: Chapter 9. Computation of Discrete Fourier Transform

-Utilize FFT of 2N-point

~

h[n]

0 N-1 2N n

x[n]

0 N-1 2N n

y[n]

0 2N-2 2N n

R2N[n] 1 0 2N-1 n

~

~

],[][][

12,...,1,0

[n],]][~

][~[

][][~][12

02

2

kHkXkY

Nn

Rknhkx

nRnynyN

kN

N

2N-pt DFTs

BGL/SNU

Page 21: Chapter 9. Computation of Discrete Fourier Transform

2N-pt FFT

2N-pt FFT

2N-pt IFFT

x[n]

h[n]

X[k]

H[k]

Y[k] y[n]

NN

2log2

2 2

NN

2log2

2 22N

# operation (multi)

- operation reduction :

NNNNNN

5log322log2

23 22

NNN 5log3N 22

000,35 000,000,1 :21024N 10 BGL/SNU

Page 22: Chapter 9. Computation of Discrete Fourier Transform

],[][][

12,...,2,1,0

[n] ]][~

][~[

][][

][][][

1

02

1

0

kHkXkZ

Nn

Rknhkx

knhkx

nhnxnz

N

kN

N

k

(3) Correlation /Power Spectrum

2N-point DFTs

# Operation : NNN 5log3 N 22

- Power spectrum P[k] = X[k] X*[k]

BGL/SNU

Page 23: Chapter 9. Computation of Discrete Fourier Transform

$ Comparison of # computation

512 1024

1

106

102

103

104

105

10

0.45k1k

2k5k

35k16k

7.25k3.3k

16k

62.5k

250k1M

DirectComputation

FFT-basedConvolutionCorrelation

FFT

N

BGL/SNU

Page 24: Chapter 9. Computation of Discrete Fourier Transform

otherwise, 1

0k,2

1 ][

1,...,1,0, 2

)12(cos][][

2k][

1

0

ke

Nk N

knnxke

NX

N

k

1

0

1,...,1,0, 2

)12(cos][][n][

N

k

Nn N

knkXkex

5. Fast Computation of DCT

BGL/SNU

Page 25: Chapter 9. Computation of Discrete Fourier Transform

- Example: Lee’s Algorithm (1984, IEEE Trans , ASSP, Dec) 1D

x[0]

x[1]

x[2]

x[3]

x[4]

x[5]

x[6]

x[7]

X[0

]

X[4

]

X[2

]

X[6

]

X[1

]

X[5

]

X[3

]

X[7

]

1

1

1

1

5

7

3

1

c

c

c

c

1

1

1

1

3

1

3

1

b

b

b

b

1

1

1

1

1

1

1

1

a

a

a

a

3,1 ,

8cos2

1

4cos2

1 1 i

iba i

7,5,3,1,

16cos2

1

ii

ci

BGL/SNU

Page 26: Chapter 9. Computation of Discrete Fourier Transform

- Example: 2D DCT Algorithm (1991, N.I.Cho and S.U.Lee)

BGL/SNU

otherwise, 1

0k,2

1 ][u

1,...,1,0,

2

)12(cos

2

)12(cos],[][][

4n],[

1

0

1

02

k

Nnm

N

nj

N

mijixnumu

NmY

N

n

N

j

Separable Transform NxN 2D DCT = N 1-D DCT into row direction followed by N 1-D DCT into column direction. Totally 2N 1-D DCT (each N-point) are required.

Page 27: Chapter 9. Computation of Discrete Fourier Transform

Fast Algorithm reduces the number of 1-D DCTs into N.

By using the trigonometric properties, 2D DCT is decomposed into 1-D DCTs.

N

njmi

N

njmiN

nj

N

mi

2

)12()12(cos

2

)12()12(cos

2

12

)12(cos

2

)12(cos

Page 28: Chapter 9. Computation of Discrete Fourier Transform

Signal flow graph of 2-D DCT8x8 DCT 4x4 DCT

Page 29: Chapter 9. Computation of Discrete Fourier Transform

6. Matrix Approach

0001100101

01

01

22)2)(2(

012

012

0

),(3,2,1,0),(

),(3,2,1,0),(

,4for

)()(

nknknknnkknk

nnn

kkk

knNkn

WWW

nnxnnx

kkXkkX

N

nxnx

WW

· Decimation-in-time

1

0

1

0

)2(201001

0 1

00110),(),(n n

nkknk WWnnxkkX

),( 001 nkx

BGL/SNU

Page 30: Chapter 9. Computation of Discrete Fourier Transform

reversed!order -bit ;

),(),(

),(),(

),(),(

01102

1

0

)2(00101

1

0

2010001

0

001

1

10

kkXkkx

WnkxkkX

Wnnxnkx

n

nkk

n

nk

)1,1(

)0,1(

)1,0(

)0,0(

010

001

010

001

)1,1(

)0,1(

)1,0(

)0,0(

0

0

0

0

2

2

0

0

1

1

1

1

x

x

x

x

W

W

W

W

x

x

x

x

)1,1(

)0,1(

)1,0(

)0,0(

100

100

001

001

)1,1(

)0,1(

)1,0(

)0,0(

1

1

1

1

3

1

2

0

2

2

2

2

x

x

x

x

W

W

W

W

x

x

x

x

)3(

)2(

)1(

)0(

)1,1(

)0,1(

)1,0(

)0,0(

100

100

001

001

010

001

010

001

)1,1(

)0,1(

)1,0(

)0,0(

)1,1(

)1,0(

)0,1(

)0,0(

)3(

)2(

)1(

)0(

0

0

0

0

3

1

2

0

2

2

0

0

2

2

2

2

x

x

x

x

x

x

x

x

W

W

W

W

W

W

W

W

x

x

x

x

X

X

X

X

X

X

X

X

).()(where 0 nxnx BGL/SNU

Page 31: Chapter 9. Computation of Discrete Fourier Transform

· Decimation-in-frequency

1

0

1

0

2)2(01001

0 1

01001),(),(n n

nkknn WWnnxkkX

),( 001 nkx

reversed!order -bit ;

),(),(

),(),(

),(),(

01102

1

0

200101

1

0

)2(010001

0

01

1

001

kkXkkx

WnkxkkX

Wnnxnkx

n

nk

n

knn

)3(

)2(

)1(

)0(

00

00

1010

0101

00

1100

00

0011

)3(

)2(

)1(

)0(

32

10

20

20

x

x

x

x

WW

WW

WW

WW

X

X

X

X

BGL/SNU

Page 32: Chapter 9. Computation of Discrete Fourier Transform

· General expression for N=2 case

022

11

022

11

22

22

kkkk

nnnn

knkkknkknknnk

nk

n n n

WWWWW

WnnnxkkkX

ii

ii

00111

0122

011

0 1 1

)22(2)2(22

021

1

0

1

0

1

0021 ),,,(),,,(

knkknkn

n n n

WWWnnnx

kkkX

00122

011

0 1 1

)2(22021

1

0

1

0

1

0

021

),,,(

),,,(

),,,( 0201 nnkx

),,,,( 03102 nnkkx

),,,( 110 kkkx

)222(),,,,,,(

),,,,,,(with

0122

112

01,210

1

01

021,110

1

kkkkWnnnkkkx

nnnkkkx

ii

iin

iiin

i

iiii

i

i

Page 33: Chapter 9. Computation of Discrete Fourier Transform

,1,,1,0

,1,,1,0,

,1,,1,0

,1,,1,0,

prime)y necessaril(not

0

101

0

101

qk

pkkqkk

pn

qnnpnn

qpN

1

0

1

0

)(0101

0101

1 0

00110),(),(

),()(),,()(q

n

p

n

nkqknpk WWnnxkkX

kkXkXnnxnx

),( 001 nkx

1

0102

)(00101

1

001001

0

101

1

10

),(),(),(

),(),(

p

n

nkqk

q

n

npk

kkxWnkxkkX

Wnnxnkx

· Extension to general N (Cooley/Tuckey)

BGL/SNU

Page 34: Chapter 9. Computation of Discrete Fourier Transform

· # computations (complex)

NNNNN

pppNpppN

qpN

npNx

nqNx

2

2121

02

11

log)222(222if

)(if

)2( total

)1hen (except w )1(

)0hen (except w )1(

times)( times)(

BGL/SNU

Page 35: Chapter 9. Computation of Discrete Fourier Transform

7. Prime Factor Algorithm (Thomas/Good)(1) Basics from Number Theory Euler’s Phi function

.2)6(,4)5(,2)4(,2)3(,1)2(,1)1()(

)than smaller numbers prime relative (#

.1),gcd(with1)(

eg

n

nllnnl

Euler’s Theorem

6mod125,2)(,6,5)(

.mod1then,1),(If)(

)(

NaNNaeg

NaNa

Chinese Remainder Theorem (CRT)

.modby determined is and

,mod and}1,,1,0{

s.t. unique a is there},1,,1,0{Given

.,1),(,

)()(

11

21

1

NN

Na

N

Naaa

iNaaNa

aNa

kiNNNNNN

LN

LL

N

ii

ii

kiL

N

Page 36: Chapter 9. Computation of Discrete Fourier Transform

122141

231

1

21

1112

1221

)(12

)(21

21

9412mod3344

.4,3,12)(

.modwhere,mod

mod

)2( case) Special(

21

21

aaaaa

NNNeg

NNNNaNNa

NNaNaa

LNNN

NNN

NN

1a 2a

112582

710141

36900

3210

Second Integer Representation (SIR)

.modby determined is and

,mod and}1,,1,0{

s.t. unique a is there},1,,1,0{Given

.,1),(,

11

21

NN

Na

N

Naaa

iNaN

NaNa

aNa

kiNNNNNN

LL

i

Nii

ii

kiL

i

BGL/SNU

}11,,1,0{ a

Page 37: Chapter 9. Computation of Discrete Fourier Transform

1221

21

1221

21

34

.4,3,12)(

mod

case) (Special

aaa

NNNeg

NNaNaa

NNN

1a 2a

521182

110741

96300

3210

}11,,1,0{ a

BGL/SNU

Page 38: Chapter 9. Computation of Discrete Fourier Transform

(2) Prime Factor Algorithm

.1),(,where1,,1,0,)()(1

0

qpqpNNkWnxkXN

n

nkN

.1,,1,0

1,,1,0

mod

),(

1,,1,0

1,,1,0

mod

),(

1

0

11

01

01

1

0

01

01

pk

qk

Nkqqkppk

CRTviakkk

qn

pn

Nqnpnn

SIRviannn

pq

Set

Then

.100111

001

1

11

001

011

101

1

11

01

01 ))((

knp

knq

kqqnp

kppnq

kqqqnpq

kppqnpq

kqqpnpq

kpppnpq

kqqkppqnpnpq

nkN

WWWW

WWWW

WW

pq

pqpq

pq

BGL/SNU

Page 39: Chapter 9. Computation of Discrete Fourier Transform

Therefore

1

0

1

00101

0 1

1001),(),(p

n

q

n

knp

knq WWnnxkkX

),( 011 nkx

1

010201101

1

001011

0

10

1

01

),(),(),(

),(),(

p

n

knp

q

n

knq

kkxWnkxkkX

Wnnxnkx

Note that the only difference is in the “twiddle factor” .00nkNW

BGL/SNU

Page 40: Chapter 9. Computation of Discrete Fourier Transform

(3) Comparison Example

12-Point DFT (N=12, p=3, q=4) C/T : Cooley/Tuckey T/G : Thomas/Good

· Transform

2

0310101

3

0401001

2

012300101

3

0401001

0

10

1

01

0

0010

1

01

),(),(

),(),(

T/G

),(),(

),(),(

C/T

n

kn

n

kn

n

knkn

n

kn

WnkxkkX

Wnnxnkx

WWnkxkkX

Wnnxnkx

· Index Mappings

01

01

01

01

94

43T/G

4

3C/T

kkk

nnn

kkk

nnn

3,2,1,0

2,1,0

2,1,0

3,2,1,0

0

1

0

1

k

k

n

n

118522

107411

96300

32100n 1n

11733

10622

9511

8400

2100k 1k

521182

110741

96300

32100n 1n

11733

21062

5191

8400

2100k 1k

Page 41: Chapter 9. Computation of Discrete Fourier Transform

· Diagram

4pt DFT

)(nx )(nx ),( 01 nnx

0369

0369

(0,0)(1,0)(2,0)(3,0)

4pt DFT

47

101

147

10

(0,1)(1,1)(2,1)(3,1)

4pt DFT

81125

25811

(0,2)(1,2)(2,2)(3,2)

3pt DFT

),( 01 kkX )(kX )(kX

(0,0)(0,1)(0,2)

3pt DFT

(1,0)(1,1)(1,2)

3pt DFT

(2,0)(2,1)(2,2)

3pt DFT

(3,0)(3,1)(3,2)

0012

knW

612W

0 0

4 4

8 8

1 9

5 1

9 5

2 6

6 10

10 2

3 3

7 7

11 11

T/G C/T C/T C/T T/G

BGL/SNU

001 ),( nkx

(0,0)(0,1)

102 ),( kkx

(0,2)(0,3)

(1,0)(1,1)(1,2)(1,3)

(2,2)(2,3)

(2,0)(2,1)

412W

012W

212W

012W

212W

112W

312W

012W

012W

012W

012W

Page 42: Chapter 9. Computation of Discrete Fourier Transform

- Radix-2 algorithms: algorithms in textbook : 2N

- Radix-4 algorithms : RN 4

Radix-4 algorithm

14/

04/

314/

04/

2

14/

04/

14/

04/

34,24,14,4,

1

0

]34[]24[

]14[]4[

][][

N

r

mkN

kN

N

r

mkN

kN

N

r

mkN

kN

N

r

mkN

mnmnmnmn

N

n

knN

WmxWWmxW

WmxWWmx

WnxkX

BGL/JWL/SNU

Page 43: Chapter 9. Computation of Discrete Fourier Transform

- Radix-4 butterfly

)()()()(]4/3[

)()()()(]2/[

)()()()(]4/[

)()()()(][

)34()( ),24()(

),14()( ),4()(Let

33

22

10

33

22

10

33

22

10

33

22

10

32

10

kGjWkGWkGjWkGNkX

kGWkGWkGWkGNkX

kGjWkGWkGjWkGNkX

kGWkGWkGWkGkX

mxmgmxmg

mxmgmxmg

kN

kN

kN

kN

kN

kN

kN

kN

kN

kN

kN

kN

BGL/JWL/SNU

Page 44: Chapter 9. Computation of Discrete Fourier Transform

- Radix-4 butterfly

-j-1

j-11

-1j

-1-j

kNW

kNW 2

kNW 3

BGL/JWL/SNU