GRN
- Company: Microids
- Extensions: grn, anm
- Game: Ultimate Domain (aka Genesia)
This is a video format that has chunked video stream interleaved with audio data if present. If file header indicates audio, then it gets padded to 2kB, followed by the signalled number of 2kB sectors of initial audio data and then it is 8kB of video stream followed by 2kB of audio followed by 8kB of video stream... Without audio there is no header padding or audio sectors present. Video data may employ RLE and/or LZSS for compression.
Header format:
4 bytes - "ANIM" 4 bytes - data offset 2 bytes - width 2 bytes - height 2 bytes - depth (8 bits per pixel) 2 bytes - number of video chunks minus one 4 bytes - delay in milliseconds between frames 4 bytes - unknown 2 bytes - unknown 2 bytes - unknown 4 bytes - number of 2kB initial audio sectors N*2 bytes - video chunk sizes
Known chunks are:
- "PAL\x00" -- palette data
- "IMAGE" -- uncompressed image
- "LZIM" -- LZSS-compressed image
- "FRM2" -- RLE-compressed image
- "LZF2" -- LZSS compressed data for RLE-compressed image
RLE compression resembles FLI but it operates on pairs of pixels. First two 16-bit values define from which line to start decoding and how many lines to process. For each line there's a byte telling how many skip/paint operations are there (1 - skip, 2 - skip, paint, 3 - skip, paint, skip etc), skip operation is one byte telling how many pairs of pixels to skip, paint operation is a signed byte value, non-negative values telling how many bytes to copy from input, negative values telling how many times to repeat the pixel pair from input.