SIFF

From MultimediaWiki
Jump to navigation Jump to search

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