Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

IIR Filter Functions

The functions described in this section initialize an infinite impulse response (IIR) filter and perform filtering. Intel IPP supports two types of filters: arbitrary order filter and biquad filter.

The figure below shows the structure of an arbitrary order IIR filter.

Structure of an Arbitrary Order Filter

Here x[n] is a sample of the input signal, y[n] is a sample of the output signal, order is the filter order, and b0, b1, . . ., b order, a1, . . ., a order are the reduced filter coefficients.

The output signal is computed by the following formula:



.

Reduced coefficients are calculated as ak = Ak/A0 and bk = Bk/A0

where A0, A 1,...Aorder, B0, B1,...Border are initial filter coefficients (taps).

A biquad IIR filter is a cascade of second-order filters. The figure below illustrates the structure of the biquad filter with k cascades of second-order filters.

Structure of a BiQuad IIR Filter

By default, all Intel IPP IIR filter functions that do not have the _DF1_ suffix in a name, use the direct form 2 (DF2) delay line. The difference between the direct form 1 (DF1) and DF2 representations of the delay line is that DF1 contains delayed values of the source and destination vectors, while DF2 is two times shorter and contains pre-calculated values based on the following code [Opp75]:

for( i = 0; i < order; i++ ){
    pDly[i] = 0;
    for( n = order - i; n > 0; n-- ){
        pDly[i] += pTaps[n+i] * pSrc[len-n]; /* b- coefficients */
    }
}
for( i = 0; i < order; i++ ){
    for( n = order - i; n > 0; n-- ){
        pDly[i] -= pTaps[order+n+i] * pDst[len-n]; /* a- coefficients */
    }
}

There is no way to transform DF2 back to DF1. Therefore, if you need DF1 output, copy the corresponding last order values of the source vector and last order values of the destination vector to DF1 buffer. Please note that the IIRSetDlyLine and IIRGetDlyLine functions get/return the delay line values also in DF2 form.

To initialize and use an IIR filter, follow this general scheme:

  1. Call ippsIIRInit to initialize the filter as an arbitrary order IIR filter in the external buffer, or ippsIIRInit_BiQuad to initialize the filter as a cascade of biquads in the external buffer. Size of the buffer can be computed by calling the functions ippsIIRGetStateSize or ippsIIRGetStateSize_BiQuad, respectively.
  2. Call ippsIIR to filter consecutive samples at once.
  3. Call ippsIIRGetDlyLine and ippsIIRSetDlyLine to get and set the delay line values in the IIR state structure.