3: Discrete Cosine Transform • DFT Problems • DCT + • Basis Functions • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary 3: Discrete Cosine Transform • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 1 / 14 DFT Problems
3: Discrete Cosine Transform For processing 1-D or 2-D signals (especially coding), a common method is • DFT Problems • DCT + to divide the signal into “frames” and then apply an invertible transform to • Basis Functions • DCT of sine wave each frame that compresses the information into few coefficients. • DCT Properties • Energy Conservation The DFT has some problems when used for this purpose: • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14 DFT Problems
3: Discrete Cosine Transform For processing 1-D or 2-D signals (especially coding), a common method is • DFT Problems • DCT + to divide the signal into “frames” and then apply an invertible transform to • Basis Functions • DCT of sine wave each frame that compresses the information into few coefficients. • DCT Properties • Energy Conservation The DFT has some problems when used for this purpose: • Energy Compaction • Frame-based coding N real x n N complex X k : 2 real, N conjugate pairs • LappedTransform + • [ ] ↔ [ ] 2 − 1 • MDCT (Modified DCT) • MDCT Basis Elements • Summary → • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14 DFT Problems
3: Discrete Cosine Transform For processing 1-D or 2-D signals (especially coding), a common method is • DFT Problems • DCT + to divide the signal into “frames” and then apply an invertible transform to • Basis Functions • DCT of sine wave each frame that compresses the information into few coefficients. • DCT Properties • Energy Conservation The DFT has some problems when used for this purpose: • Energy Compaction • Frame-based coding N real x n N complex X k : 2 real, N conjugate pairs • LappedTransform + • [ ] ↔ [ ] 2 − 1 • MDCT (Modified DCT) • MDCT Basis Elements • Summary → • MATLAB routines
• DFT ∝ the DTFT of a periodic signal formed by replicating x[n] .
DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14 DFT Problems
3: Discrete Cosine Transform For processing 1-D or 2-D signals (especially coding), a common method is • DFT Problems • DCT + to divide the signal into “frames” and then apply an invertible transform to • Basis Functions • DCT of sine wave each frame that compresses the information into few coefficients. • DCT Properties • Energy Conservation The DFT has some problems when used for this purpose: • Energy Compaction • Frame-based coding N real x n N complex X k : 2 real, N conjugate pairs • LappedTransform + • [ ] ↔ [ ] 2 − 1 • MDCT (Modified DCT) • MDCT Basis Elements • Summary → • MATLAB routines
• DFT ∝ the DTFT of a periodic signal formed by replicating x[n] . ⇒ Spurious frequency components from boundary discontinuity.
→ N=20 f=0.08
DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14 DFT Problems
3: Discrete Cosine Transform For processing 1-D or 2-D signals (especially coding), a common method is • DFT Problems • DCT + to divide the signal into “frames” and then apply an invertible transform to • Basis Functions • DCT of sine wave each frame that compresses the information into few coefficients. • DCT Properties • Energy Conservation The DFT has some problems when used for this purpose: • Energy Compaction • Frame-based coding N real x n N complex X k : 2 real, N conjugate pairs • LappedTransform + • [ ] ↔ [ ] 2 − 1 • MDCT (Modified DCT) • MDCT Basis Elements • Summary → • MATLAB routines
• 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.
DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14 DCT +
3: Discrete Cosine Transform • DFT Problems To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but in • DCT + reverse order and insert a zero between each pair of samples: • Basis Functions • DCT of sine wave y[r] • DCT Properties • Energy Conservation • Energy Compaction → • Frame-based coding • LappedTransform + • MDCT (Modified DCT) 0 12 23 • MDCT Basis Elements Take the DFT of length 4N real, symmetric, odd-sample-only sequence. • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14 DCT +
3: Discrete Cosine Transform • DFT Problems To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but in • DCT + reverse order and insert a zero between each pair of samples: • Basis Functions • DCT of sine wave y[r] • DCT Properties • Energy Conservation • Energy Compaction → • Frame-based coding • LappedTransform + • MDCT (Modified DCT) 0 12 23 • MDCT Basis Elements Take the DFT of length 4N real, symmetric, odd-sample-only sequence. • Summary • MATLAB routines Result is real, symmetric and anti-periodic:
Y[k]
12 0 23
DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14 DCT +
3: Discrete Cosine Transform • DFT Problems To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but in • DCT + reverse order and insert a zero between each pair of samples: • Basis Functions • DCT of sine wave y[r] • DCT Properties • Energy Conservation • Energy Compaction → • Frame-based coding • LappedTransform + • MDCT (Modified DCT) 0 12 23 • MDCT Basis Elements Take the DFT of length 4N real, symmetric, odd-sample-only sequence. • Summary • MATLAB routines Result is real, symmetric and anti-periodic: only need first N values
Y[k]
12 ÷2 0 23 −→
DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14 DCT +
3: Discrete Cosine Transform • DFT Problems To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but in • DCT + reverse order and insert a zero between each pair of samples: • Basis Functions • DCT of sine wave y[r] • DCT Properties • Energy Conservation • Energy Compaction → • Frame-based coding • LappedTransform + • MDCT (Modified DCT) 0 12 23 • MDCT Basis Elements Take the DFT of length 4N real, symmetric, odd-sample-only sequence. • Summary • MATLAB routines Result is real, symmetric and anti-periodic: only need first N values
Y[k]
12 ÷2 0 23 −→
N−1 2π(2n+1)k Forward DCT: XC [k] = n=0 x[n] cos 4N for k =0: N − 1 P
DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14 DCT +
3: Discrete Cosine Transform • DFT Problems To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but in • DCT + reverse order and insert a zero between each pair of samples: • Basis Functions • DCT of sine wave y[r] • DCT Properties • Energy Conservation • Energy Compaction → • Frame-based coding • LappedTransform + • MDCT (Modified DCT) 0 12 23 • MDCT Basis Elements Take the DFT of length 4N real, symmetric, odd-sample-only sequence. • Summary • MATLAB routines Result is real, symmetric and anti-periodic: only need first N values
Y[k]
12 ÷2 0 23 −→
N−1 2π(2n+1)k Forward DCT: XC [k] = n=0 x[n] cos 4N for k =0: N − 1 1 P 2 N−1 2π(2n+1)k Inverse DCT: x[n] = N X[0] + N k=1 X[k] cos 4N P DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
1 2 N−1 2π(2n+1)k DCT basis functions: x[n] = N X[0] + N k=1 X[k] cos 4N P
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
1 2 N−1 2π(2n+1)k DCT basis functions: x[n] = N X[0] + N k=1 X[k] cos 4N P
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
1 2 N−1 2π(2n+1)k DCT basis functions: x[n] = N X[0] + N k=1 X[k] cos 4N P
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
1 2 N−1 2π(2n+1)k DCT basis functions: x[n] = N X[0] + N k=1 X[k] cos 4N P
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
1 2 N−1 2π(2n+1)k DCT basis functions: x[n] = N X[0] + N k=1 X[k] cos 4N P
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
1 2 N−1 2π(2n+1)k DCT basis functions: x[n] = N X[0] + N k=1 X[k] cos 4N P
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 Basis Functions
3: Discrete Cosine Transform kn 1 N−1 j2π N • DFT Problems DFT basis functions: x[n] = N k=0 X[k]e • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
1 2 N−1 2π(2n+1)k DCT basis functions: x[n] = N X[0] + N k=1 X[k] cos 4N P
DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14 DCT of sine wave
3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: XC [k] = n=0 x[n] cos 4N • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14 DCT of sine wave
3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: XC [k] = n=0 x[n] cos 4N • DCT + • Basis Functions P f = m • DCT of sine wave N • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding x[n] • LappedTransform + N=20 f=0.10 • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14 DCT of sine wave
3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: XC [k] = n=0 x[n] cos 4N • DCT + • Basis Functions P f = m • DCT of sine wave N • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding x[n] • LappedTransform + N=20 f=0.10 • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines
|XF [k]|
DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14 DCT of sine wave
3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: XC [k] = n=0 x[n] cos 4N • DCT + • Basis Functions P f = m f 6= m • DCT of sine wave N N • DCT Properties • Energy Conservation • Energy Compaction x[n] • Frame-based coding N=20 N=20 f=0.10 f=0.08 • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines |XF [k]|
DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14 DCT of sine wave
3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: XC [k] = n=0 x[n] cos 4N • DCT + • Basis Functions P f = m f 6= m • DCT of sine wave N N • DCT Properties • Energy Conservation • Energy Compaction x[n] • Frame-based coding N=20 N=20 f=0.10 f=0.08 • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines |XF [k]|
DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14 DCT of sine wave
3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: XC [k] = n=0 x[n] cos 4N • DCT + • Basis Functions P f = m f 6= m • DCT of sine wave N N • DCT Properties • Energy Conservation • Energy Compaction x[n] • Frame-based coding N=20 N=20 f=0.10 f=0.08 • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines |XF [k]|
DFT: Real→Complex; Freq range [0, 1]; Poorly localized unless m −1 N f = N ; |XF [k]| ∝ k for Nf DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14 DCT of sine wave 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: XC [k] = n=0 x[n] cos 4N • DCT + • Basis Functions P f = m f 6= m • DCT of sine wave N N • DCT Properties • Energy Conservation • Energy Compaction x[n] • Frame-based coding N=20 N=20 f=0.10 f=0.08 • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines |XF [k]| |XC [k]| DFT: Real→Complex; Freq range [0, 1]; Poorly localized unless m −1 N f = N ; |XF [k]| ∝ k for Nf DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14 DCT of sine wave 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: XC [k] = n=0 x[n] cos 4N • DCT + • Basis Functions P f = m f 6= m • DCT of sine wave N N • DCT Properties • Energy Conservation • Energy Compaction x[n] • Frame-based coding N=20 N=20 f=0.10 f=0.08 • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines |XF [k]| |XC [k]| DFT: Real→Complex; Freq range [0, 1]; Poorly localized unless m −1 N f = N ; |XF [k]| ∝ k for Nf DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14 DCT Properties 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems Definition: X[k] = n=0 x[n] cos 4N • DCT + • Basis Functions P • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14 DCT Properties 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems Definition: X[k] = n=0 x[n] cos 4N • DCT + • Basis Functions • Linear: αx[n]P + βy[n] → αX[k] + βY [k] • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14 DCT Properties 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems Definition: X[k] = n=0 x[n] cos 4N • DCT + • Basis Functions • Linear: αx[n]P + βy[n] → αX[k] + βY [k] • DCT of sine wave • DCT Properties / • Energy Conservation • “Convolution←→Multiplication” property of DFT does not hold • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14 DCT Properties 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems Definition: X[k] = n=0 x[n] cos 4N • DCT + • Basis Functions • Linear: αx[n]P + βy[n] → αX[k] + βY [k] • DCT of sine wave • DCT Properties / • Energy Conservation • “Convolution←→Multiplication” property of DFT does not hold • Energy Compaction • Frame-based coding • Symmetric: X[−k] = X[k] since cos −αk = cos +αk • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14 DCT Properties 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems Definition: X[k] = n=0 x[n] cos 4N • DCT + • Basis Functions • Linear: αx[n]P + βy[n] → αX[k] + βY [k] • DCT of sine wave • DCT Properties / • Energy Conservation • “Convolution←→Multiplication” property of DFT does not hold • Energy Compaction • Frame-based coding • Symmetric: X[−k] = X[k] since cos −αk = cos +αk • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Anti-periodic: X[k + 2N] = −X[k] • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14 DCT Properties 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems Definition: X[k] = n=0 x[n] cos 4N • DCT + • Basis Functions • Linear: αx[n]P + βy[n] → αX[k] + βY [k] • DCT of sine wave • DCT Properties / • Energy Conservation • “Convolution←→Multiplication” property of DFT does not hold • Energy Compaction • Frame-based coding • Symmetric: X[−k] = X[k] since cos −αk = cos +αk • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Anti-periodic: X[k + 2N] = −X[k] because: • Summary ◦ 2π(2n + 1)(k + 2N) = 2π(2n + 1)k + 8πNn + 4Nπ • MATLAB routines ◦ cos(θ + π) = − cos θ DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14 DCT Properties 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems Definition: X[k] = n=0 x[n] cos 4N • DCT + • Basis Functions • Linear: αx[n]P + βy[n] → αX[k] + βY [k] • DCT of sine wave • DCT Properties / • Energy Conservation • “Convolution←→Multiplication” property of DFT does not hold • Energy Compaction • Frame-based coding • Symmetric: X[−k] = X[k] since cos −αk = cos +αk • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Anti-periodic: X[k + 2N] = −X[k] because: • Summary ◦ 2π(2n + 1)(k + 2N) = 2π(2n + 1)k + 8πNn + 4Nπ • MATLAB routines ◦ cos(θ + π) = − cos θ ⇒X[N] = 0 since X[N] = X[−N] = −X[−N + 2N] DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14 DCT Properties 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems Definition: X[k] = n=0 x[n] cos 4N • DCT + • Basis Functions • Linear: αx[n]P + βy[n] → αX[k] + βY [k] • DCT of sine wave • DCT Properties / • Energy Conservation • “Convolution←→Multiplication” property of DFT does not hold • Energy Compaction • Frame-based coding • Symmetric: X[−k] = X[k] since cos −αk = cos +αk • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Anti-periodic: X[k + 2N] = −X[k] because: • Summary ◦ 2π(2n + 1)(k + 2N) = 2π(2n + 1)k + 8πNn + 4Nπ • MATLAB routines ◦ cos(θ + π) = − cos θ ⇒X[N] = 0 since X[N] = X[−N] = −X[−N + 2N] • Periodic: X[k + 4N] = −X[k + 2N] = X[k] DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14 Energy Conservation 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: X[k] = n=0 x[n] cos 4N • DCT + 1 2 N−1 2π(2n+1)k • Basis Functions P IDCT: x[n] = N X[0] + N k=1 X[k] cos 4N • DCT of sine wave Y[k] • DCT Properties P y[r] • Energy Conservation rep DFT 12 ÷2 • Energy Compaction → → 0 23 → • Frame-based coding • LappedTransform + 0 12 23 • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14 Energy Conservation 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: X[k] = n=0 x[n] cos 4N • DCT + 1 2 N−1 2π(2n+1)k • Basis Functions P IDCT: x[n] = N X[0] + N k=1 X[k] cos 4N • DCT of sine wave Y[k] • DCT Properties P y[r] • Energy Conservation rep DFT 12 ÷2 • Energy Compaction → → 0 23 → • Frame-based coding • LappedTransform + 0 12 23 • MDCT (Modified DCT) • MDCT Basis Elements N−1 2 • Summary Energy: E = n=0 |x[n]| • MATLAB routines P DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14 Energy Conservation 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: X[k] = n=0 x[n] cos 4N • DCT + 1 2 N−1 2π(2n+1)k • Basis Functions P IDCT: x[n] = N X[0] + N k=1 X[k] cos 4N • DCT of sine wave Y[k] • DCT Properties P y[r] • Energy Conservation rep DFT 12 ÷2 • Energy Compaction → → 0 23 → • Frame-based coding • LappedTransform + 0 12 23 • MDCT (Modified DCT) • MDCT Basis Elements N−1 2 1 2 2 N−1 2 • Summary Energy: E = n=0 |x[n]| = N |X[0]| + N n=1 |X[n]| • MATLAB routines P P DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14 Energy Conservation 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: X[k] = n=0 x[n] cos 4N • DCT + 1 2 N−1 2π(2n+1)k • Basis Functions P IDCT: x[n] = N X[0] + N k=1 X[k] cos 4N • DCT of sine wave Y[k] • DCT Properties P y[r] • Energy Conservation rep DFT 12 ÷2 • Energy Compaction → → 0 23 → • Frame-based coding • LappedTransform + 0 12 23 • MDCT (Modified DCT) • MDCT Basis Elements N−1 2 1 2 2 N−1 2 • Summary Energy: E = n=0 |x[n]| = N |X[0]| + N n=1 |X[n]| • MATLAB routines In diagram above:P E → 2E→ 8NE→≈ 0.5NEP DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14 Energy Conservation 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: X[k] = n=0 x[n] cos 4N • DCT + 1 2 N−1 2π(2n+1)k • Basis Functions P IDCT: x[n] = N X[0] + N k=1 X[k] cos 4N • DCT of sine wave Y[k] • DCT Properties P y[r] • Energy Conservation rep DFT 12 ÷2 • Energy Compaction → → 0 23 → • Frame-based coding • LappedTransform + 0 12 23 • MDCT (Modified DCT) • MDCT Basis Elements N−1 2 1 2 2 N−1 2 • Summary Energy: E = n=0 |x[n]| = N |X[0]| + N n=1 |X[n]| • MATLAB routines In diagram above:P E → 2E→ 8NE→≈ 0.5NEP Orthogonal DCT (preserves energy: |x[n]|2 = |X[n]|2) P P Note: MATLAB dct() calculates the ODCT DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14 Energy Conservation 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: X[k] = n=0 x[n] cos 4N • DCT + 1 2 N−1 2π(2n+1)k • Basis Functions P IDCT: x[n] = N X[0] + N k=1 X[k] cos 4N • DCT of sine wave Y[k] • DCT Properties P y[r] • Energy Conservation rep DFT 12 ÷2 • Energy Compaction → → 0 23 → • Frame-based coding • LappedTransform + 0 12 23 • MDCT (Modified DCT) • MDCT Basis Elements N−1 2 1 2 2 N−1 2 • Summary Energy: E = n=0 |x[n]| = N |X[0]| + N n=1 |X[n]| • MATLAB routines In diagram above:P E → 2E→ 8NE→≈ 0.5NEP Orthogonal DCT (preserves energy: |x[n]|2 = |X[n]|2) P P 1 N−1 N n=0 x[n] k = 0 ODCT: X[k] = q 2 PN−1 2π(2n+1)k N n=0 x[n] cos 4N k 6= 0 q P Note: MATLAB dct() calculates the ODCT DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14 Energy Conservation 3: Discrete Cosine Transform N−1 2π(2n+1)k • DFT Problems DCT: X[k] = n=0 x[n] cos 4N • DCT + 1 2 N−1 2π(2n+1)k • Basis Functions P IDCT: x[n] = N X[0] + N k=1 X[k] cos 4N • DCT of sine wave Y[k] • DCT Properties P y[r] • Energy Conservation rep DFT 12 ÷2 • Energy Compaction → → 0 23 → • Frame-based coding • LappedTransform + 0 12 23 • MDCT (Modified DCT) • MDCT Basis Elements N−1 2 1 2 2 N−1 2 • Summary Energy: E = n=0 |x[n]| = N |X[0]| + N n=1 |X[n]| • MATLAB routines In diagram above:P E → 2E→ 8NE→≈ 0.5NEP Orthogonal DCT (preserves energy: |x[n]|2 = |X[n]|2) P P 1 N−1 N n=0 x[n] k = 0 ODCT: X[k] = q 2 PN−1 2π(2n+1)k N n=0 x[n] cos 4N k 6= 0 q P 1 2 N−1 2π(2n+1)k IODCT: x[n] = N X[0] + N k=1 X[k] cos 4N q q P Note: MATLAB dct() calculates the ODCT DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14 Energy Compaction 3: Discrete Cosine Transform • DFT Problems If consecutive x[n] are positively correlated, DCT concentrates energy in a • DCT + few X[k] and decorrelates them. • Basis Functions • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14 Energy Compaction 3: Discrete Cosine Transform • DFT Problems If consecutive x[n] are positively correlated, DCT concentrates energy in a • DCT + few X[k] and decorrelates them. • Basis Functions • DCT of sine wave 2 • DCT Properties Example: Markov Process: x[n] = ρx[n − 1] + 1 − ρ u[n] • Energy Conservation where u[n] is i.i.d. unit Gaussian. • Energy Compaction p 2 • Frame-based coding Then x [n] = 1 and hx[n]x[n − 1]i = ρ. • LappedTransform + H |i−j| • MDCT (Modified DCT) Covariance of vector is . x Si,j = xx i,j = ρ • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14 Energy Compaction 3: Discrete Cosine Transform • DFT Problems If consecutive x[n] are positively correlated, DCT concentrates energy in a • DCT + few X[k] and decorrelates them. • Basis Functions • DCT of sine wave 2 • DCT Properties Example: Markov Process: x[n] = ρx[n − 1] + 1 − ρ u[n] • Energy Conservation where u[n] is i.i.d. unit Gaussian. • Energy Compaction p 2 • Frame-based coding Then x [n] = 1 and hx[n]x[n − 1]i = ρ. • LappedTransform + H |i−j| • MDCT (Modified DCT) Covariance of vector is . x Si,j = xx i,j = ρ • MDCT Basis Elements • Summary Suppose ODCT of x is Cx and DFT is Fx. • MATLAB routines Covariance of Cx is CxxH CH = CSCH (similarly FSFH ) Diagonal elements giveD mean coefficientE energy. DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14 Energy Compaction 3: Discrete Cosine Transform • DFT Problems If consecutive x[n] are positively correlated, DCT concentrates energy in a • DCT + few X[k] and decorrelates them. • Basis Functions • DCT of sine wave 2 • DCT Properties Example: Markov Process: x[n] = ρx[n − 1] + 1 − ρ u[n] • Energy Conservation where u[n] is i.i.d. unit Gaussian. • Energy Compaction p 2 • Frame-based coding Then x [n] = 1 and hx[n]x[n − 1]i = ρ. • LappedTransform + H |i−j| • MDCT (Modified DCT) Covariance of vector is . x Si,j = xx i,j = ρ • MDCT Basis Elements • Summary Suppose ODCT of x is Cx and DFT is Fx. • MATLAB routines Covariance of Cx is CxxH CH = CSCH (similarly FSFH ) Diagonal elements giveD mean coefficientE energy. DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14 Energy Compaction 3: Discrete Cosine Transform • DFT Problems If consecutive x[n] are positively correlated, DCT concentrates energy in a • DCT + few X[k] and decorrelates them. • Basis Functions • DCT of sine wave 2 • DCT Properties Example: Markov Process: x[n] = ρx[n − 1] + 1 − ρ u[n] • Energy Conservation where u[n] is i.i.d. unit Gaussian. • Energy Compaction p 2 • Frame-based coding Then x [n] = 1 and hx[n]x[n − 1]i = ρ. • LappedTransform + H |i−j| • MDCT (Modified DCT) Covariance of vector is . x Si,j = xx i,j = ρ • MDCT Basis Elements • Summary Suppose ODCT of x is Cx and DFT is Fx. • MATLAB routines Covariance of Cx is CxxH CH = CSCH (similarly FSFH ) Diagonal elements giveD mean coefficientE energy. • Used in MPEG and JPEG (superseded by JPEG2000 using wavelets) • Used in speech recognition to decorrelate spectral coeficients: DCT of log spectrum DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14 Energy Compaction 3: Discrete Cosine Transform • DFT Problems If consecutive x[n] are positively correlated, DCT concentrates energy in a • DCT + few X[k] and decorrelates them. • Basis Functions • DCT of sine wave 2 • DCT Properties Example: Markov Process: x[n] = ρx[n − 1] + 1 − ρ u[n] • Energy Conservation where u[n] is i.i.d. unit Gaussian. • Energy Compaction p 2 • Frame-based coding Then x [n] = 1 and hx[n]x[n − 1]i = ρ. • LappedTransform + H |i−j| • MDCT (Modified DCT) Covariance of vector is . x Si,j = xx i,j = ρ • MDCT Basis Elements • Summary Suppose ODCT of x is Cx and DFT is Fx. • MATLAB routines Covariance of Cx is CxxH CH = CSCH (similarly FSFH ) Diagonal elements giveD mean coefficientE energy. • Used in MPEG and JPEG (superseded by JPEG2000 using wavelets) • Used in speech recognition to decorrelate spectral coeficients: DCT of log spectrum Energy compaction good for coding (low-valued coefficients can be set to 0) Decorrelation good for coding and for probability modelling DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14 Frame-based coding 3: Discrete Cosine Transform • Divide continuous signal • DFT Problems x[n] • DCT + into frames • Basis Functions • DCT of sine wave X[k] k=30/220 • DCT Properties • Energy Conservation y[n] • Energy Compaction • Frame-based coding y[n]-x[n] • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14 Frame-based coding 3: Discrete Cosine Transform • Divide continuous signal • DFT Problems x[n] • DCT + into frames • Basis Functions X[k] • DCT of sine wave • Apply DCT to each frame k=30/220 • DCT Properties • Energy Conservation y[n] • Energy Compaction • Frame-based coding y[n]-x[n] • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14 Frame-based coding 3: Discrete Cosine Transform • Divide continuous signal • DFT Problems x[n] • DCT + into frames • Basis Functions X[k] • DCT of sine wave • Apply DCT to each frame k=30/220 • DCT Properties • Energy Conservation y[n] • Energy Compaction • Encode DCT • Frame-based coding y[n]-x[n] • LappedTransform + ◦ e.g. keep only 30 X[k] • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14 Frame-based coding 3: Discrete Cosine Transform • Divide continuous signal • DFT Problems x[n] • DCT + into frames • Basis Functions X[k] • DCT of sine wave • Apply DCT to each frame k=30/220 • DCT Properties • Energy Conservation y[n] • Energy Compaction • Encode DCT • Frame-based coding y[n]-x[n] • LappedTransform + ◦ e.g. keep only 30 X[k] • MDCT (Modified DCT) • MDCT Basis Elements • Summary • Apply IDCT → y[n] • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14 Frame-based coding 3: Discrete Cosine Transform • Divide continuous signal • DFT Problems x[n] • DCT + into frames • Basis Functions X[k] • DCT of sine wave • Apply DCT to each frame k=30/220 • DCT Properties • Energy Conservation y[n] • Energy Compaction • Encode DCT • Frame-based coding y[n]-x[n] • LappedTransform + ◦ e.g. keep only 30 X[k] • MDCT (Modified DCT) • MDCT Basis Elements • Summary • Apply IDCT → y[n] • MATLAB routines Problem: Coding may create discontinuities at frame boundaries DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14 Frame-based coding 3: Discrete Cosine Transform • Divide continuous signal • DFT Problems x[n] • DCT + into frames • Basis Functions X[k] • DCT of sine wave • Apply DCT to each frame k=30/220 • DCT Properties • Energy Conservation y[n] • Energy Compaction • Encode DCT • Frame-based coding y[n]-x[n] • LappedTransform + ◦ e.g. keep only 30 X[k] • MDCT (Modified DCT) • MDCT Basis Elements • Summary • Apply IDCT → y[n] • MATLAB routines 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) DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave • DCT Properties x[n] N 2N 3N 4N • Energy Conservation • Energy Compaction X [k] • Frame-based coding 0 • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements y [n] 0 • Summary • MATLAB routines 0 N 2N 3N 4N DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave MDCT x[n] N 2N 3N 4N • DCT Properties → X0[0 : N − 1] • Energy Conservation • Energy Compaction X [k] • Frame-based coding 0 • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements y [n] 0 • Summary • MATLAB routines 0 N 2N 3N 4N MDCT: 2N → N coefficients DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave MDCT x[n] N 2N 3N 4N • DCT Properties → X0[0 : N − 1] • Energy Conservation IMDCT • Energy Compaction → y0[0:2N − 1] X [k] • Frame-based coding 0 • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements y [n] 0 • Summary • MATLAB routines 0 N 2N 3N 4N MDCT: 2N → N coefficients, IMDCT: N → 2N samples DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave MDCT x[n] N 2N 3N 4N • DCT Properties → X0[0 : N − 1] • Energy Conservation IMDCT • Energy Compaction → y0[0:2N − 1] X [k] • Frame-based coding 0 • LappedTransform + x N N X [k] • MDCT (Modified DCT) [ : 3 − 1] 1 MDCT • MDCT Basis Elements y [n] → X [N : 2N − 1] 0 • Summary 1 • MATLAB routines y [n] 1 0 N 2N 3N 4N MDCT: 2N → N coefficients, IMDCT: N → 2N samples DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave MDCT x[n] N 2N 3N 4N • DCT Properties → X0[0 : N − 1] • Energy Conservation IMDCT • Energy Compaction → y0[0:2N − 1] X [k] • Frame-based coding 0 • LappedTransform + x N N X [k] • MDCT (Modified DCT) [ : 3 − 1] 1 MDCT • MDCT Basis Elements y [n] → X [N : 2N − 1] 0 • Summary 1 IMDCT • MATLAB routines y [n] → y1[N : 3N − 1] 1 0 N 2N 3N 4N MDCT: 2N → N coefficients, IMDCT: N → 2N samples DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave MDCT x[n] N 2N 3N 4N • DCT Properties → X0[0 : N − 1] • Energy Conservation IMDCT • Energy Compaction → y0[0:2N − 1] X [k] • Frame-based coding 0 • LappedTransform + x[N : 3N − 1] X [k] • MDCT (Modified DCT) 1 X [k] MDCT 2 • MDCT Basis Elements y [n] → X [N : 2N − 1] 0 • Summary 1 IMDCT • MATLAB routines y [n] → y1[N : 3N − 1] 1 y [n] 2 x[2N : 4N − 1] MDCT → X2[2N : 3N − 1] 0 N 2N 3N 4N MDCT: 2N → N coefficients, IMDCT: N → 2N samples DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave MDCT x[n] N 2N 3N 4N • DCT Properties → X0[0 : N − 1] • Energy Conservation IMDCT • Energy Compaction → y0[0:2N − 1] X [k] • Frame-based coding 0 • LappedTransform + x[N : 3N − 1] X [k] • MDCT (Modified DCT) 1 X [k] MDCT 2 • MDCT Basis Elements y [n] → X [N : 2N − 1] 0 • Summary 1 IMDCT • MATLAB routines y [n] → y1[N : 3N − 1] 1 y [n] 2 x[2N : 4N − 1] MDCT → X2[2N : 3N − 1] IMDCT y N N → 2[2 : 4 − 1] 0 N 2N 3N 4N MDCT: 2N → N coefficients, IMDCT: N → 2N samples DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave MDCT x[n] N 2N 3N 4N • DCT Properties → X0[0 : N − 1] • Energy Conservation IMDCT • Energy Compaction → y0[0:2N − 1] X [k] • Frame-based coding 0 • LappedTransform + x[N : 3N − 1] X [k] • MDCT (Modified DCT) 1 X [k] MDCT 2 • MDCT Basis Elements y [n] → X [N : 2N − 1] 0 • Summary 1 IMDCT • MATLAB routines y [n] → y1[N : 3N − 1] 1 y [n] 2 x[2N : 4N − 1] y[n] MDCT → X2[2N : 3N − 1] IMDCT y N N → 2[2 : 4 − 1] 0 N 2N 3N 4N y[n] = y0[n] + y1[n] + y2[n] MDCT: 2N → N coefficients, IMDCT: N → 2N samples Add yi[n] together to get y[n]. Only two non-zero terms far any n. DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 Lapped Transform + 3: Discrete Cosine Transform Modified Discrete Cosine Transform (MDCT): overlapping frames N long • DFT Problems 2 • DCT + • Basis Functions x[0:2N − 1] • DCT of sine wave MDCT x[n] N 2N 3N 4N • DCT Properties → X0[0 : N − 1] • Energy Conservation IMDCT • Energy Compaction → y0[0:2N − 1] X [k] • Frame-based coding 0 • LappedTransform + x[N : 3N − 1] X [k] • MDCT (Modified DCT) 1 X [k] MDCT 2 • MDCT Basis Elements y [n] → X [N : 2N − 1] 0 • Summary 1 IMDCT • MATLAB routines y [n] → y1[N : 3N − 1] 1 y [n] 2 x[2N : 4N − 1] y[n] MDCT → X2[2N : 3N − 1] y[n]-x[n] = error IMDCT y N N → 2[2 : 4 − 1] 0 N 2N 3N 4N y[n] = y0[n] + y1[n] + y2[n] MDCT: 2N → N coefficients, IMDCT: N → 2N samples Add yi[n] together to get y[n]. Only two non-zero terms far any n. Errors cancel exactly: Time-domain alias cancellation (TDAC) DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14 MDCT (Modified DCT) 2N−1 2π(2n+1+N)(2k+1) MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N P DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14 MDCT (Modified DCT) 2N−1 2π(2n+1+N)(2k+1) MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N P If x and X are column vectors, then X = Mx 2π(2n+1+N)(2k+1) where M is an N × 2N matrix with mk,n = cos 8N . DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14 MDCT (Modified DCT) 2N−1 2π(2n+1+N)(2k+1) MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N P1 N−1 2π(2n+1+N)(2k+1) IMDCT: y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N If x and X are columnP vectors, then X = Mx 2π(2n+1+N)(2k+1) where M is an N × 2N matrix with mk,n = cos 8N . DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14 MDCT (Modified DCT) 2N−1 2π(2n+1+N)(2k+1) MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N P1 N−1 2π(2n+1+N)(2k+1) IMDCT: y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N P 1 T If x, X and y are column vectors, then X = Mx and y = N M X 2π(2n+1+N)(2k+1) where M is an N × 2N matrix with mk,n = cos 8N . DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14 MDCT (Modified DCT) 2N−1 2π(2n+1+N)(2k+1) MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N P1 N−1 2π(2n+1+N)(2k+1) IMDCT: y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N P 1 T 1 T If x, X and y are column vectors, then X = Mx and y = N M X = N M Mx 2π(2n+1+N)(2k+1) where M is an N × 2N matrix with mk,n = cos 8N . DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14 MDCT (Modified DCT) 2N−1 2π(2n+1+N)(2k+1) MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N P1 N−1 2π(2n+1+N)(2k+1) IMDCT: y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N P 1 T 1 T If x, X and y are column vectors, then X = Mx and y = N M X = N M Mx 2π(2n+1+N)(2k+1) where M is an N × 2N matrix with mk,n = cos 8N . 1 T Quasi-Orthogonality: The 2N × 2Nmatrix, N M M, is almost the identity: 1 ··· 0 0 ··· 1 1 T 1 I − J 0 ...... M M = with I = . .. . , J = . .. . N 2 0 I + J . . . . 0 ··· 1 1 ··· 0 DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14 MDCT (Modified DCT) 2N−1 2π(2n+1+N)(2k+1) MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N P1 N−1 2π(2n+1+N)(2k+1) IMDCT: y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N P 1 T 1 T If x, X and y are column vectors, then X = Mx and y = N M X = N M Mx 2π(2n+1+N)(2k+1) where M is an N × 2N matrix with mk,n = cos 8N . 1 T Quasi-Orthogonality: The 2N × 2Nmatrix, N M M, is almost the identity: 1 ··· 0 0 ··· 1 1 T 1 I − J 0 ...... M M = with I = . .. . , J = . .. . N 2 0 I + J . . . . 0 ··· 1 1 ··· 0 When two consective y frames are overlapped by N samples, the second half of the 1 first frame has thus been multiplied by 2 (I + J) and the first half of the second frame 1 by 2 (I − J). When these y frames are added together, the corresponding x samples 1 1 have been multiplied by 2 (I + J) + 2 (I − J) = I giving perfect reconstruction. DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14 MDCT (Modified DCT) 2N−1 2π(2n+1+N)(2k+1) MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N P1 N−1 2π(2n+1+N)(2k+1) IMDCT: y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N P 1 T 1 T If x, X and y are column vectors, then X = Mx and y = N M X = N M Mx 2π(2n+1+N)(2k+1) where M is an N × 2N matrix with mk,n = cos 8N . 1 T Quasi-Orthogonality: The 2N × 2Nmatrix, N M M, is almost the identity: 1 ··· 0 0 ··· 1 1 T 1 I − J 0 ...... M M = with I = . .. . , J = . .. . N 2 0 I + J . . . . 0 ··· 1 1 ··· 0 When two consective y frames are overlapped by N samples, the second half of the 1 first frame has thus been multiplied by 2 (I + J) and the first half of the second frame 1 by 2 (I − J). When these y frames are added together, the corresponding x samples 1 1 have been multiplied by 2 (I + J) + 2 (I − J) = I giving perfect reconstruction. Normally the 2N-long x and y frames are windowed before the MDCT and again after the IMDCT to avoid any discontinuities; if the window is symmetric and satisfies w2[i] + w2[i + N] = 2 the perfect reconstruction property is still true. DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14 MDCT Basis Elements 3: Discrete Cosine Transform 2N−1 2π(2n+1+N)(2k+1) • DFT Problems MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N • DCT + • Basis Functions P N π n N k IMDCT: 1 −1 2 (2 +1+ )(2 +1) • DCT of sine wave y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N • DCT Properties • Energy Conservation P • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14 MDCT Basis Elements 3: Discrete Cosine Transform 2N−1 2π(2n+1+N)(2k+1) • DFT Problems MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N • DCT + • Basis Functions P N π n N k IMDCT: 1 −1 2 (2 +1+ )(2 +1) • DCT of sine wave y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N • DCT Properties P 1 T 1 T • Energy Conservation In vector notation: X = Mx and y = M X = M Mx • Energy Compaction N N • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14 MDCT Basis Elements 3: Discrete Cosine Transform 2N−1 2π(2n+1+N)(2k+1) • DFT Problems MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N • DCT + • Basis Functions P N π n N k IMDCT: 1 −1 2 (2 +1+ )(2 +1) • DCT of sine wave y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N • DCT Properties P 1 T 1 T • Energy Conservation In vector notation: X = Mx and y = M X = M Mx • Energy Compaction N N • Frame-based coding • LappedTransform + The rows of M form the • MDCT (Modified DCT) MDCT basis elements. • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14 MDCT Basis Elements 3: Discrete Cosine Transform 2N−1 2π(2n+1+N)(2k+1) • DFT Problems MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N • DCT + • Basis Functions P N π n N k IMDCT: 1 −1 2 (2 +1+ )(2 +1) • DCT of sine wave y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N • DCT Properties P 1 T 1 T • Energy Conservation In vector notation: X = Mx and y = M X = M Mx • Energy Compaction N N • Frame-based coding • LappedTransform + The rows of M form the • MDCT (Modified DCT) MDCT basis elements. • MDCT Basis Elements • Summary • MATLAB routines Example (N = 4): M = 0.56 0.20 −0.20 −0.56 −0.83 −0.98 −0.98 −0.83 −0.98 −0.56 0.56 0.98 0.20 −0.83 −0.83 0.20 0.20 0.83 −0.83 −0.20 0.98 −0.56 −0.56 0.98 0.83 −0.98 0.98 −0.83 0.56 −0.20 −0.20 0.56 DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14 MDCT Basis Elements 3: Discrete Cosine Transform 2N−1 2π(2n+1+N)(2k+1) • DFT Problems MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N • DCT + • Basis Functions P N π n N k IMDCT: 1 −1 2 (2 +1+ )(2 +1) • DCT of sine wave y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N • DCT Properties P 1 T 1 T • Energy Conservation In vector notation: X = Mx and y = M X = M Mx • Energy Compaction N N • Frame-based coding • LappedTransform + The rows of M form the • MDCT (Modified DCT) MDCT basis elements. • MDCT Basis Elements • Summary • MATLAB routines Example (N = 4): M = 0.56 0.20 −0.20 −0.56 −0.83 −0.98 −0.98 −0.83 −0.98 −0.56 0.56 0.98 0.20 −0.83 −0.83 0.20 0.20 0.83 −0.83 −0.20 0.98 −0.56 −0.56 0.98 0.83 −0.98 0.98 −0.83 0.56 −0.20 −0.20 0.56 DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14 MDCT Basis Elements 3: Discrete Cosine Transform 2N−1 2π(2n+1+N)(2k+1) • DFT Problems MDCT: X[k] = n=0 x[n] cos 8N 0 ≤ k < N • DCT + • Basis Functions P N π n N k IMDCT: 1 −1 2 (2 +1+ )(2 +1) • DCT of sine wave y[n] = N k=0 X[k] cos 8N 0 ≤ n < 2N • DCT Properties P 1 T 1 T • Energy Conservation In vector notation: X = Mx and y = M X = M Mx • Energy Compaction N N • Frame-based coding • LappedTransform + The rows of M form the • MDCT (Modified DCT) MDCT basis elements. • MDCT Basis Elements • Summary • MATLAB routines Example (N = 4): M = 0.56 0.20 −0.20 −0.56 −0.83 −0.98 −0.98 −0.83 −0.98 −0.56 0.56 0.98 0.20 −0.83 −0.83 0.20 0.20 0.83 −0.83 −0.20 0.98 −0.56 −0.56 0.98 0.83 −0.98 0.98 −0.83 0.56 −0.20 −0.20 0.56 The basis frequencies are {0.5, 1.5, 2.5, 3.5} times the fundamental. DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + ◦ Decorrelation: The coefficients are uncorrelated with each other • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + ◦ Decorrelation: The coefficients are uncorrelated with each other • MDCT (Modified DCT) • Nice convolution property of DFT is lost / • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + ◦ Decorrelation: The coefficients are uncorrelated with each other • MDCT (Modified DCT) • Nice convolution property of DFT is lost / • MDCT Basis Elements • Summary • MATLAB routines MDCT: Modified Discrete Cosine Transform • Lapped transform: 2N → N → 2N DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + ◦ Decorrelation: The coefficients are uncorrelated with each other • MDCT (Modified DCT) • Nice convolution property of DFT is lost / • MDCT Basis Elements • Summary • MATLAB routines MDCT: Modified Discrete Cosine Transform • Lapped transform: 2N → N → 2N • Aliasing errors cancel out when overlapping output frames are added DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + ◦ Decorrelation: The coefficients are uncorrelated with each other • MDCT (Modified DCT) • Nice convolution property of DFT is lost / • MDCT Basis Elements • Summary • MATLAB routines MDCT: Modified Discrete Cosine Transform • Lapped transform: 2N → N → 2N • Aliasing errors cancel out when overlapping output frames are added • Similar to DCT for energy compaction and decorrelation , DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + ◦ Decorrelation: The coefficients are uncorrelated with each other • MDCT (Modified DCT) • Nice convolution property of DFT is lost / • MDCT Basis Elements • Summary • MATLAB routines MDCT: Modified Discrete Cosine Transform • Lapped transform: 2N → N → 2N • Aliasing errors cancel out when overlapping output frames are added • Similar to DCT for energy compaction and decorrelation , • Overlapping windowed frames can avoid edge discontinuities , DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + ◦ Decorrelation: The coefficients are uncorrelated with each other • MDCT (Modified DCT) • Nice convolution property of DFT is lost / • MDCT Basis Elements • Summary • MATLAB routines MDCT: Modified Discrete Cosine Transform • Lapped transform: 2N → N → 2N • Aliasing errors cancel out when overlapping output frames are added • Similar to DCT for energy compaction and decorrelation , • Overlapping windowed frames can avoid edge discontinuities , • Used in audio coding: MP3, WMA, AC-3, AAC, Vorbis, ATRAC DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 Summary 3: Discrete Cosine Transform DCT: Discrete Cosine Transform • DFT Problems ←− • DCT + • Equivalent to a DFT of time-shifted double-length x x • Basis Functions • DCT of sine wave • Often scaled to make an orthogonal transform (ODCT) • DCT Properties • Better than DFT for energy compaction and decorrelation , • Energy Conservation • Energy Compaction ◦ Energy Compaction: Most energy is in only a few coefficients • Frame-based coding • LappedTransform + ◦ Decorrelation: The coefficients are uncorrelated with each other • MDCT (Modified DCT) • Nice convolution property of DFT is lost / • MDCT Basis Elements • Summary • MATLAB routines MDCT: Modified Discrete Cosine Transform • Lapped transform: 2N → N → 2N • Aliasing errors cancel out when overlapping output frames are added • Similar to DCT for energy compaction and decorrelation , • Overlapping windowed frames can avoid edge discontinuities , • Used in audio coding: MP3, WMA, AC-3, AAC, Vorbis, ATRAC For further details see Mitra: 5. DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14 MATLAB routines 3: Discrete Cosine Transform • DFT Problems dct, idct ODCT with optional zero-padding • DCT + • Basis Functions • DCT of sine wave • DCT Properties • Energy Conservation • Energy Compaction • Frame-based coding • LappedTransform + • MDCT (Modified DCT) • MDCT Basis Elements • Summary • MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 14 / 14