Duck TrueMotion 2

From MultimediaWiki
Jump to: navigation, search

Duck TrueMotion 2 relies on differential coding of samples in a YUV colorspace and coding those deltas using Huffman codes.

Codec principles

This codec operates on 4x4 blocks and employs data separation, so packed frame data is composed from these segments:

  1. luma deltas for hi-res blocks
  2. luma deltas for low-res blocks
  3. chroma deltas for hi-res blocks
  4. chroma deltas for med-res and low-res blocks
  5. values for updating whole block
  6. motion vectors
  7. block types

Each segment is compressed with own Huffman codes (Huffman tree is stored in segment header), thus gaining compression from grouping similar data.

Blocks are unpacked in this way:

         LAST 4 ELEMENTS
         |    |    |    |
         V    V    V    V
 D0 -> +d00 +d10 +d20 +d30 -> D0
 D1 -> +d01 +d11 +d21 +d31 -> D1
 D2 -> +d02 +d12 +d22 +d32 -> D2
 D3 -> +d03 +d13 +d23 +d33 -> D2
         |    |    |    |
         V    V    V    V
         LAST 4 ELEMENTS

When current block is low-res block, an average value of pair of two last elements is calculated and used instead of them. When another type of block occurs (update, motion, still) after doing operation we need to re-calculate deltas. The same applies to chroma blocks, they are just 2x2 size.

Block types:

  1. Hi-resolution block: 16 luma deltas, 8 chroma deltas
  2. Medium-resolution block: 16 luma deltas, 2 chroma deltas
  3. Low-resolution block: 4 luma deltas, 2 chroma deltas
  4. Null block: no deltas, interpolate it from last 4 elements and deltas
  5. Still block: copy data from previous frame (and update Dx)
  6. Update block: 16 luma deltas, 8 chroma deltas, all applied independently , so recalculation is needed
  7. Motion block: copy block from previous frame with offset provided by motion vector.

Frame decoding is done this way:

 read header
 unpack all segments
 for each block in frame {
   get block type from 'block types' segment
   decode corresponding block type

Games Using Duck TrueMotion 2

These software titles are known to use the Duck TrueMotion 2 video codec to encode full motion video:

Final Fantasy VII (Windows)