> Anyone have the spec for the new PalmOS 4.0 image compression algorithm
> called "PackBits"?

        Yet another technology they didn't invent. It's been around for years
and years in TIFF files (as you probably know, from fax machines at Xerox).

        Packbits compression seeks repeated data values. Packbits is
considered an RLE (run-length encoding) compression scheme because it looks
for "runs" or repeated values, and tallies their number, or "length."  While
its name implies that runs of bits are "packed" together, it is actually runs
of bytes. It is very similar to the Macintosh Packbits compression used by
MacPaint, except the Packbits compression used for a TIFF will allow the
dimensions of the image to be variable.  It works by reducing repeated strings
of the same characters into two components: the "run count"  and the "run
value." The count and value are stored in one byte each.  Each two-byte
grouping is referred to as an RLE packet. It is not a good compression scheme
for images with large color ranges, as these will not tend to have many runs
of the same color.

        Section 9 here:

        
http://www.google.com/search?q=cache:aUAwG8cek6I:partners.adobe.com/asn/developer/pdfs/tn/TIFF6.pdf+%2B%22tiff%22+%2B%22specification%22+%2B%22packbits%22&hl=en

        and..

        http://www.dspguide.com/datacomp.htm

        Each byte (eight bits) from the input file is replaced by nine bits in
        the compressed file. The added ninth bit is interpreted as the sign of
        the number.  That is, each character read from the input file is
        between 0 to 255, while each character written to the encoded file is
        between -255 and 255. To understand how this is used, consider the
        input file: 1,2,3,4,2,2,2,2,4, and the compressed file generated by
        the PackBits algorithm: 1,2,3,4,2,-3,4. The compression program simply
        transfers each number from the input file to the compressed file, with
        the exception of the run:  2,2,2,2. This is represented in the
        compressed file by the two numbers: 2,-3. The first number ("2")
        indicates what character the run consists of. The second number ("-3")
        indicates the number of characters in the run, found by taking the
        absolute value and adding one. For instance, 4,-2 means 4,4,4; 21,-4
        means 21,21,21,21,21, etc.

        An inconvenience with PackBits is that the nine bits must be
        reformatted into the standard eight bit bytes used in computer storage
        and transmission. A useful modification to this scheme can be made
        when the input is restricted to be ASCII text. As shown in Table 27-2,
        each ASCII character is usually stored as a full byte (eight bits),
        but really only uses seven of the bits to identify the character. In
        other words, the values 127 through 255 are not defined with any
        standardized meaning, and do not need to be stored or transmitted.
        This allows the eighth bit to indicate if run-length encoding is in
        progress.


/d


Reply via email to