[PATCH libinput 3/6] filter: drop delta-softening
Peter Hutterer
peter.hutterer at who-t.net
Mon Jul 7 16:21:19 PDT 2014
I doubt this does what we think it does. It doesn't soften the delta changes,
rather it introduces bumps in the smooth processing of the changes.
abs(delta) below 1.0 is untouched, and abs(delta) beyond 3 or 4 isn't
noticable much. But in the slow range around the 1/-1 mark there is a bump.
For example, if our last_delta is 1.0 and delta is 1.1, the "softened"
delta is set to 0.6. That is stored as last delta, so an input sequence of:
0.8, 0.9, 1.0, 1.1, 1.2, 1.0, 0.8, 1.1
results in "softened" deltas that don't match the input:
0.8, 0.9, 1.0, 0.6, 0.7, 1.0, 0.8, 0.6
A better approach at smoothing this out would be to calculate the softened as:
current = current ± diff(last, current) * 0.5
or even weighted towards the new delta
current = current ± diff(last, current) * 0.25
In tests, this makes little difference. Dropping this function altogether is
sufficient to make the pointer pointer behave slightly better at low speeds
though the increase is small enough to attribute to confirmation bias.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
For a visualization of the jump, see
https://gist.github.com/whot/c9e66f368a1b895d9c22#file-libinput-soften_delta-gnuplot-graph
src/filter.c | 23 -----------------------
1 file changed, 23 deletions(-)
diff --git a/src/filter.c b/src/filter.c
index 51cc0e9..1762f98 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -257,27 +257,6 @@ calculate_acceleration(struct pointer_accelerator *accel,
return factor;
}
-static double
-soften_delta(double last_delta, double delta)
-{
- if (delta < -1.0 || delta > 1.0) {
- if (delta > last_delta)
- return delta - 0.5;
- else if (delta < last_delta)
- return delta + 0.5;
- }
-
- return delta;
-}
-
-static void
-apply_softening(struct pointer_accelerator *accel,
- struct motion_params *motion)
-{
- motion->dx = soften_delta(accel->last_dx, motion->dx);
- motion->dy = soften_delta(accel->last_dy, motion->dy);
-}
-
static void
accelerator_filter(struct motion_filter *filter,
struct motion_params *motion,
@@ -295,8 +274,6 @@ accelerator_filter(struct motion_filter *filter,
motion->dx = accel_value * motion->dx;
motion->dy = accel_value * motion->dy;
- apply_softening(accel, motion);
-
accel->last_dx = motion->dx;
accel->last_dy = motion->dy;
--
1.9.3
More information about the wayland-devel
mailing list