[Pixman] [patch] Gradient dithering into pixman

Bill Spitzak spitzak at gmail.com
Tue Mar 27 23:54:08 UTC 2018


I was just suggesting that if you have two settings, you call the "on" one
"GOOD". Generally "good" is what users want, and so this should be the
first enumeration value offered other than "OFF".

You do have to start the lines with a different error amount. Another
possibility that Nuke does, but may be hard to implement here, is to start
at a random position and go left and right from that position. It seems to
hide the artifacts very well.


On Tue, Mar 27, 2018 at 1:13 PM, Marc Jeanmougin <marc at jeanmougin.fr> wrote:

>
>
> 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 --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pixman/attachments/20180327/00a5a39b/attachment.html>


More information about the Pixman mailing list