Image Module of libSIMDx86

The Image module gives functions used to accelerate simple image and pixel operations. SSE2 and MMX implementations tend to be heavily optimized compared with a standard C function.

void SIMDx86Image_SaturatedSum(unsigned char* pDest, unsigned char* pSrc, unsigned int NumBytes)

This addes the bytes of 'pDest' and 'pSrc' together, saturating the values at 255 and storing it in 'pDest'. Saturation logic is that if the sum of two numbers is greater than the saturation value, then the sum is clamped to the saturation value. For example, if 100 and 100 were added, the saturated sum would be 200, while if 175 and 100 were added the saturated sum would be 255 (275 > 255, so set to 255). This prevents two intense values from being added and resulting in a darker value due to the wrap around effects of the x86 architecture. This is most efficient when 'NumBytes' is a multiple of 128, but not required.

void SIMDx86Image_SaturatedSumOf(unsigned char* pOut, const unsigned char* pSrc1, const unsigned char* pSrc2, unsigned int NumBytes)

This addes the bytes of 'pSrc1' and 'pSrc2' together, saturating the values at 255 and storing it in 'pOut'. This is most efficient when 'NumBytes' is a multiple of 128, but not required.