[RFC weston 13/16] compositor: Add a function to test if images transformed by a matrix should be bilinearly filtered

Bill Spitzak spitzak at gmail.com
Fri Oct 3 12:46:07 PDT 2014


On 10/03/2014 12:25 AM, Pekka Paalanen wrote:

>> AFFINE: last row is 0,0,?,1
>> NO_SKEW: a00*a01+a10*a11 ~= 0
>> NO_SCALE: a00^2+a01^2 ~= 1 && a10^2+a11^2 ~= 1
>> ORTHO: a00==a11==0 or a01==a10==0
>> NO_ROTATE: a01==a10==0
>> NOT_DEGENERATE: a00*a11-a10*a01 != 0
>> NO_MIRROR: a00,a01,a10,a11 are all >= 0
>> INT_SCALE: a00,a01,a10,a11 are all integers
>> INT_TRANSLATE: a03 and a13 are integers
>> IDENTITY: identity matrix
>
> You must have missed our code, we already have some flags:
> http://cgit.freedesktop.org/wayland/weston/tree/shared/matrix.h#n30

That looks like a good start, though I would agree that the flags need 
to change. You need a set with each bit as independent as possible, 
which is what I was trying to come up with in the above list. Tests for 
optimization probably require looking at more than one flag, for 
instance 1:1 pixel mappings are require AFFINE, NO_SKEW, NO_SCALE, 
ORTHO, and INT_TRANSLATE all turned on.

I suspect there are a lot of errors in the above list, too...

> We could be using the flags to optimize matrix ops, but we don't so
> far. No-one has seen the need to optimize our matrix ops. I suspect
> very few people if any have even profiled Weston.

You are probably right, it is not to optimize the math. What I was 
trying to optimize was figuring out a new set of flags from the result 
of multiplying two matrices, rather than running the analysis on the result.

The most useful thing to speed this up is to use 32-bit floats, store in 
column-major order (ie the same order OpenGL uses), and get it to use 
the vector built-ins in gcc if possible. I'm pretty certain that will 
result in the fastest multiply and it will be faster than the if 
statements necessary to check the flags.


More information about the wayland-devel mailing list