Share via


Motion Compensation

Motion compensation is the term for an important stage of the decoding process for compressed digital video. Many graphic accelerator devices provide some type of acceleration capability for supporting compressed video decoding. Because the motion compensation process is the most frequently supported part of video decoding, the device driver interface that supports compressed video decoding is called the motion compensation DDI. In addition to motion compensation, some devices can perform IDCT (Inverse Discrete Cosine Transformation) and other hardware functions that a software video decoder can use to accelerate the decoding process. The motion compensation DDI is flexible enough to handle devices that provide these other capabilities as well.

The input data to a software MPEG decoder is well defined. If the decoder is designed for MPEG-2, the input is in MPEG-2 format. The output of the decoder is also well defined. It is an uncompressed frame in a variety of formats. However, the interim formats between the software decoders and the display devices are not well defined, with many devices requiring their own proprietary data formats. Therefore, the motion compensation device driver interface is flexible and the interim formats are described as GUIDs. The display driver reports the GUIDs that represent the capabilities it supports, and the software decoder chooses the GUID that best matches its requirements.

To enable motion compensation functionality, the driver must perform the following steps:

  • Implement a DdGetDriverInfo function and set the GetDriverInfo member of the DD_HALINFO structure to point to this function when DrvGetDirectDrawInfo is called. The driver's DdGetDriverInfo function must parse the GUID_MotionCompCallbacks GUID.

  • Fill in a DD_MOTIONCOMPCALLBACKS structure with the appropriate driver callback pointers and callback type flags set when the DdGetDriverInfo function is called with the GUID_MotionCompCallbacks GUID. The driver must then copy this initialized structure into the Microsoft DirectDraw-allocated buffer to which the lpvData member of the DD_GETDRIVERINFODATA structure points, and return the number of bytes written into the buffer in dwActualSize.