Partager via


Loading an AYUV Alpha-Blending Surface

An AYUV alpha-blending surface is defined as an array of samples of 32 bits each in the DXVA_AYUVsample2 structure. This surface can be used as the source for blending a graphic with decoded video pictures.

The width and height of the AYUV alpha-blending surface are specified in the associated buffer description list.

Loading a 16-Entry YUV Palette

A 16-entry YUV palette is defined as an array of 16 DXVA_AYUVsample2 structures. This palette is used along with an IA44 or AI44 alpha-blending surface. The palette array is sent to the accelerator in an AYUV alpha-blending sample buffer (buffer type 8). In this case, the bSampleAlpha8 member of the DXVA_AYUVsample2 structure for each sample has no meaning and must be zero.

The YUV palette can be used to create the source for blending a graphic with decoded video pictures. This palette can be used to create the graphic source along with either

  • An IA44/AI44 alpha-blending surface, or

  • A DPXD alpha-blending surface, a highlight buffer, and DCCMD data

Loading an AYUV Surface

Rather than loading just a 16-entry palette, an entire image graphic can simply be loaded directly as an AYUV image to specify the graphic content. In this case, the AYUV graphic is sent to the accelerator in an AYUV alpha-blending sample buffer (buffer type 8) as specified in the DXVA_BufferDescription structure.

Loading an IA44/AI44 Alpha-Blending Surface

An index-alpha 4-4 (IA44) alpha-blending surface is defined as an array of 8-bit samples, each of which is structured as a byte. This byte is referred to as DXVA_IA44sample and is defined in dxva.h. The 4 most significant bits of this byte contain an index referred to as SampleIndex4, and the 4 least significant bits of this byte contain an alpha value referred to as SampleAlpha4.

An alpha-index 4-4 (AI44) alpha-blending surface is defined as an array of 8-bit samples, each of which is structured as a byte. This byte is referred to as DXVA_AI44sample and is defined in dxva.h. The 4 most significant bits of this byte contain an alpha value referred to as SampleAlpha4 and the 4 least significant bits of this byte contain an index referred to as SampleIndex4.

The SampleIndex4 field for both DXVA_IA44sample and DXVA_AI44sample contains the index into the 16-entry palette for the sample.

The SampleAlpha4 field for both DXVA_IA44sample and DXVA_AI44sample contains the following values to specify the opacity of the sample:

  • Zero indicates that the sample is transparent (so that the palette entry for SampleIndex4 has no effect on the resulting blended picture). For a zero value of SampleAlpha4, the blend specified is to use the picture value without alteration.

  • A value of 15 indicates that the sample is opaque (so that the palette entry for SampleIndex4 completely determines the resulting blended picture).

  • Nonzero values indicate that the blend specified is found by the following expression:

((SampleAlpha4+1) X graphic_value + (15-SampleAlpha4) X picture_value + 8) >> 4

The width and height of the IA44 alpha-blending surface are specified in the associated buffer description list.