[OpenJDK 2D-Dev] sun.java2D.Pisces renderer Performance and Memory enhancements

Laurent Bourgès bourges.laurent at gmail.com
Tue Jun 11 12:21:57 UTC 2013

Dear Java2D members,

Sorry to ask but does anybody care about improving java2D rendering
(quality, performance) ?

I sent several emails for one month and nobody answered.

Should I consider that there is no interest and give up ?

I am still waiting for feedback and support before going on working on my
patch on pisces renderer.

Two more comments:
- coordinate conversions: float or integer computations (DDA) related to
subpixel coordinates: ceil(), floor() ...
      Pisces uses 3x3 subpixels but it provides poor quality: many research
papers are using 4x4 (1/16 error) or 8x8 (1/64 error) subpixel masks to
increase the coverage precision (ratio of the pixel covered by the polygon)
      Moreover, Pisces does not take into account the distance / error
between the mathematical edge position and the pixel grid.
      Ideally the subpixel mask should be 16x16 => 1/256 coverage error but
it will lead to higher processing time.

     There is a compromise to be done between quality and speed: that's
exactly what java RenderingHints are for !

     For these reasons, I propose to use integer maths (instead of floating
point operations) on edges in Renderer._endRendering():

            for (i = 0; i < numCrossings; i++) {
*                ecur = _edgePtrs[i];
                f_curx = _edges[ecur /* + CURX */ ];

                // LBO: float ops: maybe use long integer ops (24.8)
                _edges[ecur /* + CURX */ ] = f_curx + _edges[ecur + _SLOPE];
                // note: left shift on crossing to store orientation flag

*//                int cross = ((int) f_curx) << 1;*
*                cross = (ceil(f_curx)) << 1;
       Comments are welcome and alternatives also ...

- coverage / alpha mask computation: incorrect or too imprecise
     Few software renderer recommends using 16x16 subpixels or at least use
1/256 position accuracy and then compute edge coverage using line functions
with enough precision:

I will look at increasing the Renderer subpixel resolution (3x3, 4x4,
16x16) and see the performance impact but also the output quality.

An efficient optimization consist in processing multiple scan lines when
possible (90%) i.e. process real pixels ie 3 or more scan lines at a time
when edges are fixed (no new edge nor edge removal) and compute triangle
coverage between 2 edge functions => less loops and more accurate computed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20130611/2838369c/attachment.html>

More information about the 2d-dev mailing list