forked from rodrigomas/DCTLs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Macbeth_ColorChecker_Chart.dctl
111 lines (104 loc) · 8.56 KB
/
Macbeth_ColorChecker_Chart.dctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Macbeth Chart
__CONSTANT__ float patch1[] = {115.0f/255.0f, 82.0f/255.0f, 68.0f/255.0f};
__CONSTANT__ float patch2[] = {194.0f/255.0f, 150.0f/255.0f, 130.0f/255.0f};
__CONSTANT__ float patch3[] = {98.0f/255.0f, 122.0f/255.0f, 157.0f/255.0f};
__CONSTANT__ float patch4[] = {87.0f/255.0f, 108.0f/255.0f, 67.0f/255.0f};
__CONSTANT__ float patch5[] = {133.0f/255.0f, 128.0f/255.0f, 177.0f/255.0f};
__CONSTANT__ float patch6[] = {103.0f/255.0f, 189.0f/255.0f, 170.0f/255.0f};
__CONSTANT__ float patch7[] = {214.0f/255.0f, 126.0f/255.0f, 44.0f/255.0f};
__CONSTANT__ float patch8[] = {80.0f/255.0f, 91.0f/255.0f, 166.0f/255.0f};
__CONSTANT__ float patch9[] = {193.0f/255.0f, 90.0f/255.0f, 99.0f/255.0f};
__CONSTANT__ float patch10[] = {94.0f/255.0f, 60.0f/255.0f, 108.0f/255.0f};
__CONSTANT__ float patch11[] = {157.0f/255.0f, 188.0f/255.0f, 64.0f/255.0f};
__CONSTANT__ float patch12[] = {224.0f/255.0f, 163.0f/255.0f, 46.0f/255.0f};
__CONSTANT__ float patch13[] = {56.0f/255.0f, 61.0f/255.0f, 150.0f/255.0f};
__CONSTANT__ float patch14[] = {70.0f/255.0f, 148.0f/255.0f, 73.0f/255.0f};
__CONSTANT__ float patch15[] = {175.0f/255.0f, 54.0f/255.0f, 60.0f/255.0f};
__CONSTANT__ float patch16[] = {231.0f/255.0f, 199.0f/255.0f, 31.0f/255.0f};
__CONSTANT__ float patch17[] = {187.0f/255.0f, 86.0f/255.0f, 149.0f/255.0f};
__CONSTANT__ float patch18[] = {8.0f/255.0f, 133.0f/255.0f, 161.0f/255.0f};
__CONSTANT__ float patch19[] = {243.0f/255.0f, 243.0f/255.0f, 242.0f/255.0f};
__CONSTANT__ float patch20[] = {200.0f/255.0f, 200.0f/255.0f, 200.0f/255.0f};
__CONSTANT__ float patch21[] = {160.0f/255.0f, 160.0f/255.0f, 160.0f/255.0f};
__CONSTANT__ float patch22[] = {122.0f/255.0f, 122.0f/255.0f, 121.0f/255.0f};
__CONSTANT__ float patch23[] = {85.0f/255.0f, 85.0f/255.0f, 85.0f/255.0f};
__CONSTANT__ float patch24[] = {52.0f/255.0f, 52.0f/255.0f, 52.0f/255.0f};
__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B)
{
const float r = p_X <= p_Width/6 && p_X >= 0 && p_Y <= p_Height/4 && p_Y >= 0 ? patch1[0] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch2[0] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch3[0] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch4[0] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch5[0] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch6[0] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch7[0] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch8[0] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch9[0] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch10[0] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch11[0] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch12[0] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch13[0] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch14[0] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch15[0] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch16[0] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch17[0] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch18[0] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch19[0] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch20[0] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch21[0] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch22[0] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch23[0] :
patch24[0]
))))))))))))))))))))));
const float g = p_X <= p_Width/6 && p_X >= 0 && p_Y <= p_Height/4 && p_Y >= 0 ? patch1[1] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch2[1] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch3[1] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch4[1] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch5[1] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch6[1] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch7[1] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch8[1] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch9[1] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch10[1] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch11[1] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch12[1] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch13[1] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch14[1] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch15[1] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch16[1] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch17[1] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch18[1] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch19[1] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch20[1] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch21[1] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch22[1] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch23[1] :
patch24[1]
))))))))))))))))))))));
const float b = p_X <= p_Width/6 && p_X >= 0 && p_Y <= p_Height/4 && p_Y >= 0 ? patch1[2] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch2[2] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch3[2] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch4[2] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch5[2] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= p_Height/4 && p_Y >= 0 ? patch6[2] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch7[2] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch8[2] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch9[2] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch10[2] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch11[2] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= 2*p_Height/4 && p_Y > p_Height/4 ? patch12[2] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch13[2] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch14[2] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch15[2] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch16[2] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch17[2] :
(p_X <= 6*p_Width/6 && p_X > 5*p_Width/6 && p_Y <= 3*p_Height/4 && p_Y > 2*p_Height/4 ? patch18[2] :
(p_X <= p_Width/6 && p_X >= 0 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch19[2] :
(p_X <= 2*p_Width/6 && p_X > p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch20[2] :
(p_X <= 3*p_Width/6 && p_X > 2*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch21[2] :
(p_X <= 4*p_Width/6 && p_X > 3*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch22[2] :
(p_X <= 5*p_Width/6 && p_X > 4*p_Width/6 && p_Y <= 4*p_Height/4 && p_Y > 3*p_Height/4 ? patch23[2] :
patch24[2]
))))))))))))))))))))));
return make_float3(r, g, b);
}