Partager via


Generating Skipped Macroblocks

The generation of a skipped macroblock in DirectX VA differs somewhat from that in MPEG-2 Video Section 7.6.6. In DirectX VA skipped macroblocks are generated in a separate macroblock control command, rather than being inferred from the type of the preceding nonskipped macroblock and the type of picture displayed (for example, in MPEG-2, the method of generating skipped macroblocks depends on whether the picture is a P picture or B picture.)

The following conditions are required when generating and using skipped macroblocks:

  • Skipped macroblocks have no residual differences.

  • Skipped macroblocks can be generated by repeating the operation of a macroblock control command with an incremented wMBaddress. (Each subsequent skipped macroblock is generated in the same way as the first, except for incrementing the value of wMBaddress.)

  • Macroblock skipping is restricted from wrapping to a new row of macroblocks in the picture. (A separate macroblock control command must be sent to generate the first macroblock of each row of macroblocks.)

  • The content of a macroblock control command with a nonzero value for MBskipsFollowing is equivalent (except for the value of MBskipsFollowing) to the content of an explicit specification of the first of the series of skipped macroblocks. Thus, whenever MBskipsFollowing is not zero, the following structure members and variables must all be equal to zero: Motion4MV, IntraMacroblock, wPatternCode, and wPC_Overflow.

Because of the first three preceding conditions, an accelerator may implement motion compensation (when Motion4MV is zero) by applying the specified motion vectors to a rectangle of width equal to the following expression in the luminance component, and to a similarly specified rectangle in the chrominance components. This rectangular-area motion compensation method can be performed by the accelerator rather than by using MBskipsFollowing+1 repetitions of the same macroblock control operation.

(bMacroblockWidthMinus1+1) X (MBskipsFollowing+1)

The bMacroblockWidthMinus1 member is contained in DXVA_PictureParameters. The MBskipsFollowing variable is in the wMBtype member of each macroblock control structure.

Skipped Macroblocks in H.263 (Annex F)

The generation of skipped macroblocks in H.263 with advanced prediction mode active (Annex F), requires representing some skipped macroblocks as nonskipped macroblocks in DirectX VA macroblock control commands. This is done in order to generate the OBMC effect within these macroblocks.

Generating Skipped Macroblocks in MPEG-2 Example

The following example shows how macroblock control commands are used when skipped macroblocks are generated. For demonstration purposes, assume that in an MPEG-2 bitstream seven macroblocks are used in the following manner.

Macroblock Number Description

0

Coded with a residual difference

1

Skipped

2

Coded with a residual difference

3

Skipped

4

Skipped

5

Skipped

6

Coded with a residual difference

These seven macroblocks would require the generation (at least) of the five DirectX VA macroblock control commands shown in the following table. The MBskipsFollowing variable indicates the number of skipped macroblocks. The wMBaddress member indicates the address of the macroblock. MBskipsFollowing and wMBaddress are contained in the DXVA_MBctrl_P_OffHostIDCT_1, and DXVA_MBctrl_P_HostResidDiff_1 structures. (The MBskipsFollowing variable is defined in the dwMB_SNL structure member.)

Macroblock Command Member Values

First

wMBaddress = 0

MBskipsFollowing = 0

Second

wMBaddress = 1

MBskipsFollowing = 0

Third

wMBaddress = 2

MBskipsFollowing = 0

Fourth

wMBaddress = 3

MBskipsFollowing = 2

Fifth

wMBaddress = 6

MBskipsFollowing = 0