// sRGB parameters
enum a = 1.055;
enum b = 0.0031308;
enum s = 12.92;
enum e = 2.4;
double v = 0.5;
// the gamma function
if (v <= b*s)
v = v/s;
else
v = ((v + (a - 1)) / a)^^e;
assert(abs(v - hybridGammaToLinear!(a, b, s, e)(0.5)) < double.epsilon);
Hybrid linear-gamma to linear transfer function. The function and parameters are detailed in the example below.