Top Banner
Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007
19

Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Lossless Compression in Multimedia Data Representation

Hao JiangComputer Science Department

Sept. 20, 2007

Page 2: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Arithmetic Coding

Arithmetic coding represents a input symbol string as a small interval in [0, 1)

The size of the interval equals P(sk1) P(sk2) P(sk3) … P(skn)

We can then represent the interval with a binary code.

0 1

An half open interval [0.3, 0.34) in [0, 1)

Page 3: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

An example

A source output symbols {A, B, C, D, E, F, $}. $ is the termination symbol. Their probabilities are as follows.

P(A) = 0.2P(B) = 0.1P(C) = 0.2P(D) = 0.05P(E) = 0.3P(F) = 0.05P($) = 0.1

1

0

0.20.3

0.50.55

0.850.9

Page 4: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Arithmetic Coding Example

Now we have an input string C A E $

1

0

0.20.3

0.50.55

0.850.9

A

B

C

D

E

F

$0.5

0.3

0.34

0.334

0.322

0.3328

0.333 = 0.0101010101 Code: 0101010101

0.34

0.3

0.322

0.334

Page 5: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Compress Multimedia Data Losslessly

Model the media (audio, image, graphics data, or video as) as a source that generates symbols.

The naïve way of choosing symbols:– Pixels for images and videos– Samples for audios– Characters for text messages

Apply the lossless compression methods to the string of symbols.

Page 6: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Lossless Grayscale Image Compression

In lossless image compression, a prediction method is usually applied when generating symbols.

1 2 4 10 128 205 210 201 195 120 50 30 400

1 1 2 6 118 77 5 -9 -6 -75 -70 -20 100

1 2 4 10 128 205 210 201 195 120 50 30 40

+ + … +

+-

+-

+-…+

-

Page 7: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Example

A Grayscale Image

Page 8: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

The Differential Image

Page 9: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Entropy H = 6.6483 Entropy H = 4.4314

GrayImage (bytes) Difference Image (bytes)Huffman coding: 192163 129397 Arithmetic coding: 190212 127220LZ77 coding (gzip): 151685 128252 LZW (compress): 158573 136899

Original image size: 227878 bytes

Page 10: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Lossless JPEG

Prediction options in lossless JPEG

C B

A X

X ~ A X ~ B X ~ CX ~ A + B – CX ~ A + (B – C)/2X ~ B + (A – C)/2X ~ (A + B)/2

Page 11: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

PNG (Portable Network Graphics)

PNG is a lossless image compressing method based on LZ77.

PNG supports three main image types: true color, grayscale and palette-based ("8-bit").

PNG supports alpha channel

Page 12: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

PNG (cont)

PNG also supports interlaced coding and decoding

1 6 4 6 2 6 4 67 7 7 7 7 7 7 75 6 5 6 5 6 5 67 7 7 7 7 7 7 73 6 4 6 3 6 4 67 7 7 7 7 7 7 75 6 5 6 5 6 5 67 7 7 7 7 7 7 7

The scanning pattern in a 8x8 block. The whole image isPartitioned into 8x8 blocks and scanned based on the patternIn each block.

PNG website

Page 13: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

GIF (Graphics Interchange Format)

GIF was devised by UNISYS and Compuserve.

GIF is based on LZW lossless compression.

GIF supports 8bit (256) color images only. Each image can have its own color table.

It supports transparency layer and simple animation functions.

It also supports interlaced coding and decoding.

Page 14: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

GIF (cont)

Row Pass0 11 4 2 33 44 25 46 37 48 19 410 3

GIF interlacedScanning order

Page 15: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Binary Image Compression

Run length Coding

We can encode the image as: 2b 8w 2b 4b 8w

In fact, we do not have to save the black or white information.New code is like: 0 2 8 2 0 4 8

Page 16: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Binary Image Compression

More scanning patterns?

We can compress the run-length symbols using Huffman coding, arithmetic coding, or dictionary based methods.

Binary image compression is widely used in applications such as Facsimile.

JBIG is a standard for binary image compression.

Page 17: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Audio Compression

Audio can also be compressed in a similar way to image data.

For lossless audio compression, prediction is usually applied first.– Simple prediction.– Adaptive prediction.

Stereo decorrelation.

Entropy coding.

Page 18: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

Examples

FLAC (free lossless audio codec)– Polynomial fitting prediction or linear prediction.– Rice coding.

MPEG4-ALS– Lossless audio coding standard in MPEG4.– Adaptive Linear Prediction.– Supports up to 65535 channels.– Fast random access.– Rice coding.

Apple lossless audio coding (ALAC)

Page 19: Lossless Compression in Multimedia Data Representation Hao Jiang Computer Science Department Sept. 20, 2007.

MPEG-4 ALS System Diagram