Compressing alt.sex.pictures files

Kent Paul Dolan xanthian at zorch.SF-Bay.ORG
Thu Aug 30 19:07:11 AEST 1990


peter at sugar.hackercorp.com (Peter da Silva) writes:
> xanthian at zorch.SF-Bay.ORG (Kent Paul Dolan) writes:
>> Hmmm.  Good idea.  Here's one suggestion for an experiment.  Somewhere on
>> the net, a month or two back, there was a suggestion that a good way to
>> compress realistic images was to XOR scan lines after the first with their
>> predecessor line, then LZW compress the output.
>
>I believe that XORing alternate scan-lines and run-length-encoding the result
>would do a better job. I've heard of this algorithm being pretty effective
>in past discussions. Should one do this with the image bitplane-mapped or
>pixel-mapped?

Not to suggest not running the experiment, but run length encoding (RLE)
suffers from the same problem as LZ compression: the output data of the
XOR is "speckley", with (sparse, one hopes) one bits scattered essentially
at random in a long string of zero bits.  This is not the kind of data on
which RLE does well: long strings of one pattern followed by long strings
of another.

Comparitively, (taking 8 bit pixels as an easy example), the number of byte
bit patterns with zero or one one-bit set is 9/256ths of the total patterns.
If a large part of the output bytes of the XOR fall in this set, then this
will strongly bias the "histogram" of byte frequencies, the right kind of
data to make arithmetic encoding highly effective.

To address your other issue, in realistic picture image data, I would expect
pixel level RLE to be the better choice for the original image [I have _no_
concept of what would work better on the XOR output, and that might be worth
trying in and of itself], since the count overhead is about the same but is
paid to encode less data at the bitplane level.  Runs at the bitplane level
_probably_ correspond to runs at the pixel level, except occasionally by
accident, so you encode about the same length run at either level, you just
pay more overhead at the bitplane level.

Kent, the man from xanth.
<xanthian at Zorch.SF-Bay.ORG> <xanthian at well.sf.ca.us>



More information about the Alt.sources.d mailing list