Motion Pixels: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
m (frame flags)
m (bitreader, reuse tables design from indeo doc)
Line 50: Line 50:
When videos with small amount of changes encoded (ex, 'talking heads' or some static scenery) special trick may be performed. Very first frame contains all the scenery, while all successive frames take this first frame as a base and add neccessary changes to it. The tricky part is, that first frame contains such a 'change-frame' as well, so you have two logical frames in one physical. Offset to the base frame is located at ('''biSizeImage''' - 4) in the encoded data buffer. Change-frame located at it's start.
When videos with small amount of changes encoded (ex, 'talking heads' or some static scenery) special trick may be performed. Very first frame contains all the scenery, while all successive frames take this first frame as a base and add neccessary changes to it. The tricky part is, that first frame contains such a 'change-frame' as well, so you have two logical frames in one physical. Offset to the base frame is located at ('''biSizeImage''' - 4) in the encoded data buffer. Change-frame located at it's start.


=== Bit Reader ===
Compressed data stored using binary stream. Bitreader operates with internal 32-bits queue and pops bits starting from the highest. '''TODO''' : Add sample


=== Decompression ===
=== Decompression ===
==== General Frame Structure ====
* Frame Flags
* Mask Block
* Motion Block
* Fill Block
* '''V2''' Extra Block
* Deltas Bundle
** Initial Position
** Color Deltas
** Huffman Tree
** Packed Deltas Indicies


==== Frame Flags ====
==== Frame Flags ====
Each frame begins with sequence of local flag bits. These bits are:
Each frame begins with sequence of local flag bits. These bits are:
# of bits Present if   Name         Description
{| border="1" cellpadding="5" style="border-collapse: collapse; border-style: dashed; border-color: #2f6fab;"
    1       always     KeyframeFlag Non-zero if this frame is a key frame (for Still-Frame mode this DOES NOT
|- bgcolor="#f0f0f0" |
                                        mean base frame change!)
! # of bits !! Present if !! Name !! Description
'''V2''' 3     flags bit 9   ColorSpace   Colorspace Format for this frame
|-
'''V2''' 1     flags bit 9   ...           ...
| 1 || always || KeyframeFlag || Non-zero if this frame is a key frame (for Still-Frame mode this DOES NOT mean base frame change!)
'''V2''' 1     flags bit 9   SmoothDeltas Use smooth delta-coding
|-
'''V2''' 1     flags bit 9   HaveSerial   (see below)
| '''V2''' 3 || flags bit 9 || ColorSpace || Colorspace Format for this frame
'''V2''' 20     flags bit 9
|-
            +HaveSerial   SerialNumber Encoder's serial number
| '''V2''' 1 || flags bit 9 || ... || ...
'''V2''' 1     flags bit 9   ...           ...
|-
'''V2''' 8     flags bit 10 ...           ...
| '''V2''' 1 || flags bit 9 || SmoothDeltas || Use smooth delta-coding
'''V2''' 8     flags bit 10 ...           ...
|-
|'''V2''' 1 || flags bit 9 || HaveSerial || (see next field)
|-
| '''V2''' 20 || flags bit 9 + HaveSerial || SerialNumber || Encoder's serial number
|-
| '''V2''' 1 || flags bit 9 || ... || ...
|-
| '''V2''' 8 || flags bit 10 || ... || ...
|-
| '''V2''' 8 || flags bit 10 || ... || ...
|}


==== Starting Pixels ====
==== Mask Block ====
==== Motion Block ====
==== Fill Block ====
==== Extra Block ====
==== Color Deltas Bundle ====
==== Color Deltas Bundle ====
==== Assembling the Frame ====
==== Assembling the Frame ====

Revision as of 15:30, 12 March 2007

Introduction

Motion Pixels version 1 (MVI1) was used in a single PC game, Treasure Quest while version 2 (MVI2) was used in a number of Movie CDs. All of these items were published by Sirius Publishing and the Motion Pixels codec is believed to still be owned by the company's CEO, Richard Gnant.

MVI belongs to the "old-school" family of video codecs and relies on interframe differences and adaptive delta-coding for horizontal lines of the picture. Delta coefficients are additionally Huffman-packed. For better compression at the cost of picture quality additional colorspace downsampling may be used. MVI2 adds smoother delta-coding and the ability to dynamically change downsampling for each frame.

Compressed MVI1 video may be carried in the custom MVI Container format.

Documentation Notes

As MVI2 version is merely an addition to MVI1, both formats will be documented together, where MVI2-specific features will be marked with V2 symbol.

MVI Codec

Compression Flags

When video is packaged inside avi files, all vital codec's parameters carried in BITMAPINFOHEADER's biCompression field of the video stream. These flag bits are:

  • 0..3 (0x000F) - Colorspace Format (see below)
  • V2 9 (0x0200) - ...
  • V2 10 (0x0400) - ...
  • 11 - (0x0800) ...
  • 12 - (0x1000) Still-Frame mode
  • 13 - (0x2000) Frames are upside-down
  • 14 - (0x4000) Video was encoded using trial version of the codec (this flag tells original decoder to put watermark to the frame)
  • 15 - (0x8000) Image is interlaced (single-field, in MP's terminology), only odd lines carried


Colorspace Formats

Output always RGB, but as an extra compression feature, source image may be initially converted to one of listed formats:

  • 0 - RGB
  • 1 - YUV 4:2:2
  • 2 - YUV 4:1:1
  • 3 - YUV 8:1:1
  • 4 - YUV 16:1:1


Normal mode VS Still-Frame mode

When videos with small amount of changes encoded (ex, 'talking heads' or some static scenery) special trick may be performed. Very first frame contains all the scenery, while all successive frames take this first frame as a base and add neccessary changes to it. The tricky part is, that first frame contains such a 'change-frame' as well, so you have two logical frames in one physical. Offset to the base frame is located at (biSizeImage - 4) in the encoded data buffer. Change-frame located at it's start.

Bit Reader

Compressed data stored using binary stream. Bitreader operates with internal 32-bits queue and pops bits starting from the highest. TODO : Add sample

Decompression

General Frame Structure

  • Frame Flags
  • Mask Block
  • Motion Block
  • Fill Block
  • V2 Extra Block
  • Deltas Bundle
    • Initial Position
    • Color Deltas
    • Huffman Tree
    • Packed Deltas Indicies

Frame Flags

Each frame begins with sequence of local flag bits. These bits are:

# of bits Present if Name Description
1 always KeyframeFlag Non-zero if this frame is a key frame (for Still-Frame mode this DOES NOT mean base frame change!)
V2 3 flags bit 9 ColorSpace Colorspace Format for this frame
V2 1 flags bit 9 ... ...
V2 1 flags bit 9 SmoothDeltas Use smooth delta-coding
V2 1 flags bit 9 HaveSerial (see next field)
V2 20 flags bit 9 + HaveSerial SerialNumber Encoder's serial number
V2 1 flags bit 9 ... ...
V2 8 flags bit 10 ... ...
V2 8 flags bit 10 ... ...

Mask Block

Motion Block

Fill Block

Extra Block

Color Deltas Bundle

Assembling the Frame

TO DO