DXVA_DeinterlaceBobDeviceClass::DeinterlaceBltEx method
The sample DeinterlaceBltEx function performs deinterlace or frame-rate conversion, combines the deinterlaced or frame-rate converted video with supplied video substreams, and writes the combined output to a destination surface.
Syntax
HRESULT DeinterlaceBltEx(
[in] REFERENCE_TIME rtTargetFrame,
[in] LPRECT lprcTargetRect,
[in] DXVA_AYUVsample2 BackgroundColor,
[in] DWORD dwDestinationFormat,
[in] DWORD dwDestinationFlags,
[in] LPDDSURFACE lpDDSDstSurface,
[in] LPDXVA_VideoSample2 lpDDSrcSurfaces,
[in] DWORD dwNumSurfaces,
[in] FLOAT fAlpha
);
Parameters
rtTargetFrame [in] Supplies the location of the output frame within the sequence of input frames. If pure deinterlacing is performed, the target time should coincide with one of the rtStart times or midpoint times (that is, (rtStart+rtEnd)/2) of a sample, as defined in the DXVA_VideoSample2 structure.
If a frame-rate conversion is requested, the rtTargetFrame time might be different from any of the rtStart times or midpoint times of the samples.
lprcTargetRect [in] Supplies a pointer to a RECT structure that describes the location within the destination surface to which DeinterlaceBltEx must write. The driver uses lprcTargetRect to determine which pixels to write to. Note that the output image is restricted to the pixels within the rectangle at lprcTargetRect. That is, every pixel within the rectangle at lprcTargetRect must be written to, and pixels outside the rectangle at lprcTargetRect must not be modified.
BackgroundColor [in] Supplies a DXVA_AYUVsample2 structure that identifies the color and opacity level of the background upon which all video stream and substreams are composed. For Microsoft Windows Server 2003 SP1 and Windows XP SP2, the opacity level is not used and should be ignored by the driver.
dwDestinationFormat [in] Supplies format information for the destination surface that is specified in the pointer at lpDDSDstSurface. For Windows Server 2003 SP1 and Windows XP SP2, this parameter is set to 0.
dwDestinationFlags [in] Supplies a collection of flags that indicate changes in the current destination surface from the previous destination surface. This parameter is a bitwise-OR of one or more of the flags in the DXVA_DestinationFlags enumeration type. You can use these flags to optimize your driver code. In other words, your code is not required to perform operations on the current destination surface if no changes have occurred from the previous destination surface.
lpDDSDstSurface [in] Supplies a pointer to the destination surface. The destination surface is an offscreen-plain surface located in video memory. The pixel format of the destination surface is specified in the d3dOutputFormat member of the DXVA_DeinterlaceCaps structure. The pixel format must be in the YUV color space.
lpDDSrcSurfaces [in] Supplies a pointer to an array of DXVA_VideoSample2 structures that describe the video source reference samples and substream samples that are required for the bit-block transfer.
dwNumSurfaces [in] Supplies the number of samples in the lpDDSrcSurfaces array.
fAlpha [in] Supplies the planar-transparency value that the driver should apply to the output destination surface image, which is a composite of background color, video stream, and video substreams. For Windows Server 2003 SP1 and Windows XP SP2, this value is always 1.0F, which indicates that the overall image is opaque and that no alpha blending on the overall image is required.
Return value
Returns 0 (S_OK or DD_OK) if successful; otherwise, returns an error code. Refer to ddraw.h for a complete list of error codes.
Remarks
The DeinterlaceBltEx function performs the deinterlace or frame-rate conversion operation and simultaneously combines supplied video substreams with the deinterlaced or frame-rate converted video. The DeinterlaceBltEx function then writes the output to the destination surface. Note that DeinterlaceBltEx can be called with a progressive video sample, in which case the driver should not perform a deinterlace operation. The driver should combine the video with the supplied video substreams and convert each stream as indicated by the lprcTargetRect and BackgroundColor paramters and the rcSrc and rcDst members of the DXVA_VideoSample2 structures in the array that is passed in the pDDSrcSurfaces parameter.
If a deinterlace mode that requires multiple reference streams is used with progressive video, the multiple frames are still sent to the driver even though those frames are not necessary to produce the output. For more information, see example 5 of Input Buffer Order.
For the reference video samples in the array that is passed in the pDDSrcSurfaces parameter, the rtStart and rtEnd members of the DXVA_VideoSample2 structure for the samples indicate the temporal location of the samples. For each video substream sample in the array, the rtStart and rtEnd members of the DXVA_VideoSample2 structure for each sample are cleared to 0.
Only video substreams with the AI44, IA44, and AYUV FOURCC pixel formats can be supplied to the driver. For more information, see Supplying Video Substream and Destination Surfaces.
For palletized video substream pixel formats, the Palette member of the DXVA_VideoSample2 structure for each video substream contains an array of 16 palette entries that the driver should use when compositing the substream sample. For nonpalletized pixel formats, the palette entries are cleared to zero and can be ignored.
The SampleFlags member of the DXVA_VideoSample2 structure for each input sample contains a collection of flags that indicate changes in the current sample from the previous sample. The flags reflect changes to the palette, color data, source rectangle, and destination rectangle of the sample. You can use these flags to optimize your driver code. In other words, your code is not required to perform operations on the current sample frame if no changes have occurred from the previous sample frame.
The dwNumSurfaces parameter indicates the number of elements in the lpDDSrcSurface array. The video reference samples are first in the array, followed by the video substreams in Z-order. For more information, see Input Buffer Order. The number of video substreams that the driver receives can range from 0 to 15. When DeinterlaceBltEx is called, the driver will typically receive 0 or 1 video substreams. However, the driver must be implemented so that it can process multiple video substreams.
The DeinterlaceBltEx function maps directly to a call to the RenderMoComp member of the DD_MOTIONCOMPCALLBACKS structure. The RenderMoComp member points to a display driver-supplied function that references the DD_RENDERMOCOMPDATA structure. The DD_RENDERMOCOMPDATA structure is filled as follows.
Member | Value |
---|---|
dwNumBuffers |
Indicates the number of entries in the array pointed to by lpBufferInfo. This number is 1 plus the number of source samples. |
lpBufferInfo |
Points to an array of DDMOCOMPBUFFERINFO structures, one for each input reference source sample or substream sample, and one for the destination sample. The destination sample is the first element of the array. |
dwFunction |
Indicates the DXVA_DeinterlaceBltExFnCode constant defined in dxva.h. |
lpInputData |
Points to a filled DXVA_DeinterlaceBltEx structure. |
lpOutputData |
Set to NULL, not currently used. |
For the DirectX VA device used for deinterlacing, the driver-supplied callback pointed to by RenderMoComp is called without calling the display driver-supplied BeginMoCompFrame or EndMoCompFrame function.
Requirements
Target platform |
Desktop |
Version |
Versions:Windows Server 2003 SP1 and later and Windows XP SP2 and later versions only. |