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

Filtering and sampling

20

My explanation describes the original sampling of an analog signal waveform. If you are more comfortable remaining in the digital domain, consider the problem of shrinking a row of image samples by a factor of n (say, n=16) to accomplish image resizing. You need to compute one output sample for each set of n input samples. This is the resampling problem in the digital domain. Its constraints are very similar to the constraints of original sampling of an analog signal.

This chapter explains how a one-dimensional signal is filtered and sampled prior to A-to-D conversion, and how it is reconstructed following D-to-A conversion. In the following chapter, Resampling, interpolation, and decimation, on page 221, I extend these concepts to conversions within the digital domain. In Image digitization and reconstruction, on page 237, I extend these concepts to the two dimensions of an image.

When a one-dimensional signal (such as an audio signal) is digitized, each sample must encapsulate, in a single value, what might have begun as a complex analog waveform during the sample period. When a

two-dimensional image is sampled, each sample encapsulates what might have begun as a potentially complex distribution of power over a small region of the image plane. In each case, a potentially large amount of information must be reduced to a single number.

Prior to sampling, detail within the sample interval must be discarded. The reduction of information prior to sampling is prefiltering. The challenge of sampling is to discard this information while avoiding the loss of information at scales larger than the sample pitch, all the time avoiding the introduction of artifacts. Sampling theory elaborates the conditions under which a signal can be sampled and accurately reconstructed, subject only to inevitable loss of detail that could not, in any event, be represented by a given number of samples in the digital domain.

Sampling theory was originally developed to describe one-dimensional signals such as audio, where the signal is a continuous function of the single dimension of

191

time. Sampling theory has been extended to images, where an image is treated as a continuous function of two spatial coordinates (horizontal and vertical).

Sampling theory can be further extended to the temporal sampling of moving images, where the third coordinate is time.

Sampling theorem

Assume that a signal to be digitized is well behaved, changing relatively slowly as a function of time. Consider the cosine signals shown in Figure 20.1 below, where the x-axis shows sample intervals. The top waveform is a cosine at the fraction 0.35 of the sampling rate fS; the middle waveform is at 0.65fS. The bottom row shows that identical samples result from sampling either of these waveforms: Either of the waveforms can masquerade as the same sample sequence. If the middle waveform is sampled, then reconstructed conventionally, the top waveform will result. This is the phenomenon of aliasing.

Symbol conventions used in this figure and following figures are as follows:

ω = fS

[rad s−1]

tS = 1 fS

cos 0.35 ω t

 

 

 

 

 

 

cos 0.65 ω t

 

 

 

 

 

 

sampled

 

 

 

 

 

 

0

1

2

3

4

5

ts

Figure 20.1 Cosine waves less than and greater than 0.5fS, in this case at the fractions 0.35 and 0.65 of the sampling rate, produce exactly the same set of sampled values when point-sampled – they alias.

192

DIGITAL VIDEO AND HD ALGORITHMS AND INTERFACES

cos 0.5 ω t

Figure 20.2 Cosine waves at exactly 0.5fS cannot be accurately represented in a sample sequence if the phase or amplitude of the sampled waveform is arbitrary.

+0°

+45°

+90°

0

1

2

3

4

5 ts

Nyquist essentially applied to signal processing a mathematical discovery made in 1915 by E.T. Whittaker. Later contributions were made by Claude Shannon (in the U.S.) and Aleksandr Kotelnikov (in Russia).

Sampling at exactly 0.5fS

You might assume that a signal whose frequency is exactly half the sampling rate can be accurately represented by an alternating sequence of sample values, say, zero and one. In Figure 20.2 above, the series of samples in the top row is unambiguous (provided it is known that the amplitude of the waveform is unity). But the samples of the middle row could be generated from any of the three indicated waveforms, and the phase-shifted waveform in the bottom row has samples that are indistinguishable from a constant waveform having a value of 0.5. The inability to accurately analyze a signal at exactly half the sampling frequency leads to the strict “less-than” condition in the sampling sheorem, which I will now describe.

Harry Nyquist, at Bell Labs, published a paper in 1928 stating that to guarantee sampling of a signal without the introduction of aliases, all of the signal’s frequency components must be contained strictly within half the sampling rate (now known as the Nyquist rate). If a signal meets this condition, it is said to satisfy the Nyquist criterion. The condition is usually

CHAPTER 20

FILTERING AND SAMPLING

193

Figure 20.3 Point sampling runs the risk of choosing an extreme value that is not representative of the neighborhood surrounding the desired sample instant.

Figure 20.4 The Box weighting function (or “boxcar”) has unity value throughout one sample interval; elsewhere, its value is zero.

Figure 20.5 Boxcar filtering weights the input waveform with the boxcar weighting function: Each output sample is the average across one sample interval.

0

1

0

-0.5

0 +0.5

t

0

0

1

2

3

4

ts

imposed by analog filtering, prior to sampling, that removes frequency components at 0.5fS and higher.

A filter must implement some sort of integration. In the example of Figure 20.1, no filtering was performed; the waveform was simply point-sampled. The lack of filtering admitted aliases. Figure 20.3 represents the waveform of an actual signal; point sampling at the indicated instants yields sample values that are not representative of the local neighborhood at each sampling instant.

Perhaps the most basic way to filter a waveform is to average the waveform across each sample period. Many different integration schemes are possible; these can be represented as weighting functions plotted as a function of time. Simple averaging uses the boxcar weighting function sketched in Figure 20.4; its value is unity during the sample period and zero outside that interval. Filtering with this weighting function is called boxcar filtering, since a sequence of these functions with different amplitudes resembles the profile of

a freight train. Once the weighted values are formed the signal is represented by discrete values, plotted for this example in Figure 20.5. To plot these values as

194

DIGITAL VIDEO AND HD ALGORITHMS AND INTERFACES

1

1+ sin 0.75 ωt

2

0.5

0

0

1

2

3

4

5

1

0.5

0

Figure 20.6 Aliasing due to boxcar filtering. The top graph shows a sine wave at 0.75fS. The shaded area under the curve illustrates its integral computed by a boxcar function. The bottom graph shows that the sequence of resulting sample points is dominated by an alias at 0.25fS.

amplitudes of a boxcar function would wrongly suggest that a boxcar function should be used as a reconstruction filter. The shading under the waveform of

Figure 20.3 suggests box filtering.

A serious problem with boxcar filtering across each sample interval is evident in Figure 20.6 above. The top graph shows a sine wave at 0.75fS; the signal exceeds the Nyquist frequency. The shaded regions show integration over intervals of one sample period. For the sine wave at 0.75fS, sampled starting at zero phase, the first two integrated values are about 0.6061; the second two are about 0.3939. The dominant component of the filtered sample sequence, shown in the bottom graph, is one-quarter of the sampling frequency. Filtering using a one-sample-wide boxcar weighting function is inadequate to attenuate signal components above the Nyquist rate. An unwanted alias results.

Figure 20.6 provides another example of aliasing: Owing to a poor presampling filter, the sequence of sampled values exhibits a frequency component not present in the input signal. As this example shows, boxcar integration is not sufficient to prevent fairly serious aliasing.

CHAPTER 20

FILTERING AND SAMPLING

195

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