[Pixman] Gradient dithering into pixman

Bryce Harrington bryce at osg.samsung.com
Mon Apr 2 22:26:31 UTC 2018


Hi Søren,

I'd really like to see this change available for Cairo.  Like you
remarked in your referenced post, dithering has a huge improvement for
gradients on 16 bit destinations.  I'm glad to hear you agree the
general idea is in-scope for pixman.  The improvements to banding are
almost embarrasingly good.  A couple users posted example images to show
with and without Mc's patch:

  http://www.bryceharrington.org/Files/device_texture_template_s8_x_metal_depth_comparison.png
  (Work by Chris Rogers)

and

  https://my.mixtape.moe/sqjmba.png
  https://my.mixtape.moe/jqyvni.png
  (Work by Liam White, I believe)

The significance of the banding change is discernable even to my old man
non-artist eyes.

The approach you outlined in your 2012 post - to do dithering late in
the pipeline - sounds interesting to me, too.  However, from your
description it sounds like it would require some rather invasive changes
to pixman's internal infrastructure.

Has progress been made on implementation of this approach?  If not,
would you mind considering adding a pre-compositing solution as an
interim solution?  6 years is a lot of time to have waited, would be
nice to not have to wait more years.  Or, if you're firm in only seeing
the post-compositing approach, could you elaborate more on how this
would be implemented?

I will be rolling a 1.15.12 release of Cairo within a week or so, and
while I'd love to be able to show off this improvement, I understand if
it will take a longer time frame.  I will also be doing a 1.16.0 release
in the coming months, so let me know if this feels like something that
may be achievable in pixman in that time frame; if not we can figure
something else out.  I am also at your service if you want help
finalizing/landing this feature in pixman.

Thanks,
Bryce

On Mon, Mar 26, 2018 at 08:04:48PM -0400, Søren Sandmann wrote:
> Hi,
> 
> A long time ago I wrote this:
> 
>     https://lists.freedesktop.org/archives/pixman/2012-July/002175.html
> 
> about how dithering could be added to pixman. The basic idea is that
> "dithering" is a property of the destination image, not of the gradient.  I
> still think this is the right way to do it.
> 
> 
> Søren
> 
> On Mon, Mar 26, 2018 at 6:37 PM, Marc Jeanmougin <marc at jeanmougin.fr> wrote:
> 
> > Hi,
> >
> > I'm Marc, I'm an Inkscape contributor, and I would like to improve
> > pixman by providing a patch to allow gradient dithering, to eliminate
> > all gradient banding. This "banding" problem is hugely visible in many
> > Inkscape files, and I hope you could help me putting it into pixman,
> > then in exposing the functionality into cairo.
> >
> > I tried to very closely follow the existing code style, and I came up
> > with the proof of concept (attached Proof_of_concept.patch ), which
> > applies to pixman/master to enable the feature directly.
> >
> > Since Inkscape also uses pixman to render files when exporting to png,
> > and that kind of dithering affects very significantly the file size (PNG
> > compression algorithm and randomness don't mix well) we also need a
> > switch to enable/disable it "at will".
> >
> > I tried to understand how it could be done by looking at
> > pixman_image_set_* functions and finally came up with the other patch
> > attached 0001-Adds-a-gradient-dithering-function-to-pixman.patch (which
> > cannot directly be tested, since it would require changes in cairo to
> > call pixman_image_set_dithering, but changing "gradient->dithering =
> > PIXMAN_DITHERING_NONE;" to _BEST in pixman-image.c works)
> >
> > Thanks for any help in merging this, or any pointer to how to improve it,
> >
> > --
> > Marc
> >
> > _______________________________________________
> > Pixman mailing list
> > Pixman at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/pixman
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.freedesktop.org/archives/pixman/attachments/20180326/dd64cca0/attachment.html>


More information about the Pixman mailing list