AVF

From MultimediaWiki
Revision as of 06:17, 21 July 2021 by Kostya (talk | contribs) (update info)
Jump to navigation Jump to search

AVF is a multimedia format used in the games like The Vampire Diaries (old 8-bit format) and Nancy Drew: Stay Tuned For Danger (new 15-bit format). It may be used in other games in the Nancy Drew series.

Header

Old format:

 3 bytes - "ALG"
 7 bytes - unknown
 2 bytes - major version
 2 bytes - minor version

New format:

 15 bytes - "AVF WayneSikes"
 2 bytes  - major version
 2 bytes  - minor version
 1 byte   - unknown

Known versions are 1.0 and 2.0.

Common header:

 2 bytes - number of frames
 2 bytes - width
 2 bytes - height
 1 byte  - depth (8 for old format, 16 for new format)
 4 bytes - frame time
 1 byte  - compression (should be 2; compression 0 is for unpacked data)
 1 byte (version 1.0 only) - unknown

Old format uses 8-bit format with an external palette, new format uses RGB555 video. Additionally old format is stored bottom-up while new format is top to bottom.

Table of contents entries format

Table of contents entry for version 1.0:

 9 bytes - name
 4 bytes - index
 4 bytes - unknown
 4 bytes - offset
 4 bytes - compressed size

Table of contents entry for version 2.0:

 2 bytes - index
 4 bytes - offset
 4 bytes - compressed size
 4 bytes - uncompressed size
 1 byte  - type
 4 bytes - unknown

Frame compression

Compression type 2 means that frame data is first compressed with LZSS scheme that groups flags into bytes and has spaces as the window fill value.

Type 0 is raw data (old format frames are always raw data). Types 1 and 2 employ additional RLE-based compression (or can be empty frames).

The compression method works by issuing one-byte commands for skipping or writing 16-bit pixels:

  • 0x20 - read 32-bit skip value and 32-bit length value, skip skip pixels and read length new 16-bit pixels
  • 0x40 - read a pixel (2 bytes), 32-bit skip value and 32-bit length value, skip skip pixels and output new pixel length times
  • 0x80 - read 8-bit length value, read 32-bit number of skip+put operations, read length new pixels into buffer, and then for the number of skip+put operations read 32-bit skip value, skip skip pixels and output length pixels from the buffer