[OpenJDK Rasterizer] Marlin #4

Laurent Bourgès bourges.laurent at gmail.com
Thu Oct 1 21:19:17 UTC 2015


Jim,

Thanks for your ideas below:

> Some thoughts - we record some info on each scanline - mostly about the
new edges that are added.  Perhaps we could keep deltas of how many edges
come and go per scanline and then sum them up at the start to figure out if
any scanline has a lot of crossings?

I will experiment having both bucketAdds and bucketRemoves stored both as
integers ie not just a delete flag.
It will allow computing mean (crossings)=total (adds + removes) by
traversing once all used buckets.
I hope it will be not too much costly and help having better global
heuristics...

> One slight optimization in the non-tileflag version of CopyRLE.
>
> for (i, from, to) {
>     int delta;
>     if ((delta = alphaRow[i]) != 0) {
>         cache.add(val);
>         val += delta;
>         // Range Check only needed here?
>         runLen = 1;
>         alphaRow[i] = 0;  // Optional - avoids clear later?
>     } else {
>         runLen++;
>     }
> }
>
> It avoids prev and having to add "prev + delta" for the very common case
of delta == 0.

It is 15% faster if I force using RLE only without tile flags.
It is almost the same with RLE+tile flags as it only traverse few pixels !

> Also, RLE tends to be more useful if the index of the values is larger
than your data storage unit - which is why Pisces used RLE when it was on
embedded since they were using bytes to store the alpha caches, but shapes
could be larger than 256 units.  You seem to be using integers which means
there is no run long enough to require having to break it up into multiple
segments, you can just store the horizontal index of the next change of
value and its value.  This also means you don't have to sum up counts to
figure out where a partial row starts, you just scan for the first index
that is in range (remembering the previous alpha value to be used for the
beginning of the range)...

I will evaluate using xcoord instead of runLen in the tuples and see if it
saves some add operations.

Did you look at the tile flags approach ?
Any other advice on the heuristics I  experimented ?

Cheers,
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/graphics-rasterizer-dev/attachments/20151001/c9fc85a9/attachment.html>


More information about the graphics-rasterizer-dev mailing list