FutureVision FST

From MultimediaWiki
Jump to navigation Jump to search

FST is an FMV format used in the computer horror adventure game Harvester by FutureVision. This format encodes 8-bit video using BTC and also contains uncompressed PCM audio track.

File Format

All numbers are little-endian.

File begins with a 32-byte header:

u32 Signature   -- file signature, "2TSF"
u32 Width       -- frame width
u32 Height      -- frame height
u32 Ticks       -- frame rate in ticks?
u32 Frames      -- number of frames
u32 Rate        -- frame rate per secord
u32 SoundRate   -- sound frequency
u32 SoundBits   -- sound sample size

Followed by (Frames) frame descriptors:

u32 VideoSize   -- size of the video portion of frame
u16 AudioSize   -- size of the audio portion of frame

Followrd by (Frames) frame blocks:

u8 VideoData[VideoSize]  -- as specified in corresponding frame descriptor
u8 AudioData[AudioSize]  -- as specified in corresponding frame descriptor

Video Compression

Each block of VideoData has the following format:

u16 BitmapSize              -- size of the following bitmap, in bits
u8  Bitmap[BitmapSize/8+1]  -- flag bits
RGB Palette[256]            -- optional. 6-bits DAC values.
u8  Data[]                  -- to the end of frame

Decoding algorithm:

Initialize bit reader using Bitmap. Read one byte, fetch bits starting from the highest.

Get bit. If bit is set - read the palette data

For each 4x4 block of the image (left to right, top to bottom)
  Get Bit. If bit is set:
    Get Bit. If bit is set:
      Read Color0, Color1 8-bits values from Data
      Read BTCMap 16-bits value from Data
      For each pixel of 4x4 block (left to right, top to bottom)
        pixel = (BTCMap & 0x8000) ? Color1 : Color0
        BTCMap <<= 1
      Draw block using next 4x4 bytes of Data