-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhueeqg.ctl
More file actions
51 lines (46 loc) · 2.91 KB
/
hueeqg.ctl
File metadata and controls
51 lines (46 loc) · 2.91 KB
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
// @ART-label: "$CTL_GRAPHICAL_EQUALIZER_BY_HUE;Graphical equalizer by hue"
// @ART-colorspace: "rec2020"
import "_artlib";
float hue01(float h)
{
float v = h / (2 * M_PI);
if (v < 0.0) {
return 1.0 + v;
} else if (v > 1.0) {
return v - 1.0;
} else {
return v;
}
}
float tolin(float y, float base)
{
float v = (y - 0.5) * 2.0;
return sgn(v) * clamp(log2lin(fabs(v), base), 0, 1);
}
// @ART-param: ["hcurve", "H", 2, ["ControlPoints", 0.0, 0.5, 0.35, 0.35, 0.16666666666666666, 0.5, 0.35, 0.35, 0.3333333333333333, 0.5, 0.35, 0.35, 0.5, 0.5, 0.35, 0.35, 0.6666666666666666, 0.5, 0.35, 0.35, 0.8333333333333333, 0.5, 0.35, 0.35], [[0.0, 0.6, 0.3, 0.48947368421052634], [0.16666666666666666, 0.6, 0.4105263157894737, 0.3], [0.3333333333333333, 0.48947368421052634, 0.6, 0.3], [0.5, 0.3, 0.6, 0.41052631578947363], [0.6666666666666666, 0.3, 0.48947368421052634, 0.6], [0.8333333333333333, 0.41052631578947363, 0.3, 0.6], [1.0, 0.6, 0.3, 0.48947368421052634]], 0, "$CTL_CHANNEL;Channel"]
// @ART-param: ["scurve", "S", 2, ["ControlPoints", 0.0, 0.5, 0.35, 0.35, 0.16666666666666666, 0.5, 0.35, 0.35, 0.3333333333333333, 0.5, 0.35, 0.35, 0.5, 0.5, 0.35, 0.35, 0.6666666666666666, 0.5, 0.35, 0.35, 0.8333333333333333, 0.5, 0.35, 0.35], [[0.0, 0.6, 0.3, 0.48947368421052634], [0.16666666666666666, 0.6, 0.4105263157894737, 0.3], [0.3333333333333333, 0.48947368421052634, 0.6, 0.3], [0.5, 0.3, 0.6, 0.41052631578947363], [0.6666666666666666, 0.3, 0.48947368421052634, 0.6], [0.8333333333333333, 0.41052631578947363, 0.3, 0.6], [1.0, 0.6, 0.3, 0.48947368421052634]], 0, "$CTL_CHANNEL;Channel"]
// @ART-param: ["lcurve", "L", 2, ["ControlPoints", 0.0, 0.5, 0.35, 0.35, 0.16666666666666666, 0.5, 0.35, 0.35, 0.3333333333333333, 0.5, 0.35, 0.35, 0.5, 0.5, 0.35, 0.35, 0.6666666666666666, 0.5, 0.35, 0.35, 0.8333333333333333, 0.5, 0.35, 0.35], [[0.0, 0.6, 0.3, 0.48947368421052634], [0.16666666666666666, 0.6, 0.4105263157894737, 0.3], [0.3333333333333333, 0.48947368421052634, 0.6, 0.3], [0.5, 0.3, 0.6, 0.41052631578947363], [0.6666666666666666, 0.3, 0.48947368421052634, 0.6], [0.8333333333333333, 0.41052631578947363, 0.3, 0.6], [1.0, 0.6, 0.3, 0.48947368421052634]], 0, "$CTL_CHANNEL;Channel"]
void ART_main(varying float r, varying float g, varying float b,
output varying float rout,
output varying float gout,
output varying float bout,
float hcurve[256], float scurve[256], float lcurve[256])
{
float hsl[3] = rgb2okhcl(r, g, b);
float h = hue01(hsl[0]);
float v = luteval(hcurve, h);
float f = tolin(v, 50) * M_PI;
hsl[0] = hsl[0] + f;
v = luteval(scurve, h);
f = tolin(v, 2);
float s = fmax(1.0 + f, 0);
hsl[1] = hsl[1] * s;
v = luteval(lcurve, h);
s = fmin(hsl[1], 1);
f = tolin(v, 10);
hsl[2] = hsl[2] * pow(2, 10 * f * s);
float rgb[3] = okhcl2rgb(hsl);
rout = rgb[0];
gout = rgb[1];
bout = rgb[2];
}