summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-11-04 19:05:34 +0100
committerStanislaw Halik <sthalik@misaki.pl>2021-11-04 19:06:25 +0100
commit35b46547cb0be698d0f3a2c17437bad2a5067789 (patch)
treee44a0bb7c780a90b93b9892482044a04a949908d /tracker-pt
parentc99692bf76ccc6798181ec13547f45f1f8430b78 (diff)
tracker/pt: add point filter gain limiter
Diffstat (limited to 'tracker-pt')
-rw-r--r--tracker-pt/FTNoIR_PT_Controls.ui74
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp4
-rw-r--r--tracker-pt/lang/nl_NL.ts4
-rw-r--r--tracker-pt/lang/ru_RU.ts4
-rw-r--r--tracker-pt/lang/stub.ts4
-rw-r--r--tracker-pt/lang/zh_CN.ts4
-rw-r--r--tracker-pt/point-filter.cpp6
-rw-r--r--tracker-pt/pt-settings.hpp1
8 files changed, 89 insertions, 12 deletions
diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui
index edb401da..bf6cbbde 100644
--- a/tracker-pt/FTNoIR_PT_Controls.ui
+++ b/tracker-pt/FTNoIR_PT_Controls.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>420</width>
- <height>703</height>
+ <width>397</width>
+ <height>673</height>
</rect>
</property>
<property name="sizePolicy">
@@ -707,8 +707,8 @@
<property name="title">
<string>Point filter</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
+ <layout class="QGridLayout" name="gridLayout_12">
+ <item row="0" column="0">
<widget class="QCheckBox" name="enable_point_filter">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
@@ -724,7 +724,36 @@
</property>
</widget>
</item>
- <item>
+ <item row="0" column="2">
+ <widget class="QDoubleSpinBox" name="point_filter_label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ <property name="maximum">
+ <double>999.990000000000009</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Limit</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
<widget class="QSlider" name="point_filter_slider">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
@@ -749,10 +778,35 @@
</property>
</widget>
</item>
- <item>
- <widget class="QDoubleSpinBox" name="point_filter_label">
+ <item row="1" column="1">
+ <widget class="QSlider" name="point_filter_limit_slider">
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>99</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="pageStep">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QDoubleSpinBox" name="point_filter_limit_label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -767,7 +821,7 @@
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
- <double>999.990000000000009</double>
+ <double>1.000000000000000</double>
</property>
</widget>
</item>
@@ -1546,6 +1600,8 @@ Don't roll or change position.</string>
<tabstop>enable_point_filter</tabstop>
<tabstop>point_filter_slider</tabstop>
<tabstop>point_filter_label</tabstop>
+ <tabstop>point_filter_limit_slider</tabstop>
+ <tabstop>point_filter_limit_label</tabstop>
<tabstop>model_tabs</tabstop>
<tabstop>clip_tlength_spin</tabstop>
<tabstop>clip_theight_spin</tabstop>
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
index f71e13a5..6d125d92 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
@@ -121,9 +121,13 @@ TrackerDialog_PT::TrackerDialog_PT(const QString& module_name) :
tie_setting(s.enable_point_filter, ui.enable_point_filter);
tie_setting(s.point_filter_coefficient, ui.point_filter_slider);
+ tie_setting(s.point_filter_limit, ui.point_filter_limit_slider);
connect(&s.point_filter_coefficient, value_::value_changed<slider_value>(),
ui.point_filter_label, [this] { ui.point_filter_label->setValue(*s.point_filter_coefficient); } );
+ connect(&s.point_filter_limit, value_::value_changed<slider_value>(), ui.point_filter_limit_label,
+ [this] { ui.point_filter_limit_label->setValue(*s.point_filter_limit); }, Qt::QueuedConnection);
ui.point_filter_label->setValue(*s.point_filter_coefficient);
+ ui.point_filter_limit_label->setValue(*s.point_filter_limit);
}
QString TrackerDialog_PT::threshold_display_text(int threshold_value)
diff --git a/tracker-pt/lang/nl_NL.ts b/tracker-pt/lang/nl_NL.ts
index c61f7437..5b55148d 100644
--- a/tracker-pt/lang/nl_NL.ts
+++ b/tracker-pt/lang/nl_NL.ts
@@ -292,6 +292,10 @@ Don&apos;t roll or change position.</source>
<source>Enable</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Limit</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
diff --git a/tracker-pt/lang/ru_RU.ts b/tracker-pt/lang/ru_RU.ts
index 027aed6f..e53052d3 100644
--- a/tracker-pt/lang/ru_RU.ts
+++ b/tracker-pt/lang/ru_RU.ts
@@ -297,6 +297,10 @@ ROLL или X/Y-смещения.</translation>
<source>Enable</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Limit</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
diff --git a/tracker-pt/lang/stub.ts b/tracker-pt/lang/stub.ts
index 072128be..5d8e0e4a 100644
--- a/tracker-pt/lang/stub.ts
+++ b/tracker-pt/lang/stub.ts
@@ -292,6 +292,10 @@ Don&apos;t roll or change position.</source>
<source>Enable</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Limit</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
diff --git a/tracker-pt/lang/zh_CN.ts b/tracker-pt/lang/zh_CN.ts
index d3dccad5..c35a63d2 100644
--- a/tracker-pt/lang/zh_CN.ts
+++ b/tracker-pt/lang/zh_CN.ts
@@ -292,6 +292,10 @@ Don&apos;t roll or change position.</source>
<source>Enable</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Limit</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
diff --git a/tracker-pt/point-filter.cpp b/tracker-pt/point-filter.cpp
index 652c099e..49e82afb 100644
--- a/tracker-pt/point-filter.cpp
+++ b/tracker-pt/point-filter.cpp
@@ -30,8 +30,8 @@ const PointOrder& point_filter::operator()(const PointOrder& input)
return state_;
}
- constexpr f E = (f)1.75;
- constexpr f max = .25;
+ constexpr auto E = (f)1.75;
+ const f limit = (f)*s.point_filter_limit;
const f C = progn(
constexpr int A = 1'000'000;
double K = *s.point_filter_coefficient;
@@ -58,7 +58,7 @@ const PointOrder& point_filter::operator()(const PointOrder& input)
for (unsigned i = 0; i < 3; i++)
{
- f x = std::clamp(delta, (f)0, max);
+ f x = std::clamp(delta, (f)0, limit);
state_[i] += x*(input[i] - state_[i]);
}
diff --git a/tracker-pt/pt-settings.hpp b/tracker-pt/pt-settings.hpp
index 876ba573..cce2ba6b 100644
--- a/tracker-pt/pt-settings.hpp
+++ b/tracker-pt/pt-settings.hpp
@@ -70,6 +70,7 @@ struct pt_settings final : options::opts
value<bool> enable_point_filter{ b, "enable-point-filter", false };
value<slider_value> point_filter_coefficient { b, "point-filter-coefficient", { 1.0, 0, 4 } };
+ value<slider_value> point_filter_limit { b, "point-filter-limit", { 0.1, 0.01, 1 }};
explicit pt_settings(const QString& name) : opts(name) {}
};