I am working on a gamma function that generates a "S-Curve". I need to run it in a realtime environment so i need to speed it up as much as possible.
The code is as follows:
float Gamma = 2.0f; //Input Variable
float GammaMult = pow(0.5f, 1.0f-Gamma);
if(Input<1.0f && Input>0.0f)
{
if(Input<0.5f)
{
Output = pow(Input,Gamma)*GammaMult;
}
else
{
Output = 1.0f-pow(1.0f-Input,Gamma)*GammaMult;
}
}
else
{
Output = Input;
}
Is there any way I can optimize this code?