-
Notifications
You must be signed in to change notification settings - Fork 1
/
PD-LogC-Print.dctl
122 lines (118 loc) · 6.64 KB
/
PD-LogC-Print.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
112
113
114
115
116
117
118
119
120
121
122
// Copyright 2022-present Contributors to the photographic-dctl project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/mikaelsundell/photographic-dctls
// clang-format on
DEFINE_UI_PARAMS(logc, LogC, DCTLUI_COMBO_BOX, 0, {LOGC3, LOGC4}, {LogC3, LogC4})
DEFINE_UI_PARAMS(ei, LogC3 EI, DCTLUI_COMBO_BOX, 7, {EI160, EI200, EI250, EI320, EI400, EI500, EI640, EI800, EI1000, EI1280, EI1600}, {EI 160, EI 200, EI 250, EI 320, EI 400, EI 500, EI 640, EI 800, EI 1000, EI 1280, EI 1600});
DEFINE_UI_PARAMS(luminositylut, Film luminosity, DCTLUI_COMBO_BOX, 0, {LUMINOSITYLUT0, LUMINOSITYLUT1, LUMINOSITYLUT2, LUMINOSITYLUT3, LUMINOSITYLUT4, LUMINOSITYLUT5, LUMINOSITYLUT6}, {Fujifilm 3513DI D55, Fujifilm 3513DI D60, Fujifilm 3513DI D65, Kodak 2383 D55, Kodak 2383 D60, Kodak 2383 D65, ARRI LogC2Video});
DEFINE_UI_PARAMS(colorlut, Film color, DCTLUI_COMBO_BOX, 0, {COLORLUT0, COLORLUT1, COLORLUT2, COLORLUT3, COLORLUT4, COLORLUT5, COLORLUT6}, {Fujifilm 3513DI D55, Fujifilm 3513DI D60, Fujifilm 3513DI D65, Kodak 2383 D55, Kodak 2383 D60, Kodak 2383 D65, ARRI LogC2Video});
DEFINE_UI_PARAMS(display, Display, DCTLUI_COMBO_BOX, 0, {REC709, DCIP3}, {Rec709/Gamma2.2, DCI-P3/Gamma2.6});
DEFINE_UI_PARAMS(luminosityblend, Luminosity blend, DCTLUI_SLIDER_FLOAT, 0, 0, 100, 1);
DEFINE_UI_PARAMS(colorblend, Color blend, DCTLUI_SLIDER_FLOAT, 0, 0, 100, 1);
DEFINE_UI_PARAMS(convertcineon, Convert to cineon, DCTLUI_CHECK_BOX, 1)
DEFINE_UI_PARAMS(convertcolorspace, Convert colorspace, DCTLUI_CHECK_BOX, 1)
DEFINE_UI_PARAMS(adjustdisplay, Adjust for display, DCTLUI_CHECK_BOX, 1)
DEFINE_LUT(LUT0_REC709, ../Film Looks/Rec709 Fujifilm 3513DI D55.cube)
DEFINE_LUT(LUT1_REC709, ../Film Looks/Rec709 Fujifilm 3513DI D60.cube)
DEFINE_LUT(LUT2_REC709, ../Film Looks/Rec709 Fujifilm 3513DI D65.cube)
DEFINE_LUT(LUT3_REC709, ../Film Looks/Rec709 Kodak 2383 D55.cube)
DEFINE_LUT(LUT4_REC709, ../Film Looks/Rec709 Kodak 2383 D60.cube)
DEFINE_LUT(LUT5_REC709, ../Film Looks/Rec709 Kodak 2383 D65.cube)
DEFINE_LUT(LUT6_REC709, ./ARRI_LogC2Video_709_davinci3d_33.cube)
DEFINE_LUT(LUT0_DCIP3, ../Film Looks/DCI-P3 Fujifilm 3513DI D55.cube)
DEFINE_LUT(LUT1_DCIP3, ../Film Looks/DCI-P3 Fujifilm 3513DI D60.cube)
DEFINE_LUT(LUT2_DCIP3, ../Film Looks/DCI-P3 Fujifilm 3513DI D65.cube)
DEFINE_LUT(LUT3_DCIP3, ../Film Looks/DCI-P3 Kodak 2383 D55.cube)
DEFINE_LUT(LUT4_DCIP3, ../Film Looks/DCI-P3 Kodak 2383 D60.cube)
DEFINE_LUT(LUT5_DCIP3, ../Film Looks/DCI-P3 Kodak 2383 D65.cube)
DEFINE_LUT(LUT6_DCIP3, ./ARRI_LogC2Video_P3DCI_davinci3d_33.cube)
// utils
#include "PD-Common.h"
#include "PD-LogC.h"
#include "PD-Cineon.h"
#include "PD-Rec709.h"
#include "PD-DCIP3.h"
__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B)
{
float3 rgb = make_float3(p_R, p_G, p_B);
if (convertcolorspace) {
if (display == REC709) {
if (logc == LOGC3) {
rgb = lin_logC3(xyz_rec709(logC3_xyz(logC3_lin(rgb, ei))), ei);
}
else {
rgb = lin_logC4(xyz_rec709(logC4_xyz(logC4_lin(rgb))));
}
}
else {
if (logc == LOGC3) {
rgb = lin_logC3(xyz_dcip3(logC3_xyz(logC3_lin(rgb, ei))), ei);
}
else {
rgb = lin_logC4(xyz_dcip3(logC4_xyz(logC4_lin(rgb))));
}
}
}
if (convertcineon) {
if (logc == LOGC3) {
rgb = lin_cineon(logC3_lin(rgb, ei));
}
else {
rgb = lin_cineon(logC4_lin(rgb));
}
}
float3 luminosity;
if (display == REC709) {
switch (luminositylut) {
case LUMINOSITYLUT0: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT0_REC709); break;
case LUMINOSITYLUT1: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT1_REC709); break;
case LUMINOSITYLUT2: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT2_REC709); break;
case LUMINOSITYLUT3: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT3_REC709); break;
case LUMINOSITYLUT4: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT4_REC709); break;
case LUMINOSITYLUT5: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT5_REC709); break;
case LUMINOSITYLUT6: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT6_REC709); break;
}
}
else {
switch (luminositylut) {
case LUMINOSITYLUT0: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT0_DCIP3); break;
case LUMINOSITYLUT1: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT1_DCIP3); break;
case LUMINOSITYLUT2: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT2_DCIP3); break;
case LUMINOSITYLUT3: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT3_DCIP3); break;
case LUMINOSITYLUT4: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT4_DCIP3); break;
case LUMINOSITYLUT5: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT5_DCIP3); break;
case LUMINOSITYLUT6: luminosity = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT6_DCIP3); break;
}
}
float3 color;
if (display == REC709) {
switch (colorlut) {
case COLORLUT0: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT0_REC709); break;
case COLORLUT1: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT1_REC709); break;
case COLORLUT2: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT2_REC709); break;
case COLORLUT3: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT3_REC709); break;
case COLORLUT4: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT4_REC709); break;
case COLORLUT5: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT5_REC709); break;
case COLORLUT6: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT6_REC709); break;
}
}
else {
switch (colorlut) {
case COLORLUT0: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT0_DCIP3); break;
case COLORLUT1: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT1_DCIP3); break;
case COLORLUT2: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT2_DCIP3); break;
case COLORLUT3: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT3_DCIP3); break;
case COLORLUT4: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT4_DCIP3); break;
case COLORLUT5: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT5_DCIP3); break;
case COLORLUT6: color = APPLY_LUT(rgb.x, rgb.y, rgb.z, LUT6_DCIP3); break;
}
}
float rgblum = luma_rec601(rgb);
float lutlum = luma_rec601(luminosity);
float3 lutrgb = adjust_luma_rec601(color, lutlum);
rgb = adjust_luma_rec601(mix_f3(rgb, lutrgb, colorblend / 100.0), mix_f(rgblum, lutlum, luminosityblend / 100.0));
if (adjustdisplay) {
rgb = adjust_display(rgb);
}
return rgb;
}