metode kompresi lz78

20
Metode Kompresi LZ78 Adi Suheryadi Pasca Sarjana Teknik Informatika Universitas Telkom

Upload: adi-suheryadi

Post on 29-Jun-2015

212 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Metode kompresi lz78

Metode Kompresi LZ78

Adi SuheryadiPasca Sarjana Teknik Informatika

Universitas Telkom

Page 2: Metode kompresi lz78

Ide Kompresi LZ78 Karakteristik Encode Decode Rasio Kompresi Kesimpulan

Poin Persentasi

Page 3: Metode kompresi lz78

Menggunakan metode kamus (dictionary) Kamus merupakan daftar yang tak terbatas menggunakan token (i,s)

o i : index/posisi pada dictionaryo s : simbol input

Ide Kompresi LZ78

Page 4: Metode kompresi lz78

Bersifat lossless dictionary berupa daftar yg tak terbatas dari

frasa yang dilihat sebelumnya Mempunyai kemampuan menyimpan entries

secara permanen Mengembangkan entitas selama proses

encoding

Karakteristik

Page 5: Metode kompresi lz78

Encode LZ78

Page 6: Metode kompresi lz78

Algoritma Encode

Page 7: Metode kompresi lz78

Psudocodekamus kosong; prefix kosong; indexkamus 1;while(masih ada karakter){

kar next karakter; if(kar+ karakter ada di kamus) prefix prefix++ ; else { if(Prefix tidak ada) Codeindex 0 ; else Codeindex index kamus; Output: (Codeindex, kar) ;

insertInDictionary( ( indexkamus, Prefix + kar) ); Indexkamus++ ; Prefix kosong; }

}if(Prefix tidak kosong){

Codeindex indexkamus; Output: (CodeIndex , ) ;}

Page 8: Metode kompresi lz78

string ABBCBCABABCAABCAAB

Contoh Encode

Encode : (0,A)(0,B)(2,C)(3,A)(2,A)(4,A)(6,B)

Page 9: Metode kompresi lz78

string input : AAAAAAAAA

Contoh Encode (2)

Encode : (0,A)(1,A)(2,A)(3, )

Page 10: Metode kompresi lz78

Number of Bit Transmisi

Merubah hasil encode menjadi kode biner

Buat index terlebih dahulu: Compressed string( codewords): (i1, s1) (i2, s2) ... (in, sn)

Codeword index 1 2 ... n Konversi codeword ke biner dengan melihat tabel,

dimana: Melihat index untuk menghitung bit Melihat codeindex untuk menetukan biner

Page 11: Metode kompresi lz78

Contoh Number of Bit Transmisi

Data : ABBCBCABABCAABCAAB

Number of bits = Total number of characters * 8

= 18 * 8

= 144 bits

Codewords: (0, A) (0, B) (2, C) (3, A) (2, A) (4, A) (6, B)

Codeword index 1 2 3 4 5 6 7

Page 12: Metode kompresi lz78

Contoh Number of Bit Transmisi (2)

Codeword (0, A) (0, B) (2, C) (3, A) (2, A) (4, A) (6, B)index 1 2 3 4 5 6 7Bits: (1 + 8) + (1 + 8) + (2 + 8) + (2 + 8) + (3 + 8) + (3 + 8) + (3 + 8) = 71 bits

Hasil : 0A0B10C11A010A100A110B

Page 13: Metode kompresi lz78

Decode LZ78

Page 14: Metode kompresi lz78

Algoritma Decode

Page 15: Metode kompresi lz78

Psudocode

kamus kosong ; kamusIndex 1 ;while(masih ada token){

CodeWord next CodeWord;kar karakter cocokan dari kamus ;if(CodeWord = = 0)

String kosongkan;else String string index CodeWord di kamus ;Output: String + kar;

kamusIndex++;}

Page 16: Metode kompresi lz78

Contoh DecodeData encode : (0, A) (0, B) (2, C) (3, A) (2, A) (4, A) (6, B)

Hasil decode : ABBCBCABABCAABCAAB

Page 17: Metode kompresi lz78

Number of Bit Transmisi

Ubah biner menjadi codeword ASCII Lakukan seperti melakukan decode

Pesan : 0A 0B 10C 11A 010A 100A 110B

Menjadi : (0,A) (0,B) (2,C) (3,A) (2,A) (4,A) (6,B)

Page 18: Metode kompresi lz78

Rumusan Rasio Kompersi:

Data : ABBCBCABABCAABCAAB 100%-(71/144 x 100)= 50,7 %

Rasio Kompresi

Page 19: Metode kompresi lz78

Perbaikan LZ77 dan LZSS LZ78 mempunyai

kemampuan menyimpan entries secara permanen dan mengembangkan selama proses encoding

LZ78 berbeda dg LZ77 dan LZSS hanya menggunakan pasangan (i,s)o i : index/posisi pada dictionaryo s : simbol input

Jika pasangan (0,s) muncul indikasi simbol s tdk ada dlm dictionary dan harus ditambahkan

Kesimpulan

Page 20: Metode kompresi lz78

1. Persentasi : 082ICS202_17_LZ_Compression.ppt2. Persentasi : Commpression Algorithm LZ-Varian.ppt3. http://en.wikipedia.org/wiki/LZ77_and_LZ78

Referensi