ch5 Mitra DSP C
ch5 Mitra DSP C
ch5 Mitra DSP C
Finite-Length Discrete
Transforms
清大電機系林嘉文
cwlin@ee.nthu.edu.tw
03 5731152
03-5731152 4-1-1
Original PowerPoint slides prepared by S. K. Mitra
© The McGraw-Hill Companies, Inc., 2007
Digital Fourier Transform
• Definition
e t o - The e ssimplest
p est relation
e at o bet
between
ee a length-N
e gt
sequence x[n], defined for 0 ≤ n ≤ N −1, and its DTFT
X(ejω) is obtained by uniformly sampling X(ejω) on the ω-
axis between 0 ≤ ω < 2π at ωk = 2πk/ N, 0 ≤ k ≤ N −1
• From the definition of the DTFT we thus have
0 ≤ k ≤ N −1
• We get , 0 ≤ k ≤ N −1
Original PowerPoint slides prepared by S. K. Mitra 4-1-6
© The McGraw-Hill Companies, Inc., 2007
Matrix Relation
• The DFT samples defined by
• Note:
• Or, equivalently
S− rS = (1
S (1− r)S =1
=1− rN
• Hence
tto finite-length
fi it l th sequences, we assume ththatt the
th samples
l
outside the specified range are zeros
• Thus if x[n] is a length
length-M
M sequence with M ≤ N then y[n] =
x[n] for 0 ≤ n ≤ N −1
• Then
• The ppartial p
products ggenerated in the 2nd, 3rd, and 4th rows
are circularly shifted to the left as indicated above 4-1-33
Original PowerPoint slides prepared by S. K. Mitra
© The McGraw-Hill Companies, Inc., 2007
Circular Convolution Using Tabular
Method
• The
e modified
od ed tab
table
eaafter
te ccircular
cu a sshifting
t g is
s sshown
o be
below
o
• That is
Original PowerPoint slides prepared by S. K. Mitra 4-1-37
© The McGraw-Hill Companies, Inc., 2007
2N-Point DFTs of a Real Sequences
Using an N-Point DFT
• Example
a p e - Letet us dete
determinee tthe
e8 8-point
po t DFT V[k]
[ ] of
o tthe
e
length-8 real sequence
{{v[n]}
[ ]} = {1
{ 2 2 2 0 1 1 1}}
• We form two length-4 real sequences as follows
g[n]] = v[2n]
g[ [ ] = {{1 2 0 1}, }, h[n]
[ ] = v[2n
[ +1]] = {{2 2 1 1}}
• Now
• Then
where
where
• Since h[n]
[ ] is of length
g M and is of length
g N, ym[[n]] is of length
g
N + M −1 4-1-41
Original PowerPoint slides prepared by S. K. Mitra
© The McGraw-Hill Companies, Inc., 2007
Overlap Add Method
Overlap-Add
• The desired linear convolution y[n] = h[n] x[n] is broken up
i t a sum off infinite
into i fi it number
b off short-length
h tl th lilinear
convolutions of length N + M −1 each: ym[n] = h[n] xm[n]
• Consider implementing the follo
following
ing con
convolutions
ol tions using
sing the
DFT-based method, where now the DFTs (and the IDFT)
are computed on the basis of (N + M −1) 1) points
• Th The first
fi convolution l i iin the h above
b sum, y0[n]
[ ] = h[n]
h[ ] x0[n],
[ ] isi
of length N + M −1 and is defined for 0 ≤ n ≤ N + M − 2
• TheTh second d short
h t convolution l ti y1[n]
[ ] = h[n]
h[ ] x1[n],
[ ] is
i also
l off
length N + M −1 but is defined for N ≤ n ≤ 3N + M − 2
Ö There is an overlap of samples between these two short
Originallinear
PowerPointconvolutions
slides prepared by S. K. Mitra 4-1-42
© The McGraw-Hill Companies, Inc., 2007
Overlap Add Method
Overlap-Add
• In general, there will be an overlap of M −1 samples
b t
between the
th samplesl off the
th short
h t convolutions
l ti h[ ] xr-1[n]
h[n] [ ]
and h[n] xm[n] for (r −1)N ≤ n ≤ rN + M − 2
1
• Th yL[n
Then [ + m(N
(N − M + 1)] = ym[n],
[ ] M−1≤n≤N−1
Original PowerPoint slides prepared by S. K. Mitra 4-1-52
© The McGraw-Hill Companies, Inc., 2007
Overlap Save Method
Overlap-Save
• The approach is called overlap-save method since the
i
input
t is
i segmented t d into
i t overlapping
l i sections
ti and
d parts
t off the
th
results of the circular convolutions are saved and abutted to
determine the linear convolution result
+
t1 t2 t3 t4
y (n ) = x(n ),0
) 0 ≤ n ≤ N − 1,
y (n ) = x((2N − 1 − n ), N ≤ n ≤ 2N − 1.
• Y(n) is symmetrical about n = N - (1/2)
No discontinuities
N −1 1 2 N −1 1
(n + )k (n + )k
= ∑
n=0
y ( n )W 2N
2
+ ∑
n =N
y ( n )W 2N
2
N −1 1 2 N −1 1
(n + )k (n + )k
= ∑
n=0
x ( n )W 2N
2
+ ∑
n =N
x ( 2 N − 1 − n )W 2N
2
N −1 1 N −1 1
(n + )k [2N −(n + )k ]
= ∑
n=0
x ( n )W 2N
2
+ ∑
n=0
x ( n )W 2N
2
N −1
π ( 2 n + 1) k
= ∑
n=0
2 x (n ) co s
2N
,
2π
− j
0 ≤ k ≤ 2 N − 1, a n d W 2N = e 2N
1 2
C (0) = , C(k ) = , k = 1,2,", N − 1
N N
• The constants are often defined differently
Original PowerPoint slides prepared by S. K. Mitra 4-1-62
© The McGraw-Hill Companies, Inc., 2007
1DN
1-D N-Point
Point DCT
cos ( (2n + 1)0π /16 ) cos ( (2n + 1)2π /16 ) cos ( (2n + 1)4π /16 ) cos ( (2n + 1)6π /16 )
cos ( (2n + 1)1π /16 ) cos ( (2n + 1)3π /16 ) cos ( (2n + 1)5π /16 ) cos ( (2n + 1)7π /16 )
160 00
160.00
2000.00 absolute DCT values of Lena row 256
1500.00
120.00
80.00 1000.00
40.00 500.00
0.00 0.00
0.00 200.00 400.00 0.00
600.00 200.00 400.00 600.00
with 16/64
original coefficients
Cosine Sine