[Pixman] [patch] Gradient dithering into pixman
Marc Jeanmougin
marc at jeanmougin.fr
Tue Mar 27 20:13:03 UTC 2018
On 03/27/2018 07:45 PM, Bill Spitzak wrote:
> Quick look at the patch and it seems like this will work, though it is a
> random dither. You might get much better compression of .png with a
> patterned dither. I've also had good luck with pseudo-error-diffusion.
> You keep in static memory an accumulated error (per color, but not
> really depending on the location of the pixel) and that is the threshold
> for the random number. This produces a bit more patterning than a
> straight random generator. You might also try it with no random number
> generator at all, but you have to preserve the accumulated error so that
> solid areas that are an integer don't reset it so each adjacent line
> gets the same pattern.
I implemented the accumulated error dithering (attached file, can be
applied over the previous 0001 patch). It greatly improves PNG
compression ratio for purely horizontal gradients (approximately +15%
instead of +10000%, in filesize), but produces small artifacts (it's
still way better than no dithering of course, they are almost invisible)
without a random accumulated error at the start of lines (which
increases a lot the filesize).
> May want to call the "on" setting PIXMAN_DITHERING_GOOD. On the
> assumption that anybody who wants it on is happy with "good" dithering,
> and that they may not want to pay for the slowness of "best" dithering.
Considering the prng used, the slowness is almost negligible ("good
except for the small stripes" dithering may in fact be slower)
--
Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Adds-PIXMAN_DITHERING_GOOD-with-diffusion-of-accumul.patch
Type: text/x-patch
Size: 2798 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/pixman/attachments/20180327/beec8351/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/pixman/attachments/20180327/beec8351/attachment.sig>
More information about the Pixman
mailing list