Commit 7f379c05ea9e6b60c081af2c18a84ec290af2df4

  • avatar
  • zecke
  • Mon Nov 09 07:28:13 GMT 2009
Improve BYTE_MUL when we don't know the alpha value

In case we don't know the alpha value for byte mul provide
specialized routine to check for 0 and 255 values. This is
gives almost a frame speed up.
src/gui/painting/qdrawhelper_arm_gnu.cpp
(23 / 2)
  
122122// -- I could not verify this on a Cortex-A8 with the above UNROLL_LOOP_WITH_PLD
123123# define PRELOAD_COND2(x,y) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts); \
124124 if (((uint)&y[i])%L2CacheLineLength == 16) preload(&y[i] + L2CacheLineLengthInInts);
125
126Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_ARM(uint x, uint a) {
127 switch (a) {
128 case 255:
129 return x;
130 case 0:
131 return 0;
132 default: {
133 uint t = (x & 0xff00ff) * a;
134 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
135 t &= 0xff00ff;
136
137 x = ((x >> 8) & 0xff00ff) * a;
138 x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
139 x &= 0xff00ff00;
140 x |= t;
141 return x;
142 }
143 }
144}
145
125146void comp_func_SourceOver_arm(uint *dest, const uint *src, int length, uint const_alpha)
126147{
127148 PRELOAD_INIT2(dest, src)
155155 dest[i] = src[i];
156156 } else {
157157 uint s = src[i];
158 dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
158 dest[i] = s + BYTE_MUL_ARM(dest[i], qAlpha(~s));
159159 }
160160
161161 ++i;
164164 int i = 0;
165165 while (i < length) {
166166 uint s = BYTE_MUL(src[i], const_alpha);
167 dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
167 dest[i] = s + BYTE_MUL_ARM(dest[i], qAlpha(~s));
168168 PRELOAD_COND2(dest, src)
169169 ++i;
170170 }

Comments

Add a new comment:

Login or create an account to post a comment

Add your comment