+ All Categories
Home > Documents > Compression one example

Compression one example

Date post: 28-Oct-2014
Category:
Upload: amr-nasr
View: 351 times
Download: 1 times
Share this document with a friend
Description:
 
Popular Tags:
31
Different compression methods one example
Transcript
Page 1: Compression one example

Different compression methods one example

Page 2: Compression one example

Agenda

LZW Example

Huffman Example

Shanon Fano Example

Arithmetic Coding Example

Advantages for Every method

Page 3: Compression one example

BILLGATES

B BILLGATESB

1B

ILLGATESIB I

1B

2I

LLGATESLB I L

1B

2I

3L

LGATESLB I L 3

1B

2I

3L

GATESGB I L 3 G

1B

2I

3L

4G

ATESAB I L 3 G A

2I

3L

4G

1B

5A

Page 4: Compression one example

TESTB I L 3 G A T

2I

3L

4G

1B

5A

6T

ESEB I L 3 G A T E

2I

3L

4G

1B

5A

6T

7E

SSB I L 3 G A T E S

2I

3L

4G

1B

5A

6T

7E

8S

Page 5: Compression one example

Advantages and Disadvantages of LZWAdvantage:

Is a lossless compression algorithm.Hence no information is lost.

One need not pass the code table between the two compression and the decompression.

Simple ,fast and good compression

Disadvantage:

What happens when the dictionary becomes too large

One approach is to throw the dictionary away when it reaches a certain size

Useful only for a large amount of test data where redundancy is high

Page 6: Compression one example

Shannon–Fano Algorithm

BILLGATES

Symbols B I L G A T E S

Probabilities 1/9 1/9 2/9 1/9 1/9 1/9 1/9 1/9

Page 7: Compression one example

B

B IL G A T E SA

BL

L BL I G A T E S

Page 8: Compression one example

For a given list of symbols, develop a corresponding list of probabilities or frequency counts so that each symbol’s relative frequency of occurrence is known.

Sort the lists of symbols according to frequency, with the most frequently occurring symbols at the left and the least common at the right.

Page 9: Compression one example

Divide the list into two parts, with the total frequency counts of the left part being as close to the total of the right as possible.

Page 10: Compression one example

BL I G A TE

S

C

Page 11: Compression one example

BL I G A TE

S

D

Page 12: Compression one example

BL I G A TE

S

E

Page 13: Compression one example

BL I G A TE

S

F

0

01

1

0

1

0

0

1

1 0 10

1

Page 14: Compression one example

Symbols

L : 00

B: 01

I : 100

G: 101

A: 1100

T: 1101

E: 1110

S: 1111

Page 15: Compression one example

2Bit(1+1)+3Bit*(1+1)+4Bit*(1+1+1+1)/9

=2.888888Bits/symbol

Page 16: Compression one example

What are the disadvantages of shanon fano coding?

What is better shannon fano and huffman coding?

huffman has a better compression rate.

Page 17: Compression one example

Huffman Algorithm

BILLGATES Symbols B I L G A T E S

Probabilities 1/9 1/9 2/9 1/9 1/9 1/9 1/9 1/9

Page 18: Compression one example

B

B ILG A T E S

A

LI G A T E SB

Page 19: Compression one example

Create a leaf node for each symbol and add it to frequency of occurrence.

While there is more than one node in the queue:

Remove the two nodes of lowest probability or frequency from the queue

Prepend 0 and 1 respectively to any code already assigned to these nodes

Create a new internal node with these two nodes as children and with probability equal to the sum of the two nodes' probabilities.

Add the new node to the queue.

The remaining node is the root node and the tree is complete.

Page 20: Compression one example

LI G A T E SB

Page 21: Compression one example

LI G A T E SB

0

1

0

1

0 1

0

1

0

1

0

1

01

Page 22: Compression one example

Symbols :

B: 00

I:01

G:100

A:101

T:1100

E:1101

L:1110

S:1111

Page 23: Compression one example

2Bit*(1+1)+3Bit*(1+1)+4Bit*(1+1+1+1)/9=2.888888 Bits/symbol

Page 24: Compression one example

Advantages and disadvantages of Huffman

This compression algorithm is mainly efficient in compressing text or program files. Images like they are often used in prepress are better handled by other compression algorithms.

Page 25: Compression one example

What are the advantages of Huffman coding?

Algorithm is easy to implement

Produce a lossless compression of images

Page 26: Compression one example

Adaptive Huffman Coding(Dynamic Huffman Coding)

Advantage: Source is encoded in real time.

Disadvantage: More chance for transmission error.

Page 27: Compression one example

Arithmetic Coding

Page 28: Compression one example
Page 29: Compression one example
Page 30: Compression one example

What are the Advantages of arithmetic coding over Huffman coding?

1.the compression ratio is higher compared to huffman coding.

2.efficiency is greater comparatively.

3.Redundancy is much reduced.

Page 31: Compression one example

THANK YOU


Recommended