Hi,

Felix recently suggested a change to SET_ALPHA_PIXEL_RGB32 in 
DirectFB/src/gfx/generic/generic.h) that resulted in a  nice 
performance improvement and that we are now using. I tried to 
do the same optimization to SET_ALPHA_PIXEL_RGB16 today and
here's what I have come up with:

#define SET_ALPHA_PIXEL_RGB16(d,r,g,b,a) \
     if (a) {\
          if (a == 0xFF) {\
               *(d) = (((r)&0xf8) << 8) | (((g)&0xfc) << 3) | (((b)&0xf8) >> 3);\
          }\
          else {\
               __u32 pixel;\
               __u8  s=((a)>>2)+1;\
               __u8 s1=(64-s);\
               \
               pixel = *(d);\
               pixel = (((((pixel & 0x0000f81f) * s1) + ((((r)<<8) | ((b)>>3)) * s)) & 
0x003e07c0) + \
                        ((((pixel & 0x000007e0) * s1) +  (((g)<<3)             * s)) & 
0x0001f800)) >> 6; \
               *(d) = pixel;\
          }\
     }

This code is indeed faster (>15%), but the output is not perfect 
(red bits seem to pollute the blue bits somehow). I have stared at 
this code for too long and can't find what I'm doing wrong here. 
Perhaps someone out there has an idea?


Salut, Sven


-- 
Info:  To unsubscribe send a mail to [EMAIL PROTECTED] with 
"unsubscribe directfb-dev" as subject.

Reply via email to