summaryrefslogtreecommitdiffhomepage
path: root/filter-ewma2
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-04-18 08:52:34 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-04-18 08:52:34 +0200
commit7df7c40a5d5eaed89fb89445348c3c7cdc8632e9 (patch)
tree49633cc6d74f4f46bb1cd9057570c6b34baa64db /filter-ewma2
parent39acca95501fa7b0d77f8e6d2cbf97f45cff4ebf (diff)
many: use std::f{max,min} for floating-point values
Diffstat (limited to 'filter-ewma2')
-rw-r--r--filter-ewma2/ftnoir_filter_ewma2.cpp4
-rw-r--r--filter-ewma2/ftnoir_filter_ewma2_dialog.cpp3
2 files changed, 2 insertions, 5 deletions
diff --git a/filter-ewma2/ftnoir_filter_ewma2.cpp b/filter-ewma2/ftnoir_filter_ewma2.cpp
index 687b5589..c79596ef 100644
--- a/filter-ewma2/ftnoir_filter_ewma2.cpp
+++ b/filter-ewma2/ftnoir_filter_ewma2.cpp
@@ -51,7 +51,7 @@ void ewma::filter(const double *input, double *output)
const double smoothing_scale_curve = static_cast<slider_value>(s.kSmoothingScaleCurve);
// min/max smoothing .01->1
const double min_smoothing = static_cast<slider_value>(s.kMinSmoothing);
- const double max_smoothing = std::max(min_smoothing, static_cast<slider_value>(s.kMaxSmoothing).cur());
+ const double max_smoothing = std::fmax(min_smoothing, static_cast<slider_value>(s.kMaxSmoothing));
// Calculate the new camera position.
for (int i=0;i<6;i++)
@@ -65,7 +65,7 @@ void ewma::filter(const double *input, double *output)
double noise = last_delta[i]*last_delta[i];
last_noise[i] = noise_alpha*noise + (1.0-noise_alpha)*last_noise[i];
// Normalise the noise between 0->1 for 0->9 variances (0->3 stddevs).
- double norm_noise = last_noise[i] < 1e-10 ? 0 : std::min<double>(noise/(9.0*last_noise[i]), 1.0);
+ double norm_noise = last_noise[i] < 1e-10 ? 0 : std::fmin(noise/(9.0*last_noise[i]), 1.0);
// Calculate the smoothing 0.0->1.0 from the normalized noise.
double smoothing = 1.0 - pow(norm_noise, smoothing_scale_curve);
double RC = (min_smoothing + smoothing*(max_smoothing - min_smoothing));
diff --git a/filter-ewma2/ftnoir_filter_ewma2_dialog.cpp b/filter-ewma2/ftnoir_filter_ewma2_dialog.cpp
index 5372767d..ad07737b 100644
--- a/filter-ewma2/ftnoir_filter_ewma2_dialog.cpp
+++ b/filter-ewma2/ftnoir_filter_ewma2_dialog.cpp
@@ -20,9 +20,6 @@ dialog_ewma::dialog_ewma()
connect(ui.minSmooth, &QSlider::valueChanged, this, &dialog_ewma::update_labels);
connect(ui.maxSmooth, &QSlider::valueChanged, this, &dialog_ewma::update_labels);
- using std::min;
- using std::max;
-
connect(ui.minSmooth, &QSlider::valueChanged, this,
[&](int v) -> void { if (ui.maxSmooth->value() < v) ui.maxSmooth->setValue(v); });