<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multimedia.cx/index.php?action=history&amp;feed=atom&amp;title=CRH</id>
	<title>CRH - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multimedia.cx/index.php?action=history&amp;feed=atom&amp;title=CRH"/>
	<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=CRH&amp;action=history"/>
	<updated>2026-12-03T15:34:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=CRH&amp;diff=15975&amp;oldid=prev</id>
		<title>Sembiance: samples</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=CRH&amp;diff=15975&amp;oldid=prev"/>
		<updated>2025-05-14T14:56:08Z</updated>

		<summary type="html">&lt;p&gt;samples&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:56, 14 May 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* extension: .crh&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* extension: .crh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* company: Kalisto Entertainment SA&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* company: Kalisto Entertainment SA&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Samples: {{DexvertSamples|video/crhVideo}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;CRH is an FMV format used at least in two games by Kalisto Entertainment. It features 15-bit RGB video with LZ-like compression and block correlation and [[DPCM]]-coded audio.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;CRH is an FMV format used at least in two games by Kalisto Entertainment. It features 15-bit RGB video with LZ-like compression and block correlation and [[DPCM]]-coded audio.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sembiance</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=CRH&amp;diff=15722&amp;oldid=prev</id>
		<title>Kostya: document the format</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=CRH&amp;diff=15722&amp;oldid=prev"/>
		<updated>2023-08-09T14:22:09Z</updated>

		<summary type="html">&lt;p&gt;document the format&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;* extension: .crh&lt;br /&gt;
* company: Kalisto Entertainment SA&lt;br /&gt;
&lt;br /&gt;
CRH is an FMV format used at least in two games by Kalisto Entertainment. It features 15-bit RGB video with LZ-like compression and block correlation and [[DPCM]]-coded audio.&lt;br /&gt;
&lt;br /&gt;
== Container format ==&lt;br /&gt;
CRH files start with 16-bit little-endian version field (should be always set to one) followed by 48-byte audio header and 4-byte video header (16-bit number of frames and 16-bit frames per second which should always be 15).&lt;br /&gt;
&lt;br /&gt;
Audio header:&lt;br /&gt;
  4 bytes - sample rate&lt;br /&gt;
  4 bytes - probably full audio stream size&lt;br /&gt;
  2 bytes - unknown&lt;br /&gt;
  2 bytes - unknown&lt;br /&gt;
  2 bytes - unknown&lt;br /&gt;
  2 bytes - number of channels&lt;br /&gt;
  4 bytes - unknown&lt;br /&gt;
  4 bytes - probably raw audio bytes per second&lt;br /&gt;
  2 bytes - probably raw audio bits per sample&lt;br /&gt;
  22 bytes - unknown&lt;br /&gt;
&lt;br /&gt;
Frames consist of fixed-size audio part and variable-size video part (it starts with 32-bit size).&lt;br /&gt;
Audio part of frame is calculated as &amp;lt;code&amp;gt;sample_rate * channels / fps + 2&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Video coding ==&lt;br /&gt;
Video frames start with four 32-bit numbers: full frame size, component 1 size, component 2 size, component 3 size. Then the data for the components follows. Finally there&amp;#039;s tile data prefixed with 32-bit size.&lt;br /&gt;
&lt;br /&gt;
Video compression works by splitting frames into tiles, decorrelating tile components, interleaving them and coding each component separately using LZ-like coding.&lt;br /&gt;
&lt;br /&gt;
=== Component plane reconstruction ===&lt;br /&gt;
Each component plane has fixed size (320x200 or 320x240 depending on the game) and uses the following bitstream (LSB first):&lt;br /&gt;
&lt;br /&gt;
  if !get_bit() { // RLE&lt;br /&gt;
    value = get_bits(5);&lt;br /&gt;
    length = get_bits(8);&lt;br /&gt;
    output value x length to dst&lt;br /&gt;
  } else { // LZ&lt;br /&gt;
    source_id = get_bit();&lt;br /&gt;
    offset = get_bits(16 or 17); // depends on game&lt;br /&gt;
    length = get_bits(8);&lt;br /&gt;
    source = (!source_id ? dst : prev_plane) + offset;&lt;br /&gt;
    copy length bytes from source to dst&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
=== Deinterleaving ===&lt;br /&gt;
For some reason (maybe in order to reconstruct downscaled video) data is stored in interleaved order, i.e. for each pair of lines component plane stored first line data at even positions and second line data at odd positions. Since the plane buffers may be used as the reference during the next plane decoding, this deinterleaving process is done during data read in tile reconstruction.&lt;br /&gt;
&lt;br /&gt;
=== Tile reconstruction ===&lt;br /&gt;
After component plane reconstruction is done, it is split into tiles and reconstructed. Tile data is stored as bitstream LSB first and read bit-by-bit MSB first (e.g. eight-bit values in the tile header are stored bit-reversed).&lt;br /&gt;
&lt;br /&gt;
  tile_width  = get_bits(8); // should be 20&lt;br /&gt;
  tile_height = get_bits(8); // should also be 20&lt;br /&gt;
  for each tile {&lt;br /&gt;
    tile_mode = get_bits(2);&lt;br /&gt;
    step1     = get_bits(4) * 4;&lt;br /&gt;
    step2     = get_bits(4) * 4;&lt;br /&gt;
    offset1   = get_bits(4) * 2;&lt;br /&gt;
    offset2   = get_bits(4) * 2;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
For each tile first two translation tables are generated using the corresponding &amp;lt;code&amp;gt;offset&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;step&amp;lt;/code&amp;gt; values using the following formula:&lt;br /&gt;
&lt;br /&gt;
  for (i = 0; i &amp;lt; 32; i++)&lt;br /&gt;
    tab[i] = i * step / 32 + offset - 16;&lt;br /&gt;
&lt;br /&gt;
And finally depending on the &amp;lt;code&amp;gt;tile_mode&amp;lt;/code&amp;gt; the RGB components are restored from &amp;lt;code&amp;gt;c0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;c1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;c2&amp;lt;/code&amp;gt; (components are listed in the order they&amp;#039;re coded, &amp;lt;code&amp;gt;clip5()&amp;lt;/code&amp;gt; is a function that clips the output value to &amp;lt;code&amp;gt;[0; 31]&amp;lt;/code&amp;gt; range):&lt;br /&gt;
&lt;br /&gt;
  switch tile_mode {&lt;br /&gt;
  case 0:&lt;br /&gt;
    r = clip5(c0 + tab2[c2]);&lt;br /&gt;
    g = clip5(c1 + tab1[c2]);&lt;br /&gt;
    b = c2;&lt;br /&gt;
    break;&lt;br /&gt;
  case 1:&lt;br /&gt;
    r = clip5(c1 + tab1[c2]);&lt;br /&gt;
    g = c2;&lt;br /&gt;
    b = clip5(c0 + tab2[c2]);&lt;br /&gt;
    break;&lt;br /&gt;
  case 2:&lt;br /&gt;
    r = c2;&lt;br /&gt;
    g = clip5(c0 + tab2[c2]);&lt;br /&gt;
    b = clip5(c1 + tab1[c2]);&lt;br /&gt;
    break;&lt;br /&gt;
  } // mode 3 seems to be not handled&lt;br /&gt;
&lt;br /&gt;
== Audio coding ==&lt;br /&gt;
The format uses 16-bit audio with 8-bit deltas. In the beginning of the audio block there is full 16-bit sample (or two in case of stereo mode) followed by 8-bit signed deltas. If low bit of the delta is set, it should be multiplied by 512, otherwise just by 16 and added to the previous sample. In case of stereo mode deltas for different channels are interleaved.&lt;br /&gt;
&lt;br /&gt;
== Games using this format ==&lt;br /&gt;
* [https://www.mobygames.com/game/2874/dark-earth/ Dark Earth] (320x200 and 16-bit offsets)&lt;br /&gt;
* [https://www.mobygames.com/game/4186/nightmare-creatures/ Nightmare Creatures] (320x240 and 17-bit offsets)&lt;br /&gt;
&lt;br /&gt;
[[Category:Game Formats]]&lt;br /&gt;
[[Category:Audio Codecs]]&lt;br /&gt;
[[Category:Video Codecs]]&lt;/div&gt;</summary>
		<author><name>Kostya</name></author>
	</entry>
</feed>