<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multimedia.cx/index.php?action=history&amp;feed=atom&amp;title=Fable_IMAX</id>
	<title>Fable IMAX - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multimedia.cx/index.php?action=history&amp;feed=atom&amp;title=Fable_IMAX"/>
	<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Fable_IMAX&amp;action=history"/>
	<updated>2026-04-26T08:50:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Fable_IMAX&amp;diff=15524&amp;oldid=prev</id>
		<title>Kostya: document yet another game format</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Fable_IMAX&amp;diff=15524&amp;oldid=prev"/>
		<updated>2021-02-14T13:17:04Z</updated>

		<summary type="html">&lt;p&gt;document yet another game format&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;* Extension: IMX&lt;br /&gt;
* Company: Simbiosis Interactive&lt;br /&gt;
&lt;br /&gt;
This is a format for three video files used in the game &amp;lt;i&amp;gt;Fable&amp;lt;/i&amp;gt;, the only game made by that company.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Header:&lt;br /&gt;
&lt;br /&gt;
 bytes  0-3  &amp;quot;IMAX&amp;quot;&lt;br /&gt;
 bytes  4-7  number of frames&lt;br /&gt;
 bytes  8-9  frames per second&lt;br /&gt;
 bytes 10-11 should always be 0x102&lt;br /&gt;
 bytes 12-13 ignored&lt;br /&gt;
 bytes 14-17 maximum video frame size including the header&lt;br /&gt;
 bytes 18-21 suggested buffer size&lt;br /&gt;
&lt;br /&gt;
Chunk format:&lt;br /&gt;
&lt;br /&gt;
 bytes 0-3  chunk payload size&lt;br /&gt;
 bytes 4-7  chunk type&lt;br /&gt;
&lt;br /&gt;
Known chunk types:&lt;br /&gt;
* 0xAA97 - video frame&lt;br /&gt;
* 0xAA98 - VGA palette (it is transmitted in full on any palette change)&lt;br /&gt;
* 0xAA99 - audio data (usually one second of sound)&lt;br /&gt;
* 0xAAFF - end of data&lt;br /&gt;
&lt;br /&gt;
== Video coding ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
  if (first frame) {&lt;br /&gt;
    empty history buffer&lt;br /&gt;
  }&lt;br /&gt;
  while not fully decoded {&lt;br /&gt;
    b = read_byte();&lt;br /&gt;
    op  = b &amp;gt;&amp;gt; 6;&lt;br /&gt;
    len = b &amp;amp; 0x3F;&lt;br /&gt;
    switch (op) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      skip 'len' pixels&lt;br /&gt;
      break;&lt;br /&gt;
    case 1:&lt;br /&gt;
      if (len == 0) {&lt;br /&gt;
        off = read_16bit_le();&lt;br /&gt;
        len = read_byte();&lt;br /&gt;
        copy 'len' pixels from history buffer at offset 'off' into output&lt;br /&gt;
      } else {&lt;br /&gt;
        read 'len' pixels from the stream&lt;br /&gt;
        output read pixels&lt;br /&gt;
        also add them to history buffer if it is not full yet&lt;br /&gt;
      }&lt;br /&gt;
      break;&lt;br /&gt;
    case 2:&lt;br /&gt;
      pix = read_byte();&lt;br /&gt;
      output 'len' run of 'pix'&lt;br /&gt;
      break;&lt;br /&gt;
    case 3:&lt;br /&gt;
      len2 = read_byte();&lt;br /&gt;
      skip 'len * 64 + len2' pixels&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Kostya</name></author>
	</entry>
</feed>