| 34 | cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT; |
| 35 | bool gTestRounding = false; |
| 36 | double sRGBmap(float fc) |
| 37 | { |
| 38 | double c = (double)fc; |
| 39 | |
| 40 | #if !defined(_WIN32) |
| 41 | if (std::isnan(c)) c = 0.0; |
| 42 | #else |
| 43 | if (_isnan(c)) c = 0.0; |
| 44 | #endif |
| 45 | |
| 46 | if (c > 1.0) |
| 47 | c = 1.0; |
| 48 | else if (c < 0.0) |
| 49 | c = 0.0; |
| 50 | else if (c < 0.0031308) |
| 51 | c = 12.92 * c; |
| 52 | else |
| 53 | c = (1055.0 / 1000.0) * pow(c, 5.0 / 12.0) - (55.0 / 1000.0); |
| 54 | |
| 55 | return c * 255.0; |
| 56 | } |
| 57 | |
| 58 | double sRGBunmap(float fc) |
| 59 | { |
no outgoing calls