Original Post
Hello,
I would like to optimize a short piece of C++ code using SIMD SSE2 or SSE3 insructions. Could someone get me up to speed, or ideally (if anyone would be so kind) provide the converted code?
The function I need optimized simply reads from a graphics-frame in ARGB format to another frame that is supposed to be in aAAA format (where the actual "a" part is set to 0xff).
I would like to optimize a short piece of C++ code using SIMD SSE2 or SSE3 insructions. Could someone get me up to speed, or ideally (if anyone would be so kind) provide the converted code?
The function I need optimized simply reads from a graphics-frame in ARGB format to another frame that is supposed to be in aAAA format (where the actual "a" part is set to 0xff).
unsigned int* f = (unsigned int*)frame;
unsigned int* k = (unsigned int*)alphaKey;
for (unsigned i = mFrameHeight*mFrameWidth; i != 0; i--)
{
unsigned int a = *f++;
a &= 0xff000000;
unsigned int v = (a >> 8) | (a >> 16) | (a >> 24) | 0xff000000;
*k++ = v;
}