[cairo] The right approach to projective transformations

Maarten Bosmans mkbosmans at gmail.com
Fri Aug 20 14:14:53 PDT 2010


2010/8/20 James Cloos <cloos at jhcloos.com>:
> In addition to Bill's and Andrea's comments, I'd note that although the
> api should be an arbitrary 3x3 matrix and 3-value vectors, the layout in
> memory should be 4x4 matrices and 4-valued vectors so that the arithmetic
> can be accelerated.  The 128-bit vector size was chosen specifically to
> optimize 4x4 matrices with each other and with 4x1 & 1x4 vectors.

This sounds to me as even more reason to use the pixman floating point
matrix type in cairo, because then optimizations like this can stay in
pixman. Note that currently however the type of a pixman matrix is a
double[3][3], so the matrix size is part of the public api.

> If the api provides no way to set the z row or the z column, then the
> non-simd paths can presume z=[0 0 0 0] and just skip over those entires.
>
> It should be good for up to a 9/4 or so speed up over scalar arithmetic,
> depending on the details of the hw.

However, how much time in a typical pixman/cairo run is spend in
matrix operations? Probably not that much compared to compositing.

> -JimC

Maarten


More information about the cairo mailing list