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

ID 790148
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

FIRSparse

Filters a source vector through a sparse FIR filter.

Syntax

IppStatus ippsFIRSparse_32f(const Ipp32f* pSrc, Ipp32f* pDst, int len, IppsFIRSparseState_32f* pState);

IppStatus ippsFIRSparse_32fc(const Ipp32fc* pSrc, Ipp32fc* pDst, int len, IppsFIRSparseState_32fc* pState);

Include Files

ipps.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

Parameters

pState

Pointer to the sparse FIR filter state structure.

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

len

Number of elements that are filtered.

Description

This function applies the sparse FIR 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 nzTapsLen, their values pNZTaps and their positions pNZTapPos, and the delay line values pDlyLine - are specified in the sparse FIR filter structure pState that should be previously initialized by calling the function ippsFIRSparseInit.

In the following definition of the sparse FIR filter, the sample to be filtered is denoted x(n), the non-zero taps are denoted pNZTaps(i), their positions are denoted pNZTapPos(i) and the return value is y(n).

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



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

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 or equal to 0.

Example

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

int buflen; 
Ipp8u *buf; 
int nzTapsLen = 5; //number of non-zero taps 
Ipp32f nzTaps [] = {0.5, 0.4, 0.3, 0.2, 0.1};  //non-zero taps values 
Ipp32s nzTapsPos[] = {0, 10, 20, 30, 40};  //non-zero tap positions 
IppsFIRSparseState_32f* firState; 
Ipp32f *src, *dst;

/* ........................... */
ippsFIRSparseGetStateSize_32f(nzTapsLen, nzTapsPos [nzTapsLen - 1], &buflen); 
buf = ippsMalloc_8u(buflen); 
ippsFIRSparseInit_32f(&firState, nzTaps, nzTapsPos, nzTapsLen, NULL, buf);

/* .... initializing src somehow .... */
ippsFIRSparse_32f(src, dst, len, firState);

/*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 */

/* ...........................*/
ippsFree(buf);