Filters a single sample through a FIR LMS filter.
IppStatus ippsFIRLMSOne_Direct_32f(Ipp32f src, Ipp32f refVal, Ipp32f* pDstVal, Ipp32f* pTapsInv, int tapsLen, float mu, Ipp32f* pDlyLine, int* pDlyLineIndex);
IppStatus ippsFIRLMSOne_Direct32f_16s(Ipp16s src, Ipp16s refVal, Ipp16s* pDstVal, Ipp32f* pTapsInv, int tapsLen, float mu, Ipp16s* pDlyLine, int* pDlyLineIndex);
IppStatus ippsFIRLMSOne_DirectQ15_16s(Ipp16s src, Ipp16s refVal, Ipp16s* pDstVal, Ipp32s* pTapsInv, int tapsLen, int muQ15, Ipp16s* pDlyLine, int* pDlyLineIndex);
src |
Input sample to be filtered. |
pDstVal |
Pointer to the output sample. |
refVal |
Reference signal sample. |
pTapsInv |
Pointer to the array containing the FIR filter taps to be adapted. The tap values are stored in the array in the inverse order. |
tapsLen |
Number of elements in the array containing the tap values. |
pDlyLine |
Pointer to the array holding the delay line values. |
pDlyLineIndex |
Pointer to the current index of the delay line. |
mu |
Adaptation step. |
muQ15 |
Integer version adaptation step. |
The function ippsFIRLMSOne_Direct is declared in the ipps.h file. This function performs directly a single iteration of FIR filter taps adaptation. The tapsLen-length array pTapsInv contains the FIR filter taps in the inverse order. The (2*tapsLen)-length array pDlyLine specifies the delay line values. The pDlyLineIndex array specifies the current index of the delay line. The output signal is stored in pDstVal.
The adaptation error value can be computed as follows: err[n] = refVal[n] - *pDstVal.
The function ippsFIRLMSOne_Direct performs a single iteration of FIR filter taps adaptation with the mu step value. The taps are floating-point numbers.
Set the taps to zero or to values close to calculated to speed up the process.
The function ippsLMSOne_Direct is to be called within cycle with the number of iterations equal to the number of input samples. You can decide what data is to be saved as a result of adaptation: either the filtered output signal or the adaptation error.
The function ippsFIRLMSOne_DirectQ15 performs a single iteration of FIR filter taps adaptation with the muQ15 step value. The taps are integer numbers. The adaptation step muQ15 can be computed as follows:
muQ15 = (int)(mu *(1<<15)+0.5f)
The example belowExample 6-13 illustrates the use of the function ippsFIRLMSOne_Direct to adapt the FIR filter taps. After adaptation the taps are close to 1.0.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when the pointers to data arrays are NULL. |
ippStsSizeErr |
Indicates an error when tapsLen is less or equal to 0. |
IppStatus firlmsone(void) {
#define LEN 200
IppStatus st = ippStsNoErr;
Ipp32f taps = 0, dly[2] = {0};
Ipp32f x[LEN], y[LEN], mu = 0.05f;
int i, indx = 0;
/// make a const signal of amplitude 1 and noise it
for( i=0; i<LEN; ++i ) x[i] = 0.4f * rand()/RAND_MAX + 0.8f;
for( i=0; i<LEN-1 && ippStsNoErr==st; ++i )
st=ippsFIRLMSOne_Direct_32f( x[i], x[i+1], y+1+i, &taps, 1, mu,
dly, &indx );
printf_32f(“FIRLMSOne tap adapted =”, &taps, 1, st );
return st;
}
Output:
FIRLMSOne tap adapted = 0.993872
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.