On 27.02.2005, at 16:42, Robert L Krawitz wrote:
In addition to being very slow, this will also yield noisy results. There are a lot of dither algorithms that are both much faster and yield better results. While you may not need full-blown Floyd-Steinberg or EvenTone dithering for this purpose (and they're hard to use in a multi-threaded fashion), a simple dither matrix is fast, free of most artifacts, trivial to parallelize (you're only reading from the matrix, so no serialization is necessary), and reasonably low noise.
This is just the first step to get better performance. In addition to the patch posted, I've already done and tested the separation of the dither and non-dither blending code, so it's a bit easier to simply change the algorithm from a randomized dither to a different one.
If we also do the change to remove the local PRNGs with a global one which can be used to get a smaller number of pseudo-random numbers or to setup and seed a thread-local PRNG, the only needed change for your proposal would be to touch two or three (one for the setup) functions.
Let me know if you're interested.
Honestly I've no idea why the blending code does dithering at all; the dithering is completely invisible in 24bit RGB colorspace anyway.
But if you can speed that up; be my guest... ;)
Description: This is a digitally signed message part