Title: Multimedia Data Compression
1Multimedia Data Compression
- Mee Young Sung
- University of Incheon
- Department of Computer Science Engineering
- mysung_at_incheon.ac.kr
2- Lossless Compression Algorithms
- Introduction
- Basics of Information Theory
- Run-Length Coding
- Variable-Length Coding(VLC)
- Shannon-Fano Algorithm
- Huffman Coding
- Adaptive Huffman Coding
- Dictionary-Based Coding
- Arithmetic Coding
- Lossless Image Compression
- Differential Coding of Images
- Differential Coding of Images
- Lossless JPEG
3- Lossy Compression Algorithms
- Introduction
- Distortion Measures
- The Rate-Distortion Theory
- Quantization
- Uniform Scalar Qunantization
- Nonuniform Saclar Qunantization
- Vector Qunantization
- Quantization
- Discrete Cosine Transform(DCT)
- Karhunen-Loève Transform
- Wavelet-Based Coding
- Introduction
- Continuous Wavelet Transform
- Discrete Wavelet Transform
- Wavelet Packets
- Embedded Zerotree of Wavelet Coefficients
- The Zerotree Data Structure
- Successive Approximation Quantization
4- Image Compression Standard
- The JPEG Standard
- Main Steps in JPEG Image Compression
- JPEG Modes
- A Glance at the JPEG Bitstream
- The JPEG2000 Standard
- Main Steps of JPEG2000 Image Compression
- Adapting EBCOT to JPEG2000
- Region-of-Interest Coding
- Comparison of JPEG and JPEG2000 Performance
- The JPEG-LS Standard
- Prediction
- Context Determination
- Residual Coding
- Near-Lossless Mode
- Bilevel Image Compression Standard
- The JBIG Standard
- The JBIG2 Standard
5- Basic Video Compression Techniques
- Introduction to Video Compression
- Video Compression Based on Motion Compensation
- Search for Motion Vectors
- Sequential Search
- 2D Logarithmic Search
- Hierarchical Search
- H.261
- Intra-Frame (I-Frame) Coding
- Inter-Frame (P-Frame) Predictive Coding
- Quantization in H.261
- H.261 Encoder and Decoder
- A Glance at the H.261 Video Bitstream Syntax
- H.263
- Motion Compensation in H.263
- Optional H.263 Coding Modes
- H.263 and H.263
6- MPEG Video Coding I MPEG-1 and 2
- Overview
- MPEG-1
- Motion Compensation in MPEG-1
- Other Major Differences form H.261
- MPEG-1 Video Bitstream
- MEPG-2
- Supporting Interlaced Video
- MPEG-2 Scalabilities
- Other Major Differences form MPEG-1
7- MPEG Video Coding II MPEG-4, 7, and Beyond
- Overview of MPEG-4
- Object-Based Visual Coding in MPEG-4
- VOP-Based Coding vs. Frame-Based Coding
- Motion Compensation
- Texture Coding
- Shape Coding
- Static Texture Coding
- Sprite Coding
- Global Motion Compensation
- Synthetic Object Coding in MPEG-4
- 2D Mesh Object Coding
- 3D Model-based Coding
- MPEG-4 Object Types, Profiles and Levels
- MPEG-4 Part10/H.264
- Core Features
- Baseline Profile Features
- Main Profile Features
- Extended Profile Features
8- Basic Audio Compression Techniques
- ADPCM in Speech Coding
- ADPCM
- G.726 ADPCM
- Vocoders
- Phase Insensitivity
- Channel Vocoder
- Formant Vocoder
- Linear Predictive Coding
- CELP
- Hybrid Excitation Vocoders
9- MPEG Audio Compression
- Psychoacoustics
- Equal-Loudness Relations
- Frequency Masking
- Temporal Masking
- MPEG Audio
- MPEG Layers
- MPEG Audio Strategy
- MPEG Audio Compression Algorithm
- MPEG-2 AAC(Advanced Audio Coding)
- MPEG-4 Audio
- Other Commercial Audio Codecs
- The Future MPEG-7 and MPEG-21
10Run-Length Coding
- ???
- 00 ... 00100 ... 001100 ... 00100
... 001100 ... 00 89 ?? -                   ?     Â
?                      - 0?????? 14      9       20      Â
30        9 -                                   0????          Â
        0???? -
- ???? ???? ??
- Run length(??) 1110 1001 0000 1111 0101 1111 1111
0000 0000 1001 40?? - Run length(??)Â 14Â Â Â 9Â Â 0Â Â Â 15Â Â Â 5Â Â 15Â Â
15Â Â Â 0Â Â Â 0Â Â 9Â Â Â Â
11Huffman Coding
- Encoding for Huffman Algorithm
- A bottom-up approach
- 1. Initialization Put all nodes in an OPEN list,
keep it sorted at all times (e.g., ABCDE). - 2. Repeat until the OPEN list has only one node
left - (a) From OPEN pick two nodes having the lowest
frequencies/probabilities, create a parent node
of them. (b) Assign the sum of the children's
frequencies/probabilities to the parent node and
insert it into OPEN. (c) Assign code 0, 1 to the
two branches of the tree, and delete the children
from OPEN. -
Symbol Count log2(1/pi) Code Subtotal ( of bits)
A 15 1.38 0 15
B 7 2.48 100 21
C 6 2.70 101 18
D 6 2.70 110 18
E 5 2.96 111 15
12Huffman Coding
- ?? ??? ??? ?? ???? ??? ???? ??? ????, ?? ??? ??
?????? ?? ?? - ?? ?? ???? ???? ? ??? ?? ?? ???? ??, ???? ???
???? ?? ???? ??? ?? ?? ???, ??? ???? ??? ?? ??
??? ???? ??? ???? ???? ?? - ???? ???? ??? ????? ???? ?? ?? ?? ???? ??? ???
??? ? ?? - ?? ?? ??? ??? ??
13Fourrier Transform
14Reinforcement and Interference
15Complex Wave Fundamental and Spectral Frequencies
16Line Spectrum
17Fundamental Frequency in a Line Spectrum
18DCT
- Discrete Cosine Transform (DCT)
- Inverse Discrete Cosine Transform (IDCT)
19Example 1
1D DCT
20Example 2
21Example 3
22Example 4
23Example of 1D IDCT
24(No Transcript)
25(No Transcript)
26(No Transcript)
27(No Transcript)
28(No Transcript)
29JPEG
- Joint Photographic Expert Group
- Motivation
- The compression ratio of lossless methods (e.g.,
Huffman, Arithmetic, LZW) is not high enough for
image and video compression, especially when the
distribution of pixel values is relatively flat. - JPEG uses transform coding, it is largely based
on the following observations - Observation 1 A large majority of useful image
contents change relatively slowly across images,
i.e., it is unusual for intensity values to alter
up and down several times in a small area, for
example, within an 8 x 8 image block. Translate
this into the spatial frequency domain, it says
that, generally, lower spatial frequency
components contain more information than the high
frequency components which often correspond to
less useful details and noises. - Observation 2 Pshchophysical experiments suggest
that humans are more receptive to loss of higher
spatial frequency components than loss of lower
frequency components.
30JPEG (DCT)
- Discrete Cosine Transform (DCT)
- Inverse Discrete Cosine Transform (IDCT)
31JPEG
32JPEG
- Major Steps
- DCT (Discrete Cosine Transformation)
- Quantization
- Zigzag Scan
- DPCM on DC component
- RLE on AC Components
- Entropy Coding
33JPEG (DCT)
- The 64 (8 x 8) DCT basis functions
34JPEG (DCT)
- Computing the DCT
- Factoring reduces problem to a series of 1D DCTs
35JPEG (Quantization)
- F'u, v round ( Fu, v / qu, v ). Why? --
To reduce number of bits per sample - Example 101101 45 (6 bits). qu, v 4 --gt
Truncate to 4 bits 1011 11. - Quantization error is the main source of the
Lossy Compression. - Uniform Quantization
- Each Fu,v is divided by the same constant N.
- Non-uniform Quantization -- Quantization Tables
- Eye is most sensitive to low frequencies (upper
left corner), less sensitive to high frequencies
(lower right corner) - The numbers in the above quantization tables can
be scaled up (or down) to adjust the so called
quality factor. - Custom quantization tables can also be put in
image/scan header.
36JPEG (Quantization)
- The Luminance Quantization Table q(u, v)
The Chrominance Quantization Table q(u, v) -
Eye Sensitivity
37JPEG (Zig-Zag Scan)
- Zig-zag Scan
- Why? -- to group low frequency coefficients in
top of vector. - Maps 8 x 8 to a 1 x 64 vector
38JPEG (DPCM on DC component )
- DPCM (Differential Pulse Code Modulation)
- DC component is large and varied, but often close
to previous value. - Encode the difference from previous 8 x 8 blocks
DPCM - DPCM ???/??? ?
- ??? ????? ????? ????? ?? ???, ?? ?? ??? ????? ?
??? ??? ???? ????? ??
(a)??? ??? ??? 14 19 25 36 43 55 66 52 48 34
(b) DPCM??? ??? 14 5 6 11 7 12 11 -14 4 -14
(c)??? ??? 14 19 25 36 43 55 66 52 48 34
39JPEG (RLE on AC components )
- RLE (Run Length Encode)
- 1 x 64 vector has lots of zeros in it
- Keeps skip and value, where skip is the number of
zeros and value is the next non-zero component. - Send (0,0) as end-of-block sentinel value
- Zig-Zag scanned ACs
40JPEG (Entropy Coding )
- Categorize DC values into SIZE (number of bits
needed to represent) and actual bits. - Example if DC value is 4, 3 bits are needed.
- Send off SIZE as Huffman symbol, followed by
actual 3 bits. - For AC components two symbols are used Symbol_1
(skip, SIZE), Symbol_2 actual bits. Symbol_1
(skip, SIZE) is encoded using the Huffman coding,
Symbol_2 is not encoded. - Huffman Tables can be custom (sent in header) or
default.
Size Amplitude 0 0 1 -1,1 2 -3,-2,2,3 3
-7,-6,-5,-4,4,5,6,7
41JPEG Example
42JPEG Example
43H. 261
- Developed by CCITT (Consultative Committee for
International Telephone and Telegraph) in
1988-1990 - Designed for videoconferencing, video-telephone
applications over ISDN telephone lines. Bit-rate
is p x 64 Kb/sec, where p ranges from 1 to 30. - Frame types are CCIR 601 CIF (352 x 288) and QCIF
(176 x 144) images with 420 subsampling. - Two frame types Intra-frames (I-frames) and
Inter-frames (P-frames) I-frame provides an
accessing point, it uses basically JPEG. - P-frames use "pseudo-differences" from previous
frame ("predicted"), so frames depend on each
other.
44Subsampling
45H.261(Intra-frame Coding)
- Macroblocks are 16 x 16 pixel areas on Y plane of
original image. A macroblock usually consists of
4 Y blocks, 1 Cr block, and 1 Cb block. - Quantization is by constant value for all DCT
coefficients (i.e., no quantization table as in
JPEG).
46H.261(Inter-frame (P-frame) Coding )
- Previous image is called reference image, the
image to encode is called target image. - Points to emphasize
- The difference image (not the target image
itself) is encoded. - Need to use the decoded image as reference image,
not the original. - We're using "Mean Absolute Error" (MAE) to decide
best block. Can also use "Mean Squared Error"
(MSE) sum(EE)/N
47H.263
- H. 263 is a new improved standard for low
bit-rate video, adopted in March 1996. As H.
261, it uses the transform coding for
intra-frames and predictive coding for
inter-frames. - Advanced Options
- Half-pixel precision in motion compensation
- Unrestricted motion vectors
- Syntax-based arithmetic coding
- Advanced prediction and PB-frames
- In addition to CIF and QCIF, H. 263 could also
support SQCIF, 4CIF, and 16CIF. The following is
a summary of video formats supported by H. 261
and H. 263
48MPEG
- What is MPEG ?
- "Moving Picture Coding Experts Group",
established in 1988 to create standard for
delivery of video and audio. - MPEG-1 Target VHS quality on a CD-ROM or Video
CD (VCD) (352 x 240 CD audio _at_ 1.5 Mbits/sec) - Standard had three parts Video, Audio, and
System (control interleaving of streams) - MPEG Video
- Problem some macroblocks need information not in
the previous reference frame. Example The
darkened macroblock in Current frame does not
have a good match from the Previous frame, but it
will find a good match in the Next frame.
49MPEG
- MPEG solution add third frame type
bidirectional frame, or B-frame In B-frames,
search for matching macroblocks in both past and
future frames. - Typical pattern is IBBPBBPBB IBBPBBPBB IBBPBBPBB
Actual pattern is up to encoder, and need not be
regular
50?? ???
- http//www.cs.sfu.ca/mmbook/demos.htm
- http//www.cs.sfu.ca/CC/365/li/material/misc/demos
.html