Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
литература / Digital_Video_and_HD_Second_Edition_Algorithms_and_Interfaces.pdf
Скачиваний:
0
Добавлен:
13.05.2026
Размер:
38.02 Mб
Скачать

Smith, Alvy Ray (1987), “Planar 2-pass texture mapping and warping,” in Computer Graphics

21 (4): 12–19, 263–272 (July,

Proc. SIGGRAPH 87).

Bartels, Richard H., John C.

Beatty, and Brian A. Barsky (1989),

An Introduction to Splines for Use in

Computer Graphics and Geometric

Modeling (San Francisco: Morgan

Kaufmann).

Only symmetric FIR filters exhibit true linear phase. Other FIR filters exhibit very nearly linear phase, close enough to be considered to have linear phase in video and audio.

a weighted sum of four sample values, where the weights are functions of the parameter ; it returns an estimated value. (If the input samples are values of

a polynomial not exceeding the third degree, then the values produced by a cubic Lagrange interpolator are exact, within roundoff error: Lagrange interpolation “interpolates“!)

If a 2-D image array is to be resampled at arbitrary x and y coordinate values, one approach is to apply a 1-D filter along one axis, then apply a 1-D filter along the other axis. This approach treats interpolation as a separable process, akin to the separable filtering that I will introduce on page 242. Surprisingly, this two-pass approach can be used to rotate an image; see Smith, cited in the margin. Alternatively, a 2× 2 array (of

4 sample values) can be used for linear interpolation in 2 dimensions in one step – this is bilinear interpolation. A more sophisticated approach is to use a 4× 4 array (of 16 sample values) as the basis for cubic interpolation in 2 dimensions – this is bicubic interpolation. (It is mathematically comparable to 15th-degree interpolation in one dimension.)

Curves can be drawn in 2-space using a parameter u as the argument to each of two functions x(u) and y(u) that produce a 2-D coordinate pair for each value of u. Cubic polynomials can be used as x(u) and y(u). This approach can be extended to 3-space by adding a third function, z(u). Pierre Bézier developed a method, which is now widely used, to use cubic polynomials to describe curves and surfaces. Such curves are now known as Bézier curves or Bézier splines. The method is very important in the field of computer graphics; however, Bézier splines and their relatives are infrequently used in signal processing.

Lagrange interpolation as filtering

Except for having 4 taps instead of 5, Equation 21.6 has identical form to the 5-tap Gaussian filter of

Equation 20.2, on page 207! Lagrange interpolation can be viewed as a special case of FIR filtering, and can be analyzed as a filtering operation. In the previous chapter, Filtering and sampling, all of the examples were symmetric. Interpolation to produce samples exactly halfway between input samples, such as in a 2×-over-

CHAPTER 21

RESAMPLING, INTERPOLATION, AND DECIMATION

229

sampling DAC, is also symmetric. However, most interpolators are asymmetric.

There are four reasons why polynomial interpolation is generally unsuitable for video signals: Polynomial interpolation has unequal stopband ripple; nulls lie at fixed positions in the stopband; the interpolating function exhibits extreme behavior outside the central interval; and signals presented to the interpolator are somewhat noisy. I will address each of these issues in turn.

Any Lagrange interpolator has a frequency response with unequal stopband ripple, sometimes highly unequal. That is generally undesirable in signal processing, and it is certainly undesirable in video.

A Lagrange interpolator “interpolates” the original samples; this causes a magnitude frequency response that has periodic nulls (“zeros”) whose frequencies are fixed by the order of the interpolator. In order for

a filter designer to control stopband attenuation, he or she needs the freedom to place nulls judiciously. This freedom is not available in the design of a Lagrange interpolator.

Conceptually, interpolation attempts to model, with a relatively simple function, the unknown function that generated the samples. The form of the function that we use should reflect the process that underlies generation of the signal. A cubic polynomial may deliver sensible interpolated values between the two central points. However, the value of any polynomial rapidly shoots off to plus or minus infinity at arguments outside the region where it is constrained by the original sample values. That property is at odds with the behavior of signals, which are constrained to lie within a limited range of values forever (say the abstract range 0 to 1 in video, or ±0.5 in audio).

In signal processing, there is always some uncertainty in the sample values caused by noise accompanying the signal, quantization noise, and noise due to roundoff error in the calculations in the digital domain. When the source data is imperfect, it seems unreasonable to demand perfection of an interpolation function. These four issues are addressed in signal processing by using interpolation functions that are not polynomials and that do not come from classical mathematics.

230

DIGITAL VIDEO AND HD ALGORITHMS AND INTERFACES

You can consider the entire stopband of an ideal sinc filter to contain an infinity of nulls. Mathematically, the sinc function represents the limit of Lagrange interpolation as the order of the polynomial approaches infinity. See Appendix A of Smith’s

Digital Audio Resampling Home Page, cited in the margin of page 227.

The 720p60 and 1080i30 standards have an identical sampling rate (74.25 MHz). In the logic design of this example, there is a single clock domain.

Instead, we usually use interpolation functions based upon the the sinc weighting function that I introduced on page 198. In signal processing, we usually design interpolators that do not “interpolate” the original sample values.

The ideal sinc weighting function has no distinct nulls in its frequency spectrum. When sinc is truncated and optimized to obtain a physically realizable filter, the stopband has a finite number of nulls. Unlike

a Lagrange interpolator, these nulls do not have to be regularly spaced. It is the filter designer’s ability to choose the frequencies for the zeros that allows him or her to tailor the filter’s response.

Polyphase interpolators

Some video signal processing applications require upsampling at simple ratios. For example, conversion from 1280 SAL to 1920 SAL in an HD format converter requires 2:3 upsampling. An output sample is computed at one of three phases: either at the site of an input sample, or 13 or 23 of the way between input samples. The upsampler can be implemented as an FIR filter with just three sets of coefficients; the coefficients can be accessed from a lookup table addressed by .

Many interpolators involve ratios more complex than the 2:3 ratio of this example. For example, in conversion from 4fSC NTSC to BT.601 (4:2:2), 910 input samples must be converted to 858 results. This involves a downsampling ratio of 35:33. Successive output samples are computed at an increment of 1233 input samples. Every 33rd output sample is computed at the site of an input sample (0); other output samples are

computed at input sample coordinates 1233, 2433, …, 163233, 18133, 19333, …, 343133. Addressing circuitry needs to increment a sample counter by one, and a fractional numerator by 2 modulo 33 (yielding the fraction 233), at each output sample. Overflow from the fraction counter carries into the sample counter; this accounts for the missing input sample number 17 in the sample number sequence of this example. The

required interpolation phases are at fractions =0, 133, 233, 333, …, 3233 between input samples.

CHAPTER 21

RESAMPLING, INTERPOLATION, AND DECIMATION

231

In the logic design of this example, two clock domains are involved.

A straightforward approach to design of this interpolator in hardware is to drive an FIR filter at the input sample rate. At each input clock, the input sample values shift across the registers. Addressing circuitry implements a modulo-33 counter to keep track of phase – a phase accumulator. At each clock, one of

33 different sets of coefficients is applied to the filter. Each coefficient set is designed to introduce the appropriate phase shift. In this example, only 33 result samples are required every 35 input clocks: During

2 clocks of every 35, no result is produced. This structure is called a polyphase filter. This

example involves 33 phases; however, the number of taps required is independent of the number of phases. A 2×-oversampled prefilter, such I described on page 224, has just two phases. The halfband filter whose response is graphed in Figure 20.25, on page 215, would be suitable for this application; that filter has 55 taps.

Polyphase taps and phases

The number of taps required in a filter is determined by the degree of control that the designer needs to exercise over frequency response, and by how tightly the filters in each phase need to match each other. In many cases of consumer-grade video, cubic (4-tap) interpolation is sufficient. In studio video, 8 taps or more might be necessary, depending upon the performance to be achieved.

In a direct implementation of a polyphase FIR interpolator, the number of phases is determined by the arithmetic that relates the sampling rates. The number of phases determines the number of coefficient sets that need to be used. Coefficient sets are typically precomputed and stored in nonvolatile memory.

On page 231, I described a polyphase resampler having 33 phases. In some applications, the number of phases is impractically large to implement directly. This is the case for the 709379:540000 ratio required to convert from 4fSC PAL to BT.601 (4:2:2), from about 922 active samples per line to about 702. In other applications, such as digital video effects, the number of phases is variable, and unknown in advance. Applications such as these can be addressed by an interpolator having a number of phases that is a suitable power of

232

DIGITAL VIDEO AND HD ALGORITHMS AND INTERFACES

Соседние файлы в папке литература