Having realized that the encoding I proposed yesterday was quite naive, I now propose a new encoding based on bzip2 compression, tentatively called bz2tile.

The uncompressed representation starts with the tile size:

        U16 tileSize;

As with Hextile and ZRLE, if the dimensions of the rectangle aren't exact multiples of the tile size, the last row and/or column of tiles are smaller.

Each tile starts with a subencoding field:

        U8 subencoding;

There are three subencodings:

0 - Raw:

The subencoding field is followed by the raw pixel data for the tile:

        CPIXEL data[tileSize * tileSize];

1 - Solid:

The subencoding field is followed by the solid color of this tile:

        CPIXEL solidColor;

2 - Palette:

The subencoding field is followed by the maximum palette index:

        U8 maxIndex;

Since palette indices are zero-based, this is the size of the palette minus one. This subencoding therefore allows a palette of up to 256 colors. This subencoding never packs multiple pixels into a single byte; bit-packing is the job of the Huffman coder used by bzip2.

The maxIndex field is followed by the palette:

        CPIXEL palette[maxIndex + 1];

The palette is followed by the indices for this tile:

        U8 indices[tileSize * tileSize];

Any questions or concerns regarding this new encoding? I'm about to implement it.

Matt
_______________________________________________
VNC-List mailing list
[email protected]
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to