-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathACES2_DRT_pex2.nk
executable file
·288 lines (288 loc) · 159 KB
/
ACES2_DRT_pex2.nk
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
set cut_paste_input [stack 0]
version 15.0 v1
push $cut_paste_input
Group {
name ACES2_DRT_pex1
label "Input: \[value encoding_in] / \[value primaries_in]\nLimit: \[value primaries_limit] / \[value white_limit] / \[value peak_luminance]nits\nOutput: \[value encoding_out] / \[value primaries_out]\n\[value toneScaleMode]\n\[file tail \[value BlinkScript1.kernelSourceFile]]"
note_font "Bitstream Vera Sans"
selected true
xpos 88
ypos -436
addUserKnob {20 User}
addUserKnob {26 input_div l Input}
addUserKnob {4 encoding_in l encoding t "the input log or gamma encoding" M {Linear ACEScct sRGB BT.1886 "Gamma 2.6" ST2084 "" ""}}
addUserKnob {4 primaries_in l primaries t "the input primaries and white point" -STARTLINE M {AP0-ACES AP1-ACES sRGB/Rec.709-D65 Rec.2020-D65 P3-D65 P3-DCI "" "" ""}}
primaries_in AP1-ACES
addUserKnob {6 ap1_clamp l "AP1 clamp" t "Clamp input chromaticities to AP1 rendering space" +STARTLINE}
ap1_clamp true
addUserKnob {26 ""}
addUserKnob {41 DRT_CAM_Kernel_HK_mode_in l HK_mode_in T BlinkScript1.DRT_CAM_Kernel_HK_mode_in}
addUserKnob {41 DRT_CAM_Kernel_discountIlluminant_in l discountIlluminant_in -STARTLINE T BlinkScript1.DRT_CAM_Kernel_discountIlluminant_in}
addUserKnob {41 DRT_CAM_Kernel_HK_mode_mid l HK_mode_mid T BlinkScript1.DRT_CAM_Kernel_HK_mode_mid}
addUserKnob {41 DRT_CAM_Kernel_discountIlluminant_mid l discountIlluminant_mid -STARTLINE T BlinkScript1.DRT_CAM_Kernel_discountIlluminant_mid}
addUserKnob {41 DRT_CAM_Kernel_HK_mode_out l HK_mode_out T BlinkScript1.DRT_CAM_Kernel_HK_mode_out}
addUserKnob {41 DRT_CAM_Kernel_discountIlluminant_out l discountIlluminant_out -STARTLINE T BlinkScript1.DRT_CAM_Kernel_discountIlluminant_out}
addUserKnob {26 ""}
addUserKnob {6 compress_mode l compressMode t "LMS compression mode\n" +STARTLINE}
addUserKnob {4 HellwigCam16Data l "Hellwig Cam16 Data" M {Stock Thomas "Live from params"}}
HellwigCam16Data "Live from params"
addUserKnob {4 inputViewingConditions l "Input Viewing Conditions" M {dark dim average}}
inputViewingConditions dim
addUserKnob {7 ac_resp l "Achromatic response" t "Changes how L, M and S channels contribute to the model's achromatic response. 0 is equal contribution from each channel, 1 is 2x contribution for L channel, which is the model's default."}
ac_resp 1
addUserKnob {26 ""}
addUserKnob {26 tonescale_div l Tonescale}
addUserKnob {4 toneScaleMode l "ToneScale Mode" M {Linear "Daniele Evo Curve" "" ""}}
toneScaleMode "Daniele Evo Curve"
addUserKnob {6 applyTonecurve l "apply Tonecurve" t "toggle the SingleStageToneScale transform" +STARTLINE}
applyTonecurve true
addUserKnob {7 peak_luminance l "Peak Luminance" t "Target peak luminance in cd/m^2" R 0 1000}
peak_luminance 100
addUserKnob {6 monochrome t "Output monochrome image" +STARTLINE}
addUserKnob {26 gamut_mapping_div l "Gamut Mapping"}
addUserKnob {6 applyChromaCompression l "apply chroma compression" t "Applies the chroma compression step. If this checkbox alone is checked the applies only the scaling step of chroma compression, but not the in-gamiut compression or the saturation." +STARTLINE}
applyChromaCompression true
addUserKnob {6 applyInGamutExpansion l "apply in gamut expansion" t "Expands colorfulness to increase saturation" +STARTLINE}
applyInGamutExpansion true
addUserKnob {6 applyInGamutCompression l "apply in gamut compression" +STARTLINE}
applyInGamutCompression true
addUserKnob {6 applyReachClamp l "apply reach mode clamp" t "Clamp the chroma compressed result to the rendering space" +STARTLINE}
addUserKnob {7 compress l "chroma compression" t "Chroma compression amount" R 2 10}
compress 2.4
addUserKnob {7 chroma_compress_fact l HDR t "Chroma compression scaling factor for SDR/HDR appearance match. Smaller values will compress less as peak luminance goes highger, higher values compress more.\n\nThis setting has effect only for peak luminance >100 nits." -STARTLINE R 2 6}
chroma_compress_fact 3.3
addUserKnob {7 chroma_expand l "chroma expansion" t "Chroma expansion to increase saturation in shadows and mid-tones" R 1 4}
chroma_expand 1.3
addUserKnob {7 chroma_expand_fact l HDR t "Chroma expansion scaling factor for SDR/HDR appearance match. Smaller values will have more saturation as peak luminance goes highger, higher values will have less saturation.\n\nThis setting has effect only for peak luminance >100 nits." -STARTLINE R 0.5 0.9}
chroma_expand_fact 0.69
addUserKnob {7 chroma_expand_thr l "chroma expansion threshold" t "Threshold for starting chroma expansion, meant to avoid expanding noise floor" R 0.5 1}
chroma_expand_thr 0.5
addUserKnob {4 ccReachPrimaries l "reach primaries" t "Primaries that define how far chroma compression and expansion reaches." M {"Chroma Compression Space" AP0-ACES AP1-ACES Rec.2020-D65 ""}}
ccReachPrimaries AP1-ACES
addUserKnob {4 et l "eccentricity factor" t "Eccentricity factor for chroma compression gamut scaling" M {CAM16 Hellwig2022 Custom None "" "" "" "" "" ""}}
et None
addUserKnob {6 apply_gamut_compression l "apply out of gamut compression " t "toggle the gamut compression towards the limiting primaries" +STARTLINE}
apply_gamut_compression true
addUserKnob {4 primaries_limit l "limiting primaries" t "the limiting primaries of the gamut to which to compress to" M {AP0-ACES AP1-ACES sRGB/Rec.709 Rec.2020 P3 "" ""}}
primaries_limit sRGB/Rec.709
addUserKnob {4 white_limit l "white point" t "The white point of the limiting gamut. Also used as the reference white for the output XYZ conversion, independent of the white point of the final encoding. This makes it effectively the creative white." -STARTLINE M {"ACES White" D65 "" "" ""}}
white_limit D65
addUserKnob {4 primaries_reach l "reach primaries" M {AP0-ACES AP1-ACES sRGB/Rec.709-D65 Rec.2020-D65 P3-D65 P3-DCI "Spectral Locus" "Chroma Compression Space"}}
primaries_reach AP1-ACES
addUserKnob {6 reachCompressMode l "Reach Compression Mode" -STARTLINE}
reachCompressMode true
addUserKnob {4 boundryIntersectionMethod M {"Original Pekka" "Oct 19" "New From Nick" ""}}
boundryIntersectionMethod "New From Nick"
addUserKnob {41 DRT_CAM_Kernel_reachNick l "Use Nick method for reach" -STARTLINE T BlinkScript1.DRT_CAM_Kernel_reachNick}
addUserKnob {41 DRT_CAM_Kernel_disableUpperHullGamma l disableUpperHullGamma T BlinkScript1.DRT_CAM_Kernel_disableUpperHullGamma}
addUserKnob {7 upperHullGamma -STARTLINE R 0 2}
upperHullGamma 1
addUserKnob {41 DRT_CAM_Kernel_disableLowerHullGamma l disableLowerHullGamma T BlinkScript1.DRT_CAM_Kernel_disableLowerHullGamma}
addUserKnob {7 lowerHullGamma -STARTLINE R 0 2}
lowerHullGamma 1.14
addUserKnob {7 cusp_mid_blend l "cusp to mid blend" t "blend the lightness (J) of the focal point of the compression between the lightness of the gamut cusp at the given hue and mid J. higher cusps will closer to the cusp lightness, lower cusps will be closer to midJ" R 0.6 2}
cusp_mid_blend 1.3
addUserKnob {7 focus_distance l "focus distance" t "Focus distance value behind acchromatic. Larger value is closer to opposite cusp point behind the achromatic. Smaller value is closer to achromatic." R 1.1 2}
focus_distance 1.35
addUserKnob {7 focusdistscaling l HDR t "Focus distance scaling factor as peak luminance gets higher for SDR/HDR appearance match. The projection gets less steep with higher projection\n\nThis setting has effect only for peak luminance >100 nits." -STARTLINE R 1 2}
focusdistscaling 1.75
addUserKnob {41 DRT_CAM_Kernel_disableFocusGain l disableFocusGain T BlinkScript1.DRT_CAM_Kernel_disableFocusGain}
addUserKnob {7 focus_gain_blend l "focus gain blend" t "Blend between cusp J and limitJmax to determine the point where the focus gain is applied.\n\n0 = cuspJ\n1 = limitJmax"}
focus_gain_blend 0.3
addUserKnob {7 focusgain l "focus gain" -STARTLINE}
focusgain 0.55
addUserKnob {19 compression_params l compression t "the threshold, min limit, max limit, and power parameters for the PowerP compression function\n\nvalues below the threshold will not be compressed and values at the limit will be compressed towards the gamut boundary while the power values defines the shape of the curve"}
compression_params {0.75 1.1 1.3 1}
addUserKnob {6 compression_params_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {7 smooth_cusps l "smooth cusps" t "the amount by how much to smooth the edges and corners of the limiting gamut cube, except the black & white corners."}
smooth_cusps 0.12
addUserKnob {7 smoothJ l "smooth J" t "Smoothing scaling factor for cusp J" R 0 0.1}
addUserKnob {7 smoothM l "smooth M" t "Smoothing scaling factor for cusp M" -STARTLINE R 0 0.25}
smoothM 0.27
addUserKnob {20 sixAxisCompression n 1}
sixAxisCompression 0
addUserKnob {6 sixAxisCompressionMode +STARTLINE}
addUserKnob {19 compressionFuncParamsR}
compressionFuncParamsR {0.2 1.4 {compressionFuncParamsR.g} 1}
addUserKnob {6 compressionFuncParamsR_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {19 compressionFuncParamsY}
compressionFuncParamsY {{compressionFuncParamsR.r} 1.21 {compressionFuncParamsY.g} 1}
addUserKnob {6 compressionFuncParamsY_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {19 compressionFuncParamsG}
compressionFuncParamsG {{compressionFuncParamsR.r} 1.3 {compressionFuncParamsG.g} 1}
addUserKnob {6 compressionFuncParamsG_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {19 compressionFuncParamsC}
compressionFuncParamsC {{compressionFuncParamsR.r} 1.9 {compressionFuncParamsC.g} 1}
addUserKnob {6 compressionFuncParamsC_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {19 compressionFuncParamsB}
compressionFuncParamsB {{compressionFuncParamsR.r} 1.2 {compressionFuncParamsB.g} 1}
addUserKnob {6 compressionFuncParamsB_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {19 compressionFuncParamsM}
compressionFuncParamsM {{compressionFuncParamsR.r} 1.23 {compressionFuncParamsM.g} 1}
addUserKnob {6 compressionFuncParamsM_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {20 endGroup n -1}
addUserKnob {6 color_rgba_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {6 color_rgb_panelDropped l "panel dropped state" +HIDDEN +STARTLINE}
addUserKnob {26 ""}
addUserKnob {26 output_div l Output}
addUserKnob {4 encoding_out l encoding t "the output log or gamma encoding" M {Linear ACEScct sRGB BT.1886 "Gamma 2.6" ST2084 "" ""}}
encoding_out BT.1886
addUserKnob {4 primaries_out l primaries t "the output primaries and white point" -STARTLINE M {AP0-ACES AP1-ACES sRGB/Rec.709-D65 Rec.2020-D65 P3-D65 P3-DCI "" "" "" ""}}
primaries_out sRGB/Rec.709-D65
addUserKnob {4 viewing_conditions l "viewing conditions" t "the ZCAM viewing conditions" M {dark dim average ""}}
viewing_conditions dim
addUserKnob {7 reference_luminance l "reference luminance" t "the ZCAM reference luminance in Cd/sqm" R 0 200}
reference_luminance 100
addUserKnob {7 background_luminance l "background luminance" t "the ZCAM background luminance in Cd/sqm" R 0 100}
background_luminance 10
addUserKnob {6 fit_white l "fit white" t "Scale the output so the maximum RGB channel for the creative white becomes 100%. Prevents clipping when the creative and encoding whites do not match." +STARTLINE}
addUserKnob {6 clamp_output l "clamp output" t "clamp the output values between 0,0 and 1.0" -STARTLINE}
clamp_output true
addUserKnob {6 soft_clamp l "soft clamp output" t "Soft clamp display output values so that no negative RGB channels occur" -STARTLINE}
addUserKnob {26 ""}
addUserKnob {26 HellwigParams l "Hellwig2022 Params"}
addUserKnob {8 BlinkScript1_DRT_CAM_Kernel_L_A l "Input Adapting field" t " // L_A\n // Adapting field *luminance* :math:`L_A` in :math:`cd/m^2`, (often taken\n // to be 20% of the luminance of a white object in the scene)."}
BlinkScript1_DRT_CAM_Kernel_L_A 100
addUserKnob {8 BlinkScript1_DRT_CAM_Kernel_Y_b l "Input background" t " // Y_b\n // Luminous factor of background :math:`Y_b` such as\n // :math:`Y_b = 100 x L_b / L_w` where :math:`L_w` is the luminance of the\n // light source and :math:`L_b` is the luminance of the background. For\n // viewing images, :math:`Y_b` can be the average :math:`Y` value for the\n // pixels in the entire image, or frequently, a :math:`Y` value of 20,\n // approximate an :math:`L^*` of 50 is used."}
BlinkScript1_DRT_CAM_Kernel_Y_b 20
addUserKnob {8 BlinkScript1_DRT_CAM_Kernel_L_A_out l "Output Adapting field" t " // L_A\n // Adapting field *luminance* :math:`L_A` in :math:`cd/m^2`, (often taken\n // to be 20% of the luminance of a white object in the scene)."}
BlinkScript1_DRT_CAM_Kernel_L_A_out 100
addUserKnob {8 BlinkScript1_DRT_CAM_Kernel_Y_b_out l "Output background" t " // Y_b\n // Luminous factor of background :math:`Y_b` such as\n // :math:`Y_b = 100 x L_b / L_w` where :math:`L_w` is the luminance of the\n // light source and :math:`L_b` is the luminance of the background. For\n // viewing images, :math:`Y_b` can be the average :math:`Y` value for the\n // pixels in the entire image, or frequently, a :math:`Y` value of 20,\n // approximate an :math:`L^*` of 50 is used."}
BlinkScript1_DRT_CAM_Kernel_Y_b_out 20
addUserKnob {26 ""}
addUserKnob {26 _2 l "" +STARTLINE T "Custom CAM 16 style prims"}
addUserKnob {41 DRT_CAM_Kernel_rxy l rxy T BlinkScript1.DRT_CAM_Kernel_rxy}
addUserKnob {41 DRT_CAM_Kernel_gxy l gxy T BlinkScript1.DRT_CAM_Kernel_gxy}
addUserKnob {41 DRT_CAM_Kernel_bxy l bxy T BlinkScript1.DRT_CAM_Kernel_bxy}
addUserKnob {41 DRT_CAM_Kernel_wxy l wxy T BlinkScript1.DRT_CAM_Kernel_wxy}
addUserKnob {26 ""}
addUserKnob {26 direction_div l Direction}
addUserKnob {6 invert t "apply the pseudo-inverse transform" +STARTLINE}
addUserKnob {41 DRT_CAM_Kernel_diagnosticMode l diagnosticMode T BlinkScript1.DRT_CAM_Kernel_diagnosticMode}
addUserKnob {26 blink_kernel_div l "Blink Kernel"}
addUserKnob {6 use_gpu l "Use GPU if available" +STARTLINE}
use_gpu true
addUserKnob {26 ""}
addUserKnob {41 kernelSourceFile l "Kernel File" T BlinkScript1.kernelSourceFile}
addUserKnob {26 "" l " "}
addUserKnob {41 reloadKernelSourceFile l Load T BlinkScript1.reloadKernelSourceFile}
addUserKnob {41 recompile l Recompile -STARTLINE T BlinkScript1.recompile}
}
Input {
inputs 0
name Input1
xpos -908
ypos -292
}
BlinkScript {
kernelSourceFile "C:/Users/Pekka Riikonen/ACESLooks/Nuke/output-transforms-dev/display-transforms/nuke/ACES2_DRT_pex2.blink"
recompileCount 4133
ProgramGroup 1
KernelDescription "3 \"DRT_CAM_Kernel\" iterate pixelWise 5a5f7de1141a81317bbd29dd30b727c3d5fe5549b0aded6f5db51a6cd912bb62 2 \"src\" Read Point \"dst\" Write Point 98 \"encodingIn\" Int 1 AAAAAA== \"AP1Clamp\" Bool 1 AA== \"primariesIn\" Int 1 AAAAAA== \"toneScaleMode\" Int 1 AAAAAA== \"discountIlluminant_in\" Bool 1 AA== \"discountIlluminant_mid\" Bool 1 AA== \"discountIlluminant_out\" Bool 1 AA== \"HK_mode_in\" Bool 1 AA== \"HK_mode_mid\" Bool 1 AA== \"HK_mode_out\" Bool 1 AA== \"compressMode\" Int 1 AAAAAA== \"referenceLuminance\" Float 1 AAAAAA== \"viewingConditions\" Int 1 AAAAAA== \"outputViewingConditions\" Int 1 AAAAAA== \"applyTonecurve\" Bool 1 AA== \"peakLuminance\" Float 1 AAAAAA== \"applyChromaCompression\" Bool 1 AA== \"applyInGamutExpansion\" Bool 1 AA== \"applyInGamutCompression\" Bool 1 AA== \"applyReachClamp\" Bool 1 AA== \"monochrome\" Bool 1 AA== \"chroma_compress\" Float 1 AAAAAA== \"Chroma Compress Factor\" Float 1 AACgQA== \"chroma_expand\" Float 1 AAAAAA== \"Chroma Expansion Factor\" Float 1 FK5HPw== \"chroma_expand_thr\" Float 1 AAAAAA== \"chromaCompressScale\" Float 1 AAAAAA== \"cc_et\" Int 1 AAAAAA== \"ccReach\" Int 1 AAAAAA== \"crxy\" Float 2 AAAAAAAAAAA= \"cgxy\" Float 2 AAAAAAAAAAA= \"cbxy\" Float 2 AAAAAAAAAAA= \"cwxy\" Float 2 AAAAAAAAAAA= \"primariesLimit\" Int 1 AAAAAA== \"whiteLimit\" Int 1 AAAAAA== \"primariesReach\" Int 1 AAAAAA== \"applyGamutCompression\" Bool 1 AA== \"cuspMidBlend\" Float 1 AAAAAA== \"focusDistance\" Float 1 AAAAAA== \"focusAdjustGain\" Float 1 AAAAAA== \"focusGainBlend\" Float 1 AAAAAA== \"disableFocusGain\" Bool 1 AA== \"disableFocusDistScaling\" Bool 1 AA== \"focusDistScaling\" Float 1 AAAAAA== \"compressionFuncParams\" Float 4 AAAAAAAAAAAAAAAAAAAAAA== \"sixAxisCompressionMode\" Bool 1 AA== \"compressionFuncParamsR\" Float 4 AAAAAAAAAAAAAAAAAAAAAA== \"compressionFuncParamsY\" Float 4 AAAAAAAAAAAAAAAAAAAAAA== \"compressionFuncParamsG\" Float 4 AAAAAAAAAAAAAAAAAAAAAA== \"compressionFuncParamsC\" Float 4 AAAAAAAAAAAAAAAAAAAAAA== \"compressionFuncParamsB\" Float 4 AAAAAAAAAAAAAAAAAAAAAA== \"compressionFuncParamsM\" Float 4 AAAAAAAAAAAAAAAAAAAAAA== \"Reachcompressmode\" Bool 1 AA== \"reachNick\" Bool 1 AA== \"Locuscompressmode\" Bool 1 AA== \"boundryIntersectionMethod\" Int 1 AAAAAA== \"disableUpperHullGamma\" Bool 1 AA== \"disableLowerHullGamma\" Bool 1 AA== \"lowerHullGamma\" Float 1 AAAAAA== \"upperHullGamma\" Float 1 AAAAAA== \"smoothCusps\" Float 1 AAAAAA== \"Smoothing factor cusp J\" Float 1 rkdhPQ== \"Smoothing factor cust M\" Float 1 WmQ7Pg== \"encodingOut\" Int 1 AAAAAA== \"primariesOut\" Int 1 AAAAAA== \"fitWhite\" Bool 1 AA== \"clampOutput\" Bool 1 AA== \"softclampOutput\" Bool 1 AA== \"clamp_thr\" Float 1 AAAAAA== \"clamp_dist\" Float 1 AAAAAA== \"invert\" Bool 1 AA== \"diagnosticMode\" Int 1 AAAAAA== \"mmScaleFactor\" Float 1 AAAAAA== \"daniele_n\" Float 1 AAAAAA== \"daniele_n_r\" Float 1 AAAAAA== \"daniele_g\" Float 1 AAAAAA== \"daniele_c\" Float 1 AAAAAA== \"daniele_c_d\" Float 1 AAAAAA== \"daniele_w_g\" Float 1 AAAAAA== \"daniele_t_1\" Float 1 AAAAAA== \"daniele_r_hit_min\" Float 1 AAAAAA== \"daniele_r_hit_max\" Float 1 AAAAAA== \"catDataSelection\" Int 1 AAAAAA== \"rxy\" Float 2 AAAAAAAAAAA= \"gxy\" Float 2 AAAAAAAAAAA= \"bxy\" Float 2 AAAAAAAAAAA= \"wxy\" Float 2 AAAAAAAAAAA= \"ra\" Float 1 AAAAAA== \"ba\" Float 1 AAAAAA== \"XYZ_w\" Float 3 AAAAAAAAAAAAAAAAAAAAAA== \"XYZ_w_scaler\" Float 1 AAAAAA== \"L_A\" Float 1 AAAAAA== \"Y_b\" Float 1 AAAAAA== \"L_B\" Float 3 AAAAAAAAAAAAAAAAAAAAAA== \"userSurround\" Float 3 AAAAAAAAAAAAAAAAAAAAAA== \"discount_illuminant\" Bool 1 AA== \"L_A_out\" Float 1 AAAAAA== \"Y_b_out\" Float 1 AAAAAA== 98 \"encodingIn\" 1 1 Default \"AP1Clamp\" 1 1 Default \"primariesIn\" 1 1 Default \"toneScaleMode\" 1 1 Default \"discountIlluminant_in\" 1 1 Default \"discountIlluminant_mid\" 1 1 Default \"discountIlluminant_out\" 1 1 Default \"HK_mode_in\" 1 1 Default \"HK_mode_mid\" 1 1 Default \"HK_mode_out\" 1 1 Default \"compressMode\" 1 1 Default \"referenceLuminance\" 1 1 Default \"viewingConditions\" 1 1 Default \"outputViewingConditions\" 1 1 Default \"applyTonecurve\" 1 1 Default \"peakLuminance\" 1 1 Default \"applyChromaCompression\" 1 1 Default \"applyInGamutExpansion\" 1 1 Default \"applyInGamutCompression\" 1 1 Default \"applyReachClamp\" 1 1 Default \"monochrome\" 1 1 Default \"chroma_compress\" 1 1 Default \"chroma_compress_fact\" 1 1 Default \"chroma_expand\" 1 1 Default \"chroma_expand_fact\" 1 1 Default \"chroma_expand_thr\" 1 1 Default \"chromaCompressScale\" 1 1 Default \"cc_et\" 1 1 Default \"ccReach\" 1 1 Default \"crxy\" 2 1 Default \"cgxy\" 2 1 Default \"cbxy\" 2 1 Default \"cwxy\" 2 1 Default \"primariesLimit\" 1 1 Default \"whiteLimit\" 1 1 Default \"primariesReach\" 1 1 Default \"applyGamutCompression\" 1 1 Default \"cuspMidBlend\" 1 1 Default \"focusDistance\" 1 1 Default \"focusAdjustGain\" 1 1 Default \"focusGainBlend\" 1 1 Default \"disableFocusGain\" 1 1 Default \"disableFocusDistScaling\" 1 1 Default \"focusDistScaling\" 1 1 Default \"compressionFuncParams\" 4 1 Default \"sixAxisCompressionMode\" 1 1 Default \"compressionFuncParamsR\" 4 1 Default \"compressionFuncParamsY\" 4 1 Default \"compressionFuncParamsG\" 4 1 Default \"compressionFuncParamsC\" 4 1 Default \"compressionFuncParamsB\" 4 1 Default \"compressionFuncParamsM\" 4 1 Default \"Reachcompressmode\" 1 1 Default \"reachNick\" 1 1 Default \"Locuscompressmode\" 1 1 Default \"boundryIntersectionMethod\" 1 1 Default \"disableUpperHullGamma\" 1 1 Default \"disableLowerHullGamma\" 1 1 Default \"lowerHullGamma\" 1 1 Default \"upperHullGamma\" 1 1 Default \"smoothCusps\" 1 1 Default \"smoothJ\" 1 1 Default \"smoothM\" 1 1 Default \"encodingOut\" 1 1 Default \"primariesOut\" 1 1 Default \"fitWhite\" 1 1 Default \"clampOutput\" 1 1 Default \"softclampOutput\" 1 1 Default \"clamp_thr\" 1 1 Default \"clamp_dist\" 1 1 Default \"invert\" 1 1 Default \"diagnosticMode\" 1 1 Default \"mmScaleFactor\" 1 1 Default \"daniele_n\" 1 1 Default \"daniele_n_r\" 1 1 Default \"daniele_g\" 1 1 Default \"daniele_c\" 1 1 Default \"daniele_c_d\" 1 1 Default \"daniele_w_g\" 1 1 Default \"daniele_t_1\" 1 1 Default \"daniele_r_hit_min\" 1 1 Default \"daniele_r_hit_max\" 1 1 Default \"catDataSelection\" 1 1 Default \"rxy\" 2 1 Default \"gxy\" 2 1 Default \"bxy\" 2 1 Default \"wxy\" 2 1 Default \"ra\" 1 1 Default \"ba\" 1 1 Default \"XYZ_w\" 3 1 Default \"XYZ_w_scaler\" 1 1 Default \"L_A\" 1 1 Default \"Y_b\" 1 1 Default \"L_B\" 3 1 Default \"userSurround\" 3 1 Default \"discount_illuminant\" 1 1 Default \"L_A_out\" 1 1 Default \"Y_b_out\" 1 1 Default 52 \"CAT_CAT16\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"CAT_CAT16_INVERSE\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"panlrcm\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"daniele_r_hit\" Float 1 1 AAAAAA== \"daniele_m_0\" Float 1 1 AAAAAA== \"daniele_m_1\" Float 1 1 AAAAAA== \"daniele_u\" Float 1 1 AAAAAA== \"daniele_m\" Float 1 1 AAAAAA== \"daniele_w_i\" Float 1 1 AAAAAA== \"daniele_c_t\" Float 1 1 AAAAAA== \"daniele_g_ip\" Float 1 1 AAAAAA== \"daniele_g_ipp2\" Float 1 1 AAAAAA== \"daniele_w_2\" Float 1 1 AAAAAA== \"daniele_s_2\" Float 1 1 AAAAAA== \"daniele_u_2\" Float 1 1 AAAAAA== \"daniele_m_2\" Float 1 1 AAAAAA== \"compr\" Float 1 1 AAAAAA== \"sat\" Float 1 1 AAAAAA== \"sat_thr\" Float 1 1 AAAAAA== \"focusDist\" Float 1 1 AAAAAA== \"st2084_m_1\" Float 1 1 AAAAAA== \"st2084_m_2\" Float 1 1 AAAAAA== \"st2084_c_1\" Float 1 1 AAAAAA== \"st2084_c_2\" Float 1 1 AAAAAA== \"st2084_c_3\" Float 1 1 AAAAAA== \"st2084_m_1_d\" Float 1 1 AAAAAA== \"st2084_m_2_d\" Float 1 1 AAAAAA== \"st2084_L_p\" Float 1 1 AAAAAA== \"identity_matrix\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"XYZ_to_RGB_input\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"XYZ_to_RGB_limit\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"XYZ_to_RGB_reach\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"XYZ_to_RGB_output\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"RGB_to_XYZ_input\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"RGB_to_XYZ_limit\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"RGB_to_XYZ_reach\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"RGB_to_XYZ_output\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"AP1_to_XYZ\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"XYZ_to_AP1\" Float 9 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \"inWhite\" Float 3 1 AAAAAAAAAAAAAAAAAAAAAA== \"outWhite\" Float 3 1 AAAAAAAAAAAAAAAAAAAAAA== \"limitWhite\" Float 3 1 AAAAAAAAAAAAAAAAAAAAAA== \"boundaryRGB\" Float 1 1 AAAAAA== \"limitJmax\" Float 1 1 AAAAAA== \"midJ\" Float 1 1 AAAAAA== \"model_gamma\" Float 1 1 AAAAAA== \"gamutCuspTable\" Float 3 361 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
kernelSource "kernel DRT_CAM_Kernel : ImageComputationKernel<ePixelWise>\n\{\n Image<eRead, eAccessPoint, eEdgeClamped> src; // the input image\n Image<eWrite> dst; // the output image\n\nparam:\n //\n // Input Parameters\n //\n\n // Encoding of the Input Image\n // 0: Linear\n // 1: ACEScct\n // 2: sRGB\n // 3: BT.1886 (Gamma 2.4)\n // 4: Gamma 2.6\n // 5: ST2084\n int encodingIn;\n\n // AP1 clamp\n bool AP1Clamp;\n\n // Primaries of the Input Image\n // 0: AP0-ACES\n // 1: AP1-ACES\n // 2: sRGB/Rec.709-D65\n // 3: Rec.2020-D65\n // 4: P3-D65\n // 5: P3-DCI\n int primariesIn;\n\n // Tonescale mode\n // 0: Linear\n // 1: Daniele Evo Curve\n int toneScaleMode;\n\n // Disable Degree of Adaptation\n // This is only effective if the limit primaries have a non-D65 white point\n // since the input conversion is assumed to be fully adapted\n // and the output conversion does not apply a CAT\n bool discountIlluminant_in;\n bool discountIlluminant_mid;\n bool discountIlluminant_out;\n\n // Toggles for Hellwig 2022 specific params\n bool HK_mode_in;\n bool HK_mode_mid;\n bool HK_mode_out;\n int compressMode;\n\n // Reference Luminance in Cd/sqm\n float referenceLuminance;\n\n // Viewing Conditions (for output)\n // 0: Dark\n // 1: Dim\n // 2: Average\n int viewingConditions;\n int outputViewingConditions;\n\n // Toggle Tone Mapping\n bool applyTonecurve;\n\n // Target Peak Luminance\n float peakLuminance;\n\n // Toggle chroma compression\n bool applyChromaCompression;\n bool applyInGamutExpansion;\n bool applyInGamutCompression;\n bool applyReachClamp;\n bool monochrome;\n\n // Chroma compression params\n float chroma_compress;\n float chroma_compress_fact;\n float chroma_expand;\n float chroma_expand_fact;\n float chroma_expand_thr;\n float chromaCompressScale;\n int cc_et;\n int ccReach;\n // xy coordinates for chroma compression gamut\n float2 crxy;\n float2 cgxy;\n float2 cbxy;\n float2 cwxy;\n\n //\n // Gamut Mapping Parameters\n //\n\n // Primaries of the Target Gamut\n // 0: AP0-ACES\n // 1: AP1-ACES\n // 2: sRGB/Rec.709-D65 # now just Rec.709\n // 3: Rec.2020-D65 # now just Rec.2020\n // 4: P3-D65 # now just P3\n // 5: P3-DCI # no longer included\n int primariesLimit;\n\n // White point of the limiting gamut\n // effectively the \"creative white\"\n // 0: ACES white\n // 1: D65\n // Could add others, or user white point\n int whiteLimit;\n\n // Primaries of the Gamut reached by the gamut compressor\n // 0: AP0-ACES\n // 1: AP1-ACES\n // 2: sRGB/Rec.709-D65\n // 3: Rec.2020-D65\n // 4: P3-D65\n // 5: P3-DCI\n // 6: Spectral Locus\n // 7: Chroma Compression Space\n int primariesReach;\n\n // Toggle Gamut Compression\n bool applyGamutCompression;\n\n // the 1D LUT used for quickly finding the approximate limiting gamut cusp JMh coordinates\n // the samples are spaced by HSV hue increments of the limiting RGB gamut\n // so to find the correct entry for a given CAM hue (h) value\n // one must search the table entries for the matching entry.z component\n #define gamutCuspTableSize 360*1\n\n // Blend Between Compressing towards\n // Target Gamut Cusp Luminance (0.0)\n // and Mid Luminance (1.0)\n float cuspMidBlend;\n\n // Focus distance of the compression focal point from the achromatic axis\n float focusDistance;\n float focusAdjustGain;\n float focusGainBlend;\n bool disableFocusGain;\n bool disableFocusDistScaling;\n float focusDistScaling;\n\n // Gamut Compression Fuction Parameters\n // Threshold / min Limit / max Limit / Power\n float4 compressionFuncParams;\n bool sixAxisCompressionMode;\n float4 compressionFuncParamsR;\n float4 compressionFuncParamsY;\n float4 compressionFuncParamsG;\n float4 compressionFuncParamsC;\n float4 compressionFuncParamsB;\n float4 compressionFuncParamsM;\n bool Reachcompressmode;\n bool reachNick;\n bool Locuscompressmode;\n\n int boundryIntersectionMethod;\n bool disableUpperHullGamma;\n bool disableLowerHullGamma;\n float lowerHullGamma;\n float upperHullGamma;\n\n // How much the edges of the target RGB cube are smoothed when finding the gamut boundary\n // in order to reduce visible contours at the gamut cusps\n float smoothCusps;\n float smoothJ; // Scaling factor for cusp J\n float smoothM; // Scaling factor for cusp M\n\n //\n // Output Parameters\n //\n\n // Encoding of the Output Image\n // 0: Linear\n // 1: ACEScct\n // 2: sRGB\n // 3: BT.1886 (Gamma 2.4)\n // 4: Gamma 2.6\n // 5: ST2084\n int encodingOut;\n\n // Primaries of the Output Image\n // 0: AP0-ACES\n // 1: AP1-ACES\n // 2: sRGB/Rec.709-D65\n // 3: Rec.2020-D65\n // 4: P3-D65\n // 5: P3-DCI\n int primariesOut;\n\n // Clamp output values to 0.0 - 1.0\n bool fitWhite;\n bool clampOutput;\n bool softclampOutput;\n float clamp_thr;\n float clamp_dist;\n\n //\n // Extra Parameters\n //\n\n // Toggle Inverse Transform\n bool invert;\n // Diagnostic path modes\n int diagnosticMode;\n\n // DanieleEvoCurve (ACES2 candidate) parameters\n float mmScaleFactor;\n float daniele_n; // peak white\n float daniele_n_r; // Normalized white in nits (what 1.0 should be)\n float daniele_g; // surround / contrast\n float daniele_c; // scene-referred grey\n float daniele_c_d; // display-referred grey (in nits)\n float daniele_w_g; // grey change between different peak luminance\n float daniele_t_1; // shadow toe, flare/glare compensation - how ever you want to call it\n float daniele_r_hit_min; // Scene-referred value \"hitting the roof\" at 100 nits\n float daniele_r_hit_max; // Scene-referred value \"hitting the roof\" at 10,000 nits\n\n // Hellwig 2022 CAM params\n // the kernel parameters\n\n // 0 = Stock CAT16\n // 1 = Thomas's custom primaries\n // 2 = live from params below\n int catDataSelection; // original vs modified CAT16 matrix\n // xy coordinates for custom CAT matrix\n float2 rxy;\n float2 gxy;\n float2 bxy;\n float2 wxy;\n float ra;\n float ba;\n\n // Input vars\n float3 XYZ_w;\n float XYZ_w_scaler;\n float L_A;\n float Y_b;\n float3 L_B;\n float3 userSurround;\n bool discount_illuminant;\n // Output vars\n float L_A_out;\n float Y_b_out;\n\nlocal:\n // Hellwig 2022 constants\n float3x3 CAT_CAT16;\n float3x3 CAT_CAT16_INVERSE;\n float3x3 panlrcm;\n\n float daniele_r_hit;\n float daniele_m_0;\n float daniele_m_1;\n float daniele_u;\n float daniele_m;\n float daniele_w_i;\n float daniele_c_t;\n float daniele_g_ip;\n float daniele_g_ipp2;\n float daniele_w_2;\n float daniele_s_2;\n float daniele_u_2;\n float daniele_m_2;\n\n // Chroma compression pre-calculated constants\n float compr; // Compression\n float sat; // Saturation\n float sat_thr; // Threshold to start expanding saturation\n\n // Gamut mapper constants\n float focusDist; // FocusDistance for projection\n\n // ST2084 vars\n float st2084_m_1;\n float st2084_m_2;\n float st2084_c_1;\n float st2084_c_2;\n float st2084_c_3;\n float st2084_m_1_d;\n float st2084_m_2_d;\n float st2084_L_p;\n\n // using the float3x3 type to store the array of 6 coefficients\n // because Blink does not support generic array assignments\n\n // matrix vars\n float3x3 identity_matrix;\n\n float3x3 XYZ_to_RGB_input;\n float3x3 XYZ_to_RGB_limit;\n float3x3 XYZ_to_RGB_reach;\n float3x3 XYZ_to_RGB_output;\n\n float3x3 RGB_to_XYZ_input;\n float3x3 RGB_to_XYZ_limit;\n float3x3 RGB_to_XYZ_reach;\n float3x3 RGB_to_XYZ_output;\n\n float3x3 AP1_to_XYZ;\n float3x3 XYZ_to_AP1;\n\n // white points\n float3 inWhite;\n float3 outWhite;\n float3 limitWhite;\n\n // the maximum RGB value of the limiting gamut\n float boundaryRGB;\n\n // the maximum lightness value of the limiting gamut\n float limitJmax;\n\n // Middle gray J\n float midJ;\n\n // Hellwig model's gamma (1 / cz)\n float model_gamma;\n\n // the 'tempTableUnsorted' table is populated\n // in increments of H of the limiting gamut HSV space starting at H=0.0\n // since it is unlikely that HSV.H=0 and JMh.h=0 line up\n // the entries are then wrap-around shifted\n // so that the 'gamutCuspTable' starts with the lowest JMh.h value\n // both tables need to be declared here since temporary array variables\n // in the init() fuction seem to crash Nuke on some systems\n float3 gamutCuspTable\[gamutCuspTableSize + 1];\n float3 gamutCuspTableReach\[gamutCuspTableSize + 1];\n float3 cgamutCuspTable\[gamutCuspTableSize + 1];\n float3 cgamutReachTable\[gamutCuspTableSize + 1];\n float2 gamutGammas\[gamutCuspTableSize + 1];\n float LocusLimitMTable\[gamutCuspTableSize + 1];\n\n void define()\n \{\n defineParam(chroma_compress_fact, \"Chroma Compress Factor\", 5.0f);\n defineParam(chroma_expand_fact, \"Chroma Expansion Factor\", 0.78f);\n defineParam(smoothJ, \"Smoothing factor cusp J\", 0.055f);\n defineParam(smoothM, \"Smoothing factor cust M\", 0.183f);\n \}\n\n // Functions used in ACES 2.0 candidate CAM DRT\n\n // multiplies a 3D vector with a 3x3 matrix\n inline float3 vector_dot(const float3x3& m, const float3 v)\n \{\n float3 r;\n for (int c = 0; c < 3; c++)\n \{\n r\[c] = m\[c]\[0] * v.x + m\[c]\[1] * v.y + m\[c]\[2] * v.z;\n \}\n\n return r;\n \}\n\n // linear interpolation between two values a & b with the bias t\n inline float lerp(float a, float b, float t)\n \{\n return a + t * (b - a);\n \}\n inline float2 lerp(float2 a, float2 b, float t)\n \{\n return a + t * (b - a);\n \}\n inline float3 lerp(float3 a, float3 b, float t)\n \{\n return a + t * (b - a);\n \}\n inline float4 lerp(float4 a, float4 b, float t)\n \{\n return a + t * (b - a);\n \}\n\n // \"safe\" power function to avoid NANs or INFs when taking a fractional power of a negative base\n // this one initially returned -pow(abs(b), e) for negative b\n // but this ended up producing undesirable results in some cases\n // so now it just returns 0.0 instead\n inline float spow(float base, float exponent)\n \{\n // a = np.atleast_1d(a)\n float a = base;\n float b = exponent;\n // // p = as_float_array(p)\n\n // float a_p = sign(a) * pow( fabs(a) ,p) ;\n\n // // a_p\[np.isnan(a_p)] = 0\n\n // return a_p;\n\n // np.sign(a) * pow(np.abs(a) , b)\n\n // float a_p = sign(a) * pow(fabs(a) , b) ;\n // if ( isnan(a_p) )\n // \{\n // a_p = a_p;\n // \}\n // else\n // \{\n // a_p = 0.0;\n // \}\n // return a_p;\n\n if (base < 0.0f && exponent != floor(exponent))\n \{\n return 0.0f;\n \}\n else\n \{\n return pow(base, exponent);\n \}\n \}\n\n // clamp the components of a 3D vector between a min & max value\n float3 clamp3(float3 v, float min, float max)\n \{\n v.x = clamp(v.x, min, max);\n v.y = clamp(v.y, min, max);\n v.z = clamp(v.z, min, max);\n return v;\n \}\n\n float3 float3spow(float3 base, float exponent)\n \{\n return float3(spow(base.x, exponent), spow(base.y, exponent), spow(base.z, exponent));\n \}\n\n inline float3 float3pow(float3 base, float exponent)\n \{\n return float3(pow(base.x, exponent), pow(base.y, exponent), pow(base.z, exponent));\n \}\n\n // \"safe\" div\n float sdiv(float a, float b)\n \{\n if (b == 0.0f)\n \{\n return 0.0f;\n \}\n return a / b;\n \}\n\n float degree_of_adaptation(float F, float L_A)\n \{\n float D = F * (1 - (1 / 3.6) * exp((-L_A - 42) / 92));\n\n return D;\n \}\n\n // convert radians to degrees\n inline float degrees(float radians)\n \{\n return radians * 180.0f / PI;\n \}\n\n // convert degrees to radians\n inline float radians(float degrees)\n \{\n return degrees / 180.0f * PI;\n \}\n\n // \"PowerP\" compression function (also used in the ACES Reference Gamut Compression transform)\n // values of v above 'threshold' are compressed by a 'power' function\n // so that an input value of 'limit' results in an output of 1.0\n float compressPowerP(float v, float threshold, float limit, float power, int inverse)\n \{\n float s = (limit - threshold) / pow(pow((1.0f - threshold) / (limit - threshold), -power) - 1.0f, 1.0f / power);\n\n float vCompressed;\n\n if (inverse)\n \{\n vCompressed = (v < threshold || limit < 1.0001f || v > threshold + s)\n ? v\n : threshold + s * pow(-(pow((v - threshold) / s, power) / (pow((v - threshold) / s, power) - 1.0f)), 1.0f / power);\n \}\n else\n \{\n vCompressed = (v < threshold || limit < 1.0001f)\n ? v\n : threshold + s * ((v - threshold) / s) / (pow(1.0f + pow((v - threshold) / s, power), 1.0f / power));\n \}\n\n return vCompressed;\n \}\n\n float3 compress_aces(float3 rgb, float3 c, float3 m, float3 y, int invert)\n \{\n float ach = max(rgb.x, max(rgb.y, rgb.z));\n float3 d = 0.0f;\n\n if (ach)\n \{\n d.x = (ach - rgb.x) / fabs(ach);\n d.y = (ach - rgb.y) / fabs(ach);\n d.z = (ach - rgb.z) / fabs(ach);\n \}\n\n rgb.x = compressPowerP(d.x, c.x, c.y, c.z, invert);\n rgb.y = compressPowerP(d.y, m.x, m.y, m.z, invert);\n rgb.z = compressPowerP(d.z, y.x, y.y, y.z, invert);\n\n rgb = ach - rgb * fabs(ach);\n\n return rgb;\n \}\n\n // basic 3D hypotenuse function, does not deal with under/overflow\n inline float hypot_float3(float3 xyz)\n \{\n return length(xyz);\n \}\n\n float3 compress_bjorn(float3 xyz)\n \{\n float C = (xyz.x + xyz.y + xyz.z) / 3;\n\n float3 xyz_temp = xyz - C;\n float R = hypot_float3(xyz_temp);\n\n if (R == 0.0f || C == 0.0f)\n return xyz;\n\n R = R * 0.816496580927726; // sqrt(2/3)\n\n xyz_temp = xyz_temp / R;\n\n float r = R / C;\n r = r * r;\n r = sqrt(4.0f / r + 1.0f) - 1.0f;\n\n float s = -min(xyz_temp.x, min(xyz_temp.y, xyz_temp.z));\n s = s - 0.5f;\n\n float t = 0.5f + sqrt(s * s + r * r / 4.0f);\n t = C / t; // t is always >= 0.5f\n\n xyz_temp = xyz_temp * t + C;\n\n return xyz_temp;\n \}\n\n float3 uncompress_bjorn(float3 xyz)\n \{\n float C = (xyz.x + xyz.y + xyz.z) / 3;\n\n float3 xyz_temp = xyz - C;\n float R = hypot_float3(xyz_temp);\n\n if (R == 0.0f || C == 0.0f)\n return xyz;\n\n R = R * 0.816496580927726; // sqrt(2/3)\n\n xyz_temp = xyz_temp / R;\n\n float t = C / R;\n t = t - 0.5f;\n\n float s = -min(xyz_temp.x, min(xyz_temp.y, xyz_temp.z));\n s = s - 0.5f;\n\n float r = 2 * sqrt(fabs(t * t - s * s)) + 1;\n r = sqrt(fabs(r * r - 1));\n if (r == 0.0)\n return xyz;\n r = C * 2 / r;\n\n xyz_temp = xyz_temp * r + C;\n\n return xyz_temp;\n \}\n\n float hue_angle_dependency_Hellwig2022(float hr)\n \{\n return -0.160 * cos(hr) + 0.132 * cos(2 * hr) - 0.405 * sin(hr) + 0.080 * sin(2 * hr) + 0.792;\n \}\n\n float3x3 RGBPrimsToXYZMatrix(float2 rxy, float2 gxy, float2 bxy, float2 wxy, float Y, bool direction)\n \{\n // # given r g b chromaticities and whitepoint, convert RGB colors to XYZ\n // # based on CtlColorSpace.cpp from the CTL source code : 77\n // # param: xy - dict of chromaticity xy coordinates: rxy: float2(x, y) etc\n // # param: Y - luminance of \"white\" - defaults to 1.0\n // # param: inverse - calculate XYZ to RGB instead\n\n float2 r = rxy;\n float2 g = gxy;\n float2 b = bxy;\n float2 w = wxy;\n\n float X = w.x * Y / w.y;\n float Z = (1 - w.x - w.y) * Y / w.y;\n\n // # Scale factors for matrix rows\n float d = r.x * (b.y - g.y) + b.x * (g.y - r.y) + g.x * (r.y - b.y);\n\n float Sr = (X * (b.y - g.y) - \\\n g.x * (Y * (b.y - 1.0f) + \\\n b.y * (X + Z)) + \\\n b.x * (Y * (g.y - 1.0f) + \\\n g.y * (X + Z))) / d ;\n\n float Sg = (X * (r.y - b.y) + \\\n r.x * (Y * (b.y - 1.0f) + \\\n b.y * (X + Z)) - \\\n b.x * (Y * (r.y - 1.0f) + \\\n r.y * (X + Z))) / d ;\n\n float Sb = (X * (g.y - r.y) - \\\n r.x * (Y * (g.y - 1.0f) + \\\n g.y * (X + Z)) + \\\n g.x * (Y * (r.y - 1.0f) + \\\n r.y * (X + Z))) / d ;\n\n // # Assemble the matrix\n float Mdata\[] =\n \{\n Sr * r.x, Sr * r.y, Sr * (1.0f - r.x - r.y),\n Sg * g.x, Sg * g.y, Sg * (1.0f - g.x - g.y),\n Sb * b.x, Sb * b.y, Sb * (1.0f - b.x - b.y),\n \};\n\n float MdataNukeOrder\[] = \{\n Mdata\[0], Mdata\[3], Mdata\[6],\n Mdata\[1], Mdata\[4], Mdata\[7],\n Mdata\[2], Mdata\[5], Mdata\[8],\n \};\n\n float3x3 newMatrix;\n newMatrix.setArray(MdataNukeOrder);\n\n // create inverse matrix\n float3x3 newMatrixInverse = newMatrix.invert();\n\n // return forward or inverse matrix\n if (direction == 0)\n \{\n return newMatrix;\n \}\n else if (direction == 1)\n \{\n return newMatrixInverse;\n \}\n \}\n\n // convert ACEScct encoded values to linear\n float ACEScct_to_linear(float v)\n \{\n return v > 0.155251141552511f ? spow(2.0f, v * 17.52f - 9.72f) : (v - 0.0729055341958355f) / 10.5402377416545f;\n \}\n\n // encode linear values as ACEScct\n float linear_to_ACEScct(float v)\n \{\n return v > 0.0078125f ? (log2(v) + 9.72f) / 17.52f : 10.5402377416545f * v + 0.0729055341958355f;\n \}\n\n // convert sRGB gamma encoded values to linear\n float sRGB_to_linear(float v)\n \{\n return v < 0.04045f ? v / 12.92f : spow((v + 0.055f) / 1.055f, 2.4f);\n \}\n\n // encode linear values as sRGB gamma\n float linear_to_sRGB(float v)\n \{\n return v <= 0.0031308f ? 12.92f * v : 1.055 * (spow(v, 1.0f / 2.4f)) - 0.055f;\n \}\n\n float3 post_adaptation_non_linear_response_compression_forward(float3 RGB, float F_L)\n \{\n const float3 F_L_RGB = float3pow(F_L / 100.0f * fabs(RGB), 0.42f);\n const float3 RGB_c = (400.0f * sign(RGB) * F_L_RGB) / (27.13f + F_L_RGB);\n return RGB_c;\n \}\n\n float3 post_adaptation_non_linear_response_compression_inverse(float3 RGB, float F_L)\n \{\n const float3 absRGB = fabs(RGB);\n const float3 RGB_p = sign(RGB) * 100.0f / F_L * float3pow((27.13f * absRGB) / (400.0f - absRGB), 1.0f / 0.42f);\n return RGB_p;\n \}\n\n // convert HSV cylindrical projection values to RGB\n float3 HSV_to_RGB(float3 HSV)\n \{\n float C = HSV.z * HSV.y;\n float X = C * (1.0f - fabs(fmod(HSV.x * 6.0f, 2.0f) - 1.0f));\n float m = HSV.z - C;\n\n float3 RGB;\n RGB.x = (HSV.x < 1.0f / 6.0f ? C\n : HSV.x < 2.0f / 6.0f ? X\n : HSV.x < 3.0f / 6.0f ? 0.0f\n : HSV.x < 4.0f / 6.0f ? 0.0f\n : HSV.x < 5.0f / 6.0f ? X\n : C)\n + m;\n RGB.y = (HSV.x < 1.0f / 6.0f ? X\n : HSV.x < 2.0f / 6.0f ? C\n : HSV.x < 3.0f / 6.0f ? C\n : HSV.x < 4.0f / 6.0f ? X\n : HSV.x < 5.0f / 6.0f ? 0.0f\n : 0.0f)\n + m;\n RGB.z = (HSV.x < 1.0f / 6.0f ? 0.0f\n : HSV.x < 2.0f / 6.0f ? 0.0f\n : HSV.x < 3.0f / 6.0f ? X\n : HSV.x < 4.0f / 6.0f ? C\n : HSV.x < 5.0f / 6.0f ? C\n : X)\n + m;\n return RGB;\n \}\n\n // convert RGB to HSV cylindrical projection values\n float3 RGB_to_HSV(float3 RGB)\n \{\n float cmax = max(RGB.x, max(RGB.y, RGB.z));\n float cmin = min(RGB.x, min(RGB.y, RGB.z));\n float delta = cmax - cmin;\n\n float3 HSV;\n HSV.x = delta == 0.0f ? 0.0f\n : cmax == RGB.x ? (fmod((RGB.y - RGB.z) / delta + 6.0f, 6.0f)) / 6.0f\n : cmax == RGB.y ? (((RGB.z - RGB.x) / delta + 2.0f) / 6.0f)\n : (((RGB.x - RGB.y) / delta + 4.0f) / 6.0f);\n HSV.y = cmax == 0.0f ? 0.0f : delta / cmax;\n HSV.z = cmax;\n return HSV;\n \}\n\n // Smooth minimum of a and b\n float smin(float a, float b, float s)\n \{\n float h = max(s - fabs(a - b), 0.0) / s;\n return min(a, b) - h * h * h * s * (1.0f / 6.0f);\n \}\n\n // reimplemented from https://github.com/nick-shaw/aces-ot-vwg-experiments/blob/master/python/intersection_approx.py\n float solve_J_intersect(float2 JM, float focusJ, float maxJ, float slope_gain)\n \{\n float a = JM.y / (focusJ * slope_gain);\n float b = 0.0f;\n float c = 0.0f;\n float intersectJ = 0.0f;\n\n if (JM.x < focusJ)\n \{\n b = 1.0f - JM.y / slope_gain;\n c = -JM.x;\n \}\n else\n \{\n b = -(1.0f + JM.y / slope_gain + maxJ * JM.y / (focusJ * slope_gain));\n c = maxJ * JM.y / slope_gain + JM.x;\n \}\n\n float root = sqrt(b * b - 4.0f * a * c);\n\n if (JM.x < focusJ)\n \{\n intersectJ = 2.0f * c / (-b - root);\n \}\n else\n \{\n intersectJ = 2.0f * c / (-b + root);\n \}\n\n return intersectJ;\n \}\n\n float3 viewingConditionsToSurround(int viewingConditions)\n \{\n float3 newSurround;\n // hack to turn incoming int value into surround coeffs\n if (viewingConditions == 0)\n \{\n // \"Dark\": InductionFactors_CIECAM02(0.8, 0.525, 0.8),\n newSurround = float3(0.8, 0.525, 0.8);\n \}\n else if (viewingConditions == 1)\n \{\n // \"Dim\": InductionFactors_CIECAM02(0.9, 0.59, 0.9),\n newSurround = float3(0.9, 0.59, 0.9);\n \}\n else if (viewingConditions == 2)\n \{\n // \"Average\": InductionFactors_CIECAM02(1, 0.69, 1),\n newSurround = float3(1.0, 0.69, 1.0);\n \}\n else if (viewingConditions == 3)\n \{\n // Pull from external input\n newSurround = userSurround;\n \}\n return newSurround;\n \}\n\n // convert XYZ tristimulus values to the CAM J (lightness), M (colorfulness) and h (hue) correlates\n // needs XYZ tristimulus values for the reference white and the viewing conditions as parameters\n inline float3 XYZ_to_JMh(float3 XYZ, float3 referenceWhite, int viewingConditions, float L_A, float Y_b, bool discountIlluminant, bool HK_mode)\n \{\n return XYZ_to_Hellwig2022_JMh(XYZ, referenceWhite, L_A, Y_b, viewingConditionsToSurround(viewingConditions), discountIlluminant, HK_mode);\n \}\n\n // convert the CAM J (lightness), M (colorfulness) and h (hue) correlates to XYZ tristimulus values\n // needs XYZ tristimulus values for the reference white and the viewing conditions as parameters\n inline float3 JMh_to_XYZ(float3 JMh, float3 referenceWhite, int viewingConditions, float L_A, float Y_b, bool discountIlluminant, bool HK_mode)\n \{\n return Hellwig2022_JMh_to_XYZ(JMh, referenceWhite, L_A, Y_b, viewingConditionsToSurround(viewingConditions), discountIlluminant, HK_mode);\n \}\n\n // convert ST2084 PQ encoded values to linear\n float ST2084_to_linear(float v)\n \{\n float V_p = spow(v, st2084_m_2_d);\n return spow((max(0.0f, V_p - st2084_c_1) / (st2084_c_2 - st2084_c_3 * V_p)), st2084_m_1_d) * st2084_L_p;\n \}\n\n // encode linear values as ST2084 PQ\n float linear_to_ST2084(float v)\n \{\n float Y_p = spow(max(0.0f, v) / st2084_L_p, st2084_m_1);\n return spow((st2084_c_1 + st2084_c_2 * Y_p) / (st2084_c_3 * Y_p + 1.0f), st2084_m_2);\n \}\n\n // decode value 'v' with the inverse of the selected encoding fuction to luminance\n float encodingToLuminance(int encoding, float v)\n \{\n if (encoding == 1)\n \{\n // ACEScct\n return ACEScct_to_linear(v) * referenceLuminance;\n \}\n else if (encoding == 2)\n \{\n // sRGB\n return sRGB_to_linear(v) * referenceLuminance;\n \}\n else if (encoding == 3)\n \{\n // BT.1886 (Gamma 2.4)\n return spow(v, 2.4f) * referenceLuminance;\n \}\n else if (encoding == 4)\n \{\n // Gamma 2.6\n return spow(v, 2.6f) * referenceLuminance;\n \}\n else if (encoding == 5)\n \{\n // ST2084\n return ST2084_to_linear(v);\n \}\n else\n \{\n // Linear\n // default\n return v * referenceLuminance;\n \}\n \}\n\n // decode the components of a 3D vector 'v' with the inverse of the selected encoding fuction to luminance\n float3 encodingToLuminance3(int encoding, float3 v)\n \{\n float3 lin;\n lin.x = encodingToLuminance(encoding, v.x);\n lin.y = encodingToLuminance(encoding, v.y);\n lin.z = encodingToLuminance(encoding, v.z);\n\n return lin;\n \}\n\n // encode the linear luminance value 'v' with the encoding fuction selected by 'encoding'\n float luminanceToEncoding(int encoding, float v)\n \{\n if (encoding == 1)\n \{\n // ACEScct\n return linear_to_ACEScct(v / referenceLuminance);\n \}\n else if (encoding == 2)\n \{\n // sRGB\n return linear_to_sRGB(v / referenceLuminance);\n \}\n else if (encoding == 3)\n \{\n // BT.1886 (Gamma 2.4)\n return spow(v / referenceLuminance, 1.0f / 2.4f);\n \}\n else if (encoding == 4)\n \{\n // Gamma 2.6\n return spow(v / referenceLuminance, 1.0f / 2.6f);\n \}\n else if (encoding == 5)\n \{\n // ST2084\n return linear_to_ST2084(v);\n \}\n else\n \{\n // Linear\n // default\n return v / referenceLuminance;\n \}\n \}\n\n // encode the linear luminance value components of a 3D vector 'v' with the encoding fuction selected by 'encoding'\n float3 luminanceToEncoding3(int encoding, float3 v)\n \{\n float3 enc;\n enc.x = luminanceToEncoding(encoding, v.x);\n enc.y = luminanceToEncoding(encoding, v.y);\n enc.z = luminanceToEncoding(encoding, v.z);\n\n return enc;\n \}\n\n // convert RGB values in the output colorspace to the CAM J (lightness), M (colorfulness) and h (hue) correlates\n float3 output_RGB_to_JMh(float3 RGB)\n \{\n float3 luminanceRGB = encodingToLuminance3(encodingOut, RGB);\n float3 XYZ = vector_dot(RGB_to_XYZ_output, luminanceRGB);\n float3 JMh = XYZ_to_JMh(XYZ, limitWhite, viewingConditions, L_A_out, Y_b_out, discountIlluminant_out, HK_mode_out);\n return JMh;\n \}\n\n // convert CAM J (lightness), M (colorfulness) and h (hue) correlates to RGB values in the output colorspace\n float3 JMh_to_output_RGB(float3 JMh)\n \{\n float3 luminanceXYZ = JMh_to_XYZ(JMh, limitWhite, outputViewingConditions, L_A_out, Y_b_out, discountIlluminant_out, HK_mode_out);\n\n // switch to treat incoming data as luminanceXYZ when in breakout mode\n if (diagnosticMode == 105)\n \{\n luminanceXYZ = JMh;\n \}\n\n // First matrix to limiting gamut for clamping\n float3 luminanceRGB = vector_dot(XYZ_to_RGB_limit, luminanceXYZ);\n\n if (fitWhite)\n \{\n // Scale to fit maximum creative white channel value\n float3 creativeWhiteXYZ = vector_dot(RGB_to_XYZ_limit, float3(1.0f, 1.0f, 1.0f)); // TODO: these scaling parameters could be precalculated\n float3 creativeWhiteRGB = vector_dot(XYZ_to_RGB_output, creativeWhiteXYZ);\n luminanceRGB *= 1.0f / max(creativeWhiteRGB.x, max(creativeWhiteRGB.y, creativeWhiteRGB.z));\n \}\n\n if (softclampOutput)\n \{\n // Soft clamp by compressing negative display linear values\n float3 compr = float3(clamp_thr, clamp_dist, 1.2f);\n luminanceRGB = compress_aces(luminanceRGB, compr, compr, compr, 0);\n \}\n\n if (clampOutput)\n \{\n // Clamp to between zero and peak luminance\n luminanceRGB = clamp3(luminanceRGB, 0.0f, peakLuminance);\n \}\n\n // Matrix to output (encoding) gamut (eventually concatenate to a single matrix)\n luminanceRGB = vector_dot(RGB_to_XYZ_limit, luminanceRGB);\n luminanceRGB = vector_dot(XYZ_to_RGB_output, luminanceRGB);\n\n // return luminanceRGB when in breakout mode\n if (diagnosticMode == 105)\n \{\n return luminanceRGB;\n \}\n\n float3 outputRGB = luminanceToEncoding3(encodingOut, luminanceRGB);\n\n return outputRGB;\n \}\n\n // convert linear RGB values with the given primaries to CAM J (lightness), M (colorfulness) and h (hue) correlates\n float3 RGB_to_JMh(const float3 RGB, float3 refWhite, const float3x3& matrix)\n \{\n const float3 luminanceRGB = RGB * boundaryRGB * referenceLuminance;\n const float3 XYZ = vector_dot(matrix, luminanceRGB);\n const float3 JMh = XYZ_to_JMh(XYZ, refWhite, viewingConditions, L_A, Y_b, discountIlluminant_mid, HK_mode_mid);\n return JMh;\n \}\n\n // convert CAM J (lightness), M (colorfulness) and h (hue) correlates to linear RGB values with the given primaries\n float3 JMh_to_RGB(float3 JMh, float3 refWhite, const float3x3& matrix)\n \{\n float3 luminanceXYZ = JMh_to_XYZ(JMh, refWhite, viewingConditions, L_A, Y_b, discountIlluminant_mid, HK_mode_mid);\n float3 luminanceRGB = vector_dot(matrix, luminanceXYZ);\n float3 RGB = luminanceRGB / boundaryRGB / referenceLuminance;\n return RGB;\n \}\n\n // XYZ to Hellwig2020 JMh\n //\n // XYZ\n // *CIE XYZ* tristimulus values of test sample / stimulus.\n // XYZ_w\n // *CIE XYZ* tristimulus values of reference white.\n // L_A\n // Adapting field *luminance* :math:`L_A` in :math:`cd/m^2`, (often taken\n // to be 20% of the luminance of a white object in the scene).\n // Y_b\n // Luminous factor of background :math:`Y_b` such as\n // :math:`Y_b = 100 x L_b / L_w` where :math:`L_w` is the luminance of the\n // light source and :math:`L_b` is the luminance of the background. For\n // viewing images, :math:`Y_b` can be the average :math:`Y` value for the\n // pixels in the entire image, or frequently, a :math:`Y` value of 20,\n // approximate an :math:`L^*` of 50 is used.\n // surround\n // Surround viewing conditions induction factors.\n // Truth value indicating if the illuminant should be discounted.\n // discount_illuminant\n //\n // NOTE: Following modifications have been made to stock Hellwig2022 model for this DRT:\n //\n // - Custom primaries\n // - Eccentriticty factor has been removed\n // - Compress mode\n //\n float3 XYZ_to_Hellwig2022_JMh(float3 XYZ, float3 XYZ_w, float L_A, float Y_b, float3 surround, bool discountIlluminant, bool HK_mode)\n \{\n XYZ_w = XYZ_w * XYZ_w_scaler;\n\n // # Step 0\n // # Converting *CIE XYZ* tristimulus values to sharpened *RGB* values.\n float3 RGB_w = vector_dot(CAT_CAT16, XYZ_w);\n\n // # Computing degree of adaptation :math:`D`.\n float D = 1.0f;\n if (!discountIlluminant)\n \{\n D = clamp(degree_of_adaptation(surround.x, L_A), 0, 1);\n \}\n\n // # Viewing conditions dependent parameters\n float k = 1 / (5 * L_A + 1);\n float k4 = pow(k, 4);\n float F_L = 0.2f * k4 * (5.0f * L_A) + 0.1f * pow((1.0f - k4), 2.0f) * pow(5.0f * L_A, 1.0f / 3.0f);\n float n = Y_b / XYZ_w.y;\n float z = 1.48 + sqrt(n);\n\n float3 D_RGB = D * XYZ_w.y / RGB_w + 1 - D;\n float3 RGB_wc = D_RGB * RGB_w;\n float3 RGB_aw = post_adaptation_non_linear_response_compression_forward(RGB_wc, F_L);\n\n // # Computing achromatic responses for the whitepoint.\n float R_aw = RGB_aw.x;\n float G_aw = RGB_aw.y;\n float B_aw = RGB_aw.z;\n\n float A_w = ra * R_aw + G_aw + ba * B_aw;\n\n // # Step 1\n // # Converting *CIE XYZ* tristimulus values to sharpened *RGB* values.\n float3 RGB = vector_dot(CAT_CAT16, XYZ);\n\n // # Step 2\n float3 RGB_c = D_RGB * RGB;\n\n // # Step 3\n // # Applying forward post-adaptation non-linear response compression.\n\n if (compressMode)\n \{\n RGB_c = compress_bjorn(RGB_c);\n \}\n\n float3 RGB_a = post_adaptation_non_linear_response_compression_forward(RGB_c, F_L);\n\n if (compressMode)\n \{\n RGB_a = uncompress_bjorn(RGB_a);\n \}\n\n // # Step 4\n // # Converting to preliminary cartesian coordinates.\n float R_a = RGB_a.x;\n float G_a = RGB_a.y;\n float B_a = RGB_a.z;\n float a = R_a - 12.0f * G_a / 11.0f + B_a / 11.0f;\n float b = (R_a + G_a - 2.0f * B_a) / 9.0f;\n\n // # Computing the *hue* angle :math:`h`.\n float hr = atan2(b, a);\n float h = wrap_to_360(degrees(hr));\n\n // # Step 6\n // # Computing achromatic responses for the stimulus.\n float R_a2 = RGB_a.x;\n float G_a2 = RGB_a.y;\n float B_a2 = RGB_a.z;\n\n float A = ra * R_a2 + G_a2 + ba * B_a2;\n\n // # Step 7\n // # Computing the correlate of *Lightness* :math:`J`.\n float J = 100.0f * pow(A / A_w, surround.y * z);\n\n // # Step 8\n // # Computing the correlate of *brightness* :math:`Q`.\n // float Q = (2.0f / float(surround.y)) * (J / 100.0f) * A_w;\n\n // # Step 9\n // # Computing the correlate of *colourfulness* :math:`M`.\n float M = 43.0f * surround.z * sqrt(a * a + b * b);\n\n // # Computing the correlate of *chroma* :math:`C`.\n float C = 35.0f * M / A_w;\n\n // # Computing the correlate of *saturation* :math:`s`.\n // float s = 100.0f * sdiv(M, Q);\n \n if (HK_mode)\n \{\n // # *Helmholtz–Kohlrausch* Effect Extension.\n J = J + hue_angle_dependency_Hellwig2022(hr) * spow(C, 0.587f);\n // float Q_HK = (2.0f / surround.y) * (J / 100.0f) * A_w;\n \}\n \n if (J == 0.0f)\n M = 0.0f;\n return \{J, M, h\};\n \}\n\n float3 Hellwig2022_JMh_to_XYZ(float3 JMh, float3 XYZ_w, float L_A, float Y_b, float3 surround, bool discountIlluminant, bool HK_mode)\n \{\n float J = JMh.x;\n float M = JMh.y;\n float h = JMh.z;\n XYZ_w = XYZ_w * XYZ_w_scaler;\n\n // # Step 0\n // # Converting *CIE XYZ* tristimulus values to sharpened *RGB* values.\n float3 RGB_w = vector_dot(CAT_CAT16, XYZ_w);\n\n // # Computing degree of adaptation :math:`D`.\n float D = 1.0f;\n if (!discountIlluminant)\n \{\n D = clamp(degree_of_adaptation(surround.x, L_A), 0, 1);\n \}\n\n // # Viewing conditions dependent parameters\n float k = 1 / (5 * L_A + 1);\n float k4 = pow(k, 4);\n float F_L = 0.2f * k4 * (5.0f * L_A) + 0.1f * pow((1.0f - k4), 2.0f) * pow(5.0f * L_A, 1.0f / 3.0f);\n float n = Y_b / XYZ_w.y;\n float z = 1.48 + sqrt(n);\n\n float3 D_RGB = D * XYZ_w.y / RGB_w + 1 - D;\n float3 RGB_wc = D_RGB * RGB_w;\n float3 RGB_aw = post_adaptation_non_linear_response_compression_forward(RGB_wc, F_L);\n\n // # Computing achromatic responses for the whitepoint.\n float R_aw = RGB_aw.x;\n float G_aw = RGB_aw.y;\n float B_aw = RGB_aw.z;\n float A_w = ra * R_aw + G_aw + ba * B_aw;\n\n float hr = radians(h);\n\n // # *Helmholtz–Kohlrausch* Effect Extension.\n float C = (M * 35) / A_w;\n if (HK_mode)\n \{\n J = J - hue_angle_dependency_Hellwig2022(hr) * spow(C, 0.587f);\n \}\n\n // # Computing achromatic response :math:`A` for the stimulus.\n float A = A_w * spow(J / 100.0f, 1.0f / (surround.y * z));\n\n // # Computing *P_p_1* to *P_p_2*.\n float P_p_1 = 43.0f * surround.z;\n float P_p_2 = A;\n\n // # Step 3\n // # Computing opponent colour dimensions :math:`a` and :math:`b`.\n float gamma = M / P_p_1;\n float a = gamma * cos(hr);\n float b = gamma * sin(hr);\n\n // # Step 4\n // # Applying post-adaptation non-linear response compression matrix.\n float3 RGB_a = vector_dot(panlrcm, float3(P_p_2, a, b)) / 1403.0f;\n\n // # Step 5\n // # Applying inverse post-adaptation non-linear response compression.\n if (compressMode)\n \{\n RGB_a = compress_bjorn(RGB_a);\n \}\n\n float3 RGB_c = post_adaptation_non_linear_response_compression_inverse(RGB_a, F_L);\n\n if (compressMode)\n \{\n RGB_c = uncompress_bjorn(RGB_c);\n \}\n\n // # Step 6\n float3 RGB = RGB_c / D_RGB;\n\n // # Step 7\n float3 XYZ = vector_dot(CAT_CAT16_INVERSE, RGB);\n\n return XYZ;\n \}\n\n // retrieve the JM coordinates of the limiting gamut cusp at the hue slice 'h'\n // cusps are very expensive to compute\n // and the DRT is only using them for lightness mapping\n // which does not require a high degree of accuracy\n // so instead we use a pre-computed table of cusp points\n // sampled at 1 degree hue intervals of the the RGB target gamut\n // and lerp between them to get the approximate J & M values\n\n inline int midpoint(int low, int high)\n \{\n return int((high + low) / 2); // Integer division\n \}\n\n int find_upper_hue_in_table(float h, float3 table\[], int table_size)\n \{\n int low_i = 0;\n int high_i = table_size - 1;\n int i = hue_position_in_uniform_table(h, table_size);\n\n while (low_i + 1 < high_i)\n \{\n if (h > table\[i].z)\n \{\n low_i = i;\n \}\n else\n \{\n high_i = i;\n \}\n i = midpoint(low_i, high_i);\n \}\n return high_i;\n \}\n\n float2 cuspFromTable(float h)\n \{\n float3 lo;\n float3 hi;\n if (h <= gamutCuspTable\[0].z)\n \{\n lo = gamutCuspTable\[gamutCuspTableSize - 1];\n lo.z = lo.z - 360.0f;\n hi = gamutCuspTable\[0];\n \}\n else\n \{\n int low_i = 0;\n int high_i = gamutCuspTableSize;\n int i = hue_position_in_uniform_table(h, gamutCuspTableSize);\n\n while (low_i + 1 < high_i)\n \{\n if (h > gamutCuspTable\[i].z)\n \{\n low_i = i;\n \}\n else\n \{\n high_i = i;\n \}\n i = midpoint(low_i, high_i);\n \}\n lo = gamutCuspTable\[high_i - 1];\n hi = gamutCuspTable\[high_i];\n \}\n\n float t = (h - lo.z) / (hi.z - lo.z);\n\n float cuspJ = lerp(lo.x, hi.x, t);\n float cuspM = lerp(lo.y, hi.y, t);\n\n return float2(cuspJ, cuspM);\n \}\n\n float2 cuspFromTableLocus(float h)\n \{\n const int i_lo = hue_position_in_uniform_table(h, gamutCuspTableSize);\n\n const float lo = LocusLimitMTable\[i_lo];\n const float hi = LocusLimitMTable\[i_lo + 1];\n\n const float base_hue = base_hue_for_position(i_lo, gamutCuspTableSize);\n const float t = h - base_hue;\n\n const float cuspJ = 69;\n const float cuspM = lerp(lo, hi, t);\n return float2(cuspJ, cuspM);\n \}\n\n float2 ccuspFromTable(float h)\n \{\n float3 lo;\n float3 hi;\n\n if (h <= cgamutCuspTable\[0].z)\n \{\n lo = cgamutCuspTable\[gamutCuspTableSize - 1];\n lo.z = lo.z - 360.0f;\n hi = cgamutCuspTable\[0];\n \}\n else\n \{\n int low_i = 0;\n int high_i = gamutCuspTableSize;\n int i = hue_position_in_uniform_table(h, gamutCuspTableSize);\n\n while (low_i + 1 < high_i)\n \{\n if (h > cgamutCuspTable\[i].z)\n \{\n low_i = i;\n \}\n else\n \{\n high_i = i;\n \}\n i = midpoint(low_i, high_i);\n \}\n lo = cgamutCuspTable\[high_i - 1];\n hi = cgamutCuspTable\[high_i];\n \}\n\n float t = (h - lo.z) / (hi.z - lo.z);\n\n float cuspJ = lerp(lo.x, hi.x, t);\n float cuspM = lerp(lo.y, hi.y, t);\n\n return float2(cuspJ, cuspM);\n \}\n\n inline float wrap_to_360(float hue)\n \{\n float y = fmod(hue, 360.0f);\n if (y < 0.0)\n \{\n y = y + 360.0f;\n \}\n return y;\n \}\n\n inline int hue_position_in_uniform_table(float wrapped_hue, int table_size)\n \{\n return int(wrapped_hue / 360.0f * table_size);\n \}\n\n inline float base_hue_for_position(int i_lo, int table_size)\n \{\n return float(i_lo) * 360.0f / float(table_size);\n \}\n\n float cReachFromTable(float h)\n \{\n const int i_lo = hue_position_in_uniform_table(h, gamutCuspTableSize);\n\n const float3 lo = cgamutReachTable\[i_lo];\n const float3 hi = cgamutReachTable\[i_lo + 1];\n\n const float t = (h - lo.z) / (hi.z - lo.z);\n return lerp(lo.y, hi.y, t);\n \}\n\n float daniele_evo_fwd(float Y)\n \{\n float f = daniele_m_2 * pow(max(0.0f, Y) / (Y + daniele_s_2), daniele_g);\n float h = max(0.0f, f * f / (f + daniele_t_1));\n return h;\n \}\n\n float daniele_evo_rev(float Y)\n \{\n Y = max(0.0f, min(daniele_n / (daniele_u_2 * daniele_n_r), Y));\n float h = (Y + sqrt(Y * (4.0f * daniele_t_1 + Y))) / 2.0f;\n float f = daniele_s_2 / (pow((daniele_m_2 / h), (1.0f / daniele_g)) - 1.0f);\n return f;\n \}\n\n float chromaCompressNorm(float h)\n \{\n float hr = radians(h);\n float a = cos(hr);\n float b = sin(hr);\n float cos_hr2 = a * a - b * b;\n float sin_hr2 = 2.0f * a * b;\n float cos_hr3 = 4.0f * a * a * a - 3.0f * a;\n float sin_hr3 = 3.0f * b - 4.0f * b * b * b;\n\n float M = 11.34072f * a +\n 16.46899f * cos_hr2 +\n 7.88380f * cos_hr3 +\n 14.66441f * b +\n -6.37224f * sin_hr2 +\n 9.19364f * sin_hr3 +\n 77.12896f;\n\n return M * chromaCompressScale;\n \}\n\n // A \"toe\" function that remaps the given value x between 0 and limit.\n // The k1 and k2 parameters change the size and shape of the toe.\n // https://www.desmos.com/calculator/6vplvw14ti\n float toe(float x, float limit, float k1, float k2, int inverse)\n \{\n if (x > limit)\n return x;\n\n k2 = max(k2, 0.001f);\n k1 = sqrt(k1 * k1 + k2 * k2);\n float k3 = (limit + k1) / (limit + k2);\n\n if (!inverse)\n return 0.5f * (k3 * x - k1 + sqrt((k3 * x - k1) * (k3 * x - k1) + 4 * k2 * k3 * x));\n else\n return (x * x + k1 * x) / (k3 * (x + k2));\n \}\n\n // Chroma compression\n //\n // Compresses colors inside the gamut with the aim for colorfulness to have an\n // appropriate rate of change from display black to display white, and from\n // achromatic outward to purer colors.\n //\n float chromaCompression(float3 JMh, float origJ, float linear, int invert)\n \{\n float M = JMh.y;\n if (M == 0.0f)\n return M;\n\n float nJ = JMh.x / limitJmax;\n float snJ = max(0.0f, 1.0f - nJ);\n float Mnorm = chromaCompressNorm(JMh.z);\n float limit = pow(nJ, model_gamma) * cReachFromTable(JMh.z) / Mnorm;\n\n if (!invert)\n \{\n // Rescaling of M with the tonescaled J to get the M to the same range as\n // J after the tonescale. The rescaling uses the Hellwig2022 model gamma to\n // keep the M/J ratio correct (keeping the chromaticities constant).\n M *= pow(JMh.x / origJ, model_gamma);\n\n if (applyInGamutCompression || applyInGamutExpansion)\n \{\n // Normalize M with the rendering space cusp M\n M /= Mnorm;\n\n // Expand the colorfulness by running the toe function in reverse. The goal is to\n // expand less saturated colors less and more saturated colors more. The expansion\n // increases saturation in the shadows and mid-tones but not in the highlights.\n // The 0.001 offset starts the expansions slightly above zero. The sat_thr makes\n // the toe less aggressive near black to reduce the expansion of noise.\n if (applyInGamutExpansion)\n M = limit - toe(limit - M, limit - 0.001f, snJ * sat, sqrt(nJ * nJ + sat_thr), 0);\n\n // Compress the colorfulness. The goal is to compress less saturated colors more and\n // more saturated colors less, especially in the highlights. This step creates the\n // saturation roll-off in the highlights, but attemps to preserve pure colors. This\n // mostly affects highlights and mid-tones, and does not compress shadows.\n if (applyInGamutCompression)\n M = toe(M, limit, nJ * compr, snJ, 0);\n\n // Clamp M to the rendering space\n if (applyReachClamp)\n M = min(limit, M);\n\n // Denormalize\n M *= Mnorm;\n \}\n \}\n else\n \{\n if (applyInGamutCompression)\n \{\n M /= Mnorm;\n M = toe(M, limit, nJ * compr, snJ, 1);\n if (applyInGamutExpansion)\n M = limit - toe(limit - M, limit - 0.001f, snJ * sat, sqrt(nJ * nJ + sat_thr), 1);\n M *= Mnorm;\n \}\n\n M *= pow(JMh.x / origJ, -model_gamma);\n \}\n\n return M;\n \}\n\n float3 input_RGB_to_JMh(float3 inputRGB)\n \{\n // convert to linear XYZ luminance values\n float3 luminanceRGB = encodingToLuminance3(encodingIn, inputRGB);\n float3 luminanceXYZ = vector_dot(RGB_to_XYZ_input, luminanceRGB);\n\n if (AP1Clamp)\n \{\n luminanceRGB = vector_dot(XYZ_to_AP1, luminanceXYZ);\n luminanceRGB.x = max(0.0f, luminanceRGB.x);\n luminanceRGB.y = max(0.0f, luminanceRGB.y);\n luminanceRGB.z = max(0.0f, luminanceRGB.z);\n luminanceXYZ = vector_dot(AP1_to_XYZ, luminanceRGB);\n \}\n\n float3 JMh = XYZ_to_JMh(luminanceXYZ, inWhite, viewingConditions, L_A, Y_b, discountIlluminant_in, HK_mode_in);\n\n if (diagnosticMode == 6 || diagnosticMode == 100)\n \{\n return luminanceXYZ;\n \}\n else\n \{\n return JMh;\n \}\n \}\n\n float3 JMh_to_input_RGB(float3 JMh)\n \{\n float3 luminanceXYZ = JMh_to_XYZ(JMh, inWhite, viewingConditions, L_A, Y_b, discountIlluminant_in, HK_mode_in);\n float3 luminanceRGB = vector_dot(XYZ_to_RGB_input, luminanceXYZ);\n float3 inputRGB = luminanceToEncoding3(encodingIn, luminanceRGB);\n\n return inputRGB;\n \}\n\nfloat Y_to_Hellwig_J(float Y, float3 surround)\n \{\n // Viewing conditions dependent parameters (could be pre-calculated)\n float k = 1.0f / (5.0f * L_A + 1.0f);\n float k4 = k*k*k*k;\n float F_L = 0.2f * k4 * (5.0f * L_A) + 0.1f * pow((1.0f - k4), 2.0f) * pow(5.0f * L_A, 1.0f / 3.0f) ;\n float n = Y_b / XYZ_w_scaler;\n float z = 1.48f + sqrt(n);\n float F_L_W = pow(F_L, 0.42f);\n float A_w = (400.0f * F_L_W) / (27.13f + F_L_W);\n\n float F_L_Y = pow(F_L * fabs(Y) / 100.0f, 0.42f);\n\n return sign(Y) * 100.0f * pow(((400.0f * F_L_Y) / (27.13f + F_L_Y)) / A_w, surround.y * z);\n \}\n\n float Hellwig_J_to_Y(float J, float3 surround)\n \{\n // Viewing conditions dependent parameters (could be pre-calculated)\n float k = 1.0f / (5.0f * L_A + 1.0f);\n float k4 = k*k*k*k;\n float F_L = 0.2f * k4 * (5.0f * L_A) + 0.1f * pow((1.0f - k4), 2.0f) * pow(5.0f * L_A, 1.0f / 3.0f) ;\n float n = Y_b / XYZ_w_scaler;\n float z = 1.48f + sqrt(n);\n float F_L_W = pow(F_L, 0.42f);\n float A_w = (400.0f * F_L_W) / (27.13f + F_L_W);\n\n float A = A_w * pow(fabs(J) / 100.0f, 1.0f / (surround.y * z));\n\n return sign(J) * 100.0f / F_L * pow((27.13f * A) / (400.0f - A), 1.0f / 0.42f);\n \}\n\n float3 forwardTonescale(float3 inputJMh)\n \{\n float3 outputJMh;\n float3 surround = viewingConditionsToSurround(viewingConditions);\n float linear = Hellwig_J_to_Y(inputJMh.x, surround) / referenceLuminance;\n float luminanceTS = linear;\n\n // switch for applying the different tonescale compression functions\n if (toneScaleMode == 1)\n \{\n luminanceTS = daniele_evo_fwd(luminanceTS) * mmScaleFactor;\n \}\n\n float tonemappedJ = Y_to_Hellwig_J(luminanceTS, surround);\n float3 tonemappedJMh = float3(tonemappedJ, inputJMh.y, inputJMh.z);\n\n if (applyTonecurve)\n \{\n outputJMh = tonemappedJMh;\n \}\n else\n \{\n outputJMh = inputJMh;\n \}\n\n if (applyChromaCompression)\n \{\n outputJMh.y = chromaCompression(tonemappedJMh, inputJMh.x, linear, 0);\n \}\n\n if (monochrome)\n \{\n outputJMh.y = 0.0f;\n \}\n\n return outputJMh;\n \}\n\n float3 inverseTonescale(float3 JMh)\n \{\n float3 tonemappedJMh = JMh;\n float3 surround = viewingConditionsToSurround(viewingConditions);\n\n if (!applyTonecurve && !applyChromaCompression)\n \{\n // nothing else to do here\n return tonemappedJMh;\n \}\n\n float3 untonemappedColourJMh = tonemappedJMh;\n\n float luminance = Hellwig_J_to_Y(tonemappedJMh.x, surround);\n\n // Dummy value to init the var\n float linear = 0.0f;\n if (toneScaleMode == 1)\n \{\n linear = daniele_evo_rev(luminance / mmScaleFactor);\n \}\n else\n \{\n linear = luminance;\n \}\n\n linear = linear * referenceLuminance;\n\n if (applyTonecurve)\n \{\n float untonemappedJ = Y_to_Hellwig_J(linear, surround);\n untonemappedColourJMh = float3(untonemappedJ, tonemappedJMh.y, tonemappedJMh.z);\n \}\n\n if (applyChromaCompression)\n \{\n untonemappedColourJMh.y = chromaCompression(tonemappedJMh, untonemappedColourJMh.x, linear, 1);\n \}\n\n return untonemappedColourJMh;\n \}\n\n float2 hueDependantHullGammas(float h)\n \{\n const int i_lo = hue_position_in_uniform_table(h, gamutCuspTableSize);\n const float base_hue = base_hue_for_position(i_lo, gamutCuspTableSize);\n const float t = h - base_hue;\n\n return lerp(gamutGammas\[i_lo], gamutGammas\[i_lo + 1], t);\n \}\n\n // reimplemented from https://github.com/nick-shaw/aces-ot-vwg-experiments/blob/master/python/intersection_approx.py\n float3 findGamutBoundaryIntersection(float3 JMh_s, float2 JM_cusp, float J_focus, float J_max, float slope_gain, float smoothness,\n float gamma_top, float gamma_bottom)\n \{\n float2 JM_source = float2(JMh_s.x, JMh_s.y);\n\n float slope = 0.0f;\n\n float s = max(0.000001f, smoothness);\n JM_cusp.x *= 1.0f + smoothJ * s; // J\n JM_cusp.y *= 1.0f + smoothM * s; // M\n\n float J_intersect_source = solve_J_intersect(JM_source, J_focus, J_max, slope_gain);\n float J_intersect_cusp = solve_J_intersect(JM_cusp, J_focus, J_max, slope_gain);\n\n if (J_intersect_source < J_focus)\n \{\n slope = J_intersect_source * (J_intersect_source - J_focus) / (J_focus * slope_gain);\n \}\n else\n \{\n slope = (J_max - J_intersect_source) * (J_intersect_source - J_focus) / (J_focus * slope_gain);\n \}\n\n float M_boundary_lower = J_intersect_cusp * pow(J_intersect_source / J_intersect_cusp, 1 / gamma_bottom) / (JM_cusp.x / JM_cusp.y - slope);\n\n float M_boundary_upper = JM_cusp.y * (J_max - J_intersect_cusp)\n * pow((J_max - J_intersect_source) / (J_max - J_intersect_cusp), 1.0f / gamma_top) / (slope * JM_cusp.y + J_max - JM_cusp.x);\n\n float M_boundary = JM_cusp.y * smin(M_boundary_lower / JM_cusp.y, M_boundary_upper / JM_cusp.y, s);\n\n float J_boundary = J_intersect_source + slope * M_boundary;\n\n return float3(J_boundary, M_boundary, J_intersect_source);\n \}\n\n // Approximation of the gamut intersection to a curved and smoothened triangle\n // along the projection line 'from -> to'.\n float2 find_gamut_intersection(float2 cusp, float2 from, float2 to, float smoothing)\n \{\n float t0, t1;\n\n // Scale the cusp outward when smoothing to avoid reducing the gamut. Reduce\n // smoothing for high cusps because smin() will bias it too much for the longer line.\n float s = max(lerp(smoothing, smoothing * 0.05f, cusp.x / limitJmax), 0.0001f);\n cusp.y *= 1.0f + 0.18f * s;\n cusp.x *= 1.0f + 0.07f * s;\n\n // Line below the cusp is curved with model_gamma\n float toJ_gamma = cusp.x * spow(to.x / cusp.x, model_gamma);\n float fromJ_gamma = cusp.x * spow(from.x / cusp.x, model_gamma);\n t0 = cusp.y * toJ_gamma / (from.y * cusp.x + cusp.y * (toJ_gamma - fromJ_gamma));\n\n // Line above the cusp\n t1 = cusp.y * (to.x - limitJmax) / (from.y * (cusp.x - limitJmax) + cusp.y * (to.x - from.x));\n\n // Smooth minimum to smooth the cusp\n t1 = smin(fabs(t0), fabs(t1), s);\n\n return float2(to.x * (1.0f - t1) + t1 * from.x, t1 * from.y);\n \}\n\n float2 findCurveIntersection(float c, float2 cusp, float m, float h)\n \{\n // based on this desmos plot https://www.desmos.com/calculator/pcsovzirqa\n float xc = cusp.y;\n float yc = cusp.x;\n float f = 1.0;\n float mf = m * f;\n float xi = 1.0f;\n float g1 = 1.0f / model_gamma;\n float g2 = hueDependantHullGammas(h).y;\n\n if (m * xc + c < yc)\n \{\n // below cusp\n xi = spow((1 - mf), (g1 - 1)) * ((yc * spow((c / yc), (1.0 / g1))) / (yc / xc - m));\n \}\n else\n \{\n // above cusp\n xi =\n spow((1 + mf), ((g2 - 1))) * (xc * (limitJmax - yc) * spow(((limitJmax - c) / (limitJmax - yc)), (1 / g2)) / (m * xc + limitJmax - yc));\n \}\n float yi = (m * xi) + c;\n if (yi > limitJmax)\n \{\n yi = limitJmax;\n xi = 0.0f;\n \}\n return float2(yi, xi);\n \}\n\n float3 getLocusBoundry(float3 Jmh)\n \{\n float h = Jmh.z;\n\n float2 cuspLocus = cuspFromTableLocus(h);\n float cuspTarget100 = cuspLocus.y;\n float cuspTarget = cuspTarget100 * pow((Jmh.x / 100.0f), model_gamma);\n float difference = cuspLocus.y / cuspTarget;\n return float3(Jmh.x, cuspTarget, Jmh.z);\n \}\n\n float3 getReachBoundry(float3 Jmh)\n \{\n const float h = Jmh.z;\n\n const int i_lo = hue_position_in_uniform_table(h, gamutCuspTableSize);\n\n const float3 lo = gamutCuspTableReach\[i_lo];\n const float3 hi = gamutCuspTableReach\[i_lo + 1];\n\n const float t = (h - lo.z) / (hi.z - lo.z);\n\n const float reachMaxM = lerp(lo.y, hi.y, t);\n if (reachNick)\n \{\n float2 JMcusp = cuspFromTable(Jmh.z);\n float focusJ = lerp(JMcusp.x, midJ, min(1.0f, cuspMidBlend - (JMcusp.x / limitJmax)));\n float slope_gain = limitJmax * focusDist * getFocusGain(Jmh.x, JMcusp.x);\n float intersectJ = solve_J_intersect(float2(Jmh.x, Jmh.y), focusJ, limitJmax, slope_gain);\n float slope;\n if (intersectJ < focusJ)\n \{\n slope = intersectJ * (intersectJ - focusJ) / (focusJ * slope_gain);\n \}\n else\n \{\n slope = (limitJmax - intersectJ) * (intersectJ - focusJ) / (focusJ * slope_gain);\n \}\n float boundaryNick = limitJmax * pow(intersectJ / limitJmax, model_gamma) * reachMaxM / (limitJmax - slope * reachMaxM);\n return float3(Jmh.x, boundaryNick, Jmh.z);\n \}\n float cuspTarget = reachMaxM * pow((Jmh.x / limitJmax), model_gamma);\n return float3(Jmh.x, cuspTarget, Jmh.z);\n \}\n\n float4 getCompressionFuncParams(float3 Jmh)\n \{\n float h = Jmh.z;\n\n float angleR = 20.0f;\n float angleY = 102.0f;\n float angleG = 146.0f;\n float angleC = 193.0f;\n float angleB = 259.0f;\n float angleM = 342.0f;\n\n float lerpVal = 0.0f;\n\n if (Reachcompressmode)\n \{\n if (primariesReach != 6) // All of the primary based reach values\n \{\n // use primary based reach\n float locusMax = getReachBoundry(Jmh).y;\n float difference = max(1.0001f, locusMax / Jmh.y);\n float threshold = max(compressionFuncParams.x, 1.0f / difference);\n return float4(threshold, difference, difference, compressionFuncParams.w);\n \}\n else\n \{\n // use locus based reach\n float locusMax = getLocusBoundry(Jmh).y;\n float difference = locusMax / Jmh.y;\n return float4(compressionFuncParams.x, difference, difference, compressionFuncParams.w);\n \}\n \}\n\n if (!sixAxisCompressionMode)\n return compressionFuncParams;\n else\n \{\n if (h >= angleR && h < angleY)\n \{\n lerpVal = (h - angleR) / (angleY - angleR);\n return lerp(compressionFuncParamsR, compressionFuncParamsY, lerpVal);\n \}\n if (h >= angleY && h < angleG)\n \{\n lerpVal = (h - angleY) / (angleG - angleY);\n return lerp(compressionFuncParamsY, compressionFuncParamsG, lerpVal);\n \}\n if (h >= angleG && h < angleC)\n \{\n lerpVal = (h - angleG) / (angleC - angleG);\n return lerp(compressionFuncParamsG, compressionFuncParamsC, lerpVal);\n \}\n if (h >= angleC && h < angleB)\n \{\n lerpVal = (h - angleC) / (angleB - angleC);\n return lerp(compressionFuncParamsC, compressionFuncParamsB, lerpVal);\n \}\n if (h >= angleB && h < angleM)\n \{\n lerpVal = (h - angleB) / (angleM - angleB);\n return lerp(compressionFuncParamsB, compressionFuncParamsM, lerpVal);\n \}\n if (h >= angleM && h < angleR + 360.0f)\n \{\n lerpVal = (h - angleM) / (angleR + 360.0f - angleM);\n return lerp(compressionFuncParamsM, compressionFuncParamsR, lerpVal);\n \}\n if (h < angleR)\n \{\n lerpVal = (h + 360.0f - angleM) / (angleR + 360.0f - angleM);\n return lerp(compressionFuncParamsM, compressionFuncParamsR, lerpVal);\n \}\n else\n \{\n return compressionFuncParams;\n \}\n \}\n \}\n\n // https://www.desmos.com/calculator/oe2fscya80\n float getFocusGain(float J, float cuspJ)\n \{\n if (disableFocusGain)\n return 1.0f;\n\n float thr = lerp(cuspJ, limitJmax, focusGainBlend);\n if (J > thr)\n \{\n // Approximate inverse required above threshold\n float gain = (limitJmax - thr) / max(0.0001f, (limitJmax - min(limitJmax, J)));\n return pow(log10(gain), 1.0f / focusAdjustGain) + 1.0f;\n \}\n else\n \{\n // Analytic inverse possible below cusp\n return 1.0f;\n \}\n \}\n\n float3 compressGamut(float3 JMh, int invert)\n \{\n if (disableFocusGain)\n return compressGamut2(JMh, invert, JMh.x);\n\n if (!invert)\n \{\n return compressGamut2(JMh, 0, JMh.x);\n \}\n else\n \{\n float2 JMcusp = cuspFromTable(JMh.z);\n float Jx = JMh.x;\n\n // Analytic inverse below threshold\n if (Jx <= lerp(JMcusp.x, limitJmax, focusGainBlend))\n return compressGamut2(JMh, 1, Jx);\n\n // Approximation above\n Jx = compressGamut2(JMh, 1, Jx).x;\n return compressGamut2(JMh, 1, Jx);\n \}\n \}\n\n float3 compressGamut2(float3 JMh, int invert, float Jx)\n \{\n float2 project_from = float2(JMh.x, JMh.y);\n float2 JMcusp = cuspFromTable(JMh.z);\n\n if (!applyGamutCompression)\n return JMh;\n if (project_from.y == 0.0f)\n return JMh;\n\n // Calculate where the out of gamut color is projected to\n float focusJ = lerp(JMcusp.x, midJ, min(1.0f, cuspMidBlend - (JMcusp.x / limitJmax)));\n\n // https://www.desmos.com/calculator/9u0wiiz9ys\n float Mratio = project_from.y / (focusDist * JMcusp.y);\n float a = max(0.001f, Mratio / focusJ);\n float b0 = 1.0f - Mratio;\n float b1 = -(1.0f + Mratio + (a * limitJmax));\n float b = project_from.x < focusJ ? b0 : b1;\n float c0 = -project_from.x;\n float c1 = project_from.x + limitJmax * Mratio;\n float c = project_from.x < focusJ ? c0 : c1;\n\n // XXX this sqrt can cause NaNs (subtraction goes negative)\n float J0 = sqrt(b * b - 4 * a * c);\n float J1 = (-b - J0) / (2 * a);\n J0 = (-b + J0) / (2 * a);\n float projectJ = project_from.x < focusJ ? J0 : J1;\n\n float slope_gain = limitJmax * focusDist * getFocusGain(Jx, JMcusp.x);\n\n // Find gamut intersection\n float2 project_to = float2(projectJ, 0.0f);\n float2 JMboundary = float2(1.0f, 1.0f);\n if (boundryIntersectionMethod == 0)\n \{\n // Original method implemented by Pekka\n JMboundary = find_gamut_intersection(JMcusp, project_from, project_to, smoothCusps);\n \}\n else if (boundryIntersectionMethod == 1)\n \{\n // Alternate method shown in Oct 19 meeting\n float m = (JMh.x - projectJ) / JMh.y;\n JMboundary = findCurveIntersection(JMh.x, JMcusp, 0.0f, JMh.z);\n \}\n else if (boundryIntersectionMethod == 2)\n \{\n const float2 gammas = hueDependantHullGammas(JMh.z);\n float3 nickBoundryReturn = findGamutBoundaryIntersection(JMh, JMcusp, focusJ, limitJmax, slope_gain, smoothCusps, gammas.x, gammas.y);\n JMboundary = float2(nickBoundryReturn.x, nickBoundryReturn.y);\n project_to = float2(nickBoundryReturn.z, 0.0f);\n projectJ = nickBoundryReturn.z;\n \}\n\n // Get hue dependent compression parameters\n float4 interpolatedCompressionFuncParams;\n if (reachNick)\n \{\n interpolatedCompressionFuncParams = getCompressionFuncParams(float3(JMboundary.x, JMboundary.y, JMh.z));\n \}\n else\n \{\n interpolatedCompressionFuncParams = getCompressionFuncParams(float3(JMh.x, JMboundary.y, JMh.z));\n \}\n\n if (!Reachcompressmode)\n interpolatedCompressionFuncParams.x =\n 1.0f / lerp(interpolatedCompressionFuncParams.z, interpolatedCompressionFuncParams.y, projectJ / limitJmax);\n\n // Compress the out of gamut color along the projection line\n float2 JMcompressed = project_from;\n\n float lowerMlimit = 0.0001f; // Testing a small value here\n if (JMh.x < limitJmax\n && JMh.y > lowerMlimit) // using a small value to test against here rather than 0.0, and I was getting Nans on inversion.\n \{\n float v = project_from.y / JMboundary.y;\n v = compressPowerP(v, interpolatedCompressionFuncParams.x,\n lerp(interpolatedCompressionFuncParams.z, interpolatedCompressionFuncParams.y, projectJ / limitJmax),\n interpolatedCompressionFuncParams.w, invert);\n JMcompressed = project_to + v * (JMboundary - project_to);\n \}\n else\n \{\n JMcompressed = float2(JMh.x, 0.0f);\n \}\n\n if (diagnosticMode == 5)\n \{\n return float3(focusJ, Mratio, projectJ);\n \}\n if (diagnosticMode == 12)\n \{\n return float3(JMboundary.x, JMboundary.y, JMh.z);\n \}\n if (diagnosticMode == 18)\n \{\n return float3(JMh.x, JMboundary.y, JMh.z);\n \}\n if (diagnosticMode == 20)\n \{\n // return focus point\n return float3(project_to.x, project_to.y, JMh.z);\n \}\n // actual output\n else\n \{\n return float3(JMcompressed.x, JMcompressed.y, JMh.z);\n \}\n \}\n\n // Generate the Hellwig2022 post adaptation non-linear compression matrix\n // that is used in the inverse of the model (JMh-to-XYZ).\n //\n // Original:\n // 460.0f, 451.0f, 288.0f,\n // 460.0f, -891.0f, -261.0f,\n // 460.0f, -220.0f, -6300.0f\n void generate_panlrcm()\n \{\n float panlrcm_data\[]=\n \{\n // original values: 2.0f, 1.0f, 0.05f,\n ra, 1.0f, ba,\n 1.0f, -12.0f / 11.0f, 1.0f / 11.0f,\n 1.0f / 9.0f, 1.0f / 9.0f, -2.0f / 9.0f\n \};\n panlrcm.setArray(panlrcm_data);\n panlrcm = panlrcm.invert();\n\n // Normalize rows so that first column is 460\n for (int i = 0; i < 3; i++)\n \{\n float n = 460.0f / panlrcm\[i]\[0];\n panlrcm\[i]\[0] *= n;\n panlrcm\[i]\[1] *= n;\n panlrcm\[i]\[2] *= n;\n \}\n \}\n\n float3x3 generate_RGB_to_XYZ_matrix(const int which)\n \{\n if (which == 0)\n \{\n return RGBPrimsToXYZMatrix(float2(0.7347f, 0.2653), float2(0.0f, 1.0f), float2(0.0001, -0.077), float2(0.32168f, 0.33767f), 1.0f, 0);\n \}\n else if (which == 1)\n \{\n return RGBPrimsToXYZMatrix(float2(0.713f, 0.293f), float2(0.165f, 0.830f), float2(0.128f, 0.044f), float2(0.32168f, 0.33767f), 1.0f, 0);\n \}\n else if (which == 2)\n \{\n return RGBPrimsToXYZMatrix(float2(0.64f, 0.33f), float2(0.3f, 0.6f), float2(0.15f, 0.06f), float2(0.3127f, 0.3290f), 1.0f, 0);\n \}\n else if (which == 3)\n \{\n return RGBPrimsToXYZMatrix(float2(0.708f, 0.292f), float2(0.170f, 0.797f), float2(0.131f, 0.046f), float2(0.3127f, 0.3290f), 1.0f, 0);\n \}\n else if (which == 4)\n \{\n return RGBPrimsToXYZMatrix(float2(0.680f, 0.320f), float2(0.265f, 0.690f), float2(0.150f, 0.060f), float2(0.3127f, 0.3290f), 1.0f, 0);\n \}\n else if (which == 5)\n \{\n return RGBPrimsToXYZMatrix(float2(0.680f, 0.320f), float2(0.265f, 0.690f), float2(0.150f, 0.060f), float2(0.314f, 0.351f), 1.0f, 0);\n \}\n else\n \{\n return identity_matrix;\n \}\n \}\n\n void init()\n \{\n st2084_m_1 = 2610.0f / 4096.0f * (1.0f / 4.0f);\n st2084_m_2 = 2523.0f / 4096.0f * 128.0f;\n st2084_c_1 = 3424.0f / 4096.0f;\n st2084_c_2 = 2413.0f / 4096.0f * 32.0f;\n st2084_c_3 = 2392.0f / 4096.0f * 32.0f;\n st2084_m_1_d = 1.0f / st2084_m_1;\n st2084_m_2_d = 1.0f / st2084_m_2;\n st2084_L_p = 10000.0f;\n\n // pre-calculate Daniele Evo constants\n daniele_r_hit = daniele_r_hit_min + (daniele_r_hit_max - daniele_r_hit_min) * (log(daniele_n / daniele_n_r) / log(10000.0f / 100.0f));\n daniele_m_0 = daniele_n / daniele_n_r;\n daniele_m_1 = 0.5f * (daniele_m_0 + sqrt(daniele_m_0 * (daniele_m_0 + 4.0f * daniele_t_1)));\n daniele_u = pow((daniele_r_hit / daniele_m_1) / ((daniele_r_hit / daniele_m_1) + 1.0f), daniele_g);\n daniele_m = daniele_m_1 / daniele_u;\n daniele_w_i = log(daniele_n / 100.0f) / log(2.0f);\n daniele_c_t = daniele_c_d * (1.0f + daniele_w_i * daniele_w_g) / daniele_n_r;\n daniele_g_ip = 0.5f * (daniele_c_t + sqrt(daniele_c_t * (daniele_c_t + 4.0f * daniele_t_1)));\n daniele_g_ipp2 = -daniele_m_1 * pow(daniele_g_ip / daniele_m, 1.0f / daniele_g) / (pow(daniele_g_ip / daniele_m, 1.0f / daniele_g) - 1.0f);\n daniele_w_2 = daniele_c / daniele_g_ipp2;\n daniele_s_2 = daniele_w_2 * daniele_m_1;\n daniele_u_2 = pow((daniele_r_hit / daniele_m_1) / ((daniele_r_hit / daniele_m_1) + daniele_w_2), daniele_g);\n daniele_m_2 = daniele_m_1 / daniele_u_2;\n\n // 1.0f / (c * z)\n model_gamma = 1.0f / (viewingConditionsToSurround(outputViewingConditions).y * (1.48f + sqrt(Y_b_out / L_A_out)));\n\n // Chroma compression scaling for HDR/SDR appearance match\n float log_peak = log10(daniele_n / daniele_n_r);\n compr = chroma_compress + (chroma_compress * chroma_compress_fact) * log_peak;\n sat = max(0.2f, chroma_expand - (chroma_expand * chroma_expand_fact) * log_peak);\n sat_thr = chroma_expand_thr / daniele_n;\n chromaCompressScale = pow(0.03379f * daniele_n, 0.30596f) - 0.45135f;\n\n // Gamut mapper focus distance scaling with peak luminance for\n // HDR/SDR appearance match. The projection gets slightly less\n // steep with higher peak luminance.\n // https://www.desmos.com/calculator/bnfhjcq5vf\n if (!disableFocusDistScaling)\n focusDist = focusDistance + focusDistance * focusDistScaling * log_peak;\n else\n focusDist = focusDistance;\n\n float identity_matrix_data\[] = \{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f\};\n identity_matrix.setArray(identity_matrix_data);\n\n float CAT_CAT16_data\[] = \{\n 0.401288, 0.650173, -0.051461, -0.250268, 1.204414, 0.045854, -0.002079, 0.048952, 0.953127,\n \};\n\n float Modified_CAT16_data\[] = \{\n 0.656619, 0.342071, 0.00131062, -0.222571, 1.10658, 0.115987, -0.000634146, 0.05855, 0.942084,\n \};\n\n // M Max data generated via an external Nukescript at a J value of 100\n float LocusLimitMTable_data\[] = \{\n 244.8230133, 245.4952393, 246.4431458, 247.1381531, 247.2368927, 246.8459778, 245.7083588, 244.2591095, 242.5463409, 240.4208374,\n 238.0180511, 235.4039917, 233.010849, 230.4004669, 227.8723602, 225.2279968, 222.7197876, 214.8562622, 206.1778564, 198.0664215,\n 190.9799347, 184.005127, 177.7472992, 172.2332611, 166.6447754, 161.64534, 156.9872284, 152.6203003, 148.3236084, 144.2987976,\n 140.8540192, 137.4315033, 134.3281555, 131.2306366, 128.3477631, 125.8098145, 123.1305542, 120.5120163, 118.3302231, 116.127861,\n 114.0526428, 112.1633072, 110.2943344, 108.4250336, 106.711853, 105.188797, 103.6860809, 102.2319641, 100.8348923, 99.51873779,\n 98.26163483, 97.04810333, 95.90451813, 94.84623718, 93.86389923, 92.9352951, 92.03639984, 91.15013885, 90.27630615, 89.43255615,\n 88.63536072, 87.8986969, 87.23329163, 86.63896942, 86.09989166, 85.60071564, 85.12715912, 84.66781616, 84.21458435, 83.76491547,\n 83.30849457, 82.86478424, 82.46378326, 82.11483002, 81.82078552, 81.58016968, 81.37005615, 81.18525696, 81.01979065, 80.86772156,\n 80.72546387, 80.59381104, 80.48122406, 80.40287018, 80.33755493, 80.30010986, 80.28891754, 80.28807831, 80.33933258, 80.44513702,\n 80.57379913, 80.71469879, 80.86810303, 81.03874207, 81.23072052, 81.44044495, 81.6555481, 81.901474, 82.20778656, 82.67211151,\n 83.1408844, 83.62628174, 84.0898056, 84.53721619, 84.99518585, 85.49137878, 86.03423309, 86.58794403, 87.16802979, 87.72124481,\n 88.51965332, 89.35781097, 90.16739655, 90.94639587, 91.75927734, 92.65882111, 93.6033783, 94.64561462, 95.68405914, 96.84765625,\n 97.98625183, 99.09587097, 100.2806396, 101.5832748, 103.0694122, 104.6378632, 106.2420197, 107.8503952, 109.5214844, 111.3000031,\n 113.1901169, 115.1414337, 117.1432114, 119.3193054, 121.7141724, 124.2319031, 126.4584961, 128.9876556, 131.6906891, 134.7160034,\n 137.8343048, 140.7224121, 143.7820892, 147.23909, 150.6812439, 154.0381317, 157.1765747, 160.5133972, 164.2957306, 168.1366272,\n 171.8247986, 175.4206543, 179.2828827, 182.0374146, 185.0783844, 188.2106171, 190.9611206, 193.3639221, 195.5132294, 197.58255,\n 199.4234161, 201.3786011, 203.1474609, 205.016037, 206.6236725, 208.1813812, 209.8205719, 211.2774353, 212.8192749, 214.4571686,\n 215.6442261, 216.4818726, 217.1617279, 217.7372131, 218.2023926, 218.4073486, 218.4278564, 217.6643677, 216.4666748, 215.1212463,\n 213.8158264, 212.5012817, 210.8331757, 208.8956146, 206.9006958, 204.9239197, 203.0310059, 201.2084045, 199.3484344, 197.3464355,\n 195.217453, 193.0449677, 190.9578705, 188.9528656, 187.0009918, 185.0068817, 182.9402924, 180.8367767, 178.7057037, 176.5325165,\n 174.445282, 172.4908905, 170.5744934, 168.5490723, 166.459259, 164.4333649, 162.5092621, 160.4579468, 158.491806, 156.6880035,\n 155.0045624, 153.295166, 151.4545441, 149.5910492, 147.7821808, 146.4078522, 144.8022614, 143.2662506, 141.8236542, 140.5029602,\n 139.225174, 137.8959045, 136.4792175, 135.0780334, 133.7389374, 132.7613525, 131.6787109, 130.6356354, 129.64328, 128.7269897,\n 127.8450623, 126.9439697, 126.0015182, 125.0760727, 124.1718826, 123.4704056, 122.8062363, 122.1408768, 121.501358, 120.9004822,\n 120.3225555, 119.7514191, 119.2011871, 118.7055511, 118.2950592, 117.9416199, 117.5793762, 117.2029953, 116.8356552, 116.4874039,\n 116.1693954, 115.9030762, 115.6935577, 115.5213852, 115.3659363, 115.2032318, 115.0445251, 114.9317932, 114.8815384, 114.8605118,\n 114.8510284, 114.8482819, 114.848465, 114.8521805, 114.8999329, 115.0081787, 115.1483612, 115.2983322, 115.511528, 115.7195816,\n 115.9448853, 116.2098999, 116.5264893, 116.8126144, 117.1579666, 117.5379944, 117.9048004, 118.3263168, 118.8006821, 119.2988586,\n 119.8310318, 120.3776703, 121.0383987, 121.6810684, 122.4489899, 123.207077, 124.071022, 124.9082108, 125.74823, 126.6865311,\n 127.4425888, 127.8552094, 128.1067963, 128.3630676, 128.6606598, 128.9203491, 129.2632141, 129.708252, 130.1131287, 130.5647278,\n 130.9923553, 131.5979462, 132.2623444, 132.8651428, 133.4651947, 134.1470337, 134.8683624, 135.683609, 136.6136017, 137.5203552,\n 138.3826599, 139.2931976, 140.2762299, 141.2150574, 142.3930054, 143.7060547, 145.0472565, 146.3404083, 147.6144257, 148.9406586,\n 150.3545532, 151.8509674, 153.4246826, 155.0567017, 156.7265472, 158.4546509, 160.2428131, 162.1348267, 164.1415863, 166.2302551,\n 168.4024506, 170.5583649, 172.6457672, 174.9460449, 177.2792664, 179.6472473, 182.1867218, 184.5882721, 187.3068848, 189.8807373,\n 192.5116577, 195.5551453, 198.5196381, 201.3429413, 203.941452, 206.8439484, 209.5599213, 212.4866943, 215.0750885, 217.929306,\n 220.6668701, 223.364151, 226.2115479, 228.9524536, 231.5583954, 234.405304, 237.0275879, 239.5091705, 242.0047455, 242.0177155,\n 244.8230133\};\n\n // populate the input primaries matrix\n RGB_to_XYZ_input = generate_RGB_to_XYZ_matrix(primariesIn);\n XYZ_to_RGB_input = RGB_to_XYZ_input.invert();\n\n // AP1 matrix\n AP1_to_XYZ = generate_RGB_to_XYZ_matrix(1); // AP1 == 1\n XYZ_to_AP1 = AP1_to_XYZ.invert();\n\n // populate the limiting primaries matrix\n // RGBPrimsToXYZMatrix\n float2 limitWhiteForMatrix;\n float2 limitRedForMatrix;\n float2 limitGreenForMatrix;\n float2 limitBlueForMatrix;\n if (whiteLimit == 0)\n \{\n limitWhiteForMatrix = float2(0.32168f, 0.33767f);\n \}\n else if (whiteLimit == 1)\n \{\n limitWhiteForMatrix = float2(0.3127f, 0.3290f);\n \}\n else\n \{\n limitWhiteForMatrix = float2(0.333333f, 0.333333f);\n \}\n\n // TODO: could we share these primaries with matrix generation code?\n if (primariesLimit == 0)\n \{\n limitRedForMatrix = float2(0.7347f, 0.2653);\n limitGreenForMatrix = float2(0.0f, 1.0f);\n limitBlueForMatrix = float2(0.0001, -0.077);\n \}\n else if (primariesLimit == 1)\n \{\n limitRedForMatrix = float2(0.713f, 0.293f);\n limitGreenForMatrix = float2(0.165f, 0.830f);\n limitBlueForMatrix = float2(0.128f, 0.044f);\n \}\n else if (primariesLimit == 2)\n \{\n limitRedForMatrix = float2(0.64f, 0.33f);\n limitGreenForMatrix = float2(0.3f, 0.6f);\n limitBlueForMatrix = float2(0.15f, 0.06f);\n \}\n else if (primariesLimit == 3)\n \{\n limitRedForMatrix = float2(0.708f, 0.292f);\n limitGreenForMatrix = float2(0.170f, 0.797f);\n limitBlueForMatrix = float2(0.131f, 0.046f);\n \}\n else if (primariesLimit == 4)\n \{\n limitRedForMatrix = float2(0.680f, 0.320f);\n limitGreenForMatrix = float2(0.265f, 0.690f);\n limitBlueForMatrix = float2(0.150f, 0.060f);\n \}\n else\n \{\n limitRedForMatrix = float2(1.0f, 0.0f);\n limitGreenForMatrix = float2(0.0f, 1.0f);\n limitBlueForMatrix = float2(0.0f, 0.0f);\n \}\n\n RGB_to_XYZ_limit = RGBPrimsToXYZMatrix(limitRedForMatrix, limitGreenForMatrix, limitBlueForMatrix, limitWhiteForMatrix, 1.0f, 0);\n XYZ_to_RGB_limit = RGB_to_XYZ_limit.invert();\n\n RGB_to_XYZ_reach = generate_RGB_to_XYZ_matrix(primariesReach);\n XYZ_to_RGB_reach = RGB_to_XYZ_reach.invert();\n\n RGB_to_XYZ_output = generate_RGB_to_XYZ_matrix(primariesOut);\n XYZ_to_RGB_output = RGB_to_XYZ_output.invert();\n\n float3 white(1.0f, 1.0f, 1.0f);\n inWhite = vector_dot(RGB_to_XYZ_input, white);\n outWhite = vector_dot(RGB_to_XYZ_output, white);\n limitWhite = vector_dot(RGB_to_XYZ_limit, white);\n\n boundaryRGB = peakLuminance / referenceLuminance;\n\n if (catDataSelection == 0)\n \{\n CAT_CAT16.setArray(CAT_CAT16_data);\n \}\n else if (catDataSelection == 1)\n \{\n CAT_CAT16.setArray(Modified_CAT16_data);\n \}\n else if (catDataSelection == 2)\n \{\n CAT_CAT16 = RGBPrimsToXYZMatrix(rxy, gxy, bxy, wxy, 1.0f, 1);\n \}\n CAT_CAT16_INVERSE = CAT_CAT16.invert();\n\n generate_panlrcm();\n\n // solving the RGB cusp from JMh is very expensive\n // instead we go the other way and start with a RGB cusp sweep\n // which is easily calculated by converting via HSV (Hue, 1.0, 1.0)\n // we then convert each cusp to JMh and add them to a table\n for (int i = 0; i < gamutCuspTableSize; ++i)\n \{\n LocusLimitMTable\[i] = LocusLimitMTable_data\[i];\n \}\n\n // calculate the maximum expected J & M values for the given limit gamut\n // these are used as limiting values for the gamut boundary searches\n // limitJmax (assumed to match limitRGB white)\n limitJmax = RGB_to_JMh(float3(1.0f), limitWhite, RGB_to_XYZ_limit).x;\n\n // Cusp table for chroma compression gamut\n float3x3 RGB_to_XYZ_cgReach;\n if (ccReach == 0) // Chroma Compression Space (primaries defined in kernel params)\n \{\n RGB_to_XYZ_cgReach = RGBPrimsToXYZMatrix(crxy, cgxy, cbxy, cwxy, 1.0f, 0);\n\n \}\n else if (ccReach == 1)\n \{\n RGB_to_XYZ_cgReach = generate_RGB_to_XYZ_matrix(0);\n \}\n else if (ccReach == 2)\n \{\n RGB_to_XYZ_cgReach = generate_RGB_to_XYZ_matrix(1);\n \}\n else\n \{\n RGB_to_XYZ_cgReach = generate_RGB_to_XYZ_matrix(3);\n \}\n const float3x3 XYZ_to_RGB_cgReach = RGB_to_XYZ_cgReach.invert();\n\n initialise_cusp_table(cgamutCuspTable, gamutCuspTableSize, inWhite, RGB_to_XYZ_cgReach);\n initialise_reach_cusp_table(cgamutReachTable, gamutCuspTableSize, limitJmax, inWhite, XYZ_to_RGB_cgReach);\n\n // With gamut mapper reach mode 7, use the chroma compression reach space with the\n // gamut mapper.\n if (primariesReach == 7)\n XYZ_to_RGB_reach = XYZ_to_RGB_cgReach;\n\n // Cusp table for limiting gamut\n initialise_cusp_table(gamutCuspTable, gamutCuspTableSize, limitWhite, RGB_to_XYZ_limit);\n initialise_reach_cusp_table(gamutCuspTableReach, gamutCuspTableSize, limitJmax, inWhite, XYZ_to_RGB_reach);\n\n midJ = XYZ_to_JMh(inWhite * daniele_c_t * mmScaleFactor, inWhite, outputViewingConditions, L_A_out, Y_b_out, discountIlluminant_mid,\n HK_mode_mid)\n .x;\n\n initialise_upper_hull_gamma();\n initialise_lower_hull_gamma();\n \}\n\n void initialise_cusp_table(float3 output_table\[], const int table_size, float3 refWhite, const float3x3& matrix)\n \{\n // the 'tempTableUnsorted' table is populated\n // in increments of H of the limiting gamut HSV space starting at H=0.0\n // since it is unlikely that HSV.H=0 and JMh.h=0 line up\n // the entries are then wrap-around shifted\n // so that the 'gamutCuspTable' starts with the lowest JMh.h value\n float3 tempTableUnsorted\[gamutCuspTableSize];\n int minhIndex = 0;\n for (int i = 0; i < table_size; ++i)\n \{\n const float hNorm = float(i) / (table_size);\n const float3 RGB = HSV_to_RGB(float3(hNorm, 1.0f, 1.0f));\n tempTableUnsorted\[i] = RGB_to_JMh(RGB, refWhite, matrix);\n if (tempTableUnsorted\[i].z < tempTableUnsorted\[minhIndex].z)\n \{\n minhIndex = i;\n \}\n \}\n copy_table_rotated(tempTableUnsorted, table_size, output_table, minhIndex);\n\n // Add extra entry to wrap\n output_table\[gamutCuspTableSize] = output_table\[0];\n output_table\[gamutCuspTableSize].z = output_table\[gamutCuspTableSize].z + 360.0f;\n \}\n\n void copy_table_rotated(float3 tableUnsorted\[], const int tableSize, float3 output_table\[], const int offsetIndex)\n \{\n for (int i = 0; i < tableSize; ++i)\n \{\n output_table\[i] = tableUnsorted\[(offsetIndex + i) % tableSize];\n \}\n \}\n\n void initialise_reach_cusp_table(float3 output_table\[], const int table_size, const float limitJ, float3 refWhite, const float3x3& matrix)\n \{\n const float search_range = 100.0;\n for (int i = 0; i < table_size; ++i)\n \{\n const float hue = base_hue_for_position(i, table_size);\n\n float low = 0.0;\n float high = low + search_range;\n bool outside = false;\n\n while (!outside && high < 1400.0)\n \{\n outside = any_below_zero(JMh_to_RGB(float3(limitJ, high, hue), refWhite, matrix));\n if (!outside)\n \{\n low = high;\n high = high + search_range;\n \}\n \}\n\n while ((high - low) > 1e-2)\n \{\n const float sampleM = (high + low) / 2.0;\n outside = any_below_zero(JMh_to_RGB(float3(limitJ, sampleM, hue), refWhite, matrix));\n if (outside)\n \{\n high = sampleM;\n \}\n else\n \{\n low = sampleM;\n \}\n \}\n output_table\[i].x = limitJ;\n output_table\[i].y = high;\n output_table\[i].z = hue;\n \}\n // Wrap last entry in table\n output_table\[table_size] = output_table\[0];\n output_table\[table_size].z += 360.0f;\n \}\n\n inline bool outside_hull(const float3 newLimitRGB)\n \{\n // limit value, once we cross this value, we are outside of the top gamut shell\n const float maxRGBtestVal = 1.0f;\n if (newLimitRGB.x > maxRGBtestVal || newLimitRGB.y > maxRGBtestVal || newLimitRGB.z > maxRGBtestVal)\n \{\n return true;\n \}\n return false;\n \}\n\n bool evaluate_upper_hull_gamma_fit(const float2 JMcusp, float3 testJmh\[], const int test_count, const float topGamma)\n \{\n const float focusJ = lerp(JMcusp.x, midJ, min(1.0, cuspMidBlend - (JMcusp.x / limitJmax)));\n for (int testIndex = 0; testIndex < test_count; ++testIndex)\n \{\n const float slope_gain = limitJmax * focusDist * getFocusGain(testJmh\[testIndex].x, JMcusp.x);\n const float3 approxLimit =\n findGamutBoundaryIntersection(testJmh\[testIndex], JMcusp, focusJ, limitJmax, slope_gain, smoothCusps, topGamma, lowerHullGamma);\n const float3 approximate_JMh = float3(approxLimit.x, approxLimit.y, testJmh\[testIndex].z);\n const float3 newLimitRGB = JMh_to_RGB(approximate_JMh, limitWhite, XYZ_to_RGB_limit);\n\n if (!outside_hull(newLimitRGB))\n \{\n return false;\n \}\n \}\n return true;\n \}\n\n void initialise_upper_hull_gamma()\n \{\n // Find upper hull gamma values for the gamut mapper\n // start by taking a h angle\n // get the cusp J value for that angle\n // find a J value halfway to the Jmax\n // iterate through gamma values until the approximate max M is negative through the actual boundary\n\n // positions between the cusp and Jmax we will check\n // variables that get set as we iterate through, once all are set to true we break the loop\n const int test_count = 3;\n const float testPositions\[test_count] = \{0.01f, 0.5f, 0.99f\};\n for (int i = 0; i < gamutCuspTableSize; ++i)\n \{\n if (disableUpperHullGamma)\n \{\n gamutGammas\[i].x = upperHullGamma;\n continue;\n \}\n const float hue = base_hue_for_position(i, gamutCuspTableSize);\n // default value. This will get overridden as we loop, but can be a good diagnostic to make sure things are working\n gamutGammas\[i].x = -1.0f;\n const float2 JMcusp = cuspFromTable(hue);\n float3 testJmh\[test_count];\n for (int testIndex = 0; testIndex < test_count; ++testIndex)\n \{\n // create test values halfway between the cusp and the Jmax\n testJmh\[testIndex] = float3(JMcusp.x + ((limitJmax - JMcusp.x) * testPositions\[testIndex]), JMcusp.y, hue);\n \}\n\n const float search_range = 0.4;\n float low = 0.4;\n float high = low + search_range;\n bool all_inside = false;\n\n while (!all_inside && high < 5.0)\n \{\n all_inside = evaluate_upper_hull_gamma_fit(JMcusp, testJmh, test_count, high);\n if (!all_inside)\n \{\n low = high;\n high = high + search_range;\n \}\n \}\n\n float testGamma = -1.0;\n while ((high - low) > 1e-5)\n \{\n testGamma = (high + low) / 2.0;\n all_inside = evaluate_upper_hull_gamma_fit(JMcusp, testJmh, test_count, testGamma);\n if (all_inside)\n \{\n high = testGamma;\n \}\n else\n \{\n low = testGamma;\n \}\n \}\n gamutGammas\[i].x = testGamma;\n \}\n // Wrap the last entry\n gamutGammas\[gamutCuspTableSize].x = gamutGammas\[0].x;\n \}\n\n inline bool any_below_zero(const float3 newLimitRGB)\n \{\n if (newLimitRGB.x < 0.0f || newLimitRGB.y < 0.0f || newLimitRGB.z < 0.0f)\n \{\n return true;\n \}\n return false;\n \}\n\n bool evaluate_lower_hull_gamma_fit(const float2 JMcusp, float3 testJmh\[], const int test_count, const float bottomGamma)\n \{\n const float focusJ = lerp(JMcusp.x, midJ, cuspMidBlend);\n for (int testIndex = 0; testIndex < test_count; ++testIndex)\n \{\n const float slope_gain = limitJmax * focusDist * getFocusGain(testJmh\[testIndex].x, JMcusp.x);\n\n const float3 approxLimit = findGamutBoundaryIntersection(testJmh\[testIndex], JMcusp, focusJ, limitJmax,\n slope_gain, smoothCusps, upperHullGamma, bottomGamma);\n const float3 approximate_JMh = float3(approxLimit.x, approxLimit.y, testJmh\[testIndex].z);\n const float3 newLimitRGB = JMh_to_RGB(approximate_JMh, limitWhite, XYZ_to_RGB_limit);\n\n if (!any_below_zero(newLimitRGB))\n \{\n return false;\n \}\n \}\n return true;\n \}\n\n void initialise_lower_hull_gamma()\n \{\n // Same process, for the bottom hull gamma\n const int test_count = 3;\n const float testPositions\[test_count] = \{0.01f, 0.4f, 0.75f\};\n\n for (int i = 0; i < gamutCuspTableSize; ++i)\n \{\n if (disableLowerHullGamma)\n \{\n gamutGammas\[i].y = lowerHullGamma;\n continue;\n \}\n const float hue = base_hue_for_position(i, gamutCuspTableSize);\n\n gamutGammas\[i].y = -1.0f;\n const float2 JMcusp = cuspFromTable(hue);\n float3 testJmh\[test_count];\n for (int testIndex = 0; testIndex < test_count; ++testIndex)\n \{\n testJmh\[testIndex] = float3(JMcusp.x * testPositions\[testIndex], JMcusp.y, hue);\n \}\n\n const float search_range = 0.4;\n float low = 0.8;\n float high = low + search_range;\n bool all_inside = false;\n\n while (!all_inside && high < 5.0)\n \{\n all_inside = evaluate_lower_hull_gamma_fit(JMcusp, testJmh, test_count, high);\n if (!all_inside)\n \{\n low = high;\n high = high + search_range;\n \}\n \}\n\n float testGamma = -1.0;\n while ((high - low) > 1e-5)\n \{\n testGamma = (high + low) / 2.0;\n all_inside = evaluate_lower_hull_gamma_fit(JMcusp, testJmh, test_count, testGamma);\n if (all_inside)\n \{\n high = testGamma;\n \}\n else\n \{\n low = testGamma;\n \}\n \}\n gamutGammas\[i].x = testGamma;\n \}\n // Wrap the last entry\n gamutGammas\[gamutCuspTableSize].y = gamutGammas\[0].y;\n \}\n\n void process()\n \{\n SampleType(src) source = src();\n float3 srcRGB(source.x, source.y, source.z);\n float3 dstRGB;\n float3 compressedJMh;\n float3 tonemappedJMh;\n float3 JMh;\n float3 diagnostic;\n\n if (invert)\n \{\n compressedJMh = output_RGB_to_JMh(srcRGB);\n tonemappedJMh = compressGamut(compressedJMh, 1);\n JMh = inverseTonescale(tonemappedJMh);\n diagnostic = JMh_to_input_RGB(JMh);\n \}\n else\n \{\n JMh = input_RGB_to_JMh(srcRGB);\n tonemappedJMh = forwardTonescale(JMh);\n compressedJMh = compressGamut(tonemappedJMh, 0);\n diagnostic = JMh_to_output_RGB(compressedJMh);\n \}\n\n if (diagnosticMode == 1 || diagnosticMode == 6)\n \{\n // Mode 6 actually returns XYZ, mode 1 returns real JMh\n if (invert)\n \{\n diagnostic = JMh_to_input_RGB(srcRGB);\n \}\n else\n \{\n diagnostic = JMh;\n \}\n \}\n else if (diagnosticMode == 2 || diagnosticMode == 99)\n \{\n diagnostic = tonemappedJMh;\n \}\n else if (diagnosticMode == 3 || diagnosticMode == 5)\n \{\n diagnostic = compressedJMh;\n \}\n/*\n else if (diagnosticMode == 4 || diagnosticMode == 7)\n \{\n if (diagnosticMode == 4)\n srcRGB = JMh;\n dstRGB = JMh_to_output_RGB(srcRGB);\n diagnostic = dstRGB;\n \}\n else if (diagnosticMode == 8)\n \{\n diagnostic = inWhite;\n \}\n else if (diagnosticMode == 9)\n \{\n diagnostic = outWhite;\n \}\n else if (diagnosticMode == 10)\n \{\n diagnostic = limitWhite;\n \}\n else if (diagnosticMode == 12)\n \{\n // output gamut boundary\n diagnostic = compressGamut(srcRGB, 1);\n \}\n else if (diagnosticMode == 13)\n \{\n // output gamut boundary\n diagnostic = compressGamut(srcRGB, invert);\n \}\n else if (diagnosticMode == 14)\n \{\n // output gamut cusp\n const float2 JMcusp = cuspFromTable(srcRGB.z);\n diagnostic = float3(JMcusp.x, JMcusp.y, srcRGB.z);\n \}\n else if (diagnosticMode == 16)\n \{\n // output Locus cusp\n const float2 JMcusp = cuspFromTableLocus(srcRGB.z);\n diagnostic = float3(JMcusp.x, JMcusp.y, srcRGB.z);\n \}\n else if (diagnosticMode == 17)\n \{\n // output Locus boundary\n diagnostic = getLocusBoundry(srcRGB);\n \}\n else if (diagnosticMode == 18)\n \{\n // output gamut boundary\n diagnostic = compressGamut(srcRGB, 0);\n \}\n else if (diagnosticMode == 19)\n \{\n // output Reach boundary\n diagnostic = getReachBoundry(srcRGB);\n \}\n else if (diagnosticMode == 20)\n \{\n // output JMFocus\n diagnostic = compressGamut(srcRGB, 1);\n \}\n else if (diagnosticMode == 21)\n \{\n // output JMFocus\n diagnostic = float3(hueDependantHullGammas(srcRGB.z).y, 0.0f, 0.0f);\n \}\n else if (diagnosticMode == 22)\n \{\n float2 JMcusp = cuspFromTable(srcRGB.z);\n // create test value halfway between the cusp and the Jmax\n float slope_gain = limitJmax * focusDist;\n diagnostic = float3(JMcusp.x + ((limitJmax - JMcusp.x) / 2.0f), JMcusp.y, srcRGB.z);\n \}\n else if (diagnosticMode == 23)\n \{\n float2 JMcusp = cuspFromTable(srcRGB.z);\n // create test value halfway between the cusp and the Jmax\n float slope_gain = limitJmax * focusDist;\n float3 testJmh = float3(JMcusp.x + ((limitJmax - JMcusp.x) / 2.0f), JMcusp.y, srcRGB.z);\n const float2 gammas = hueDependantHullGammas(srcRGB.z);\n float3 approxLimit = findGamutBoundaryIntersection(testJmh, JMcusp, (JMcusp.x + 38.0f) / 2, limitJmax, slope_gain, smoothCusps, gammas.x, gammas.y);\n diagnostic = float3(approxLimit.x, approxLimit.y, srcRGB.z);\n \}\n\n else if (diagnosticMode == 24)\n \{\n float2 JMcusp = cuspFromTable(srcRGB.z);\n // create test value halfway between the cusp and the Jmax\n float slope_gain = limitJmax * focusDist;\n float3 testJmh = float3(JMcusp.x + ((limitJmax - JMcusp.x) / 2.0f), JMcusp.y, srcRGB.z);\n const float2 gammas = hueDependantHullGammas(srcRGB.z);\n float3 approxLimit = findGamutBoundaryIntersection(testJmh, JMcusp, (JMcusp.x + 38.0f) / 2, limitJmax, slope_gain, smoothCusps, gammas.x, gammas.y);\n float3 newLimitRGB = JMh_to_RGB(float3(approxLimit.x, approxLimit.y, srcRGB.z), limitWhite, XYZ_to_RGB_limit);\n diagnostic = newLimitRGB;\n \}\n\n else if (diagnosticMode == 25)\n \{\n float2 JMcusp = cuspFromTable(srcRGB.z);\n float focusJ = lerp(JMcusp.x, midJ, min(1.0f, cuspMidBlend - (JMcusp.x / limitJmax)));\n float slope_gain = limitJmax * focusDist * getFocusGain(JMh.x, JMcusp.x);\n const float2 gammas = hueDependantHullGammas(srcRGB.z);\n float3 nickBoundryReturn = findGamutBoundaryIntersection(srcRGB, JMcusp, focusJ, limitJmax, slope_gain, smoothCusps, gammas.x, gammas.y);\n diagnostic = float3(srcRGB.x, nickBoundryReturn.y, srcRGB.z);\n \}\n else if (diagnosticMode == 26)\n \{\n // XYZ back to luminance RGB\n float3 JMh = JMh_to_XYZ(srcRGB, limitWhite, outputViewingConditions, L_A_out, Y_b_out, discountIlluminant_out, HK_mode_out);\n diagnostic = vector_dot(XYZ_to_RGB_limit, JMh);\n \}\n else if (diagnosticMode == 27)\n \{\n // output\n diagnostic = float3(hueDependantHullGammas(srcRGB.z).x, 0.0f, 0.0f);\n \}\n else if (diagnosticMode == 28)\n \{\n // output\n float2 JMcusp = cuspFromTable(srcRGB.z);\n const float2 gammas = hueDependantHullGammas(srcRGB.z);\n diagnostic = findGamutBoundaryIntersection(srcRGB, JMcusp, lerp(JMcusp.x, midJ, cuspMidBlend), limitJmax, 10000.0f, 0.0f,\n gammas.x, gammas.y);\n \}\n\n // extra modes to allow for easier breakout of the order of events.\n // modes starting with 100\n\n ////// FORWARD PATHWAY\n\n else if (diagnosticMode == 100)\n \{\n // display encoding to display linear\n diagnostic = encodingToLuminance3(encodingIn, srcRGB);\n \}\n else if (diagnosticMode == 101)\n \{\n // convert to linear XYZ luminance values\n diagnostic = vector_dot(RGB_to_XYZ_input, srcRGB);\n \}\n else if (diagnosticMode == 102)\n \{\n // convert luminanceXYZ to JMh\n diagnostic = XYZ_to_JMh(srcRGB, inWhite, viewingConditions, L_A, Y_b, discountIlluminant_in, HK_mode_in);\n \}\n else if (diagnosticMode == 103)\n \{\n // JMh to tonemappedJMh\n diagnostic = forwardTonescale(srcRGB);\n \}\n else if (diagnosticMode == 104)\n \{\n // JMh to gamut compressed JMh\n diagnostic = compressGamut(srcRGB, 0);\n \}\n else if (diagnosticMode == 105)\n \{\n // JMh to luminance XYZ\n diagnostic = JMh_to_XYZ(srcRGB, limitWhite, outputViewingConditions, L_A_out, Y_b_out, discountIlluminant_out, HK_mode_out);\n \}\n else if (diagnosticMode == 106)\n \{\n // display luminance XYZ to display linear RGB\n diagnostic = vector_dot(XYZ_to_RGB_output, srcRGB);\n \}\n else if (diagnosticMode == 107)\n \{\n // display linear RGB to display encoded RGB\n diagnostic = luminanceToEncoding3(encodingOut, srcRGB);\n \}\n\n ////// INVERSE PATHWAY\n\n else if (diagnosticMode == 200)\n \{\n // output display encoded RGB to display linear RGB\n diagnostic = encodingToLuminance3(encodingOut, srcRGB);\n \}\n else if (diagnosticMode == 201)\n \{\n // output display linear RGB to output display linear XYZ\n diagnostic = vector_dot(RGB_to_XYZ_output, srcRGB);\n \}\n else if (diagnosticMode == 202)\n \{\n // output XYZ to JMh\n diagnostic = XYZ_to_JMh(srcRGB, limitWhite, viewingConditions, L_A_out, Y_b_out, discountIlluminant_out, HK_mode_out);\n \}\n else if (diagnosticMode == 203)\n \{\n // uncompress gamut\n diagnostic = compressGamut(srcRGB, 1);\n \}\n else if (diagnosticMode == 204)\n \{\n // inverse tonescale in JMh\n diagnostic = inverseTonescale(srcRGB);\n \}\n else if (diagnosticMode == 205)\n \{\n // inverted JMh back to XYZ\n diagnostic = JMh_to_XYZ(srcRGB, inWhite, viewingConditions, L_A, Y_b, discountIlluminant_in, HK_mode_in);\n \}\n else if (diagnosticMode == 206)\n \{\n // XYZ back to luminance RGB\n diagnostic = vector_dot(XYZ_to_RGB_input, srcRGB);\n \}\n else if (diagnosticMode == 207)\n \{\n // luminance RGB to input encoding RGB\n diagnostic = luminanceToEncoding3(encodingIn, srcRGB);\n \}\n*/\n dst() = float4(diagnostic.x, diagnostic.y, diagnostic.z, source.w);\n \}\n\};\n"
useGPUIfAvailable {{parent.use_gpu}}
rebuild ""
DRT_CAM_Kernel_encodingIn {{parent.encoding_in}}
DRT_CAM_Kernel_AP1Clamp {{parent.ap1_clamp}}
DRT_CAM_Kernel_primariesIn {{parent.primaries_in x9 1}}
DRT_CAM_Kernel_toneScaleMode {{parent.toneScaleMode}}
DRT_CAM_Kernel_discountIlluminant_in true
DRT_CAM_Kernel_discountIlluminant_mid true
DRT_CAM_Kernel_discountIlluminant_out true
DRT_CAM_Kernel_compressMode {{parent.compress_mode}}
DRT_CAM_Kernel_referenceLuminance {{parent.reference_luminance x446 0.185}}
DRT_CAM_Kernel_viewingConditions {{inputViewingConditions}}
DRT_CAM_Kernel_outputViewingConditions {{parent.viewing_conditions}}
DRT_CAM_Kernel_applyTonecurve {{applyTonecurve}}
DRT_CAM_Kernel_peakLuminance {{parent.peak_luminance}}
DRT_CAM_Kernel_applyChromaCompression {{parent.applyChromaCompression}}
DRT_CAM_Kernel_applyInGamutExpansion {{parent.applyInGamutExpansion}}
DRT_CAM_Kernel_applyInGamutCompression {{parent.applyInGamutCompression}}
DRT_CAM_Kernel_applyReachClamp {{parent.applyReachClamp}}
DRT_CAM_Kernel_monochrome {{parent.monochrome}}
DRT_CAM_Kernel_chroma_compress {{parent.compress}}
"DRT_CAM_Kernel_Chroma Compress Factor" {{parent.chroma_compress_fact}}
DRT_CAM_Kernel_chroma_expand {{parent.chroma_expand}}
"DRT_CAM_Kernel_Chroma Expansion Factor" {{parent.chroma_expand_fact}}
DRT_CAM_Kernel_chroma_expand_thr {{parent.chroma_expand_thr}}
DRT_CAM_Kernel_cc_et {{parent.et}}
DRT_CAM_Kernel_ccReach {{parent.ccReachPrimaries}}
DRT_CAM_Kernel_crxy {0.7347 0.2653}
DRT_CAM_Kernel_cgxy {0.12 0.88}
DRT_CAM_Kernel_cbxy {0.08 -0.04}
DRT_CAM_Kernel_cwxy {0.32168 0.33767}
DRT_CAM_Kernel_primariesLimit {{parent.primaries_limit}}
DRT_CAM_Kernel_whiteLimit {{parent.white_limit}}
DRT_CAM_Kernel_primariesReach {{parent.primaries_reach}}
DRT_CAM_Kernel_applyGamutCompression {{parent.apply_gamut_compression}}
DRT_CAM_Kernel_cuspMidBlend {{parent.cusp_mid_blend}}
DRT_CAM_Kernel_focusDistance {{parent.focus_distance}}
DRT_CAM_Kernel_focusAdjustGain {{parent.focusgain}}
DRT_CAM_Kernel_focusGainBlend {{parent.focus_gain_blend}}
DRT_CAM_Kernel_focusDistScaling {{parent.focusdistscaling}}
DRT_CAM_Kernel_compressionFuncParams {{parent.compression_params.r x272 -1.75} {parent.compression_params.g} {parent.compression_params.b} {parent.compression_params.a}}
DRT_CAM_Kernel_sixAxisCompressionMode {{parent.sixAxisCompressionMode}}
DRT_CAM_Kernel_compressionFuncParamsR {{parent.compressionFuncParamsR x272 0.21} {parent.compressionFuncParamsR} {parent.compressionFuncParamsR} {parent.compressionFuncParamsR}}
DRT_CAM_Kernel_compressionFuncParamsY {{parent.compressionFuncParamsY} {parent.compressionFuncParamsY} {parent.compressionFuncParamsY} {parent.compressionFuncParamsY}}
DRT_CAM_Kernel_compressionFuncParamsG {{parent.compressionFuncParamsG} {parent.compressionFuncParamsG} {parent.compressionFuncParamsG} {parent.compressionFuncParamsG}}
DRT_CAM_Kernel_compressionFuncParamsC {{parent.compressionFuncParamsC} {parent.compressionFuncParamsC} {parent.compressionFuncParamsC} {parent.compressionFuncParamsC}}
DRT_CAM_Kernel_compressionFuncParamsB {{parent.compressionFuncParamsB} {parent.compressionFuncParamsB} {parent.compressionFuncParamsB} {parent.compressionFuncParamsB}}
DRT_CAM_Kernel_compressionFuncParamsM {{parent.compressionFuncParamsM} {parent.compressionFuncParamsM} {parent.compressionFuncParamsM} {parent.compressionFuncParamsM}}
DRT_CAM_Kernel_Reachcompressmode {{parent.reachCompressMode}}
DRT_CAM_Kernel_reachNick true
DRT_CAM_Kernel_Locuscompressmode {{parent.BlinkScript1_DRT_CAM_Kernel_Locuscompressmode}}
DRT_CAM_Kernel_boundryIntersectionMethod {{boundryIntersectionMethod}}
DRT_CAM_Kernel_disableLowerHullGamma true
DRT_CAM_Kernel_lowerHullGamma {{lowerHullGamma}}
DRT_CAM_Kernel_upperHullGamma {{parent.upperHullGamma}}
DRT_CAM_Kernel_smoothCusps {{parent.smooth_cusps}}
"DRT_CAM_Kernel_Smoothing factor cusp J" {{parent.smoothJ}}
"DRT_CAM_Kernel_Smoothing factor cust M" {{parent.smoothM}}
DRT_CAM_Kernel_encodingOut {{parent.encoding_out}}
DRT_CAM_Kernel_primariesOut {{parent.primaries_out}}
DRT_CAM_Kernel_fitWhite {{parent.fit_white}}
DRT_CAM_Kernel_clampOutput {{parent.clamp_output}}
DRT_CAM_Kernel_softclampOutput {{parent.soft_clamp}}
DRT_CAM_Kernel_clamp_thr 0.99
DRT_CAM_Kernel_clamp_dist 1.1
DRT_CAM_Kernel_invert {{parent.invert}}
DRT_CAM_Kernel_mmScaleFactor 100
DRT_CAM_Kernel_daniele_n {{parent.peak_luminance}}
DRT_CAM_Kernel_daniele_n_r 100
DRT_CAM_Kernel_daniele_g 1.15
DRT_CAM_Kernel_daniele_c 0.18
DRT_CAM_Kernel_daniele_c_d 10.013
DRT_CAM_Kernel_daniele_w_g 0.14
DRT_CAM_Kernel_daniele_t_1 0.04
DRT_CAM_Kernel_daniele_r_hit_min 128
DRT_CAM_Kernel_daniele_r_hit_max 896
DRT_CAM_Kernel_catDataSelection {{parent.HellwigCam16Data}}
DRT_CAM_Kernel_rxy {0.8336 0.1735}
DRT_CAM_Kernel_gxy {2.3854 -1.4659}
DRT_CAM_Kernel_bxy {0.087 -0.125}
DRT_CAM_Kernel_wxy {0.333 0.333}
DRT_CAM_Kernel_ra {{"parent.ac_resp * 2"}}
DRT_CAM_Kernel_ba {{"0.05 + (2 - DRT_CAM_Kernel_ra)"}}
DRT_CAM_Kernel_XYZ_w {95.05 100 108.88}
DRT_CAM_Kernel_XYZ_w_scaler 100
DRT_CAM_Kernel_L_A {{parent.BlinkScript1_DRT_CAM_Kernel_L_A}}
DRT_CAM_Kernel_Y_b {{parent.BlinkScript1_DRT_CAM_Kernel_Y_b}}
DRT_CAM_Kernel_L_B {0 {DRT_CAM_Kernel_L_B.x} {DRT_CAM_Kernel_L_B.x}}
DRT_CAM_Kernel_L_A_out {{parent.BlinkScript1_DRT_CAM_Kernel_L_A_out}}
DRT_CAM_Kernel_Y_b_out {{parent.BlinkScript1_DRT_CAM_Kernel_Y_b_out}}
rebuild_finalise ""
name BlinkScript1
note_font "Bitstream Vera Sans"
selected true
xpos -908
ypos -201
addUserKnob {20 User}
addUserKnob {7 matrixScaler R 0 2}
matrixScaler 0.99415
}
Output {
name Output1
xpos -908
ypos -84
}
end_group