Вы находитесь на странице: 1из 4

TP4113 Kompresi Data

3-Metode Statistik Kompresi Data

METODE STATISTIK KOMPRESI DATA


TP4113

Compressiong Coding
Entropy coding, adalah teknik kompresi yang coding, menggunakan proses lossless Source coding, adalah teknik kompresi dengan coding, menggunakan proses lossy Hybrid coding, adalah teknik kompresi dengan coding, menggunakan kombinasi teknik di atas

Restyandito, S.Kom, MSIS Restyandito,


Metode Statistik Kompresi Data Restyandito - 2

Compressiong Coding
Run Length Coding

Information Theory
Dirumuskan oleh Claude Elwood Shannon yang mendefinisikan suatu kuantitas yang disebut

Entropy Encoding
Prediction Transformation

Huffman Coding Arithmetic Coding DPCM DM FFT DCT Bit Position Layered Coding Subsampling Sub-band Coding SubVector Quantization JPEG MPEG H.261 DVI RTV , DVI PLV

self-information self1 P (A)

Source Coding

i(A) = logb

= - logb P(A)

Hybrid Coding

Metode Statistik Kompresi Data

Restyandito - 3

Metode Statistik Kompresi Data

Restyandito - 4

Information Theory
Berapa banyaknya informasi yang terdapat pada peristiwa melemparkan sebuah koin?

Information Theory
i(AB) = logb
1 P (AB)

P(AB) = P(A) P(B)


1 P(A) P(B) 1 P(A)

i(AB) = logb

= logb

+ logb

1 P(B)

= i(A) + i(B)

Metode Statistik Kompresi Data

Restyandito - 5

Metode Statistik Kompresi Data

Restyandito - 6

Restyandito, S.Kom,MSIS

TP4113 Kompresi Data

3-Metode Statistik Kompresi Data

Entropy
Rata-rata dari self-information yang berasosiasi Rataselfdengan serangkaian peristiwa Jumlah bit terkecil yang dibutuhkan untuk merepresentasikan suatu simbol
H = 3 P(Ai) i(Ai) i(A) = - logb P(A)

Entropy
Hitunglah entropy dari serangkaian data berikut:

1 2 3 2 3 4 5 4 5 6 7 8 9 8 9 10

H(S) = - 3 P(Ai) logb P(Ai)

Metode Statistik Kompresi Data

Restyandito - 7

Metode Statistik Kompresi Data

Restyandito - 8

Rata-Rata
Efisiensi dari suatu metode kompresi dihitung dari rasio entropy (H) dibanding dengan rata-rata ratajumlah bit / simbol

Rata-Rata
Hitunglah rata-rata jumlah bit/simbol yang diperlukan untuk ratamengirimkan suatu file teks, jika terdapat 6 buah karakter dalam teks tersebut (M,F,Y,N,O,I) dengan frekuensi kejadian masing-masing (0,25 ; 0,25 ; 0,125 ; 0,125 ; 0,125 masing; 0,125) Pengkodean yang dihasilkan dari kompresi tersebut: M = 10 , F = 11 , Y = 010 , N = 011 , O = 000 , I = 001

Rata-rata jumlah bit/simbol = - 3Ni Pi

Metode Statistik Kompresi Data

Restyandito - 9

Metode Statistik Kompresi Data

Restyandito - 10

Shannon-Fano Coding
1.

Shannon-Fano Coding
5.

Start with a set of n symbols with known probabilities (frequencies) of occurence Arranged the symbols in descending order of their probabilities Divided the set of symbols into two subsets that have the same (or almost) probabilities Assigned the first subset a symbol 0 and the other a symbol 1
Restyandito - 11

Each subset is then recursively divided into two When a subset contains just two symbols, their codes are distinguished by adding one more bit to each Continues until no more subsets remain

2.

6.

3.

7.

4.

Metode Statistik Kompresi Data

Metode Statistik Kompresi Data

Restyandito - 12

Restyandito, S.Kom,MSIS

TP4113 Kompresi Data

3-Metode Statistik Kompresi Data

Shannon-Fano Coding
CONTOH: Tentukan simbol untuk kompresi data berikut:

Shannon-Fano Coding
LATIHAN: Tentukan simbol untuk kompresi data berikut:

Prob.
A1 0,25 A2 0,25 A3 0,125 A4 0,125 A5 0,125 A6 0,125

Langkah
0 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1

Simbol
0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 1

P(A1) = 0,25 P(A2) = 0,20 P(A3) = 0,15 P(A4) = 0,15 P(A5) = 0,10 P(A6) = 0,10 P(A7) = 0,05

Metode Statistik Kompresi Data

Restyandito - 13

Metode Statistik Kompresi Data

Restyandito - 14

Huffman Coding
1.

Huffman Coding
4.

Building a list of all the symbols in descending order of their probabilities Constructs a tree with a symbol at every leaf from the bottom up At each step the two symbols with the smallest probabilities are selected, added to the top of the partial tree, deleted from the list, and replaced with an auxiliary symbol representing both of them
Restyandito - 15

When the list is reduced to just one auxiliary symbol, the tree is complete The tree is traversed to determine the codes of the symbols

2.

5.

3.

Metode Statistik Kompresi Data

Metode Statistik Kompresi Data

Restyandito - 16

Huffman Coding
CONTOH: Tentukan simbol untuk kompresi data berikut:
A1 0,4 A2 0,2 A3 0,2 A4 0,1 A5 0,1 0 0 1 0,2 0 0 1 1 0,4 0,6 1,0 0 1 0 1 1 0 1 1 1 0 1 1 1 1

Huffman Coding
LATIHAN: Buatlah Huffman Tree untuk 8 buah simbol berikut:

P(A) = 1/30 P(B) = 1/30 P(C) = 1/30 P(D) = 2/30 P(E) = 3/30 P(F) = 5/30 P(G) = 5/30 P(H) = 12/30

Adakah solusi yang lain utk kompresi di atas ?


Metode Statistik Kompresi Data Restyandito - 17 Metode Statistik Kompresi Data Restyandito - 18

Restyandito, S.Kom,MSIS

TP4113 Kompresi Data

3-Metode Statistik Kompresi Data

Huffman Decoding
A1 A2 A3 A4 A5 3. 1 0 1 0 1 0 1 0 1. 1001100111 A4 A2 A5 A1 2.

Adaptive Huffman Coding


Transmitter and receiver start with a tree that comprises the root node and a single empty leaf node A leaf node with a zero frequency of occurnce assigned to its 0-branch 0For each subsequent character, the encoder first checks whether the character is already present in the tree
Restyandito - 20

Metode Statistik Kompresi Data

Restyandito - 19

Metode Statistik Kompresi Data

Adaptive Huffman Coding


4.

Adaptive Huffman Coding


CONTOH: Tentukan simbol untuk kompresi data berikut menggunakan adaptive Huffman coding ini_gampang

If it is present, the encoder sends the current codeword for the character in the normal way. If it is not, the the encoder sends the current codeword for the empty leaf If the character is already present in the tree, then the frequency of occurrence

5.

Metode Statistik Kompresi Data

Restyandito - 21

Metode Statistik Kompresi Data

Restyandito - 22

BUKU ACUAN
Hallsal, F, 2001, Multimedia Communications Applications, Networks, Protocols and Standards, Standards, Addison-Wesley (p. 124-134) Addison124Sayood, K, 2006, Introduction to Data Compression, Morgan Kaufmann Pub. (p. Compression, 13-80) 13Metode Statistik Kompresi Data Restyandito - 23 Salomon, D, 2000, Data Compression, The

TERIMAKASIH

Restyandito, S.Kom,MSIS

Вам также может понравиться