VIP Video

From MultimediaWiki
Jump to navigation Jump to search

This is a format used in PC port of Zorton Brothers game known as Los Justicieros. It employs a mix of RLE and 2-colour vector quantisation in paletted format.

File header (all values are little-endian):

 5 bytes - "VIP01"
 2 bytes - number of chunks
 2 bytes - video width
 2 bytes - video height
 4 bytes - always zero?
 2 bytes - always 125, probably fps*10
 2 bytes - unknown
 12 bytes - zeroes?

The rest of file is a sequence of chunks with 8-byte header:

 2 bytes - chunk size
 1 byte  - duration
 1 byte  - chunk type
 1 byte  - unknown
 1 byte  - fade step
 2 bytes - 0xC060

Known chunk types are:

  • 0 - skip frame
  • 2 - VGA palette update (first byte - start index, second byte - number of colours to update, then RGB triplets and usually two unknown bytes at the end)
  • 3 - raw frame
  • 4 - intra RLE frame
  • 5 - inter RLE frame
  • 6 - RLE+2-colour 4x4 tiles
  • 7 - 8-bit PCM audio
  • 9 - ignored
  • 11 - 4x2 2-colour tile frame
  • 12 - black frame
  • 13 - fade out (with new palette in the same format as chunk type 2)
  • 14 - fade out

Video compression

Intra RLE (mode 4)

RLE operation is one byte, top bit is operation kind (copy/run), low 7 bits are operation length minus one.

Inter RLE (mode 5)

In this mode frame is split into strips with the changed data and only changed pixels in the strips are coded.

 16 bits - ignored, probably width
 16 bits - number of strips
 for each strip {
   16 bits - number of lines to skip after the previous strip
   16 bits - strip height
   for each line {
     8 bits - number of operations
     for each operation {
       8 bits - number of pixels to skip
       8 bits - RLE opcode (same as mode 4)
     }
   } 
 }

RLE plus 4x4 tiles (mode 6)

This mode resembles mode 5 except that instead of individual pixels whole 4x4 tiles are painted. I.e. "copy 3" operation means painting three tiles while "run of 5 tiles" means reading one tile definition and painting it five times.

Each tile is coded as 16-bit mask and two colour indices.

4x2 tiles (mode 11)

Frame can be coded in two modes: intra (all tiles are coded explicitly) and inter (bitmask in the beginning tells which tiles to update). The very first byte signals inter mode if non-zero. Then optional update bitmap follows (one bit per tile, MSB first) and actual tile data.

Tiles are coded as two colour indices and 8-bit mask telling which colour to use.