FLK

From MultimediaWiki
Jump to navigation Jump to search

This is an LZW-based format used in some Italian adult game called Selen.

Video consists of one or more blocks of frames with the same palette.

Block header:

 4 bytes - number of frames
 4 bytes - video size
 4 bytes - width
 4 bytes - height
 4 bytes - frame table size (should be 64*nframes)
 12 bytes - unknown
 4 bytes - suggested unpacked data buffer size
 16 bytes - unknown
 N bytes - frame table
 512 bytes - RGB555 palette

Frame table record:

 8 bytes - unknown
 4 bytes - offset to opcodes
 4 bytes - opcodes size
 8 bytes - unknown
 4 bytes - offset to pixel data
 4 bytes - pixel data size
 4 bytes - offset to audio data
 4 bytes - audio data size
 4 bytes - frame data end?
 4x2 bytes - bounding rectangle for changed area
 12 bytes - unknown 

Frame data consists of opcodes and LZW-compressed pixel data. If opcodes are not present, pixel data constitutes raw frame.

Opcodes (in binary):

  • 000nnnnn -- output 0..31 pixels
  • 001nnnnn nnnnnnnn -- output 0..8191 pixels
  • 010nnnnn -- run of 0..31 pixels
  • 011nnnnn nnnnnnnn -- run of 0..8191 pixels
  • 100nnnnn -- restore 0..31 pixels of the initial background
  • 101nnnnn nnnnnnnn -- restore 0..8191 pixels of the initial background
  • 11000000 00000000 -- end of current line
  • 11000000 11111111 -- end of frame
  • 11000000 nnnnnnnn -- skip 1..255 lines
  • 110nnnnn -- skip 0..31 pixels
  • 111nnnnn nnnnnnnn -- skip 0..8191 pixels