Re: [PATCH] Apple USB Touchpad driver (new)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 10, 2005 at 12:48:30AM +0200, Peter Osterlund wrote:
> Vojtech Pavlik <[email protected]> writes:
> 
> > Btw, what I don't completely understand is why you need linear
> > regression, when you're not trying to detect motion or something like
> > that. Basic floating average, or even simpler filtering like the input
> > core uses for fuzz could work well enough I believe.
> 
> Indeed, this function doesn't make much sense:
> 
> +static inline int smooth_history(int x0, int x1, int x2, int x3)
> +{
> +	return x0 - ( x0 * 3 + x1 - x2 - x3 * 3 ) / 10;
> +}
> 
> In the X driver, a derivative estimate is computed from the last 4
> absolute positions, and in that case the least squares estimate is
> given by the factors [.3 .1 -.1 -.3]. However, in this case you want
> to compute an absolute position estimate from the last 4 absolute
> positions, and in this case the least squares estimate is given by the
> factors [.25 .25 .25 .25], ie a floating average. If the function is
> changed to this:
> 
> +static inline int smooth_history(int x0, int x1, int x2, int x3)
> +{
> +	return (x0 + x1 + x2 + x3) / 4;
> +}
> 
> the standard deviation of the noise will be reduced by a factor of 2
> compared to the unfiltered values. With the old smooth_history()
> function, the noise reduction will only be a factor of 1.29.
 
Using a function like

	return (x_old * 3 + x) / 4;

eliminates the need for a FIFO, and has similar (if not better)
properties to floating average, because its coefficients are
[ .25 .18 .14 .10 ... ].

Setting

	absfuzz[ABS_X] = some number;

activates the abovementioned filtering (with additional cutoff and fast
motion compensation) directly in input.c, which should eliminate a lot
of the code in the appletouch driver.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux