diff -r f7edb3b90816 -r fcf1487b398b src/pixmap.cc --- a/src/pixmap.cc Mon Apr 28 11:44:11 2008 +0200 +++ b/src/pixmap.cc Tue Apr 29 13:56:29 2008 +0200 @@ -36,13 +36,24 @@ { unsigned char *cdata = new unsigned char[w*h*3]; Float *fd = fdata; + +#ifdef NO_SSE for (unsigned char *cd = cdata; cd != cdata + w*h*3; cd++, fd++) - { if (*fd > 1.0) *cd = 255; else *cd = (unsigned char)(*fd * 255.0); +#else + __m128 cmax = _mm_set_ps1(255.0); + __m64 m; + for (unsigned char *cd = cdata; cd < cdata + w*h*3; cd += 4, fd += 4) + { + m = _mm_cvtps_pi8(_mm_mul_ps(cmax, + _mm_min_ps(mOne, _mm_set_ps(fd[3],fd[2],fd[1],fd[0])))); + memcpy(cd, &m, 4); } +#endif + return cdata; }