LMH LMO Format (Fury of the Furries)
The LMH/LMO Format is a video format made for Fury of the Furries to store the intro and language selection cutscenes. It consists of two files, LMH which is an index of individual frames, and LMO which contains the graphic data for the frames.
The file contains to palette information, that is stored separately in a PAM file
Header (LMH file)
|UINT16LE||frame_count||Number of frames in this file.|
|UINT16LE||width||Width of the frames in pixels.|
|UINT16LE||height||Height of the frames in pixels.|
|UINT32LE||index||Offset into LMO file of the first frame.|
|UINT32LE||index||Offset into LMO file of the second frame.|
Frame (LMO file)
The LMO file contains one or more frames, indexed by the LMH file
|UINT8||compressionFlags||flags indicating how the frame data is stored.
Clarify how these flags interact if more than one is set
if bit 1 is set, the frame is identical to the previous frame. No length information or pixel information follows.
if bit 0 is set, the frame has delta compression described below. The data contains only differences from the previous frame.
if no bits are set, the frame is uncompressed. The following 2 bytes are a UINT16BE indicating the compressed data length, and these are then followed by the pixel data from top to bottom. Each pixel is represented by a UINT8 index into the corresponding PAM palette file.
|UINT16LE||length||Length of this frame's data. This field is omitted where bit 1 of the compressionFlag is set.|
Following on from the UINT16BE length field, the file proceeds either by indicating the number of pixels that should remain unchanged from the previous frame, or by providing a sequence of pixels to replace in the frame at this point. This repeats until length bytes have been handled.
A single byte is read to indicate what to do.
If bit 7 is set, then the 6 least significant bits (lsb) of the byte indicate the number of pixels to be skipped.
If bit 6 is set, then the 6 lsb of this byte, combined (or'ed) with the 2 most significant bits (msb) of the next byte indicate the number of bytes (+ 1) that follow that should be copied into the frame at this point. ALSO the 6 lsb of the next byte (the byte from where we took the 2 msb for the length) indicates the number of pixels to be skipped following the substitution.
If neither bit 6 nor bit 7 is set, then the 6 lsb of this byte indicates the number of bytes (+ 1) that follow that should be copied into the frame at this point.
Add pseudo code to clarify algorithm
This file format was reverse engineered by carbon14. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)