[cairo] PATCH: Use floats instead of doubles in some spline calculations for improved performance

Bill Spitzak spitzak at gmail.com
Mon Mar 4 10:34:17 PST 2013

I can say that in special effects rendering floats are used almost 

Errors that seem to require doubles are almost all where the software 
does something like translate by 6 million units, does a tiny rotation, 
then translates back by 6 million units, and the resulting animation has 
noticable steps. Changing to doubles makes the steps smaller, but the 
improvement is not as good as just figuring out what the resulting 
rotation and translation are directly in floats, which can be done by 
either a programmer or software that has knowledge of linear algebra. So 
I think in fact using doubles is hiding defects and using floats (and 
fixing the now-visible defects) would result in *better* rendering.

On 03/04/2013 12:39 AM, Marko.Kuukkanen at tieto.com wrote:
>> Could you provide some error analysis to show when your patch is applicable and
>> the accuracy sufficient?
> No formal analysis has been made, but I ran canvas performance test
> (http://dl.dropbox.com/u/1865210/mindcat/canvas_perf.html - on ARM and
> rendered using Cairo) 15 times. During those tests _cairo_spline_error_squared
> was called about 100 million times with randomized data and just once
> there was one pixel difference between double and float versions.
> Unfortunately I didn't record the used spline in that case and haven't been
> able to reproduce that since.
> --MarkoK--

More information about the cairo mailing list