Multirate Processing for Filters

The FIR design interpolation filter, like the decimation filter, has a output sampling rate that differs from the input sampling rate. Any change will be an integer of the incoming sample rate. However by using an interpolation filter combined with a decimation filter any change of sampling rate can be achieved. This is called Multirate Processing and is a very common technique used in digital signal processing, in especial narrowband filters

The decimation filter

The decimation filter is a some what trivial case since it only involves discarding the (M-1) sample for every M samples of the input signal. Thus a decimation filter from 48KHz to 24KHz (2:1) means just omitting every other sample at the output when passing through the filter.

The general decimation filter input-output relationship is given here:

FIR formula 4

The interpolation filter

The interpolation filter increases the sample rate by an integer factor. This means the output signal contains additional samples between the original input samples. In the specific case of the stereo generator in question here: The input sample rate is 48KHx from the input ADC, the output DAC uses a 192KHz sample rate, so we introduce a 1:4 interpolation filter. We use the term interpolation filter, implying there is filtering action on the samples and that is the case. Straight formward interpolation by insertion of zero samples in the output stream between the input stream samples results in alias frequencies. Thus a low pass response at the output sampling rate is required.

A CAD filter design program is essential to get this work done easily. In this case FILTERSHOP was used. This application incorporates both analogue and digital design techniques along with many filter prototype formats including interpolation filters

The general interpolation filter input-output relationship is given here:

FIR formula 5

Where w(m) = 0 to x(m/L). L is the interpolation integer

It may seem there is nothing more to be done at this stage but an additional trick has been employed in the stereo generator to reduce the DSP computation required to produce the final MPX signal in digital format. That is the use of polyphase filtering. Here the interpolation filter is split into 4 seperate filters, each with one quarter of the coefficients of the original filter. These four filter are computed simultaneously in parallel but with the resultant samples used at the output sample rate. Going back the the software deisgn we see there is a ring buffer after the interpolation filter. The output samples are placed in the ring buffer four at a time on the 48KHz driven cycle but taken out at 192KHz DAC sample rate.

The following two diagrams show this in operation.

Interpolation Filter Diagram

An efficient Interpolation Filter block diagram using N parallel channels

Here is some code for an Analog Devices SIMD Sharc DSP processor

The two audio channels are interpolate simultaneously. Each data sample is split into the 4 parallel filter streams each with an individual historical value channels. The loop computes each of the filter streams. The the four streams are re-aasembled into the four samples in a data array _audio192k. later these 4 p[acks of data are used to construct the MPX signal

Interpolation Filter Diagram

The delay lines are converted into a switch that commutes at the delay increment rate. However the generated samples do not need to be delayed at the filter, a ring buffer can be used and the samples retrieved from the ring buffer at the interpolated sample rate. Thus we save the four samples in a ring buffer and the DAC synchronises retrieval of the samples at the correct sample rate. In effect the output samples are decoupled from the input samples.

Using this approach the actual time taken to calculate the output samples is does not influence the sample retrieval rate set by the DAC. provided, of cause the time taken to generate the output samples is less than the input sample time of 20.8uS. (48KHz input sampling assumed)