Code: Select all
// Insider the "tight loop."
if(*leftIn > Threshold)
{
x = Threshold / *leftIn;
*leftOut = (1.0f - x) * (1.0f - Threshold) + Threshold;
}
else if(*leftIn < -Threshold)
{
x = -Threshold / *leftIn;
*leftOut = -((1.0f - x) * (1.0f - Threshold) + Threshold);
}
else
{
*leftOut = *leftIn;
}
Code: Select all
If the input is greater than the threshold.
Divide threshold by the input.
Multiply the inverted result by the inverted threshold.
Add the result to threshold.
Assign result to output.
Else if the input is less than negative threshold.
Divide negative threshold by the input.
Multiply the inverted result by the inverted threshold.
Add the result to threshold.
Make the result negative.
Assign result to output
Else
Assign input (unaltered) to output.