<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multimedia.cx/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Eli.friedman</id>
	<title>MultimediaWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multimedia.cx/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Eli.friedman"/>
	<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php/Special:Contributions/Eli.friedman"/>
	<updated>2026-04-18T09:27:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=LEAD_Screen_Capture&amp;diff=11028</id>
		<title>LEAD Screen Capture</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=LEAD_Screen_Capture&amp;diff=11028"/>
		<updated>2009-02-02T06:21:05Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Add category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* FourCC: LSCR&lt;br /&gt;
* Company: LEAD Technologies&lt;br /&gt;
* Website: http://www.leadtools.com/help/leadtools/v15/mapping/Features/Codecs.htm&lt;br /&gt;
* Samples: (TO ADD; see http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-January/060393.html)&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=LSCR&amp;diff=11027</id>
		<title>LSCR</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=LSCR&amp;diff=11027"/>
		<updated>2009-02-02T06:19:46Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: FourCC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect [[LEAD Screen Capture]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video FourCCs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=LEAD_Screen_Capture&amp;diff=11026</id>
		<title>LEAD Screen Capture</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=LEAD_Screen_Capture&amp;diff=11026"/>
		<updated>2009-02-02T06:18:04Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Stub&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* FourCC: LSCR&lt;br /&gt;
* Company: LEAD Technologies&lt;br /&gt;
* Website: http://www.leadtools.com/help/leadtools/v15/mapping/Features/Codecs.htm&lt;br /&gt;
* Samples: (TO ADD; see http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-January/060393.html)&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=DV_video&amp;diff=11025</id>
		<title>DV video</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=DV_video&amp;diff=11025"/>
		<updated>2009-02-02T06:09:21Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Link to samples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* FOURCCs: CDVC, CUV5, CDVH&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/V-codecs/CDVC/&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=MVXM&amp;diff=11024</id>
		<title>MVXM</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=MVXM&amp;diff=11024"/>
		<updated>2009-02-02T06:05:34Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Add a FourCC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect [[ISO MPEG-4]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video FourCCs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=ISO_MPEG-4&amp;diff=11023</id>
		<title>ISO MPEG-4</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=ISO_MPEG-4&amp;diff=11023"/>
		<updated>2009-02-02T06:05:03Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Add a FourCC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* FourCCs: 3IV2, 3iv2, BLZ0, DIGI, DIV1, div1, DIVX, divx, DX50, dx50, DXGM, EM4A, EPHV, FMP4, fmp4, FVFW, HDX4, hdx4, M4S2, m4s2, MP4S, mp4s, MP4V, mp4v, MVXM, RMP4, SEDG, SMP4, UMP4, WV1F, XVID, XviD, xvid, XVIX&lt;br /&gt;
* Matroska CodecIDs: V_MPEG4/ISO/SP (Simple Profile), V_MPEG4/ISO/ASP (Advanced Simple Profile)&lt;br /&gt;
* Samples:&lt;br /&gt;
** 3IV2: http://samples.mplayerhq.hu/V-codecs/3iv2/&lt;br /&gt;
** BLZ0: http://samples.mplayerhq.hu/V-codecs/BLZ0/&lt;br /&gt;
** DCOD: http://samples.mplayerhq.hu/V-codecs/DCOD/&lt;br /&gt;
** DIGI: http://samples.mplayerhq.hu/V-codecs/DIGI/&lt;br /&gt;
** DX50: http://samples.mplayerhq.hu/V-codecs/DX50-DivX5/&lt;br /&gt;
** DXGM: http://samples.mplayerhq.hu/V-codecs/DXGM/&lt;br /&gt;
** EM4A: http://samples.mplayerhq.hu/V-codecs/EM4A/&lt;br /&gt;
** FVFW: http://samples.mplayerhq.hu/V-codecs/FVFW/&lt;br /&gt;
** M4S2: http://samples.mplayerhq.hu/V-codecs/M4S2/&lt;br /&gt;
** MP4S: http://samples.mplayerhq.hu/V-codecs/MP4S/&lt;br /&gt;
** RMP4: http://samples.mplayerhq.hu/V-codecs/RMP4/&lt;br /&gt;
** SEDG: http://samples.mplayerhq.hu/V-codecs/SEDG/&lt;br /&gt;
** SMP4: http://samples.mplayerhq.hu/V-codecs/SMP4/&lt;br /&gt;
** UMP4: http://samples.mplayerhq.hu/V-codecs/UMP4/&lt;br /&gt;
** WV1F: http://samples.mplayerhq.hu/V-codecs/WV1F/&lt;br /&gt;
** XVID: http://samples.mplayerhq.hu/V-codecs/XVID/&lt;br /&gt;
&lt;br /&gt;
'''MPEG-4 part 2''' video.  Different encoders use different FourCCs to identify MPEG-4 content in AVI files, with DIVX, XVID, DX50, and FMP4 being most common.  Strictly speaking, some of these FourCCs should refer only to simple profile rather than advanced simple profile, but this can not be relied upon.&lt;br /&gt;
&lt;br /&gt;
This does not include [[H.264]] video ([[MPEG-4 part 10]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In particular, specifically for FMP4 fourcc, accordingly with MPlayer FAQ :&lt;br /&gt;
&lt;br /&gt;
Q:	&lt;br /&gt;
Why do third-party players fail to play MPEG-4 movies encoded by MEncoder versions later than 1.0pre7?&lt;br /&gt;
&lt;br /&gt;
A:	&lt;br /&gt;
libavcodec, the native MPEG-4 encoding library usually shipped with MEncoder, used to set the FourCC to 'DIVX' when encoding MPEG-4 videos (the FourCC is an AVI tag to identify the software used to encode and the intended software to use for decoding the video). This led many people to think that libavcodec was a DivX encoding library, when in fact it is a completely different MPEG-4 encoding library which implements the MPEG-4 standard much better than DivX does. Therefore, the new default FourCC used by libavcodec is 'FMP4', but you may override this behavior using MEncoder's -ffourcc option. You may also change the FourCC of existing files in the same way:&lt;br /&gt;
&lt;br /&gt;
  mencoder input.avi -o output.avi -ovc copy -oac copy -ffourcc XVID&lt;br /&gt;
&lt;br /&gt;
Note that this will set the FourCC to XVID rather than DIVX. This is recommended as DIVX FourCC means DivX4, which is a very basic MPEG-4 codec, whereas DX50 and XVID both mean full MPEG-4 (ASP). Therefore, if you change the FourCC to DIVX, some bad software or hardware players may choke on some advanced features that libavcodec supports, but DivX doesn't; on the other hand XviD is closer to libavcodec in terms of functionality, and is supported by all decent players.&lt;br /&gt;
&lt;br /&gt;
Because of this annoying detail, third-party software may fail to decode video that has been encoded with software based on a recent libavcodec, such as VLC. &lt;br /&gt;
Modifying the fourcc with 'DX50' or 'XVID', for example, should resolve the problem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[H.263]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=IJPG&amp;diff=11022</id>
		<title>IJPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=IJPG&amp;diff=11022"/>
		<updated>2009-02-02T06:01:21Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Add FourCC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect: [[Motion JPEG]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video FourCCs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Motion_JPEG&amp;diff=11021</id>
		<title>Motion JPEG</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Motion_JPEG&amp;diff=11021"/>
		<updated>2009-02-02T06:00:46Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Add FourCC to list&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* FourCCs: AVDJ, AVID, AVRn, dmb1, IJPG, MJPG, mjpa, mjpb&lt;br /&gt;
* Company: [[Independent JPEG Group]], [[Pegasus Imaging]]&lt;br /&gt;
&lt;br /&gt;
Motion JPEG is a sub-category of motion video codecs where successive frames are encoded using the standard [[JPEG]] algorithm. No interframe compression is performed and the resulting encoded data generally does not achieve the same level of compression as a codec using interframe techniques. However, decompression is usually faster and any frame can be referenced independently since there are no dependencies on other frames. Plus, there are fewer legal caveats when using the open JPEG standard.&lt;br /&gt;
&lt;br /&gt;
[[Category:Incomplete Video Codecs]]&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sunplus_JPEG&amp;diff=11020</id>
		<title>Sunplus JPEG</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sunplus_JPEG&amp;diff=11020"/>
		<updated>2009-02-02T05:37:55Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: A bit more info about FourCCs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*  FourCC: SP54 (and per MPlayer docs, also SP53, SP55, SP56, SP57, SP58)&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/V-codecs/SP5x/&lt;br /&gt;
&lt;br /&gt;
An [[MJPEG]] variant with data rearranged in a slightly unusual manner; per MPlayer documentation, this codec is used by the software for Aiptek MegaCam.&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=SP54&amp;diff=11019</id>
		<title>SP54</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=SP54&amp;diff=11019"/>
		<updated>2009-02-02T05:36:43Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: FourCC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Sunplus JPEG]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video FourCCs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=SP53&amp;diff=11018</id>
		<title>SP53</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=SP53&amp;diff=11018"/>
		<updated>2009-02-02T05:35:34Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: FourCC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Sunplus JPEG]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video FourCCs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=MOHD&amp;diff=11017</id>
		<title>MOHD</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=MOHD&amp;diff=11017"/>
		<updated>2009-02-02T05:33:46Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Fix FourCC redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Mobiclip Video Codec]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video FourCCs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sunplus_JPEG&amp;diff=11016</id>
		<title>Sunplus JPEG</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sunplus_JPEG&amp;diff=11016"/>
		<updated>2009-02-02T05:29:25Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Fix wikilink&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*  FourCC: SP53, SP54, SP55, SP56, SP57, SP58&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/V-codecs/SP5x/&lt;br /&gt;
&lt;br /&gt;
An [[MJPEG]] variant with data rearranged in a slightly unusual manner; per MPlayer documentation, this codec is used by the software for Aiptek MegaCam.&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Sunplus_JPEG&amp;diff=11015</id>
		<title>Sunplus JPEG</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Sunplus_JPEG&amp;diff=11015"/>
		<updated>2009-02-02T05:29:02Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Stub&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*  FourCC: SP53, SP54, SP55, SP56, SP57, SP58&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/V-codecs/SP5x/&lt;br /&gt;
&lt;br /&gt;
An [MJPEG] variant with data rearranged in a slightly unusual manner; per MPlayer documentation, this codec is used by the software for Aiptek MegaCam.&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=MOHD&amp;diff=10995</id>
		<title>MOHD</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=MOHD&amp;diff=10995"/>
		<updated>2009-01-28T16:15:03Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Redirect for MOHD FourCC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Mobiclip Video Codec]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=10237</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=10237"/>
		<updated>2008-06-22T18:16:21Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt (The referenced document was used as a reference for a lot of the description here, but note that the Pb/Pr adjustment table described there has errors!  The tables on this page are correct.)&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
The following is a spec for the Escape 130 codec; this is accurate as far as I know, but it is possible there are errors.&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace. Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There is always one base Y sample for any given block, plus there can be a adjustment pattern on top of the base sample, which provides more resolution.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: The information I have indicates that for blocks without an adjustment pattern, there is a special pattern applied after conversion to 8-bit RGB: (top left) green+6, (top right) red+6 blue+6, (bottom left) red+4 blue+4 green+2, (bottom right) red+2 blue+2 green+4.  However, I have no idea what the purpose is; possibly to reduce blockiness?  That said, I think this adjustment is too small to be visible.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: Is there more than one potential colorspace?  Some information I have indicates that there is a flag in bit 17 of the header that allows selecting an alternate colorspace, but I don't know of any samples.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus an intensity pattern for the individual pixels, one just encodes a base value, one encodes a difference from the previous block's base value, and one is just an indicator to use the previous block's base value.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, one encodes an adjustment from the previous block's values, and one is just an indicator to use the previous block's values.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for intensity-pattern encoding====&lt;br /&gt;
&lt;br /&gt;
The formula for the luma of each pixel is BaseValue + PatternStrength * PatternValue, where PatternStrength and PatternValue are from the following two tables.&lt;br /&gt;
&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
&lt;br /&gt;
This table can be dynamically generated; the way this table is generated is just using a pattern of 0, 1, then -1, for the pixels from the top left to the bottom right, with the restrictions that any code with the bottom 4 bits zero is zero, and any potential row without both a 1 and a -1 is skipped.  This algorithm will leave the bottom ten cells untouched.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Top left&lt;br /&gt;
! Top right&lt;br /&gt;
! Bottom left&lt;br /&gt;
! Bottom right&lt;br /&gt;
|-&lt;br /&gt;
| 000000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000001&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000010&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001001&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001010&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001100&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001101&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001110&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001111&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 010001&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010010&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011010&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100001&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100010&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101001&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110101&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111001&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111010&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111011&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111100&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111101&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&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>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=10236</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=10236"/>
		<updated>2008-06-22T17:53:51Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: /* Colorspace and Organization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace. Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There is always one base Y sample for any given block, plus there can be a adjustment pattern on top of the sample, which provides more resolution.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: The information I have indicates that for blocks without an adjustment pattern, there is a special pattern applied after conversion to 8-bit RGB: (top left) green+6, (top right) red+6 blue+6, (bottom left) red+4 blue+4 green+2, (bottom right) red+2 blue+2 green+4.  However, I have no idea what the purpose is; I think this is too small to be visible.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: Is there more than one potential colorspace?  Some information I have indicates that there is a flag in bit 17 of the header that allows selecting an alternate colorspace, but I don't know of any samples.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus an intensity pattern for the individual pixels, one just encodes a base value, one encodes a difference from the previous block's base value, and one is just an indicator to use the previous block's base value.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, one encodes an adjustment from the previous block's values, and one is just an indicator to use the previous block's values.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for intensity-pattern encoding====&lt;br /&gt;
&lt;br /&gt;
The formula for the luma of each pixel is BaseValue + PatternStrength * PatternValue, where PatternStrength and PatternValue are from the following two tables.&lt;br /&gt;
&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
&lt;br /&gt;
This table can be dynamically generated; the way this table is generated is just using a pattern of 0, 1, then -1, for the pixels from the top left to the bottom right, with the restrictions that any code with the bottom 4 bits zero is zero, and any potential row without both a 1 and a -1 is skipped.  This algorithm will leave the bottom ten cells untouched.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Top left&lt;br /&gt;
! Top right&lt;br /&gt;
! Bottom left&lt;br /&gt;
! Bottom right&lt;br /&gt;
|-&lt;br /&gt;
| 000000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000001&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000010&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001001&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001010&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001100&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001101&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001110&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001111&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 010001&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010010&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011010&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100001&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100010&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101001&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110101&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111001&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111010&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111011&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111100&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111101&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&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>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=10235</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=10235"/>
		<updated>2008-06-22T17:44:54Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: /* Encoding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace. Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There is always one base Y sample for any given block, plus there can be a adjustment pattern on top of the sample, which provides more resolution.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: The information I have indicates that for blocks without an adjustment pattern, there is a special pattern applied after conversion to 8-bit RGB: (top left) green+6, (top right) red+6 blue+6, (bottom left) red+4 blue+4 green+2, (bottom right) red+2 blue+2 green+4.  However, I have no idea what the purpose is; I think this is too small to be visible.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: Is there more than one potential colorspace?  Some information I have indicates that there is a flag in but 17 of the header that allows selecting an alternate colorspace.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus an intensity pattern for the individual pixels, one just encodes a base value, one encodes a difference from the previous block's base value, and one is just an indicator to use the previous block's base value.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, one encodes an adjustment from the previous block's values, and one is just an indicator to use the previous block's values.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for intensity-pattern encoding====&lt;br /&gt;
&lt;br /&gt;
The formula for the luma of each pixel is BaseValue + PatternStrength * PatternValue, where PatternStrength and PatternValue are from the following two tables.&lt;br /&gt;
&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
&lt;br /&gt;
This table can be dynamically generated; the way this table is generated is just using a pattern of 0, 1, then -1, for the pixels from the top left to the bottom right, with the restrictions that any code with the bottom 4 bits zero is zero, and any potential row without both a 1 and a -1 is skipped.  This algorithm will leave the bottom ten cells untouched.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Top left&lt;br /&gt;
! Top right&lt;br /&gt;
! Bottom left&lt;br /&gt;
! Bottom right&lt;br /&gt;
|-&lt;br /&gt;
| 000000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000001&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000010&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001001&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001010&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001100&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001101&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001110&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001111&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 010001&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010010&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011010&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100001&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100010&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101001&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110101&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111001&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111010&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111011&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111100&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111101&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&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>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=10234</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=10234"/>
		<updated>2008-06-22T17:43:39Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: /* Colorspace and Organization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace. Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There is always one base Y sample for any given block, plus there can be a adjustment pattern on top of the sample, which provides more resolution.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: The information I have indicates that for blocks without an adjustment pattern, there is a special pattern applied after conversion to 8-bit RGB: (top left) green+6, (top right) red+6 blue+6, (bottom left) red+4 blue+4 green+2, (bottom right) red+2 blue+2 green+4.  However, I have no idea what the purpose is; I think this is too small to be visible.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: Is there more than one potential colorspace?  Some information I have indicates that there is a flag in but 17 of the header that allows selecting an alternate colorspace.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus an intensity pattern for the individual pixels, one just encodes a base value, one encodes a difference from the previous block's base value, and one is just an indicator to use the previous block's base value. (XXX talk about the individual pixel adjustments for the blocks without an intensity pattern.)&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, one encodes an adjustment from the previous block's values, and one is just an indicator to use the previous block's values.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for intensity-pattern encoding====&lt;br /&gt;
&lt;br /&gt;
The formula for the luma of each pixel is BaseValue + PatternStrength * PatternValue, where PatternStrength and PatternValue are from the following two tables.&lt;br /&gt;
&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
&lt;br /&gt;
This table can be dynamically generated; the way this table is generated is just using a pattern of 0, 1, then -1, for the pixels from the top left to the bottom right, with the restrictions that any code with the bottom 4 bits zero is zero, and any potential row without both a 1 and a -1 is skipped.  This algorithm will leave the bottom ten cells untouched.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Top left&lt;br /&gt;
! Top right&lt;br /&gt;
! Bottom left&lt;br /&gt;
! Bottom right&lt;br /&gt;
|-&lt;br /&gt;
| 000000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000001&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000010&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001001&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001010&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001100&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001101&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001110&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001111&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 010001&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010010&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011010&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100001&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100010&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101001&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110101&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111001&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111010&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111011&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111100&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111101&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&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>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9906</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9906"/>
		<updated>2008-04-03T06:05:47Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There is always one base Y sample for any given block, plus there can be a adjustment pattern on top of the sample, which provides more resolution.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: The information I have indicates that for blocks without an adjustment pattern, the default pattern is a pattern which affects the Cb and Cr channels; this doesn't really make much sense to me, though.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: Is there more than one potential colorspace?  Some information I have indicates that there might be.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus an intensity pattern for the individual pixels, one just encodes a base value, one encodes a difference from the previous block's base value, and one is just an indicator to use the previous block's base value. (XXX talk about the individual pixel adjustments for the blocks without an intensity pattern.)&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, one encodes an adjustment from the previous block's values, and one is just an indicator to use the previous block's values.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for intensity-pattern encoding====&lt;br /&gt;
&lt;br /&gt;
The formula for the luma of each pixel is BaseValue + PatternStrength * PatternValue, where PatternStrength and PatternValue are from the following two tables.&lt;br /&gt;
&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
&lt;br /&gt;
This table can be dynamically generated; the way this table is generated is just using a pattern of 0, 1, then -1, for the pixels from the top left to the bottom right, with the restrictions that any code with the bottom 4 bits zero is zero, and any potential row without both a 1 and a -1 is skipped.  This algorithm will leave the bottom ten cells untouched.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Top left&lt;br /&gt;
! Top right&lt;br /&gt;
! Bottom left&lt;br /&gt;
! Bottom right&lt;br /&gt;
|-&lt;br /&gt;
| 000000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000001&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000010&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001001&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001010&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001100&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001101&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001110&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001111&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 010001&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010010&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011010&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100001&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100010&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101001&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110101&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111001&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111010&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111011&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111100&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111101&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&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>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9905</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9905"/>
		<updated>2008-04-03T05:53:14Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: /* Colorspace and Organization */ Wording change, plus explain FIXME a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There is always one base Y sample for any given block, plus there can be a adjustment pattern on top of the sample, which provides more resolution.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: The information I have indicates that for blocks without an adjustment pattern, the default pattern is a pattern which affects the Cb and Cr channels; this doesn't really make much sense to me, though.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus an intensity pattern for the individual pixels, one just encodes a base value, one encodes a difference from the previous block's base value, and one is just an indicator to use the previous block's base value. (XXX talk about the individual pixel adjustments for the blocks without an intensity pattern.)&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, one encodes an adjustment from the previous block's values, and one is just an indicator to use the previous block's values.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for intensity-pattern encoding====&lt;br /&gt;
&lt;br /&gt;
The formula for the luma of each pixel is BaseValue + PatternStrength * PatternValue, where PatternStrength and PatternValue are from the following two tables.&lt;br /&gt;
&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
&lt;br /&gt;
This table can be dynamically generated; the way this table is generated is just using a pattern of 0, 1, then -1, for the pixels from the top left to the bottom right, with the restrictions that any code with the bottom 4 bits zero is zero, and any potential row without both a 1 and a -1 is skipped.  This algorithm will leave the bottom ten cells untouched.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Top left&lt;br /&gt;
! Top right&lt;br /&gt;
! Bottom left&lt;br /&gt;
! Bottom right&lt;br /&gt;
|-&lt;br /&gt;
| 000000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000001&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000010&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001001&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001010&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001100&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001101&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001110&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001111&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 010001&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010010&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011010&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100001&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100010&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101001&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110101&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111001&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111010&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111011&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111100&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111101&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&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>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9904</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9904"/>
		<updated>2008-04-03T05:25:40Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Fix up intensity pattern information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There can be either one or four Y samples for any given block.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: I've seen various comments involving stuff in an RGB colorspace; I don't know exactly what is going on here, and I'm not going to try and figure it out until I've got the rest of decoding working.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus an intensity pattern for the individual pixels, one just encodes a base value, one encodes a difference from the previous block's base value, and one is just an indicator to use the previous block's base value. (XXX talk about the individual pixel adjustments for the blocks without an intensity pattern.)&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, one encodes an adjustment from the previous block's values, and one is just an indicator to use the previous block's values.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for intensity-pattern encoding====&lt;br /&gt;
&lt;br /&gt;
The formula for the luma of each pixel is BaseValue + PatternStrength * PatternValue, where PatternStrength and PatternValue are from the following two tables.&lt;br /&gt;
&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
&lt;br /&gt;
This table can be dynamically generated; the way this table is generated is just using a pattern of 0, 1, then -1, for the pixels from the top left to the bottom right, with the restrictions that any code with the bottom 4 bits zero is zero, and any potential row without both a 1 and a -1 is skipped.  This algorithm will leave the bottom ten cells untouched.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Top left&lt;br /&gt;
! Top right&lt;br /&gt;
! Bottom left&lt;br /&gt;
! Bottom right&lt;br /&gt;
|-&lt;br /&gt;
| 000000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000001&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000010&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 000111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001001&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001010&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001100&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001101&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001110&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 001111&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 010001&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010010&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011010&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100001&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100010&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100011&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100100&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100101&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101001&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101101&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101110&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101111&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110001&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110011&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110100&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110101&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 110111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111000&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111001&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111010&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111011&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111100&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111101&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111110&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 111111&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&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>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9903</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9903"/>
		<updated>2008-04-03T02:47:25Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Some small, but important, corrections/clarifications&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There can be either one or four Y samples for any given block.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: I've seen various comments involving stuff in an RGB colorspace; I don't know exactly what is going on here, and I'm not going to try and figure it out until I've got the rest of decoding working.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus an intensity pattern for the individual pixels, one just encodes a base value, one encodes a difference from the previous block's base value, and one is just an indicator to use the previous block's base value. (XXX talk about the individual pixel adjustments for the blocks without an intensity pattern.)&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, one encodes an adjustment from the previous block's values, and one is just an indicator to use the previous block's values.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for intensity-pattern encoding====&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
(XXX Unverified)&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
(XXX need to clean up; the codes are listed from 000000 to 110101, the pixels are&lt;br /&gt;
listed left to right, top to bottom; zero indicates the base value,&lt;br /&gt;
1 indicates a positive adjustment by thestrength value, -1 indicates a&lt;br /&gt;
negative adjustment by the strength value.)&lt;br /&gt;
(XXX May be wrong)&lt;br /&gt;
(XXX Table is a mess/unwikified; view the source to see it. I'm not going to bother reformatting it until I have some confidence that it's accurate.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
                    { {0, 0, 0, 0},&lt;br /&gt;
                      {-1, 1, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 0},&lt;br /&gt;
                      {-1, 0, 1, 0},&lt;br /&gt;
                      {-1, 1, 1, 0},&lt;br /&gt;
                      {0, -1, 1, 0},&lt;br /&gt;
                      {1, -1, 1, 0},&lt;br /&gt;
                      {-1, -1, 1, 0},&lt;br /&gt;
                      {1, 0, -1, 0},&lt;br /&gt;
                      {0, 1, -1, 0},&lt;br /&gt;
                      {1, 1, -1, 0},&lt;br /&gt;
                      {-1, 1, -1, 0},&lt;br /&gt;
                      {1, -1, -1, 0},&lt;br /&gt;
                      {-1, 0, 0, 1},&lt;br /&gt;
                      {-1, 1, 0, 1},&lt;br /&gt;
                      {0, -1, 0, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 1},&lt;br /&gt;
                      {-1, -1, 0, 1},&lt;br /&gt;
                      {-1, 0, 1, 1},&lt;br /&gt;
                      {-1, 1, 1, 1},&lt;br /&gt;
                      {0, -1, 1, 1},&lt;br /&gt;
                      {1, -1, 1, 1},&lt;br /&gt;
                      {-1, -1, 1, 1},&lt;br /&gt;
                      {0, 0, -1, 1},&lt;br /&gt;
                      {1, 0, -1, 1},&lt;br /&gt;
                      {-1, 0, -1, 1},&lt;br /&gt;
                      {0, 1, -1, 1},&lt;br /&gt;
                      {1, 1, -1, 1},&lt;br /&gt;
                      {-1, 1, -1, 1},&lt;br /&gt;
                      {0, -1, -1, 1},&lt;br /&gt;
                      {1, -1, -1, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {-1, -1, -1, 1},&lt;br /&gt;
                      {1, 0, 0, -1},&lt;br /&gt;
                      {0, 1, 0, -1},&lt;br /&gt;
                      {1, 1, 0, -1},&lt;br /&gt;
                      {-1, 1, 0, -1},&lt;br /&gt;
                      {1, -1, 0, -1},&lt;br /&gt;
                      {0, 0, 1, -1},&lt;br /&gt;
                      {1, 0, 1, -1},&lt;br /&gt;
                      {-1, 0, 1, -1},&lt;br /&gt;
                      {0, 1, 1, -1},&lt;br /&gt;
                      {1, 1, 1, -1},&lt;br /&gt;
                      {-1, 1, 1, -1},&lt;br /&gt;
                      {0, -1, 1, -1},&lt;br /&gt;
                      {1, -1, 1, -1},&lt;br /&gt;
                      {-1, -1, 1, -1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, 0, -1, -1},&lt;br /&gt;
                      {0, 1, -1, -1},&lt;br /&gt;
                      {1, 1, -1, -1},&lt;br /&gt;
                      {-1, 1, -1, -1},&lt;br /&gt;
                      {1, -1, -1, -1} };&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(TODO: Finish decoder and check that everything I've said is actually accurate)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9889</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9889"/>
		<updated>2008-04-02T01:48:51Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: /* Table for Cb/Cr adjustment codes */ Finally figured out the right Cr codes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There can be either one or four Y samples for any given block.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: I've seen various comments involving stuff in an RGB colorspace; I don't know exactly what is going on here, and I'm not going to try and figure it out until I've got the rest of decoding working.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus a difference pattern for the individual pixels, one just encodes a base value (XXX with a flat pattern?), one encodes a difference from the previous values, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, and one encodes an adjustment for the previous block, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Tables for 4-color encoding====&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
(XXX Unverified)&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
(XXX need to clean up; the codes are listed from 000000 to 110101, the pixels are&lt;br /&gt;
listed left to right, top to bottom; zero indicates the base value,&lt;br /&gt;
1 indicates a positive adjustment by thestrength value, -1 indicates a&lt;br /&gt;
negative adjustment by the strength value.)&lt;br /&gt;
(XXX May be wrong)&lt;br /&gt;
(XXX Table is a mess/unwikified; view the source to see it. I'm not going to bother reformatting it until I have some confidence that it's accurate.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
                    { {0, 0, 0, 0},&lt;br /&gt;
                      {-1, 1, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 0},&lt;br /&gt;
                      {-1, 0, 1, 0},&lt;br /&gt;
                      {-1, 1, 1, 0},&lt;br /&gt;
                      {0, -1, 1, 0},&lt;br /&gt;
                      {1, -1, 1, 0},&lt;br /&gt;
                      {-1, -1, 1, 0},&lt;br /&gt;
                      {1, 0, -1, 0},&lt;br /&gt;
                      {0, 1, -1, 0},&lt;br /&gt;
                      {1, 1, -1, 0},&lt;br /&gt;
                      {-1, 1, -1, 0},&lt;br /&gt;
                      {1, -1, -1, 0},&lt;br /&gt;
                      {-1, 0, 0, 1},&lt;br /&gt;
                      {-1, 1, 0, 1},&lt;br /&gt;
                      {0, -1, 0, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 1},&lt;br /&gt;
                      {-1, -1, 0, 1},&lt;br /&gt;
                      {-1, 0, 1, 1},&lt;br /&gt;
                      {-1, 1, 1, 1},&lt;br /&gt;
                      {0, -1, 1, 1},&lt;br /&gt;
                      {1, -1, 1, 1},&lt;br /&gt;
                      {-1, -1, 1, 1},&lt;br /&gt;
                      {0, 0, -1, 1},&lt;br /&gt;
                      {1, 0, -1, 1},&lt;br /&gt;
                      {-1, 0, -1, 1},&lt;br /&gt;
                      {0, 1, -1, 1},&lt;br /&gt;
                      {1, 1, -1, 1},&lt;br /&gt;
                      {-1, 1, -1, 1},&lt;br /&gt;
                      {0, -1, -1, 1},&lt;br /&gt;
                      {1, -1, -1, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {-1, -1, -1, 1},&lt;br /&gt;
                      {1, 0, 0, -1},&lt;br /&gt;
                      {0, 1, 0, -1},&lt;br /&gt;
                      {1, 1, 0, -1},&lt;br /&gt;
                      {-1, 1, 0, -1},&lt;br /&gt;
                      {1, -1, 0, -1},&lt;br /&gt;
                      {0, 0, 1, -1},&lt;br /&gt;
                      {1, 0, 1, -1},&lt;br /&gt;
                      {-1, 0, 1, -1},&lt;br /&gt;
                      {0, 1, 1, -1},&lt;br /&gt;
                      {1, 1, 1, -1},&lt;br /&gt;
                      {-1, 1, 1, -1},&lt;br /&gt;
                      {0, -1, 1, -1},&lt;br /&gt;
                      {1, -1, 1, -1},&lt;br /&gt;
                      {-1, -1, 1, -1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, 0, -1, -1},&lt;br /&gt;
                      {0, 1, -1, -1},&lt;br /&gt;
                      {1, 1, -1, -1},&lt;br /&gt;
                      {-1, 1, -1, -1},&lt;br /&gt;
                      {1, -1, -1, -1} };&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(TODO: Finish decoder and check that everything I've said is actually accurate)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9888</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9888"/>
		<updated>2008-04-02T00:58:08Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Comment out pattern codes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There can be either one or four Y samples for any given block.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: I've seen various comments involving stuff in an RGB colorspace; I don't know exactly what is going on here, and I'm not going to try and figure it out until I've got the rest of decoding working.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus a difference pattern for the individual pixels, one just encodes a base value (XXX with a flat pattern?), one encodes a difference from the previous values, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, and one encodes an adjustment for the previous block, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
(XXX I'm almost certain the Cr column is wrong!)&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Tables for 4-color encoding====&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
(XXX Unverified)&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
(XXX need to clean up; the codes are listed from 000000 to 110101, the pixels are&lt;br /&gt;
listed left to right, top to bottom; zero indicates the base value,&lt;br /&gt;
1 indicates a positive adjustment by thestrength value, -1 indicates a&lt;br /&gt;
negative adjustment by the strength value.)&lt;br /&gt;
(XXX May be wrong)&lt;br /&gt;
(XXX Table is a mess/unwikified; view the source to see it. I'm not going to bother reformatting it until I have some confidence that it's accurate.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
                    { {0, 0, 0, 0},&lt;br /&gt;
                      {-1, 1, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 0},&lt;br /&gt;
                      {-1, 0, 1, 0},&lt;br /&gt;
                      {-1, 1, 1, 0},&lt;br /&gt;
                      {0, -1, 1, 0},&lt;br /&gt;
                      {1, -1, 1, 0},&lt;br /&gt;
                      {-1, -1, 1, 0},&lt;br /&gt;
                      {1, 0, -1, 0},&lt;br /&gt;
                      {0, 1, -1, 0},&lt;br /&gt;
                      {1, 1, -1, 0},&lt;br /&gt;
                      {-1, 1, -1, 0},&lt;br /&gt;
                      {1, -1, -1, 0},&lt;br /&gt;
                      {-1, 0, 0, 1},&lt;br /&gt;
                      {-1, 1, 0, 1},&lt;br /&gt;
                      {0, -1, 0, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 1},&lt;br /&gt;
                      {-1, -1, 0, 1},&lt;br /&gt;
                      {-1, 0, 1, 1},&lt;br /&gt;
                      {-1, 1, 1, 1},&lt;br /&gt;
                      {0, -1, 1, 1},&lt;br /&gt;
                      {1, -1, 1, 1},&lt;br /&gt;
                      {-1, -1, 1, 1},&lt;br /&gt;
                      {0, 0, -1, 1},&lt;br /&gt;
                      {1, 0, -1, 1},&lt;br /&gt;
                      {-1, 0, -1, 1},&lt;br /&gt;
                      {0, 1, -1, 1},&lt;br /&gt;
                      {1, 1, -1, 1},&lt;br /&gt;
                      {-1, 1, -1, 1},&lt;br /&gt;
                      {0, -1, -1, 1},&lt;br /&gt;
                      {1, -1, -1, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {-1, -1, -1, 1},&lt;br /&gt;
                      {1, 0, 0, -1},&lt;br /&gt;
                      {0, 1, 0, -1},&lt;br /&gt;
                      {1, 1, 0, -1},&lt;br /&gt;
                      {-1, 1, 0, -1},&lt;br /&gt;
                      {1, -1, 0, -1},&lt;br /&gt;
                      {0, 0, 1, -1},&lt;br /&gt;
                      {1, 0, 1, -1},&lt;br /&gt;
                      {-1, 0, 1, -1},&lt;br /&gt;
                      {0, 1, 1, -1},&lt;br /&gt;
                      {1, 1, 1, -1},&lt;br /&gt;
                      {-1, 1, 1, -1},&lt;br /&gt;
                      {0, -1, 1, -1},&lt;br /&gt;
                      {1, -1, 1, -1},&lt;br /&gt;
                      {-1, -1, 1, -1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, 0, -1, -1},&lt;br /&gt;
                      {0, 1, -1, -1},&lt;br /&gt;
                      {1, 1, -1, -1},&lt;br /&gt;
                      {-1, 1, -1, -1},&lt;br /&gt;
                      {1, -1, -1, -1} };&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(TODO: Finish decoder and check that everything I've said is actually accurate)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9887</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9887"/>
		<updated>2008-04-02T00:55:11Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Wikifying + warning&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
'''The following is a work-in-progress spec for the Escape 130 codec; it is likely to be inaccurate!'''&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There can be either one or four Y samples for any given block.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: I've seen various comments involving stuff in an RGB colorspace; I don't know exactly what is going on here, and I'm not going to try and figure it out until I've got the rest of decoding working.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus a difference pattern for the individual pixels, one just encodes a base value (XXX with a flat pattern?), one encodes a difference from the previous values, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, and one encodes an adjustment for the previous block, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
(XXX I'm almost certain the Cr column is wrong!)&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Tables for 4-color encoding====&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
(XXX Unverified)&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Strength&lt;br /&gt;
|-&lt;br /&gt;
| 00&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 01&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
(XXX need to clean up; the codes are listed from 000000 to 110101, the pixels are&lt;br /&gt;
listed left to right, top to bottom; zero indicates the base value,&lt;br /&gt;
1 indicates a positive adjustment by thestrength value, -1 indicates a&lt;br /&gt;
negative adjustment by the strength value.)&lt;br /&gt;
(XXX May be wrong)&lt;br /&gt;
                    { {0, 0, 0, 0},&lt;br /&gt;
                      {-1, 1, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 0},&lt;br /&gt;
                      {-1, 0, 1, 0},&lt;br /&gt;
                      {-1, 1, 1, 0},&lt;br /&gt;
                      {0, -1, 1, 0},&lt;br /&gt;
                      {1, -1, 1, 0},&lt;br /&gt;
                      {-1, -1, 1, 0},&lt;br /&gt;
                      {1, 0, -1, 0},&lt;br /&gt;
                      {0, 1, -1, 0},&lt;br /&gt;
                      {1, 1, -1, 0},&lt;br /&gt;
                      {-1, 1, -1, 0},&lt;br /&gt;
                      {1, -1, -1, 0},&lt;br /&gt;
                      {-1, 0, 0, 1},&lt;br /&gt;
                      {-1, 1, 0, 1},&lt;br /&gt;
                      {0, -1, 0, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 1},&lt;br /&gt;
                      {-1, -1, 0, 1},&lt;br /&gt;
                      {-1, 0, 1, 1},&lt;br /&gt;
                      {-1, 1, 1, 1},&lt;br /&gt;
                      {0, -1, 1, 1},&lt;br /&gt;
                      {1, -1, 1, 1},&lt;br /&gt;
                      {-1, -1, 1, 1},&lt;br /&gt;
                      {0, 0, -1, 1},&lt;br /&gt;
                      {1, 0, -1, 1},&lt;br /&gt;
                      {-1, 0, -1, 1},&lt;br /&gt;
                      {0, 1, -1, 1},&lt;br /&gt;
                      {1, 1, -1, 1},&lt;br /&gt;
                      {-1, 1, -1, 1},&lt;br /&gt;
                      {0, -1, -1, 1},&lt;br /&gt;
                      {1, -1, -1, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {-1, -1, -1, 1},&lt;br /&gt;
                      {1, 0, 0, -1},&lt;br /&gt;
                      {0, 1, 0, -1},&lt;br /&gt;
                      {1, 1, 0, -1},&lt;br /&gt;
                      {-1, 1, 0, -1},&lt;br /&gt;
                      {1, -1, 0, -1},&lt;br /&gt;
                      {0, 0, 1, -1},&lt;br /&gt;
                      {1, 0, 1, -1},&lt;br /&gt;
                      {-1, 0, 1, -1},&lt;br /&gt;
                      {0, 1, 1, -1},&lt;br /&gt;
                      {1, 1, 1, -1},&lt;br /&gt;
                      {-1, 1, 1, -1},&lt;br /&gt;
                      {0, -1, 1, -1},&lt;br /&gt;
                      {1, -1, 1, -1},&lt;br /&gt;
                      {-1, -1, 1, -1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, 0, -1, -1},&lt;br /&gt;
                      {0, 1, -1, -1},&lt;br /&gt;
                      {1, 1, -1, -1},&lt;br /&gt;
                      {-1, 1, -1, -1},&lt;br /&gt;
                      {1, -1, -1, -1} };&lt;br /&gt;
&lt;br /&gt;
(TODO: Finish decoder and check that everything I've said is actually accurate)&lt;br /&gt;
(TODO: Wikify)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=ARMovie&amp;diff=9886</id>
		<title>ARMovie</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=ARMovie&amp;diff=9886"/>
		<updated>2008-04-01T23:25:58Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extensions: rpl&lt;br /&gt;
* Technical Description: [http://multimedia.cx/AE7doc.txt http://multimedia.cx/AE7doc.txt]&lt;br /&gt;
* Samples: [http://samples.mplayerhq.hu/game-formats/rpl/ http://samples.mplayerhq.hu/game-formats/rpl/]&lt;br /&gt;
&lt;br /&gt;
ARMovie is ostensibly a multimedia container format used on Acorn RISC computer systems. Perhaps the most curious aspect of the format's design is its use of variable-length strings in the file header. &lt;br /&gt;
&lt;br /&gt;
While apparently designed as a general container format, its most most notable use is in various [[Eidos Interactive]] computer games (using the extension rpl for Replay) including the Tomb Raider series. These [[FMV]] files contain video encoded with the [[ESCAPE]] video codec, and the audio is either uncompressed PCM or a custom [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
== PC Games That Use RPL Files ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.mobygames.com/game/big-red-racing Big Red Racing] ([[Escape 122]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/fighting-force Fighting Force] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/ian-livingstones-deathtrap-dungeon Ian Livingstone's Deathtrap Dungeon] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/joint-strike-fighter-jsf Joint Strike Fighter] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/legacy-of-kain-soul-reaver Legacy of Kain: Soul Reaver] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/dos/tomb-raider Tomb Raider] ([[Escape 124]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/tomb-raider-ii-the-dagger-of-xian Tomb Raider II] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/tomb-raider-iii-adventures-of-lara-croft Tomb Raider III] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/warzone-2100 Warzone 2100] ([[Escape 130]])&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=ARMovie&amp;diff=9884</id>
		<title>ARMovie</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=ARMovie&amp;diff=9884"/>
		<updated>2008-04-01T19:22:56Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Small cleanup: audio is definitely IMA ADPCM, patch was integrated into ffmpeg svn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extensions: rpl&lt;br /&gt;
* Technical Description: [http://multimedia.cx/AE7doc.txt http://multimedia.cx/AE7doc.txt]&lt;br /&gt;
* Samples: [http://samples.mplayerhq.hu/game-formats/rpl/ http://samples.mplayerhq.hu/game-formats/rpl/]&lt;br /&gt;
&lt;br /&gt;
ARMovie is ostensibly a multimedia container format used on Acorn RISC computer systems. Perhaps the most curious aspect of the format's design is its use of variable-length strings in the file header. &lt;br /&gt;
&lt;br /&gt;
While apparently designed as a general container format, its most most notable use is in various [[Eidos Interactive]] computer games (using the extension rpl for Replay) including the Tomb Raider series. These [[FMV]] files contain video encoded with the [[ESCAPE]] video codec, and the audio is either uncompressed PCM or a custom [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
== PC Games That Use RPL Files ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.mobygames.com/game/big-red-racing Big Red Racing] ([[Escape 122]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/fighting-force Fighting Force] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/ian-livingstones-deathtrap-dungeon Ian Livingstone's Deathtrap Dungeon] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/joint-strike-fighter-jsf Joint Strike Fighter] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/legacy-of-kain-soul-reaver Legacy of Kain: Soul Reaver] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/dos/tomb-raider Tomb Raider] ([[Escape 124]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/tomb-raider-ii-the-dagger-of-xian Tomb Raider II] ([[Escape 130]])&lt;br /&gt;
* [http://www.mobygames.com/game/windows/tomb-raider-iii-adventures-of-lara-croft Tomb Raider III]&lt;br /&gt;
* [http://www.mobygames.com/game/windows/warzone-2100 Warzone 2100] ([[Escape 130]])&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9883</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9883"/>
		<updated>2008-04-01T19:18:58Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Wikifying&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There can be either one or four Y samples for any given block.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: I've seen various comments involving stuff in an RGB colorspace; I don't know exactly what is going on here, and I'm not going to try and figure it out until I've got the rest of decoding working.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus a difference pattern for the individual pixels, one just encodes a base value (XXX with a flat pattern?), one encodes a difference from the previous values, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, and one encodes an adjustment for the previous block, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
====Skip codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Block code, Y part====&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Block code, Cb/Cr part====&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
====Table for Y adjustment codes====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Table for Cb/Cr adjustment codes====&lt;br /&gt;
(XXX I'm almost certain the Cr column is wrong!)&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Tables for 4-color encoding====&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
(XXX Unverified)&lt;br /&gt;
Code          Strength&lt;br /&gt;
00             2&lt;br /&gt;
01             4&lt;br /&gt;
10            10&lt;br /&gt;
11            20&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
(XXX need to clean up; the codes are listed from 000000 to 110101, the pixels are&lt;br /&gt;
listed left to right, top to bottom; zero indicates the base value,&lt;br /&gt;
1 indicates a positive adjustment by thestrength value, -1 indicates a&lt;br /&gt;
negative adjustment by the strength value.)&lt;br /&gt;
(XXX May be wrong)&lt;br /&gt;
                    { {0, 0, 0, 0},&lt;br /&gt;
                      {-1, 1, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 0},&lt;br /&gt;
                      {-1, 0, 1, 0},&lt;br /&gt;
                      {-1, 1, 1, 0},&lt;br /&gt;
                      {0, -1, 1, 0},&lt;br /&gt;
                      {1, -1, 1, 0},&lt;br /&gt;
                      {-1, -1, 1, 0},&lt;br /&gt;
                      {1, 0, -1, 0},&lt;br /&gt;
                      {0, 1, -1, 0},&lt;br /&gt;
                      {1, 1, -1, 0},&lt;br /&gt;
                      {-1, 1, -1, 0},&lt;br /&gt;
                      {1, -1, -1, 0},&lt;br /&gt;
                      {-1, 0, 0, 1},&lt;br /&gt;
                      {-1, 1, 0, 1},&lt;br /&gt;
                      {0, -1, 0, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 1},&lt;br /&gt;
                      {-1, -1, 0, 1},&lt;br /&gt;
                      {-1, 0, 1, 1},&lt;br /&gt;
                      {-1, 1, 1, 1},&lt;br /&gt;
                      {0, -1, 1, 1},&lt;br /&gt;
                      {1, -1, 1, 1},&lt;br /&gt;
                      {-1, -1, 1, 1},&lt;br /&gt;
                      {0, 0, -1, 1},&lt;br /&gt;
                      {1, 0, -1, 1},&lt;br /&gt;
                      {-1, 0, -1, 1},&lt;br /&gt;
                      {0, 1, -1, 1},&lt;br /&gt;
                      {1, 1, -1, 1},&lt;br /&gt;
                      {-1, 1, -1, 1},&lt;br /&gt;
                      {0, -1, -1, 1},&lt;br /&gt;
                      {1, -1, -1, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {-1, -1, -1, 1},&lt;br /&gt;
                      {1, 0, 0, -1},&lt;br /&gt;
                      {0, 1, 0, -1},&lt;br /&gt;
                      {1, 1, 0, -1},&lt;br /&gt;
                      {-1, 1, 0, -1},&lt;br /&gt;
                      {1, -1, 0, -1},&lt;br /&gt;
                      {0, 0, 1, -1},&lt;br /&gt;
                      {1, 0, 1, -1},&lt;br /&gt;
                      {-1, 0, 1, -1},&lt;br /&gt;
                      {0, 1, 1, -1},&lt;br /&gt;
                      {1, 1, 1, -1},&lt;br /&gt;
                      {-1, 1, 1, -1},&lt;br /&gt;
                      {0, -1, 1, -1},&lt;br /&gt;
                      {1, -1, 1, -1},&lt;br /&gt;
                      {-1, -1, 1, -1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, 0, -1, -1},&lt;br /&gt;
                      {0, 1, -1, -1},&lt;br /&gt;
                      {1, 1, -1, -1},&lt;br /&gt;
                      {-1, 1, -1, -1},&lt;br /&gt;
                      {1, -1, -1, -1} };&lt;br /&gt;
&lt;br /&gt;
(TODO: Finish decoder and check that everything I've said is actually accurate)&lt;br /&gt;
(TODO: Wikify)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9882</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9882"/>
		<updated>2008-04-01T19:17:40Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Wikifying&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a [[YCbCr]] colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There can be either one or four Y samples for any given block.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: I've seen various comments involving stuff in an RGB colorspace; I don't know exactly what is going on here, and I'm not going to try and figure it out until I've got the rest of decoding working.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus a difference pattern for the individual pixels, one just encodes a base value (XXX with a flat pattern?), one encodes a difference from the previous values, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, and one encodes an adjustment for the previous block, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
======Skip codes======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Block code, Y part======&lt;br /&gt;
1SSSSSSDDBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
&lt;br /&gt;
011BBBBBB&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the base value&lt;br /&gt;
&lt;br /&gt;
010AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
00&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
======Block code, Cb/Cr part======&lt;br /&gt;
11BBBBBRRRRR&amp;lt;br/&amp;gt;&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
&lt;br /&gt;
10AAA&amp;lt;br/&amp;gt;&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
&lt;br /&gt;
0&amp;lt;br/&amp;gt;&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
======Table for Y adjustment codes======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Adjustment&amp;lt;br/&amp;gt;(relative to 6-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| -3&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Table for Cb/Cr adjustment codes======&lt;br /&gt;
(XXX I'm almost certain the Cr column is wrong!)&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&lt;br /&gt;
! Cb Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
! Cr Adjustment&amp;lt;br/&amp;gt;(relative to 5-bit sample)&lt;br /&gt;
|-&lt;br /&gt;
| 000&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 001&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 010&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 011&lt;br /&gt;
| -1&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 100&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 101&lt;br /&gt;
| -1&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
| 110&lt;br /&gt;
| 0&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
| 111&lt;br /&gt;
| 1&lt;br /&gt;
| -1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Tables for 4-color encoding====&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
(XXX Unverified)&lt;br /&gt;
Code          Strength&lt;br /&gt;
00             2&lt;br /&gt;
01             4&lt;br /&gt;
10            10&lt;br /&gt;
11            20&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
(XXX need to clean up; the codes are listed from 000000 to 110101, the pixels are&lt;br /&gt;
listed left to right, top to bottom; zero indicates the base value,&lt;br /&gt;
1 indicates a positive adjustment by thestrength value, -1 indicates a&lt;br /&gt;
negative adjustment by the strength value.)&lt;br /&gt;
(XXX May be wrong)&lt;br /&gt;
                    { {0, 0, 0, 0},&lt;br /&gt;
                      {-1, 1, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 0},&lt;br /&gt;
                      {-1, 0, 1, 0},&lt;br /&gt;
                      {-1, 1, 1, 0},&lt;br /&gt;
                      {0, -1, 1, 0},&lt;br /&gt;
                      {1, -1, 1, 0},&lt;br /&gt;
                      {-1, -1, 1, 0},&lt;br /&gt;
                      {1, 0, -1, 0},&lt;br /&gt;
                      {0, 1, -1, 0},&lt;br /&gt;
                      {1, 1, -1, 0},&lt;br /&gt;
                      {-1, 1, -1, 0},&lt;br /&gt;
                      {1, -1, -1, 0},&lt;br /&gt;
                      {-1, 0, 0, 1},&lt;br /&gt;
                      {-1, 1, 0, 1},&lt;br /&gt;
                      {0, -1, 0, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 1},&lt;br /&gt;
                      {-1, -1, 0, 1},&lt;br /&gt;
                      {-1, 0, 1, 1},&lt;br /&gt;
                      {-1, 1, 1, 1},&lt;br /&gt;
                      {0, -1, 1, 1},&lt;br /&gt;
                      {1, -1, 1, 1},&lt;br /&gt;
                      {-1, -1, 1, 1},&lt;br /&gt;
                      {0, 0, -1, 1},&lt;br /&gt;
                      {1, 0, -1, 1},&lt;br /&gt;
                      {-1, 0, -1, 1},&lt;br /&gt;
                      {0, 1, -1, 1},&lt;br /&gt;
                      {1, 1, -1, 1},&lt;br /&gt;
                      {-1, 1, -1, 1},&lt;br /&gt;
                      {0, -1, -1, 1},&lt;br /&gt;
                      {1, -1, -1, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {-1, -1, -1, 1},&lt;br /&gt;
                      {1, 0, 0, -1},&lt;br /&gt;
                      {0, 1, 0, -1},&lt;br /&gt;
                      {1, 1, 0, -1},&lt;br /&gt;
                      {-1, 1, 0, -1},&lt;br /&gt;
                      {1, -1, 0, -1},&lt;br /&gt;
                      {0, 0, 1, -1},&lt;br /&gt;
                      {1, 0, 1, -1},&lt;br /&gt;
                      {-1, 0, 1, -1},&lt;br /&gt;
                      {0, 1, 1, -1},&lt;br /&gt;
                      {1, 1, 1, -1},&lt;br /&gt;
                      {-1, 1, 1, -1},&lt;br /&gt;
                      {0, -1, 1, -1},&lt;br /&gt;
                      {1, -1, 1, -1},&lt;br /&gt;
                      {-1, -1, 1, -1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, 0, -1, -1},&lt;br /&gt;
                      {0, 1, -1, -1},&lt;br /&gt;
                      {1, 1, -1, -1},&lt;br /&gt;
                      {-1, 1, -1, -1},&lt;br /&gt;
                      {1, -1, -1, -1} };&lt;br /&gt;
&lt;br /&gt;
(TODO: Finish decoder and check that everything I've said is actually accurate)&lt;br /&gt;
(TODO: Wikify)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9881</id>
		<title>Escape 130</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Escape_130&amp;diff=9881"/>
		<updated>2008-04-01T18:31:10Z</updated>

		<summary type="html">&lt;p&gt;Eli.friedman: Massive dump of Escape 130 details (I'll finish wikifying later)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Eidos Technologies]]&lt;br /&gt;
* Samples: http://samples.mplayerhq.hu/game-formats/rpl/&lt;br /&gt;
* Technical Description: http://pirsoft-dsl-dropzone.de/dec130-spec.txt&lt;br /&gt;
&lt;br /&gt;
Surprisingly, unlike previous [[ESCAPE]] codecs, Escape 130 was completely redesigned. Now it operates in mixed [[YUV]]/[[RGB]] colorpace and employs simple differential coding. In short, the source RGB image broken into 2x2 blocks. The average value of each pixel quad is interpolated, converted to YUV colorspace and stored together with quantized neighboring pixel differences. The decoder, operating in reverse, unpacks interpolated pixel values, convert them to RGB colorspace, then requantizes 4 pixels using supplied or pre-defined coefficient set. Compression works well for full-motion video, but static images experience visible blocking.&lt;br /&gt;
&lt;br /&gt;
==Container==&lt;br /&gt;
&lt;br /&gt;
All known video clips using the Escape 130 video codec are contained in the [[ARMovie]]/RPL container format. [[ARMovie]] is a general video/sound container; the only feature worth mentioning here is that the video and audio are contained in pairs of opaque chunks of arbitrary size. All known Escape 130 clips have only one video frame per chunk, though, which means the demuxer doesn't have to parse the video frame headers.&lt;br /&gt;
&lt;br /&gt;
Note that functionally, this format is mostly unrelated to the [[Escape 122]] and [[Escape 124]] codecs; the only real similarity is the skip code, block code organization of the blocks.&lt;br /&gt;
&lt;br /&gt;
The audio alongside Escape 130 samples is either 16-bit signed linear [[PCM]], or an [[IMA ADPCM]] variant.&lt;br /&gt;
&lt;br /&gt;
See the [[ARMovie]] page for a list of games using this codec.&lt;br /&gt;
&lt;br /&gt;
==Bit order==&lt;br /&gt;
&lt;br /&gt;
All numbers in this format are little-endian; this format is bit-oriented,&lt;br /&gt;
and the bitstream is parsed in little-endian order.  Multi-bit quantities&lt;br /&gt;
are stored smallest bit first.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
The header is 16 bytes long; decoding doesn't require any information from this header.&lt;br /&gt;
&lt;br /&gt;
The first two bytes are always 0x0130. The second two bytes are 0x0001 for most frames and 0x8001 for keyframes (i.e. frames not dependent on the previous frame). The only way that a keyframe is different from a normal frame is that the only legal skip code in a keyframe is the code with the value zero. Most clips are not seekable anyway due to the audio using an ADPCM format without any keyframes (XXX is it really unseekable?). The next 4 bytes contain the size of the video frame, which is the same as the chunk size in the index of the container. The next 8 bytes are always zero.&lt;br /&gt;
&lt;br /&gt;
==Colorspace and Organization==&lt;br /&gt;
&lt;br /&gt;
Each frame is conceptually a series of 2x2 blocks of pixels, encoded from left to right, top to bottom. The colors are encoded in the file using a YCbCr colorspace (XXX not exactly right?). Y samples use 6 bits, Cb and Cr samples use 5 bits. There is always one Cb and one Cr sample per 2x2 block of pixels. There can be either one or four Y samples for any given block.&lt;br /&gt;
&lt;br /&gt;
XXXFIXME: I've seen various comments involving stuff in an RGB colorspace; I don't know exactly what is going on here, and I'm not going to try and figure it out until I've got the rest of decoding working.&lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
Each frame is enocoded as a series of skip codes and block codes.  A frame consists of a skip code, then a block code, then a skip code, etc. A frame ends when every block in the frame has been either explicitly encoded or skipped.&lt;br /&gt;
&lt;br /&gt;
A skip code is a number, encoded with a variable length encoding. It indicates some number of blocks to copy over from the previous frame. The blocks are &amp;quot;skipped&amp;quot; from left to right, top to bottom, starting with the block after the last block explicitly encoded (starting with the block in the top left for the first skip code).&lt;br /&gt;
&lt;br /&gt;
A block code explicitly encodes the color of a block. Most blocks are dependent in some way on the previous block; the &amp;quot;previous block&amp;quot; is the block in the current frame processed immediately before the current block. Visually, the previous block is the block to the immediate right of the current block.  Note that the previous block may have been copied from the previous frame by a skip code. (XXXWhat about the block in the top left?)&lt;br /&gt;
&lt;br /&gt;
A block code consists of two parts: the first part encodes the Y value(s), and the second part encodes the Cb and Cr values.&lt;br /&gt;
&lt;br /&gt;
There are four formats for the Y value(s): one encodes a base value for the block plus a difference pattern for the individual pixels, one just encodes a base value (XXX with a flat pattern?), one encodes a difference from the previous values, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
There are three formats for the Cb and Cr values: one encodes the values for the block, and one encodes an adjustment for the previous block, and one is just an indicator to use the values from the previous block.&lt;br /&gt;
&lt;br /&gt;
==Encoding details==&lt;br /&gt;
&lt;br /&gt;
======Skip code======&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Binary&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
| 000000000000XXXXXXXXXXXXXXX&amp;lt;br/&amp;gt;(12 zero bits followed by 15 data bits)&lt;br /&gt;
| X + 262&lt;br /&gt;
|-&lt;br /&gt;
| 0000XXXXXXXX&amp;lt;br/&amp;gt;(4 zero bits followed by 8 data bits)&lt;br /&gt;
| X + 7&lt;br /&gt;
|-&lt;br /&gt;
| 0XXX&amp;lt;br/&amp;gt;(1 zero bit followed by 3 data bits)&lt;br /&gt;
| X&lt;br /&gt;
|-&lt;br /&gt;
| 1&amp;lt;br/&amp;gt;(1 one bit)&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Block code, Y part======&lt;br /&gt;
1SSSSSSDDBBBBB&lt;br /&gt;
B is half of the base value, D is the code for the strength of the pattern, and S is the code for the pattern.&lt;br /&gt;
011BBBBBB&lt;br /&gt;
B is the base value&lt;br /&gt;
010AAA&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
00&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
======Block code, Cb/Cr part======&lt;br /&gt;
11BBBBBRRRRR&lt;br /&gt;
B is the Cb value, R is the Cr value&lt;br /&gt;
10AAA&lt;br /&gt;
A is the code for the adjustment from the previous block's values&lt;br /&gt;
0&lt;br /&gt;
Indicator to use the values from the previous block&lt;br /&gt;
&lt;br /&gt;
======Table for Y adjustment codes (adjustments relative to 6-bit sample)======&lt;br /&gt;
Code         Adjustment&lt;br /&gt;
000          -4&lt;br /&gt;
001          -3&lt;br /&gt;
010          -2&lt;br /&gt;
011          -1&lt;br /&gt;
100           1&lt;br /&gt;
101           2&lt;br /&gt;
110           3&lt;br /&gt;
111           4&lt;br /&gt;
&lt;br /&gt;
======Table for Cb/Cr adjustment codes (adjustments relative to 5-bit sample)======&lt;br /&gt;
(XXX I'm almost certain the Cr column is wrong!)&lt;br /&gt;
Code         Cb Adjustment   Cr Adjustment&lt;br /&gt;
000           1               0&lt;br /&gt;
001           1               1&lt;br /&gt;
010           0               1&lt;br /&gt;
011          -1               0&lt;br /&gt;
100          -1              -1&lt;br /&gt;
101          -1              -2&lt;br /&gt;
110           0              -1&lt;br /&gt;
111           1              -1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Tables for 4-color encoding====&lt;br /&gt;
======Pattern strength codes (adjustments strengths relative to 6-bit sample):======&lt;br /&gt;
(XXX Unverified)&lt;br /&gt;
Code          Strength&lt;br /&gt;
00             2&lt;br /&gt;
01             4&lt;br /&gt;
10            10&lt;br /&gt;
11            20&lt;br /&gt;
&lt;br /&gt;
======Pattern codes======&lt;br /&gt;
(XXX need to clean up; the codes are listed from 000000 to 110101, the pixels are&lt;br /&gt;
listed left to right, top to bottom; zero indicates the base value,&lt;br /&gt;
1 indicates a positive adjustment by thestrength value, -1 indicates a&lt;br /&gt;
negative adjustment by the strength value.)&lt;br /&gt;
(XXX May be wrong)&lt;br /&gt;
                    { {0, 0, 0, 0},&lt;br /&gt;
                      {-1, 1, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 0},&lt;br /&gt;
                      {-1, 0, 1, 0},&lt;br /&gt;
                      {-1, 1, 1, 0},&lt;br /&gt;
                      {0, -1, 1, 0},&lt;br /&gt;
                      {1, -1, 1, 0},&lt;br /&gt;
                      {-1, -1, 1, 0},&lt;br /&gt;
                      {1, 0, -1, 0},&lt;br /&gt;
                      {0, 1, -1, 0},&lt;br /&gt;
                      {1, 1, -1, 0},&lt;br /&gt;
                      {-1, 1, -1, 0},&lt;br /&gt;
                      {1, -1, -1, 0},&lt;br /&gt;
                      {-1, 0, 0, 1},&lt;br /&gt;
                      {-1, 1, 0, 1},&lt;br /&gt;
                      {0, -1, 0, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, -1, 0, 1},&lt;br /&gt;
                      {-1, -1, 0, 1},&lt;br /&gt;
                      {-1, 0, 1, 1},&lt;br /&gt;
                      {-1, 1, 1, 1},&lt;br /&gt;
                      {0, -1, 1, 1},&lt;br /&gt;
                      {1, -1, 1, 1},&lt;br /&gt;
                      {-1, -1, 1, 1},&lt;br /&gt;
                      {0, 0, -1, 1},&lt;br /&gt;
                      {1, 0, -1, 1},&lt;br /&gt;
                      {-1, 0, -1, 1},&lt;br /&gt;
                      {0, 1, -1, 1},&lt;br /&gt;
                      {1, 1, -1, 1},&lt;br /&gt;
                      {-1, 1, -1, 1},&lt;br /&gt;
                      {0, -1, -1, 1},&lt;br /&gt;
                      {1, -1, -1, 1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {-1, -1, -1, 1},&lt;br /&gt;
                      {1, 0, 0, -1},&lt;br /&gt;
                      {0, 1, 0, -1},&lt;br /&gt;
                      {1, 1, 0, -1},&lt;br /&gt;
                      {-1, 1, 0, -1},&lt;br /&gt;
                      {1, -1, 0, -1},&lt;br /&gt;
                      {0, 0, 1, -1},&lt;br /&gt;
                      {1, 0, 1, -1},&lt;br /&gt;
                      {-1, 0, 1, -1},&lt;br /&gt;
                      {0, 1, 1, -1},&lt;br /&gt;
                      {1, 1, 1, -1},&lt;br /&gt;
                      {-1, 1, 1, -1},&lt;br /&gt;
                      {0, -1, 1, -1},&lt;br /&gt;
                      {1, -1, 1, -1},&lt;br /&gt;
                      {-1, -1, 1, -1},&lt;br /&gt;
&lt;br /&gt;
                      {0, 0, 0, 0},&lt;br /&gt;
                      {1, 0, -1, -1},&lt;br /&gt;
                      {0, 1, -1, -1},&lt;br /&gt;
                      {1, 1, -1, -1},&lt;br /&gt;
                      {-1, 1, -1, -1},&lt;br /&gt;
                      {1, -1, -1, -1} };&lt;br /&gt;
&lt;br /&gt;
(TODO: Finish decoder and check that everything I've said is actually accurate)&lt;br /&gt;
(TODO: Wikify)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Video Codecs]]&lt;br /&gt;
[[Category:Game Formats]]&lt;/div&gt;</summary>
		<author><name>Eli.friedman</name></author>
	</entry>
</feed>