19 return to_linear_float_table[val];
28 return (val <= 0.04045f)
29 ? (val * (1.f / 12.92f))
30 : cpow((val + 0.055f) * (1.f / 1.055f), 2.4f);
38 return to_linear_uchar_table[val];
46 return (val <= 0.04045f)
47 ? (
unsigned char)(std::max(0.f, val) * (255.f / 12.92f) + 0.5f)
48 : (
unsigned char)(cpow((std::min(val, 1.f) + 0.055f) * (1.f / 1.055f), 2.4f) * 255.f + 0.5f);
60 : (1.055f * cpow((
float)val * (1.f / 255.f), 0.41666f) - 0.055f);
70 return (val < 0.0031308f)
72 : (1.055f * cpow(val, 0.41666f) - 0.055f);
81 return to_srgb8_table[val];
96 #if defined(__SSE2__) || (_M_IX86_FP >= 2) || defined(_M_X64) || defined(_M_AMD64) 99 return encode_sRGB_uchar_sse2(val);
101 return (val < 0.0031308f)
102 ? (
unsigned char) (std::max(0.f, val) * 3294.6f + 0.5f)
103 : (
unsigned char) (269.025f * cpow(std::min(val, 1.f), 0.41666f) - 13.525f);
119 #if defined(__SSE2__) || (_M_IX86_FP >= 2) || defined(_M_X64) || defined(_M_AMD64) 121 encode_sRGB_uchar_sse2(color, into);
143 #if defined(__SSE2__) || (_M_IX86_FP >= 2) || defined(_M_X64) || defined(_M_AMD64) 145 encode_sRGB_uchar_sse2(color, into, into_alpha);
153 into_alpha = (xelval) (color[3] * 255.f + 0.5f);
float decode_sRGB_float(unsigned char val)
Decodes the sRGB-encoded unsigned char value to a linearized float in the range 0-1.
unsigned char decode_sRGB_uchar(unsigned char val)
Decodes the sRGB-encoded unsigned char value to a linearized unsigned char value.
unsigned char encode_sRGB_uchar(unsigned char val)
Encodes the linearized unsigned char value to an sRGB-encoded unsigned char value.
float encode_sRGB_float(unsigned char val)
Encodes the linearized unsigned char value to an sRGB-encoded floating- point value in ther range 0-1...