SunjunKim / mouse_cursor_simulator

A displayed cursor simulator, with parameters of mouse sampling fps, USB polling rate, and display frequency
1 stars 0 forks source link

Add a randomizer to add optional artificial jitter to polls #1

Open mdrejhon opened 4 years ago

mdrejhon commented 4 years ago

The MouseTester.exe shows timing jitter in polls, which can mean that some polls arrive before VSYNC (including Windows compositor), and some polls arrive after VSYNC. The combined jitter is often the combination of:

For example, timing jitter (e.g. 1ms randomized to 0.5ms-thru-2ms) can amplify stroboscopic stepping effect issue.

Suggested parameters:

Two randomization patterns is recommended (linear distribution, geometric distribution); with the geometric distribution to simulate the rarer-and-bigger deviations.

Faster computers with fast GPUs will tend to be much more consistent (smaller jitter), though huge variances in system load and idle power management (less precision during low-power SpeedStep, etc) can be jitter factors.

Use case: By having this option, it will make it easier to compare multiple different cursor simulator images -- with actual photographed images.

(Though visual comparisons are understandably subjective, it's useful)

It may not capture all possible causes of jitter, but it can cause a better-than-averge Hz-coupling to become a worse-than-average Hz coupling, because of tight thresholds. The phase of mouse polls can slew against phase of refresh cycles, with random jitter creating a flood of random VSYNC misses (tiny timing errors amplifying to large timing errors). Since USB and GPU clocks are independent, 360Hz may end up 360.001Hz and USB may be 7999.81Hz, so creates a phase-slew effect (See #2, refresh rate can be turned into a float). When poll is near a VSYNC miss, jitter can create a series of random VSYNC misses for many refresh cycles until the phase slews further apart.

SunjunKim commented 4 years ago

Currently added a linear distribution jitter. What kind of random distribution do you want?