![Page 1: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/1.jpg)
CS 414 - Spring 2014
CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4)
Klara Nahrstedt
Spring 2014
![Page 2: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/2.jpg)
CS 414 - Spring 2014
Administrative
MP1 is posted
![Page 3: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/3.jpg)
Today Covered Topics
Hybrid Coding: JPEG Coding
CS 414 - Spring 2014
![Page 4: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/4.jpg)
JPEG Compression (Baseline)
FDCT
SourceImage
QuantizerEntropyEncoder
TableTable
Compressedimage data
DCT-based encoding
8x8 blocks
R
B
G
CS 414 - Spring 2014
Image Preparation
Image Processing
![Page 5: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/5.jpg)
1. Image Preparation Image Preparation:
Source image consists of components (Ci) and to each component we assign YUV or RGB signals.
Image Component Preparation:Each component divided into blocks (8x8 pixels)
Image Block Preparation: Blocks (data units) need to be ordered
Interleaved or non-interleaved block ordering
![Page 6: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/6.jpg)
2. Image Processing
Shift values [0, 2P - 1] to [-2P-1, 2P-1 - 1]e.g. if (P=8), shift [0, 255] to [-127, 127]DCT requires range be centered around 0Values in 8x8 pixel blocks are spatial values and
there are 64 samples values in each block Transform values
From spatial intensity to frequency values via FDCT transformation (encoder) and
From frequency to spatial intensity values (decoder)
CS 414 - Spring 2014
![Page 7: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/7.jpg)
Equations for 2D DCT
Forward DCT:
Inverse DCT:
m
vy
n
uxyxIvCuC
nmvuF
m
y
n
x 2
)12(cos*
2
)12(cos*),()()(
2),(
1
0
1
0
m
vy
n
uxvCuCuvF
nmxyI
m
v
n
u 2
)12(cos*
2
)12(cos)()(),(
2),(
1
0
1
0
![Page 8: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/8.jpg)
Visualization of 2D DCT Basis Functions
Increasin
g frequ
ency
Increasing frequency
CS 414 - Spring 2014
![Page 9: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/9.jpg)
Coefficient Differentiation F(0,0)
includes the lowest frequency in both directions is called DC coefficient Determines fundamental color of the block
F(0,1) …. F(7,7) are called AC coefficientsTheir frequency is non-zero in one or both
directions
CS 414 - Spring 2014
![Page 10: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/10.jpg)
3. Quantization Throw out bits Consider example: 1011012 = 45 (6 bits)
We can truncate this string to 4 bits: 10112 = 11 We can truncate this string to 3 bits: 1012 = 5 (original value 40) or
1102 = 6 (original value 48) Uniform quantization is achieved by dividing DCT coefficients
by N and round the result (e.g., above we used N=4 or N=8) In JPEG – use quantization tables
Fq(u,v) = F(u,v)/Quv
Two quantization tables – one for luminance and one for two chrominance components
CS 414 - Spring 2014
![Page 11: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/11.jpg)
De facto Quantization Table
16 11 10 16 24 40 51 61
12 12 14 19 26 58 60 55
14 13 16 24 40 57 69 56
14 17 22 29 51 87 80 62
18 22 37 56 68 109 103 77
24 35 55 64 81 104 113 92
49 64 78 87 103 121 120 101
72 92 95 98 112 100 103 99
Eye becomes less sensitive
Eye b
ecomes less sen
sitive
CS 414 - Spring 2014
![Page 12: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/12.jpg)
4. Entropy Encoding
Compress sequence of quantized DC and AC coefficients from quantization step further increase compression, without loss
Separate DC from AC componentsDC components change slowly, thus will be
encoded using difference encoding
CS 414 - Spring 2014
![Page 13: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/13.jpg)
DC Encoding
DC represents average intensity of a blockencode using difference encoding scheme
Because difference tends to be near zero, can use less bits in the encodingcategorize difference into difference classessend the index of the difference class, followed
by bits representing the difference
CS 414 - Spring 2014
![Page 14: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/14.jpg)
Difference Coding applied to DC Coefficients
CS 414 - Spring 2014
![Page 15: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/15.jpg)
AC Encoding Use zig-zag ordering of coefficients
orders frequency components from low->highproduce maximal series of 0s at the endOrdering helps to apply efficiently entropy
encoding Apply Huffman coding Apply RLE on AC zero
values
CS 414 - Spring 2014
![Page 16: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/16.jpg)
Huffman Encoding
Sequence of DC difference indices and values along with RLE of AC coefficients
Apply Huffman encoding to sequence
Attach appropriate headers
Finally have the JPEG image!
CS 414 - Spring 2014
![Page 17: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/17.jpg)
Interchange Format of JPEG
CS 414 - Spring 2014
![Page 18: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/18.jpg)
Example - One Everyday Photo
2.76M
CS 414 - Spring 2014
![Page 19: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/19.jpg)
Example - One Everyday Photo
600K
CS 414 - Spring 2014
![Page 20: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/20.jpg)
Example - One Everyday Photo
350K
CS 414 - Spring 2014
![Page 21: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/21.jpg)
Example - One Everyday Photo
240K
CS 414 - Spring 2014
![Page 22: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/22.jpg)
Example - One Everyday Photo
144K
CS 414 - Spring 2014
![Page 23: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/23.jpg)
Example - One Everyday Photo
88K
CS 414 - Spring 2014
![Page 24: CS 414 - Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649f385503460f94c54f71/html5/thumbnails/24.jpg)
Discussion
What types of image content would JPEG work best (worst) for?
Is image compression solved?
What’s missing from JPEG?
CS 414 - Spring 2014