CA2

From MultimediaWiki
Jump to navigation Jump to search
  • Company: Psygnosis
  • Extension: ca2

This animation format is used in the game Microcosm and is based on scalable RLE.

Files start with one byte signalling number of colours in the palette (usually 128) followed by the palette itself in BRG format.

Frame data starts with 16-bit zero value (used to signal frame start) followed by 16-bit frame size (or another zero in case of file end) and four parts of the frame compressed with a method signalled right before that data start. Each part corresponds to each fourth column of the screen. Additionally each frame updates penultimate frame (e.g. frame 4 updates frame 2 while frame 3 updates frame 1) so two subsequent frames can be decoded in parallel.

There are five methods in use, all are variations of run/copy/skip opcodes adjusted for the different statistical distributions of those.

Method 0

  • 00 00 - end of frame
  • 00 xx yy - run of yy xx times
  • 01..7F - skip 1-127 pixels
  • 80..FF - copy negated amount of pixels (e.g. 0xFE means copy two pixels)

Method 1

  • 00..7F - use the value as a mask for updating 7 pixels (e.g. 00 - update nothing, 20 - update second pixel, 7F - update all seven pixels)
  • 80..BF - skip 64..1 pixels
  • C0 - end of frame
  • C1..FF - read two colours, repeat them 1-63 times (e.g. C0, C0 C1, C0 C1 C0, C0 C1 C0 C1 etc)

Method 2

  • 00..7F - output pixel
  • 81 - end of frame
  • 80..FF - skip negated amount of pixels (e.g. 0xFE means skipping two pixels)

Method 3

Here opcodes are 16-bit

  • 0000..7FFF - use opcode value as a mask to update 15 pixels in the same way as in method 1
  • 8000..BFFF - skip 0x4000..0x0001 pixels
  • C000 - end of frame
  • C001..FFFF - read two colours, repeat them 0001..3FFF times (same as in method 1)

Method 4

  • 00..7F - same as in method 1
  • 80..9F - skip 0..31 pixels
  • A0..BF - skip 0..31 pair of lines (e.g. A1 mean skipping two lines)
  • C0 - end of frame
  • C1..FF - same as in method 1