1mlib_SignalNLMSFilter(3MLIBm)ediaLib Library Functionmslib_SignalNLMSFilter(3MLIB)
2
3
4
6 mlib_SignalNLMSFilter, mlib_SignalNLMSFilterInit_S16_S16, mlib_Sig‐
7 nalNLMSFilterInit_S16S_S16S, mlib_SignalNLMSFilterInit_F32_F32,
8 mlib_SignalNLMSFilterInit_F32S_F32S, mlib_SignalNLMSFilter_S16_S16_Sat,
9 mlib_SignalNLMSFilter_S16S_S16S_Sat, mlib_SignalNLMSFilter_F32_F32,
10 mlib_SignalNLMSFilter_F32S_F32S, mlib_SignalNLMSFilterNon‐
11 Adapt_S16_S16_Sat, mlib_SignalNLMSFilterNonAdapt_S16S_S16S_Sat,
12 mlib_SignalNLMSFilterNonAdapt_F32_F32, mlib_SignalNLMSFilterNon‐
13 Adapt_F32S_F32S, mlib_SignalNLMSFilterFree_S16_S16, mlib_SignalNLMSFil‐
14 terFree_S16S_S16S, mlib_SignalNLMSFilterFree_F32_F32, mlib_SignalNLMS‐
15 FilterFree_F32S_F32S - normalized least mean square (NLMS) adaptive
16 filtering
17
19 cc [ flag... ] file... -lmlib [ library... ]
20 #include <mlib.h>
21
22 mlib_status mlib_SignalNLMSFilterInit_S16_S16(void **filter,
23 const mlib_f32 *flt, mlib_s32 tap, mlib_f32 beta);
24
25
26 mlib_status mlib_SignalNLMSFilterInit_S16S_S16S(void **filter,
27 const mlib_f32 *flt, mlib_s32 tap, mlib_f32 beta);
28
29
30 mlib_status mlib_SignalNLMSFilterInit_F32_F32(void **filter,
31 const mlib_f32 *flt, mlib_s32 tap, mlib_f32 beta);
32
33
34 mlib_status mlib_SignalNLMSFilterInit_F32S_F32S(void **filter,
35 const mlib_f32 *flt, mlib_s32 tap, mlib_f32 beta);
36
37
38 mlib_status mlib_SignalNLMSFilter_S16_S16_Sat(mlib_s16 *dst,
39 const mlib_s16 *src, const mlib_s16 *ref, void *filter, mlib_s32 n);
40
41
42 mlib_status mlib_SignalNLMSFilter_S16S_S16S_Sat(mlib_s16 *dst,
43 const mlib_s16 *src, const mlib_s16 *ref, void *filter, mlib_s32 n);
44
45
46 mlib_status mlib_SignalNLMSFilter_F32_F32(mlib_f32 *dst,
47 const mlib_f32 *src, const mlib_f32 *ref, void *filter, mlib_s32 n);
48
49
50 mlib_status mlib_SignalNLMSFilter_F32S_F32S(mlib_f32 *dst,
51 const mlib_f32 *src, const mlib_f32 *ref, void *filter, mlib_s32 n);
52
53
54 mlib_status mlib_SignalNLMSFilterNonAdapt_S16_S16_Sat(mlib_s16 *dst,
55 const mlib_s16 *src, const mlib_s16 *ref, void *filter, mlib_s32 n);
56
57
58 mlib_status mlib_SignalNLMSFilterNonAdapt_S16S_S16S_Sat(mlib_s16 *dst,
59 const mlib_s16 *src, const mlib_s16 *ref, void *filter, mlib_s32 n);
60
61
62 mlib_status mlib_SignalNLMSFilterNonAdapt_F32_F32(mlib_f32 *dst,
63 const mlib_f32 *src, const mlib_f32 *ref, void *filter, mlib_s32 n);
64
65
66 mlib_status mlib_SignalNLMSFilterNonAdapt_F32S_F32S(mlib_f32 *dst,
67 const mlib_f32 *src, const mlib_f32 *ref, void *filter, mlib_s32 n);
68
69
70 void mlib_SignalNLMSFilterFree_S16_S16(void *filter);
71
72
73 void mlib_SignalNLMSFilterFree_S16S_S16S(void *filter);
74
75
76 void mlib_SignalNLMSFilterFree_F32_F32(void *filter);
77
78
79 void mlib_SignalNLMSFilterFree_F32S_F32S(void *filter);
80
81
83 The normalized LMS adaptive algorithm is summarized as follows:
84
85 1. Initialize the weights Wk(i), i = 0, 1, ..., tap - 1.
86
87 2. Initialize previous source elements Xo(i), i = 0, 1, ...,
88 tap - 1.
89
90 3. Read Xk(t) from src and Yk(t) from ref, t = 0, 1, ..., n -
91 1.
92
93 4. Compute filter output: nk = sum(Wk(i) * Xk(t - i)), i = 0,
94 1, ..., tap - 1. If i > t, use previous source elements
95 stored in the Xo vector.
96
97 5. Compute source elements power: Pwk = sum(Xk(t - i) * Xk(t -
98 i)), i = 0, 1, ..., tap - 1. If i > t, use previous source
99 elements stored in the Xo vector.
100
101 6. Store filter output : dst[t] = nk.
102
103 7. Compute the error estimate: Ek = Yk - nk.
104
105 8. Compute factor BE0 = 2 * beta * Ek / Pwk.
106
107 9. Update filter weights: Wk(i) += BE0 * Xk(t - i), i = 0, 1,
108 ..., tap - 1. If i > t, use previous source elements stored
109 in the Xo vector.
110
111 10. Next t, go to step 3.
112
113 11. Store N ending source elements in previous source elements
114 vector Xo: if N > n, N = n; else N = tap.
115
116
117 Each of the FilterInit functions allocates memory for the internal fil‐
118 ter structure and converts the parameters into the internal representa‐
119 tion.
120
121
122 Each of the Filter functions applies the NLMS adaptive filter on one
123 signal packet and updates the filter states.
124
125
126 Each of the FilterNoAdapt functions applies the NLMS filter on one sig‐
127 nal packet and updates the filter states but without changing the fil‐
128 ter weights.
129
130
131 Each of the FilterFree functions releases the memory allocated for the
132 internal filter structure.
133
135 Each of the functions takes some of the following arguments:
136
137 filter Internal filter structure.
138
139
140 flt Filter coefficient array.
141
142
143 tap Taps of the filter.
144
145
146 beta Error weighting factor. 0 < beta < 1.
147
148
149 dst Destination signal array.
150
151
152 src Source signal array.
153
154
155 ref Reference or "desired" signal array.
156
157
158 n Number of samples in the source signal array.
159
160
162 Each of the FilterInit, Filter and FilterNonAdapt functions returns
163 MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. The Fil‐
164 terFree functions don't return anything.
165
167 See attributes(5) for descriptions of the following attributes:
168
169
170
171
172 ┌─────────────────────────────┬─────────────────────────────┐
173 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
174 ├─────────────────────────────┼─────────────────────────────┤
175 │Interface Stability │Committed │
176 ├─────────────────────────────┼─────────────────────────────┤
177 │MT-Level │MT-Safe │
178 └─────────────────────────────┴─────────────────────────────┘
179
181 mlib_SignalLMSFilter(3MLIB), attributes(5)
182
183
184
185SunOS 5.11 10 Sep 2007 mlib_SignalNLMSFilter(3MLIB)