Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Review
METODE ARITMETIKA
LATIHAN: Serangkaian karakter A = { a1 , a2 , a3 } memiliki probabilitas P(a1)=0,95 P(a2)=0,02 P(a3)=0,03 Dapatkah diperoleh hasil kompresi yang maksimal?
KOMPRESI DATA
TP4113
Arithmetic Coding
Huffman codes have to be an integral number of bits long, while the entropy value of a symbol is almost always a faction number, theoretical possible compressed message cannot be achieved.
For example, if a statistical method assign 90% probability to a given character, the optimal code size would be 0.15 bits.
Metode Aritmetika Kompresi Data Restyandito - 3
Arithmetic Coding
Arithmetic coding bypasses the idea of replacing an input symbol with a specific code. It replaces a stream of input symbols with a single floating-point output number. floatingArithmetic coding is especially useful when dealing with sources with small alphabets, such as binary sources, and alphabets with highly skewed probabilities.
Metode Aritmetika Kompresi Data Restyandito - 4
Arithmetic Coding
Karakter
^(spasi) A B E G I L S T
Arithmetic Coding
0.0 0.1 0.2 ^ A 0.2 0.3 B E 0.4 0.5 G I 0.6 L 0.8 S 0.9 T 1.0
0.258
Probabilitas
1/10 1/10 1/10 1/10 1/10 1/10 2/10 1/10 1/10
Range
0,00 < r < 0,10 0,11 < r < 0,20 0,21 < r < 0,30 0,31 < r < 0,40 0,41 < r < 0,50 0,51 < r < 0,60 0,61 < r < 0,80 0,81 < r < 0,90 0,91 < r < 1,00
0.25
0.256
0.25724
0.2572
0.25 I 0.26
0.256
0.2572
L
0.2576
0.3
0.26
0.258
0.2576
Restyandito - 6
Restyandito, S.Kom,MSIS
Arithmetic Coding
Karakter
B I L L ^(spasi) G A T E S
Metode Aritmetika Kompresi Data
Arithmetic Coding
Hasil akhir, penamaan tag, 0,2572167752 merupakan kode unik yang berisi informasi BILL GATES GATES Berapapun nilai antara 0,2572167752 hingga 0,2572167756 dapat dijadikan tag untuk meng-enkodekan pesan, dan dapat mengdi de-kodekan secara unik de-
Batas Bawah
0.2 0.25 0.256 0.2572 0.25720 0.257216 0.2572164 0.25721676 0.257216772 0.2572167752
Batas Atas
0.3 0.26 0.258 0.2576 0.25724 0.257220 0.2572168 0.2572168 0.257216776 0.2572167756
Restyandito - 7
Restyandito - 8
Arithmetic Coding
0.00
Arithmetic Coding
0.00 0.656
0.7712 0.7712
Simbol 1 2 3
0.7712
0.773504
0.77408
Arithmetic Coding
Hasil Encoding:
Karakter 1 3 2 1 Batas Bawah 0.0 0.0 0.656 0.7712 0.7712 Batas Atas 1.0 0.8 0.800 0.77408 0.773504
0.0 0.1
Arithmetic Decoding
^ A 0.2 B 0.3 E G 0.5 I 0.6
0.4 0.2
^ A B E G I
0.25
0.256
^ A B E G I
^ A B E G
0.25720 0.25724
^ A B E G I L S
0.25 0.26
0.256
0.2572 0.2576
I L S
L
0.8 0.9
L S
0.3 T
Tx (1312) =
0.258
L S T
T 1.0
0.258 T
0.2576 T
Restyandito - 12
0,2572167752
Restyandito, S.Kom,MSIS
Algoritma Encoding
LATIHAN: Kodekanlah UKDW! Menggunakan arithmetic coding, jika diketahui probabilitas untuk masingmasingmasing karakter sbb: k = 0,3 ; d = 0,3 ; w = 0,2 ; u = 0,1 ; ! = 0,1 Low = 0.0 ; high =1.0 ; while not EOF do range = high - low ; read(c) ; high = low + rangehigh_range(c) ; range low = low + rangelow_range(c) ; range enddo output(low);
Restyandito - 13
Restyandito - 14
Algoritma Decoding
r = input_code repeat search c such that r falls in its range ; output(c) ; r = r - low_range(c) ; r = r/(high_range(c) - low_range(c)); until r equal 0
Solusi:
Synchronized rescaling and incremental encoding. encoding.
Metode Aritmetika Kompresi Data Restyandito - 16
Restyandito - 15
0.3568 0.3568
0.312
0.6784 0.3392
E2 ( x) = 2( x 0.5)
Restyandito - 17
0.54112 0.504256
Restyandito - 18
Restyandito, S.Kom,MSIS
bts.bawah 0 0 0,656 0,312 0,5424 0,0848 0,1696 0,3392 0,6784 0,3568 0,3568
bts.atas 1 0,8 0,8 0,6 0,54812 0,09632 0,19264 0,38528 0,77056 0,54112 0,50426
kode
Proses decoding pada bit stream dimulai dengan 1100011 1100011 jumlah bits yg diperlukan untuk membuat simbol unik bits. log 2 0.02 = 6 bits.
binary 110001 decimal 0,765625 0,9525 100011 0,546875 0,815 000110 001100 011000 110000 100000 0,5 0,777 0~0.8 0.8~0.82 range asli 0~0.8 0.82~1
1 1 0 0 0 1 1
Restyandito - 19
c 1 3 2
range baru (0.76525-0)/0.8=0.9525 0.656~0.8 0.312~0.6 0.5424~0.54816 0.0848~0.09632 0.1696~0.19264 0.3392~0.38528 0.6784~0.77056 rescale (0.546875-0.312)/(0.6-0.312)=0.815 rescale rescale rescale rescale rescale
0.3568~0.54112 (0.5-0.3568)/(0.54112-0.3568)=0.777
1
Restyandito - 20
BUKU ACUAN
Hallsal, F, 2001, Multimedia Communications Addison-Wesley (p. 134-136) Addison134-
Sayood, K, 2006, Introduction to Data Compression, Compression, Morgan Kaufmann Pub. (p. 81-113) 81Salomon, D, 2000, Data Compression, The Complete Reference, 2nd edition, Springer (p. 101-15) edition, 101-
TERIMAKASIH
Restyandito - 21
Restyandito, S.Kom,MSIS