This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can be used to efficiently encode floating point values from a limited range ([0..65k]) into a byte | |
// edgeDecode is optimized for GPUs (native exp2) | |
// edgeEncode1 is optimized for GPUs (native log2) | |
// edgeEncode2 is optimized for CPUs but is an approximation | |
// edgeEncode3 is optimized for CPUs | |
float edgeDecode(int e) | |
{ | |
return exp2f(float(e) * (1 / 16.f)) - 1; | |
} |