That has got to be slooooooooooow.byuu wrote:Code: Select all
int32 color = int32(pow(double(color) / 256.0, gamma) * 256.0); color = (color > 255) ? 255 : ((color < 0) ? 0 : color); //color >>= 3; for 15-bit
Are you realy using the floating point or negatives at all?
Try this:
Code: Select all
unsigned int npow(register unsigned int base, register unsigned int exponent)
{
register unsigned int total = 1;
if (exponent)
{
register unsigned int i;
for (i = 2, total = base; i < exponent; i += i)
{
total *= total;
}
for (i >>= 1; i < exponent; i++)
{
total *= base;
}
}
return(total);
}
color = npow(color, gamma) / 256;