MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / sRGBmap

Function sRGBmap

test_common/harness/imageHelpers.cpp:36–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT;
35bool gTestRounding = false;
36double 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
58double sRGBunmap(float fc)
59{

Callers 8

test_write_imageFunction · 0.85
test_write_image_3DFunction · 0.85
test_write_image_1DFunction · 0.85
test_read_imageFunction · 0.85
pack_image_pixelFunction · 0.85

Calls

no outgoing calls

Tested by 7

test_write_imageFunction · 0.68
test_write_image_3DFunction · 0.68
test_write_image_1DFunction · 0.68
test_read_imageFunction · 0.68