CA2
- 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 frame00 xx yy
- run ofyy
xx
times01..7F
- skip 1-127 pixels80..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 pixelsC0
- end of frameC1..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 pixel81
- end of frame80..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 18000..BFFF
- skip 0x4000..0x0001 pixelsC000
- end of frameC001..FFFF
- read two colours, repeat them 0001..3FFF times (same as in method 1)
Method 4
00..7F
- same as in method 180..9F
- skip 0..31 pixelsA0..BF
- skip 0..31 pair of lines (e.g.A1
mean skipping two lines)C0
- end of frameC1..FF
- same as in method 1