Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
2008/4/22
1
Chapter 5
Finite-Length Discrete Transforms
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-1
清大電機系林嘉文
Digital Fourier Transform• Definition - The simplest relation between a length-N
sequence x[n], defined for 0 ≤ n ≤ N −1, and its DTFT X(ejω) is obtained b niforml sampling X(ejω) on theX(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
• Note: X[k] is also a length-N sequence in the frequency
0 ≤ k ≤ N −1
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-2
[ ] g q q ydomain
• The sequence X[k] is called the Discrete Fourier Transform (DFT) of the sequence x[n]
2008/4/22
2
Digital Fourier Transform• Using the notation WN = e−j2π/N the DFT is usually
expressed as:
• The Inverse Discrete Fourier Transform (IDFT) is given by
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-3
• To verify the above expression we multiply both sides of the above equation by and sum the result from n = 0 to n = N −1
Digital Fourier Transform• This results in:
• Making use of the identity
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-4
g y
we observe the RHS of the last equation is equal to X[l]• Hence
2008/4/22
3
Digital Fourier Transform• Example - Consider the length-N sequence
• Its N-point DFT is given by
• Example - Consider the length-N sequence
, 0 ≤ k ≤ N −1
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-5
• Its N-point DFT is given by
, 0 ≤ k ≤ N −1
Digital Fourier Transform• Example - Consider the length-N sequence defined for
0 ≤ n ≤ N −1g[n] cos(2πrn/ N) 0 ≤ r ≤ N 1g[n] = cos(2πrn/ N), 0 ≤ r ≤ N −1
• Using a trigonometric identity we can write
• The N-point DFT of g[n] is thus given by
0 ≤ k ≤ N −1
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-6
• Making use of the identity
• We get , 0 ≤ k ≤ N −1
2008/4/22
4
Matrix Relation• The DFT samples defined by
can be expressed in matrix form asX = DNx
whereX = [X[0] X[1] ..... X[N −1]]Tx = [x[0] x[1] ..... x[N −1]]T
and D is the N × N DFT matrix given by
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-7
and DN is the N × N DFT matrix given by
Matrix Relation• Likewise, the IDFT relation given by
can be expressed in matrix form as
where is the IDFT matrix
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-8
• Note:
2008/4/22
5
DFT Computation Using MATLAB• The functions to compute the DFT and the IDFT are fft and
ifftThese functions make use of FFT algorithms which are• These functions make use of FFT algorithms which are computationally highly efficient compared to the direct computation
• The DFT and DTFT of the following function is shown below
x[n] = cos(6πn/16), 0 ≤ n ≤ 15
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-9
DTFT from DFT by Interpolation• The DFT X[k] of a length-N sequence x[n] is simply the freq.
samples of its DTFT X(ejω) evaluated at N uniformly spaced frequency points ω = ω = 2πk/N 0 ≤ k ≤ N −1frequency points ω = ωk = 2πk/N, 0 ≤ k ≤ N 1
• Compared to the direct computation, these functions are computationally highly efficient due to the use of FFT
• Given the N-point DFT X[k] of a length-N sequence x[n], its DTFT X(ejω) can be uniquely determined from X[k]
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-10
2008/4/22
6
DTFT from DFT by Interpolation• To develop a compact expression for the sum S, let
r = e−j(ω−2πk/N)
• Then
• Or, equivalentlyS− rS = (1− r)S =1− rN
H
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-11
• Hence
DTFT from DFT by Interpolation• Therefore
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-12
2008/4/22
7
Sampling the DTFT• Consider a sequence x[n] with a DTFT X(ejω)• We sample X(ejω) at N equally spaced points ωk = 2πk/N, 0 ≤
k ≤ N 1 developing the N frequency samplesk ≤ N −1 developing the N frequency samples• These N frequency samples can be considered as an N-point
DFT Y[k] whose N-point IDFT is a length-N sequence y[n]• Now
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-13
• Taking IDFT of Y[k] yields
Sampling the DTFT• That is
• Making use of the identity
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-14
we arrive at the desired relation
2008/4/22
8
Sampling the DTFT• Thus y[n] is obtained from x[n] by adding an infinite number
of shifted replicas of x[n], with each replica shifted by an integer multiple of N sampling instants and observing theinteger multiple of N sampling instants, and observing the sum only for the interval
• To apply
to finite-length sequences, we assume that the samples
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-15
outside the specified range are zeros• Thus if x[n] is a length-M sequence with M ≤ N then y[n] =
x[n] for 0 ≤ n ≤ N −1
Sampling the DTFT• Example – Let {x[n]} = {0 1 2 3 4 5}• By sampling its DTFT X(ejω) at ωk = 2πk/4, 0 ≤ k ≤ 3 and then
applying a 4 point IDFT to these samples we arrive at theapplying a 4-point IDFT to these samples, we arrive at the sequence y[n] given by
y[n] = x[n] + x[n + 4] + x[n − 4] 0 ≤ n ≤ 3i.e.,
{y[n]} = {4 6 2 3}⇒ {x[n]} cannot be recovered from {y[n]}
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-16
{ [ ]} {y[ ]}
2008/4/22
9
Numerical Computation of the DTFT Using DFT
• A practical approach to the numerical computation of the DTFT of a finite-length sequence
• Let X(ejω) be the DTFT of a length-N sequence x[n]• We wish to evaluate X(ejω) at a dense grid of frequencies ωk = 2πk/M, 0 ≤ k ≤ M −1, where M >> N:
• Define a new sequence
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-17
• Define a new sequence
• Then
Numerical Computation of the DTFT Using DFT
• Thus X(ejω) is essentially an M-point DFT Xe[k] of the length-M sequence xe[n]
• The DFT Xe[k] can be computed very efficiently using the FFT algorithm if M is an integer power of 2
• The function freqz employs this approach to evaluate the frequency response at a prescribed set of frequencies of a DTFT expressed as a rational function in e−jω
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-18
2008/4/22
10
DFT Properties• Like the DTFT, the DFT also satisfies a number of
properties that are useful in signal processing applications Some of these properties are essentially identical to those• Some of these properties are essentially identical to those of the DTFT, while some others are somewhat different
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-19x[n] is a complex sequence
Symmetry Relations of DFT
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-20x[n] is a real sequence
2008/4/22
11
General Properties of DFT
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-21
Circular Shift of a Sequence• This property is analogous to the time-shifting property of
the DTFT, but with a subtle differenceConsider length N sequences defined for 0 ≤ n ≤ N 1• Consider length-N sequences defined for 0 ≤ n ≤ N −1. Sample values of such sequences are equal to zero for values of n < 0 and n ≥ N
• If x[n] is such a sequence, then for any arbitrary integer , the shifted sequence
x1[n] = x[n − no]
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-22
is no longer defined for the range 0 ≤ n ≤ N −1• We thus need to define another type of a shift that will
always keep the shifted sequence in the range 0 ≤ n ≤ N −1
2008/4/22
12
Circular Shift of a Sequence• The desired shift, called the circular shift, is defined using
a modulo operation:x [n] x[ n n ]xc[n] = x[ n − no N]
• For no > 0 (right circular shift), the above equation implies
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-23
x[ n − 1 6]= x[ n + 5 6]
x[ n − 4 6]= x[ n + 2 6]
Circular Convolution• This operation is analogous to linear convolution, but with a
subtle difference Consider two length N sequences g[n] and h[n] Their linear• Consider two length-N sequences, g[n] and h[n]. Their linear convolution results in a length-(2N−1) sequence yL[n]:
• In computing yL[n] we assume that both length-N sequences have been zero-padded to extend their lengths to 2N−1
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-24
• The longer form of yL[n] results from the time-reversal of the sequence h[n] and its linear shift to the right
• The first nonzero value of yL[n] is yL[0] = g[0]h[0] , and the last nonzero value is yL[2N−2] = g[N−1]h[N−1]
2008/4/22
13
Circular Convolution• To develop a convolution-like operation resulting in a length-
N sequence yC[n], we need to define a circular time-reversal and then apply a circular time-shiftreversal, and then apply a circular time-shift
• Resulting operation, called a circular convolution, is defined by:
• Since the operation defined involves two length-N sequences it is often referred to as an N-point circular
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-25
sequences, it is often referred to as an N-point circular convolution, denoted as
• The circular convolution is commutative, i.e.
Circular Convolution• Example - Determine the 4-point circular convolution of the
two length-4 sequences {g[n]} = {1 2 0 1}, {h[n]} = {2 2 1 1}{g[n]} {1 2 0 1}, {h[n]} {2 2 1 1}
• The result is a length-4 sequence yC[n] given by
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-26
• From above, we observe
2008/4/22
14
Circular Convolution• Likewise
yC[1] = g[0]h[1] + g[1]h[0] + g[2]h[3] + g[3]h[2] = 7
yC[2] = g[0]h[2] + g[1]h[1] + g[2]h[0] + g[3]h[3] = 6
yC[3] = g[0]h[3] + g[1]h[2] + g[2]h[1] + g[3]h[0] = 5
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-27
Circular Convolution• Example - Consider the two length-4 sequences repeated
below for convenience:
• The 4-point DFT G[k] of g[n] is given byG[k] = g[0] + g[1] e−j2πk/4 + g[2] e−j4πk/4 + g[3] e−j6πk/4
= 1 + 2e−jπk/2 + e−j3πk/2 , 0 ≤ k ≤ 3
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-28
1 2e e , 0 k 3• Therefore G[0] = 4, G[1] = 1− j, G[2] = −2, G[3] = 1+ j• Likely
H[k] = 2 + 2e−jπk/2 + e−jπk + e−j3πk/2 , 0 ≤ k ≤ 3
2008/4/22
15
Circular Convolution• The two 4-point DFTs can also be computed using the
matrix relation given earlier
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-29
• If YC[k] denotes the 4-point DFT of yC[n], YC[k] = G[k]H[k]
Circular Convolution• A 4-point IDFT of YC[k] yields
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-30
2008/4/22
16
Circular Convolution• Example - Extend the two length-4 sequences to length 7 by
appending each with three zero-valued samples, i.e.
• We next determine the 7-point circular convolution of ge[n]and he[n]
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-31
• From the above, we can obtain y[0] ~ y[6]• y[n] is precisely the sequence yL[n] obtained
by a linear convolution of g[n] and h[n]
Circular Convolution• The N-point circular convolution can be written in matrix
form as
• Note: The elements of each diagonal of the matrix are equal• Such a matrix is called a circulant matrix
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-32
2008/4/22
17
Circular Convolution Using Tabular Method
• Consider the evaluation of y[n] = h[n] g[n] where {g[n]} and {h[n]} are length-4 sequences
• First, the samples of the two sequences are multiplied using the conventional multiplication method as shown below
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-33
• The partial products generated in the 2nd, 3rd, and 4th rows are circularly shifted to the left as indicated above
Circular Convolution Using Tabular Method
• The modified table after circular shifting is shown below
• The samples of the sequence yC[n] are obtained by adding the 4 partial products in the column above of each sample
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-34
p p pyC[0] = g[0]h[0] + g[3]h[1] + g[2]h[2] + g[1]h[3] = 7yC[1] = g[1]h[0] + g[0]h[1] + g[3]h[2] + g[2]h[3] = 6yC[2] = g[2]h[0] + g[1]h[1] + g[0]h[2] + g[3]h[3] = 5yC[3] = g[3]h[0] + g[2]h[1] + g[1]h[2] + g[0]h[3] = 5
2008/4/22
18
N-Point DFTs of Two Length-N Real Sequences
• Let g[n] and h[n] be two length-N real sequences with G[k] and H[k] denoting their respective N-point DFTs
• These two N-point DFTs can be computed efficiently using a single N-point DFT
• Define a complex length-N sequencex[n] = g[n] + j h[n]
• Let X[k] denote the N-point DFT of x[n]
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-35
• Note that for 0 ≤ k ≤ N −1,
N-Point DFTs of Two Length-N Real Sequences
• Example - We compute the 4-point DFTs of the two real sequences g[n] and h[n] given below
{g[n]} = {1 2 0 1}, {h[n]} = {2 2 1 1}• Then {x[n]} = {g[n]}+ j{h[n]} = {1+j2 2+j2 j 1+j}• Its DFT X[k] is
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-36
• From the aboveX*[k] = [4−j6 2 −2 −j2], X*[ 4−k 4] = [4−j6 −j2 −2 2]
• Therefore{G[k]} = {4 1−j −2 1+j}, {H[k]} = {6 1−j 0 1+j}
2008/4/22
19
2N-Point DFTs of a Real Sequences Using an N-Point DFT
• Let v[n] be a length-N real sequence with a 2N-point DFT V[k]• Define two length-N real sequences g[n] and h[n] as follows:
g[n] = v[2n], h[n] = v[2n +1], 0 ≤ n ≤ N• Let G[k] and H[k] denote their respective N-point DFTs• Define a length-N complex sequence
{x[n]} = {g[n]}+ j{h[n]}with an N-point DFT X[k]N
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-37
• Now
• That is
2N-Point DFTs of a Real Sequences Using an N-Point DFT
• Example - Let us determine the 8-point DFT V[k] of the 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] = {1 2 0 1}, h[n] = v[2n +1] = {2 2 1 1}• Now
S f G
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-38
• Substituting the values of the 4-point DFTs G[k] and H[k], we can obtain V[k]
2008/4/22
20
Linear Convolution Using DFT• Since a DFT can be efficiently implemented using FFT
algorithms, it is of interest to develop methods for the implementation of linear con ol tion sing the DFTimplementation of linear convolution using the DFT
• Let g[n] and h[n] be two finite-length sequences of length N and M, respectively
• Define two length-L (L = N + M −1) sequences
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-39
• Then
Linear Convolution Using DFT• The corresponding implementation scheme is illustrated
below
• We next consider the DFT-based implementation of
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-40
where h[n] is a finite-length sequence of length M and x[n] is an infinite length (or a finite length sequence of length much greater than M)
2008/4/22
21
Overlap-Add Method• We first segment x[n], assumed to be a causal sequence
here without any loss of generality, into a set of contiguous finite-length subsequences of length N each:finite length subsequences of length N each:
where
• Thus we can write
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-41
where
• Since h[n] is of length M and is of length N, ym[n] is of length N + M −1
Overlap-Add Method• The desired linear convolution y[n] = h[n] x[n] is broken up
into a sum of infinite number of short-length linear convolutions of length N + M −1 each: ym[n] = h[n] xm[n]convolutions of length N M 1 each: ym[n] h[n] xm[n]
• Consider implementing the following convolutions using the DFT-based method, where now the DFTs (and the IDFT) are computed on the basis of (N + M −1) points
• The first convolution in the above sum, y0[n] = h[n] x0[n], is
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-42
0 0of length N + M −1 and is defined for 0 ≤ n ≤ N + M − 2
• The second short convolution y1[n] = h[n] x1[n], is also of length N + M −1 but is defined for N ≤ n ≤ 3N + M − 2There is an overlap of samples between these two short linear convolutions
2008/4/22
22
Overlap-Add Method• In general, there will be an overlap of M −1 samples
between the samples of the short convolutions h[n] xr-1[n] and h[n] xm[n] for (r −1)N ≤ n ≤ rN + M − 2and h[n] xm[n] for (r 1)N n rN M 2
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-43
Overlap-Add Method
• Therefore, y[n] obtained by a linear convolution of x[n] and
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-44
Therefore, y[n] obtained by a linear convolution of x[n] and h[n] is given by
2008/4/22
23
Overlap-Add Method• The above procedure is called the overlap-add method
since the results of the short linear convolutions overlap and the overlapped portions are added to get the correct finalthe overlapped portions are added to get the correct final result
• The MATLAB function fftfilt can be used to implement the above method
• The following illustrates an example of filtering of a noise-corrupted signal using a length-3 moving average filter:
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-45
Overlap-Save Method• In implementing the overlap-add method using the DFT, we
need to compute two (N + M −1)-point DFTs and one (N + M−1)-point IDFT for each short linear convolution1) point IDFT for each short linear convolution
• It is possible to implement the overall linear convolution by performing instead circular convolution of length shorter than (N + M −1)
• To this end, it is necessary to segment x[n] into overlapping blocks xm[n], keep the terms of the circular convolution of h[n] with that corresponds to the terms
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-46
convolution of h[n] with that corresponds to the terms obtained by a linear convolution of h[n] and xm[n], and throw away the other parts of the circular convolution
2008/4/22
24
Overlap-Save Method• To understand the correspondence between the linear and
circular convolutions, consider a length-4 sequence x[n] and a length-3 sequence h[n]a length 3 sequence h[n]
• Let yL[n] denote the result of a linear convolution of x[n] with h[n]
• The six samples of yL[n] are given byyL[0] = h[0]x[0]yL[1] = h[0]x[1] + h[1]x[0]
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-47
yL[2] = h[0]x[2] + h[1]x[1] + h[2]x[0]yL[3] = h[0]x[3] + h[1]x[2] + h[2]x[1]yL[4] = h[1]x[3] + h[2]x[2]yL[5] = h[2]x[3]
Overlap-Save Method• If we append h[n] with a single zero-valued sample and
convert it into a length-4 sequence he[n], the 4-point circular convolution yC[n] of he[n] and x[n] is given byconvolution yC[n] of he[n] and x[n] is given by
yC[0] = h[0]x[0] + h[1]x[3] + h[2]x[2]yC[1] = h[0]x[1] + h[1]x[0] + h[2]x[3]yC[2] = h[0]x[2] + h[1]x[1] + h[2]x[0]yC[3] = h[0]x[3] + h[1]x[2] + h[2]x[1]
• If we compare the expressions for the samples yL[n] of with those of y [n] we observe that the first 2 terms of y [n] do
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-48
those of yC[n], we observe that the first 2 terms of yC[n] do not correspond to the first 2 terms of yL[n], whereas the last 2 terms of yC[n] are precisely the same as the 3rd and 4th terms of yL[n], i.e.
yL[0] ≠ yC[0], yL[1] ≠ yC[1], yL[2] = yC[2], yL[3] = yC[3]
2008/4/22
25
Overlap-Save Method• General case: N-point circular convolution of a length-M
sequence h[n] with a length-N sequence x[n] with N > M• First M − 1 samples of the circular convolution are incorrect• First M 1 samples of the circular convolution are incorrect
and are rejected• Remaining N − M + 1 samples correspond to the correct
samples of the linear convolution of h[n] with x[n]• Now, consider an infinitely long or very long sequence x[n]• Break it up as a collection of smaller length (length-4)
l i [ ] [ ] [ 2 ] 0 3
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-49
overlapping sequences xm[n] as xm[n] = x[n + 2m], 0 ≤ n ≤ 3, 0 ≤ m ≤ ∞
• Next, formwm[n] = h[n] xm[n]
Overlap-Save Method• Or, equivalently,
wm[0] = h[0]xm[0] + h[1]xm[3] + h[2]xm[2]w [1] = h[0]x [1] + h[1]x [0] + h[2]x [3]wm[1] = h[0]xm[1] + h[1]xm[0] + h[2]xm[3]wm[2] = h[0]xm[2] + h[1]xm[1] + h[2]xm[0]wm[3] = h[0]xm[3] + h[1]xm[2] + h[2]xm[1]
• Computing the above for m = 0, 1, 2, 3, . . . , and substituting the values of xm[n] we arrive at
w0[0] = h[0]x[0] + h[1]x[3] + h[2]x[2] Reject[1] h[0] [1] h[1] [0] h[2] [3] R j
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-50
w0[1] = h[0]x[1] + h[1]x[0] + h[2]x[3] Rejectw0[2] = h[0]x[2] + h[1]x[1] + h[2]x[0] = y[2] Savew0[3] = h[0]x[3] + h[1]x[2] + h[2]x[1] = y[3] Save
2008/4/22
26
Overlap-Save Methodw1[0] = h[0]x[2] + h[1]x[5] + h[2]x[4] Rejectw1[1] = h[0]x[3] + h[1]x[2] + h[2]x[5] Rejectw [2] = h[0]x[4] + h[1]x[3] + h[2]x[2] = y[4] Savew1[2] = h[0]x[4] + h[1]x[3] + h[2]x[2] = y[4] Savew1[3] = h[0]x[5] + h[1]x[4] + h[2]x[3] = y[5] Save
w2[0] = h[0]x[4] + h[1]x[5] + h[2]x[6] Rejectw2[1] = h[0]x[5] + h[1]x[4] + h[2]x[7] Rejectw2[2] = h[0]x[6] + h[1]x[5] + h[2]x[4] = y[6] Save
[3] h[0] [7] h[1] [6] h[2] [5] [7] S
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-51
w2[3] = h[0]x[7] + h[1]x[6] + h[2]x[5] = y[7] Save• It should be noted that to determine y[0] and y[1], we need to
form x−1[n]: x−1[0] = 0, x−1[1] = 0, x−1[2] = x[0] , x−1[3] = x[1]and compute w−1[n] = h[n] x−1[n] for 0 ≤ n ≤ 3, reject w−1[0] and w−1[1], and save w−1[2] = y[0], and w−1[3] = y[1]
Overlap-Save Method• General Case: Let h[n] be a length-N sequence• Let xm[n] denote the m-th section of an infinitely long
sequence x[n] of length N and defined bysequence x[n] of length N and defined byxm[n] = x[n + m(N − M + 1)], 0 ≤ n ≤ N − 1 with M < N
• Let wm[n] = h[n] xm[n]• Then, we reject the first M − 1 samples of wm[n] and “abut”
the remaining M − M + 1 samples of wm[n] to form yL[n], the linear convolution of h[n] and x[n]
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-52
• If ym[n] denotes the saved portion of wm[n], i.e.,
• Then yL[n + m(N − M + 1)] = ym[n], M − 1 ≤ n ≤ N − 1
1
2008/4/22
27
Overlap-Save Method• The approach is called overlap-save method since the
input is segmented into overlapping sections and parts of the results of the circular convolutions are saved and abutted toresults of the circular convolutions are saved and abutted to determine the linear convolution result
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-53
Overlap-Save Method
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-54
2008/4/22
28
Signal Transform• Motivation:
– Represent a vector (e.g. a block of image samples) as h i i f i l (bl kthe superposition of some typical vectors (block
patterns)
+t1 t2 t3 t4
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-55
2 3 4
Transform Coding of a Image
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-56
2008/4/22
29
1-D 16-Pont DFT Basis Vectors
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-57
Disadvantages of DFT in Signal Coding
• Fourier Transform of a real function results incomplex numbers
• May result in artifacts due to discontinuityat the block boundary
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-58
Discontinuities (high freq. components)
2008/4/22
30
From DFT to DCT• DFT of any real and symmetric sequence contains only
real coefficients corresponding to the cosine terms of the series
• Construct a new symmetric sequence y(n) of length 2N out of x(n) of length N
= ≤ ≤ −= − − ≤ ≤ −
( ) ( ),0 1,( ) (2 1 ), 2 1.
y n x n n Ny n x N n N n N
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-59
• Y(n) is symmetrical about n = N - (1/2)
From DFT to DCT• DCT has a higher compression ration than DFT
• DCT avoids the generation of spurious spectral componentscomponents
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-60
No discontinuities
2008/4/22
31
From DFT to DCT− +
=
= ∑12 1 ( )2
20
1 11 2 1
( ) ( ) ,N n k
Nn
N N
Y k y n W
− −+ +
= =
= +∑ ∑1 11 2 1( ) ( )2 2
2 20
( ) ( )N Nn k n k
N Nn n N
y n W y n W
− −+ +
= =
− −+ − +
= + − −
= +
∑ ∑
∑ ∑
1 11 2 1( ) ( )2 2
2 20
1 11 1( ) [ 2 ( ) ]2 2
2 2
( ) ( 2 1 )
( ) ( )
N Nn k n k
N Nn n N
N Nn k N n k
N N
x n W x N n W
x n W x n W
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-61
π
π= =
−
=
−
+=
≤ ≤ − =
∑ ∑
∑
2 20 0
1
022
2
( ) ( )
( 2 1)2 ( ) c o s ,2
0 2 1,
N Nn n
N
n
jN
N
n kx nN
k N a n d W e
1-D N-Point DCTπ−
=
+⎡ ⎤= ⎢ ⎥⎣ ⎦∑
1
0
( 2 1)( ) ( ) ( ) c o s ,2
N
n
n kF k C k f nN
π−
=
= −
+⎡ ⎤= ⎢ ⎥⎣ ⎦= −
∑1
0
0 ,1, , 1,( 2 1)( ) ( ) ( ) c o s ,
20 ,1, , 1,
N
k
k Nn kf n C k F k
Nn N
where
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-62
= = = −1 2(0) , ( ) , 1,2, , 1C C k k NN N
where
• The constants are often defined differently
2008/4/22
32
1-D N-Point DCT
( )cos (2 1)0 /16n π+ ( )cos (2 1)2 /16n π+ ( )cos (2 1)4 /16n π+ ( )cos (2 1)6 /16n π+
( )cos (2 1)1 /16n π+ ( )cos (2 1)3 /16n π+ ( )cos (2 1)5 /16n π+ ( )cos (2 1)7 /16n π+
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-63
Example of 1-D DCT
200.00Row 256 of Lena 2500.00
80.00
120.00
160.00
1000.00
1500.00
2000.00 absolute DCT values of Lena row 256
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-64
0.00 200.00 400.00 600.00
0.00
40.00
0.00 200.00 400.00 600.00
0.00
500.00
2008/4/22
33
Illustration of Image CodingUsing 2-D DCT
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-65
DCT-Based Image Coding with Different Quantization Levels
• DCT coding with increasingly coarse quantization, block size 8x8
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-66
quantizer step-size for AC coefficient: 25
quantizer step-size for AC coefficient: 100
quantizer step-size for AC coefficient: 200
2008/4/22
34
Image Coding with Different Numbers of DCT Coefficients
originalwith 16/64 coefficients
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-67
with 8/64 coefficients
with 4/64 coefficients
Comparison of Basis Vectors of Different Transform (1-D)
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-68
2008/4/22
35
Comparison of Basis Vectors of Different Transform (2-D)
Cosine Sine
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-69Haar 69
DCT-Based Coding: JPEG8x8 blocks
Entropyencoder
Compressedimage data
QDPCM
ZigzagDCT
DC
encoderscan
Quantizationtable
Tablespecification
Entropy
Compressedimage dataDPCM
Zigzag
Sourceimage data
AC
8x8 blocksDC
© The McGraw-Hill Companies, Inc., 2007Original PowerPoint slides prepared by S. K. Mitra 4-1-70
EntropydecoderIQ
Zigzagscan
Quantizationtable
Tablespecification
Reconstructedimage data
IDCTAC