[Pixman] [PATCHv3 0/3] Faster 90/270 degrees rotation

Siarhei Siamashka siarhei.siamashka at gmail.com
Mon Feb 7 17:03:13 PST 2011


On Friday 04 February 2011 20:45:56 Andrea Canciani wrote:
> On Fri, Feb 4, 2011 at 7:34 PM, Bill Spitzak <spitzak at gmail.com> wrote:
> > I would think that rather than a flag for each rotation, you can use 3
> > flags to get all the unit rotations and flipping, and avoid the annoying
> 
> > possibility of setting the flags to invalid combinations:
> Uhm... that's not how fast path flags are supposed to work.
> Currently a if a fast path is valid for a set of flags, it is also valid
> for any superset of that set.
> For your suggestion to work, the flags matching algorithm would
> have to be replaced.
> 
> >  TRANSPOSE: flip about the x==y diagonal, before the MIRROR transforms
> >  MIRROR_X: flip about x==0 (y axis)
> >  MIRROR_Y: flip about y==0 (x axis)
> > 
> > 90 CCW rotation is TRANSPOSE+MIRROR_X
> > 180 rotation is MIRROR_X+MIRROR_Y
> > 270 rotation is TRANSPOSE+MIRROR_Y
> > 
> > There would also need to be a flag indicating if the transform is not one
> > of these. If this flag is set then it may still be useful to set these
> > flags to indicate the closest such transform, applying them would reduce
> > the remaining transform to less than +/- 45 degrees.
> 
> It would be possible to have a single flag for simple unit transforms
> (the on/off
> flag you propose) and then dispatch depending on the matrix type.
> It is interesting to note that it would be possible to share code between
> the 8 combinations. I don't know if/how much this would affect
> performance.

The flags are just internally used by pixman and can be reassigned/rearranged
any time. We basically have some optimized fast path functions and just want to
be able to identify the case when they can be used safely.

IMHO while it should be possible to decompose rotation into TRANSPOSE+MIRROR
plus some other flags to actually ensure reliable selection of fast paths, it
just does not have any practical advantage. If reducing the usage of flag bits
is the goal, then just one bit is enough [1]. With the disadvantage of losing
the freedom to implement fast paths selectively (for example support only 90
degrees rotation in some future SSE2/NEON code, without caring about 270 or
180). 

1. http://lists.freedesktop.org/archives/pixman/2010-July/000307.html

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list