How to show video material in computer screen

Copyright 1997-1998 Tomi Engdahl

Different display design criterias of computer monitor and TV

Computer monitors have been optimized for reading 10-point type and static images from distance of 2 feet (around 60 cm). Typical office computer monitor howadays is 17" monitor and uses 75 Hz or higher refresh rate to give flicker free 1024x768 pixels image.

TV imagery has been optimized within the constraints of the relatively archaic National TV Systems Committee (NTSC) and Phase Alternate Line (PAL) systems. TV uses interlaced scan to generate a low resolution high brightness image. The large TV screen in designed to be viewed at distances of around 2 meters or more so low resolution and he flicker caused by slow screen refesh (50 or 60 fieds/s) is not very noticable.

TV is a very poor substitute for a PC monitor as a computer graphics display device. Standard PC display technology cannot measure up to the TV as a display device for family-room video enterteinment. TV's text display capabilities are severely limited at best even if good quality digital video flicker filtering and carefully selected fonts are used.

Why integrate computer and TV

Adapting TV picture content to the PC monitor has gained the attention of home computer makers. Of particular interrest are PC graphics display technologies which allow the computer monitor to replace the family-room TV without any degration in TV picture.

The nature of NTSC and PAL TV display format creates enormous challenges. Video made for NTSC TV is comprised of a continuous sequence of pictures (or field) at constant rate of 59.94 Hz. Each field (640x240 pixels) contains only half of the image. Each frame consists of two fiels (odd and even field). Each field within a frame are separated temporally (they represent two discrete instances in time 1/60th second apart). A full frame of NTSC video actually contains 525 lines and approximally 480 of those lines are used for video picture.

In PAL format used in most parts of Europe each video frame has total 625 lines and 576 of those lines are used for picture. The field rate of PAL video is 50 fiels/second. The picture is also interlaced like NTSC (excpet the fields are 1/50th second apart in PAL). SECAM standard used in some European countries hasl has same basic characteristics (same number of lines and same field rate).

How to get good video quality to computer screen

The native resolution of the digital video stram must be preserved throughout the process from video input to the output DAC in the computer graphics card. The video should be captured into the frame buffer at 60 field/s, with up to 720 YCrCb 4:2:2 formatted video pixels per line without any intermediate decimation or scaling.

The native video source must be converted from interlaced format to a display format that is suitable for PC's progressive-scan display without introducing any visible image glitches.

PC screen display refresh rate must be locked to the field rate of the original video source to avoid display-rate conversion artifacts.

Interlaced to non-interlaced conversion

De-interlacing is a basic requirement for video scanning format conversion. Since perfection under all circuimstances is impossible to achieve, many different algorithms to realize a good quality have been proposed. The algorithms currently in use in consumer electronics use typically Vertical-Tempora filtering, median filtering or motion compensated median filtering. Literature have described many more advanced algorithms but those are typically so much more complicated than those basic algoriths that they are too expensive to integrate to cheap consumer products like PC video cards. The following examples describe some simple deinterlacing algorithms used in computer video cards.

Store-and-read method

The conventional simplistic approach to the interlaced-to-noninterlaced conversion challenge is to capture both fields of video frame in local memory and read out both fields simultaneously to the PC display.

Deinterlacing figure

This store-and-read deinterlacer ignores the fact that individual fields visually reprent two separate instances in time. This approach causes no problems with static images but if the object were to traverse horizonally accross the screen a distorted motion occurs. This technique maintains the picture's maximum detail provided there's no motion. Even slightest object movement causes a disturbing feathering artifact. The picture below shows a typical artifact:

Artifact example picture

Line-doubling solution

The conventional line-doubling solution discards the even fields and repeats each line in the odd field. This solves the feathering artifact in movement at the cost of lower vertical resolution.

Scanline doubling operation

Artifact example picture

Beacuse scanline doubling gives very low veritcal resolution which can be annoying, usually better results can be get by using line interpolation which hides part of the vertical resolution loss. The idea is that every other scanline in the deinterlaced picture is from the video source. The lines between those are calculated by interpolating between the pixel values in scanlines above and below. Interpolation helps but, the missing clarity is still noticable especially in (near) static images. The picture below describes how this interpolation works:

Vertical interpolation operation

Artifact example picture

This line doubling method can be effectively used when video signal needs to be shown in full-screen VGA display. This scanlien doubling is first done to even fiels and this is shown on VGA screen. The the same conversion is done to odd field and this result is shown on VGA screen. This conversion makes one full VGA frame from one TV picture field field and those are shown on VGA monitor at the same rate as TV. So this means that when VGA monitor is showing TV picture it has about 31.5 kHz horizonal scan rate (double the the scanrate) and the same frame rate as TV field rate (50 Hz for PAL and 60 Hz for NTSC). Normal VGA monitor can sync to those frequencies easily. This conversion is easy to do in real time and needs a buffer for only few TV scanlines, which makes it very economic solution also. This conversion does not guarantee totally flicker free display on VGA monitor, but this conversion does not suffer from the montion artifacts caused by many frame rate conversion methods. If the conversion timing is not done very accurately this conversion can lead to problems like pixel jitter on VGA monitor picture.

Combination of store-and-read and line-doubling deinterlacing

This methods works so that the converter normally operates as store-and-read interlaced to non-interlaced converter. The converter has a built-in montion detection circuit. If the motion detector detects movement in some parts of the picture those parts of picture are deinterlaced using line-doubling (with interpolation) method. This comibination of two techniques gives full resolution in static parts of images and gives no artifacts for motion where the loss of details is not so easily noticable. The disarvantage is that this method needs two different types of conversion circuits and motion detector circuitry which makes this method more complicated and expensive than other methods.

Example picture

The picture above is an example what picture might look after precessing it with combined store-and-read and filtering line-doubling methods with motion detection. The picture above is just an approximation of the process made using a normal paint program (smoothing is applied by hand to the points where motion is detected) and is just here to give you the idea of the quality of the results of the system is implemented well. Generally the vertical resolution in non-moving parts (face and background) is as good as in the original interlaced picture and the vertical resolution in moving parts of the picture (hair) lower than in the original picture.

Each field as discrete image approach

A significantly more effective approach is displaying each field of video stream as a discrete image on the display. Each field is displayed on the screen on alternating scan lines as in TV. The empty (or blank) scan lines are generated by interpolating new video pixels from the adjacent captured video lines immediately above and below the emply line. The interpolating can be done accurately by using three-tap eight phase interpolation filter on the video/grpahics controller (same basic idea as line doubling with averaging but with better filtering). In this way full 480 lines of NTSC video can be produced for each field update to the computer screen. Because each field is displayed separately then there is still some interlace flickering left in the TV picture on the monitor (like in TV) but this is not a bigger problem than when viewing normal TV.

Scaling the video material to computer screen size

If 480-line video image needs to be fitted into a 600- or 768 line display area then the required vertical offset between fields becomes noninteger value greater than one. A noninteger vertical line offset value can be achieved by implementing a weighted interpolation filtering between adjacent video lines within field rather than simple averaging.

Frame rate conversion

The field rate of the native NTSC video source is fixed at approximately 60 fields/s. PC displays are typically refreshed at rate of 70 Hz or more (is usally anything between 70Hz and 100 Hz). This difference raises two issues:

1. If same video buffer is used both the video capture and display image tearing or shearign can occur. The damage is caused because the buffer is updated at slower rate than the display refresh rate (so displayed image contains portions of different frames). Double buffering of video can solve this problem but there is still some occasional stilted montion caused by periodic replication of video frame or field.

2. If the PC screen display should match the original video source rate then special digital frame locking techniques must be used to ensure that the screen refresh rate precisely tracks the actual field rate of original digital video. Even small mismatches in input and output image update rates will cause regular noticable hiccups in video picture motion. The most effective frame-locking technique is adaptive digital frame locking.

How video is shown in PC screen window ?

In modern PCs a typical need in modern multimedia is a need to show a TV program on computer screen window (for example inside Windows window). The mostly used techniques nowadays are graphics overlay cards and writign the video to to graphics card buffer for display.

Video overlay card technology

Overlay cards are connected between your normal VGA card monitor output and you monitor. Typically this kind of overlay cards sits inside your computer and you have a short cable from your graphics card to this overlay (TV card) and you monitor is connected to the output of this overlay card. Tho overlay card work so that most time it just passes the analogue RGB signals from the VGA card to the monitor directly. But when it want to show it's own material (the digitized video) it switches the signal form VGA card off and pushes it's own signal to VGA monitor.

This switching works so quicly that the overlay card swich it's own signal to monitor only in the small time of those video scanlines which the video playback window takes. The size and position of the video window (how many scanlines from vertical sync pulse and how much time from the horizonal sync pulse) is then programmed to the video overlay card by the driver program every time the video overlay windows parameters are changed (windows scaled, movev or turned on/off).

Some overlay cards also use overlay technique where they look at the signal from incoming VGA signal and when they detect certain predefined color they replace the vide material which was this colow with their own signal (useful when video need to be played on Windows background).

Video overlay cards are well working technology and can support full color video output even if the VGA card supports only limited number of colors (16 or 256) at the screen mode which is in use. The biggest problem in using video overlay cards is that high resolution VGA signal might get noticably less sharp when it passes though the overlay card electronics.

Writing the TV video data to graphics card memory

The technique where the data is written to the normal grapahics card memory is quite straighforward. The most traditional method is that the PC CPU keeps reading the video capture device and then copies the video data from the video capturing device to the PC grpahics card memory. The problem in this techniques is that this kind of operation will take very much processor time and usually does not give a good video window refresh rare because of all kinds of overheads in the system.

Modern PC TV cards which plug to PCI bus are quite often capable of directly writing the video data to the grpahics card memory of the card supports this. To make this work a bus-master PCI slot is required for the TV card and the VGA card must support DirectDraw 3.0 (or later) in Windows 95. When TV picture is written directly to the grpahics card memory the number of available colors is limited by the number of colors supported by the grapahics mode. Modern graphics cards with 15, 16 and 24 bit graphics modes provide whough colors for good quality video playback.

Other techniques

There are also some TV card which plug to the expansion connector of PC graphics cards. Because no expansion connector specification since VGA Feature Connector (inadequate for modern high resolution displays) have not gained wide industry acceptance this kind of products are quite rare. Typically this kind pf products are just proprietary add-on cards made by the same company as the graphics card (and work only with that specific graphics card). Those add-on cards can either write the TV video directly to the graphics card memory or they can do the overlay function in digital domain (before graphics data passses to graphics card RAMDAC).

Summary

Home-PC manufacturers face significant challenges as they prepare to do battle with consumer electronics manufacturers for a piece of the living room entertainment-equipment market. Preserving TV look and feel is critical for consumer acceptance of PC-based entertainment equipment.

Some TV cards for PCs have tried to reduce motion artifacts caused by framerate conversion process by making the TV card Windows drivers to change the Windows screen referesh rate to value where the framerate conversion (video input refresh rate vs. computer screen refresh rate) is easier to handle smoothly. I have read form Usenet Newsgroups that some cards made by Hauppauge try to change Windows screen refresh rate to 75 Hz or 100 Hz when PAL video display on computer screen is needed. For 100 Hz screen the conversion methids could be the same that are used in normal 100 Hz TVs. And for 75 Hz refresh for PAL signal (50 fields/second) could for example be impelemented using 1:2 pulldown (odd field shown once, even field twice) or some other more inttelligent method. For NTSC signals computer screen refresh rates of 60 Hz, 90 Hz and 120 Hz would give the best results.

Sources


Tomi Engdahl <Tomi.Engdahl@iki.fi>

Back VGA to TV to home page