Content-type: text/html Man page of mlib_SignalLMSFilter

mlib_SignalLMSFilter

Section: mediaLib Library Functions (3MLIB)
Updated: 2 Mar 2007
Index Return to Main Contents
 

NAME

mlib_SignalLMSFilter, mlib_SignalLMSFilterInit_S16_S16, mlib_SignalLMSFilterInit_S16S_S16S, mlib_SignalLMSFilterInit_F32_F32, mlib_SignalLMSFilterInit_F32S_F32S, mlib_SignalLMSFilter_S16_S16_Sat, mlib_SignalLMSFilter_S16S_S16S_Sat, mlib_SignalLMSFilter_F32_F32, mlib_SignalLMSFilter_F32S_F32S, mlib_SignalLMSFilterNonAdapt_S16_S16_Sat, mlib_SignalLMSFilterNonAdapt_S16S_S16S_Sat, mlib_SignalLMSFilterNonAdapt_F32_F32, mlib_SignalLMSFilterNonAdapt_F32S_F32S, mlib_SignalLMSFilterFree_S16_S16, mlib_SignalLMSFilterFree_S16S_S16S, mlib_SignalLMSFilterFree_F32_F32, mlib_SignalLMSFilterFree_F32S_F32S - least mean square (LMS) adaptive filtering  

SYNOPSIS

cc [ flag... ] file... -lmlib [ library... ]
#include <mlib.h>

mlib_status mlib_SignalLMSFilterInit_S16_S16(void **filter,
    const mlib_f32 *flt,
    mlib_s32 tap, mlib_f32 beta);

mlib_status mlib_SignalLMSFilterInit_S16S_S16S(void **filter,
    const mlib_f32 *flt,
    mlib_s32 tap, mlib_f32 beta);

mlib_status mlib_SignalLMSFilterInit_F32_F32(void **filter,
    const mlib_f32 *flt,
    mlib_s32 tap, mlib_f32 beta);

mlib_status mlib_SignalLMSFilterInit_F32S_F32S(void **filter,
    const mlib_f32 *flt,
    mlib_s32 tap, mlib_f32 beta);

mlib_status mlib_SignalLMSFilter_S16_S16_Sat(mlib_s16 *dst,
    const mlib_s16 *src,
    const mlib_s16 *ref, void *filter, mlib_s32 n);

mlib_status mlib_SignalLMSFilter_S16S_S16S_Sat(mlib_s16 *dst, 
    const mlib_s16 *src,
    const mlib_s16 *ref, void *filter, mlib_s32 n);

mlib_status mlib_SignalLMSFilter_F32_F32(mlib_f32 *dst,
    const mlib_f32 *src,
    const mlib_f32 *ref, void *filter, mlib_s32 n);

mlib_status mlib_SignalLMSFilter_F32S_F32S(mlib_f32 *dst,
    const mlib_f32 *src,
    const mlib_f32 *ref, void *filter, mlib_s32 n);

mlib_status mlib_SignalLMSFilterNonAdapt_S16_S16_Sat(mlib_s16 *dst,
    const mlib_s16 *src, const mlib_s16 *ref,
    void *filter, mlib_s32 n);

mlib_status mlib_SignalLMSFilterNonAdapt_S16S_S16S_Sat(mlib_s16 *dst,
    const mlib_s16 *src, const mlib_s16 *ref,
    void *filter, mlib_s32 n);

mlib_status mlib_SignalLMSFilterNonAdapt_F32_F32(mlib_f32 *dst,
    const mlib_f32 *src, const mlib_f32 *ref,
    void *filter, mlib_s32 n);

mlib_status mlib_SignalLMSFilterNonAdapt_F32S_F32S(mlib_f32 *dst,
    const mlib_f32 *src, const mlib_f32 *ref,
    void *filter, mlib_s32 n);

void mlib_SignalLMSFilterFree_S16_S16(void *filter);

void mlib_SignalLMSFilterFree_S16S_S16S(void *filter);

void mlib_SignalLMSFilterFree_F32_F32(void *filter);

void mlib_SignalLMSFilterFree_F32S_F32S(void *filter);

 

DESCRIPTION

The basic LMS adaptive algorithm is summarized as follows:

1.
Initialize the weights Wk(i), i = 0, 1, ..., tap - 1.
2.
Initialize previous source elements Xo(i), i = 0, 1, ..., tap - 1.
3.
Read Xk(t) from src and Yk(t) from ref, t = 0, 1, ..., n - 1.
4.
Compute filter output: nk = sum(Wk(i) * Xk(t - i)), i = 0, 1, ..., tap - 1. If i > t, use previous source elements stored in the Xo vector.
5.
Store filter output : dst[t] = nk.
6.
Compute the error estimate: Ek = Yk - nk.
7.
Compute factor BE0 = 2 * beta * Ek.
8.
Update filter weights: Wk(i) += BE0 * Xk(t - i), i = 0, 1, ..., tap - 1. If i > t, use previous source elements stored in Xo vector.
9.
Next t, go to step 3.
10.
Store N ending source elements in previous source elements vector Xo: if N > n, N = n; else N = tap.

The functions assume that the input signal has a power maximum equal to 1. If it is not, beta should be divided by power maximum. Power maximum is calculated according to the following formula:

                     flt_len
   Power_max = MAX {  SUM  signal(n + k)**2 }
                n     k=0

It is necessary to consider the maximum of power maxima of both components as the stereo signal's power maximum.

Each of the FilterInit functions allocates memory for the internal filter structure and converts the parameters into the internal representation.

Each of the Filter functions applies the LMS adaptive filter on one signal packet and updates the filter states.

Each of the FilterNoAdapt functions applies the LMS filter on one signal packet and updates the filter states but without changing the filter weights.

Each of the FilterFree functions releases the memory allocated for the internal filter structure.  

PARAMETERS

Each of the functions takes some of the following arguments:

filter

Internal filter structure.

flt

Filter coefficient array.

tap

Taps of the filter.

beta

Error weighting factor. 0 < beta < 1.

dst

Destination signal array.

src

Source signal array.

ref

Reference or "desired" signal array.

n

Number of samples in the source signal array.

 

RETURN VALUES

Each of the FilterInit, Filter and FilterNonAdapt functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. The FilterFree functions don't return anything.  

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE

Interface StabilityCommitted

MT-Level

 

SEE ALSO

mlib_SignalNLMSFilter(3MLIB), attributes(5)


 

Index

NAME
SYNOPSIS
DESCRIPTION
PARAMETERS
RETURN VALUES
ATTRIBUTES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 02:37:54 GMT, October 02, 2010