REN An9765 APN 20020111
REN An9765 APN 20020111
AN9765
Rev 2.00
Designing a High Performance NTSC/PAL Decoder Aug 1, 1998
Introduction
Designing a NTSC/PAL decoder requires understanding not of operation is the most common where the quality of the
only the video standards, but also real-world video signals video signal is unknown.
and how to best deal with them. In addition, there are many
During “freeze automatic gain control” operation, the ampli-
tricks and techniques used by the pro-video market, that
tude of the video signals is multiplied by a constant. This
may now be cost-effectively implemented on a standard
constant is the value the AGC circuitry generated when the
decoder product. Vertical blanking interval (VBI) data cap-
“freeze automatic gain” command is selected.
ture is also now common, requiring understanding real-world
implications of VBI processing. During “no gain control” operation, the amplitude of the video
signal is not modified, regardless of variations in the sync
This Application Note discusses the architecture and
amplitude. Thus, a gain of 1x is always used. This mode of
features of the decoder core used in several Intersil
operation is useful when the amplitude of the active video is
NTSC/PAL decoders, such as the HMP8116 and HMP8117.
known to be correct, but the sync amplitude may be incor-
rect. The circuit must ensure the blanking level from the ADC
Analog Video Inputs
is always a specified value by adding or subtracting a DC
Standard video practice is to have the analog inputs be AC- offset to the video signal.
coupled to the video signals, with an AC and DC input
impedance of 75. During “fixed gain control” operation, the amplitude of the video
signal is multiplied by a constant, regardless of variations in the
The video signal must then be further processed to position sync amplitude. A gain of 0.5x to 4x is typically used. Limiting
the blanking level to a known value, and automatic gain con- the gain to 4x limits the amount of amplified noise. This mode of
trol done, to be able to handle real-world video signals. operation is useful when there is a correlation between the sync
Clamp Circuit amplitude and the active video amplitudes, and the video levels
are known and constant. Again, the circuit must ensure the
Since the input is AC-coupled, the clamp circuit positions the blanking level from the ADC is always a specified value by add-
video signal such that during the sync tip the ADC generates ing or subtracting a DC offset to the video signal.
a known value (in this case, a code of 0).
A/D Conversion
Automatic Gain Control (AGC)
To simplify analog anti-aliasing filters, the video data is 2x
Four types of gain control for the composite video signal (or oversampled and an internal digital anti-aliasing filter is
the Y and C signals in s-video applications) are useful: used. Since Intersil decoders use a proprietary Y/C separa-
tion algorithm, the digitized video data is then processed by
1. Automatic gain control.
an input sample rate converter.
2. Freeze automatic gain control.
Unlike many decoders, the gain circuitry and ADC operation
3. No gain control.
are designed to handle 100% color saturation without intro-
4. Fixed gain control. ducing artifacts or amplitude limiting. Many video sources
The last three modes are useful in pro-video editing applica- now contain computer-generated text and graphics, and
tions, where the quality of the video signal is known, and the highly-saturated colors may be present. Although the trans-
user wishes to optimize the video capture quality, or com- mission of video via RF modulation limits the color to 75%
pensate for variations in the signal. saturation, there is no such limit for baseband video (not RF
modulated). Thus, 100% saturated colors may be present on
Many of these modes require the determination of the blank- the outputs of settop boxes, DVD players, etc.
ing level from the ADC. To do this, the output of the ADC is
lowpass filtered to remove color subcarrier information and Input Signal Detection
noise. The back porch is sampled multiple times to deter- A nice feature is the ability to detect whether or not an input
mine the average value, and this value is averaged over video signal is present. If a video signal is detected, then
three scan lines to limit line-to-line variations. “lost”, the decoder may generate an interrupt to the system.
During “automatic gain control” operation, the AGC attenu- This allows the decoder, through software, to optionally
ates or amplifies the entire video signal to ensure that the generate a blue screen, black screen, or freeze the video
blanking level from the ADC is a specified value. This mode output timing and data.
CAPTIONING,
TELETEXT,
AND WSS CLK2
YIN
PROCESSING
YOUT DVALID
COMB Y
NTSC/PAL 1 FILTER PROCESSING
AGC ADC OUTPUT
NTSC/PAL 2 MUX Y/C P0-P15
FORMAT
SEPARATOR CHROMA CB, CR
NTSC/PAL 3/Y HSYNC
DEMOD PROCESSING
VSYNC
C AGC ADC FIELD
BLANK
SCL AGC AND VBIVALID
SDA HOST VIDEO
RESET INTERFACE TIMING
INTREQ
The blue screen option is common in consumer applications. A chroma trap filter may be used to remove any residual color
The black screen and freeze video output timing options are subcarrier from the luminance data. This is particularly useful
common in video editing to minimize editing artifacts. in PAL applications, since the performance of the comb filter
degrades due to the closeness of the Y and U/V frequency
Y/C Separation packets. The center frequency of the chroma trap is automat-
An input sample rate converter converts composite or Y/C ically determined from the video standard being decoded.
video data from the 2x sample rate to a virtual 4xFSC sample The chroma trap should be disabled during s-video operation
rate for comb filtering and demodulation. to maintain maximum luminance bandwidth. Alternately, a
Although many decoders use a comb filter, it is usually to 3MHz lowpass filter may be used to remove high-frequency Y
remove any remaining chroma from the Y signal because a rel- data, making a noisy image more pleasing to the user,
atively simple Y/C separator is used. Better decoders, such as although softer.
the HMP8116 and HMP8117, use a true comb filter to provide Coring of low-level high-frequency Y data and low-level Y data
Y/C separation. about black may be done to help reduce noise.
An improvement over standard comb filters is “adaptive comb fil- High-frequency components of the luminance signal may be
ters”. These comb filters detect the conditions under which dot “peaked” to control the sharpness of the image. Maximum gain
crawl (or “hanging dots”) occur around edges of objects, and use may be selected to occur at either 2.6MHz or the color subcarrier
a different Y/C separation algorithm to eliminate them. frequency. This may be used to make the displayed image more
High-end TVs use a 3D comb filter with motion compensation pleasing to the user. It should not be used if the output video will
for the best possible Y/C separation. However, this implemen- be compressed, as this technique introduces high-frequency
tation requires field store memory. components that will reduce the compression ratio.
The brightness control adds or subtracts a user-specified DC
Chroma Demodulation offset to the Y data, while the contrast control multiplies the Y
Demodulation, based on the Walsh-Hadamard Transform, is data by a user-specified amount. These may also be used to
done at a virtual 4xFSC sample rate, generating U and V data. make the displayed image more pleasing to the user.
The output sample rate converter converts the U and V data Finally, a value of 16 is added to generate a nominal range of
from a virtual 4xFSC sample rate to the desired output sample 16 (black) to 235 (white). Values of 0 are made 1, and values
rate (i.e., 13.5MHz). It also vertically aligns the samples based of 255 are made 254 to be BT.656 compliant.
on the horizontal sync information embedded in the digitized
video data stream. CbCr Processing
The U and V signals are then scaled and offset to generate Cb After demodulation, the CbCr data is lowpass filtered to either
and Cr data with a nominal 8-bit range of 16-240. 0.85 or 1.5MHz (selectable) to remove alias components as a
result of the demodulation process. Coring of the CbCr data may
Y Processing also be done to reduce low-level noise around zero.
The black level is subtracted from the Y data to remove sync and The saturation control, which multiplies the CbCr data by a
any blanking pedestal information. Unlike many decoders, nega- user-specified amount, may be used to make the displayed
tive values of Y are supported at this point to allow proper decod- image more pleasing to the user.
ing of “below black” luminance levels. This allows video test Many decoders have a color shift when adjusting the contrast
signals, self-keying information, and real-world video to be passed since they do not modify the CbCr gain in addition to the Y
through the decoder with minimum degradation. gain. Intersil decoders allow the contrast control to optionally
Scaling is then done to position black at 8-bit code 0 and white control the CbCr gain, implementing a true TV-like contrast
at 8-bit code 219 to match the dynamic range used by BT.601 adjustment.
and BT.656.
The hue control provides a user-specified phase offset to the color Timing Control
subcarrier during decoding. During NTSC operation, this may be
Intersil decoders, such as the HMP8116, generate HSYNC
used to correct slight hue errors due to high-frequency phase
(horizontal sync), VSYNC (vertical sync), BLANK (composite
shifts during transmission. PAL decoding uses line averaging, so
blanking), and FIELD control signals. The timing control signals
a hue control is not normally supported for PAL video.
have selectable polarity, simplifying interfacing to a wide variety
Finally, Cb and Cr values of 0 are made 1, and values of 255 of ICs. The output timing is compatible with other decoders on
are made 254 to be BT.656 compliant. the market, simplifying the system design.
Genlocking For flexibility, the BLANK output timing is programmable,
allowing the horizontal and vertical timing to be configured for
The ability to lock to a real-world video signal and recover the specific applications. Most systems expect 480 active scan
horizontal timing, vertical timing, and color subcarrier timing is lines per frame for 525/60 video systems. Therefore, during
the most difficult function of a decoder. The genlock circuits (M) NTSC and (M) PAL operation, the active scan lines
must be able to robustly handle missing and additional sync decoded should be 23-262 for odd fields, and 286-525 for even
pulses, noise, VCR head switching, VCR fast-forward and fields, resulting in 240 active lines per field. During (B, D, G, H,
reverse modes, and timing variations. I, N, NC) PAL operation, the active scan lines decoded should
Televisions are able to handle such diverse conditions by be 23-310 for odd fields, and 336-623 for even fields, resulting
adopting the rule of “never do anything quickly”. For example, in 288 active lines per field.
they wait for several lines of missing sync pulses before taking A separate VBIVALID output signal is used to indicate when
corrective action. VBI data is output onto the pixel outputs during the vertical
A chroma PLL is used to maintain chroma lock for demodula- blanking intervals. This is useful to enable GUI chips and
tion of the color information. It must be able to lock to low- ASICs to separate the video and VBI data.
amplitude color bursts (12.5% of nominal), and be able to Since the some decoders, such as the HMP8116, do not gener-
accurately regenerate the color subcarrier. ate a true line-locked clock, a DVALID (data valid) output signal
The horizontal PLL is used to track the horizontal sync pulses may be used to indicate when valid pixel data is present on the
to maintain vertical sample alignment. It must be able to handle pixel outputs. This signal is common on NTSC/PAL decoders that
missing or additional sync pulses, and line timing variations. use DSP techniques for decoding video. The major advantages of
The ability to handle line timing variations determines how well this technique are lower sample clock jitter and the ability to han-
the decoder will handle VCR video signals. dle VCR video signals more robustly.
Adaptive sync slicing (averaged over four lines) is used to BT.656 and VIP Interface
automatically determine the mid-point of the horizontal sync The BT.656 and VIP interface are rapidly gaining acceptance
amplitude for optimum horizontal PLL timing. Averaging over as standard digital video interfaces for ICs. The advantage is
several lines avoids minor line-to-line variations, and improves that the video timing information is embedded in the video
the ability to handle low-amplitude video signals. stream, reducing pin count. In addition, they support the trans-
Although not usually a true PLL, vertical timing must be recov- mission of other digital data, such as audio and VBI data
ered from the video signal. Again, the ability to handle (either “sliced” or “raw”) in the blanking intervals.
extended or missing vertical syncs determines how well the For further information on the BT.656 and VIP interface, see
decoder will handle VCR video signals. Application Notes AN9728, and AN9792.
Another PLL is commonly used to generate a line-locked sam- VBI Data Capture
ple clock, ensuring a constant number of clock cycles are gen- Most video decoders now support several types of VBI (vertical
erated each scan line. This may be done by multiplying the blanking interval) data capture. Many designs for multimedia
horizontal sync timing by a constant (such as 858 to generate PCs, settop boxes, digital VCRs, recordable DVD, and TVs
a 13.5MHz sample clock). require support for these VBI data types.
Most decoders implement a “TV/VCR” control bit that is used During (M) NTSC operation, the first possible line of VBI data is
to adjust the time constants of the PLLs. If the input video sig- lines 10 and 272, and the last possible lines are the last blanked
nal is nice and stable, the TV mode is used, and the PLL time scan lines. Lines 1-9 and 264-271 are always blanked.
constants are selected such that the genlock circuits respond
During (B, D, G, H, I, N, NC) PAL operation, the first possible
slowly to change. If the input signal is unstable, such as the
line of VBI data is lines 6 and 318, and the last possible lines
output of a VCR, the VCR mode is used, and the PLL time con-
are the last blanked scan lines. Lines 623-5 and 311-317 are
stants are changed so that the genlock circuits respond more
always blanked.
quickly to change.
During (M) PAL operation, the first possible line of VBI data is
Genlock Loss Detection lines 7 and 269, and the last possible lines are the last blanked
A nice feature is the ability to detect when genlocking to the scan lines. Lines 523-6 and 261-268 are always blanked.
input source has been lost, so the decoder may generate an When the decoder is outputting “sliced” or “raw” VBI onto the
interrupt to the system. This allows the decoder, through soft- pixel outputs, the VBIVALID output signal may be used to indi-
ware, to optionally generate a blue screen, black screen, or cate when VBI data is present. This simplifies the design of
freeze the video output timing and data. GUI chips and ASICs that are required to separate the VBI
data from the active video data.
“Sliced” VBI Data Capture Teletext. The capture of ITU-R BT.653 teletext system A, B, C,
To simplify the handling of VBI data by the host processor, and and D is rapidly becoming a common feature. Teletext allows
reduce PCI bandwidth in multimedia PC applications, a the transmission of text, graphics, and almost any other type of
decoder may generate “sliced” or binary VBI data. Once the data. NABTS (North American Broadcast Teletext
VBI data has been captured, an interrupt may be generated to Specification) is the same as BT.653 525-line system C. WST
inform the host that new VBI data has been captured. (World System Teletext) is the same as BT.653 system B.
For all the VBI data capture types discussed below, hysteresis is Many proprietary systems that use the vertical blanking interval
used to prevent the VBI decoders from rapidly turning on and off to transmit data use the teletext physical layer. Some of these
due to noise and transmission errors. In order to handle real- include Intel Intercast™, WavePhore™ WaveTop™, and Wink
world signals, the VBI decoders also compensate for DC offsets, ITV.
amplitude variations, and timing variations. Ghost cancellation The teletext decoder monitors the scan lines, looking for the
for the VBI data should also be implemented. 16-bit clock synchronization code used by teletext. If found, it
Closed Captioning. Closed captioning has been a standard locks to the clock synchronization code, the teletext data is
feature for quite some time now for decoders. The closed cap- sampled and loaded into shift registers, and the data is then
tion decoder monitors the appropriate scan lines looking for the transferred to teletext data registers.
clock run-in and start bits used by captioning. If found, it locks If the clock synchronization code is not found, it is assumed the
to the clock run-in, the caption data is sampled and loaded into scan line contains video data unless other VBI information is
shift registers, and the data is then transferred to the caption detected, such as WSS.
data registers.
“Raw” VBI Data Capture
If the clock run-in and start bits are not found, it is assumed the
“Raw” VBI data capture simply digitizes the VBI data, and out-
scan line contains video data unless other VBI information is
puts it onto the pixel outputs. Two applications for this are mul-
detected, such as teletext.
timedia PCs (software decoding of VBI data) and settop boxes
Widescreen Signalling (WSS). Widescreen signalling is a rel- (pass the VBI data on to the NTSC/PAL encoder).
atively new feature, used to indicate the aspect ratio of the pro-
One requirement while generating oversampled VBI data is
gram. This allows a WSS-enabled 16:9 TV to display the
that the “active line time” be a constant, independent on the
program to the best of its ability, or however the user specifies.
horizontal timing of the BLANK output signal. Thus, all the VBI
For PAL systems, this signal also contains the CGMS (copy
data is assured to be captured, regardless of the output resolu-
guard management system) bits.
tion of the active video data.
For further information on Widescreen Signalling, see
Application Note AN9716. Summary
The WSS decoder monitors the appropriate scan lines looking This Application Note has reviewed the basic architecture and
for the run-in and start codes used by WSS. If found, it locks to features of the Intersil NTSC/PAL decoders. By adopting vari-
the run-in code, the WSS data is sampled and loaded into shift ous output interfaces, such as VMI (Video Module Interface),
registers, and the data is then transferred to the WSS data reg- BT.656, VIP (Video Interface Port), PCI, and AGP, a high-per-
isters. formance NTSC/PAL decoder is easily designed for a wide
If the run-in and start codes are not found, it is assumed the variety of applications.
scan line contains video data unless other VBI information is
detected, such as teletext.