|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
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::GetVideoPortConnectInfomethod. If the video port cannot discard half-lines, the DDVPCONNECT_HALFLINE flag will be specified in the dwFlagsmember of the associated DDVIDEOPORTCONNECTstructure 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's how to work around the problem. When creating the video-port object by calling the IDDVideoPortContainer::CreateVideoPortmethod, include the DDVPCONNECT_INVERTPOLARITY flag in the dwFlagsmember of the associated DDVIDEOPORTCONNECTstructure. 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::StartVideomethod 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 Tuesday, May 18, 2004