Filters a source vector through a sparse FIR filter.
IppStatus ippsFIRSparse_32f(const Ipp32f* pSrc, Ipp32f* pDst, int len, IppsFIRSparseState_32f* pState);
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. |
The function ippsFIRSparse is declared in the ipps.h file. 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.
The example below shows how to use the sparse FIR filter functions.
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. |
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);
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.