QDraw

From MultimediaWiki
Revision as of 03:57, 8 March 2006 by Snacky (talk | contribs) (revert spam)
Jump to navigation Jump to search

This page is based on the codec description written by Konstantin Shishkov found in the document Description of the Apple Quicktime Animation (RLE) Format located at http://multimedia.cx/qtrle.txt.

  • FOURCCs: qdrw
  • Company: Apple

QDraw is another RLE format supported by the Quicktime multimedia system. It is identified by the FOURCC 'qdrw'. QDraw frames contain palettized 8-bit pixel data and transport their own palette data within frames.

Data Format

All multi-byte numbers are encoded in big-endian format.

An encoded QDraw frame is laid out as follows:

 bytes 0-103    unknown
 bytes 104-107  number of colors - 1
 bytes 108..    color table (8 bytes per entry)

One color table entry is laid out as:

 byte 0-1   index of palette table entry to replace
 byte 2-3   16-bit red component
 byte 4-5   16-bit green component
 byte 6-7   16-bit blue component

Thus, the color table can update arbitrary entries in the palette.

Following the color table are 18 undetermined bytes. After these bytes, there is a series of RLE-encoded lines. For each line in the image:

 first 2 bytes indicate size in bytes of compressed line
 while (remaining bytes in compressed line)
   code = next byte in encoded frame
   if (top bit is set (code & 0x80))
     output next byte in encoded frame to decoded frame (257-code) 
        times
   else
     copy (code + 1) bytes from encoded frame to decoded frame