Filters vector of samples through FIR block filter.
IppStatus ippsFIRBlockOne_32f(Ipp32f* pSrc, Ipp32f* pDst, IppsFIRBlockState_32f* pState, Ipp32f* pTaps);
pSrc |
Pointer to the input vector of samples to be filtered. |
pDst |
Pointer to the vector of filtered output samples. |
pState |
Pointer to the FIR filter state structure. |
pTaps |
Pointer to the vector of filter taps. |
This function is declared in the ippac.h header file. The function ippsFIRBlockOne filters a vector of samples pSrc of the length len through a filter and stores the result in pDst.
The filter taps are specified in the vector pTaps of the length order. The values of len and order parameters are specified in the ippsFIRBlockInitAlloc call.
In the following definition of the FIR filter, the sample of the input vector i to be filtered with the delay k is denoted xin-k, and the taps are denoted hk . The output value yi is defined by the following formula:
Before calling the function ippsFIRBlockOne, initialize the filter state by calling the function ippsFIRBlockInitAlloc. Specify the taps values in the argument pTaps.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when at least one of the specified pointers is NULL. |
ippStsContextMatchErr |
Indicates an error when the state structure is invalid. |
ippStsMisalignedBuf |
Indicates misaligned arrays. Supply aligned data for better performance. |
ippStsFIRLenErr |
Indicates an error when one of the following conditions is true: pState->len is less than or equal to 0; pState->order is less than or equal to 0; pState->queue_end is less than 0; pState->queue_end is greater or equal to pState->order. |
IppStatus fir(void)
{
#undef NUMITERS
#define NUMITERS 20
#undef BLOCKSIZE
#define BLOCKSIZE 20
int n;
int i;
IppStatus status;
IppsFIRBlockState_32f *fctx;
Ipp32f x [BLOCKSIZE], y [BLOCKSIZE];
const float taps[] = {
0.0051f, 0.0180f, 0.0591f, 0.1245f, 0.1869f, 0.2127f, 0.1869f,
0.1245f, 0.0591f, 0.0180f, 0.0051f, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
ippsFIRBlockInitAlloc_32f( &fctx, 11, BLOCKSIZE );
for (n =0;n<NUMITERS;++n)
{
for (i = 0; i< BLOCKSIZE; i++) x[i]=(Ipp32f)sin(IPP_2PI *
n *0.2 + i);
status = ippsFIRBlockOne_32f( x, y, fctx, (Ipp32f*)taps );
for (i = 0; i< BLOCKSIZE; i++)
printf("%f", y[i]);
}
ippsFIRBlockFree_32f(fctx);
return status;
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.