31.6.5 mips_lms16

Description

Computes a Least Mean Squares (LMS) adaptive filter and updates its coefficients. The new coefficients are computed using the error between the last filter output and the reference signal ref. The function takes one input sample in and computes one output sample. The parameter mu controls the adaptation rate of the filter.

Include

dsplib_dsp.h

Prototype

int16
mips_lms16
(
       int16 in,
       int16 ref,
       int16 *coeffs,
       int16 *delayline,
       int16 *error,
       int16 K,
       int mu
);

Argument

in: Input value in Q15 format.

ref: Desired (reference) value in Q15 format.

coeffs: Input/output array of 16-bit fixed-point coefficients.

delayline: Delay line array holding the last K input samples.

error: Input/output value indicating the difference between the filter output and the reference value.

K: Number of coefficients (filter taps).

mu: Adaptation rate in Q15 format.

Return Value

LMS filter output value in Q15 format.

Remarks

  • The pointers coeffs and delayline must be aligned on a 4-byte boundary.
  • K must be larger than or equal to 4 and a multiple of 2.

Notes

The order of the elements of the coeffs and delayline arrays is implementation dependent. The delayline array must be initialized to zero before the first call to mips_lms16().