Magic number a0 49 4d 41h | 32 bits |
Metadata | |
Image start tag C000000Ch | 32 bits |
Image width | 32 bits |
Image height | 32 bits |
Color depth | 8 bits |
Number of channels | 8 bits |
Compression algorithm | 16 bits |
Synchronization marker 16 | 32 bits |
CRC | 32 bits |
Image content | |
Synchronization marker 128 | 32 bits |
CRC | 32 bits |
Numbers are stored in little-endian format. In the header, everything except the magic number, synchronization marker and CRC is stored in binary-complement format and a ffh byte is inserted after any byte with the value 0, as seen on disk, to avoid creating an artificial synchronization marker. The format for a synchronization marker is 00 00 80 xxh. Outside of a synchronization marker or a CRC, a 1 bit is inserted after any 22 consecutive 0 bits starting at a byte boundary.
The format for metadata is a 32 bits tag followed by the data. The low-order 8 bits indicate how many bytes of data follow the tag: |
0 - 127 | tag is followed by 0 to 127 bytes of data |
128 | tag is followed by a 0-ended text string |
129 | tag is followed by 32 bits indicating how many bytes of binary data follow |
130 | tag is followed by 32 bits indicating how many bytes of text follow |
00000000h - 7fffffffh | tag can be skipped and is user-editable |
80000000h - 9fffffffh | tag can help and is user-editable |
a0000000h - bfffffffh | tag can help and is not user-editable |
c0000000h - ffffffffh | tag is essential and is not user-editable |
The format for user-editable numbers is that in each byte, bit 7 indicates if this is the last byte (1) or (0) if the number continues. If bit 7 is 1, bit 6 is the sign. So an 8 bits number would be coded as, xxxxxxx0 x00000?1 A 16 bits number would be coded as, xxxxxxx0 xxxxxxx0 xx0000?1 128 would be coded as, 00000000 10000001 -128 would be coded as, 00000000 10000011 The format for an animation is, |
Header | |
Synchronization marker 16 | 32 bits |
CRC | 32 bits |
First frame of first group | |
Synchronization marker 64 | 32 bits |
CRC | 32 bits |
Second frame of first group | |
Synchronization marker 64 | 32 bits |
CRC | 32 bits |
......................................................... | |
Last frame of first group | |
Synchronization marker 96 | 32 bits |
CRC | 32 bits |
Header of second group of frames | |
Synchronization marker 16 | 32 bits |
CRC | 32 bits |
First frame of second group | |
......................................................... | |
Last frame of last group | |
Synchronization marker 112 | 32 bits |
CRC | 32 bits |
Additional metadata, seek pointers... (optional) | |
Synchronization marker 128 | 32 bits |
CRC | 32 bits |