summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-11-28 19:49:07 +0100
committerStanislaw Halik <sthalik@misaki.pl>2014-11-28 19:49:07 +0100
commitbf1ff7dc170b9dcf9ac151170845bf8f8ea10083 (patch)
tree994a38328f3abc84d0cf4609a9732b340a1c4b11
parentcd2ef7b3b610eeb349be6cc9646828e2d1c6e247 (diff)
move constants to header
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp8
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.h6
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