diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/NLMSCC~.c | 18 | ||||
-rw-r--r-- | src/NLMS~.c | 23 | ||||
-rw-r--r-- | src/n_CLNLMS~.c | 20 | ||||
-rw-r--r-- | src/n_CNLMS~.c | 20 |
4 files changed, 38 insertions, 43 deletions
diff --git a/src/NLMSCC~.c b/src/NLMSCC~.c index 445f82a..48f501a 100644 --- a/src/NLMSCC~.c +++ b/src/NLMSCC~.c @@ -163,7 +163,7 @@ static t_int *NLMSCC_tilde_perform(t_int *w) t_float *wmax_filt_coeff = x->x_wmax_array_mem_beg; t_float my, my_err, sum; t_float beta = x->x_beta; - t_float gamma = x->x_gamma; + t_float gammax = x->x_gamma; t_int i, j, update_counter; t_int update = x->x_update; t_int ord8=n_order&0xfffffff8; @@ -230,7 +230,7 @@ static t_int *NLMSCC_tilde_perform(t_int *w) } for(j=0; j<ord_residual; j++) // residual sum += read_in_hist[-j] * read_in_hist[-j]; // [-j] only valid for Musil's double buffer structure - sum += gamma * gamma * (float)n_order; // convert gamma corresponding to filter order + sum += gammax * gammax * (float)n_order; // convert gammax corresponding to filter order my = beta / sum;// calculate mue @@ -312,7 +312,7 @@ static void *NLMSCC_tilde_new(t_symbol *s, t_int argc, t_atom *argv) t_symbol *wmin_name; t_symbol *wmax_name; t_float beta=0.1f; - t_float gamma=0.00001f; + t_float gammax=0.00001f; if((argc >= 6) && IS_A_FLOAT(argv,0) && //IS_A_FLOAT/SYMBOL from iemlib.h @@ -324,7 +324,7 @@ static void *NLMSCC_tilde_new(t_symbol *s, t_int argc, t_atom *argv) { n_order = (t_int)atom_getintarg(0, argc, argv); beta = (t_float)atom_getfloatarg(1, argc, argv); - gamma = (t_float)atom_getfloatarg(2, argc, argv); + gammax = (t_float)atom_getfloatarg(2, argc, argv); w_name = (t_symbol *)atom_getsymbolarg(3, argc, argv); wmin_name = (t_symbol *)atom_getsymbolarg(4, argc, argv); wmax_name = (t_symbol *)atom_getsymbolarg(5, argc, argv); @@ -334,10 +334,10 @@ static void *NLMSCC_tilde_new(t_symbol *s, t_int argc, t_atom *argv) if(beta > 2.0f) beta = 2.0f; - if(gamma < 0.0f) - gamma = 0.0f; - if(gamma > 1.0f) - gamma = 1.0f; + if(gammax < 0.0f) + gammax = 0.0f; + if(gammax > 1.0f) + gammax = 1.0f; if(n_order < 2) n_order = 2; @@ -353,7 +353,7 @@ static void *NLMSCC_tilde_new(t_symbol *s, t_int argc, t_atom *argv) x->x_n_order = n_order; x->x_update = 0; x->x_beta = beta; - x->x_gamma = gamma; + x->x_gamma = gammax; // 2 times in and one time desired_in memory allocation (history) x->x_in_hist = (t_float *)getbytes(2*x->x_n_order*sizeof(t_float)); diff --git a/src/NLMS~.c b/src/NLMS~.c index ade883e..f54efc6 100644 --- a/src/NLMS~.c +++ b/src/NLMS~.c @@ -6,11 +6,6 @@ lib iem_adaptfilt written by Markus Noisternig & Thomas Musil noisternig_AT_iem.at; musil_AT_iem.at (c) Institute of Electronic Music and Acoustics, Graz Austria 2005 */ -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - #include "m_pd.h" #include "iemlib.h" @@ -149,7 +144,7 @@ static t_int *NLMS_tilde_perform(t_int *w) t_float *w_filt_coeff = x->x_w_array_mem_beg; t_float my, my_err, sum; t_float beta = x->x_beta; - t_float gamma = x->x_gamma; + t_float gammax = x->x_gamma; t_int i, j, update_counter; t_int update = x->x_update; t_int ord8=n_order&0xfffffff8; @@ -211,7 +206,7 @@ static t_int *NLMS_tilde_perform(t_int *w) } for(j=0; j<ord_residual; j++) // residual sum += read_in_hist[-j] * read_in_hist[-j]; // [-j] only valid for Musil's double buffer structure - sum += gamma * gamma * (float)n_order; // convert gamma corresponding to filter order + sum += gammax * gammax * (float)n_order; // convert gammax corresponding to filter order my = beta / sum;// calculate mue @@ -270,7 +265,7 @@ static void *NLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) t_int i, n_order=39; t_symbol *w_name; t_float beta=0.1f; - t_float gamma=0.00001f; + t_float gammax=0.00001f; if((argc >= 4) && IS_A_FLOAT(argv,0) && //IS_A_FLOAT/SYMBOL from iemlib.h @@ -280,7 +275,7 @@ static void *NLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) { n_order = (t_int)atom_getintarg(0, argc, argv); beta = (t_float)atom_getfloatarg(1, argc, argv); - gamma = (t_float)atom_getfloatarg(2, argc, argv); + gammax = (t_float)atom_getfloatarg(2, argc, argv); w_name = (t_symbol *)atom_getsymbolarg(3, argc, argv); if(beta < 0.0f) @@ -288,10 +283,10 @@ static void *NLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) if(beta > 2.0f) beta = 2.0f; - if(gamma < 0.0f) - gamma = 0.0f; - if(gamma > 1.0f) - gamma = 1.0f; + if(gammax < 0.0f) + gammax = 0.0f; + if(gammax > 1.0f) + gammax = 1.0f; if(n_order < 2) n_order = 2; @@ -306,7 +301,7 @@ static void *NLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) x->x_n_order = n_order; x->x_update = 0; x->x_beta = beta; - x->x_gamma = gamma; + x->x_gamma = gammax; // 2 times in and one time desired_in memory allocation (history) x->x_in_hist = (t_float *)getbytes(2*x->x_n_order*sizeof(t_float)); diff --git a/src/n_CLNLMS~.c b/src/n_CLNLMS~.c index be330b6..3153c0b 100644 --- a/src/n_CLNLMS~.c +++ b/src/n_CLNLMS~.c @@ -187,7 +187,7 @@ static t_int *n_CLNLMS_tilde_perform(t_int *w) t_float *w_filt_coeff; t_float my, my_err, sum; t_float beta = x->x_beta; - t_float hgamma, gamma = x->x_gamma; + t_float hgamma, gammax = x->x_gamma; t_float hkappa, kappa = x->x_kappa; t_float hleakage, leakage = x->x_leakage; t_int i, j, k, update_counter; @@ -202,7 +202,7 @@ static t_int *n_CLNLMS_tilde_perform(t_int *w) goto n_CLNLMS_tildeperfzero;// this is Musil/Miller style } - hgamma = gamma * gamma * (float)n_order; + hgamma = gammax * gammax * (float)n_order; //hkappa = kappa * kappa * (float)n_order; hkappa = kappa; // kappa regards to energy value, else use line above @@ -271,7 +271,7 @@ static t_int *n_CLNLMS_tilde_perform(t_int *w) } for(j=0; j<ord_residual; j++) // residual sum += read_in_hist[-j] * read_in_hist[-j]; // [-j] only valid for Musil's double buffer structure - sum += hgamma; // convert gamma corresponding to filter order + sum += hgamma; // convert gammax corresponding to filter order my = beta / sum;// calculate mue my_err = my * err_sum; @@ -403,7 +403,7 @@ static void *n_CLNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) t_int n_order=39, n_io=1; t_symbol *w_name; t_float beta=0.1f; - t_float gamma=0.00001f; + t_float gammax=0.00001f; t_float kappa = 1.0f; t_float leakage = 0.99f; @@ -419,7 +419,7 @@ static void *n_CLNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) n_io = (t_int)atom_getintarg(0, argc, argv); n_order = (t_int)atom_getintarg(1, argc, argv); beta = (t_float)atom_getfloatarg(2, argc, argv); - gamma = (t_float)atom_getfloatarg(3, argc, argv); + gammax = (t_float)atom_getfloatarg(3, argc, argv); kappa = (t_float)atom_getfloatarg(4, argc, argv); leakage = (t_float)atom_getfloatarg(5, argc, argv); w_name = (t_symbol *)atom_getsymbolarg(6, argc, argv); @@ -429,10 +429,10 @@ static void *n_CLNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) if(beta > 2.0f) beta = 2.0f; - if(gamma < 0.0f) - gamma = 0.0f; - if(gamma > 1.0f) - gamma = 1.0f; + if(gammax < 0.0f) + gammax = 0.0f; + if(gammax > 1.0f) + gammax = 1.0f; if(kappa < 0.0001f) kappa = 0.0001f; @@ -466,7 +466,7 @@ static void *n_CLNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) x->x_n_order = n_order; x->x_update = 0; x->x_beta = beta; - x->x_gamma = gamma; + x->x_gamma = gammax; x->x_kappa = kappa; x->x_leakage = leakage; x->x_my_kern = (t_n_CLNLMS_tilde_kern *)getbytes(x->x_n_io*sizeof(t_n_CLNLMS_tilde_kern)); diff --git a/src/n_CNLMS~.c b/src/n_CNLMS~.c index a80c313..d1d6b51 100644 --- a/src/n_CNLMS~.c +++ b/src/n_CNLMS~.c @@ -177,7 +177,7 @@ static t_int *n_CNLMS_tilde_perform(t_int *w) t_float *w_filt_coeff; t_float my, my_err, sum; t_float beta = x->x_beta; - t_float hgamma, gamma = x->x_gamma; + t_float hgamma, gammax = x->x_gamma; t_float hkappa, kappa = x->x_kappa; t_int i, j, k, update_counter; t_int update = x->x_update; @@ -191,7 +191,7 @@ static t_int *n_CNLMS_tilde_perform(t_int *w) goto n_CNLMS_tildeperfzero;// this is Musil/Miller style } - hgamma = gamma * gamma * (float)n_order; + hgamma = gammax * gammax * (float)n_order; //hkappa = kappa * kappa * (float)n_order; hkappa = kappa;// kappa regards to energy value, else use line above @@ -260,7 +260,7 @@ static t_int *n_CNLMS_tilde_perform(t_int *w) } for(j=0; j<ord_residual; j++) // residual sum += read_in_hist[-j] * read_in_hist[-j]; // [-j] only valid for Musil's double buffer structure - sum += hgamma; // convert gamma corresponding to filter order + sum += hgamma; // convert gammax corresponding to filter order my = beta / sum;// calculate mue my_err = my * err_sum; @@ -392,7 +392,7 @@ static void *n_CNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) t_int n_order=39, n_io=1; t_symbol *w_name; t_float beta=0.1f; - t_float gamma=0.00001f; + t_float gammax=0.00001f; t_float kappa = 1.0f; if((argc >= 6) && @@ -406,7 +406,7 @@ static void *n_CNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) n_io = (t_int)atom_getintarg(0, argc, argv); n_order = (t_int)atom_getintarg(1, argc, argv); beta = (t_float)atom_getfloatarg(2, argc, argv); - gamma = (t_float)atom_getfloatarg(3, argc, argv); + gammax = (t_float)atom_getfloatarg(3, argc, argv); kappa = (t_float)atom_getfloatarg(4, argc, argv); w_name = (t_symbol *)atom_getsymbolarg(5, argc, argv); @@ -415,10 +415,10 @@ static void *n_CNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) if(beta > 2.0f) beta = 2.0f; - if(gamma < 0.0f) - gamma = 0.0f; - if(gamma > 1.0f) - gamma = 1.0f; + if(gammax < 0.0f) + gammax = 0.0f; + if(gammax > 1.0f) + gammax = 1.0f; if(kappa < 0.0001f) kappa = 0.0001f; @@ -447,7 +447,7 @@ static void *n_CNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv) x->x_n_order = n_order; x->x_update = 0; x->x_beta = beta; - x->x_gamma = gamma; + x->x_gamma = gammax; x->x_kappa = kappa; x->x_my_kern = (t_n_CNLMS_tilde_kern *)getbytes(x->x_n_io*sizeof(t_n_CNLMS_tilde_kern)); for(i=0; i<n_io; i++) |