Retro computing – Better Picts

View of the Limmat in Zürich, compressed with Cinepak codec

While coding my QuickDraw viewer application, I ended up writing two decoders for two codecs: Cinepak and Road-Pizza. They are interesting because the decoding complexity is moderate so they can run with 68K Macintoshes running system 7 and decoding is handled by stock versions of QuickTime. At the same time, the default encoders provided by Apple don’t seem very efficient, which means, you could use a modern computer with it’s relatively large memory and computing power to create PICT files which are compact and decode quickly on old Macintoshes.

Now my Swift code can only read QuickDraw files, so the optimisations I describe here are purely theoretical, but worth exploring:

Auto codec selection
Selecting a codec is difficult, and requires understanding which codec is best suited for a given image. A modern machine could try them all in parallel and select the most suited one.
Palette and Dithering
Cinepak allows the use of a colour palette, which means the image is first converted to 256 colours, with possibly some error diffusion, then the vectors for encoding are selected. It should be possible to combine both steps to minimise the visual errors.
Palette selection
From what I have seen the Cinepak encoder always uses the standard 256 apple colour table, but there are other standard palettes present in the system (like for instance CLUT number 9 which is used for dimmed icons). The QuickTime format also allows for embedding a Color Table, which opens new encoding options.
Banding
As the underlying format PICT format is a set of vector operations, the image data can divided into regions, with each area possibly using a different codec.
Cinepak gray bands
Cinepak theoretically allows the co-existence of colour (YUV) and grayscale blocks (pure Y), this could be used with low-colour images.
Using the transformation matrix
The QuickTime payload contains a transformation matrix, if this matrix is honoured by the QuickTime decoder on classic macs, this could be used encode images rotated. This could be useful for codecs that are row oriented, like the RLE-based ones (graphics), or codecs that use bands (Cinepak).

There are probably many other possibilities.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.