summaryrefslogtreecommitdiff
path: root/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.cc')
-rw-r--r--ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.cc b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.cc
index da596b8..51aa4df 100644
--- a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.cc
+++ b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.cc
@@ -4,6 +4,8 @@
#include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.h"
+#include "base/logging.h"
+
namespace ui {
NeuralStylusPalmDetectionFilterModelConfig::
@@ -15,4 +17,19 @@ NeuralStylusPalmDetectionFilterModelConfig::
NeuralStylusPalmDetectionFilterModelConfig::
~NeuralStylusPalmDetectionFilterModelConfig() = default;
+
+base::TimeDelta
+NeuralStylusPalmDetectionFilterModelConfig::GetEquivalentDuration(
+ uint32_t sample_count) const {
+ if (!resample_period) {
+ LOG(DFATAL) << __func__
+ << " should only be called if resampling is enabled";
+ return base::TimeDelta::FromMicroseconds(0);
+ }
+ if (sample_count <= 1) {
+ return base::TimeDelta::FromMicroseconds(0);
+ }
+ return (sample_count - 1) * (*resample_period);
+}
+
} // namespace ui \ No newline at end of file