From: Peter Hutterer Date: Fri, 4 Jul 2014 02:52:04 +0000 (+1000) Subject: filter: drop delta-softening X-Git-Tag: 0.5.0~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2dfbc0b826db5e451bc25cae44b07e3b9c827f1;p=platform%2Fupstream%2Flibinput.git filter: drop delta-softening 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 Reviewed-by: Hans de Goede --- diff --git a/src/filter.c b/src/filter.c index 51cc0e92..1762f98a 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;