On Friday 14 January 2011 17:30:52 Andrea Canciani wrote: > Soren suggested extending composite, i.e. computing a "reference > gradient" in double precision with any algorithm and comparing its > results with those from the pixman implementation. > This might help with different fp implementations, but I'm afraid that > it would not solve the problem completely, unless the algorithm used > to compute the gradient is exactly the same. > > Do you have any idea on what could be done to make such a test > more numerically stable? I've been thinking about blurring or things > like that, but I'm afraid that they would also miss off-by-ones and > other real bugs.
In my opinion, for radial gradient tests it makes sense focusing at different parts of the implementation separately. The gradient walker part is reasonably simple and can be tested independently (on linear gradients for example, or via some other methods). So for the start, I would try making some test, which does not use interpolation between stop colors at all. Something like the following, or maybe arrangement of stops could be different: 0% - black 10% - black 10% - white 20% - white 20% - black 30% - black ... Next get two radial gradient pictures, trying different, probably random, inner and outer circles positions and radii. First picture done with a reference high precision implementation, and another with a performance optimized one. And then, for example, for each 3x3 uniformly colored pixel area in the reference picture, require that the pixel representing the center of this area also has the same color in another picture. That would provide precision requirement of being roughly one pixel off at most. That's just an untested idea, some variation or different criteria may be possible. Filter (if it applies to gradients), should be just set to nearest. > PS: A simple non-gtk version of the test might be an interesting > addition to notice division by zero. Maybe it is appropriate for > gradient-crash-test. Yes, I think extending gradient-crash-test with a test for division by zero problem would be great. -- Best regards, Siarhei Siamashka _______________________________________________ Pixman mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/pixman
