mu578 commented on code in PR #9487: URL: https://github.com/apache/nuttx/pull/9487#discussion_r1225018065
########## include/dsp.h: ########## @@ -447,6 +447,14 @@ struct pmsm_model_f32_s float iq_int; /* Iq integral part */ }; +/* Average filter */ + +struct avg_filter_data_s Review Comment: what we like to control in any filtering process that's the rolling window size, especially in lowpass filtering ; i.e that's a noise reducer. from the top of my mind ``` void sma(const int_type n, const float_type * x, const int_type p, float_type * r) { int_type i = 0, j = 0, k = 0, l = 0; if (l < (p - 1)) { l = p - 1; } if (!(l > (n - 1))) { k = l - (p - 1); i = k; if (p > 1) { while (i < l) { s += x[i++]; } } do { s += x[i++]; t = s; s -= x[k++]; r[j++] = t / p; } while (i <= (n - 1)); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org