<?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=H2O</id>
	<title>H2O - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multimedia.cx/index.php?action=history&amp;feed=atom&amp;title=H2O"/>
	<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=H2O&amp;action=history"/>
	<updated>2026-04-18T13:26:36Z</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=H2O&amp;diff=15809&amp;oldid=prev</id>
		<title>Kostya: fill description</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=H2O&amp;diff=15809&amp;oldid=prev"/>
		<updated>2024-09-18T13:32:10Z</updated>

		<summary type="html">&lt;p&gt;fill description&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;* Company: Access Software&lt;br /&gt;
* Used in: [https://www.mobygames.com/game/1454/the-pandora-directive/ The Pandora Directive]&lt;br /&gt;
&lt;br /&gt;
This is an animation format that uses 16-bit static Huffman coding along with the fill/skip/pattern block coding.&lt;br /&gt;
&lt;br /&gt;
File header (all values are little-endian):&lt;br /&gt;
  4 bytes - &amp;quot;H2O\x01&amp;quot;&lt;br /&gt;
  4 bytes - frame width&lt;br /&gt;
  4 bytes - frame height&lt;br /&gt;
  4 bytes - number of frames&lt;br /&gt;
  48 bytes - unknown&lt;br /&gt;
&lt;br /&gt;
Each frame starts with 24-bit full frame size and 8-bit flags telling which kinds of payloads frame has. Each payload starts with 32-bit size so it can be skipped. Known payloads are:&lt;br /&gt;
* &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt; - new frame parameters (first two 32-bit words are new frame width and height)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt; - code definitions&lt;br /&gt;
* &amp;lt;code&amp;gt;0x01&amp;lt;/code&amp;gt; - palette update&lt;br /&gt;
* &amp;lt;code&amp;gt;0x02&amp;lt;/code&amp;gt; - video data&lt;br /&gt;
&lt;br /&gt;
Please note that video data comes last.&lt;br /&gt;
&lt;br /&gt;
=== Code definitions ===&lt;br /&gt;
This data defines canonical Huffman codes. It starts with two bytes telling the shortest and the longest code lengths. Then for each of the possible code lengths there is a 16-bit number telling how many codes have such length followed by the 16-bit values for those codes.&lt;br /&gt;
&lt;br /&gt;
The defined codebook is used to unpack video data before processing it further.&lt;br /&gt;
&lt;br /&gt;
=== Palette update ===&lt;br /&gt;
Palette updates are transmitted as one or more regions. First 16-bit value tells how many regions are total in the update. Each region start with a byte telling how many colours to skip from the end of the previous region (or 0 for the first region) and a byte telling how many colours are there in the region (0 means all 256 colours). Then a standard VGA palette follows.&lt;br /&gt;
&lt;br /&gt;
=== Video decompression ===&lt;br /&gt;
After unpacking data as a stream of 16-bit values, those values are used as opcodes and data to reconstruct 4x4 blocks.&lt;br /&gt;
&lt;br /&gt;
Top four bits of the opcode represent an operation:&lt;br /&gt;
* 0-3 - fill blocks. Bits 8-13 of the opcode (i.e. including the operation bits) represent run length (0-59 = 1-60, 60-63 = 128,256,512,1024), bits 0-7 are fill value (0 means skip instead of fill);&lt;br /&gt;
* 4 - two-colour pattern fill. Bits 0-11 of the opcode tell how many blocks to process this way (minus one). Then for each block there's 16-bit mask and two colours (16-bit value re-interpreted as two bytes);&lt;br /&gt;
* 5 - masked update. Bits 0-11 of the opcode tell how many blocks to process this way (minus one). Then for each block there's 16-bit mask telling which bits of the block to update and new pixel values packed in 16-bit elements (for odd number of pixels last value is stored in its own 16-bit value);&lt;br /&gt;
* other values are invalid.&lt;br /&gt;
&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Kostya</name></author>
	</entry>
</feed>