diff options
author | Siarhei Vishniakou <svv@google.com> | 2022-08-25 17:16:47 +0000 |
---|---|---|
committer | Siarhei Vishniakou <svv@google.com> | 2022-09-09 20:37:58 +0000 |
commit | 7ee2b25c0f398ed9872841b552446a27a580a4ea (patch) | |
tree | f64eaa73cc7618ce71291c5eec3195cf95e46d2d | |
parent | 1361b2abb1be5c3effd627627800dd7a7e291ad9 (diff) | |
download | libpalmrejection-7ee2b25c0f398ed9872841b552446a27a580a4ea.tar.gz |
Simplify condition in ShouldDecideStroke
Currently, the condition is complicated. In reality, the requirement is
that the number of samples is exactly equal to max.
Update the code so that it's clear.
Bug: b/240168494
Test: autoninja -C out/Default events_unittests
Change-Id: I8cdcdacc4cf9926779b22a47b7be62899c101702
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3854946
Reviewed-by: Rob Schonberger <robsc@chromium.org>
Auto-Submit: Siarhei Vishniakou <svv@google.com>
Commit-Queue: Siarhei Vishniakou <svv@google.com>
Cr-Commit-Position: refs/heads/main@{#1039304}
-rw-r--r-- | ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.cc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.cc b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.cc index 49c2a4e..6b7e60b 100644 --- a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.cc +++ b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.cc @@ -272,14 +272,8 @@ void NeuralStylusPalmDetectionFilter::Filter( bool NeuralStylusPalmDetectionFilter::ShouldDecideStroke( const PalmFilterStroke& stroke) const { const NeuralStylusPalmDetectionFilterModelConfig& config = model_->config(); - // Perform inference at most every |max_sample_count| samples. - if (stroke.samples_seen() % config.max_sample_count != 0) - return false; - - // Only inference at start. - if (stroke.samples_seen() > config.max_sample_count) - return false; - return true; + // Inference only executed once per stroke + return stroke.samples_seen() == config.max_sample_count; } bool NeuralStylusPalmDetectionFilter::IsHeuristicPalmStroke( |