Solving Problems Caused by Half-Lines
Some video decoders output a half line of meaningless data at the beginning of the even field. If this extra line is written to the frame buffer, the resulting image will appear garbled. In some cases, the video-port hardware is capable of sensing and discarding this data before writing it to the frame buffer.
You can determine if a video port is capable of discarding this data when retrieving connection information with the IDDVideoPortContainer::GetVideoPortConnectInfo method. If the video port cannot discard half-lines, the DDVPCONNECT_HALFLINE flag will be specified in the dwFlags member of the associated DDVIDEOPORTCONNECT structure for each supported connection.
If the video port is unable to discard half-lines, you have two options: you can discard one of the fields, or you can work around the hardware's limitations by making some adjustments in how you create the video-port object and display images with the target overlay surface.
Here is how to work around the problem. When creating the video-port object by calling the IDDVideoPortContainer::CreateVideoPort method, include the DDVPCONNECT_INVERTPOLARITY flag in the dwFlags member of the associated DDVIDEOPORTCONNECT structure. This causes the video port to invert the polarity of the fields in the video stream, treating even fields like odd fields and vice versa. Once reversed, the half-line preceding even fields will be written to the frame buffer as the first scan line of each frame. To remove the unwanted data, adjust the source rectangle of the overlay surface used to display the image down one pixel by calling the IDirectDrawVideoPort::StartVideo method with the necessary coordinates. Note that this technique requires that you allocate one extra line in the surface containing the even field.
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.