Lecture 14: More on finite-length discrete transforms

advertisement
1
Lecture 14: More on finite-length
discrete transforms
Instructor:
Dr. Gleb V. Tcheslavski
Contact:
gleb@ee.lamar.edu
Office Hours: Room 2030
Class web site:
http://ee.lamar.edu/gleb/ds
p/index.htm
Smiley face
ELEN 5346/4304
DSP and Filter Design
Fall 2008
2
Orthogonal transforms
Frequently, it is beneficial to convert a finite-length time-domain sequence xn
into a finite-length sequence in other domain and vice versa:
N 1
Analysis:
X k   xn *k ,n ,0  k  N  1
(14.2.1)
n 0
Synthesis
1
xn 
N
N 1
X 
k 0
k
k ,n
,0  n  N  1
(14.2.2)
We restrict our discussion to the class of orthogonal transforms.
For such transforms, the basis sequences (functions) k,n satisfy the following
properties:
1,l  k
1 N 1
*
 k ,n l ,n  

N n 0
0,l  k
ELEN 5346/4304
DSP and Filter Design
Fall 2008
(14.2.3)
3
Orthogonal transforms
For the orthogonal basis functions, we can verify that (14.2.2) is indeed an
inverse of (14.2.1):
N 1
x
n
n 0
N 1
 1 N 1
 *
 1 N 1

    X k k ,n  l ,n   X k   k ,n *l ,n   X l
n 0  N k 0
n 0

 N k 0

N 1
*
l ,n
(14.3.1)
An important consequence of orthogonality is the energy conservation property
of such transforms that allows to compute the energy of a time-domain sequence
in the transform domain (Parseval’s relation):
N 1
 xn
n 0
2
1 N 1
 1 N 1
 * 1 N 1  N 1 *
 1 N 1
*
  x x     X k k ,n  xn   X k   xn k ,n    X k X k   X k
N k  0  n 0
N k 0
n 0
n  0  N k 0

 N k 0
N 1
N 1
*
n n
2
(14.3.2)
In some applications, it may be important to use a transform that decorrelates
the transform coefficients.
In other applications, energy compaction (concentration of most of signal energy
in few transform coefficients) is highly desirable.
ELEN 5346/4304
DSP and Filter Design
Fall 2008
4
DFT revisited
Basis functions:
 k ,n  e j 2 kn N
(14.4.1)
Therefore, the N-point DFT pair:
N 1
X k   xn e
n 0
 j 2 kn N
N 1
  xnWNkn ,0  k  N  1
n 0
1 N 1
1 N 1
j 2 kn N
xn   X k e
  X kWN kn ,0  n  N  1
N k 0
N k 0
WN  e j 2
where
(14.4.2)
N
(14.4.3)
(14.4.4)
As a result, even for real xn, its DFT Xk is generally complex:
X k  X re,k  jX im,k
ELEN 5346/4304
DSP and Filter Design
Fall 2008
(14.4.5)
5
DFT symmetry relations
Real and imaginary parts of the DFT sequence can be found as:
1
X k  X k* 

2
1
  X k  X k* 
2
X re,k 
(14.5.1)
X im ,k
(14.5.2)
Assuming that the original time-domain signal is complex:
xn  xre,n  jxim,n
(14.5.3)
its DFT can be found as:
2 k
2 k 

X k    xre,n  jxim,n   cos
 j sin

N
N


n 0
N 1
2 k
2 k  N 1 
2 k
2 k 

   xre,n cos
 xim,n sin

j
x
cos

x
sin

im , n
re , n


N
N
N
N 
 n 0 
n 0 
N 1
ELEN 5346/4304
DSP and Filter Design
Fall 2008
(14.5.4)
6
DFT symmetry relations
Therefore, real and imaginary parts of the DFT sequence are:
2 k
2 k  N 1

 j kn
X re,k    xre,n cos
 xim,n sin

x
e
 cs,n
N
N  n 0
n 0 
N 1
2 k
2 k  N 1

 j kn
X im,k    xim,n cos
 xre,n sin

x
e
 ca,n
N
N  n 0
n 0 
N 1
(14.6.1)
(14.6.2)
Here xcs,n and xca,n are circular conjugate-symmetric and circular conjugateantisymmetric parts of xn:
xn  xcs,n  xca,n ,0  n  N 1
xcs ,n




1
xn  x*  n ,0  n  N  1
N
2
1
 xn  x*  n ,0  n  N  1
N
2
xcs ,n 
circular shift
ELEN 5346/4304
DSP and Filter Design
Fall 2008
(14.6.3)
(14.6.4)
(14.6.5)
7
DFT symmetry relations
Therefore, for complex sequences:
1
X k  X * k 
N 
N  DFT
2
1
j  xim ,n  X ca ,k   X k  X * k 
N 
N  DFT
2
xcs ,n  X re ,k
xre,n  X cs ,k 
N  DFT
(14.7.3)
(14.7.4)
x* n  X *  k
(14.7.5)
N  DFT
x*  n
DSP and Filter Design
(14.7.2)
xca ,n  j  X im ,k
N  DFT
ELEN 5346/4304
(14.7.1)
N
N
 X *k
N  DFT
Fall 2008
(14.7.6)
8
DFT symmetry relations
real
For real sequences:
Therefore:
 xcs , n  xev , n

 xca , n  xod ,n
(14.8.3)
xod ,n  j  X im,k
(14.8.4)
N  DFT
X k  X * k
(14.8.5)
N
X re,k  X re,  k
(14.8.6)
N
X im ,k   X im ,  k
Xk  X
k
Fall 2008
(14.8.7)
N
(14.8.8)
N
X k  X
DSP and Filter Design
(14.8.2)
xev ,n  X re,k
N  DFT
ELEN 5346/4304
(14.8.1)
k
(14.8.9)
N
9
DFT symmetry relations
If N (the length of the sequence) is even, the DFT samples X0 and X(N-2)/2 are
real and distinct. The remaining N – 2 samples of DFT are complex: a half of
them are distinct and the rest are their complex conjugates.
If N (the length of the sequence) is odd, the DFT sample X0 is real and
distinct. The remaining N – 1 samples of DFT are complex: a half of them are
distinct and the rest are their complex conjugates.
It is frequently desired to have an orthogonal transform that represents a real
time-domain sequence as another real sequence in the transform domain.
ELEN 5346/4304
DSP and Filter Design
Fall 2008
10
Type 2 DCT
There are several (8?) types of Discrete Cosine Transform (DCT), for the
development of which Dr. Rao (UT Arlington) is credited…
The most commonly used is DCT 2:
Basis functions:
 k ,n
  k (2n  1) 
k ( n 1 2
 cos 

Re
W


2N

2N


(14.10.1)
The DCT pair:
  k (2n  1) 
X DCT ,k   2 xn cos 
,0  k  N  1
2N


n 0
1 N 1
  k (2n  1) 
xn    k X DCT ,k cos 
,0  n  N  1
N k 0
2N


N 1
1 2,k  0
1,1  k  N  1
k  
where
ELEN 5346/4304
DSP and Filter Design
Fall 2008
(14.10.2)
(14.10.3)
(14.10.4)
11
Type 2 DCT
DCT Properties:
1. Linearity:
 g n   hn   GDCT ,k   H DCT ,k
(14.11.1)
g *n  G * DCT ,k
(14.11.2)
DCT
2. Symmetry:
DCT
N 1
3. Energy preservation:

n 0
gn
2
1 N 1

 k GDCT ,k

2 N k 0
2
(14.11.3)
DCT of a real sequence is another real sequence.
DCT has very good energy compaction properties: most of the signals energy
is confined to several first DCT coefficients. Therefore, DCT is used for lossy
data compression: JPEG, MPG, mp3…
ELEN 5346/4304
DSP and Filter Design
Fall 2008
12
Computation of type 2 DCT
DCT is related to DFT
X DCT ,k
 k 2 2 N 1

 2 Re W2 N  xnW2nkN  ,0  k  N  1
n 0


(14.12.1)
Therefore, the N-point DCT can be computed (by utilizing FFT algorithms) as
follows:
1. Extend xn to a length-2N sequence xe,n by zero-padding and compute its
2N-point DFT Xe,k;
2. Extract the first N samples of Xe,k and multiply each sample by W2kN2 ;
3. Extract the real part of the above samples and multiply each by 2.
ELEN 5346/4304
DSP and Filter Design
Fall 2008
13
The Haar transform
The transform pair:
X Haar = H N x
(14.13.1)
x = H N1X Haar
(14.13.2)
T
Haar transform coefficients:
X Haar   X Haar ,0  X Haar ,1... X Haar , N 1 
Time-domain samples:
x   x0  x1... xN 1 
(14.13.4)
Normalized Haar
transform matrix:
1
H2  
1
(14.13.5)
(14.13.3)
T
H 2v1
2
2
2 

1 2 
1
 H v  1 2 1 2  
2



,v  0
I  1 2 1 2  
 2v 
 
Where  denotes the Kronecker product and Ik is a k x k identity matrix.
ELEN 5346/4304
DSP and Filter Design
Fall 2008
(14.13.6)
14
The Haar transform
Properties:
1. Orthogonality:
which, for the inverse
transform, leads to:
H N1 
x

n 0
(14.14.1)
1 t
H N X Haar
N
N 1
2. Energy conservation:
1 t
HN
N
xn
2
1 N 1
  H Haar ,k
N k 0
(14.14.2)
2
(14.13.3)
The Haar transform represents a real time-domain sequence as another real
transform-domain sequence. Used in data compression algorithms.
ELEN 5346/4304
DSP and Filter Design
Fall 2008
Download