src/pixmap.cc
branchpyrit
changeset 90 f6a72eb99631
parent 89 fcf1487b398b
child 92 9af5c039b678
equal deleted inserted replaced
89:fcf1487b398b 90:f6a72eb99631
    46 #else
    46 #else
    47 	__m128 cmax = _mm_set_ps1(255.0);
    47 	__m128 cmax = _mm_set_ps1(255.0);
    48 	__m64 m;
    48 	__m64 m;
    49 	for (unsigned char *cd = cdata; cd < cdata + w*h*3; cd += 4, fd += 4)
    49 	for (unsigned char *cd = cdata; cd < cdata + w*h*3; cd += 4, fd += 4)
    50 	{
    50 	{
    51 		m = _mm_cvtps_pi8(_mm_mul_ps(cmax,
    51 		m = _mm_cvtps_pi16(_mm_mul_ps(cmax,
    52 			_mm_min_ps(mOne, _mm_set_ps(fd[3],fd[2],fd[1],fd[0]))));
    52 			_mm_min_ps(mOne, _mm_set_ps(fd[3],fd[2],fd[1],fd[0]))));
    53 		memcpy(cd, &m, 4);
    53 		for (int i = 0; i < 4; i++)
       
    54 			cd[i] = ((unsigned char *)&m)[i<<1];
    54 	}
    55 	}
    55 #endif
    56 #endif
    56 
    57 
    57 	return cdata;
    58 	return cdata;
    58 }
    59 }