From bf1ff7dc170b9dcf9ac151170845bf8f8ea10083 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 28 Nov 2014 19:49:07 +0100 Subject: move constants to header --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 8 ++++---- ftnoir_filter_accela/ftnoir_filter_accela.h | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 656c88ec..733af902 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -16,12 +16,12 @@ FTNoIR_Filter::FTNoIR_Filter() : first_run(true) { } -static double f(double vec, double thres) +double FTNoIR_Filter::f(double vec, double thres) { - if (vec > thres*4) - return (vec - thres*4) * 600 + thres*4; + if (vec > thres*high_thres_c) + return (vec - thres*high_thres_c) * high_thres_out + thres*high_thres_c; if (vec > thres) - return (vec - thres) * 150 + thres; + return (vec - thres) * low_thres_mult + thres; return pow(vec / thres, 2.0) * thres; } diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 3abd2cf0..7d59638a 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -31,6 +31,12 @@ private: double last_output[6]; double smoothed_input[6]; Timer t; + static double f(double vec, double thres); + + static constexpr double high_thres_c = 4; + static constexpr double high_thres_out = 600; + + static constexpr double low_thres_mult = 150; }; class FilterControls: public IFilterDialog -- cgit v1.2.3