M95

From MultimediaWiki
Revision as of 15:06, 13 July 2006 by Multimedia Mike (talk | contribs) (samples, categories)
Jump to navigation Jump to search

Quite predictable, Cyberia 2 comes with a bit extended movies, now stored within m95 files. While all existing codecs remains unchanged, several new were added and frames layout revised. Please refer to the original C93 description, as this document covers only changes between m95-c93.

File Stucture

  • Contents table remain the same, but holds 1024 records now.
  • Frame descriptor, however, greatly changed (all offsets are relative to the block):
dword frame_offset[14] - offset of the particular frame
dword unk_offset_1     - points to something after palette, useless (?)
dword unknown
dword sound_offset     - offset of the sound portion
dword unknown[3]
dword palette_offset   - offset of the palette
dword unk_offset_2     - 
dword unk_offset_3     - both fields, when non-zero, also offsets of something
  • Sound stored as a complete WAV file.
  • Palette begins with a byte, indicates (in-block) frame number it belongs to, and followed by 256 BGR triplets.

Video Compression

Before proceeding to the decoding, read 2 bytes value from the stream. If it's non-zero, perform extra dictionary unpacking, located at offset (frame + value). Then continue frame decoding. Dictionary contains variable number of 8x8 blocks packed using simple LZ-like algorithm. To decompress:

repeat
  read 16-bits tag value
  for each bit of tag (low to high)
    if bit is set
      output = next byte of the stream
    else
      offset = 10 bits of the stream
      count = next 6 bits of the stream + 3
      if offset is zero
        finish the unpacking
      else
        output count bytes located at output - offset

New compression methods:

  • 1

Read 8 color bytes from the stream. Paint pixels by reading 3 bits from the stream and selecting one of 8 colors by these bits.

  • 3

Copy 8x8 block from the previous frame.

  • 4

Paint next 8x8 pixels from the dictionary.

  • 9

Motion block. For each of 2x2 subblock read 4 bits of x delta, then 4 bits of y delta. If bit 3 of delta is set, then delta = delta - 16. Copy block from the previous frame shifted by that delta relatively current position.

  • C

Same as 9, but for 4x4 subblocks.