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

ID 790148
Date 10/31/2024
Public
Document Table of Contents

IIRSparse

Filters a source vector through a sparse IIR filter.

Syntax

IppStatus ippsIIRSparse_32f(const Ipp32f* pSrc, Ipp32f* pDst, int len, IppsIIRSparseState_32f* pState);

Include Files

ipps.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

Parameters

pState

Pointer to the sparse IIR filter state structure.

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

len

Number of elements that will be filtered.

Description

This function applies the sparse IIR filter to the len elements of the source vector pSrc, and stores the results in pDst. The filter parameters - the number of non-zero taps nzTapsLen1, nzTapsLen2, their values pNZTaps and their positions pNZTapPos, and the delay line values pDlyLine - are specified in the sparse IIR filter structure pState that should be previously initialized the function ippsIIRSparseInit.

In the following definition of the sparse IIR filter, the sample to be filtered is denoted x(n), the non-zero taps are denoted Bi and A i, their positions are denoted BPi and APi.

The non-zero taps are arranged in the array as follows:

B0, B1, . . ., BnzTapsLen1-1, A0, A1, . . ., AnzTapsLen2-1.

The non-zero tap positions are arranged in the array as follows:

BP0, BP1, . . ., BPnzTapsLen1-1, AP0, AP1, . . ., APnzTapsLen2-1, AP0 ≠ 0

The return value is y(n) is defined by the formula for a sparse IIR filter:



After the function has performed calculations, it updates the delay line values stored in the filter state structure.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error if one of the specified pointers is NULL.

ippStsSizeErr

Indicates an error if len is less than or equal to 0.

Example

The example below shows how to use the sparse IIR filter functions.

int buflen;  Ipp8u *buf;  int nzTapsLen1 = 5;	//number of non-zero taps in the FIR part of the formula  int nzTapsLen2 = 3;	//number of non-zero taps in the IIR part of the formula  Ipp32f nzTaps [] = {0.5, 0.4, 0.3, 0.2, 0.1, 0.8, 0.7, 0.6};                                                //non-zero taps values (FIR+IIR)  Ipp32s nzTapsPos[] = {0, 10, 20, 30, 40, 1, 5, 15};                                            //non-zero tap positions (FIR+IIR)  IppsIIRSparseState_32f* iirState;  Ipp32f *src, *dst; /* ............................................. */  ippsIIRSparseGetStateSize_32f(nzTapsLen1, nzTapsLen2, nzTapsPos [nzTapsLen1 - 1],                                  nzTapsPos [nzTapsLen1 + nzTapsLen2 - 1], &buflen);  buf = ippsMalloc_8u(buflen);  ippsIIRSparseInit_32f(&iirState, nzTaps, nzTapsPos, nzTapsLen1, nzTapsLen2,                         NULL, buf);  /* . . . . initializing src somehow . . . . */ ippsIIRSparse_32f(src, dst, len, iirState); /* dst[i] = src[i] * 0.5 + src[i-10] * 0.4 +  src[i-20] * 0.3 +  src[i-30] * 0.2             +  src[i-40] * 0.1 + dst[i-1] * 0.8 + dst[i-5] * 0.7 + dst[i-15] * 0.6  */ /* ................................................... */ ippsFree(buf);