Magic Lantern DIFF
This is an RLE-based Amiga animation format.
File starts with magic words DIFF
and \x48\xA8\x9A\x61
followed by 32-bit zero word and 32-bit header size (usually 30). This is followed by the header, chunks, and index.
Chunks start with 32-bit chunk type and chunk size. Known chunk types:
- 6 - some initial chunk
- 9 - palette probably
- 11 - RLE-compressed frame
- 12 - RLE-compressed frame line-by-line
- 22 - delta frame
- 65535 - end marker
Index starts with some 32-bit number followed by index size and chunk types plus sizes for all chunks. At the end there's the total number of chunks and the magic word \x48\xA8\x9A\x61
.
RLE compression is straightforward: 127 means end of image/line (depending on coding mode), other positive values mean copy that amount of bytes from the stream, negative value means inverted run length. Frames start with 32-bit unpacked size.
Delta frames use skip-copy coding and may code changes in either horizontal or vertical direction. Bytestream consists of (skip, copy) pairs followed by the bytes to copy except when skip value is 255. For vertical coding the second byte means the number of columns to skip, for horizontal coding it is used either to signal long skip value or end of frame.