Touchscreen Jitter Filter ?


scachi

Member
Joined
Dec 28, 2005
Messages
451
Has anyone already coded a jitter filter for better touchscreen input ?
Or maybe someone can name a (SDL) game with touchscreen support where the
cursor doesn't shake like crazy when the pen is hold down ?
 
you might take a look at the tslib source - http://tslib.berlios.de/ - a jitter smoothing filter sample is included ... i don't know if this plugin is activated by default on the wiz, but it seems not :)

i think they got some nice filters, too: http://wiki.openmoko.org/wiki/Touchscreen_Filters
 
The GP2X's hardware-accelerated SDL library incorporates a modified version of TSLIB directly into its source code in order to read the touchscreen. When porting Open2X I spent a long time heavily modifying it to improve its filtering and came up with quite a good filter (as good as the F200 might be able to get).

You can see the entirety of it here:
http://open2x.svn.sourceforge.net/viewvc/open2x/trunk/libs-new/sdl/sdl/SDL-1.2.11/src/video/gp2x/gp2x_tslib.c?revision=353&view=markup

This does things in userspace as opposed to Openmoko which seems to do it in kernel space. It uses a 15-sample history and takes a weighted average that looks like a pyramid. Sample 0 (newest sample) and sample 15 (oldest sample) are given the least weight. Sample 7 (the middle sample) is the sample with the highest weight. Everything is done with no division so it is fast on the ARM and uses less cycles that way. If the filter detects fast touchscreen movements, it completely flushes the sample history and starts it over so that there is no perceived lag.

It would not be difficult to modify this to fit into the Wiz's SDL library but it won't be be doing it, not for a half a year at least since I am going away on a trip. You can use this code in your application to read touchscreen input directly if you modify it.
 
Back
Top