Texas Instruments TMS320C64X User Manual
Page 30
DSP_firlms2
4-2
4.1
Adaptive Filtering
LMS FIR
DSP_firlms2
Function
long DSP_firlms2(short * restrict h, const short * restrict x, short b, int nh)
Arguments
h[nh]
Coefficient Array
x[nh+1]
Input Array
b
Error from previous FIR
nh
Number of coefficients. Must be multiple of 4.
return long
Return value
Description
The Least Mean Square Adaptive Filter computes an update of all nh
coefficients by adding the weighted error times the inputs to the original
coefficients. The input array includes the last nh inputs followed by a new
single sample input. The coefficient array includes nh coefficients.
Algorithm
This is the C equivalent of the assembly code without restrictions. Note that
the assembly code is hand optimized and restrictions may apply.
long DSP_firlms2(short h[ ],short x[ ], short b,
int nh)
{
int i;
long r = 0;
for (i = 0; i < nh; i++) {
h[i] += (x[i] * b) >> 15;
r += x[i + 1] * h[i];
}
return r;
}
Special Requirements
-
This routine assumes 16-bit input and output.
-
The number of coefficients nh must be a multiple of 4.