# Downsampling

(Redirected from Decimation (signal processing))

In signal processing, downsampling (or "subsampling") is the process of reducing the sampling rate of a signal. This is usually done to reduce the data rate or the size of the data.

The downsampling factor (commonly denoted by M) is usually an integer or a rational fraction greater than unity. This factor multiplies the sampling time or, equivalently, divides the sampling rate. For example, if 16-bit compact disc audio (sampled at 44,100 Hz) is downsampled to 22,050 Hz, the audio is said to be downsampled by a factor of 2. The bit rate is also reduced in half, from 1,411,200 bit/s to 705,600 bit/s, assuming that each sample retains its bit depth of 16 bits.

## Maintaining the sampling theorem criterion

Since downsampling reduces the sampling rate, it is usually a good idea to make sure the Nyquist–Shannon sampling theorem criterion is maintained relative to the new lower sample rate, to avoid aliasing in the resulting digital signal. To ensure that the sampling theorem is satisfied, or approximately so, a low-pass filter is used as an anti-aliasing filter to reduce the bandwidth of the signal before the signal is downsampled; the overall process (low-pass filter, then downsample) is sometimes called decimation.

If the original signal had been bandwidth limited, and then first sampled at a rate higher than the Nyquist rate, then the sampled signal may already have a bandwidth compliant with the requirements of the sampling theorem at the lower rate, so the downsampling can be done directly without any additional filtering. Downsampling only changes the sample rate, not the bandwidth, of the signal. The only reason to filter the bandwidth is to avoid the case where the new sample rate would become lower than the Nyquist rate and cause aliasing.

In some cases, the anti-aliasing filter can be a band-pass filter; the aliasing inherent in downsampling will then transpose a band of interest to baseband samples. A bandpass signal, i.e. a band-limited signal whose minimum frequency is different from zero, can be downsampled avoiding superposition of the spectra if certain conditions are satisfied; see undersampling.

## Downsampling by integer factor

Downsampling a sequence $\scriptstyle x[n]$ by retaining only every Mth sample creates a new sequence  $\scriptstyle y[n] = x[nM].$  If the original sequence contains normalized frequency components between $\scriptstyle 0.5/M$ and $\scriptstyle 0.5$ (cycles/sample), the downsampler should be preceded by a low-pass filter with cutoff frequency $\scriptstyle 0.5/M$.[note 1]  In this application, such an anti-aliasing filter is referred to as a decimation filter, and the combined process of filtering (convolution) and downsampling is called decimation.

The process described above would generate an output sample for every input sample, and then M-1 of every M outputs would be discarded. Such is the process for an IIR filter that relies on feedback from output to input. With FIR filtering, it is an easy matter to compute only every Mth output. The calculation performed by a decimating FIR filter for the nth output sample is a dot product:

$y[n] = \sum_{k=0}^{K-1} x[nM-k]\cdot h[k],$

where the h[•] sequence is the impulse response, and K is its length. In a general purpose processor, after computing y[n], the easiest way to compute y[n+1] is to advance the starting index in the x[•] array by M, and recompute the dot product. In a multi-processor architecture, it can be advantageous to demultiplex the x[•] sequence by a factor of M, and send the separate streams to a polyphase implementation of the filter.

## Downsampling by rational fraction

Let M/L denote the downsampling factor.

1. Upsample by a factor of L
2. Downsample by a factor of M

A proper upsampling design requires an interpolation filter after increasing the data rate and that a proper downsampling design requires a filter before eliminating some samples. These two low-pass filters can be combined into a single filter.

These two steps are generally not interchangeable. Downsampling results in a loss of data and, if performed first, could result in data loss if there is any data filtered out by the downsampler's low-pass filter. Since both interpolation and anti-aliasing filters are low-pass filters, the filter with the smallest bandwidth is more restrictive and can therefore be used in place of both filters. When the rational fraction M/L is greater than unity then L < M and the single low-pass filter should have cutoff at $\scriptstyle 0.5/M$ cycles/sample.

NOTE: Upsampling first is necessary in all cases where the rate is not an even multiple. E.g.: if a sample rate of 2x is changed to a rate of 1x by averaging every pair of samples this would be equivalent to a low pass filtering operation. But taking every other sample would be equivalent to up then down sampling in this special case where the multiple was 2 to 1, so there is no need to do an upsample first.

## Anti-aliasing filter

The simplest downsampling or decimation process is to just keep every Mth sample from the original.

According to a form of the Poisson summation formula, the discrete-time Fourier transform (DTFT) of the x[n] sequence is proportional to a periodic summation of the continuous Fourier transform, X(f), of any function, x(t), whose samples at some interval, T, equal the x[n] sequence. I.e.:

$\underbrace{ \sum_{n=-\infty}^{\infty} \overbrace{x(nT)}^{x[n]}\ e^{-i 2\pi f nT} }_{\text{DTFT}} = \frac{1}{T}\sum_{k=-\infty}^{\infty} X(f-k/T).$

When T has units of seconds, $\scriptstyle f$ has units of hertz. Setting T=1 results in a normalized DTFT, but we need the extra generality to easily see the effect of decimation. Replacing T with MT in the formulas above gives the DTFT of the decimated sequence, x[nM]:

$\sum_{n=-\infty}^{\infty} x(n\cdot MT)\ e^{-i 2\pi f n(MT)} \equiv \frac{1}{MT}\sum_{k=-\infty}^{\infty} X\left(f-\tfrac{k}{(MT)}\right).$

The periodic summation has been reduced in amplitude and periodicity by a factor of M. Aliasing occurs when adjacent copies of X(f) overlap. The purpose of the anti-aliasing filter is to ensure that the reduced periodicity does not create overlap.

## Notes

1. ^ Realizable low-pass filters have a "skirt", where the response diminishes from near unity to near zero. So in practice the cutoff frequency is placed far enough below the theoretical cutoff that the filter's skirt is contained below the theoretical cutoff.