Re: A86: Image Compression


[Prev][Next][Index][Thread]

Re: A86: Image Compression



Trent Lillehaugen wrote:
> 
> Nicholas C Anderson wrote:
> 
> > Have you tried Huffman code compression yet???
> > Just a thought! :-)
> 
>   I know there are others out there, but I wanted to try to make one
> myself :) that's the fun part.  I'll look at the Huffman one and see if
> i can't even improve on that.  Mine is a simple RLE type deal, I don't
> know what kind of compression Huffman uses.

I'm using Huffman compression in Sqrxz. The levels are compressed with
Huffman, though only the 85 version at the moment. I got some weird
problems when converting it to the 86 for some strange reason.

Huffman compression checks how frequently used letters are, and then
they're
stored in a shorter bit form. For example:

ABBAABBCB     Let Freq  Code
              A     3    11
              B     5    0
              C     1    10

And the sentence above would be encoded as

11001111 00100

Of course you need to store the tree information as well, which takes
(no dif chars)+(no dif chars-1)/8 bytes

Huffman compression beats RLE when the pictures gets a bit more
complicated.
RLE is only somewhat good when the picture is very plain, and definately
not
good to compress small pictures.

You should try LZW compression if you want an overall good compression
scheme.
It's much more complicated though, and a disadvantage is that the
algorithm
requires quite much free memory (although that shouldn't be much of a
problem
on the 86). LZW is used in all GIF, ZIP and all other known algoritms
(although
those are modified). I made a LZW decompresser for ZShell a couple of
months
back, and it worked quite well. It crashes sometimes after the picture
had
been extracted though :-/ Haven't worked on it since then, because I
don't
feel any need for it at the moment.

-- 
Jimmy Mårdell                "The nice thing about standards is that 
mailto:mja@algonet.se         there are so many of them to choose from."
http://www.algonet.se/~mja    
IRC: Yarin                   "Sanity? I'm sure I have it on tape
somewhere!"


References: