0% found this document useful (0 votes)
38 views

3: Discrete Cosine Transform

This document discusses the discrete cosine transform (DCT), including: - The DCT overcomes problems with the discrete Fourier transform (DFT) when processing signals in frames. - The DCT of a sine wave is well-localized and concentrated in one coefficient, unlike the DFT. - The DCT is equivalent to taking the DFT of an extended sequence constructed from the original signal. - Properties of the DCT include being linear, symmetric, anti-periodic, and periodic in its basis functions.

Uploaded by

Shiva Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

3: Discrete Cosine Transform

This document discusses the discrete cosine transform (DCT), including: - The DCT overcomes problems with the discrete Fourier transform (DFT) when processing signals in frames. - The DCT of a sine wave is well-localized and concentrated in one coefficient, unlike the DFT. - The DCT is equivalent to taking the DFT of an extended sequence constructed from the original signal. - Properties of the DCT include being linear, symmetric, anti-periodic, and periodic in its basis functions.

Uploaded by

Shiva Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

3: Discrete Cosine Transform

3: Discrete Cosine Transform


DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 1 / 14
DFT Problems
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 2 / 14
For processing 1-D or 2-D signals (especially coding), a common method is
to divide the signal into frames and then apply an invertible transform to
each frame that compresses the information into few coefcients.
The DFT has some problems when used for this purpose:
N real x[n] N complex X[k] : 2 real,
N
2
1 conj pairs

DFT the DTFT of a periodic signal formed by replicating x[n] .


Spurious frequency components from boundary discontinuity.
N=20
f=0.08

The Discrete Cosine Transform (DCT) overcomes these problems.


DCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 3 / 14
To form the Discrete Cosine Transform (DCT), replicate x[0 : N 1] but in
reverse order and insert a zero between each pair of samples:

0 12 23
y[r]
take the DFT of length 4N real symmetric sequence
0
12
23
Y[k]

result is real, symmetric and anti-periodic: only need rst N values


Forward DCT: X
C
[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
for k = 0 : N 1
Compare DFT: X
F
[k] =

N1
n=0
x[n] exp
j2(4n+0)k
4N
DCT of sine wave
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 4 / 14
DCT: X
C
[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
f =
m
N
f =
m
N
x[n]
N=20
f=0.10
N=20
f=0.08
|X
F
[k]|
|X
C
[k]|
DFT RealComplex, Freq range [0, 1], Poorly localized unless
f
m
N
: k
1
for m < k
N
2
DCT RealReal, Freq range [0, 0.5], well localized, k
2
for
m < k < N
DCT/DFT Equivalence
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 5 / 14
X
C
[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
0 12 23
y[r]
Dene y[r] =
_

_
0 r even
x
_
r1
2

r = 1 : 2 : 2N 1
x
_
4N1r
2

r = 2N + 1 : 2 : 4N 1
Y
F
[k] =

4N1
r=0
y[r]W
kr
4N
where W
M
= e
j2
M
(i)
=

2N1
n=0
y[2n + 1]W
(2n+1)k
4N
(ii)
=

N1
n=0
y[2n + 1]W
(2n+1)k
4N
+

N1
m=0
y[4N 2m1]W
(4N2m1)k
4N
(iii)
=

x[n]W
(2n+1)k
4N
+

N1
m=0
x[m]W
(2m+1)k
4N
= 2

N1
n=0
x[n] cos
2(2n+1)k
4N
= 2X
C
[k]
(i) odd r only: r = 2n + 1
(ii) reverse order for n N: m = 2N 1 n
(iii) substitute y denition & W
4Nk
4N
= e
j2
4Nk
4N
1
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k]
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
X[N] = 0 since X[N] = X[N] = X[N + 2N]
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
X[N] = 0 since X[N] = X[N] = X[N + 2N]
Periodic: X[k + 4N] = X[k] since cos ( + 2) = cos
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
X[N] = 0 since X[N] = X[N] = X[N + 2N]
Periodic: X[k + 4N] = X[k] since cos ( + 2) = cos
DCT basis functions:
0:
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
X[N] = 0 since X[N] = X[N] = X[N + 2N]
Periodic: X[k + 4N] = X[k] since cos ( + 2) = cos
DCT basis functions:
0:
1:
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
X[N] = 0 since X[N] = X[N] = X[N + 2N]
Periodic: X[k + 4N] = X[k] since cos ( + 2) = cos
DCT basis functions:
0:
1:
2:
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
X[N] = 0 since X[N] = X[N] = X[N + 2N]
Periodic: X[k + 4N] = X[k] since cos ( + 2) = cos
DCT basis functions:
0:
3:
1:
2:
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
X[N] = 0 since X[N] = X[N] = X[N + 2N]
Periodic: X[k + 4N] = X[k] since cos ( + 2) = cos
DCT basis functions:
0:
3:
1: 4:
2:
DCT Properties
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 6 / 14
Denition: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
Linear: x[n] +y[n] X[k] +Y [k]
DFT Convolution property does not hold
Symmetric: X[k] = X[k] since cos k = cos +k
Anti-periodic: X[k + 2N] = X[k] because:
cos ( +) = cos
2(2n + 1)(k + 2N) = 2(2n + 1)k + 8Nn + 4
X[N] = 0 since X[N] = X[N] = X[N + 2N]
Periodic: X[k + 4N] = X[k] since cos ( + 2) = cos
DCT basis functions:
0:
3:
1: 4:
2: 5:
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
0
12
23
Y[k]
W
b
a
= e
j
2b
a
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
[Y [k] = 2X[k]]
0
12
23
Y[k]
W
b
a
= e
j
2b
a
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
x[n] = y[2n + 1] [Y [k] = 2X[k]]
0
12
23
Y[k]
W
b
a
= e
j
2b
a
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
x[n] = y[2n + 1] =
1
2N

4N1
k=0
X[k]W
(2n+1)k
4N
[Y [k] = 2X[k]]
0
12
23
Y[k]
W
b
a
= e
j
2b
a
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
x[n] = y[2n + 1] =
1
2N

4N1
k=0
X[k]W
(2n+1)k
4N
[Y [k] = 2X[k]]
(i)
=
1
2N

2N1
k=0
X[k]W
(2n+1)k
4N

1
2N

2N1
l=0
X[l]W
(2n+1)(l+2N)
4N
0
12
23
Y[k]
W
b
a
= e
j
2b
a
(i) k = l + 2N for k 2N and X[k + 2N] = X[k]
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
x[n] = y[2n + 1] =
1
2N

4N1
k=0
X[k]W
(2n+1)k
4N
[Y [k] = 2X[k]]
(i)
=
1
2N

2N1
k=0
X[k]W
(2n+1)k
4N

1
2N

2N1
l=0
X[l]W
(2n+1)(l+2N)
4N
0
12
23
Y[k]
(ii)
=
1
N

2N1
k=0
X[k]W
(2n+1)k
4N
W
b
a
= e
j
2b
a
(i) k = l + 2N for k 2N and X[k + 2N] = X[k]
(ii)
(2n+1)(l+2N)
4N
=
(2n+1)l
4N
+n +
1
2
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
x[n] = y[2n + 1] =
1
2N

4N1
k=0
X[k]W
(2n+1)k
4N
[Y [k] = 2X[k]]
(i)
=
1
2N

2N1
k=0
X[k]W
(2n+1)k
4N

1
2N

2N1
l=0
X[l]W
(2n+1)(l+2N)
4N
0
12
23
Y[k]
(ii)
=
1
N

2N1
k=0
X[k]W
(2n+1)k
4N
W
b
a
= e
j
2b
a
(iii)
=
1
N
X[0] +
1
N

N1
k=1
X[k]W
(2n+1)k
4N
+
1
N
X[N]
+
1
N

N1
r=1
X[2N r]W
(2n+1)(2Nr)
4N
(i) k = l + 2N for k 2N and X[k + 2N] = X[k]
(ii)
(2n+1)(l+2N)
4N
=
(2n+1)l
4N
+n +
1
2
(iii) k = 2N r for k > N
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
x[n] = y[2n + 1] =
1
2N

4N1
k=0
X[k]W
(2n+1)k
4N
[Y [k] = 2X[k]]
(i)
=
1
2N

2N1
k=0
X[k]W
(2n+1)k
4N

1
2N

2N1
l=0
X[l]W
(2n+1)(l+2N)
4N
0
12
23
Y[k]
(ii)
=
1
N

2N1
k=0
X[k]W
(2n+1)k
4N
W
b
a
= e
j
2b
a
(iii)
=
1
N
X[0] +
1
N

N1
k=1
X[k]W
(2n+1)k
4N
+
1
N
X[N]
+
1
N

N1
r=1
X[2N r]W
(2n+1)(2Nr)
4N
(iv)
=
1
N
X[0] +
1
N

N1
k=1
X[k]W
(2n+1)k
4N
+
1
N

N1
r=1
X[r]W
(2n+1)r+2N
4N
(i) k = l + 2N for k 2N and X[k + 2N] = X[k]
(ii)
(2n+1)(l+2N)
4N
=
(2n+1)l
4N
+n +
1
2
(iii) k = 2N r for k > N (iv) X[N] = 0 and X[2N r] = X[r]
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
x[n] = y[2n + 1] =
1
2N

4N1
k=0
X[k]W
(2n+1)k
4N
[Y [k] = 2X[k]]
(i)
=
1
2N

2N1
k=0
X[k]W
(2n+1)k
4N

1
2N

2N1
l=0
X[l]W
(2n+1)(l+2N)
4N
0
12
23
Y[k]
(ii)
=
1
N

2N1
k=0
X[k]W
(2n+1)k
4N
W
b
a
= e
j
2b
a
(iii)
=
1
N
X[0] +
1
N

N1
k=1
X[k]W
(2n+1)k
4N
+
1
N
X[N]
+
1
N

N1
r=1
X[2N r]W
(2n+1)(2Nr)
4N
(iv)
=
1
N
X[0] +
1
N

N1
k=1
X[k]W
(2n+1)k
4N
+
1
N

N1
r=1
X[r]W
(2n+1)r+2N
4N
x[n] =
1
N
X[0] +
2
N

N1
k=1
X[k] cos
2(2n+1)k
4N
(i) k = l + 2N for k 2N and X[k + 2N] = X[k]
(ii)
(2n+1)(l+2N)
4N
=
(2n+1)l
4N
+n +
1
2
(iii) k = 2N r for k > N (iv) X[N] = 0 and X[2N r] = X[r]
IDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 7 / 14
y[r] =
1
4N

4N1
k=0
Y [k]W
rk
4N
=
1
2N

4N1
k=0
X[k]W
rk
4N
x[n] = y[2n + 1] =
1
2N

4N1
k=0
X[k]W
(2n+1)k
4N
[Y [k] = 2X[k]]
(i)
=
1
2N

2N1
k=0
X[k]W
(2n+1)k
4N

1
2N

2N1
l=0
X[l]W
(2n+1)(l+2N)
4N
0
12
23
Y[k]
(ii)
=
1
N

2N1
k=0
X[k]W
(2n+1)k
4N
W
b
a
= e
j
2b
a
(iii)
=
1
N
X[0] +
1
N

N1
k=1
X[k]W
(2n+1)k
4N
+
1
N
X[N]
+
1
N

N1
r=1
X[2N r]W
(2n+1)(2Nr)
4N
(iv)
=
1
N
X[0] +
1
N

N1
k=1
X[k]W
(2n+1)k
4N
+
1
N

N1
r=1
X[r]W
(2n+1)r+2N
4N
x[n] =
1
N
X[0] +
2
N

N1
k=1
X[k] cos
2(2n+1)k
4N
= Inverse DCT
(i) k = l + 2N for k 2N and X[k + 2N] = X[k]
(ii)
(2n+1)(l+2N)
4N
=
(2n+1)l
4N
+n +
1
2
(iii) k = 2N r for k > N (iv) X[N] = 0 and X[2N r] = X[r]
Energy Conservation
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 8 / 14
DCT: X[k] =

N1
n=0
x[n] cos
2(2n+1)k
4N
IDCT: x[n] =
1
N
X[0] +
2
N

N1
k=1
X[k] cos
2(2n+1)k
4N
rep

0 12 23
y[r]
DFT

0
12
23
Y[k]
2

Energy: E =

N1
n=0
|x[n]|
2
: E 2E8NE 0.5NE
E =
1
N
|X|
2
[0] +
2
N

N1
n=1
|X|
2
[n]
Orthogonal DCT
Dene: c[k] =
_
2
k
N
where
0
= 1,
k=0
= 0
ODCT: X[k] = c[k]

N1
n=0
x[n] cos
2(2n+1)k
4N
IODCT: x[n] =

N1
k=0
c[k]X[k] cos
2(2n+1)k
4N
Note: MATLAB dct() calculates the ODCT
Energy Compaction
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 9 / 14
If consecutive x[n] are positively correlated, DCT concentrates energy in a
few X[k] and decorrelates them.
Example: Markov Process: x[n] = x[n 1] +
_
1
2
u[n]
where u[n] is i.i.d. unit Gaussian.
Then

x
2
[n]
_
= 1 and x[n]x[n 1] = .
Covariance of vector x is S
i,j
=

xx
H
_
i,j
=
|ij|
.
Suppose ODCT of x is Cx and DFT is Fx.
Covariance of Cx is
_
Cxx
H
C
H
_
= CSC
H
(similarly FSF
H
)
Diagonal elements give mean coefcient energy.
Used in MPEG and JPEG (superseded
by JPEG2000 using wavelets)
Used in speech recognition to
decorrelate: DCT of log spectrum
5 10 15 20 25 30
50
60
70
80
90
100
DCT
DFT
=0.9
N=32
No of coefficients
C
u
m
u
l
a
t
i
v
e

e
n
e
r
g
y

(
%
)
Energy compaction good for coding (low-valued coefcients can be set to 0)
Decorrelation good for coding and for probability modelling
Frame-based coding
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 10 / 14
Divide continuous signal
into frames
x[n]
X[k] k=30/220
y[n]
y[n]-x[n]
Frame-based coding
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 10 / 14
Divide continuous signal
into frames
Apply DCT to each frame
x[n]
X[k] k=30/220
y[n]
y[n]-x[n]
Frame-based coding
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 10 / 14
Divide continuous signal
into frames
Apply DCT to each frame
Encode DCT
e.g. keep only 30 X[k]
x[n]
X[k] k=30/220
y[n]
y[n]-x[n]
Frame-based coding
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 10 / 14
Divide continuous signal
into frames
Apply DCT to each frame
Encode DCT
e.g. keep only 30 X[k]
Apply IDCT y[n]
x[n]
X[k] k=30/220
y[n]
y[n]-x[n]
Frame-based coding
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 10 / 14
Divide continuous signal
into frames
Apply DCT to each frame
Encode DCT
e.g. keep only 30 X[k]
Apply IDCT y[n]
x[n]
X[k] k=30/220
y[n]
y[n]-x[n]
Problem: Coding may create discontinuities at frame boundaries
Frame-based coding
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 10 / 14
Divide continuous signal
into frames
Apply DCT to each frame
Encode DCT
e.g. keep only 30 X[k]
Apply IDCT y[n]
x[n]
X[k] k=30/220
y[n]
y[n]-x[n]
Problem: Coding may create discontinuities at frame boundaries
e.g. JPEG, MPEG use 8 8 pixel blocks
8.3 kB (PNG) 1.6 kB (JPEG) 0.5 kB (JPEG)
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
MDCT
X[0 : N 1]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
MDCT: 2N N coefcients
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
MDCT
X[0 : N 1]
IMDCT
y
A
[0 : 2N 1]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
MDCT: 2N N coefcients, IMDCT: N 2N samples
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
MDCT
X[0 : N 1]
IMDCT
y
A
[0 : 2N 1]
x[N : 3N 1]
MDCT
X[N : 2N 1]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
MDCT: 2N N coefcients, IMDCT: N 2N samples
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
MDCT
X[0 : N 1]
IMDCT
y
A
[0 : 2N 1]
x[N : 3N 1]
MDCT
X[N : 2N 1]
IMDCT
y
B
[N : 3N 1]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
MDCT: 2N N coefcients, IMDCT: N 2N samples
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
MDCT
X[0 : N 1]
IMDCT
y
A
[0 : 2N 1]
x[N : 3N 1]
MDCT
X[N : 2N 1]
IMDCT
y
B
[N : 3N 1]
x[2N : 4N 1]
MDCT
X[2N : 3N 1]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
MDCT: 2N N coefcients, IMDCT: N 2N samples
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
MDCT
X[0 : N 1]
IMDCT
y
A
[0 : 2N 1]
x[N : 3N 1]
MDCT
X[N : 2N 1]
IMDCT
y
B
[N : 3N 1]
x[2N : 4N 1]
MDCT
X[2N : 3N 1]
IMDCT
y
A
[2N : 3N 1]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
MDCT: 2N N coefcients, IMDCT: N 2N samples
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
MDCT
X[0 : N 1]
IMDCT
y
A
[0 : 2N 1]
x[N : 3N 1]
MDCT
X[N : 2N 1]
IMDCT
y
B
[N : 3N 1]
x[2N : 4N 1]
MDCT
X[2N : 3N 1]
IMDCT
y
A
[2N : 3N 1]
y[] = y
A
[] +y
B
[]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
MDCT: 2N N coefcients, IMDCT: N 2N samples
Even frames y
A
, Odd frames y
B
then y = y
A
+y
B
Lapped Transform
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 11 / 14
Modied Discrete Cosine Transform (MDCT): overlapping frames 2N long
x[0 : 2N 1]
MDCT
X[0 : N 1]
IMDCT
y
A
[0 : 2N 1]
x[N : 3N 1]
MDCT
X[N : 2N 1]
IMDCT
y
B
[N : 3N 1]
x[2N : 4N 1]
MDCT
X[2N : 3N 1]
IMDCT
y
A
[2N : 3N 1]
y[] = y
A
[] +y
B
[]
x[n]
X[k]
y
A
[n]
y
B
[n]
y[n]
y[n]-x[n]
0 N
N
2N
2N
3N
3N
4N
4N
MDCT: 2N N coefcients, IMDCT: N 2N samples
Even frames y
A
, Odd frames y
B
then y = y
A
+y
B
Errors cancel exactly: Time-domain alias cancellation (TDAC)
MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

Now form the N-vector u =


_
d

c a

b
_
where

c is the vector c but in reverse order


MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

Now form the N-vector u =


_
d

c a

b
_
where

c is the vector c but in reverse order


Now form v =
_
u

and take 2N DCT


MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

Now form the N-vector u =


_
d

c a

b
_
where

c is the vector c but in reverse order


Now form v =
_
u

and take 2N DCT


V
C
[2k] = 0 because of symmetry, so set X
M
[k] = V
C
[2k + 1]
MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

Now form the N-vector u =


_
d

c a

b
_
where

c is the vector c but in reverse order


Now form v =
_
u

and take 2N DCT


V
C
[2k] = 0 because of symmetry, so set X
M
[k] = V
C
[2k + 1]
IMDCT
Undo above to get X
M
[k] u =
_
d

c a

b
_
MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

Now form the N-vector u =


_
d

c a

b
_
where

c is the vector c but in reverse order


Now form v =
_
u

and take 2N DCT


V
C
[2k] = 0 because of symmetry, so set X
M
[k] = V
C
[2k + 1]
IMDCT
Undo above to get X
M
[k] u =
_
d

c a

b
_
Create y
A
[n] =
_
a

b b

a c +

d d +

c
_
MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

Now form the N-vector u =


_
d

c a

b
_
where

c is the vector c but in reverse order


Now form v =
_
u

and take 2N DCT


V
C
[2k] = 0 because of symmetry, so set X
M
[k] = V
C
[2k + 1]
IMDCT
Undo above to get X
M
[k] u =
_
d

c a

b
_
Create y
A
[n] =
_
a

b b

a c +

d d +

c
_
Next frame: y
B
[n] =
_
c

d d

c e +

f f +

e
_
MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

Now form the N-vector u =


_
d

c a

b
_
where

c is the vector c but in reverse order


Now form v =
_
u

and take 2N DCT


V
C
[2k] = 0 because of symmetry, so set X
M
[k] = V
C
[2k + 1]
IMDCT
Undo above to get X
M
[k] u =
_
d

c a

b
_
Create y
A
[n] =
_
a

b b

a c +

d d +

c
_
Next frame: y
B
[n] =
_
c

d d

c e +

f f +

e
_
Adding together, the

d and

c terms cancel but c and d add.


MDCT
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 12 / 14
MDCT: X
M
[k] =

2N1
n=0
x[n] cos
2(2n+1+N)(2k+1)
8N
IMDCT: y
A,B
[n] =
1
N

N1
k=0
X
M
[k] cos
2(2n+1+N)(2k+1)
8N
MDCT can be made from a DCT of length 2N
Split x[n] into four
N
2
-vectors: x =
_
a b c d

Now form the N-vector u =


_
d

c a

b
_
where

c is the vector c but in reverse order


Now form v =
_
u

and take 2N DCT


V
C
[2k] = 0 because of symmetry, so set X
M
[k] = V
C
[2k + 1]
IMDCT
Undo above to get X
M
[k] u =
_
d

c a

b
_
Create y
A
[n] =
_
a

b b

a c +

d d +

c
_
Next frame: y
B
[n] =
_
c

d d

c e +

f f +

e
_
Adding together, the

d and

c terms cancel but c and d add.


Used in audio coding: MP3, WMA, AC-3, AAC, Vorbis, ATRAC
Summary
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 13 / 14
DCT: Discrete Cosine Transform
Equivalent to a DFT of time-shifted
_
x

x

Often scaled to make an orthogonal transform


Better than DFT for energy compaction and decorrelation
Nice convolution property of DFT is lost
MDCT: Modied Discrete Cosine Transform
Lapped transform: 2N N 2N
Aliasing errors cancel out when overlapping output frames are added
Like DCT for energy compaction and decorrelation
Overlapping frames can avoid edge effects
For further details see Mitra: 5.
MATLAB routines
3: Discrete Cosine Transform
DFT Problems
DCT
DCT of sine wave
DCT/DFT Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT
Summary
MATLAB routines
DSP and Digital Filters (2012-1744) Transforms: 3 14 / 14
dct, idct DFT with optional zero-padding

You might also like