←Older revision | Newer revision→
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.
- FourCC: qdrw
- Company: Apple
- Specification: http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-333.html
- Samples: http://samples.mplayerhq.hu/V-codecs/QT-qdrw/
QDraw is really just a standard QuickDraw PICT resource inside of a QuickTime container. It is identified by the FOURCC 'qdrw'. The PICT format can support both vector- and raster-based images.
However, only v2 8-bit paletted PackBits images have been found in QuickTime files so far. Most of this document is based on this assumption as well as having no other QuickDraw opcodes present in the frame and is therefore incomplete.
All multi-byte numbers are encoded in big-endian format.
An encoded QDraw frame is laid out as follows:
bytes 0-1 low two bytes of the frame size bytes 2-103 QuickDraw header/opcode data 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 bytes describing the PackBits source/destination rectangles and mode. After these bytes, there is a series of RLE-encoded lines using the standard PackBits compression (if mode is 0 "default" or greater than 2). For each line in the image:
if (row bytes is > 250) two bytes compressed line size else one byte compressed line size 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