# Motion Compensation

(Difference between revisions)
 Revision as of 23:18, 19 May 2007Superdump (Talk | contribs) (First edition.)← Previous diff Revision as of 23:18, 19 May 2007Superdump (Talk | contribs) Next diff → Line 4: Line 4: == Direct Prediction == == Direct Prediction == - Direct prediction offers methods for calculating motion vectors for already coded vectors to reduce the bit cost of coding B-frames and take advantage of motion coherences in different domains. There are two methods of direct prediction - spatial and temporal. + '''Direct prediction''' offers methods for calculating motion vectors for already coded vectors to reduce the bit cost of coding B-frames and take advantage of motion coherences in different domains. There are two methods of direct prediction - spatial and temporal. The '''spatial''' mode calculates motion vectors from the vectors (left, top left, top? if available?) of neighbouring blocks. Depending on the prediction method used in said neighbouring blocks, the resultant B-frame prediction mode can be one of forward, backward or interpolation. The '''spatial''' mode calculates motion vectors from the vectors (left, top left, top? if available?) of neighbouring blocks. Depending on the prediction method used in said neighbouring blocks, the resultant B-frame prediction mode can be one of forward, backward or interpolation.

## Revision as of 23:18, 19 May 2007

Motion compensation encompasses a number of methods for using predicted motion vectors to recreate pixels within a frame from past, future video frames or even the current video frame. Wikipedia has a fairly extensive article discussing and detailing some of the defined techniques.

## Direct Prediction

Direct prediction offers methods for calculating motion vectors for already coded vectors to reduce the bit cost of coding B-frames and take advantage of motion coherences in different domains. There are two methods of direct prediction - spatial and temporal.

The spatial mode calculates motion vectors from the vectors (left, top left, top? if available?) of neighbouring blocks. Depending on the prediction method used in said neighbouring blocks, the resultant B-frame prediction mode can be one of forward, backward or interpolation.

Temporal direct prediction necessarily uses the interpolation mode. The temporal mode considers the forward motion vector of the collocated block in the first list 1 reference frame.

Insert mathematical theory here. :)

Consider the following setup where we have a sequence of frames PbbbP with no reference B-frames / frame reordering:

To visualise the process, the end points of the forward motion vector remain in the same frames (starting at P2, ending at P1) but the vector is translated such that it appropriately intersects the current macroblock (in red) in the current frame (B1).

The translated vector is essentially 'split' setting the start point at the appropriate position of the current macroblock and pointing along the translated vector forward to P1 and backward to P2.