Homebuilt digital video TBC/standards converter


Marcus Gunnarsson

Click any image for a large version

This project is a timebase corrector/standards converter with the following features:

This was my first big digital video project, done in 2001. I can be used for making clean copies of videotapes, or perhaps more interesting - perform standards conversion for recording NTSC Laserdiscs or DVDs onto PAL videotape.

Input section

A crucial point in the design is the input/decoder section, and the question of what ICs to use for decoding the input video to component digital video streams. The choice for this project was the Philips IC SAA7114H, new on the market at the time. This chip is basically an A/D converter that produces a digital data stream from an analog video input, but the additional features presents a veritable candy-land for anyone who has an interest in video technology! This IC accepts CVBS inputs, and does all filtering and decoding internally. It extracts sync and generates a line-locked 27 MHz master clock, H/V sync and clock gate signals. SAA7114H even provides real-time digital scaling of the video image. This is used for the 525 <-> 625 line vertical scaling needed for PAL <-> NTSC conversion.

A problem (for a soldering iron-wielding hobbyist) is the IC package. The SAA7114H comes in a LQFP100 package. This has 100 leads on a plastic square measuring 14mm along each edge. Soldering this is not easy, but it can be done.

I have designed a PCB pattern for an adapter board that converts the IC to 2.54 mm pin spacing. Feel free to download the UV mask as a PS file here:

SAA7114adapter.ps

Frame memories

The SAA7114H is configured to give a 16-bit 4:2:2 output stream, which is stored in the frame memories. These are Hitachi HM530281R's (20ns access time). These may be hard to get, as I believe that Hitachi has ceased production of RAMs. There should be substitutes for these. The HM530281R comes in a plastic package with a 0.8 mm lead pitch. This is easy to solder when comparing to the above.

Similarly to the above, here is an adapter board converting the memories to 2.54 mm pin spacing

HM530281adapter.ps

Output section

The third important building block is the video encoder, which reads out the image from the memories and recreates a crystal-stable video signal. I selected the Philips SAA7182A for this. This IC is slightly older, but has a 16-bit wide data input, which was desired here. This IC also has RGB output, which is available simultaneously with the CVBS and Y/C outputs. This means that a very sharp picture can be watched on a RGB monitor, at the same time as the CVBS signal is sent to a recording VCR.

System control and user interface

A microcontroller must be used for I2C programming of the registers in the SAA chips (of which there are a lot). I have used a PIC16F84 for this, which also is the heart of the user interface.

The PIC is connected to a Seiko 2x16 character backlighted LCD display, and four pushbutton switches, which serves as the user interface. Menus and settings are shown in the display, controlled by the switches, marked (up), (<), (>), and (menu/select).

I have realized that this microcontroller is on the small side for a project like this. The texts, data tables and code just barely fits in the 1024 word flash ROM of the PIC.

Datasheets for the above ICs are easily found on the web. I have not linked them here since the URLs often change. The SAA's are 3.3V devices, but there are no problems with connecting them to the 5V memories. By the way - why are the 3.3V voltage regulators so darned expensive? I got mine for a price around 10 times that of a 7805!

Set-up

Here is the schematic of the TBC circuit. It is hand-drawn, but fits on an A4 page:


A full-frame TBC built using (essentially) only 7 IC's - how about that?

This schematic shows the minimum circuit, for operation as a TBC for interlaced PAL->PAL or NTSC->NTSC. Of course, there are lots of extra functions that can be added, and I am leaving this up to you, in case you would lime to build something similar. In addition to the circuit shown, separate analog and digital 3.3V supplies are needed, as well as a 5V digital supply.

My present design uses four memories, and thus provides a complete frame store, or an infinite TBC window. The SAA7114H has pins that can be configured to direct the data stream to the correct (odd or even) memories, but a 74LS74 IC has been added to the output side in order to decode the odd/even field ID and select which memory pair that is output enabled.

The microcontroller holds tables of data that are written to the internal registers in the SAA devices via the I2C bus when the TBC is powered up.

When doing the NTSC-PAL conversion, this full frame store cannot be used directly, since the writing point in the memory catches up with the reading point every 1/6 seconds, losing 1/25s of video. This effect makes moving video unwatchable (although still images appear perfect). The system must then revert to the design shown above. This is easily done by software control, making the SAA7114H write to both memory pairs simultaneously. This makes the output section see a memory holding only one field.

This leads to another problem when producing an interlaced PAL signal from NTSC: Since the NTSC video is written to the memory at a speed 6/5 times the read-out speed the ordering of the odd/even lines is inverted every 5 or 6 fields. In addition to the schematic shown above, some extra logic circuits are used together with the software to fix this. The logic analyzes the timing relationship between the input and output signal, and sends a signal to the microcontroller about the current field phase. If the encoder is about to output an even field which is actually an odd field at the input, it is converted by a vertical phase shift of 1/2 line. (The SAA7114H can do arbitrary vertical phase shifts of the picture, see the datasheet.) This technique looks great for most material, although some flickering can be noted on sharp vertical edges of some objects, such as subtitles. Anyway, it gives the best results that I have been able to produce, and is perfectly adequate for VHS as target media. It is still a bit experimental, and cannot be used the other way around, i.e from PAL to NTSC. To convert interlaced signals both ways, a more advanced converter should be constructed (See below).

The freeze-frame function is enabled by a simple switch, which inhibits the WE pin of the memories. I have a toggle switch function on my TBC for this. In addition, there is a switch to control the output signal in freeze frame mode (interlace/odd/even). This is because freezing both fields with a moving picture can result in a flickering still frame. This function thus allows to switch between display of both fields, just the even field or just the odd field.

There is also a 'lock' indicator LED on the front panel. This lights up if the decoder has managed to lock onto the input signal. I have set the conditions for 'lock' to mean a complete phase lock to H-sync, V-sync and color subcarrier.

Most of the functions listed at the top are completely under software control. Of the effects, inverted video is produced by setting the contrast parameter to C0, and the Mirror image effect is produced by just setting one bit of the 7114 register set.

Operation

All important features are working fine. Watching broadcast TV through the TBC with RGB output results in a great picture, because of the comb filter. Copying a VHS tape to another VHS tape via the TBC results in a considerably better copy compared to the case of a simple cable between the VCRs. The colours in the copy are very stable, and if a good quality cassette is used, there is very little degradation in picture clarity. By the very nature of the design, disturbances such as macrovision copy protection are completely stripped from the video signal in the process. (A status byte can be read from the SAA7114H, which tells whether the input signal contains Macrovision pulses or not.) The picture quality after 525->625 conversion is good, being more or less on par with that of the Panasonic AG W-1 'world video'.

I may be leaving some details out on this page, but if you are interested in in building a similar project, and manage to solder the SAA7114H, I am sure that you are experienced enough to sort out the rest for yourself, and also that you will want to give the circuit your own custom touch. Also, most of the information you need is in the data sheets for the chips. I do not have a documented source code for the software to put on this page, but the important thing about the software is the data tables that are written to the SAA chips on power-up, via the I2C bus.

The present design is housed in a neat 19'' 1HU box. See picture at the top.

User interface features

The user interface allows flipping through (using the (<) and (>) buttons) a number of parameters that are shown on the LCD display. These are: Brightness, saturation, hue, sharpness, comb filter (on/off), chroma trap(on/off) input standard, Y/C horizontal shift, mirror image (on/off), colourbars (on/off), output standard, top cutoff, bottom cutoff (adjustable masking of top and bottom edges) and 525->625 (on/off). Selecting one of the above topics displays its current setting (in hexadecimal notation :-) ) and the (<) and (>) buttons are then used to change the value.

Back to Electronics