BBS: Inland Empire Archive Date: 10-04-92 (09:01) Number: 347 From: GLENN KINEN Refer#: NONE To: BOB EDWARDS Recvd: NO Subj: Re: Data compression Conf: (2) Quik_Bas
> -> This was all off the top of my head, but you should
> ->hopefully get the general idea of it.
> Rich, where does RLE fit in?
I know I'm not Rich (Yep, I'm quite poor <g>), but here is a brief demo
of RLE-Run Length Encoding.
Pick a character from the ascii set which is not in the file. (I'll
pick '*')
Now say you wanted to compress:
aaaaBBBBBBBBccOOOOOOO;;;;;;opp
You find all letters which are repeated more than 3 times in a row (more
on this later). Next, you put '*' into the compressed file, as the
initializer, or for decompressor info. (The decompressor uses this so it
would know the next 2 bytes tell it what to do). Then you add the
character which is repeated more than 3 times (not 3 more than 3),
*a; then you add total number of times repeated; *a4. See you compressed
4 bytes in 3 bytes, you can't use this on 3 or more bytes becaus eyou
will get no compression, or actully make the file LARGER.
So the compressed version of the string I put above would be:
*a4*B8cc*O7*;6opp
31 was the original size - 17 the compressed. Any questions? ;-D
-Glenn
* SLMR 2.1a * Computers All Wait at the Same Speed.
--- Maximus 2.01wb
* Origin: Miami Amateur Computer Club BBS HST/V32b/V42b (1:135/110)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET