Fable IMAX

From MultimediaWiki
Revision as of 06:17, 14 February 2021 by Kostya (talk | contribs) (document yet another game format)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  • Extension: IMX
  • Company: Simbiosis Interactive

This is a format for three video files used in the game Fable, the only game made by that company.

File format

Files contain 320x160 8-bit video and 22050 Hz mono 8-bit PCM audio. Container consists of 22-byte header and chunks with image or audio data. All values are little-endian.


bytes  0-3  "IMAX"
bytes  4-7  number of frames
bytes  8-9  frames per second
bytes 10-11 should always be 0x102
bytes 12-13 ignored
bytes 14-17 maximum video frame size including the header
bytes 18-21 suggested buffer size

Chunk format:

bytes 0-3  chunk payload size
bytes 4-7  chunk type

Known chunk types:

  • 0xAA97 - video frame
  • 0xAA98 - VGA palette (it is transmitted in full on any palette change)
  • 0xAA99 - audio data (usually one second of sound)
  • 0xAAFF - end of data

Video coding

Frame coding scheme can be described as RLE coding with memory buffer. Beside the usual coding of runs and skips to update the previous frame, raw data encountered in the stream (during decoding of all frames) is also copied into 32768-byte buffer until it's full and the data from that buffer can also be used as a source data for the frame.

 if (first frame) {
   empty history buffer
 while not fully decoded {
   b = read_byte();
   op  = b >> 6;
   len = b & 0x3F;
   switch (op) {
   case 0:
     skip 'len' pixels
   case 1:
     if (len == 0) {
       off = read_16bit_le();
       len = read_byte();
       copy 'len' pixels from history buffer at offset 'off' into output
     } else {
       read 'len' pixels from the stream
       output read pixels
       also add them to history buffer if it is not full yet
   case 2:
     pix = read_byte();
     output 'len' run of 'pix'
   case 3:
     len2 = read_byte();
     skip 'len * 64 + len2' pixels