- Extension: amf
- Samples: http://samples.mplayerhq.hu/game-formats/amf/
Not to be confused with Asylum Music Format
All numbers are little-endian. File begins with an 8-byte header:
u16 numframes -- number of frames u16 width -- frame width u16 height -- frame height u16 unknown -- unknown/unused, always 2
and is followed by at least numframes + 1 frame chunks. Each frame chunk begins with a short header:
u8 type -- chunk type u16 size -- chunk payload size (w/o this header)
and then followed by a chunk payload.
Observed chunk types:
- 0x3E - palette chunk (always first chunk in file) Payload format:
u8 firstcolor -- first color of palette to update (always 64) RGB palette[256-firstcolor] -- new palette entries (always 256-64 = 192 triplets), 6-bits DAC values
- 0x3F - video frame chunk (a video file has total numframes chunks of this type) Contains compressed video data
- all other chunk types are ignored/skipped.
Note: palette can not be changed during playback. Playback rate is about 10 fps.
while input buffer is not exhausted tag = next byte of input tag is: < 0x20 : skip (tag) pixels == 0x20 : skip (DecodeLength) pixels < 0x3F : fill (tag - 0x21 + 2) pixels with the next byte of input == 0x3F : fill (DecodeLength) pixels with the next byte of input >= 0x40 : draw (tag)
DecodeLength loads variable-sized length value:
length = 32 repeat delta = next byte of input length += delta until delta != 0xFF
The MANIC.AMF file has several BMP files attached at the end.