ExampleHere is the beginning of Dr. Seuss's Green eggs and ham, with character numbers at the beginning of lines for convenience. 0: I am Sam 9: 10: Sam I am 19: 20: That Sam-I-am! 35: That Sam-I-am! 50: I do not like 64: that Sam-I-am! 79: 80: Do you like green eggs and ham? 112: 113: I do not like them, Sam-I-am. 143: I do not like green eggs and ham. This text takes 177 bytes in uncompressed form. Assuming a break even point of 2 bytes (and thus 2 byte pointer/offset pairs), and one byte newlines, this text compressed with LZSS becomes 98 bytes long: 0: I am Sam 9: 10: (6,3) (0,4) 16: 17: That (6,3)-I-am! 31: (20,15)I do not like 47: t(21,14)Do you(58,5) green eggs and ham? 79: 80: (50,13) them,(24,9). 92: (50,13)(93,18). Note: this does not include a few bytes (3-4) of flags indicating whether the next chunk of text is a pointer or a literal. Adding it, the text becomes just over 100 bytes long, which is much shorter than the original 177 bytes. ImplementationsThe Allegro library can encode and decode an LZSS format,[1] and the Game Boy Advance BIOS can decode a slightly different LZSS format.[2] References
See also
External links
| | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||