diff options
-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]; |