ARMovie

From MultimediaWiki
(Redirected from RPL)
Jump to navigation Jump to search

ARMovie is ostensibly a multimedia container format used on Acorn RISC computer systems. Perhaps the most curious aspect of the format's design is its use of variable-length strings in the file header.

While apparently designed as a general container format, its most most notable use is in various Eidos Interactive computer games (using the extension rpl for Replay) including the Tomb Raider series. These FMV files contain video encoded with the ESCAPE video codec, and the audio is either uncompressed PCM or a custom IMA ADPCM variant.

Known video codecs

Most of the codecs output RGB555 or 5-bit YUV formats.

  • 1 -- Acorn Moving lines
  • 2 -- 15bpp uncompressed video (YUV or RGB)
  • 3 -- 10bpp YUV (4:2:2 YUV with 5-bit components)
  • 4 -- 8bpp raw video
  • 5 -- 8bpp YUV (4:2:0 subsampling)
  • 6 -- 6bpp YUV (4:1:0 subsampling)
  • 7 -- Acorn Moving Blocks
  • 8 -- 24bpp RGB
  • 9 -- YYUV with 8-bit components
  • 10 -- YV12
  • 11 -- YUV9
  • 12 -- indirect MPEG (a pointer to real MPEG movie)
  • 13 -- MPEG video data
  • 14 -- IBM UltiMotion
  • 15 -- other indirect video formats
  • 16 -- another packed YV12
  • 17 -- Acorn Moving Blocks HQ
  • 18 -- H.263
  • 19 -- Acorn Super Moving Blocks
  • 20 -- Acorn Moving Blocks Beta
  • 21 -- YUYV8
  • 22 -- packed YUV422
  • 23 -- YUV422 with 6-bit Y and 5-bit U/V components
  • 24 -- YUV420 with 6-bit Y and 5-bit U/V components
  • 25 -- YUV410 with 6-bit components
  • 100-199 -- ESCAPE codecs from Eidos Technologies
  • 500 -- Iota Software LZW-compressed frames (like in their Euclid or ACE films)
  • 600 -- WSS wrapper for 8-bit Microsoft Video 1
  • 601 -- WSS wrapper for 15-bit Microsoft Video 1
  • 602 -- WSS wrapper for Cinepak
  • 603 -- WSS wrapper for RPZA
  • 604 -- WSS wrapper for SMC
  • 605 -- WSS wrapper for IBM UltiMotion
  • 606 -- WSS wrapper for 8-bit RGB (AVI)
  • 607 -- WSS wrapper for 8-bit Microsoft RLE
  • 608 -- WSS wrapper for 24-bit RGB (AVI)
  • 609 -- WSS wrapper for 8-bit Apple QuickTime RLE
  • 610 -- WSS wrapper for FLI
  • 613 -- WSS wrapper for 4-bit Apple QuickTime RLE
  • 614 -- WSS wrapper for 16-bit Apple QuickTime RLE
  • 615 -- WSS wrapper for 24-bit Apple QuickTime RLE
  • 622 -- WSS DL (converted to raw palettised video)
  • 623 -- WSS ANM (converted to raw palettised video)
  • 624 -- WSS wrapper for 8-bit RGB (QuickTime)
  • 630 -- WSS wrapper for QuickTime VR
  • 699 -- WSS wrapper for unknown AVI or QT codecs
  • 800 -- Henrik Pedersen's LinePack
  • 802 -- Henrik Pedersen's Movie 16:3
  • 803 -- Henrik Pedersen's wrapper for AVI/QT codecs and FLI

Some ARMovie-specific codecs are documented below.

Moving Lines

This codec operates in RGB555 or YUV555 format. It reads one or several 16-bit words to determine operation.

Control word with LSB set means raw pixel value in top 15 bits. Otherwise depending on those top 15-bit value range a specific operation should be performed:

  • [0x0000..0x4800) -- motion compensation from previous frame. Low 6 bits are copy length minus two, top 9 bits are motion vector table index (you can decode it as val = idx + (idx >= 144; dx = (val % 17) - 8; dy = (val / 17) - 8;)
  • [0x4800..0x7300) -- motion compensation from current frame. Operation length is the same as in previous case, motion values can be decoded as dx = (idx - 0x120) % 19 - 9; dy = (idx - 0x120) / 19 - 9;
  • 0x7300 -- end of frame marker;
  • [0x7301..0x7800) -- run. Low 6 bits are run length minus two, next 16-bit word is run pixel value;
  • [0x7800..0x7C00) -- skip. Low 10 bits are skip length minus one;
  • [0x7C00..0x7FFF] -- raw data. The following 16-bit words will contain continuously packed 15-bit values.


Moving Blocks

This codec operates on 4x4 blocks in YUV555 format. Each 4x4 block has three coding modes: raw, motion compensated (from previous or already decoded part of the current frame) and subdivide it into 2x2 blocks and code them in raw or motion compensated mode.

Format specification may be found here.

Moving Blocks HQ

This is a development of Moving Blocks with some enhancements. Now there are more allowed motion vectors and raw luma samples use delta prediction and static Huffman coding.

Block mode codewords now are:

  • 00 -- skip block
  • 10 -- use motion compensation.
  • 01 -- raw block
  • 00 -- subdivided block

Subdivided blocks use the following mode codewords:

  • 00 -- skip subblock
  • 10 -- raw subblock
  • 1 -- use motion compensation.

Motion vectors are using the following mode codewords:

  • 00 -- read 3 bits and use table for 1-pixel MVs;
  • 10 -- read 4 bits and use table for 2-pixel MVs;
  • 01 -- read 5 bits and use a different MV table for copying from already decoded part of the frame or a table for 3-pixel MVs;
  • 00 -- read 8 bits and use table for 4-8 pixel MVs.

Raw blocks have 5-bit chroma components transmitted for a whole block followed by 4 or 16 luma differences. The codec keeps last (sub)block luma average (non-rounding) and uses it as a prediction.

For 2x2 sub-block

 a b
 c d

reconstruction is performed as

 a = (a + AVG) & 31;
 b = (b + a) & 31;
 c = (c + a) & 31;
 d = (d + ((b + c) >> 1)) & 31;
 AVG = (a + b + c + d) >> 2;

For 4x4 block decoded values are reconstructed row per row, first adding left neighbour (if present), then top neighbour (if present). First value is reconstructed the same as in previous case.

Codebook for all 32 possible values:

        10
       111
       100
      1000
     11101
    111011
    110101
   1011011
   1100101
   1110000
   1010000
  11101101
  10100101
  11000101
  10010000
 110011011
 101101101
 001101101
 010011011
  00010000
  01000101
  00100101
  00011011
   0110000
   0000101
   0101101
    010101
    001101
     00000
     01011
      0011
       001

Super Moving Blocks

Super Moving Blocks is almost the same as Moving Blocks HQ but it operates in 6Y5UV format (i.e. 6 bits per luma component and chroma components are 5 bits each). As the result the codebook for luma deltas has changed and masks in prediction are now 0x3F. The new codebook:

         10
        111
       1101
      11001
      11100
      11000
     110001
     110100
     110000
    1100001
    1101100
    1010000
   11000001
   11001100
   11101000
  110100001
  110001100
  111010100
  110010100
  110010000
 1010100001
 1101000001
 1101001100
 1010010100
 1100010100
10101000001
00101000001
11010001100
10101001100
00101001100
10010010100
11000010100
11010010000
01010010000
11100010000
01100010000
10000010100
00000010100
01000010100
00010010100
01010001100
 0010010000
 0100010000
 0100010100
 0010001100
 0010100001
  000010000
  011010100
  001001100
  001000001
   01101000
   01010100
   00001100
   00100001
    0101000
    0101100
    0000001
     001000
     010001
      00000
      00100
      01001
       0101
        011

LinePack

This codec takes 16-bit little-endian words for input and outputs 15-bit RGB or YUV.

If top bit is not set the word is pixel value, otherwise bits 12-14 signal the operation and low 12 bits (with some exceptions) transmit number of pixels to perform the operation on (e.g. run or skip length).

Known operations are:

  • 0 -- leave pixels unchanged from the previous frame;
  • 1 -- motion: bits 0-2 are horizontal motion component plus four, bits 3-5 are vertical motion component plus four, bits 6-11 are operation length. Zero displacement means copying pixels from the line above, other values denote an offset in the previous frame;
  • 2 -- run. Next 16-bit word is run value;
  • 3 -- raw pixels (16-bit values are transmitted in the following bytes);
  • 4 -- four-colour pattern. Next four 16-bit words are four colours, the following 16-bit words contain 2-bit colour indices for the pixels (LSB first);
  • 5 -- pixel pair run. The following two 16-bit words are two colours that should be repeated the specified number of times.

Movie 16:3

This codec codes 4x4 blocks in RGB555 format using 16-bit control words (though if pixel value is stored in control word, blue component there has only 4 bits). Two top bits specify operation:

  • 0 -- fill block with the pixel value from the low bits;
  • 1 -- copy block from previous frame with displacement. Horizontal displacement is stored in bits 0-4 (plus sign in bit 10), vertical displacement is stored in bits 5-9 (plus sign in bit 11);
  • 2 -- patterned fill. Low 14 bits from the control word are the first colour value, low 15 bits from the next word are the second colour value. If top bit on the second word is not set, read 16-bit mask word and fill the block with those two colours; if top bit is set, another pixel is read -- if its top bit is not set, this is a raw tile and 13 more pixels need to be read, otherwise read 5 more pixels and 16-bit mask and do two-colour 2x2 block patterned fill like in Microsoft Video 1;
  • 3 -- paint block with three colours. For that another 16-bit word is read, top 2 bits are used for paint mode, low 14 bits are pixel value. The third colour is an average of those two colours. The patterns are ('1' mean interpolated colour):
  0 1 1 2    0 0 1 1    0 0 0 0    1 1 0 0
  0 1 1 2    0 1 1 1    1 1 1 1    1 1 1 0
  0 1 1 2    1 1 1 2    1 1 1 1    2 1 1 1
  0 1 1 2    1 1 2 2    2 2 2 2    2 2 1 1

PC Games That Use RPL Files