diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-16 19:06:49 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-16 19:06:49 +0200 |
commit | 583d6d12f404f67197d7037991a57ef2a038ad4d (patch) | |
tree | 800bcf3e5a5ae9b3a4bee93e3bb384d5da06c57f | |
parent | 3e60ccda96dfada9307a0a25134475c726f1ae72 (diff) |
accela: drop NaN/+-inf values
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index ab5fda07..81ef3948 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -88,7 +88,9 @@ void FTNoIR_Filter::filter(const double* input, double *output) { Map& m = i >= 3 ? rot : trans; - smoothed_input[i] = smoothed_input[i] * (1.-alpha) + input[i] * alpha; + const bool drop = std::isnan(input[i]) || std::isinf(input[i]); + const double f = drop ? last_output[i] : input[i]; + smoothed_input[i] = smoothed_input[i] * (1.-alpha) + f * alpha; const double in = smoothed_input[i]; |