CPSC 461: Copyright (C) 2003 Katrin Becker 1998-2002 Last Modified May 28, 2003 05:06 PM
LZ77 (Sliding Window)
 
"im living in my lego house im sitting in my lego chair im watching my lego tv in my lego underwear"
Token Phrase Token Phrase
0,0,i   31,1,t {it}
0,0,m   1,1,i {ti}
0,0,_   28,14,c {ing in my lego c}
0,0,1   29,1,a {ha}
4,1,v {iv} 52,1,r {ir}
6,1,n {in} 28,4,w {_im_w}
0,0,g   8,1,t {at}
7,1,i {_i} 12,2,i {chi}
4,1,_ {n_} 56,3,m {ng_m}
12,1,y {my} 54,7,t {y lego t}
12,1,e {le} 0,0,v  
10,1,o {go} 68,12,u {_in my lego u}
18,1,h {_h} 83,1,d {nd}
3,1,u {ou} 75,1,r {er}
0,0,s   36,1,e {we}
8,1,_ {e_} 46,1,r {ar}
27,3,s {im_s}    
 
Let's say we have:

100 byte search buffer; 20 byte look-ahead

so we need 7 bits offset; 5 bits length; 7 bits char

original text is 98 bytes (784 bits)

33 tokens @ 19 bits = 692 unpacked / 627 packed

compress further? can drop 2nd ‘0’ in 0,0

- now 636 unpacked / 592 packed = 0.75 compression ratio



Back to TopCPSC 461: Copyright (C) 2003 Katrin Becker 1998-2002 Last Modified May 28, 2003 05:06 PM