SIFF: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
(Link to samples)
m (→‎Audio file structures: fix one field description)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
* Extentions: vb, son
* Extentions: vb, vbc, son
* Samples: http://samples.mplayerhq.hu/game-formats/SIFF/
* Samples: http://samples.mplayerhq.hu/game-formats/SIFF/


Certain PC games developed by [[Beam Software]] use a  multimedia format with the file signature 'SIFF'. The format can transport audio and video (which are .vb files) or just audio (which are .son files).
Certain PC games developed by [[Beam Software]] use a  multimedia format with the file signature 'SIFF'. The format can transport audio (in <code>.son</code> files), image (in <code>.pim</code>) and video (in <code>.vb</code>/<code>.vbc</code> files).


== File Format ==
== File Format ==
Line 14: Line 14:
It is important to note that in the fourcc chunk preamble, the size field is big-endian. However, all other multi-byte numbers in the file are little-endian.
It is important to note that in the fourcc chunk preamble, the size field is big-endian. However, all other multi-byte numbers in the file are little-endian.


A VB file begins with a 'SIFF' file signature, followed by the total length of the file, minus 8 bytes. Bytes 8-11 contain the version fourcc, e.g. 'VBV1'. Then comes the header, which is laid out as follows:
=== Audio file structures ===
Audio file type is signalled by 'SOUN' signature. The header is stored in 8-byte 'SHDR' chunk:
  4 bytes - audio duration
  2 bytes - sampling rate
  1 byte  - bits per sample (usually 8 or 12)
  1 byte  - audio flags (1 - stereo sound)


   bytes 0-3    header fourcc ('VBHD')
Audio data is stored in 'BODY' chunk. 12-bit PCM audio is unpacked as <code>AB CD EF -> DAB0 EFC0</code>.
   bytes 4-7   header length (should be 32 == 0x20)
 
   bytes 8-9    unknown, but might be header version
=== Sprite file structures ===
   bytes 10-11  video width
 
   bytes 12-13  video height
This kind of files has 'PXAN' signature, header is stored in 'AHDR' chunk, palette is transmitted in 'CMAP' chunk and 'BODY' chunk contains image data.
   bytes 14-17 zeroes
 
   bytes 18-19 number of frames
=== FCP video structures ===
   bytes 20-21 bits per audio sample?
 
   bytes 22-23 audio sample rate
FCP video is signalled by 'FCPK' signature. It has the following header in 16-byte 'FCHD' chunk:
   bytes 24-39 zeroes
   2 bytes - flags (0x2000 - global MV present for each frame)
  2 bytes - width
  2 bytes - height
  2 bytes - number of frames
 
Frame data is stored inside 'BODY' chunk prefixed with 16-bit frame size and frames have the following header:
  2 bytes - audio data size
  2 bytes - frame duration (presumably)
   2 bytes - number of changed palette colours
  (if there are changed colours)
  2 bytes - palette change start
   3*N bytes - new palette bytes
  M bytes - audio size
  2 bytes (if present) - global motion X component
  2 bytes (if present) - global motion Y component
  the rest is video data
 
For actual compression description see [[Beam Video]].
 
=== VBV video structures ===
 
A VB file has 'VBV1' signature. The header is stored in 32-byte 'VBHD' chunk:
   2 bytes - version/bytes per sample (1 - palettised video, 2 - RGB555 video)
   2 bytes - width
   2 bytes - height
  2 bytes - x offset of the video
   2 bytes - y offset of the video
   2 bytes - number of frames
   1 byte  - bits per audio sample
   1 byte  - audio flags (probably)
  2 bytes - sample rate
   16 bytes - reserved, set to 0


All data is stored in 'BODY' chunk in blocks. Block format:
All data is stored in 'BODY' chunk in blocks. Block format:


   bytes 0-3   block size (with header)
   bytes 0-3   block size (with header)
   bytes 4-5 flags
   bytes 4-5   flags
   bytes 6..    block payload
   bytes 6..    block payload


Flags meaning:
The flags are defined as:


   bit 0 - frame has global motion vector
   bit 0 - frame has global motion vector
Line 41: Line 77:
   bit 5 - block has frame duration
   bit 5 - block has frame duration


Global motion vector is stored as two signed words.
Global motion vector is stored as two signed words (16 bits each). Duration is 16-bit value. The rest of sub-payloads have 32-bit size preceding them (the size includes 4 bytes of the size field itself).


Palette change data:
Palette change data:
    
    
   byte 0 - start index
   byte 0   - start index
   byte 1 - number of entries to change
   byte 1   - number of entries to change
   bytes 2.. - RGB entry, 3 bytes per entry
   bytes 2.. - RGB entry, 3 bytes per entry


=== Video Frame Format ===
For the actual compression algorithm see [[Beam Video]].


Frame is divided into 4x4 blocks. Block type is stored in two bits, which are grouped into one byte for four consequent blocks.
== Games That Use The SIFF Format ==
 
Block types:
* 0 - skip block
* 1 - motion compensated block, next byte contains motion vector (with values -8..7). If motion vector is zero then block is uncompressed and its data is contained in the next 16 bytes.
* 2 - block is filled with color stored in the next byte
* 3 - pattern fill, pattern method and value is stored in the next byte.
 
Pattern type (for block type 3) is stores in high two bits, pattern index is stored in 6 low bits. Pattern type meanings:
* 0 - read 2 bytes and paint block with them
* 1 - read one bytes and paint only pixels where pattern bit is zero
* 2 - read one bytes and paint only pixels where pattern bit is one
* 3 - invalid value


Motion compensation may wrap, i.e. pixels from the previous or next line may be read.
* [https://www.mobygames.com/game/dame-was-loaded The Dame was Loaded] (FCP and 12-bit PCM in SON)
 
* [https://www.mobygames.com/game/bug Bug!]
There are 64 possible patterns:
* [https://www.mobygames.com/game/cricket-97 Cricket 97]
 
* [https://www.mobygames.com/game/kknd-krush-kill-n-destroy KKND]
    0x0660, 0xFF00, 0xCCCC, 0xF000, 0x8888, 0x000F, 0x1111, 0xFEC8,
* [https://www.mobygames.com/game/windows/kknd2-krossfire KKND2: Krossfire]
    0x8CEF, 0x137F, 0xF731, 0xC800, 0x008C, 0x0013, 0x3100, 0xCC00,
* [https://www.mobygames.com/game/dos/norse-by-norse-west-the-return-of-the-lost-vikings The Lost Vikings II] (a.k.a. Norse By Norse West: The Return of the Lost Vikings)
    0x00CC, 0x0033, 0x3300, 0x0FF0, 0x6666, 0x00F0, 0x0F00, 0x2222,
* [https://www.mobygames.com/game/dethkarz Dethkarz]
    0x4444, 0xF600, 0x8CC8, 0x006F, 0x1331, 0x318C, 0xC813, 0x33CC,
* [https://www.mobygames.com/game/alien-earth Alien Earth] (the only one with 15-bit video)
    0x6600, 0x0CC0, 0x0066, 0x0330, 0xF900, 0xC88C, 0x009F, 0x3113,
    0x6000, 0x0880, 0x0006, 0x0110, 0xCC88, 0xFC00, 0x00CF, 0x88CC,
    0x003F, 0x1133, 0x3311, 0xF300, 0x6FF6, 0x0603, 0x08C6, 0x8C63,
    0xC631, 0x6310, 0xC060, 0x0136, 0x136C, 0x36C8, 0x6C80, 0x324C
 
== Games That Use The SIFF Format ==


* [http://www.mobygames.com/game/windows/kknd2-krossfire KKND2: Krossfire]
* [http://www.mobygames.com/game/dos/norse-by-norse-west-the-return-of-the-lost-vikings The Lost Vikings II] (a.k.a. Norse By Norse West: The Return of the Lost Vikings)
[[Category:Game Formats]]
[[Category:Game Formats]]

Latest revision as of 03:10, 5 November 2022

Certain PC games developed by Beam Software use a multimedia format with the file signature 'SIFF'. The format can transport audio (in .son files), image (in .pim) and video (in .vb/.vbc files).

File Format

The general fourcc chunk format is as follows:

 bytes 0-3   chunk type
 bytes 4-7   chunk size (not including 8-byte chunk preamble and usually in MSB format)
 bytes 8..   chunk payload

It is important to note that in the fourcc chunk preamble, the size field is big-endian. However, all other multi-byte numbers in the file are little-endian.

Audio file structures

Audio file type is signalled by 'SOUN' signature. The header is stored in 8-byte 'SHDR' chunk:

 4 bytes - audio duration
 2 bytes - sampling rate
 1 byte  - bits per sample (usually 8 or 12)
 1 byte  - audio flags (1 - stereo sound)

Audio data is stored in 'BODY' chunk. 12-bit PCM audio is unpacked as AB CD EF -> DAB0 EFC0.

Sprite file structures

This kind of files has 'PXAN' signature, header is stored in 'AHDR' chunk, palette is transmitted in 'CMAP' chunk and 'BODY' chunk contains image data.

FCP video structures

FCP video is signalled by 'FCPK' signature. It has the following header in 16-byte 'FCHD' chunk:

 2 bytes - flags (0x2000 - global MV present for each frame)
 2 bytes - width
 2 bytes - height
 2 bytes - number of frames

Frame data is stored inside 'BODY' chunk prefixed with 16-bit frame size and frames have the following header:

 2 bytes - audio data size
 2 bytes - frame duration (presumably)
 2 bytes - number of changed palette colours
 (if there are changed colours)
  2 bytes - palette change start
  3*N bytes - new palette bytes
 M bytes - audio size
 2 bytes (if present) - global motion X component
 2 bytes (if present) - global motion Y component
 the rest is video data

For actual compression description see Beam Video.

VBV video structures

A VB file has 'VBV1' signature. The header is stored in 32-byte 'VBHD' chunk:

 2 bytes - version/bytes per sample (1 - palettised video, 2 - RGB555 video)
 2 bytes - width
 2 bytes - height
 2 bytes - x offset of the video
 2 bytes - y offset of the video
 2 bytes - number of frames
 1 byte  - bits per audio sample
 1 byte  - audio flags (probably)
 2 bytes - sample rate
 16 bytes - reserved, set to 0

All data is stored in 'BODY' chunk in blocks. Block format:

 bytes 0-3    block size (with header)
 bytes 4-5    flags
 bytes 6..    block payload

The flags are defined as:

 bit 0 - frame has global motion vector
 bit 2 - block contains audio
 bit 3 - block contains video
 bit 4 - palette change
 bit 5 - block has frame duration

Global motion vector is stored as two signed words (16 bits each). Duration is 16-bit value. The rest of sub-payloads have 32-bit size preceding them (the size includes 4 bytes of the size field itself).

Palette change data:

 byte  0   - start index
 byte  1   - number of entries to change
 bytes 2.. - RGB entry, 3 bytes per entry

For the actual compression algorithm see Beam Video.

Games That Use The SIFF Format