#! /u/soft/foundry/nuke12.2v5/libnuke-12.2.5.so -nx version 12.2 v5 define_window_layout_xml { } Root { inputs 0 name /u/chrisbrejon/Downloads/output_transform_prototypes_v001.nk format "2248 898 0 0 2248 898 1 IMG (Full Frame)" proxy_type scale proxy_format "1124 449 0 0 1124 449 1 IMG (Half Size)" colorManagement OCIO defaultViewerLUT "OCIO LUTs" workingSpaceLUT scene_linear monitorLut ACES/P3D65 int8Lut matte_paint int16Lut texture_paint logLut compositing_log floatLut scene_linear views "L #FF0000 R #00FF00" free_type_system_fonts false } BackdropNode { inputs 0 name BackdropNode1 tile_color 0x8e388e00 label "OpenDRT - v0.0.81b1" note_font_size 42 xpos 432 ypos -395 bdwidth 465 bdheight 320 } BackdropNode { inputs 0 name BackdropNode2 tile_color 0x7171c600 label "ACES 1.2" note_font_size 42 xpos -77 ypos -398 bdwidth 480 bdheight 325 } BackdropNode { inputs 0 name BackdropNode3 tile_color 0x8e388e00 label "DIY PerChannel DRT v2" note_font_size 42 xpos 922 ypos -396 bdwidth 1615 bdheight 1066 } BackdropNode { inputs 0 name BackdropNode4 tile_color 0x8e388e00 label "Tonemap ToeLast v1.1" note_font_size 42 xpos 2563 ypos -396 bdwidth 593 bdheight 348 } BackdropNode { inputs 0 name BackdropNode5 tile_color 0x8e388e00 label "Tonemap PiecewiseHyperbolic v3" note_font_size 42 xpos 3183 ypos -398 bdwidth 680 bdheight 350 } Group { inputs 0 name OpenDRT xpos 615 ypos -215 addUserKnob {20 OpenDRT} addUserKnob {26 about_label l " " T "\n\nOpenDRT created by Jed Smith\n
v0.0.81b1 | documentation
"} addUserKnob {41 gamut l "input gamut" T InGamut_to_XYZ.gamut} addUserKnob {26 spacer l " " T ""} addUserKnob {35 presets l " " M {"presets/Rec.1886: 2.4 Power EOTF | Rec.709" "knobs this \{Lw 100 Lg 10 c 1.4 surround 1 wp 3 eotf 2 display_gamut 2\}" "presets/sRGB Display: 2.2 Power EOTF | Rec.709" "knobs this \{Lw 100 Lg 10 c 1.4 surround 0 wp 3 eotf 1 display_gamut 2\}" "presets/Apple Display P3: 2.2 Power EOTF | P3D65" "knobs this \{Lw 100 Lg 10 c 1.4 surround 0 wp 3 eotf 1 display_gamut 1\}" "presets/Rec.2100: ST-2084 PQ EOTF | Rec.2020 | 108 nit" "knobs this \{Lw 108 Lg 4.8 c 1.3 surround 2 wp 3 eotf 4 display_gamut 0\}" "presets/Rec.2100: ST-2084 PQ EOTF | Rec.2020 | 600 nit" "knobs this \{Lw 600 Lg 15 c 1.2 surround 2 wp 3 eotf 4 display_gamut 0\}" "presets/Rec.2100: ST-2084 PQ EOTF | Rec.2020 | 1000 nit" "knobs this \{Lw 1000 Lg 15 c 1.2 surround 2 wp 3 eotf 4 display_gamut 0\}" "presets/Rec.2100: HLG EOTF | Rec.2020 | 1000 nit" "knobs this \{Lw 1000 Lg 15 c 1.2 surround 2 wp 3 eotf 5 display_gamut 0\}" "presets/Rec.2100: ST-2084 PQ EOTF | Rec.2020 | 2000 nit" "knobs this \{Lw 2000 Lg 15 c 1.2 surround 2 wp 3 eotf 4 display_gamut 0\}" "presets/Rec.2100: ST-2084 PQ EOTF | Rec.2020 | 4000 nit" "knobs this \{Lw 4000 Lg 15 c 1.2 surround 2 wp 3 eotf 4 display_gamut 0\}" ""}} addUserKnob {26 ""} addUserKnob {26 luminance_label l " " T luminance} addUserKnob {7 Lw t "Normalized white luminance in nits" R 48 4000} Lw 100 addUserKnob {7 Lg t "Grey luminance in nits." R 4 20} Lg 10 addUserKnob {7 c l contrast R 0.8 2} c 1.4 addUserKnob {4 surround M {average dim dark ""}} surround dim addUserKnob {6 pwh l "piecewise hyperbolic" t "Piecewise hyperbolic compression function with linear section below middle grey" +STARTLINE} addUserKnob {20 calc_grp l "" +STARTLINE n 1} calc_grp 0 addUserKnob {7 Lp t "Peak luminance in nits" R 48 10000} Lp {{eotf==4?10000:eotf==5?1000:Lw}} addUserKnob {7 t0 l toe R 0 0.01} t0 {{1/Lw}} addUserKnob {7 ps t "surround compensation: unconstrained power function" R 0.9 1} ps {{0.9+0.05*surround}} addUserKnob {7 p t "power (combination of grey-constrained contrast and unconstrained surround compensation)" R 0.5 4} p {{c*ps}} addUserKnob {7 th} th {{Lg/Lw}} addUserKnob {78 g l grey t "input -> output grey" n 2} g {0.18 {Lg/Lp}} addUserKnob {7 w t "input exposure" R 0 100} w {{pwh?th>pow(g.1/s.1,1/c)?pow(g.1/s.1,1/c)/g.0:(2*th*pow(g.1/s.1,1/c)-pow(g.1/s.1,1/c)-th*th)/(g.0*(pow(g.1/s.1,1/c)-1)):-pow(g.1/s.1,1/c)/(g.0*(pow(g.1/s.1,1/c)-1))}} addUserKnob {7 h R 1 2} h {{0.048*Lw/1000+1.037}} addUserKnob {78 s l scale n 2} s {{w*max(1,pow(Lw/1000,0.1))} {Lw/Lp*h/w_n}} addUserKnob {20 endGroup n -1} addUserKnob {26 ""} addUserKnob {26 chroma_label l " " T chroma} addUserKnob {7 chroma_compress l compress t "amount to compress chrominance as luminance approaches display maximum"} chroma_compress 0.35 addUserKnob {7 saturation R 1 1.2} saturation 1.1 addUserKnob {41 wp l whitepoint T TruelightLMS_to_XYZ.wp} addUserKnob {20 chroma_grp l " " t "preset chroma params - adjust if you wish" n 1} chroma_grp 0 addUserKnob {7 w_n l "wp norm" R 0 2} w_n {{this.TruelightLMS_to_XYZ.w_n}} addUserKnob {7 wr l "weight r" t "red weight for norm" R 0 0.3} wr 0.24 addUserKnob {7 wg l "weight g" t "green weight for norm" R 0 0.3} wg 0.14 addUserKnob {7 wb l "weight b" t "blue weight for norm\n" R 0 0.3} wb 0.09 addUserKnob {20 endGroup_chroma l endGroup n -1} addUserKnob {26 ""} addUserKnob {26 display_encoding_label l " " T "display encoding"} addUserKnob {41 eotf T InverseEOTF.eotf} addUserKnob {41 display_gamut l gamut -STARTLINE T XYZ_to_DisplayGamut.gamut} addUserKnob {6 clamp t "clamp output to a 0-1 range" -STARTLINE} clamp true addUserKnob {26 ""} addUserKnob {4 direction M {forward inverse}} } Input { inputs 0 name Input xpos 290 ypos -1000 } Dot { name Dot7 xpos 324 ypos -876 } set Nee0d0f00 [stack 0] Group { name EOTF xpos 730 ypos -880 addUserKnob {20 EOTF_tab l EOTF} addUserKnob {4 eotf l EOTF t "Choose the inverse EOTF to apply for the target display device." M {None "sRGB Display" BT.1886 "Gamma 2.6" PQ HLG ""}} eotf {{parent.InverseEOTF.eotf}} } Input { inputs 0 name Input xpos 400 ypos -160 } Dot { name Dot3 xpos 434 ypos -96 } set Ne8227900 [stack 0] Dot { name Dot8 xpos 544 ypos -96 } set Ne8227200 [stack 0] Dot { name Dot1 xpos 654 ypos -96 } Expression { expr0 r<=0.5?r*r/3:(exp((r-_c)/_a)+_b)/12 expr1 g<=0.5?g*g/3:(exp((g-_c)/_a)+_b)/12 expr2 b<=0.5?b*b/3:(exp((b-_c)/_a)+_b)/12 name HLG_InverseOETF xpos 620 ypos -70 addUserKnob {20 CONSTANTS_tab l CONSTANTS} addUserKnob {7 _a t alpha} _a 0.17883277 addUserKnob {7 _b t beta} _b {{1-4*_a}} addUserKnob {7 _c} _c {{0.5-_a*log(4*_a)}} } Expression { temp_name0 Ys temp_expr0 0.2627*r+0.6780*g+0.0593*b expr0 pow(Ys,_g-1)*r expr1 pow(Ys,_g-1)*g expr2 pow(Ys,_g-1)*b name HLG_OOTF xpos 620 ypos -40 addUserKnob {20 CONSTANTS_tab l CONSTANTS} addUserKnob {7 _g t "Gamma: Extended model for gamma variation according to peak display luminance and surround luminance: BT.2390-8 p32" R 0 2} _g {{1.2*pow(1.111,log(Lw/1000)/log(2))*pow(0.98,log(max(1e-6,Lamb)/5)/log(2))}} addUserKnob {7 Lw R 600 4000} Lw 1000 addUserKnob {7 Lb} addUserKnob {7 Lamb t "ambient luminance level in nits" R 0 200} Lamb 5 } push $Ne8227200 Expression { expr0 pow((pow(r,1/m_2)-c_1)/(c_2-c_3*pow(r,1/m_2)),1/m_1)*10000/Lw expr1 pow((pow(g,1/m_2)-c_1)/(c_2-c_3*pow(g,1/m_2)),1/m_1)*10000/Lw expr2 pow((pow(b,1/m_2)-c_1)/(c_2-c_3*pow(b,1/m_2)),1/m_1)*10000/Lw name ST2084_EOTF xpos 510 ypos -71 addUserKnob {20 CONSTANTS_tab l CONSTANTS} addUserKnob {7 m_1} m_1 {{2610/4096*(1/4)}} addUserKnob {7 m_2} m_2 {{2523/4096*128}} addUserKnob {7 c_1} c_1 {{107/128}} addUserKnob {7 c_2} c_2 {{2413/128}} addUserKnob {7 c_3} c_3 {{2392/128}} addUserKnob {7 Lw t "Display peak luminance in nits" R 600 4000} Lw 10000 } push $Ne8227900 Expression { expr0 sign(r)*pow(fabs(r),p) expr1 sign(g)*pow(fabs(g),p) expr2 sign(b)*pow(fabs(b),p) name Power xpos 400 ypos -70 addUserKnob {20 Params_tab l Params} addUserKnob {7 p l power R 0.2 2} p {{eotf?2+eotf*0.2:1}} } Switch { inputs 3 which {{eotf-3}} name SwitchInverseEOTF xpos 400 ypos -11 } Output { name Output xpos 400 ypos 80 } end_group Expression { expr0 r/s.1 expr1 g/s.1 expr2 b/s.1 name InvOutputScale xpos 730 ypos -820 } ColorMatrix { matrix { {{parent.XYZ_to_DisplayGamut.ColorMatrix.matrix} {parent.XYZ_to_DisplayGamut.ColorMatrix.matrix} {parent.XYZ_to_DisplayGamut.ColorMatrix.matrix}} {{parent.XYZ_to_DisplayGamut.ColorMatrix.matrix} {parent.XYZ_to_DisplayGamut.ColorMatrix.matrix} {parent.XYZ_to_DisplayGamut.ColorMatrix.matrix}} {{parent.XYZ_to_DisplayGamut.ColorMatrix.matrix} {parent.XYZ_to_DisplayGamut.ColorMatrix.matrix} {parent.XYZ_to_DisplayGamut.ColorMatrix.matrix}} } invert true name Inv_XYZ_to_DisplayGamut xpos 730 ypos -760 } ColorMatrix { matrix { {{parent.TruelightLMS_to_XYZ.matrix} {parent.TruelightLMS_to_XYZ.matrix} {parent.TruelightLMS_to_XYZ.matrix}} {{parent.TruelightLMS_to_XYZ.matrix} {parent.TruelightLMS_to_XYZ.matrix} {parent.TruelightLMS_to_XYZ.matrix}} {{parent.TruelightLMS_to_XYZ.matrix} {parent.TruelightLMS_to_XYZ.matrix} {parent.TruelightLMS_to_XYZ.matrix}} } name Inv_TruelightLMS_to_XYZ xpos 730 ypos -700 } Dot { name Dot1 xpos 764 ypos -636 } set Ne871e400 [stack 0] Dot { name Dot2 xpos 544 ypos -636 } Expression { channel0 {rgba.red rgba.green rgba.blue none} expr0 sqrt(pow(w.0*r,2)+pow(w.1*g,2)+pow(w.2*b,2))/sum channel1 none channel2 none channel3 none name WeightedSmoothMax1 xpos 510 ypos -610 addUserKnob {20 Param} addUserKnob {78 w n 3} w {{wr} {wg} {wb}} addUserKnob {7 sum t "Normalize so achromatic in=out" R 0 2} sum {{sqrt(w.0*w.0+w.1*w.1+w.2*w.2)}} } Expression { temp_name0 mn temp_expr0 1e-6 temp_name1 mx temp_expr1 0.999 expr0 max(mn,min(mx,r)) expr1 max(mn,min(mx,g)) expr2 max(mn,min(mx,b)) name Clamp1 xpos 510 ypos -580 } Dot { name Dot3 xpos 544 ypos -546 } set Ne871c800 [stack 0] Expression { expr0 (r+sqrt(r*(4*t0+r)))/2 channel1 {-rgba.red rgba.green -rgba.blue none} expr1 (g+sqrt(g*(4*t0+g)))/2 expr2 (b+sqrt(b*(4*t0+b)))/2 name InvToe xpos 510 ypos -520 } Expression { expr0 pow(r,1/p) expr1 pow(g,1/p) expr2 pow(b,1/p) name InvPower xpos 510 ypos -490 } set Ne841b900 [stack 0] Expression { expr0 r>th?th+1/(1/(r-th)-1/(1-th)):r expr1 g>th?th+1/(1/(g-th)-1/(1-th)):g expr2 b>th?th+1/(1/(b-th)-1/(1-th)):b name InvShoulder_pwh xpos 400 ypos -460 } push $Ne841b900 Expression { expr0 r/(1-r) expr1 g/(1-g) expr2 b/(1-b) name InvShoulder note_font Helvetica xpos 510 ypos -459 } Switch { inputs 2 which {{parent.pwh}} name Switch2 note_font Helvetica xpos 510 ypos -429 } set Ne841a400 [stack 0] Expression { expr0 r/s.0 expr1 g/s.0 expr2 b/s.0 name InvInputScale xpos 510 ypos -370 } Dot { name Dot4 xpos 544 ypos -306 } push $Ne841b900 push $Ne841a400 MergeExpression { inputs 2 expr0 Ar==0?0:Ar/Br expr1 Ag==0?0:Ag/Bg expr2 Ab==0?0:Ab/Bb name MergeDivide1 xpos 620 ypos -430 } Expression { expr0 pow(r,p) expr1 pow(g,p) expr2 pow(b,p) name Power xpos 620 ypos -400 addUserKnob {20 Params_tab l Params} addUserKnob {7 p l power R 0.01 2} p {{chroma_compress}} } Expression { expr0 r*s expr1 g*s expr2 b*s name ScaleSaturation1 xpos 620 ypos -370 addUserKnob {20 Params_tab l Params} addUserKnob {7 s l scale R 0 2} s {{saturation}} } Dot { name Dot8 xpos 654 ypos -336 } push $Ne871c800 push $Ne871e400 MergeExpression { inputs 2 expr0 Ar==0?0:Br/Ar expr1 Ag==0?0:Bg/Ag expr2 Ab==0?0:Bb/Ab name MergeDivideReverse3 xpos 730 ypos -550 } MergeExpression { inputs 2 expr0 (Br-1)/Ar+1 expr1 (Bg-1)/Ag+1 expr2 (Bb-1)/Ab+1 name InvLerp xpos 730 ypos -340 } MergeExpression { inputs 2 expr0 Ar*Br expr1 Ar*Bg expr2 Ar*Bb name Multiply2 xpos 730 ypos -310 } ColorMatrix { matrix { {{parent.XYZ_to_TruelightLMS.matrix} {parent.XYZ_to_TruelightLMS.matrix} {parent.XYZ_to_TruelightLMS.matrix}} {{parent.XYZ_to_TruelightLMS.matrix} {parent.XYZ_to_TruelightLMS.matrix} {parent.XYZ_to_TruelightLMS.matrix}} {{parent.XYZ_to_TruelightLMS.matrix} {parent.XYZ_to_TruelightLMS.matrix} {parent.XYZ_to_TruelightLMS.matrix}} } invert true name Inv_XYZ_to_TruelightLMS xpos 730 ypos -250 } ColorMatrix { matrix { {{parent.InGamut_to_XYZ.ColorMatrix.matrix} {parent.InGamut_to_XYZ.ColorMatrix.matrix} {parent.InGamut_to_XYZ.ColorMatrix.matrix}} {{parent.InGamut_to_XYZ.ColorMatrix.matrix} {parent.InGamut_to_XYZ.ColorMatrix.matrix} {parent.InGamut_to_XYZ.ColorMatrix.matrix}} {{parent.InGamut_to_XYZ.ColorMatrix.matrix} {parent.InGamut_to_XYZ.ColorMatrix.matrix} {parent.InGamut_to_XYZ.ColorMatrix.matrix}} } invert true name Inv_InGamut_to_XYZ xpos 730 ypos -190 } Dot { name Dot9 xpos 764 ypos 84 } push $Nee0d0f00 Group { name InGamut_to_XYZ tile_color 0x429940ff selected true xpos 290 ypos -820 addUserKnob {20 InputGamut_to_XYZ_tab l InputGamut_to_XYZ} addUserKnob {4 gamut l "input gamut" M {ACES ACEScg P3D65 Rec.2020 Rec.709 AlexaWideGamut RedWideGamutRGB "Filmlight E-Gamut" "DaVinci Wide Gamut" ""}} gamut ACEScg addUserKnob {41 matrix T ColorMatrix.matrix} addUserKnob {41 invert -STARTLINE T ColorMatrix.invert} } Input { inputs 0 name Input xpos 290 ypos -610 } Dot { name Dot1 xpos 324 ypos -546 } set Ne80cb900 [stack 0] ColorMatrix { matrix { {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}} {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}} {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}} } name ColorMatrix xpos 290 ypos -369 } Output { name Output xpos 290 ypos -250 } push $Ne80cb900 Dot { name Dot391 label " *RGB to XYZ D65 CAT: XYZ Scaling" xpos 434 ypos -546 } set Ne80ca400 [stack 0] ColorMatrix { matrix { {0.7006223202 0.1487748027 0.101058729} {0.2741184831 0.8736317754 -0.1477504224} {-0.09896290302 -0.1378953159 1.325916052} } name ColorMatrix30 label "DaVinci WG to XYZ D65" note_font Helvetica xpos 1280 ypos -465 } push $Ne80ca400 ColorMatrix { matrix { {0.705396831 0.1640413404 0.08101775497} {0.2801307142 0.8202067018 -0.1003373787} {-0.1037815139 -0.07290726155 1.265746593} } name ColorMatrix29 label "Filmlight E-Gamut to XYZ D65" note_font Helvetica xpos 1170 ypos -465 } push $Ne80ca400 ColorMatrix { matrix { {0.735275209 0.06860940903 0.1465712786} {0.2866940796 0.8429790735 -0.1296732426} {-0.07968084514 -0.3473432064 1.516081929} } name ColorMatrix22 label "REDWideGamutRGB to XYZ D65" xpos 1060 ypos -465 } push $Ne80ca400 ColorMatrix { matrix { {0.6380076408 0.2147038132 0.09774445742} {0.2919537723 0.8238408566 -0.1157948226} {0.002798279049 -0.06703422219 1.153293848} } name ColorMatrix21 label "Arri AlexaWideGamut to XYZ D65" xpos 950 ypos -465 } push $Ne80ca400 ColorMatrix { matrix { {0.4123909175 0.3575843573 0.1804807931} {0.2126390785 0.7151687145 0.07219231129} {0.01933082566 0.1191947833 0.9505321383} } name ColorMatrix18 label "Rec709 to XYZ D65" xpos 840 ypos -465 } push $Ne80ca400 ColorMatrix { matrix { {0.6369581223 0.1446169168 0.1688809693} {0.2627002299 0.6779981256 0.05930171534} {4.99410725e-17 0.02807269618 1.060985088} } name ColorMatrix17 label "Rec2020 to XYZ D65" xpos 730 ypos -465 } push $Ne80ca400 ColorMatrix { matrix { {0.4865711331 0.2656677067 0.1982173175} {0.2289746404 0.6917386055 0.07928691804} {-3.972076965e-17 0.04511338845 1.043944478} } name ColorMatrix16 label "P3D65 to XYZ D65" xpos 620 ypos -465 } push $Ne80ca400 ColorMatrix { matrix { {0.6609312296 0.1336961389 0.1558285803} {0.2722287476 0.6740817428 0.05368950963} {-0.006018006243 0.004383686464 1.090692043} } name ColorMatrix1 label "ACEScg to XYZ D65" xpos 510 ypos -465 } push $Ne80ca400 ColorMatrix { matrix { {0.9503623843 0 9.346324805e-05} {0.3439664543 0.728166163 -0.07213254273} {0 0 1.089057803} } name ColorMatrix2 label "ACES to XYZ D65" xpos 400 ypos -465 } Switch { inputs 9 which {{gamut}} name SwitchGamut selected true xpos 400 ypos -370 } end_group ColorMatrix { matrix { {0.18295 0.859943 -0.031061} {-0.394427 1.258988 0.106423} {0.064856 -0.07625 0.93164} } name XYZ_to_TruelightLMS label "XYZ D65 to TruelightRGB D65 Scaled" xpos 290 ypos -706 } Dot { name Dot453 xpos 324 ypos -636 } set Ne8098f00 [stack 0] Dot { name Dot454 xpos 104 ypos -636 } Expression { channel0 {rgba.red rgba.green rgba.blue none} expr0 sqrt(pow(w.0*r,2)+pow(w.1*g,2)+pow(w.2*b,2))/sum channel1 none channel2 none channel3 none name WeightedVectorLength xpos 70 ypos -610 addUserKnob {20 Param} addUserKnob {78 w n 3} w {{wr} {wg} {wb}} addUserKnob {7 sum t "Normalize so achromatic in=out" R 0 2} sum {{sqrt(w.0*w.0+w.1*w.1+w.2*w.2)}} } Dot { name Dot455 xpos 104 ypos -546 } set Ne8063900 [stack 0] Expression { expr0 r*s.0 expr1 g*s.0 expr2 b*s.0 name InputScale xpos 70 ypos -520 } set Ne8063200 [stack 0] Expression { expr0 r>th?th+1/(1/(r-th)+1/(1-th)):r expr1 g>th?th+1/(1/(g-th)+1/(1-th)):g expr2 b>th?th+1/(1/(b-th)+1/(1-th)):b name Shoulder_pwh xpos -40 ypos -490 } push $Ne8063200 Expression { expr0 r/(r+1) expr1 g/(g+1) expr2 b/(b+1) name Shoulder xpos 70 ypos -490 } Switch { inputs 2 which {{parent.pwh}} name Switch1 note_font Helvetica xpos 70 ypos -459 } set Ne8061d00 [stack 0] Expression { expr0 pow(r,p) expr1 pow(g,p) expr2 pow(b,p) name Power1 xpos 70 ypos -400 } Expression { expr0 (r*r)/(r+t0) channel1 {-rgba.red rgba.green -rgba.blue none} expr1 (g*g)/(g+t0) expr2 (b*b)/(b+t0) name Toe xpos 70 ypos -370 } Dot { name Dot6 xpos 104 ypos -306 } push $Ne8061d00 push $Ne8063200 Dot { name Dot5 xpos 214 ypos -516 } MergeExpression { inputs 2 expr0 Ar==0?0:Ar/Br expr1 Ag==0?0:Ag/Bg expr2 Ab==0?0:Ab/Bb name MergeDivide2 xpos 180 ypos -460 } Expression { expr0 pow(r,p) expr1 pow(g,p) expr2 pow(b,p) name Power8 xpos 180 ypos -430 addUserKnob {20 Params_tab l Params} addUserKnob {7 p l power R 0.01 2} p {{chroma_compress}} } Expression { expr0 r*s expr1 g*s expr2 b*s name ScaleSaturation xpos 180 ypos -400 addUserKnob {20 Params_tab l Params} addUserKnob {7 s l scale R 0 2} s {{saturation}} } Dot { name Dot13 xpos 214 ypos -336 } push $Ne8063900 push $Ne8098f00 MergeExpression { inputs 2 expr0 Ar==0?0:Br/Ar expr1 Ag==0?0:Bg/Ag expr2 Ab==0?0:Bb/Ab name MergeDivideReverse1 xpos 290 ypos -550 } MergeExpression { inputs 2 expr0 (1-Ar)+Br*Ar expr1 (1-Ag)+Bg*Ag expr2 (1-Ab)+Bb*Ab name LerpToTarget1 xpos 290 ypos -340 } MergeExpression { inputs 2 expr0 Ar*Br expr1 Ar*Bg expr2 Ar*Bb name Multiply14 xpos 290 ypos -310 } ColorMatrix { matrix { {{w_ad.0} 0.859943 -0.031061} {-0.394427 {w_ad.1} 0.106423} {0.064856 -0.07625 {w_ad.2}} } invert true name TruelightLMS_to_XYZ label "Scaled for Chromatic Adaptation" xpos 290 ypos -256 addUserKnob {20 User} addUserKnob {4 wp l whitepoint t "Choose the creative whitepoint that determines the color of the neutral axis when rendered on the display." M {D50 D55 D60 D65 D75 D93}} wp D65 addUserKnob {78 w_ad l "wp adapt" t "adapted whitepoint weights" n 3} w_ad {{curve(wp) 0.171823 0.176293 0.17997 0.18295 0.18759 0.193087} {curve(wp) 1.292538 1.279333 1.268278 1.258988 1.244085 1.225341} {curve(wp) 1.228587 1.10072 1.00585 0.93164 0.827517 0.717363}} addUserKnob {7 w_n l "wp norm" t "amount to scale output for whitepoint adaptation" R 1 1.5} w_n {{curve(wp+6*display_gamut) 1.09063 1.05337 1.02355 1 1.12915 1.30631 1.1408 1.08334 1.037 1 1.13116 1.31116 1.17646 1.10416 1.0461 1 1.14486 1.34374}} } Group { name XYZ_to_DisplayGamut tile_color 0x429940ff xpos 290 ypos -190 addUserKnob {20 XYZ_to_DisplayGamut_tab l XYZ_to_DisplayGamut} addUserKnob {4 gamut l "display gamut" t "Choose the target display device chromaticities." M {Rec.2020 P3 Rec.709 "" ""}} gamut Rec.709 addUserKnob {41 matrix T ColorMatrix.matrix} addUserKnob {41 invert -STARTLINE T ColorMatrix.invert} } Input { inputs 0 name Input xpos 290 ypos -580 } Dot { name Dot391 label " " xpos 324 ypos -516 } set Ne39b7200 [stack 0] Dot { name Dot1 label " XYZ D65 to *RGB CAT: XYZ Scaling" xpos 434 ypos -516 } set Ne39b6b00 [stack 0] ColorMatrix { matrix { {3.240968943 -1.537382722 -0.4986106157} {-0.9692435861 1.875967264 0.04155508429} {0.05563007668 -0.2039769441 1.056971431} } name ColorMatrix23 label "XYZ D65 to Rec709" xpos 620 ypos -465 } push $Ne39b6b00 ColorMatrix { matrix { {2.493495464 -0.9313831329 -0.4027105868} {-0.8294886947 1.762663484 0.02362468652} {0.03584581986 -0.07617236674 0.9568843246} } name ColorMatrix24 label "XYZ D65 to P3D65" xpos 510 ypos -465 } push $Ne39b6b00 ColorMatrix { matrix { {1.716650844 -0.3556707203 -0.2533662021} {-0.6666842103 1.616480947 0.01576854289} {0.01763985492 -0.04277061298 0.9421030283} } name ColorMatrix25 label "XYZ D65 to Rec2020" xpos 400 ypos -465 } Switch { inputs 3 which {{gamut}} name SwitchGamut xpos 400 ypos -399 } push $Ne39b7200 ColorMatrix { matrix { {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}} {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}} {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}} } name ColorMatrix xpos 290 ypos -399 } Output { name Output xpos 290 ypos -310 } end_group Expression { expr0 r*s.1 expr1 g*s.1 expr2 b*s.1 name OutputScale xpos 290 ypos -130 } Expression { temp_name0 mn temp_expr0 0 temp_name1 mx temp_expr1 1 expr0 max(mn,min(mx,r)) expr1 max(mn,min(mx,g)) expr2 max(mn,min(mx,b)) name Clamp xpos 290 ypos -100 disable {{!parent.clamp}} } Group { name InverseEOTF xpos 290 ypos -10 addUserKnob {20 EOTF_tab l EOTF} addUserKnob {4 eotf t "Choose the inverse EOTF to apply for the target display device." M {None "sRGB Display" BT.1886 "Gamma 2.6" PQ HLG "" "" ""}} eotf BT.1886 } Input { inputs 0 name Input xpos 400 ypos -160 } Dot { name Dot1 xpos 434 ypos -96 } set Ne3991d00 [stack 0] Dot { name Dot3 xpos 544 ypos -96 } set Ne3991600 [stack 0] Dot { name Dot4 xpos 654 ypos -96 } Expression { temp_name0 Yd temp_expr0 0.2627*r+0.6780*g+0.0593*b expr0 r*pow(Yd,(1-_g)/_g) expr1 g*pow(Yd,(1-_g)/_g) expr2 b*pow(Yd,(1-_g)/_g) name HLG_InverseOOTF xpos 620 ypos -70 addUserKnob {20 CONSTANTS_tab l CONSTANTS} addUserKnob {7 _g t "Gamma: Extended model for gamma variation according to peak display luminance and surround luminance: BT.2390-8 p32" R 0 2} _g {{1.2*pow(1.111,log(Lw/1000)/log(2))*pow(0.98,log(max(1e-6,Lamb)/5)/log(2))}} addUserKnob {7 Lw R 600 4000} Lw {{parent.parent.Lw}} addUserKnob {7 Lamb t "ambient luminance level in nits" R 0 200} Lamb 5 } Expression { expr0 r<=1/12?sqrt(3*r):_a*log(12*r-_b)+_c expr1 g<=1/12?sqrt(3*g):_a*log(12*g-_b)+_c expr2 b<=1/12?sqrt(3*b):_a*log(12*b-_b)+_c name HLG_OETF xpos 620 ypos -38 addUserKnob {20 CONSTANTS_tab l CONSTANTS} addUserKnob {7 _a t alpha} _a 0.17883277 addUserKnob {7 _b t beta} _b {{1-4*_a}} addUserKnob {7 _c} _c {{0.5-_a*log(4*_a)}} } push $Ne3991600 Expression { expr0 pow((c_1+c_2*pow(r*Lw/10000,m_1))/(1+c_3*pow(r*Lw/10000,m_1)),m_2) expr1 pow((c_1+c_2*pow(g*Lw/10000,m_1))/(1+c_3*pow(g*Lw/10000,m_1)),m_2) expr2 pow((c_1+c_2*pow(b*Lw/10000,m_1))/(1+c_3*pow(b*Lw/10000,m_1)),m_2) name ST2084_InverseEOTF xpos 510 ypos -70 addUserKnob {20 CONSTANTS_tab l CONSTANTS} addUserKnob {7 m_1} m_1 {{2610/4096*(1/4)}} addUserKnob {7 m_2} m_2 {{2523/4096*128}} addUserKnob {7 c_1} c_1 {{107/128}} addUserKnob {7 c_2} c_2 {{2413/128}} addUserKnob {7 c_3} c_3 {{2392/128}} addUserKnob {7 Lw t "Display peak luminance in nits" R 600 4000} Lw 10000 } push $Ne3991d00 Expression { expr0 sign(r)*pow(fabs(r),1/p) expr1 sign(g)*pow(fabs(g),1/p) expr2 sign(b)*pow(fabs(b),1/p) name power xpos 400 ypos -70 addUserKnob {20 Params_tab l Params} addUserKnob {7 p l power R 0.2 2} p {{eotf?2+eotf*0.2:1}} } Switch { inputs 3 which {{eotf-3}} name SwitchInverseEOTF xpos 400 ypos -10 } Output { name Output xpos 400 ypos 50 } end_group Switch { inputs 2 which {{parent.direction}} name SwitchDirection xpos 290 ypos 80 } Output { name Output xpos 290 ypos 170 } end_group Group { inputs 0 name ACES_OutputTransform_v1_2_ tile_color 0xa57aaaff xpos 126 ypos -221 addUserKnob {20 ACES_OutputTransform_tab l "ACES OutputTransform"} addUserKnob {41 gamut l "input gamut" T GamutToXYZ_lite.gamut} addUserKnob {26 ""} addUserKnob {35 presets t "display output presets." M {display/sRGB "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 0 limiting_pri 0 eotf 0 stretch_black 0 d60_sim 0 force_d65_cat 0 dark_to_dim 1 legal_range 0 label \"sRGB\"\}" "display/sRGB D60 sim." "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 0 limiting_pri 0 eotf 0 stretch_black 0 d60_sim 1 force_d65_cat 0 dark_to_dim 1 legal_range 0 label \"sRGB D60 sim.\"\}" display/Rec.709 "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 0 limiting_pri 0 eotf 1 stretch_black 0 d60_sim 0 force_d65_cat 0 dark_to_dim 1 legal_range 0 label \"Rec.709\"\}" "display/Rec.709 D60 sim." "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 0 limiting_pri 0 eotf 1 stretch_black 0 d60_sim 1 force_d65_cat 0 dark_to_dim 1 legal_range 0 label \"Rec.709 D60 sim.\"\}" display/Rec.2020 "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 1 limiting_pri 1 eotf 1 stretch_black 0 d60_sim 0 force_d65_cat 0 dark_to_dim 1 legal_range 0 label \"Rec.2020\"\}" display/P3D60 "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 4 limiting_pri 4 eotf 4 stretch_black 0 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3D60\"\}" display/P3D65 "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 2 limiting_pri 2 eotf 4 stretch_black 0 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3D65\"\}" "display/P3D65 D60 sim." "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 2 limiting_pri 2 eotf 4 stretch_black 0 d60_sim 1 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3D65 D60 sim.\"\}" display/P3DCI "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 3 limiting_pri 3 eotf 4 stretch_black 0 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3DCI\"\}" "display/P3DCI D60 sim." "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 3 limiting_pri 3 eotf 4 stretch_black 0 d60_sim 1 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3DCI D60 sim.\"\}" "display/P3DCI D65 sim." "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 3 limiting_pri 3 eotf 4 stretch_black 0 d60_sim 0 force_d65_cat 1 dark_to_dim 0 legal_range 0 label \"P3DCI D65 sim.\"\}" display/DCDM "knobs this \{lum \{0.02 4.8 48\} override_ssts_params 0 use_c9 1 display_pri 7 limiting_pri 7 eotf 5 stretch_black 0 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"DCDM\"\}" "display/P3D65 ST2084 108nits 7.2nits" "knobs this \{lum \{0.0001 7.2 108\} override_ssts_params 0 use_c9 0 display_pri 2 limiting_pri 2 eotf 6 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3D65 ST2084 108nits 7.2nits\"\}" "display/P3D65 ST2084 1000nits 15nits" "knobs this \{lum \{0.0001 15 1000\} override_ssts_params 0 use_c9 0 display_pri 2 limiting_pri 2 eotf 6 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3D65 ST2084 1000nits 15nits\"\}" "display/P3D65 ST2084 2000nits 15nits" "knobs this \{lum \{0.0001 15 2000\} override_ssts_params 0 use_c9 0 display_pri 2 limiting_pri 2 eotf 6 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3D65 ST2084 2000nits 15nits\"\}" "display/P3D65 ST2084 2000nits 15nits" "knobs this \{lum \{0.0001 15 2000\} override_ssts_params 0 use_c9 0 display_pri 2 limiting_pri 2 eotf 6 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3D65 ST2084 2000nits 15nits\"\}" "display/P3D65 ST2084 4000nits 15nits" "knobs this \{lum \{0.0001 15 4000\} override_ssts_params 0 use_c9 0 display_pri 2 limiting_pri 2 eotf 6 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"P3D65 ST2084 4000nits 15nits\"\}" display/Rec2020_HLG_1000nits_15nits "knobs this \{lum \{0.0001 15 1000\} override_ssts_params 0 use_c9 0 display_pri 1 limiting_pri 1 eotf 7 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"Rec2020_HLG_1000nits_15nits\"\}" display/Rec2020_ST2084_1000nits_15nits "knobs this \{lum \{0.0001 15 1000\} override_ssts_params 0 use_c9 0 display_pri 1 limiting_pri 1 eotf 6 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"Rec2020_ST2084_1000nits_15nits\"\}" display/Rec2020_ST2084_2000nits_15nits "knobs this \{lum \{0.0001 15 2000\} override_ssts_params 0 use_c9 0 display_pri 1 limiting_pri 1 eotf 6 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"Rec2020_ST2084_2000nits_15nits\"\}" display/Rec2020_ST2084_4000nits_15nits "knobs this \{lum \{0.0001 15 4000\} override_ssts_params 0 use_c9 0 display_pri 1 limiting_pri 1 eotf 6 stretch_black 1 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"Rec2020_ST2084_4000nits_15nits\"\}" display/OCES "knobs this \{lum \{0.0001 4.8 10000\} override_ssts_params 0 use_c9 0 display_pri 6 limiting_pri 6 eotf 9 stretch_black 0 d60_sim 0 force_d65_cat 0 dark_to_dim 0 legal_range 0 label \"OCES\"\}" "" ""}} addUserKnob {26 display_label l " " T "Display Settings"} addUserKnob {78 lum l luminance t "SSTS Display Luminance: \ny_min y_mid y_max\n\nAccording to Zach Lewis's ACES_OT\nhttps://gist.github.com/zachlewis/786c0be941868644c993fde1c3515c2c\n\nStandard Cinema: \n0.02 4.8 48\nDolby Cinema: \n0.0001 7.2 108\nDolby Pulsar: \n0.005 15 4000\nDolby PRR-4220: \n0.005 10 600\nSony BVM-X300: \n0.0001 10 1000\nACES OCES: \n0.0001 4.8 10000\n\n" n 3} lum {0.02 4.8 48} addUserKnob {20 ssts_params_grp l "SSTS Parameters" n 1} ssts_params_grp 0 addUserKnob {6 override_ssts_params l "override ssts params" t "Enable overrides of SSTS params.\n\nOtherwise the values will be calculated automatically by the algorithm." +STARTLINE} addUserKnob {35 presets_ssts_param l presets t "If you want to override the default SSTS parameters and play around, here are some useful starting points." M {contrast/default "knobs this \{override_ssts_params 0 pctLow 0.35 pctHigh 0.89 slope \{0 1.5 0.\} exposure 0.0 use_c9 0\}" contrast/sdr "knobs this \{override_ssts_params 1 pctLow 0.35 pctHigh 0.89 slope \{0.1 1.6 0.01\} exposure 0.0 use_c9 0\}" contrast/high "knobs this \{override_ssts_params 1 pctLow 0.2 pctHigh 0.89 slope \{0.28 1.75 0.01\} exposure 0.0 use_c9 0\}" contrast/med "knobs this \{override_ssts_params 1 pctLow 0.40 pctHigh 0.89 slope \{0.38 1.3 0.01\} exposure 0.0 use_c9 0\}" contrast/med-low "knobs this \{override_ssts_params 1 pctLow 0.40 pctHigh 0.80 slope \{0.38 1.42 0.01\} exposure 0.0 use_c9 0\}" contrast/low "knobs this \{override_ssts_params 1 pctLow 0.40 pctHigh 0.80 slope \{0.38 1.2 0.01\} exposure 0.0 use_c9 0\}" ""}} addUserKnob {7 exposure R -5 5} addUserKnob {7 pctLow l knee} pctLow 0.35 addUserKnob {7 pctHigh l shoulder} pctHigh 0.89 addUserKnob {78 slope n 3} slope {0.38 1.501 0.01} addUserKnob {20 endGroup n -1} addUserKnob {6 use_c9 l "use SegmentedSpline_c9" t "In ACES 1.1 the Output Transform was re-written for HDR tonescales. \n\nIn ACES 1.1, HDR transforms use the new SSTS (Single Stage Tone Scale), while SDR transforms continue to use the old SegmentedSpline_c5 -> OCES -> SegmentedSpline_c9 -> ODT transform.\n\nIf this is enabled, the SegmentedSpline_c9 transform is used to maintain compatibility with the ACES SDR output transforms and enable a 1:1 match with the AMPAS CTL.\n\nIf you are curious, turn use_c9 off and play around with the SSTS Parameters." +STARTLINE} use_c9 true addUserKnob {26 ""} addUserKnob {4 display_pri l "display pri" t "Display encoding primaries." M {Rec709 Rec2020 P3D65 P3DCI P3D60 ACEScg ACES XYZ}} addUserKnob {4 limiting_pri l "limiting pri" t "Limiting primaries for the output transform." -STARTLINE M {Rec709 Rec2020 P3D65 P3DCI P3D60 ACEScg ACES XYZ}} addUserKnob {4 eotf l EOTF t "Electrical to Optical Transfer Function of the monitor." M {sRGB BT.1886 "Gamma 2.2" "Gamma 2.4" "Gamma 2.6" DCDM "ST-2084 (PQ)" HLG Linear OCES ""}} eotf BT.1886 addUserKnob {6 stretch_black l "stretch black" t "For hdr outputs: stretch black luminance to a PQ code value of 0" +STARTLINE} addUserKnob {6 d60_sim l "d60 sim" t "d60 whitepoint simulation." +STARTLINE} addUserKnob {6 force_d65_cat l "force d60 to d65 cat" -STARTLINE} addUserKnob {6 dark_to_dim l "dark to dim surround" t "Apply gamma adjustment to compensate for \"Dark to Dim\" surround. For SDR outputs only." +STARTLINE} dark_to_dim true addUserKnob {6 legal_range l "legal range" t "Output legal range." +STARTLINE} } BackdropNode { inputs 0 name Electrical_Optical_Transfer_Function tile_color 0x151515ff label "ACESlib.OutputTransforms.ctl : 185\n// EOTF" note_font_size 12 xpos -2025 ypos 2294 bdwidth 3391 bdheight 740 z_order -10 } BackdropNode { inputs 0 name BackdropNode1 tile_color 0x272727ff label "HDR EOTFs" note_font_size 42 xpos 425 ypos 2379 bdwidth 910 bdheight 617 z_order -5 } BackdropNode { inputs 0 name BackdropNode2 tile_color 0x272727ff label "SDR EOTFs" note_font_size 42 xpos -1158 ypos 2384 bdwidth 1436 bdheight 608 z_order -5 } BackdropNode { inputs 0 name AP1_to_XYZ tile_color 0x555b5cff label "ACESlib.OutputTransforms.ctl : 90\n// Rendering primaries to XYZ\n" note_font_size 12 xpos -1400 ypos 906 bdwidth 380 bdheight 156 } BackdropNode { inputs 0 name AP1_to_XYZ1 tile_color 0x555a5cff label "// Apply desaturation to compensate for luminance difference\nlinearCV = mult_f3_f33( linearCV, ODT_SAT_MAT);\n( SDR only)" note_font_size 12 xpos -1412 ypos 669 bdwidth 439 bdheight 186 } BackdropNode { inputs 0 name D60_whitepoint_simulation tile_color 0x232323ff label "ACESlib.OutputTransforms.ctl : 150\n// Scale to avoid clipping when device calibration is different from D60. \n// To simulate D60, unequal code values are sent to the display.\n" note_font_size 12 xpos -1399 ypos 176 bdwidth 818 bdheight 463 } BackdropNode { inputs 0 name Luminance_to_Linear_Code_Values tile_color 0x272727ff label "ACESlib.OutputTransforms.ctl : 87\n/* Scale absolute luminance to linear code value */\n" note_font_size 12 xpos -1367 ypos -50 bdwidth 315 bdheight 148 } BackdropNode { inputs 0 name Output_Color_Encoding_Specification tile_color 0x1d1d1dff label "OCES\n\n- ACES Output Output Color Encoding Specification \n- An idealized reference display with 0.0001 / 4.8 / 10000 luma\n w/ ACES AP0 Primaries." note_font_size 27.4 xpos -1833 ypos 2379 bdwidth 367 bdheight 377 } BackdropNode { inputs 0 name Output_Legal_Range tile_color 0x272727ff label "ACESlib.OutputTransforms.ctl : 216\n" note_font_size 12 xpos -1369 ypos 3128 bdwidth 318 bdheight 176 } BackdropNode { inputs 0 name Single_Stage_Tone_Scale tile_color 0x272727ff label "Single Stage Tone Scale : ACESlib.OutputTransforms.ctl : 82
// Apply the tonescale independently in rendering-space RGB\nfloat rgbPost\[3] = ssts_f3( rgbPre, PARAMS);\n\nIf output is SDR, output OCES from SSTS and use SegmentedSpline_c9."
  note_font_size 12
  xpos -1502
  ypos -653
  bdwidth 609
  bdheight 533
 }
 BackdropNode {
  inputs 0
  name clamp_negatives
  tile_color 0x272727ff
  label "ACESlib.OutputTransforms.ctl : 174\n// Clip values < 0 (i.e. projecting outside the display primaries)\nNote: Also clamping values > 1 here."
  note_font_size 12
  xpos -1393
  ypos 2087
  bdwidth 386
  bdheight 120
 }
 BackdropNode {
  inputs 0
  name dim_surround_gamma_adjustment
  tile_color 0x272727ff
  label "ACESlib.OutputTransforms.ctl : 92\n// Apply gamma adjustment to compensate for dim surround\n"
  note_font_size 12
  xpos -1407
  ypos 1063
  bdwidth 395
  bdheight 258
 }
 BackdropNode {
  inputs 0
  name limit_primaries
  tile_color 0x555a5cff
  label "ACESlib.OutputTransforms.ctl : 130\n// Gamut limit to limiting primaries\n"
  note_font_size 12
  xpos -1408
  ypos 1655
  bdwidth 396
  bdheight 194
 }
 BackdropNode {
  inputs 0
  name limit_primaries1
  tile_color 0x555a5cff
  label "ACESlib.OutputTransforms.ctl : 144\n// CIE XYZ to display encoding primaries\n"
  note_font_size 12
  xpos -1402
  ypos 1892
  bdwidth 384
  bdheight 151
 }
 BackdropNode {
  inputs 0
  name limit_primaries2
  tile_color 0x555a5cff
  label "ACESlib.OutputTransforms.ctl : 130\n    // Apply CAT from ACES white point to assumed observer adapted white point\n    // TODO: Needs to expand from just supporting D60 sim to allow for any\n    // observer adapted white point.\n"
  note_font_size 12
  xpos -1407
  ypos 1337
  bdwidth 467
  bdheight 301
 }
 BackdropNode {
  inputs 0
  name rrt_sweeteners_
  tile_color 0x555a5cff
  label "RRT Sweeteners : ACESlib.OutputTransforms.ctl : 79
// RRT sweeteners\nfloat rgbPre\[3] = rrt_sweeteners( in);\n"
  note_font_size 18
  xpos -1469
  ypos -1234
  bdwidth 519
  bdheight 548
 }
 Input {
  inputs 0
  name Input
  xpos -1250
  ypos -1450
 }
 AddChannels {
  channels rgba
  name AddChannels
  xpos -1250
  ypos -1415
 }
 Group {
  name GamutToXYZ_lite
  xpos -1250
  ypos -1373
  addUserKnob {20 GamutToXYZ_lite_tab l GamutToXYZ_lite}
  addUserKnob {4 gamut t "Choose gamut" M {XYZ ACES ACEScg "Filmlight E-Gamut" "DaVinci WG" Rec709 Rec2020 P3D60 P3D65 P3DCI "Arri AlexaWideGamut" REDDRAGONcolor REDDRAGONcolor2 REDcolor REDcolor2 REDcolor3 REDcolor4 REDWideGamutRGB "GoPro Protune Native" CanonCinemaGamut SonySGamut SonySGamut3Cine PanasonicVGamut "DJI D-Gamut" "Fujifilm F-Gamut" BMDFilmV1 BMD4kFilmV1 BMD4kFilmV3 BMD46kFilmV1 BMD46kFilmV3 BMDWideGamutV4 "AdobeRGB\t" AdobeWideGamutRGB ROMM RIMM ERIMM ProPhotoRGB RusselRGB SharpRGB AppleRGB BestRGB}}
  gamut ACEScg
  addUserKnob {6 invert +STARTLINE}
  addUserKnob {26 ""}
  addUserKnob {26 chromaticity_coordinates_label l " " T "Chromaticity Coordinates"}
  addUserKnob {20 chromaticities_grp l "" +STARTLINE n 1}
  addUserKnob {41 rxy T ColorMatrix.rxy}
  addUserKnob {41 gxy T ColorMatrix.gxy}
  addUserKnob {41 bxy T ColorMatrix.bxy}
  addUserKnob {41 wxy T ColorMatrix.wxy}
  addUserKnob {41 matrix T ColorMatrix.matrix}
  addUserKnob {20 endGroup n -1}
 }
  Input {
   inputs 0
   name Input
   xpos -40
   ypos -10
  }
  ColorMatrix {
   matrix {
       {{curve(which) 1 0.9525524378 0.6624541879 0.7053968906 0.4123907983 0.6369580626 0.5049495697 0.4865709841 0.4451698363 0.6380076408 0.5070186853 0.4462202489 0.4300414324 0.4581649601 0.4878340662 0.4517004192 0.7352752686 0.5022571683 0.7160496712 0.7064827085 0.5990839601 0.6796444654 0.6481720209 0.6369580626 0.6390493512 0.6141571999 0.3724023998 0.60689044 0.4017650783 0.6065810919 0.5766690373 0.7165006995 0.797760427 0.797760427 0.797760427 0.7976718545 0.7015837431 0.8156226277 0.4496616423 0.6318944097} {curve(which) 0 0 0.1340042055 0.1640413404 0.3575843275 0.1446169019 0.2646814585 0.2656676769 0.2771343887 0.2147038579 0.3587769568 0.3157556653 0.3700728714 0.3832037449 0.3432727158 0.3178463876 0.06860940903 0.2929667532 0.1296834797 0.1288010478 0.2489254922 0.1522114277 0.1940581352 0.1446169019 0.1578372866 0.2825684249 0.4324877858 0.2193847299 0.4560420811 0.2203479856 0.1855582297 0.1010205746 0.1351858526 0.1351858526 0.1351858526 0.1351878047 0.1554162204 0.04716260359 0.3162561059 0.2053879201} {curve(which) 0 9.367863095e-05 0.1561876982 0.08101774752 0.180480808 0.1688809693 0.1830150485 0.1982172877 0.1722826511 0.09774444997 0.0868505761 0.190669477 0.152531758 0.1112773567 0.1215386018 0.1830992699 0.1465712637 0.1552320272 0.1047228053 0.1151721701 0.1024464965 0.1186000481 0.108225815 0.1688809693 0.1516760886 0.05183707923 0.1436725408 0.124180764 0.09264881909 0.123526901 0.1882286519 0.1467743814 0.03134934977 0.03134934977 0.03134934977 0.03133957833 0.09979832917 0.1372147948 0.1845382005 0.1270133406}}
       {{curve(which) 0 0.3439664543 0.2722287476 0.2801307142 0.2126390189 0.2627002299 0.237623319 0.2289745659 0.209491685 0.2919537723 0.2207257152 0.1942579001 0.2022213936 0.1694435924 0.2289056629 0.2119505703 0.2866941094 0.1387997568 0.2612613738 0.2709796727 0.2150758505 0.2606855333 0.2830046713 0.2627002299 0.1743051857 0.2365771234 0.1383759677 0.1973138005 0.1721783578 0.2680045366 0.2973450124 0.258728236 0.2880711257 0.2880711257 0.2880711257 0.2880405784 0.3152042925 0.3790788651 0.2446159422 0.2276017666} {curve(which) 1 0.7281661034 0.6740817428 0.8202066422 0.7151686549 0.6779980659 0.6891706586 0.6917385459 0.7215952873 0.8238410354 0.839184761 0.7385566831 0.7585275769 0.8648257852 0.7808576822 0.7230190039 0.8429791331 0.910841465 0.8696421385 0.786606431 0.8850684762 0.7748944759 0.8131960034 0.6779980659 0.951146543 0.8896810412 0.911518693 0.943950057 0.8553914428 0.8326833844 0.6273635626 0.7246823311 0.7118432522 0.7118432522 0.7118432522 0.7118694782 0.6648360491 0.5769088268 0.6720442176 0.7383946776} {curve(which) 0 -0.07213255018 0.05368951708 -0.1003373638 0.07219231874 0.05930171534 0.07320601493 0.07928691059 0.06891305745 -0.1157948226 -0.05991046131 0.06718540192 0.03925102949 -0.03426937759 -0.009763340466 0.06503042579 -0.1296732277 -0.04964122549 -0.1309035122 -0.05758608505 -0.1001443192 -0.03558001295 -0.09620071948 0.05930171534 -0.1254517138 -0.1262581497 -0.04989464581 -0.1412638426 -0.02756982669 -0.1006879359 0.07529145479 0.01658944227 8.565396274e-05 8.565396274e-05 8.565396274e-05 8.991353388e-05 0.01995966583 0.04401229322 0.08333983272 0.0340035744}}
       {{curve(which) 0 -3.863927134e-08 -0.005574660841 -0.1037815213 0.01933082007 0 0 0 0 0.0027982709 -0.0544523783 -0.04792318866 -0.0176958181 -0.1061859056 -0.02100777067 -0.01945115253 -0.07968087494 0.07801423222 -0.009676366113 -0.009677864611 -0.03206583485 -0.009310216643 -0.01825834997 0 -0.11669112 -0.02325225808 -0.1602820009 -0.1427432895 -0.10720893 -0.02941203304 0.02703136392 -2.906408625e-08 -3.236030111e-08 -3.236030111e-08 -3.236030111e-08 0 0 -0.01229703799 0.02518104948 0} {curve(which) 0 0 0.004060741514 -0.07290724665 0.1191947311 0.0280726999 0.0449459292 0.04511339962 0.04706057906 -0.06703422964 -0.0003228379355 -0.0002844714036 0.08768811822 0.02554347552 0.01782695204 0.01650637016 -0.3473432064 -0.3148325086 -0.2364816219 0.004600019194 -0.02765839547 -0.004612449091 -0.08316776901 0.0280726999 -0.5518454909 -0.4897170365 -0.171635136 -0.4278847873 0.07809129357 -0.08659287542 0.07068887353 0.05121183768 1.2621717e-08 1.2621717e-08 1.2621717e-08 -1.262213711e-08 0.04317118227 0.01672476344 0.1411857158 0.01001892332} {curve(which) 1 1.008825183 1.010339141 1.265746474 0.950532198 1.060985088 0.9638792276 1.043944359 0.9073553085 1.153293729 1.063571215 1.057001948 0.9388025999 1.089437366 1.01197505 1.011739731 1.51608181 1.325875998 1.335215807 1.094135642 1.148782015 1.102980375 1.190483928 1.060985088 1.745692492 1.590125084 1.409072995 1.65968585 1.118175387 1.205062628 0.9913375378 0.7738927603 0.8251045942 0.8251045942 0.8251045942 0.8248898983 0.8782252669 0.9955722094 0.9226909876 0.8150856495}}
     }
   invert {{parent.invert}}
   name ColorMatrix
   label "RGB to XYZ"
   xpos -40
   ypos 32
   addUserKnob {20 Gamut}
   addUserKnob {3 which}
   which {{parent.gamut}}
   addUserKnob {12 rxy}
   rxy {{curve(which) 1 0.7347 0.713 0.8 0.8 0.64 0.708 0.68 0.68 0.68 0.684 0.7530442228 0.7530444911 0.6997470013 0.8786825105 0.7011810359 0.7011805919 0.780308 0.69848046 0.74 0.73 0.766 0.73 0.71 0.708 0.9173 0.7422 1.0625 0.9175 0.8608 0.7177 0.64 0.7347 0.7347 0.7347 0.7347 0.734699 0.69 0.6898 0.625 0.7351916376} {curve(which) 0 0.2653 0.293 0.3177 0.313 0.33 0.292 0.32 0.32 0.32 0.313 0.3278305767 0.3278310295 0.3290469303 0.3249640074 0.3290141556 0.3290136991 0.304253 0.19302645 0.27 0.28 0.275 0.28 0.31 0.292 0.2502 0.2859 0.3948 0.2983 0.3689 0.3171 0.33 0.2653 0.2653 0.2653 0.2653 0.265301 0.31 0.3206 0.34 0.2648083624}}
   addUserKnob {12 gxy}
   gxy {{curve(which) 0 0 0.165 0.18 0.1682 0.3 0.17 0.265 0.265 0.265 0.221 0.2995702285 0.2995704905 0.304264039 0.3008887144 0.3006003047 0.3006003955 0.121595 0.32955538 0.17 0.14 0.225 0.165 0.21 0.17 0.2833 0.414 0.3689 0.2983 0.3282 0.228 0.21 0.1152 0.1596 0.1596 0.1596 0.159597 0.18 0.0736 0.28 0.2153361345} {curve(which) 1 1 0.83 0.9 0.9877 0.6 0.797 0.69 0.69 0.69 0.848 0.700699322 0.7006994156 0.6236411451 0.6790547558 0.6837888343 0.6837888243 1.493994 1.02459662 1.14 0.855 0.8 0.84 0.88 0.797 1.7072 1.3035 0.7775 1.2835 0.6156 0.8616 0.71 0.8264 0.8404 0.8404 0.8404 0.840403 0.77 0.9003 0.595 0.7741596639}}
   addUserKnob {12 bxy}
   bxy {{curve(which) 0 0.0001 0.128 0.065 0.079 0.15 0.131 0.15 0.15 0.15 0.0861 0.07964206674 0.1450115843 0.1349139613 0.09539869461 0.1081544556 0.1453319462 0.095612 0.10844263 0.08 0.1 0.089 0.1 0.09 0.131 0.0856 0.0342 0.0956 0.0756 0.0783 0.1006 0.15 0.1566 0.0366 0.0366 0.0366 0.036598 0.1 0.1166 0.155 0.1301229508} {curve(which) 0 -0.077 0.044 -0.0805 -0.1155 0.06 0.046 0.06 0.06 0.06 -0.102 -0.05493795109 0.05109712509 0.03471744128 -0.02937932683 -0.008688175787 0.05161680362 -0.084589 -0.03467857 -0.1 -0.05 -0.087 -0.03 -0.08 0.046 -0.0708 -0.0833 -0.0332 -0.086 -0.0233 -0.082 0.06 0.0177 0.0001 0.0001 0.0001 0.000105 0.02 0.0374 0.07 0.03483606557}}
   addUserKnob {12 wxy}
   wxy {{curve(which) 0.33333333 0.32168 0.32168 0.3127 0.3127 0.3127 0.3127 0.32168 0.3127 0.314 0.3127 0.3216831877 0.3216832104 0.3216832894 0.3216832894 0.3216832104 0.3216832894 0.3127 0.3127 0.3127 0.3127 0.3127 0.3127 0.3127 0.3127 0.3135 0.3135 0.3135 0.3127 0.3127 0.3127 0.3127 0.3457 0.3457 0.3457 0.3457 0.345704 0.33243 0.33333333 0.3127 0.3457} {curve(which) 0.33333333 0.33767 0.33767 0.329 0.329 0.329 0.329 0.33767 0.329 0.351 0.329 0.337673316 0.3376736101 0.3376734472 0.3376734472 0.3376736101 0.3376734472 0.329 0.329 0.329 0.329 0.329 0.329 0.329 0.329 0.3305 0.3305 0.3305 0.329 0.329 0.329 0.329 0.3585 0.3585 0.3585 0.3585 0.35854 0.34744 0.33333333 0.329 0.3585}}
  }
  Output {
   name Output
   xpos -40
   ypos 86
  }
 end_group
 ColorMatrix {
  matrix {
      {1.049811006 0 -9.748453158e-05}
      {-0.4959030151 1.373313069 0.09824004024}
      {4.020908051e-08 0 0.9912520051}
    }
  name ColorMatrix4
  label "XYZ to ACES"
  note_font Helvetica
  xpos -1250
  ypos -1338
 }
 Dot {
  name Dot7
  label " ACES 2065-1 IN"
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1216
  ypos -1268
 }
 Group {
  name glow_module1
  note_font Helvetica
  xpos -1250
  ypos -1089
  addUserKnob {20 Params_tab l Params}
  addUserKnob {7 RRT_GLOW_GAIN}
  RRT_GLOW_GAIN 0.05
  addUserKnob {7 RRT_GLOW_MID}
  RRT_GLOW_MID 0.08
  addUserKnob {6 invert +STARTLINE}
 }
  Input {
   inputs 0
   name Input
   xpos -40
   ypos -562
  }
  Dot {
   name Dot2
   xpos -6
   ypos -510
  }
set Ne3ae0100 [stack 0]
  Dot {
   name Dot4
   xpos -116
   ypos -510
  }
set Ne3ab7900 [stack 0]
  Expression {
   temp_name0 chroma
   temp_expr0 sqrt(b*(b-g)+g*(g-r)+r*(r-b))
   temp_name1 ycRadiusWeight
   temp_expr1 1.75
   channel0 {-rgba.red rgba.green -rgba.blue none}
   expr0 "( b + g + r + ycRadiusWeight * chroma) / 3.0"
   channel1 {rgba.red -rgba.green -rgba.blue none}
   expr1 0
   expr2 0
   name rgb_2_yc1
   xpos -150
   ypos -466
  }
push 0
push $Ne3ab7900
  Dot {
   name Dot3
   xpos -226
   ypos -510
  }
  Expression {
   temp_name0 TINY
   temp_expr0 1e-10
   temp_name1 min_f3
   temp_expr1 min(r,min(g,b))
   temp_name2 max_f3
   temp_expr2 max(r,max(g,b))
   expr0 "(max( max_f3, TINY) - max( min_f3, TINY)) / max( max_f3, 1e-2)"
   expr1 0
   expr2 0
   name rgb_2_saturation1
   xpos -260
   ypos -466
  }
set Ne3ab6400 [stack 0]
  Expression {
   channel0 {rgba.red rgba.green rgba.blue none}
   expr0 "(r - 0.4) / 0.2"
   name Expression1
   xpos -370
   ypos -466
  }
  Expression {
   temp_name0 t
   temp_expr0 "max( 1.0 - fabs( r / 2.0), 0.0)"
   temp_name1 sign
   temp_expr1 r>0?1:r<0?-1:0
   temp_name2 valy
   temp_expr2 "1.0 + sign * (1.0 - t * t)"
   channel0 {-rgba.red -rgba.green rgba.blue none}
   expr0 "valy / 2"
   channel1 {rgba.red rgba.green -rgba.blue none}
   expr1 0
   channel2 {-rgba.red rgba.green rgba.blue none}
   expr2 0
   name sigmoid_shaper1
   xpos -370
   ypos -442
  }
push $Ne3ab6400
  Merge2 {
   inputs 3+1
   operation plus
   bbox B
   output rgb
   name Merge2
   note_font Helvetica
   xpos -260
   ypos -393
  }
set Ne3ab4f00 [stack 0]
  Expression {
   temp_name0 ycOut
   temp_expr0 g
   temp_name1 glowGainIn
   temp_expr1 "RRT_GLOW_GAIN * b"
   temp_name2 glowMid
   temp_expr2 RRT_GLOW_MID
   channel0 rgb
   expr0 "1 + ((ycOut <= ((1 + glowGainIn) * 2./3. * glowMid)) ? -glowGainIn / (1 + glowGainIn) : ( ycOut >= (2. * glowMid)) ? 0 : glowGainIn * (glowMid / ycOut - 1./2.) / (glowGainIn / 2. - 1.))"
   channel1 none
   channel2 none
   name glow_inv
   xpos -150
   ypos -346
  }
push $Ne3ab4f00
  Expression {
   temp_name0 ycIn
   temp_expr0 g
   temp_name1 glowGainIn
   temp_expr1 "RRT_GLOW_GAIN * b"
   temp_name2 glowMid
   temp_expr2 RRT_GLOW_MID
   channel0 rgb
   expr0 "1 + ( ycIn <= 2./3. * glowMid ? glowGainIn : ycIn >= 2. * glowMid ? 0 : glowGainIn * (glowMid / ycIn - 1./2.) )"
   channel1 none
   channel2 none
   name glow_fwd
   xpos -370
   ypos -346
  }
  Switch {
   inputs 2
   which {{parent.invert}}
   name Switch_direction
   note_font Helvetica
   xpos -260
   ypos -297
  }
  Dot {
   name Dot5
   xpos -226
   ypos -246
  }
push $Ne3ae0100
  Merge2 {
   inputs 2
   operation multiply
   bbox B
   output rgb
   name Merge3
   note_font Helvetica
   xpos -40
   ypos -249
  }
  Output {
   name Output
   xpos -40
   ypos -178
  }
 end_group
 Group {
  name red_modifier1
  note_font Helvetica
  xpos -1250
  ypos -1041
  addUserKnob {20 Params_tab l Params}
  addUserKnob {7 RRT_RED_SCALE}
  RRT_RED_SCALE 0.82
  addUserKnob {7 RRT_RED_PIVOT}
  RRT_RED_PIVOT 0.03
  addUserKnob {7 RRT_RED_HUE}
  addUserKnob {7 RRT_RED_WIDTH R 0 360}
  RRT_RED_WIDTH 135
  addUserKnob {6 invert +STARTLINE}
 }
  Input {
   inputs 0
   name Input
   xpos -40
   ypos -10
  }
  Dot {
   name Dot1
   xpos -6
   ypos 42
  }
set Ne3a80f00 [stack 0]
  Dot {
   name Dot2
   xpos -226
   ypos 42
  }
set Ne3a80800 [stack 0]
  Expression {
   temp_name0 TINY
   temp_expr0 1e-10
   temp_name1 min_f3
   temp_expr1 min(r,min(g,b))
   temp_name2 max_f3
   temp_expr2 max(r,max(g,b))
   channel0 rgb
   expr0 "(max( max_f3, TINY) - max( min_f3, TINY)) / max( max_f3, 1e-2)"
   channel1 none
   expr1 0
   channel2 none
   expr2 0
   name rgb_2_saturation
   xpos -260
   ypos 86
  }
push $Ne3a80800
  Dot {
   name Dot3
   xpos -336
   ypos 42
  }
  Expression {
   temp_name0 hue
   temp_expr0 "(r==g&&g==b)?0:(180/pi) * atan2( sqrt(3)*(g-b), 2*r-g-b)"
   channel0 {rgba.red -rgba.green -rgba.blue -rgba.alpha}
   expr0 "hue < 0 ? hue + 360 : hue"
   channel1 {-rgba.red rgba.green -rgba.blue none}
   expr1 0
   expr2 0
   name rgb_2_hue
   xpos -370
   ypos 86
  }
  Expression {
   temp_name0 hue
   temp_expr0 r
   temp_name1 centerH
   temp_expr1 RRT_RED_HUE
   temp_name2 hueCentered
   temp_expr2 hue-centerH
   channel0 {-rgba.red rgba.green -rgba.blue -rgba.alpha}
   expr0 "hueCentered < -180.0 ? hueCentered + 360.0 : (hueCentered > 180.0) ? hueCentered - 360.0 : hueCentered"
   name center_hue
   xpos -370
   ypos 134
  }
  Expression {
   temp_name0 centeredHue
   temp_expr0 g
   temp_name1 knot_coord
   temp_expr1 "(centeredHue - knots.0) * 4.0/w"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   channel0 {rgba.red -rgba.green -rgba.blue -rgba.alpha}
   expr0 "(min((centeredHue > knots.0?1:0) , (centeredHue < knots.4?1:0)) ? j == 3 ? t*t*t * -1./6 + t*t * 3./6 +  t * -3./6 + 1 * 1./6 : j == 2 ? t*t*t * 3./6 + t*t * -6./6 + t * 0./6 + 1. *4./6 : j == 1 ? t*t*t * -3./6 + t*t * 3./6 + t * 3./6 + 1. * 1./6 : j == 0 ? t*t*t * 1./6 + t*t * 0./6 + t * 0./6 + 1. * 0./6 : 0 : 0) * 3/2"
   channel1 none
   channel2 none
   name cubic_basis_shaper
   xpos -370
   ypos 182
   addUserKnob {20 param}
   addUserKnob {7 w R 0 360}
   w {{parent.RRT_RED_WIDTH}}
   addUserKnob {78 knots n 5}
   knots {{-w/2} {-w/4} 0 {w/4} {w/2}}
  }
  Dot {
   name Dot4
   xpos -336
   ypos 234
  }
  Copy {
   inputs 2
   from0 rgba.blue
   to0 rgba.blue
   name Copy4
   note_font Helvetica
   xpos -260
   ypos 226
  }
  Dot {
   name Dot6
   label " r : hueWeight\n g : centeredHue\n b : saturation"
   note_font "Helvetica \[pyrs]"
   note_font_size 12
   note_font_color 0xff
   xpos -226
   ypos 282
  }
  Dot {
   name Dot7
   xpos -226
   ypos 330
  }
set Ne3a58800 [stack 0]
push $Ne3a80f00
  Dot {
   name Dot8
   xpos -6
   ypos 258
  }
set Ne3a58100 [stack 0]
  MergeExpression {
   inputs 2
   temp_name0 minChan
   temp_expr0 "Ag < 0 ? Bg : Bb"
   temp_name1 a_
   temp_expr1 "Ar * (1. - RRT_RED_SCALE) - 1."
   temp_name2 b
   temp_expr2 "Br - Ar* (RRT_RED_PIVOT + minChan) * (1. - RRT_RED_SCALE)"
   temp_name3 c
   temp_expr3 "Ar * RRT_RED_PIVOT * minChan * (1. - RRT_RED_SCALE)"
   expr0 "( -b - sqrt( b * b - 4. * a_ * c)) / ( 2. * a_)"
   name red_modifier_rev
   note_font Helvetica
   xpos -150
   ypos 351
  }
push $Ne3a58800
push $Ne3a58100
  MergeExpression {
   inputs 2
   expr0 "r + Ar * Ab * (RRT_RED_PIVOT - r) * (1. - RRT_RED_SCALE)"
   name red_modifier_fwd
   note_font Helvetica
   xpos -40
   ypos 327
  }
  Switch {
   inputs 2
   which {{parent.invert}}
   name Switch_direction
   note_font Helvetica
   xpos -40
   ypos 423
  }
  Output {
   name Output
   xpos -40
   ypos 494
  }
 end_group
 Clamp {
  channels rgb
  maximum_enable false
  name clamp_f3_min
  label "Clamp Negative Values"
  xpos -1250
  ypos -976
 }
 ColorMatrix {
  matrix {
      {1.451439381 -0.2365107685 -0.2149285674}
      {-0.07655383646 1.176229835 -0.09967593104}
      {0.008316127583 -0.0060324613 0.997716248}
    }
  name ColorMatrix15
  label "ACES to ACEScg"
  xpos -1250
  ypos -928
 }
 Clamp {
  channels rgb
  maximum 65535
  name clamp_f3_
  label "clamp to HALF_MAX"
  xpos -1250
  ypos -880
 }
 ColorMatrix {
  matrix {
      {{"(1.0 - sat) * rgb2Y.x + sat"} {"(1.0 - sat) * rgb2Y.y"} {"(1.0 - sat) * rgb2Y.z"}}
      {{"(1.0 - sat) * rgb2Y.x"} {"(1.0 - sat) * rgb2Y.y + sat"} {"(1.0 - sat) * rgb2Y.z"}}
      {{"(1.0 - sat) * rgb2Y.x"} {"(1.0 - sat) * rgb2Y.y"} {"(1.0 - sat) * rgb2Y.z + sat"}}
    }
  name ColorMatrix
  label "// --- Global desaturation --- //\nrgbPre = mult_f3_f33( rgbPre, RRT_SAT_MAT);"
  xpos -1250
  ypos -790
  addUserKnob {20 params}
  addUserKnob {13 rgb2Y}
  rgb2Y {0.27222875 0.67408174 0.05368952}
  addUserKnob {7 sat}
  sat 0.96
 }
 Dot {
  name Dot29
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xff
  xpos -1216
  ypos -558
 }
set Ne3a08800 [stack 0]
 Group {
  name ssts
  xpos -1250
  ypos -514
  addUserKnob {20 ssts_tab l ssts}
  addUserKnob {26 display_label l " " T "Display Settings"}
  addUserKnob {78 lum l luminance t "SSTS Display Luminance: \ny_min y_mid y_max\n\nAccording to Zach Lewis's ACES_OT\nhttps://gist.github.com/zachlewis/786c0be941868644c993fde1c3515c2c\n\nStandard Cinema: \n0.02 4.8 48\nDolby Cinema: \n0.0001 7.2 108\nDolby Pulsar: \n0.005 15 4000\nDolby PRR-4220: \n0.005 10 600\nSony BVM-X300: \n0.0001 10 1000\nACES OCES: \n0.0001 4.8 10000\n\n" n 3}
  lum {{"use_c9 ? 0.0001 : parent.lum"} {parent.lum} {"use_c9 ? 10000 : parent.lum"}}
  addUserKnob {6 override_ssts_params l "override ssts params" t "Enable overrides of SSTS params.\n\nOtherwise the values will be calculated automatically by the algorithm." +STARTLINE}
  override_ssts_params {{parent.override_ssts_params}}
  addUserKnob {7 exposure R -5 5}
  exposure {{parent.exposure}}
  addUserKnob {7 knee}
  knee {{parent.pctLow}}
  addUserKnob {7 shoulder}
  shoulder {{parent.pctHigh}}
  addUserKnob {78 slope n 3}
  slope {{parent.slope} {parent.slope} {parent.slope}}
  addUserKnob {20 TsParams_tab l TsParams}
  addUserKnob {7 mid_lum l "mid lum" R 0 20}
  mid_lum {{parent.lum.1}}
  addUserKnob {7 expShift R -4 4}
  expShift {{"(parent.override_ssts_params ? exposure : 0) + (mid_lum<= 4.8 ? 0 : \[sample parent.expShift r 0 0] )"}}
  addUserKnob {13 minPoint t "x;        // ACES\ny;        // luminance\nz;        // slope"}
  minPoint {{"pow(2, log(0.18*pow(2, MIN_STOP_RRT+((MIN_STOP_SDR-MIN_STOP_RRT)/(log10(MIN_LUM_SDR)-log10(MIN_LUM_RRT)))*(log10(minPoint.y)-log10(MIN_LUM_RRT))))/log(2)-expShift)"} {lum.0} {override_ssts_params?slope.0:0}}
  addUserKnob {13 midPoint t "x;        // ACES\ny;        // luminance\nz;        // slope"}
  midPoint {{"pow(2, ((log(0.18)/log(2)-expShift)))"} 4.8 {override_ssts_params?slope.1:1.55}}
  addUserKnob {13 maxPoint t "x;        // ACES\ny;        // luminance\nz;        // slope"}
  maxPoint {{"pow(2, log(0.18*pow(2, (MAX_STOP_SDR + (MAX_STOP_RRT-MAX_STOP_SDR) / (log10(MAX_LUM_RRT)-log10(MAX_LUM_SDR)) * (log10(maxPoint.y)-log10(MAX_LUM_SDR)))))/log(2)-expShift)"} {lum.2} {override_ssts_params?slope.2:0}}
  addUserKnob {7 knotIncLow}
  knotIncLow {{"(log10(midPoint.x) - log10(minPoint.x)) / 3.0"}}
  addUserKnob {7 knotIncHigh}
  knotIncHigh {{"(log10(maxPoint.x) - log10(midPoint.x)) / 3.0"}}
  addUserKnob {7 pctLow}
  pctLow {{0.18+(0.35-0.18)/(MIN_STOP_SDR-MIN_STOP_RRT)*(log(minPoint.x/0.18)/log(2)-MIN_STOP_RRT)}}
  addUserKnob {7 pctHigh}
  pctHigh {{0.89+(0.90-0.89)/(MAX_STOP_SDR-MAX_STOP_RRT)*(log(maxPoint.x/0.89)/log(2)-MAX_STOP_RRT)}}
  addUserKnob {78 coefsLow n 5}
  coefsLow {{"(minPoint.z * (log10(minPoint.x)-0.5*knotIncLow)) + ( log10(minPoint.y) - minPoint.z * log10(minPoint.x))"} {"(minPoint.z * (log10(minPoint.x)+0.5*knotIncLow)) + ( log10(minPoint.y) - minPoint.z * log10(minPoint.x))"} {log10(minPoint.y)+pctLow*(log10(midPoint.y)-log10(minPoint.y))} {"(midPoint.z * (log10(midPoint.x)-0.5*knotIncLow)) + ( log10(midPoint.y) - midPoint.z * log10(midPoint.x))"} {"(midPoint.z * (log10(midPoint.x)+0.5*knotIncLow)) + ( log10(midPoint.y) - midPoint.z * log10(midPoint.x))"}}
  addUserKnob {78 coefsHigh n 5}
  coefsHigh {{"(midPoint.z * (log10(midPoint.x)-0.5*knotIncHigh)) + ( log10(midPoint.y) - midPoint.z * log10(midPoint.x))"} {"(midPoint.z * (log10(midPoint.x)+0.5*knotIncHigh)) + ( log10(midPoint.y) - midPoint.z * log10(midPoint.x))"} {log10(midPoint.y)+pctHigh*(log10(maxPoint.y)-log10(midPoint.y))} {"(maxPoint.z * (log10(maxPoint.x)-0.5*knotIncHigh)) + ( log10(maxPoint.y) - maxPoint.z * log10(maxPoint.x))"} {"(maxPoint.z * (log10(maxPoint.x)+0.5*knotIncHigh)) + ( log10(maxPoint.y) - maxPoint.z * log10(maxPoint.x))"}}
  addUserKnob {20 Constants_tab l const}
  addUserKnob {3 N_KNOTS_LOW}
  N_KNOTS_LOW 4
  addUserKnob {3 N_KNOTS_HIGH}
  N_KNOTS_HIGH 4
  addUserKnob {7 MIN_STOP_SDR R -20 20}
  MIN_STOP_SDR -6.5
  addUserKnob {7 MAX_STOP_SDR R -20 20}
  MAX_STOP_SDR 6.5
  addUserKnob {7 MIN_STOP_RRT R -20 20}
  MIN_STOP_RRT -15
  addUserKnob {7 MAX_STOP_RRT R -20 20}
  MAX_STOP_RRT 18
  addUserKnob {7 MIN_LUM_SDR R 0 0.1}
  MIN_LUM_SDR 0.02
  addUserKnob {7 MAX_LUM_SDR R 0 100}
  MAX_LUM_SDR 48
  addUserKnob {7 MIN_LUM_RRT R 0 0.1}
  MIN_LUM_RRT 0.0001
  addUserKnob {7 MAX_LUM_RRT R 0 10000}
  MAX_LUM_RRT 10000
 }
  Input {
   inputs 0
   name Input
   xpos -1030
   ypos -634
  }
  Dot {
   name Dot25
   label " "
   xpos -996
   ypos -318
  }
set Ne3bd7200 [stack 0]
  Dot {
   name Dot26
   label " "
   xpos -996
   ypos 1506
  }
push $Ne3bd7200
  Dot {
   name Dot4
   label " "
   xpos -886
   ypos -318
  }
set Ne3bd6400 [stack 0]
  Dot {
   name Dot5
   label " "
   xpos -776
   ypos -318
  }
set Ne3bd5d00 [stack 0]
  Dot {
   name Dot2
   label " "
   xpos -666
   ypos -318
  }
set Ne3bd5600 [stack 0]
  Dot {
   name Dot3
   label " "
   xpos -556
   ypos -318
  }
set Ne3bd4f00 [stack 0]
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   expr0 "logr <= log10(minPoint.x)"
   expr1 "logg <= log10(minPoint.x)"
   expr2 "logb <= log10(minPoint.x)"
   name segment_bottom
   xpos -590
   ypos -178
  }
  Dot {
   name Dot1
   label " "
   xpos -556
   ypos 162
  }
push $Ne3bd4f00
  Dot {
   name Dot7
   label " "
   xpos -336
   ypos -318
  }
set Ne3bb7900 [stack 0]
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 "logr * minPoint.z + ( log10(minPoint.y) - minPoint.z * log10(minPoint.x) )"
   expr1 "logg * minPoint.z + ( log10(minPoint.y) - minPoint.z * log10(minPoint.x) )"
   expr2 "logb* minPoint.z + ( log10(minPoint.y) - minPoint.z * log10(minPoint.x) )"
   expr3 1
   name Expression
   xpos -370
   ypos -178
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply3
   xpos -370
   ypos 158
  }
  Dot {
   name Dot27
   label " "
   xpos -336
   ypos 786
  }
push $Ne3bd5600
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   expr0 "( logr > log10(minPoint.x) ) * ( logr < log10(midPoint.x) )"
   expr1 "( logg > log10(minPoint.x) ) * ( logg < log10(midPoint.x) )"
   expr2 "( logb > log10(minPoint.x) ) * ( logb < log10(midPoint.x) )"
   name segment_low
   xpos -700
   ypos -178
  }
  Dot {
   name Dot22
   label " "
   xpos -666
   ypos 354
  }
push $Ne3bb7900
  Dot {
   name Dot9
   label " "
   xpos -6
   ypos -318
  }
set Ne3bb4f00 [stack 0]
  Dot {
   name Dot6
   label " "
   xpos -6
   ypos -198
  }
set Ne3bb4800 [stack 0]
  Dot {
   name Dot8
   label " "
   xpos 214
   ypos -198
  }
set Ne3bb4100 [stack 0]
  Dot {
   name Dot13
   label " "
   xpos 434
   ypos -198
  }
  Dot {
   name Dot12
   label " "
   xpos 434
   ypos -78
  }
set Ne3b93200 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(b, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsLow.0 : j == 1 ? coefsLow.1 : j == 2 ? coefsLow.2 :j == 3 ? coefsLow.3 : j == 4 ? coefsLow.4 : 0"
   expr1 "j == 0 ? coefsLow.1 : j == 1 ? coefsLow.2 : j == 2 ? coefsLow.3 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.4 : 0"
   expr2 "j == 0 ? coefsLow.2 : j == 1 ? coefsLow.3 : j == 2 ? coefsLow.4 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.4 : 0"
   name Expression5
   xpos 290
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix3
   label "mult_f3_f33( cf, M)"
   xpos 290
   ypos 8
  }
push $Ne3b93200
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(b, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression6
   xpos 400
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 0
   expr1 0
   expr2 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   name dot_f3_f2
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 400
   ypos 8
  }
push 0
push $Ne3bb4100
  Dot {
   name Dot11
   label " "
   xpos 214
   ypos -78
  }
set Ne3b90f00 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(g, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsLow.0 : j == 1 ? coefsLow.1 : j == 2 ? coefsLow.2 :j == 3 ? coefsLow.3 : j == 4 ? coefsLow.4 : 0"
   expr1 "j == 0 ? coefsLow.1 : j == 1 ? coefsLow.2 : j == 2 ? coefsLow.3 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.4 : 0"
   expr2 "j == 0 ? coefsLow.2 : j == 1 ? coefsLow.3 : j == 2 ? coefsLow.4 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.4 : 0"
   name Expression3
   xpos 70
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix1
   label "mult_f3_f33( cf, M)"
   xpos 70
   ypos 8
  }
push $Ne3b90f00
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(g, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression4
   xpos 180
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 0
   expr1 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   expr2 0
   name dot_f3_f7
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 180
   ypos 8
  }
push $Ne3bb4800
  Dot {
   name Dot10
   label " "
   xpos -6
   ypos -78
  }
set Ne3b56b00 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(r, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsLow.0 : j == 1 ? coefsLow.1 : j == 2 ? coefsLow.2 :j == 3 ? coefsLow.3 : j == 4 ? coefsLow.4 : 0"
   expr1 "j == 0 ? coefsLow.1 : j == 1 ? coefsLow.2 : j == 2 ? coefsLow.3 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.4 : 0"
   expr2 "j == 0 ? coefsLow.2 : j == 1 ? coefsLow.3 : j == 2 ? coefsLow.4 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.4 : 0"
   name Expression1
   xpos -150
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix2
   label "mult_f3_f33( cf, M)"
   xpos -150
   ypos 8
  }
push $Ne3b56b00
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(r, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression2
   xpos -40
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   expr1 0
   expr2 0
   name dot_f3_f1
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos -40
   ypos 8
  }
  Merge2 {
   inputs 3+1
   operation plus
   bbox B
   output rgb
   name Merge1
   xpos 180
   ypos 158
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply1
   xpos 180
   ypos 350
  }
  Dot {
   name Dot28
   label " "
   xpos 214
   ypos 786
  }
push 0
push $Ne3bd5d00
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   expr0 "( logr >= log10(midPoint.x) ) * ( logr < log10(maxPoint.x) )"
   expr1 "( logg >= log10(midPoint.x) ) * ( logg < log10(maxPoint.x) )"
   expr2 "( logb >= log10(midPoint.x) ) * ( logb < log10(maxPoint.x) )"
   name segment_high
   xpos -810
   ypos -178
  }
  Dot {
   name Dot23
   label " "
   xpos -776
   ypos 474
  }
push $Ne3bb4f00
  Dot {
   name Dot14
   label " "
   xpos 764
   ypos -318
  }
set Ne3b1a400 [stack 0]
  Dot {
   name Dot15
   label " "
   xpos 764
   ypos -198
  }
set Ne3b19d00 [stack 0]
  Dot {
   name Dot17
   label " "
   xpos 984
   ypos -198
  }
set Ne3b19600 [stack 0]
  Dot {
   name Dot20
   label " "
   xpos 1204
   ypos -198
  }
  Dot {
   name Dot19
   label " "
   xpos 1204
   ypos -78
  }
set Ne3b18800 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(b, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsHigh.0 : j == 1 ? coefsHigh.1 : j == 2 ? coefsHigh.2 :j == 3 ? coefsHigh.3 : j == 4 ? coefsHigh.4 : 0"
   expr1 "j == 0 ? coefsHigh.1 : j == 1 ? coefsHigh.2 : j == 2 ? coefsHigh.3 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.4 : 0"
   expr2 "j == 0 ? coefsHigh.2 : j == 1 ? coefsHigh.3 : j == 2 ? coefsHigh.4 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.4 : 0"
   expr3 j
   name Expression11
   xpos 1060
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix6
   label "mult_f3_f33( cf, M)"
   xpos 1060
   ypos 8
  }
push $Ne3b18800
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(b, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression12
   xpos 1170
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 0
   expr1 0
   expr2 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   name dot_f3_f6
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 1170
   ypos 8
  }
push 0
push $Ne3b19600
  Dot {
   name Dot18
   label " "
   xpos 984
   ypos -78
  }
set Ne8e1a400 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(g, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsHigh.0 : j == 1 ? coefsHigh.1 : j == 2 ? coefsHigh.2 :j == 3 ? coefsHigh.3 : j == 4 ? coefsHigh.4 : 0"
   expr1 "j == 0 ? coefsHigh.1 : j == 1 ? coefsHigh.2 : j == 2 ? coefsHigh.3 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.4 : 0"
   expr2 "j == 0 ? coefsHigh.2 : j == 1 ? coefsHigh.3 : j == 2 ? coefsHigh.4 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.4 : 0"
   expr3 j
   name Expression9
   xpos 840
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix5
   label "mult_f3_f33( cf, M)"
   xpos 840
   ypos 8
  }
push $Ne8e1a400
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(g, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression10
   xpos 950
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 0
   expr1 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   expr2 0
   name dot_f3_f5
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 950
   ypos 8
  }
push $Ne3b19d00
  Dot {
   name Dot16
   label " "
   xpos 764
   ypos -78
  }
set Ne8e18100 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(r, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsHigh.0 : j == 1 ? coefsHigh.1 : j == 2 ? coefsHigh.2 :j == 3 ? coefsHigh.3 : j == 4 ? coefsHigh.4 : 0"
   expr1 "j == 0 ? coefsHigh.1 : j == 1 ? coefsHigh.2 : j == 2 ? coefsHigh.3 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.4 : 0"
   expr2 "j == 0 ? coefsHigh.2 : j == 1 ? coefsHigh.3 : j == 2 ? coefsHigh.4 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.4 : 0"
   expr3 j
   name Expression7
   xpos 620
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix4
   label "mult_f3_f33( cf, M)"
   xpos 620
   ypos 8
  }
push $Ne8e18100
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(r, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression8
   xpos 730
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   expr1 0
   expr2 0
   name dot_f3_f4
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 730
   ypos 8
  }
  Merge2 {
   inputs 3+1
   operation plus
   bbox B
   output rgb
   name Merge2
   xpos 950
   ypos 158
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply2
   xpos 950
   ypos 470
  }
  Dot {
   name Dot29
   label " "
   xpos 984
   ypos 786
  }
push $Ne3bd6400
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   expr0 "logr >= log10(maxPoint.x) ? 1 : 0"
   expr1 "logg >= log10(maxPoint.x) ? 1 : 0"
   expr2 "logb >= log10(maxPoint.x) ? 1 : 0"
   name segment_peak
   xpos -920
   ypos -178
  }
  Dot {
   name Dot24
   label " "
   xpos -886
   ypos 618
  }
push $Ne3b1a400
  Dot {
   name Dot21
   label " "
   xpos 1534
   ypos -318
  }
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 "logr * maxPoint.z + ( log10(maxPoint.y) - maxPoint.z * log10(maxPoint.x) )"
   expr1 "logg * maxPoint.z + ( log10(maxPoint.y) - maxPoint.z * log10(maxPoint.x) )"
   expr2 "logb* maxPoint.z + ( log10(maxPoint.y) - maxPoint.z * log10(maxPoint.x) )"
   expr3 1
   name proc_low1
   label Expression
   xpos 1500
   ypos -160
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply4
   xpos 1500
   ypos 614
  }
  Dot {
   name Dot30
   xpos 1534
   ypos 810
  }
  Merge2 {
   inputs 4+1
   operation plus
   bbox B
   output rgb
   name Merge3
   xpos 510
   ypos 1118
  }
  Expression {
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 pow(10,r)
   expr1 pow(10,g)
   expr2 pow(10,b)
   name Expression13
   xpos 510
   ypos 1238
  }
  Copy {
   inputs 2
   from0 rgba.alpha
   to0 rgba.alpha
   name Copy1
   xpos 510
   ypos 1496
  }
  Output {
   name Output1
   xpos 510
   ypos 1814
  }
 end_group
 Dot {
  name Dot23
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1216
  ypos -462
 }
set Ne8da0100 [stack 0]
 Dot {
  name Dot22
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1656
  ypos -462
 }
 ColorMatrix {
  matrix {
      {0.6954522133 0.1406786889 0.163869068}
      {0.04479461163 0.8596711159 0.09553432465}
      {-0.005525866989 0.004025223665 1.001500726}
    }
  name ColorMatrix7
  label "ACEScg to ACES"
  note_font Helvetica
  xpos -1690
  ypos -398
 }
 Dot {
  name Dot21
  label " OCES"
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1656
  ypos 2658
 }
push $Ne8da0100
 Dot {
  name Dot28
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1216
  ypos -342
 }
set Ne8d7a400 [stack 0]
 Group {
  name segmented_spline_c9_fwd
  xpos -1140
  ypos -346
  addUserKnob {20 SegmentedSplineParams_c9_tab l SegmentedSplineParams_c9}
  addUserKnob {78 coefsLow n 10}
  coefsLow {-1.698970004 -1.698970004 -1.4779 -1.2291 -0.8648 -0.448 0.00518 0.4511080334 0.9113744414 0.9113744414}
  addUserKnob {78 coefsHigh n 10}
  coefsHigh {0.5154386965 0.8470437783 1.1358 1.3802 1.5197 1.5985 1.6467 1.674609136 1.687873339 1.687873339}
  addUserKnob {12 minPoint}
  minPoint {0.0028799 0.02}
  addUserKnob {12 midPoint}
  midPoint {4.79999924 4.8}
  addUserKnob {12 maxPoint}
  maxPoint {1005.719116 48}
  addUserKnob {7 slopeLow}
  addUserKnob {7 slopeHigh}
  slopeHigh 0.04
  addUserKnob {3 N_KNOTS_LOW}
  N_KNOTS_LOW 8
  addUserKnob {3 N_KNOTS_HIGH}
  N_KNOTS_HIGH 8
 }
  Input {
   inputs 0
   name Input
   xpos -1030
   ypos -634
  }
  Dot {
   name Dot25
   label " "
   xpos -996
   ypos -318
  }
set Ne8d78f00 [stack 0]
  Dot {
   name Dot26
   label " "
   xpos -996
   ypos 1506
  }
push $Ne8d78f00
  Dot {
   name Dot4
   label " "
   xpos -886
   ypos -318
  }
set Ne8d78100 [stack 0]
  Dot {
   name Dot5
   label " "
   xpos -776
   ypos -318
  }
set Ne8d5f900 [stack 0]
  Dot {
   name Dot2
   label " "
   xpos -666
   ypos -318
  }
set Ne8d5f200 [stack 0]
  Dot {
   name Dot3
   label " "
   xpos -556
   ypos -318
  }
set Ne8d5eb00 [stack 0]
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   expr0 "logr <= log10(minPoint.x)"
   expr1 "logg <= log10(minPoint.x)"
   expr2 "logb <= log10(minPoint.x)"
   name segment_bottom
   xpos -590
   ypos -178
  }
  Dot {
   name Dot1
   label " "
   xpos -556
   ypos 162
  }
push $Ne8d5eb00
  Dot {
   name Dot7
   label " "
   xpos -336
   ypos -318
  }
set Ne8d5d600 [stack 0]
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 "logr * slopeLow + ( log10(minPoint.y) - slopeLow * log10(minPoint.x) )"
   expr1 "logg * slopeLow + ( log10(minPoint.y) - slopeLow * log10(minPoint.x) )"
   expr2 "logb* slopeLow + ( log10(minPoint.y) - slopeLow * log10(minPoint.x) )"
   expr3 1
   name Expression
   xpos -370
   ypos -178
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply3
   xpos -370
   ypos 158
  }
  Dot {
   name Dot27
   label " "
   xpos -336
   ypos 786
  }
push $Ne8d5f200
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   expr0 "( logr > log10(minPoint.x) ) * ( logr < log10(midPoint.x) )"
   expr1 "( logg > log10(minPoint.x) ) * ( logg < log10(midPoint.x) )"
   expr2 "( logb > log10(minPoint.x) ) * ( logb < log10(midPoint.x) )"
   name segment_low
   xpos -700
   ypos -178
  }
  Dot {
   name Dot22
   label " "
   xpos -666
   ypos 354
  }
push $Ne8d5d600
  Dot {
   name Dot9
   label " "
   xpos -6
   ypos -318
  }
set Ne8d36b00 [stack 0]
  Dot {
   name Dot6
   label " "
   xpos -6
   ypos -198
  }
set Ne8d36400 [stack 0]
  Dot {
   name Dot8
   label " "
   xpos 214
   ypos -198
  }
set Ne8d35d00 [stack 0]
  Dot {
   name Dot13
   label " "
   xpos 434
   ypos -198
  }
  Dot {
   name Dot12
   label " "
   xpos 434
   ypos -78
  }
set Ne8d34f00 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(b, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsLow.0 : j == 1 ? coefsLow.1 : j == 2 ? coefsLow.2 :j == 3 ? coefsLow.3 : j == 4 ? coefsLow.4 : j == 5 ? coefsLow.5 : j == 6 ? coefsLow.6 : j == 7 ? coefsLow.7 : j == 8 ? coefsLow.8 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr1 "j == 0 ? coefsLow.1 : j == 1 ? coefsLow.2 : j == 2 ? coefsLow.3 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.5 : j == 5 ? coefsLow.6 : j == 6 ? coefsLow.7 : j == 7 ? coefsLow.8 : j == 8 ? coefsLow.9 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr2 "j == 0 ? coefsLow.2 : j == 1 ? coefsLow.3 : j == 2 ? coefsLow.4 :j == 3 ? coefsLow.5 : j == 4 ? coefsLow.6 : j == 5 ? coefsLow.7 : j == 6 ? coefsLow.8 : j == 7 ? coefsLow.9 : j == 8 ? coefsLow.9 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr3 j
   name Expression15
   xpos 290
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix3
   label "mult_f3_f33( cf, M)"
   xpos 290
   ypos 8
  }
push $Ne8d34f00
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(b, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression6
   xpos 400
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 0
   expr1 0
   expr2 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   name dot_f3_f2
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 400
   ypos 8
  }
push 0
push $Ne8d35d00
  Dot {
   name Dot11
   label " "
   xpos 214
   ypos -78
  }
set Ne8cf2b00 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(g, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsLow.0 : j == 1 ? coefsLow.1 : j == 2 ? coefsLow.2 :j == 3 ? coefsLow.3 : j == 4 ? coefsLow.4 : j == 5 ? coefsLow.5 : j == 6 ? coefsLow.6 : j == 7 ? coefsLow.7 : j == 8 ? coefsLow.8 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr1 "j == 0 ? coefsLow.1 : j == 1 ? coefsLow.2 : j == 2 ? coefsLow.3 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.5 : j == 5 ? coefsLow.6 : j == 6 ? coefsLow.7 : j == 7 ? coefsLow.8 : j == 8 ? coefsLow.9 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr2 "j == 0 ? coefsLow.2 : j == 1 ? coefsLow.3 : j == 2 ? coefsLow.4 :j == 3 ? coefsLow.5 : j == 4 ? coefsLow.6 : j == 5 ? coefsLow.7 : j == 6 ? coefsLow.8 : j == 7 ? coefsLow.9 : j == 8 ? coefsLow.9 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr3 j
   name Expression14
   xpos 70
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix1
   label "mult_f3_f33( cf, M)"
   xpos 70
   ypos 8
  }
push $Ne8cf2b00
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(g, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression4
   xpos 180
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 0
   expr1 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   expr2 0
   name dot_f3_f7
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 180
   ypos 8
  }
push $Ne8d36400
  Dot {
   name Dot10
   label " "
   xpos -6
   ypos -78
  }
set Ne8cf0800 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(r, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsLow.0 : j == 1 ? coefsLow.1 : j == 2 ? coefsLow.2 :j == 3 ? coefsLow.3 : j == 4 ? coefsLow.4 : j == 5 ? coefsLow.5 : j == 6 ? coefsLow.6 : j == 7 ? coefsLow.7 : j == 8 ? coefsLow.8 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr1 "j == 0 ? coefsLow.1 : j == 1 ? coefsLow.2 : j == 2 ? coefsLow.3 :j == 3 ? coefsLow.4 : j == 4 ? coefsLow.5 : j == 5 ? coefsLow.6 : j == 6 ? coefsLow.7 : j == 7 ? coefsLow.8 : j == 8 ? coefsLow.9 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr2 "j == 0 ? coefsLow.2 : j == 1 ? coefsLow.3 : j == 2 ? coefsLow.4 :j == 3 ? coefsLow.5 : j == 4 ? coefsLow.6 : j == 5 ? coefsLow.7 : j == 6 ? coefsLow.8 : j == 7 ? coefsLow.9 : j == 8 ? coefsLow.9 : j == 9 ? coefsLow.9 : coefsLow.9"
   expr3 j
   name Expression1
   xpos -150
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix2
   label "mult_f3_f33( cf, M)"
   xpos -150
   ypos 8
  }
push $Ne8cf0800
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(r, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_LOW-1) * (logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression2
   xpos -40
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   expr1 0
   expr2 0
   name dot_f3_f1
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos -40
   ypos 8
  }
  Merge2 {
   inputs 3+1
   operation plus
   bbox B
   output rgb
   name Merge1
   xpos 180
   ypos 158
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply1
   xpos 180
   ypos 350
  }
  Dot {
   name Dot28
   label " "
   xpos 214
   ypos 786
  }
push 0
push $Ne8d5f900
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   expr0 "( logr >= log10(midPoint.x) ) * ( logr < log10(maxPoint.x) )"
   expr1 "( logg >= log10(midPoint.x) ) * ( logg < log10(maxPoint.x) )"
   expr2 "( logb >= log10(midPoint.x) ) * ( logb < log10(maxPoint.x) )"
   name segment_high
   xpos -810
   ypos -178
  }
  Dot {
   name Dot23
   label " "
   xpos -776
   ypos 474
  }
push $Ne8d36b00
  Dot {
   name Dot14
   label " "
   xpos 764
   ypos -318
  }
set Ne8cb8100 [stack 0]
  Dot {
   name Dot15
   label " "
   xpos 764
   ypos -198
  }
set Ne8c8f900 [stack 0]
  Dot {
   name Dot17
   label " "
   xpos 984
   ypos -198
  }
set Ne8c8f200 [stack 0]
  Dot {
   name Dot20
   label " "
   xpos 1204
   ypos -198
  }
  Dot {
   name Dot19
   label " "
   xpos 1204
   ypos -78
  }
set Ne8c8e400 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(b, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsHigh.0 : j == 1 ? coefsHigh.1 : j == 2 ? coefsHigh.2 :j == 3 ? coefsHigh.3 : j == 4 ? coefsHigh.4 : j == 5 ? coefsHigh.5 : j == 6 ? coefsHigh.6 : j == 7 ? coefsHigh.7 : j == 8 ? coefsHigh.8 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr1 "j == 0 ? coefsHigh.1 : j == 1 ? coefsHigh.2 : j == 2 ? coefsHigh.3 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.5 : j == 5 ? coefsHigh.6 : j == 6 ? coefsHigh.7 : j == 7 ? coefsHigh.8 : j == 8 ? coefsHigh.9 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr2 "j == 0 ? coefsHigh.2 : j == 1 ? coefsHigh.3 : j == 2 ? coefsHigh.4 :j == 3 ? coefsHigh.5 : j == 4 ? coefsHigh.6 : j == 5 ? coefsHigh.7 : j == 6 ? coefsHigh.8 : j == 7 ? coefsHigh.9 : j == 8 ? coefsHigh.9 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr3 j
   name Expression3
   xpos 1060
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix6
   label "mult_f3_f33( cf, M)"
   xpos 1060
   ypos 8
  }
push $Ne8c8e400
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(b, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression12
   xpos 1170
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 0
   expr1 0
   expr2 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   name dot_f3_f6
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 1170
   ypos 8
  }
push 0
push $Ne8c8f200
  Dot {
   name Dot18
   label " "
   xpos 984
   ypos -78
  }
set Ne8c8c100 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(g, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsHigh.0 : j == 1 ? coefsHigh.1 : j == 2 ? coefsHigh.2 :j == 3 ? coefsHigh.3 : j == 4 ? coefsHigh.4 : j == 5 ? coefsHigh.5 : j == 6 ? coefsHigh.6 : j == 7 ? coefsHigh.7 : j == 8 ? coefsHigh.8 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr1 "j == 0 ? coefsHigh.1 : j == 1 ? coefsHigh.2 : j == 2 ? coefsHigh.3 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.5 : j == 5 ? coefsHigh.6 : j == 6 ? coefsHigh.7 : j == 7 ? coefsHigh.8 : j == 8 ? coefsHigh.9 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr2 "j == 0 ? coefsHigh.2 : j == 1 ? coefsHigh.3 : j == 2 ? coefsHigh.4 :j == 3 ? coefsHigh.5 : j == 4 ? coefsHigh.6 : j == 5 ? coefsHigh.7 : j == 6 ? coefsHigh.8 : j == 7 ? coefsHigh.9 : j == 8 ? coefsHigh.9 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr3 j
   name Expression5
   xpos 840
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix5
   label "mult_f3_f33( cf, M)"
   xpos 840
   ypos 8
  }
push $Ne8c8c100
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(g, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression10
   xpos 950
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 0
   expr1 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   expr2 0
   name dot_f3_f5
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 950
   ypos 8
  }
push $Ne8c8f900
  Dot {
   name Dot16
   label " "
   xpos 764
   ypos -78
  }
set Ne8c5dd00 [stack 0]
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(r, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 "j == 0 ? coefsHigh.0 : j == 1 ? coefsHigh.1 : j == 2 ? coefsHigh.2 :j == 3 ? coefsHigh.3 : j == 4 ? coefsHigh.4 : j == 5 ? coefsHigh.5 : j == 6 ? coefsHigh.6 : j == 7 ? coefsHigh.7 : j == 8 ? coefsHigh.8 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr1 "j == 0 ? coefsHigh.1 : j == 1 ? coefsHigh.2 : j == 2 ? coefsHigh.3 :j == 3 ? coefsHigh.4 : j == 4 ? coefsHigh.5 : j == 5 ? coefsHigh.6 : j == 6 ? coefsHigh.7 : j == 7 ? coefsHigh.8 : j == 8 ? coefsHigh.9 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr2 "j == 0 ? coefsHigh.2 : j == 1 ? coefsHigh.3 : j == 2 ? coefsHigh.4 :j == 3 ? coefsHigh.5 : j == 4 ? coefsHigh.6 : j == 5 ? coefsHigh.7 : j == 6 ? coefsHigh.8 : j == 7 ? coefsHigh.9 : j == 8 ? coefsHigh.9 : j == 9 ? coefsHigh.9 : coefsHigh.9"
   expr3 j
   name Expression16
   xpos 620
   ypos -34
  }
  ColorMatrix {
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name ColorMatrix4
   label "mult_f3_f33( cf, M)"
   xpos 620
   ypos 8
  }
push $Ne8c5dd00
  Expression {
   temp_name0 logx
   temp_expr0 "(log10( max(r, 5.96046448e-08 )))"
   temp_name1 knot_coord
   temp_expr1 "(N_KNOTS_HIGH-1) * (logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x))"
   temp_name2 j
   temp_expr2 int(knot_coord)
   temp_name3 t
   temp_expr3 "knot_coord - j"
   expr0 t*t
   expr1 t
   expr2 1
   expr3 1
   name Expression8
   xpos 730
   ypos -34
  }
  MergeExpression {
   inputs 2
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 (Ar*Br)+(Ag*Bg)+(Ab*Bb)
   expr1 0
   expr2 0
   name dot_f3_f4
   label "logy = dot_f3_f3( monomials, mult_f3_f33( cf, M))"
   xpos 730
   ypos 8
  }
  Merge2 {
   inputs 3+1
   operation plus
   bbox B
   output rgb
   name Merge2
   xpos 950
   ypos 158
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply2
   xpos 950
   ypos 470
  }
  Dot {
   name Dot29
   label " "
   xpos 984
   ypos 786
  }
push $Ne8d78100
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   expr0 "logr >= log10(maxPoint.x) ? 1 : 0"
   expr1 "logg >= log10(maxPoint.x) ? 1 : 0"
   expr2 "logb >= log10(maxPoint.x) ? 1 : 0"
   name segment_peak
   xpos -920
   ypos -178
  }
  Dot {
   name Dot24
   label " "
   xpos -886
   ypos 618
  }
push $Ne8cb8100
  Dot {
   name Dot21
   label " "
   xpos 1534
   ypos -318
  }
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 5.96046448e-08 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 5.96046448e-08 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 5.96046448e-08 ))"
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 "logr * slopeHigh + ( log10(maxPoint.y) - slopeHigh * log10(maxPoint.x) )"
   expr1 "logg * slopeHigh + ( log10(maxPoint.y) - slopeHigh * log10(maxPoint.x) )"
   expr2 "logb* slopeHigh + ( log10(maxPoint.y) - slopeHigh * log10(maxPoint.x) )"
   expr3 1
   name proc_low1
   label Expression
   xpos 1500
   ypos -202
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply4
   xpos 1500
   ypos 614
  }
  Merge2 {
   inputs 4+1
   operation plus
   bbox B
   output rgb
   name Merge3
   xpos 510
   ypos 1118
  }
  Expression {
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 pow(10,r)
   expr1 pow(10,g)
   expr2 pow(10,b)
   name Expression13
   xpos 510
   ypos 1238
  }
  Copy {
   inputs 2
   from0 rgba.alpha
   to0 rgba.alpha
   name Copy1
   xpos 510
   ypos 1496
  }
  Output {
   name Output1
   xpos 510
   ypos 1814
  }
 end_group
push $Ne8d7a400
 Switch {
  inputs 2
  which {{parent.use_c9}}
  name Switch_c9
  xpos -1250
  ypos -298
 }
 Expression {
  expr0 "(r - Ymin) / (Ymax - Ymin)"
  expr1 "(g - Ymin) / (Ymax - Ymin)"
  expr2 "(b - Ymin) / (Ymax - Ymin)"
  expr3 1
  name Y_2_linCV_f3_
  xpos -1250
  ypos 38
  addUserKnob {20 Luminance}
  addUserKnob {7 Ymin R 0.0001 0.02}
  Ymin {{parent.lum.0}}
  addUserKnob {7 Ymax R 48 10000}
  Ymax {{parent.lum.2}}
 }
 Dot {
  name Dot12
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1216
  ypos 282
 }
set Ne2d69600 [stack 0]
 Dot {
  name Dot15
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1106
  ypos 282
 }
set Ne2d68f00 [stack 0]
 Dot {
  name Dot13
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -886
  ypos 282
 }
 Dot {
  name Dot16
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -886
  ypos 354
 }
set Ne2d68100 [stack 0]
 Expression {
  temp_name0 tr
  temp_expr0 "(-r - c_x_0) / (c_x_1 - c_x_0)"
  temp_name1 tg
  temp_expr1 "(-g - c_x_0) / (c_x_1 - c_x_0)"
  temp_name2 tb
  temp_expr2 "(-b - c_x_0) / (c_x_1 - c_x_0)"
  expr0 "tr < 0.0 ? -(tr * c_b + c_c) : tr > 1.0 ? r : -(( tr * c_a + c_b) * tr + c_c)"
  expr1 "tg < 0.0 ? -(tg * c_b + c_c) : tg > 1.0 ? g : -(( tg * c_a + c_b) * tg + c_c)"
  expr2 "tb < 0.0 ? -(tb * c_b + c_c) : tb > 1.0 ? b : -(( tb * c_a + c_b) * tb + c_c)"
  name roll_white_fwd_1
  xpos -920
  ypos 398
  addUserKnob {20 Params}
  addUserKnob {7 new_wht}
  new_wht 0.918
  addUserKnob {7 c_width}
  c_width 0.5
  addUserKnob {7 c_x_0 +DISABLED}
  c_x_0 -1
  addUserKnob {7 c_x_1 +DISABLED}
  c_x_1 {{"c_x_0 + c_width"}}
  addUserKnob {7 c_y0 +DISABLED}
  c_y0 {{-new_wht}}
  addUserKnob {7 c_y1 +DISABLED}
  c_y1 {{c_x_1}}
  addUserKnob {7 c_m1 +DISABLED}
  c_m1 {{"(c_x_1 - c_x_0)"}}
  addUserKnob {7 c_a +DISABLED}
  c_a {{"c_y0 - c_y1 + c_m1"}}
  addUserKnob {7 c_b +DISABLED}
  c_b {{"2 * (c_y1 - c_y0) - c_m1"}}
  addUserKnob {7 c_c +DISABLED}
  c_c {{c_y0}}
 }
 Expression {
  temp_name0 SCALE
  temp_expr0 0.96
  temp_name1 NEW_WHT
  temp_expr1 0.918
  expr0 "min( r, NEW_WHT) * SCALE"
  expr1 "min( g, NEW_WHT) * SCALE"
  expr2 "min( b, NEW_WHT) * SCALE"
  name Expression2
  label "// Scale and clamp white to avoid casted highlights due to D60 simulation"
  xpos -920
  ypos 440
 }
 Dot {
  name Dot11
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -886
  ypos 498
 }
push $Ne2d68100
 Expression {
  temp_name0 SCALE
  temp_expr0 0.96362
  expr0 "r * SCALE"
  expr1 "g * SCALE"
  expr2 "b * SCALE"
  name mult_f_f3_
  label D65
  xpos -1030
  ypos 344
 }
push $Ne2d68f00
 Switch {
  inputs 2
  which {{"parent.display_pri < 3"}}
  name switch_wp_is_d65_
  xpos -1140
  ypos 350
 }
 Dot {
  name Dot14
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1106
  ypos 426
 }
push $Ne2d69600
 Switch {
  inputs 2
  which {{parent.d60_sim}}
  name d60_sim_switch1
  xpos -1250
  ypos 422
 }
 Switch {
  inputs 2
  which {{"parent.display_pri == 3"}}
  name switch_wp_is_dci_
  xpos -1250
  ypos 494
 }
 Dot {
  name Dot26
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1216
  ypos 762
 }
set Ne2d40100 [stack 0]
 ColorMatrix {
  matrix {
      {{"(1.0 - sat) * rgb2Y.x + sat"} {"(1.0 - sat) * rgb2Y.y"} {"(1.0 - sat) * rgb2Y.z"}}
      {{"(1.0 - sat) * rgb2Y.x"} {"(1.0 - sat) * rgb2Y.y + sat"} {"(1.0 - sat) * rgb2Y.z"}}
      {{"(1.0 - sat) * rgb2Y.x"} {"(1.0 - sat) * rgb2Y.y"} {"(1.0 - sat) * rgb2Y.z + sat"}}
    }
  name ColorMatrix3
  label "// Apply desaturation to compensate \nfor luminance difference"
  xpos -1140
  ypos 746
  addUserKnob {20 params}
  addUserKnob {13 rgb2Y}
  rgb2Y {0.27222875 0.67408174 0.05368952}
  addUserKnob {7 sat}
  sat 0.93
 }
push $Ne2d40100
 Switch {
  inputs 2
  which {{"parent.eotf < 5 && display_pri < 2"}}
  name Switch_eotf
  label "Use if output is SDR"
  xpos -1250
  ypos 800
 }
 ColorMatrix {
  matrix {
      {0.6624541879 0.1340042055 0.1561876982}
      {0.2722287476 0.6740817428 0.05368951708}
      {-0.005574660841 0.004060741514 1.010339141}
    }
  name ColorMatrix1
  label "ACES AP1 to XYZ"
  xpos -1250
  ypos 968
 }
 Dot {
  name Dot8
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1216
  ypos 1146
 }
set Ne2d12400 [stack 0]
 Colorspace {
  colorspace_in CIE-XYZ
  colorspace_out CIE-Yxy
  name Colorspace2
  label "\[value colorspace_in] -> \[value colorspace_out]"
  xpos -1140
  ypos 1136
 }
 Clamp {
  channels {rgba.red -rgba.green -rgba.blue none}
  maximum_enable false
  name ClampMin4
  xpos -1140
  ypos 1190
 }
 Expression {
  expr0 "pow(r, DIM_SURROUND_GAMMA)"
  expr1 g
  expr2 b
  channel3 none
  name dark_to_dim3
  xpos -1140
  ypos 1214
  addUserKnob {20 Params}
  addUserKnob {7 DIM_SURROUND_GAMMA}
  DIM_SURROUND_GAMMA 0.9811
 }
 Colorspace {
  colorspace_in CIE-Yxy
  colorspace_out CIE-XYZ
  name Colorspace4
  label "\[value colorspace_in] -> \[value colorspace_out]"
  xpos -1140
  ypos 1256
 }
push $Ne2d12400
 Switch {
  inputs 2
  which {{"(parent.eotf <= 4) ? parent.dark_to_dim : 0"}}
  name DarkToDim_Switch
  label "enable if sdr\nand dark_to_dim enabled"
  xpos -1250
  ypos 1250
 }
 Dot {
  name Dot19
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1216
  ypos 1434
 }
set Ne2cf5d00 [stack 0]
 Dot {
  name Dot9
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1106
  ypos 1434
 }
set Ne2cf5600 [stack 0]
 ColorMatrix {
  matrix {
      {0.9872254133 -0.006114810705 0.01592640579}
      {-0.007603884675 1.001874804 0.005322027951}
      {0.003066040576 -0.005084238946 1.081519246}
    }
  name ColorMatrix2
  label "CAT: Bradford\n D60 to D65"
  xpos -1140
  ypos 1466
 }
set Ne2cf4f00 [stack 0]
push $Ne2cf5600
 Dot {
  name Dot10
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -996
  ypos 1434
 }
push $Ne2cf4f00
 Switch {
  inputs 2
  which {{parent.d60_sim}}
  name d60_sim_switch
  xpos -1140
  ypos 1550
 }
push $Ne2cf5d00
 Switch {
  inputs 2
  which {{"parent.display_pri < 3"}}
  name switch_wp_is_d65_1
  xpos -1250
  ypos 1550
 }
 Switch {
  inputs 2
  which {{parent.force_d65_cat}}
  name switch_force_d65_cat
  xpos -1250
  ypos 1598
 }
 Group {
  name limit_to_primaries
  label "Only enabled when display_pri != limiting_pri"
  xpos -1250
  ypos 1760
  disable {{"!(parent.display_pri != parent.limiting_pri)"}}
  addUserKnob {20 limit_to_primaries}
  addUserKnob {4 limiting_pri l "limiting pri" M {Rec709 Rec2020 P3D65 P3DCI P3D60 ACEScg ACES XYZ}}
  limiting_pri {{parent.limiting_pri}}
 }
  Input {
   inputs 0
   name Input
   xpos -40
   ypos -298
  }
  Dot {
   name Dot1
   label " XYZ to limiting primaries"
   note_font "Helvetica Bold"
   note_font_size 24
   note_font_color 0xa5a5a501
   xpos -6
   ypos -198
  }
set Ne2ccdd00 [stack 0]
push $Ne2ccdd00
  ColorMatrix {
   matrix {
       {1.049811006 0 -9.748453158e-05}
       {-0.4959030151 1.373313069 0.09824004024}
       {4.020908051e-08 0 0.9912520051}
     }
   name ColorMatrix5
   label "XYZ to ACES"
   xpos 730
   ypos -136
  }
push $Ne2ccdd00
  ColorMatrix {
   matrix {
       {1.641023397 -0.3248033226 -0.2364246994}
       {-0.6636629701 1.615331769 0.01675636508}
       {0.01172191743 -0.008284457959 0.9883947968}
     }
   name ColorMatrix21
   label "XYZ to ACEScg"
   xpos 620
   ypos -136
  }
push $Ne2ccdd00
  ColorMatrix {
   matrix {
       {2.402741432 -0.8974840641 -0.3880533576}
       {-0.8325796723 1.769231915 0.02371272631}
       {0.03882339597 -0.08249972761 1.036368608}
     }
   name ColorMatrix15
   label "XYZ to P3D60"
   xpos 510
   ypos -136
  }
push $Ne2ccdd00
  ColorMatrix {
   matrix {
       {2.725393534 -1.018002748 -0.4401631057}
       {-0.795167923 1.689731717 0.02264718339}
       {0.04124190658 -0.0876390487 1.100929499}
     }
   name ColorMatrix19
   label "XYZ to P3DCI"
   xpos 400
   ypos -136
  }
push $Ne2ccdd00
  ColorMatrix {
   matrix {
       {2.493496418 -0.9313833117 -0.4027107358}
       {-0.8294888139 1.762663841 0.02362467349}
       {0.03584583849 -0.07617240399 0.9568845034}
     }
   name ColorMatrix17
   label "XYZ to P3D65"
   xpos 290
   ypos -136
  }
push $Ne2ccdd00
  ColorMatrix {
   matrix {
       {0.6954522133 0.1406786889 0.163869068}
       {0.04479461163 0.8596711159 0.09553432465}
       {-0.005525866989 0.004025223665 1.001500726}
     }
   name ColorMatrix12
   label "XYZ to Rec2020"
   xpos 180
   ypos -136
  }
push $Ne2ccdd00
  ColorMatrix {
   matrix {
       {3.240970135 -1.537383318 -0.4986107945}
       {-0.9692437053 1.875967622 0.04155509174}
       {0.0556300357 -0.2039768547 1.056971431}
     }
   name ColorMatrix2
   label "XYZ to Rec709"
   xpos 70
   ypos -136
  }
  Switch {
   inputs 8
   which {{parent.limiting_pri}}
   name limiting_primary_switch
   xpos -40
   ypos -34
  }
  Clamp {
   channels rgb
   name clamp_f3
   label "Clip any values outside the limiting primaries"
   xpos -40
   ypos 56
  }
  Dot {
   name Dot2
   label " Convert limited RGB to XYZ"
   note_font "Helvetica Bold"
   note_font_size 24
   note_font_color 0xa5a5a501
   xpos -6
   ypos 162
  }
set Ne2e77900 [stack 0]
push $Ne2e77900
  ColorMatrix {
   matrix {
       {0.9525524378 0 9.367863095e-05}
       {0.3439664543 0.7281661034 -0.07213255018}
       {-3.863927134e-08 0 1.008825183}
     }
   name ColorMatrix4
   label "ACES to XYZ"
   xpos 730
   ypos 224
  }
push $Ne2e77900
  ColorMatrix {
   matrix {
       {0.6624541879 0.1340042055 0.1561876982}
       {0.2722287476 0.6740817428 0.05368951708}
       {-0.005574660841 0.004060741514 1.010339141}
     }
   name ColorMatrix20
   label "ACEScg to XYZ"
   xpos 620
   ypos 224
  }
push $Ne2e77900
  ColorMatrix {
   matrix {
       {0.5049495697 0.2646814585 0.1830150485}
       {0.237623319 0.6891706586 0.07320601493}
       {0 0.0449459292 0.9638792276}
     }
   name ColorMatrix13
   label "P3D60 to XYZ"
   xpos 510
   ypos 224
  }
push $Ne2e77900
  ColorMatrix {
   matrix {
       {0.4451698363 0.2771343887 0.1722826511}
       {0.209491685 0.7215952873 0.06891305745}
       {0 0.04706057906 0.9073553085}
     }
   name ColorMatrix18
   label "P3DCI to XYZ"
   xpos 400
   ypos 224
  }
push $Ne2e77900
  ColorMatrix {
   matrix {
       {0.4865709841 0.2656676769 0.1982172877}
       {0.2289745659 0.6917385459 0.07928691059}
       {0 0.04511339962 1.043944359}
     }
   name ColorMatrix16
   label "P3D65 to XYZ"
   xpos 290
   ypos 224
  }
push $Ne2e77900
  ColorMatrix {
   matrix {
       {0.6369580626 0.1446169019 0.1688809693}
       {0.2627002299 0.6779980659 0.05930171534}
       {0 0.0280726999 1.060985088}
     }
   name ColorMatrix3
   label "Rec2020 to XYZ"
   xpos 180
   ypos 224
  }
push $Ne2e77900
  ColorMatrix {
   matrix {
       {0.4123907983 0.3575843275 0.180480808}
       {0.2126390189 0.7151686549 0.07219231874}
       {0.01933082007 0.1191947311 0.950532198}
     }
   name ColorMatrix1
   label "Rec709 to XYZ"
   xpos 70
   ypos 224
  }
  Switch {
   inputs 8
   which {{parent.limiting_pri}}
   name limiting_primary_switch1
   xpos -40
   ypos 326
  }
  Output {
   name Output
   xpos -40
   ypos 446
  }
 end_group
 Group {
  name XYZ_2_DISPLAY_PRI
  label "CIE XYZ to display encoding primaries"
  xpos -1250
  ypos 1976
  addUserKnob {20 XYZ_2_DISPLAY_PRI_tab l XYZ_2_DISPLAY_PRI}
  addUserKnob {4 display_pri l "display pri" M {Rec709 Rec2020 P3D65 P3DCI P3D60 ACEScg ACES XYZ}}
  display_pri {{parent.display_pri}}
 }
  Input {
   inputs 0
   name Input
   xpos -40
   ypos -298
  }
  Dot {
   name Dot1
   label " XYZ to display primaries"
   note_font "Helvetica Bold"
   note_font_size 24
   note_font_color 0xa5a5a501
   xpos -6
   ypos -198
  }
set Ne2e32400 [stack 0]
push $Ne2e32400
  ColorMatrix {
   matrix {
       {1.049811006 0 -9.748453158e-05}
       {-0.4959030151 1.373313069 0.09824004024}
       {4.020908051e-08 0 0.9912520051}
     }
   name ColorMatrix3
   label "XYZ to ACES"
   xpos 730
   ypos -136
  }
push $Ne2e32400
  ColorMatrix {
   matrix {
       {1.641023397 -0.3248033226 -0.2364246994}
       {-0.6636629701 1.615331769 0.01675636508}
       {0.01172191743 -0.008284457959 0.9883947968}
     }
   name ColorMatrix21
   label "XYZ to ACEScg"
   xpos 620
   ypos -136
  }
push $Ne2e32400
  ColorMatrix {
   matrix {
       {2.402741432 -0.8974840641 -0.3880533576}
       {-0.8325796723 1.769231915 0.02371272631}
       {0.03882339597 -0.08249972761 1.036368608}
     }
   name ColorMatrix15
   label "XYZ to P3D60"
   xpos 510
   ypos -136
  }
push $Ne2e32400
  ColorMatrix {
   matrix {
       {2.725393534 -1.018002748 -0.4401631057}
       {-0.795167923 1.689731717 0.02264718339}
       {0.04124190658 -0.0876390487 1.100929499}
     }
   name ColorMatrix19
   label "XYZ to P3DCI"
   xpos 400
   ypos -136
  }
push $Ne2e32400
  ColorMatrix {
   matrix {
       {2.493496418 -0.9313833117 -0.4027107358}
       {-0.8294888139 1.762663841 0.02362467349}
       {0.03584583849 -0.07617240399 0.9568845034}
     }
   name ColorMatrix17
   label "XYZ to P3D65"
   xpos 290
   ypos -136
  }
push $Ne2e32400
  ColorMatrix {
   matrix {
       {1.71665132 -0.3556708097 -0.2533662617}
       {-0.6666844487 1.616481304 0.01576855592}
       {0.01763986237 -0.04277062416 0.9421030879}
     }
   name ColorMatrix12
   label "XYZ to Rec2020"
   xpos 180
   ypos -136
  }
push $Ne2e32400
  ColorMatrix {
   matrix {
       {3.240970135 -1.537383318 -0.4986107945}
       {-0.9692437053 1.875967622 0.04155509174}
       {0.0556300357 -0.2039768547 1.056971431}
     }
   name ColorMatrix2
   label "XYZ to Rec709"
   xpos 70
   ypos -136
  }
  Switch {
   inputs 8
   which {{parent.display_pri}}
   name limiting_primary_switch
   xpos -40
   ypos -34
  }
  Output {
   name Output
   xpos -40
   ypos 86
  }
 end_group
 Clamp {
  channels rgb
  name clamp_f3_all
  xpos -1250
  ypos 2164
 }
 Dot {
  name Dot1
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -1216
  ypos 2514
 }
set Ne2def900 [stack 0]
push $Ne2def900
 Dot {
  name Dot3
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -886
  ypos 2514
 }
set Ne2def200 [stack 0]
 Dot {
  name Dot4
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -666
  ypos 2514
 }
set Ne2deeb00 [stack 0]
 Dot {
  name Dot6
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -446
  ypos 2514
 }
set Ne2dee400 [stack 0]
 Dot {
  name Dot18
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -226
  ypos 2514
 }
set Ne2dedd00 [stack 0]
 Dot {
  name Dot20
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos -6
  ypos 2514
 }
set Ne2ded600 [stack 0]
 Dot {
  name Dot25
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos 214
  ypos 2514
 }
set Ne2decf00 [stack 0]
 Dot {
  name Dot24
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos 654
  ypos 2514
 }
 Dot {
  name Dot2
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos 654
  ypos 2610
 }
set Ne2dec100 [stack 0]
 Expression {
  expr0 "r * (Ymax - Ymin) + Ymin"
  expr1 "g * (Ymax - Ymin) + Ymin"
  expr2 "b * (Ymax - Ymin) + Ymin"
  name linCV_2_Y_f3_hdr
  label "stretch_black = True"
  xpos 510
  ypos 2672
  addUserKnob {20 Luminance}
  addUserKnob {7 Ymin R 0.0001 0.02}
  addUserKnob {7 Ymax R 48 10000}
  Ymax {{parent.lum.2}}
 }
push $Ne2dec100
 Expression {
  expr0 "r * (Ymax - Ymin) + Ymin"
  expr1 "g * (Ymax - Ymin) + Ymin"
  expr2 "b * (Ymax - Ymin) + Ymin"
  name linCV_2_Y_f3_hdr2
  label "stretch_black = False"
  xpos 620
  ypos 2672
  addUserKnob {20 Luminance}
  addUserKnob {7 Ymin R 0.0001 0.02}
  Ymin {{parent.lum.0}}
  addUserKnob {7 Ymax R 48 10000}
  Ymax {{parent.lum.2}}
 }
 Switch {
  inputs 2
  which {{parent.stretch_black}}
  name StretchBlacks_Switch
  xpos 620
  ypos 2750
 }
 Clamp {
  channels rgb
  maximum 65535
  name clamp_f3__
  xpos 620
  ypos 2822
 }
 Expression {
  temp_name0 Lm_r
  temp_expr0 "pow((r / pq_C), pq_m1)"
  temp_name1 Lm_g
  temp_expr1 "pow((g / pq_C), pq_m1)"
  temp_name2 Lm_b
  temp_expr2 "pow((b / pq_C), pq_m1)"
  expr0 "pow(( pq_c1 + pq_c2 * Lm_r ) / ( 1.0 + pq_c3 * Lm_r ), pq_m2)"
  expr1 "pow(( pq_c1 + pq_c2 * Lm_g ) / ( 1.0 + pq_c3 * Lm_g ), pq_m2)"
  expr2 "pow(( pq_c1 + pq_c2 * Lm_b ) / ( 1.0 + pq_c3 * Lm_b ), pq_m2)"
  name Y_2_ST2084_
  label "ACESlib.OutputTransforms.ctl : 243 \nACESlib.Utilities_Color.ctl : 425"
  xpos 620
  ypos 2882
  addUserKnob {20 SMPTE_ST2084-2014_Constants_tab l "Constants from SMPTE ST 2084-2014"}
  addUserKnob {7 pq_m1 t " ( 2610.0 / 4096.0 ) / 4.0;" +DISABLED R 0 100}
  pq_m1 0.1593017578
  addUserKnob {7 pq_m2 t " ( 2523.0 / 4096.0 ) * 128.0;" +DISABLED R 0 100}
  pq_m2 78.84375
  addUserKnob {7 pq_c1 t " 3424.0 / 4096.0 or pq_c3 - pq_c2 + 1.0;" +DISABLED R 0 100}
  pq_c1 0.8359375
  addUserKnob {7 pq_c2 t " ( 2413.0 / 4096.0 ) * 32.0;" +DISABLED R 0 100}
  pq_c2 18.8515625
  addUserKnob {7 pq_c3 t " ( 2392.0 / 4096.0 ) * 32.0;" +DISABLED R 0 100}
  pq_c3 18.6875
  addUserKnob {7 pq_C +DISABLED R 0 100}
  pq_C 10000
 }
set Ne2dd0100 [stack 0]
 Dot {
  name Dot5
  label " "
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos 984
  ypos 2514
 }
 Expression {
  temp_name0 Np_r
  temp_expr0 "pow( r, 1.0 / pq_m2 )"
  temp_name1 Np_g
  temp_expr1 "pow( g, 1.0 / pq_m2 )"
  temp_name2 Np_b
  temp_expr2 "pow( b, 1.0 / pq_m2 )"
  expr0 "r < 0 ? 0 : pow((Np_r - pq_c1) / ( pq_c2 - pq_c3 * Np_r ), 1.0/pq_m1) * pq_C"
  expr1 "g < 0 ? 0 : pow((Np_g - pq_c1) / ( pq_c2 - pq_c3 * Np_g ), 1.0/pq_m1) * pq_C"
  expr2 "b < 0 ? 0 : pow((Np_b - pq_c1) / ( pq_c2 - pq_c3 * Np_b ), 1.0/pq_m1) * pq_C"
  name ST2084_2_Y_f3_
  label "ACESlib.Utilities_Color.ctl : 408\n// Converts from the non-linear perceptually quantized space to linear cd/m^2"
  xpos 950
  ypos 2618
  addUserKnob {20 SMPTE_ST2084-2014_Constants_tab l "Constants from SMPTE ST 2084-2014"}
  addUserKnob {7 pq_m1 t " ( 2610.0 / 4096.0 ) / 4.0;" +DISABLED R 0 100}
  pq_m1 0.1593017578
  addUserKnob {7 pq_m2 t " ( 2523.0 / 4096.0 ) * 128.0;" +DISABLED R 0 100}
  pq_m2 78.84375
  addUserKnob {7 pq_c1 t " 3424.0 / 4096.0 or pq_c3 - pq_c2 + 1.0;" +DISABLED R 0 100}
  pq_c1 0.8359375
  addUserKnob {7 pq_c2 t " ( 2413.0 / 4096.0 ) * 32.0;" +DISABLED R 0 100}
  pq_c2 18.8515625
  addUserKnob {7 pq_c3 t " ( 2392.0 / 4096.0 ) * 32.0;" +DISABLED R 0 100}
  pq_c3 18.6875
  addUserKnob {7 pq_C +DISABLED R 0 100}
  pq_C 10000
 }
 Expression {
  temp_name0 Y_d
  temp_expr0 "0.2627*r + 0.6780*g + 0.0593*b"
  expr0 "Y_d == 0 ? 0 : pow( (Y_d-c_beta)/c_alpha, (1-c_gamma)/c_gamma) * ((r-c_beta)/c_alpha)"
  expr1 "Y_d == 0 ? 0 : pow( (Y_d-c_beta)/c_alpha, (1-c_gamma)/c_gamma) * ((g-c_beta)/c_alpha)"
  expr2 "Y_d == 0 ? 0 : pow( (Y_d-c_beta)/c_alpha, (1-c_gamma)/c_gamma) * ((b-c_beta)/c_alpha)"
  name ST2084_2_HLG_1000nits_f3_3
  label "ACESlib.Utilities_Color.ctl : 469\n// HLG Inverse EOTF (i.e. HLG inverse OOTF followed by the HLG OETF)\n// HLG Inverse OOTF (display linear to scene linear)"
  xpos 950
  ypos 2732
  addUserKnob {20 Constants_tab l Constants}
  addUserKnob {7 L_w +DISABLED}
  L_w 1000
  addUserKnob {7 L_b +DISABLED}
  addUserKnob {7 c_alpha +DISABLED}
  c_alpha {{L_w-L_b}}
  addUserKnob {7 c_beta +DISABLED}
  c_beta {{L_b}}
  addUserKnob {7 c_gamma +DISABLED}
  c_gamma 1.2
 }
 Expression {
  channel0 {rgba.red -rgba.green -rgba.blue none}
  expr0 "r <= 1.0/12 ? sqrt(3.0*r) : c_a * log(12.0 * r - c_b) + c_c"
  expr1 "g <= 1.0/12 ? sqrt(3.0*g) : c_a * log(12.0 * g- c_b) + c_c"
  expr2 "b <= 1.0/12 ? sqrt(3.0*b) : c_a * log(12.0 * b - c_b) + c_c"
  name ST2084_2_HLG_1000nits_f3_
  label "ACESlib.Utilities_Color.ctl : 493\n// HLG OETF (scene linear to non-linear signal value)"
  xpos 950
  ypos 2834
  addUserKnob {20 Constants_tab l Constants}
  addUserKnob {7 c_a +DISABLED}
  c_a 0.17883277
  addUserKnob {7 c_b t 1.-4.*a +DISABLED}
  c_b 0.28466892
  addUserKnob {7 c_c t 0.5-a*log(4.*a) +DISABLED}
  c_c 0.55991073
 }
 Dot {
  name Dot17
  label " HLG"
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos 984
  ypos 2970
 }
push $Ne2dd0100
 Dot {
  name Dot27
  label " PQ"
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xa5a5a501
  xpos 654
  ypos 2970
 }
push $Ne2decf00
 Expression {
  expr0 "pow( (48./52.37) * r, 1./2.6)"
  expr1 "pow( (48./52.37) * g, 1./2.6)"
  expr2 "pow( (48./52.37) * b, 1./2.6)"
  expr3 1
  name dcdm_encode
  xpos 180
  ypos 2702
 }
push $Ne2ded600
 Expression {
  expr0 pow(r,1/gamma)
  expr1 pow(g,1/gamma)
  expr2 pow(b,1/gamma)
  name pow_f3_gamma_26_
  label "ACESlib.Utilities_Color.ctl : 260\n// Gamma 2.6"
  xpos -40
  ypos 2690
  addUserKnob {20 Gamma_tab l Gamma}
  addUserKnob {7 gamma R 0 4}
  gamma 2.6
 }
push $Ne2dedd00
 Expression {
  expr0 pow(r,1/gamma)
  expr1 pow(g,1/gamma)
  expr2 pow(b,1/gamma)
  name pow_f3_gamma_24_
  label "ACESlib.Utilities_Color.ctl : 260\n// Gamma 2.4"
  xpos -260
  ypos 2690
  addUserKnob {20 Gamma_tab l Gamma}
  addUserKnob {7 gamma R 0 4}
  gamma 2.4
 }
push $Ne2dee400
 Expression {
  expr0 pow(r,1/gamma)
  expr1 pow(g,1/gamma)
  expr2 pow(b,1/gamma)
  name pow_f3_gamma_22_
  label "ACESlib.Utilities_Color.ctl : 260\n// Gamma 2.2"
  xpos -480
  ypos 2690
  addUserKnob {20 Gamma_tab l Gamma}
  addUserKnob {7 gamma R 0 4}
  gamma 2.2
 }
push $Ne2deeb00
 Expression {
  temp_name0 c_a
  temp_expr0 "pow( pow( Lw, 1./gamma) - pow( Lb, 1./gamma), gamma)"
  temp_name1 c_b
  temp_expr1 "pow( Lb, 1./gamma) / ( pow( Lw, 1./gamma) - pow( Lb, 1./gamma))"
  expr0 "pow( max( r / c_a, 0.), 1.0/gamma) - c_b"
  expr1 "pow( max( g / c_a, 0.), 1.0/gamma) - c_b"
  expr2 "pow( max( b / c_a, 0.), 1.0/gamma) - c_b"
  name bt1886_r_f3
  label "ACESlib.Utilities_Color.ctl : 301\n// The reference EOTF specified in Rec. ITU-R BT.1886\n// L = a(max\[(V+b),0])^g"
  xpos -700
  ypos 2684
  addUserKnob {20 Luminance}
  addUserKnob {7 Lw R 48 10000}
  Lw 1
  addUserKnob {7 Lb R 0.0001 0.02}
  addUserKnob {7 gamma R 1 4}
  gamma 2.4
 }
push $Ne2def200
 Expression {
  temp_name0 yb
  temp_expr0 "pow( offs * gamma / ( ( gamma - 1.0) * ( 1.0 + offs)), gamma)"
  temp_name1 rs
  temp_expr1 "pow( ( gamma - 1.0) / offs, gamma - 1.0) * pow( ( 1.0 + offs) / gamma, gamma)"
  expr0 "r >= yb ? ( 1.0 + offs) * pow( r, 1.0 / gamma) - offs : r * rs"
  expr1 "g >= yb ? ( 1.0 + offs) * pow( g, 1.0 / gamma) - offs : g * rs"
  expr2 "b >= yb ? ( 1.0 + offs) * pow( b, 1.0 / gamma) - offs : b * rs"
  name moncurve_r_f3_
  label "ACESlib.Utilities_Color.ctl : 260\nmoncurve_r with gamma of 2.4 and offset of 0.055 matches the EOTF found in IEC 61966-2-1:1999 (sRGB)"
  xpos -920
  ypos 2690
  addUserKnob {20 Luminance}
  addUserKnob {7 gamma R 0 4}
  gamma 2.4
  addUserKnob {7 offs}
  offs 0.055
 }
 Switch {
  inputs 10
  which {{parent.eotf}}
  name EOTF_Switch
  xpos -1250
  ypos 2966
 }
 Expression {
  temp_name0 REFBLACK
  temp_expr0 "64 / 1023"
  temp_name1 REFWHITE
  temp_expr1 "940 / 1023"
  expr0 "r * ( REFWHITE - REFBLACK) + REFBLACK"
  expr1 "g * ( REFWHITE - REFBLACK) + REFBLACK"
  expr2 "b * ( REFWHITE - REFBLACK) + REFBLACK"
  name fullRange_to_smpteRange_f3_
  label "ACESlib.OutputTransforms.ctl : 216"
  xpos -1250
  ypos 3224
  disable {{!parent.legal_range}}
 }
 Output {
  name Output
  xpos -1250
  ypos 3446
 }
 StickyNote {
  inputs 0
  name StickyNote1
  tile_color 0x535a61ff
  label "\nACESlib.RRT_Common.ctl : 135\n
\nfloat\[3] rrt_sweeteners( float in\[3])\n\{\n    float aces\[3] = in;\n    \n    // --- Glow module --- //\n    float saturation = rgb_2_saturation( aces);\n    float ycIn = rgb_2_yc( aces);\n    float s = sigmoid_shaper( (saturation - 0.4) / 0.2);\n    float addedGlow = 1. + glow_fwd( ycIn, RRT_GLOW_GAIN * s, RRT_GLOW_MID);\n\n    aces = mult_f_f3( addedGlow, aces);\n\n    // --- Red modifier --- //\n    float hue = rgb_2_hue( aces);\n    float centeredHue = center_hue( hue, RRT_RED_HUE);\n    float hueWeight = cubic_basis_shaper( centeredHue, RRT_RED_WIDTH);\n\n    aces\[0] = aces\[0] + hueWeight * saturation * (RRT_RED_PIVOT - aces\[0]) * (1. - RRT_RED_SCALE);\n\n    // --- ACES to RGB rendering space --- //\n    aces = clamp_f3( aces, 0., HALF_POS_INF);\n    float rgbPre\[3] = mult_f3_f44( aces, AP0_2_AP1_MAT);\n    rgbPre = clamp_f3( rgbPre, 0., HALF_MAX);\n    \n    // --- Global desaturation --- //\n    rgbPre = mult_f3_f33( rgbPre, RRT_SAT_MAT);\n    return rgbPre;\n\}\n\n\n\n"
  note_font_size 10
  xpos -825
  ypos -1204
 }
 StickyNote {
  inputs 0
  name StickyNote2
  tile_color 0x535a61ff
  label "\n\nACESlib.SSTS.ctl : 163
float ssts\n( \n    varying float x,\n    varying TsParams C\n)\n\{\n    const int N_KNOTS_LOW = 4;\n    const int N_KNOTS_HIGH = 4;\n\n    // Check for negatives or zero before taking the log. If negative or zero,\n    // set to HALF_MIN.\n    float logx = log10( max(x, HALF_MIN )); \n\n    float logy;\n\n    if ( logx <= log10(C.Min.x) ) \{ \n\n        logy = logx * C.Min.slope + ( log10(C.Min.y) - C.Min.slope * log10(C.Min.x) );\n\n    \} else if (( logx > log10(C.Min.x) ) && ( logx < log10(C.Mid.x) )) \{\n\n        float knot_coord = (N_KNOTS_LOW-1) * (logx-log10(C.Min.x))/(log10(C.Mid.x)-log10(C.Min.x));\n        int j = knot_coord;\n        float t = knot_coord - j;\n\n        float cf\[ 3] = \{ C.coefsLow\[ j], C.coefsLow\[ j + 1], C.coefsLow\[ j + 2]\};\n\n        float monomials\[ 3] = \{ t * t, t, 1. \};\n        logy = dot_f3_f3( monomials, mult_f3_f33( cf, M1));\n\n    \} else if (( logx >= log10(C.Mid.x) ) && ( logx < log10(C.Max.x) )) \{\n\n        float knot_coord = (N_KNOTS_HIGH-1) * (logx-log10(C.Mid.x))/(log10(C.Max.x)-log10(C.Mid.x));\n        int j = knot_coord;\n        float t = knot_coord - j;\n\n        float cf\[ 3] = \{ C.coefsHigh\[ j], C.coefsHigh\[ j + 1], C.coefsHigh\[ j + 2]\}; \n\n        float monomials\[ 3] = \{ t * t, t, 1. \};\n        logy = dot_f3_f3( monomials, mult_f3_f33( cf, M1));\n\n    \} else \{ //if ( logIn >= log10(C.Max.x) ) \{ \n\n        logy = logx * C.Max.slope + ( log10(C.Max.y) - C.Max.slope * log10(C.Max.x) );\n\n    \}\n\n    return pow10(logy);\n\n\}"
  note_font_size 10
  xpos -830
  ypos -664
 }
 StickyNote {
  inputs 0
  name StickyNote3
  tile_color 0x535a61ff
  label "\n\nACESlib.Tonescales.ctl : 271
float segmented_spline_c9_fwd\n  ( \n    varying float x,\n    varying SegmentedSplineParams_c9 C = ODT_48nits\n  )\n\{    \n  const int N_KNOTS_LOW = 8;\n  const int N_KNOTS_HIGH = 8;\n\n  // Check for negatives or zero before taking the log. If negative or zero,\n  // set to HALF_MIN.\n  float logx = log10( max(x, HALF_MIN )); \n\n  float logy;\n\n  if ( logx <= log10(C.minPoint.x) ) \{ \n\n    logy = logx * C.slopeLow + ( log10(C.minPoint.y) - C.slopeLow * log10(C.minPoint.x) );\n\n  \} else if (( logx > log10(C.minPoint.x) ) && ( logx < log10(C.midPoint.x) )) \{\n\n    float knot_coord = (N_KNOTS_LOW-1) * (logx-log10(C.minPoint.x))/(log10(C.midPoint.x)-log10(C.minPoint.x));\n    int j = knot_coord;\n    float t = knot_coord - j;\n\n    float cf\[ 3] = \{ C.coefsLow\[ j], C.coefsLow\[ j + 1], C.coefsLow\[ j + 2]\};\n    \n    float monomials\[ 3] = \{ t * t, t, 1. \};\n    logy = dot_f3_f3( monomials, mult_f3_f33( cf, M));\n\n  \} else if (( logx >= log10(C.midPoint.x) ) && ( logx < log10(C.maxPoint.x) )) \{\n\n    float knot_coord = (N_KNOTS_HIGH-1) * (logx-log10(C.midPoint.x))/(log10(C.maxPoint.x)-log10(C.midPoint.x));\n    int j = knot_coord;\n    float t = knot_coord - j;\n\n    float cf\[ 3] = \{ C.coefsHigh\[ j], C.coefsHigh\[ j + 1], C.coefsHigh\[ j + 2]\}; \n\n    float monomials\[ 3] = \{ t * t, t, 1. \};\n    logy = dot_f3_f3( monomials, mult_f3_f33( cf, M));\n\n  \} else \{ //if ( logIn >= log10(C.maxPoint.x) ) \{ \n\n    logy = logx * C.slopeHigh + ( log10(C.maxPoint.y) - C.slopeHigh * log10(C.maxPoint.x) );\n\n  \}\n\n  return pow10(logy);\n  \n\}"
  note_font_size 10
  xpos -200
  ypos -660
 }
push $Ne3a08800
 Reformat {
  type "to box"
  box_width 4
  box_height 4
  box_fixed true
  name Reformat1
  note_font Helvetica
  xpos -1140
  ypos -561
 }
 Fill {
  output rgb
  color {{parent.ssts.mid_lum}}
  name Fill1
  note_font Helvetica
  xpos -1140
  ypos -537
 }
 Group {
  name inv_ssts
  xpos -1140
  ypos -514
  addUserKnob {20 ssts_tab l ssts}
  addUserKnob {78 lum l luminance t "SSTS Display Luminance: \ny_min y_mid y_max\n\nAccording to Zach Lewis's ACES_OT\nhttps://gist.github.com/zachlewis/786c0be941868644c993fde1c3515c2c\n\nStandard Cinema: \n0.02 4.8 48\nDolby Cinema: \n0.0001 7.2 108\nDolby Pulsar: \n0.005 15 4000\nDolby PRR-4220: \n0.005 10 600\nSony BVM-X300: \n0.0001 10 1000\nACES OCES: \n0.0001 4.8 10000\n\n" n 3}
  lum {{"use_c9 ? 0.0001 : parent.lum"} 4.8 {"use_c9 ? 10000 : parent.lum"}}
  addUserKnob {6 override_ssts_params l "override ssts params" t "Enable overrides of SSTS params.\n\nOtherwise the values will be calculated automatically by the algorithm." +STARTLINE}
  override_ssts_params {{parent.ACES_SSTS.AcesSSTSKernel_override_curve_params}}
  addUserKnob {7 exposure R -5 5}
  exposure {{parent.exposure}}
  addUserKnob {7 knee}
  knee {{parent.pctLow}}
  addUserKnob {7 shoulder}
  shoulder {{parent.pctHigh}}
  addUserKnob {78 slope n 3}
  slope {{parent.slope} {parent.slope} {parent.slope}}
  addUserKnob {20 TsParams_tab l TsParams}
  addUserKnob {7 expShift R -4 4}
  expShift {{"override_ssts_params ? exposure : 0"}}
  addUserKnob {13 minPoint t "x;        // ACES\ny;        // luminance\nz;        // slope"}
  minPoint {{"pow(2, log(0.18*pow(2, MIN_STOP_RRT+((MIN_STOP_SDR-MIN_STOP_RRT)/(log10(MIN_LUM_SDR)-log10(MIN_LUM_RRT)))*(log10(minPoint.y)-log10(MIN_LUM_RRT))))/log(2)-expShift)"} {lum.0} {override_ssts_params?slope.0:0}}
  addUserKnob {13 midPoint t "x;        // ACES\ny;        // luminance\nz;        // slope"}
  midPoint {{"pow(2, ((log(0.18)/log(2)-expShift)))"} {lum.1} {override_ssts_params?slope.1:1.55}}
  addUserKnob {13 maxPoint t "x;        // ACES\ny;        // luminance\nz;        // slope"}
  maxPoint {{"pow(2, log(0.18*pow(2, (MAX_STOP_SDR+(MAX_STOP_RRT-MAX_STOP_SDR)/(log10(MAX_LUM_RRT)-log10(MAX_LUM_SDR))*(log10(maxPoint.y)-log10(MAX_LUM_SDR)))))/log(2)-expShift)"} {lum.2} {override_ssts_params?slope.2:0}}
  addUserKnob {7 knotIncLow}
  knotIncLow {{"(log10(midPoint.x) - log10(minPoint.x)) / 3.0"}}
  addUserKnob {7 knotIncHigh}
  knotIncHigh {{"(log10(maxPoint.x) - log10(midPoint.x)) / 3.0"}}
  addUserKnob {7 pctLow}
  pctLow {{0.18+(0.35-0.18)/(MIN_STOP_SDR-MIN_STOP_RRT)*(log(minPoint.x/0.18)/log(2)-MIN_STOP_RRT)}}
  addUserKnob {7 pctHigh}
  pctHigh {{0.89+(0.90-0.89)/(MAX_STOP_SDR-MAX_STOP_RRT)*(log(maxPoint.x/0.89)/log(2)-MAX_STOP_RRT)}}
  addUserKnob {78 coefsLow n 5}
  coefsLow {{"(minPoint.z * (log10(minPoint.x)-0.5*knotIncLow)) + ( log10(minPoint.y) - minPoint.z * log10(minPoint.x))"} {"(minPoint.z * (log10(minPoint.x)+0.5*knotIncLow)) + ( log10(minPoint.y) - minPoint.z * log10(minPoint.x))"} {log10(minPoint.y)+pctLow*(log10(midPoint.y)-log10(minPoint.y))} {"(midPoint.z * (log10(midPoint.x)-0.5*knotIncLow)) + ( log10(midPoint.y) - midPoint.z * log10(midPoint.x))"} {"(midPoint.z * (log10(midPoint.x)+0.5*knotIncLow)) + ( log10(midPoint.y) - midPoint.z * log10(midPoint.x))"}}
  addUserKnob {78 coefsHigh n 5}
  coefsHigh {{"(midPoint.z * (log10(midPoint.x)-0.5*knotIncHigh)) + ( log10(midPoint.y) - midPoint.z * log10(midPoint.x))"} {"(midPoint.z * (log10(midPoint.x)+0.5*knotIncHigh)) + ( log10(midPoint.y) - midPoint.z * log10(midPoint.x))"} {log10(midPoint.y)+pctHigh*(log10(maxPoint.y)-log10(midPoint.y))} {"(maxPoint.z * (log10(maxPoint.x)-0.5*knotIncHigh)) + ( log10(maxPoint.y) - maxPoint.z * log10(maxPoint.x))"} {"(maxPoint.z * (log10(maxPoint.x)+0.5*knotIncHigh)) + ( log10(maxPoint.y) - maxPoint.z * log10(maxPoint.x))"}}
  addUserKnob {7 KNOT_INC_LOW}
  KNOT_INC_LOW {{"(log10(midPoint.x) - log10(minPoint.x)) / (N_KNOTS_LOW - 1)"}}
  addUserKnob {7 KNOT_INC_HIGH}
  KNOT_INC_HIGH {{"(log10(maxPoint.x) - log10(midPoint.x)) / (N_KNOTS_HIGH - 1)"}}
  addUserKnob {78 KNOT_Y_LOW n 4}
  KNOT_Y_LOW {{"(coefsLow.0 + coefsLow.1) / 2"} {"(coefsLow.1 + coefsLow.2) / 2"} {"(coefsLow.2 + coefsLow.3) / 2"} {"(coefsLow.3 + coefsLow.4) / 2"}}
  addUserKnob {78 KNOT_Y_HIGH n 4}
  KNOT_Y_HIGH {{"(coefsHigh.0 + coefsHigh.1) / 2"} {"(coefsHigh.1 + coefsHigh.2) / 2"} {"(coefsHigh.2 + coefsHigh.3) / 2"} {"(coefsHigh.3 + coefsHigh.4) / 2"}}
  addUserKnob {20 Constants_tab l const}
  addUserKnob {3 N_KNOTS_LOW}
  N_KNOTS_LOW 4
  addUserKnob {3 N_KNOTS_HIGH}
  N_KNOTS_HIGH 4
  addUserKnob {7 MIN_STOP_SDR R -20 20}
  MIN_STOP_SDR -6.5
  addUserKnob {7 MAX_STOP_SDR R -20 20}
  MAX_STOP_SDR 6.5
  addUserKnob {7 MIN_STOP_RRT R -20 20}
  MIN_STOP_RRT -15
  addUserKnob {7 MAX_STOP_RRT R -20 20}
  MAX_STOP_RRT 18
  addUserKnob {7 MIN_LUM_SDR R 0 0.1}
  MIN_LUM_SDR 0.02
  addUserKnob {7 MAX_LUM_SDR R 0 100}
  MAX_LUM_SDR 48
  addUserKnob {7 MIN_LUM_RRT R 0 0.1}
  MIN_LUM_RRT 0.0001
  addUserKnob {7 MAX_LUM_RRT R 0 10000}
  MAX_LUM_RRT 10000
 }
  Input {
   inputs 0
   name Input
   xpos -1030
   ypos -634
  }
  Dot {
   name Dot25
   label " "
   xpos -996
   ypos -318
  }
set Ne2a21600 [stack 0]
  Dot {
   name Dot26
   label " "
   xpos -996
   ypos 1506
  }
push $Ne2a21600
  Dot {
   name Dot4
   label " "
   xpos -886
   ypos -318
  }
set Ne2a20800 [stack 0]
  Dot {
   name Dot5
   label " "
   xpos -776
   ypos -318
  }
set Ne2a20100 [stack 0]
  Dot {
   name Dot2
   label " "
   xpos -666
   ypos -318
  }
set Ne29fb900 [stack 0]
  Dot {
   name Dot3
   label " "
   xpos -556
   ypos -318
  }
set Ne29fb200 [stack 0]
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 1e-10 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 1e-10 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 1e-10 ))"
   expr0 "logr <= log10(minPoint.y)"
   expr1 "logg <= log10(minPoint.y)"
   expr2 "logb <= log10(minPoint.y)"
   name segment_bottom
   xpos -590
   ypos -202
  }
  Dot {
   name Dot1
   label " "
   xpos -556
   ypos 162
  }
push $Ne29fb200
  Dot {
   name Dot7
   label " "
   xpos -336
   ypos -318
  }
set Ne29f9d00 [stack 0]
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 1e-10 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 1e-10 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 1e-10 ))"
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 log10(minPoint.x)
   expr1 log10(minPoint.x)
   expr2 log10(minPoint.x)
   expr3 1
   name Expression
   xpos -370
   ypos -202
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply3
   xpos -370
   ypos 158
  }
  Dot {
   name Dot27
   label " "
   xpos -336
   ypos 786
  }
push $Ne29fb900
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 1e-10 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 1e-10 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 1e-10 ))"
   expr0 "( logr > log10(minPoint.y) ) && ( logr <= log10(midPoint.y) )"
   expr1 "( logg > log10(minPoint.y) ) && ( logg <= log10(midPoint.y) )"
   expr2 "( logb > log10(minPoint.y) ) && ( logb <= log10(midPoint.y) )"
   name segment_low
   xpos -700
   ypos -202
  }
  Dot {
   name Dot22
   label " "
   xpos -666
   ypos 354
  }
push $Ne29f9d00
  Dot {
   name Dot9
   label " "
   xpos -6
   ypos -318
  }
set Ne29c7200 [stack 0]
  Dot {
   name Dot6
   label " "
   xpos -6
   ypos -174
  }
set Ne29c6b00 [stack 0]
  Dot {
   name Dot8
   label " "
   xpos 214
   ypos -174
  }
set Ne29c6400 [stack 0]
  Dot {
   name Dot13
   label " "
   xpos 434
   ypos -174
  }
  Dot {
   name Dot19
   xpos 434
   ypos -78
  }
set Ne29c5600 [stack 0]
  Expression {
   temp_name0 logy
   temp_expr0 "log10( max(b, 1e-10 ))"
   temp_name1 low
   temp_expr1 "(logy > KNOT_Y_LOW.0) && (logy <= KNOT_Y_LOW.1)"
   temp_name2 mid
   temp_expr2 "(logy > KNOT_Y_LOW.1) && (logy <= KNOT_Y_LOW.2)"
   temp_name3 high
   temp_expr3 "(logy > KNOT_Y_LOW.2) && (logy <= KNOT_Y_LOW.3)"
   expr0 "low ? coefsLow.0 : mid ? coefsLow.1 : coefsLow.2"
   expr1 "low ? coefsLow.1 : mid ? coefsLow.2 : coefsLow.3"
   expr2 "low ? coefsLow.2 : mid ? coefsLow.3 : coefsLow.4"
   expr3 "low ? 0 : mid ? 1 : high ? 2 : 0"
   name inv_cfLow5
   xpos 290
   ypos -82
  }
  ColorMatrix {
   channels {rgba.red rgba.green rgba.blue -rgba.alpha}
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name inv_basis_low5
   xpos 290
   ypos -34
  }
push $Ne29c5600
  MergeExpression {
   inputs 2
   temp_name0 logy
   temp_expr0 "log10(max(Bb, 1e-10))"
   expr0 Ar
   expr1 Ag
   expr2 Ab-logy
   expr3 Aa
   name c_minus_logy5
   xpos 400
   ypos -34
  }
  Expression {
   temp_name0 j
   temp_expr0 a
   temp_name1 d
   temp_expr1 "sqrt(g*g - 4*r*b)"
   temp_name2 t
   temp_expr2 "(2.*b)/(-sqrt(g*g - 4*r*b)-g)"
   expr0 0
   channel1 {-rgba.red rgba.green -rgba.blue none}
   expr1 0
   channel2 {-rgba.red -rgba.green rgba.blue none}
   expr2 "log10(minPoint.x) + (t +j) * KNOT_INC_LOW"
   expr3 1
   maskChannelInput -rgba.alpha
   unpremult -rgba.alpha
   name inv_knot_vals4
   xpos 400
   ypos 14
   addUserKnob {20 User}
   addUserKnob {7 knotIncLow}
   knotIncLow {{parent.knotIncLow}}
   addUserKnob {13 min l Min}
   min {{parent.min.x} {parent.min.y} {parent.minSlope}}
  }
push 0
push $Ne29c6b00
  Dot {
   name Dot10
   xpos -6
   ypos -78
  }
set Ne279b200 [stack 0]
  Expression {
   temp_name0 logy
   temp_expr0 "log10( max(r, 1e-10 ))"
   temp_name1 low
   temp_expr1 "(logy > KNOT_Y_LOW.0) && (logy <= KNOT_Y_LOW.1)"
   temp_name2 mid
   temp_expr2 "(logy > KNOT_Y_LOW.1) && (logy <= KNOT_Y_LOW.2)"
   temp_name3 high
   temp_expr3 "(logy > KNOT_Y_LOW.2) && (logy <= KNOT_Y_LOW.3)"
   expr0 "low ? coefsLow.0 : mid ? coefsLow.1 : coefsLow.2"
   expr1 "low ? coefsLow.1 : mid ? coefsLow.2 : coefsLow.3"
   expr2 "low ? coefsLow.2 : mid ? coefsLow.3 : coefsLow.4"
   expr3 "low ? 0 : mid ? 1 : high ? 2 : 0"
   name inv_cfLow
   xpos -150
   ypos -82
  }
  ColorMatrix {
   channels {rgba.red rgba.green rgba.blue -rgba.alpha}
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name inv_basis_low
   xpos -150
   ypos -34
  }
push $Ne279b200
  MergeExpression {
   inputs 2
   temp_name0 logy
   temp_expr0 "log10(max(Br, 1e-10))"
   expr0 Ar
   expr1 Ag
   expr2 Ab-logy
   expr3 Aa
   name c_minus_logy
   xpos -40
   ypos -34
  }
  Expression {
   temp_name0 j
   temp_expr0 a
   temp_name1 d
   temp_expr1 "sqrt(g*g - 4*r*b)"
   temp_name2 t
   temp_expr2 "(2.*b)/(-sqrt(g*g - 4*r*b)-g)"
   expr0 "log10(minPoint.x) + (t +j) * KNOT_INC_LOW"
   channel1 {-rgba.red rgba.green -rgba.blue none}
   expr1 0
   channel2 {-rgba.red -rgba.green rgba.blue none}
   expr2 0
   expr3 1
   maskChannelInput -rgba.alpha
   unpremult -rgba.alpha
   name inv_knot_vals
   xpos -40
   ypos 14
   addUserKnob {20 User}
   addUserKnob {7 knotIncLow}
   knotIncLow {{parent.knotIncLow}}
   addUserKnob {13 min l Min}
   min {{parent.min.x} {parent.min.y} {parent.minSlope}}
  }
push $Ne29c6400
  Dot {
   name Dot18
   xpos 214
   ypos -78
  }
set Ne2798f00 [stack 0]
  Expression {
   temp_name0 logy
   temp_expr0 "log10( max(g, 1e-10 ))"
   temp_name1 low
   temp_expr1 "(logy > KNOT_Y_LOW.0) && (logy <= KNOT_Y_LOW.1)"
   temp_name2 mid
   temp_expr2 "(logy > KNOT_Y_LOW.1) && (logy <= KNOT_Y_LOW.2)"
   temp_name3 high
   temp_expr3 "(logy > KNOT_Y_LOW.2) && (logy <= KNOT_Y_LOW.3)"
   expr0 "low ? coefsLow.0 : mid ? coefsLow.1 : coefsLow.2"
   expr1 "low ? coefsLow.1 : mid ? coefsLow.2 : coefsLow.3"
   expr2 "low ? coefsLow.2 : mid ? coefsLow.3 : coefsLow.4"
   expr3 "low ? 0 : mid ? 1 : high ? 2 : 0"
   name inv_cfLow4
   xpos 70
   ypos -82
  }
  ColorMatrix {
   channels {rgba.red rgba.green rgba.blue -rgba.alpha}
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name inv_basis_low4
   xpos 70
   ypos -34
  }
push $Ne2798f00
  MergeExpression {
   inputs 2
   temp_name0 logy
   temp_expr0 "log10(max(Bg, 1e-10))"
   expr0 Ar
   expr1 Ag
   expr2 Ab-logy
   expr3 Aa
   name c_minus_logy4
   xpos 180
   ypos -34
  }
  Expression {
   temp_name0 j
   temp_expr0 a
   temp_name1 d
   temp_expr1 "sqrt(g*g - 4*r*b)"
   temp_name2 t
   temp_expr2 "(2.*b)/(-sqrt(g*g - 4*r*b)-g)"
   expr0 0
   channel1 {-rgba.red rgba.green -rgba.blue none}
   expr1 "log10(minPoint.x) + (t +j) * KNOT_INC_LOW"
   channel2 {-rgba.red -rgba.green rgba.blue none}
   expr2 0
   expr3 1
   maskChannelInput -rgba.alpha
   unpremult -rgba.alpha
   name inv_knot_vals5
   xpos 180
   ypos 14
   addUserKnob {20 User}
   addUserKnob {7 knotIncLow}
   knotIncLow {{parent.knotIncLow}}
   addUserKnob {13 min l Min}
   min {{parent.min.x} {parent.min.y} {parent.minSlope}}
  }
  Merge2 {
   inputs 3+1
   operation plus
   bbox B
   name Merge2
   xpos 180
   ypos 134
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply1
   xpos 180
   ypos 350
  }
  Dot {
   name Dot28
   label " "
   xpos 214
   ypos 786
  }
push 0
push $Ne2a20100
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 1e-10 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 1e-10 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 1e-10 ))"
   expr0 "( logr >= log10(midPoint.y) ) && ( logr < log10(maxPoint.y) )"
   expr1 "( logg >= log10(midPoint.y) ) && ( logg < log10(maxPoint.y) )"
   expr2 "( logb >= log10(midPoint.y) ) && ( logb < log10(maxPoint.y) )"
   name segment_high
   xpos -810
   ypos -202
  }
  Dot {
   name Dot23
   label " "
   xpos -776
   ypos 474
  }
push $Ne29c7200
  Dot {
   name Dot14
   label " "
   xpos 764
   ypos -318
  }
set Ne2760800 [stack 0]
  Dot {
   name Dot15
   label " "
   xpos 764
   ypos -174
  }
set Ne2760100 [stack 0]
  Dot {
   name Dot17
   label " "
   xpos 984
   ypos -174
  }
set Ne272b900 [stack 0]
  Dot {
   name Dot20
   label " "
   xpos 1204
   ypos -174
  }
  Dot {
   name Dot16
   xpos 1204
   ypos -78
  }
set Ne272ab00 [stack 0]
  Expression {
   temp_name0 logy
   temp_expr0 "log10( max(b, 1e-10 ))"
   temp_name1 low
   temp_expr1 "(logy > KNOT_Y_HIGH.0) && (logy <= KNOT_Y_HIGH.1)"
   temp_name2 mid
   temp_expr2 "(logy > KNOT_Y_HIGH.1) && (logy <= KNOT_Y_HIGH.2)"
   temp_name3 high
   temp_expr3 "(logy > KNOT_Y_HIGH.2) && (logy <= KNOT_Y_HIGH.3)"
   expr0 "low ? coefsHigh.0 : mid ? coefsHigh.1 : coefsHigh.2"
   expr1 "low ? coefsHigh.1 : mid ? coefsHigh.2 : coefsHigh.3"
   expr2 "low ? coefsHigh.2 : mid ? coefsHigh.3 : coefsHigh.4"
   expr3 "low ? 0 : mid ? 1 : high ? 2 : 0"
   name inv_cfLow3
   xpos 1060
   ypos -82
  }
  ColorMatrix {
   channels {rgba.red rgba.green rgba.blue -rgba.alpha}
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name inv_basis_low3
   xpos 1060
   ypos -34
  }
push $Ne272ab00
  MergeExpression {
   inputs 2
   temp_name0 logy
   temp_expr0 "log10(max(Bb, 1e-10))"
   expr0 Ar
   expr1 Ag
   expr2 Ab-logy
   expr3 Aa
   name c_minus_logy3
   xpos 1170
   ypos -34
  }
  Expression {
   temp_name0 j
   temp_expr0 a
   temp_name1 d
   temp_expr1 "sqrt(g*g - 4*r*b)"
   temp_name2 t
   temp_expr2 "(2.*b) / (-sqrt(g*g - 4*r*b) - g)"
   expr0 0
   channel1 {-rgba.red rgba.green -rgba.blue none}
   expr1 0
   channel2 {-rgba.red -rgba.green rgba.blue none}
   expr2 "log10(midPoint.x) + (t +j) * KNOT_INC_HIGH"
   expr3 1
   maskChannelInput -rgba.alpha
   unpremult -rgba.alpha
   name inv_knot_vals3
   xpos 1170
   ypos 14
  }
push 0
push $Ne2760100
  Dot {
   name Dot11
   xpos 764
   ypos -78
  }
set Ne2728800 [stack 0]
  Expression {
   temp_name0 logy
   temp_expr0 "log10( max(r, 1e-10 ))"
   temp_name1 low
   temp_expr1 "(logy > KNOT_Y_HIGH.0) && (logy <= KNOT_Y_HIGH.1)"
   temp_name2 mid
   temp_expr2 "(logy > KNOT_Y_HIGH.1) && (logy <= KNOT_Y_HIGH.2)"
   temp_name3 high
   temp_expr3 "(logy > KNOT_Y_HIGH.2) && (logy <= KNOT_Y_HIGH.3)"
   expr0 "low ? coefsHigh.0 : mid ? coefsHigh.1 : coefsHigh.2"
   expr1 "low ? coefsHigh.1 : mid ? coefsHigh.2 : coefsHigh.3"
   expr2 "low ? coefsHigh.2 : mid ? coefsHigh.3 : coefsHigh.4"
   expr3 "low ? 0 : mid ? 1 : high ? 2 : 0"
   name inv_cfLow1
   xpos 620
   ypos -82
  }
  ColorMatrix {
   channels {rgba.red rgba.green rgba.blue -rgba.alpha}
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name inv_basis_low1
   xpos 620
   ypos -34
  }
push $Ne2728800
  MergeExpression {
   inputs 2
   temp_name0 logy
   temp_expr0 "log10(max(Br, 1e-10))"
   expr0 Ar
   expr1 Ag
   expr2 Ab-logy
   expr3 Aa
   name c_minus_logy1
   xpos 730
   ypos -34
  }
  Expression {
   temp_name0 j
   temp_expr0 a
   temp_name1 d
   temp_expr1 "sqrt(g*g - 4*r*b)"
   temp_name2 t
   temp_expr2 "(2.*b) / (-sqrt(g*g - 4*r*b) - g)"
   expr0 "log10(midPoint.x) + (t +j) * KNOT_INC_HIGH"
   channel1 {-rgba.red rgba.green -rgba.blue none}
   expr1 0
   channel2 {-rgba.red -rgba.green rgba.blue none}
   expr2 0
   expr3 1
   maskChannelInput -rgba.alpha
   unpremult -rgba.alpha
   name inv_knot_vals1
   xpos 730
   ypos 14
  }
push $Ne272b900
  Dot {
   name Dot12
   xpos 984
   ypos -78
  }
set Ne26f6400 [stack 0]
  Expression {
   temp_name0 logy
   temp_expr0 "log10( max(g, 1e-10 ))"
   temp_name1 low
   temp_expr1 "(logy > KNOT_Y_HIGH.0) && (logy <= KNOT_Y_HIGH.1)"
   temp_name2 mid
   temp_expr2 "(logy > KNOT_Y_HIGH.1) && (logy <= KNOT_Y_HIGH.2)"
   temp_name3 high
   temp_expr3 "(logy > KNOT_Y_HIGH.2) && (logy <= KNOT_Y_HIGH.3)"
   expr0 "low ? coefsHigh.0 : mid ? coefsHigh.1 : coefsHigh.2"
   expr1 "low ? coefsHigh.1 : mid ? coefsHigh.2 : coefsHigh.3"
   expr2 "low ? coefsHigh.2 : mid ? coefsHigh.3 : coefsHigh.4"
   expr3 "low ? 0 : mid ? 1 : high ? 2 : 0"
   name inv_cfLow2
   xpos 840
   ypos -82
  }
  ColorMatrix {
   channels {rgba.red rgba.green rgba.blue -rgba.alpha}
   matrix {
       {0.5 -1 0.5}
       {-1 1 0}
       {0.5 0.5 0}
     }
   name inv_basis_low2
   xpos 840
   ypos -34
  }
push $Ne26f6400
  MergeExpression {
   inputs 2
   temp_name0 logy
   temp_expr0 "log10(max(Bg, 1e-10))"
   expr0 Ar
   expr1 Ag
   expr2 Ab-logy
   expr3 Aa
   name c_minus_logy2
   xpos 950
   ypos -34
  }
  Expression {
   temp_name0 j
   temp_expr0 a
   temp_name1 d
   temp_expr1 "sqrt(g*g - 4*r*b)"
   temp_name2 t
   temp_expr2 "(2.*b) / (-sqrt(g*g - 4*r*b) - g)"
   expr0 0
   channel1 {-rgba.red rgba.green -rgba.blue none}
   expr1 "log10(midPoint.x) + (t +j) * KNOT_INC_HIGH"
   channel2 {-rgba.red -rgba.green rgba.blue none}
   expr2 0
   expr3 1
   maskChannelInput -rgba.alpha
   unpremult -rgba.alpha
   name inv_knot_vals2
   xpos 950
   ypos 14
  }
  Merge2 {
   inputs 3+1
   operation plus
   bbox B
   output rgb
   name Merge1
   xpos 950
   ypos 134
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply2
   xpos 950
   ypos 470
  }
  Dot {
   name Dot29
   label " "
   xpos 984
   ypos 786
  }
push $Ne2a20800
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 1e-10 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 1e-10 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 1e-10 ))"
   expr0 "logr >= log10(maxPoint.y) ? 1 : 0"
   expr1 "logg >= log10(maxPoint.y) ? 1 : 0"
   expr2 "logb >= log10(maxPoint.y) ? 1 : 0"
   name segment_peak
   xpos -920
   ypos -202
  }
  Dot {
   name Dot24
   label " "
   xpos -886
   ypos 618
  }
push $Ne2760800
  Dot {
   name Dot21
   label " "
   xpos 1534
   ypos -318
  }
  Expression {
   temp_name0 logr
   temp_expr0 "log10( max(r, 1e-10 ))"
   temp_name1 logg
   temp_expr1 "log10( max(g, 1e-10 ))"
   temp_name2 logb
   temp_expr2 "log10( max(b, 1e-10 ))"
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 log10(maxPoint.x)
   expr1 log10(maxPoint.x)
   expr2 log10(maxPoint.x)
   expr3 1
   name proc_low1
   label Expression
   xpos 1500
   ypos -208
  }
  Merge2 {
   inputs 2
   operation multiply
   also_merge all
   name Multiply4
   xpos 1500
   ypos 614
  }
  Merge2 {
   inputs 4+1
   operation plus
   bbox B
   output rgb
   name Merge3
   xpos 510
   ypos 1118
  }
  Expression {
   channel0 {rgba.red -rgba.green -rgba.blue none}
   expr0 pow(10,r)
   expr1 pow(10,g)
   expr2 pow(10,b)
   name Expression13
   xpos 510
   ypos 1238
  }
  Copy {
   inputs 2
   from0 rgba.alpha
   to0 rgba.alpha
   name Copy1
   xpos 510
   ypos 1496
  }
  Output {
   name Output1
   xpos 510
   ypos 1814
  }
 end_group
 Expression {
  channel0 rgb
  expr0 log(r)/log(2)-log(0.18)/log(2)
  name expShift
  note_font Helvetica
  xpos -1140
  ypos -489
 }
end_group
Dot {
 inputs 0
 name Dot24
 label " ACEScg IN"
 note_font "Helvetica Bold"
 note_font_size 24
 note_font_color 0xff
 xpos 1956
 ypos -199
}
Group {
 name RenderingPrimaries
 tile_color 0xbd91c9ff
 xpos 1922
 ypos 188
 addUserKnob {20 GamutConvert_tab l GamutConvert}
 addUserKnob {26 gamut_chromaticities_label l " " T "SRC Gamut Chromaticity Coordinates"}
 addUserKnob {35 src_presets l preset M {gamut/ACES "knobs this \{rxy \{0.73470 0.26530\} gxy \{0.00000 1.00000\} bxy \{0.00010 -0.07700\} wxy \{0.32168 0.33767\} src_colorspace_name \{ACES\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ACEScg "knobs this \{rxy \{0.713 0.293\} gxy \{0.165 0.830\} bxy \{0.128 0.044\} wxy \{0.32168 0.33767\} src_colorspace_name \{ACEScg\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Filmlight E-Gamut" "knobs this \{ rxy \{0.8 0.3177\} gxy \{0.18 0.9\} bxy \{0.065 -0.0805\} wxy \{0.3127 0.329\} src_colorspace_name \{Filmlight E-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/DaVinci WG" "knobs this \{ rxy \{0.8 0.3130\} gxy \{0.1682 0.9877\} bxy \{0.079 -0.1155\} wxy \{0.3127 0.329\} src_colorspace_name \{DaVinci WG\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/Rec709 "knobs this \{rxy \{0.64000 0.33000\} gxy \{0.30000 0.60000\} bxy \{0.15000 0.06000\} wxy \{0.3127 0.329\} src_colorspace_name \{Rec709\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/Rec2020 "knobs this \{rxy \{0.70800 0.29200\} gxy \{0.17000 0.79700\} bxy \{0.13100 0.04600\} wxy \{0.3127 0.329\} src_colorspace_name \{Rec2020\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3D60 "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.32168 0.33767\} src_colorspace_name \{P3D60\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3D65 "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.3127 0.329\} src_colorspace_name \{P3D65\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3DCI "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.314 0.351\} src_colorspace_name \{P3DCI\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Arri AlexaWideGamut" "knobs this \{rxy \{0.68400 0.31300\} gxy \{0.22100 0.84800\} bxy \{0.08610 -0.10200\} wxy \{0.3127 0.329\} src_colorspace_name \{Arri AlexaWideGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDDRAGONcolor "knobs this \{rxy \{0.753044222785 0.327830576682\} gxy \{0.299570228481 0.700699321956\} bxy \{0.079642066735 -0.0549379510888\} wxy \{0.321683187724 0.337673316035\} src_colorspace_name \{REDDRAGONcolor\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDDRAGONcolor2 "knobs this \{rxy \{0.753044491143 0.327831029513\} gxy \{0.299570490451 0.700699415614\} bxy \{0.145011584278 0.0510971250879\} wxy \{0.321683210353 0.337673610062\} src_colorspace_name \{REDDRAGONcolor2\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor "knobs this \{rxy \{0.699747001291 0.329046930313\} gxy \{0.304264039024 0.623641145129\} bxy \{0.134913961296 0.0347174412813\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor2 "knobs this \{rxy \{0.878682510476 0.32496400741\} gxy \{0.300888714367 0.679054755791\} bxy \{0.0953986946056 -0.0293793268343\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor2\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor3 "knobs this \{rxy \{0.701181035906 0.329014155583\} gxy \{0.300600304652 0.683788834269\} bxy \{0.108154455624 -0.00868817578666\} wxy \{0.321683210353 0.337673610062\} src_colorspace_name \{REDcolor3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor4 "knobs this \{rxy \{0.701180591892 0.329013699116\} gxy \{0.300600395529 0.683788824257\} bxy \{0.145331946229 0.0516168036226\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor4\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDWideGamutRGB "knobs this \{rxy \{0.780308 0.304253\} gxy \{0.121595 1.493994\} bxy \{0.095612 -0.084589\} wxy \{0.3127 0.329\} src_colorspace_name \{REDWideGamutRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/GoPro Protune Native" "knobs this \{rxy \{0.69848046 0.19302645\} gxy \{0.32955538 1.02459662\} bxy \{0.10844263 -0.03467857\} wxy \{0.3127 0.329\} src_colorspace_name \{GoPro Protune Native\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/CanonCinemaGamut "knobs this \{rxy \{0.74 0.27\} gxy \{0.17 1.14\} bxy \{0.08 -0.1\} wxy \{0.3127 0.329\} src_colorspace_name \{CanonCinemaGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SonySGamut "knobs this \{rxy \{0.73 0.28\} gxy \{0.14 0.855\} bxy \{0.1 -0.05\} wxy \{0.3127 0.329\} src_colorspace_name \{SonySGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SonySGamut3Cine "knobs this \{rxy \{0.766 0.275\} gxy \{0.225 0.8\} bxy \{0.089 -0.087\} wxy \{0.3127 0.329\} src_colorspace_name \{SonySGamut3Cine\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/PanasonicVGamut "knobs this \{rxy \{0.730 0.280\} gxy \{0.165 0.840\} bxy \{0.100 -0.030\} wxy \{0.3127 0.329\} src_colorspace_name \{PanasonicVGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/DJI D-Gamut" "knobs this \{rxy \{0.71 0.31\} gxy \{0.21 0.88\} bxy \{0.09 -0.08\} wxy \{0.3127 0.329\} src_colorspace_name \{DJI D-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Fujifilm F-Gamut" "knobs this \{rxy \{0.70800 0.29200\} gxy \{0.17000 0.79700\} bxy \{0.13100 0.04600\} wxy \{0.3127 0.329\} src_colorspace_name \{Fujifilm F-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMDFilmV1 "knobs this \{rxy \{0.9173 0.2502\} gxy \{0.2833 1.7072\} bxy \{0.0856 -0.0708\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMDFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD4kFilmV1 "knobs this \{rxy \{0.7422 0.2859\} gxy \{0.4140 1.3035\} bxy \{0.0342 -0.0833\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMD4kFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD4kFilmV3 "knobs this \{rxy \{1.0625 0.3948\} gxy \{0.3689 0.7775\} bxy \{0.0956 -0.0332\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMD4kFilmV3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD46kFilmV1 "knobs this \{rxy \{0.9175 0.2983\} gxy \{0.2983 1.2835\} bxy \{0.0756 -0.0860\} wxy \{0.3127 0.329\} src_colorspace_name \{BMD46kFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD46kFilmV3 "knobs this \{rxy \{0.8608 0.3689\} gxy \{0.3282 0.6156\} bxy \{0.0783 -0.0233\} wxy \{0.3127 0.329\} src_colorspace_name \{BMD46kFilmV3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMDWideGamutV4 "knobs this \{rxy \{0.7177 0.3171\} gxy \{0.2280 0.8616\} bxy \{0.1006 -0.0820\} wxy \{0.3127 0.329\} src_colorspace_name \{BMDWideGamutV4\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/AdobeRGB\t" "knobs this \{rxy \{0.6400 0.3300\} gxy \{0.2100 0.7100\} bxy \{0.1500 0.0600\} wxy \{0.3127 0.329\} src_colorspace_name \{AdobeRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/AdobeWideGamutRGB "knobs this \{rxy \{0.7347 0.2653\} gxy \{0.1152 0.8264\} bxy \{0.1566 0.0177\} wxy \{0.3457 0.3585\} src_colorspace_name \{AdobeWideGamutRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ROMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01  8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{ROMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/RIMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01 8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{RIMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ERIMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01 8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{ERIMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ProPhotoRGB "knobs this \{rxy \{0.734699 0.265301\} gxy \{0.159597 0.840403\} bxy \{0.036598 0.000105\} wxy \{0.345704 0.358540\} src_colorspace_name \{ProPhotoRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/RusselRGB "knobs this \{rxy \{0.6900 0.3100\} gxy \{0.1800 0.7700\} bxy \{0.1000 0.0200\} wxy \{0.33243 0.34744\} src_colorspace_name \{RusselRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SharpRGB "knobs this \{rxy \{0.6898 0.3206\} gxy \{0.0736 0.9003\} bxy \{0.1166 0.0374\} wxy \{0.33333333 0.33333333\} src_colorspace_name \{SharpRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/AppleRGB "knobs this \{rxy \{0.6250 0.3400\} gxy \{0.2800 0.5950\} bxy \{0.1550 0.0700\} wxy \{0.3127 0.329\} src_colorspace_name \{AppleRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BestRGB "knobs this \{rxy \{0.735191637630662 0.264808362369338\} gxy \{0.215336134453781 0.774159663865546\} bxy \{0.130122950819672 0.034836065573770\} wxy \{0.3457 0.3585\} src_colorspace_name \{BestRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ D60" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.32162624 0.337737\} src_colorspace_name \{XYZ D60\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ D65" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.3127 0.329\} src_colorspace_name \{XYZ D65\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ E" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.333333333333 0.333333333333\}  src_colorspace_name \{XYZ E\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()"}}
 addUserKnob {12 rxy l r t "Red xy chromaticity coordinates in CIE 1931 colorspace."}
 rxy {0.713 0.293}
 addUserKnob {12 gxy l g t "Green xy chromaticity coordinates in CIE 1931 colorspace."}
 gxy {0.165 0.83}
 addUserKnob {12 bxy l b t "Blue xy chromaticity coordinates in CIE 1931 colorspace."}
 bxy {0.128 0.044}
 addUserKnob {12 wxy l w t "Whitepoint xy chromaticity coordinates in CIE 1931 colorspace."}
 wxy {0.32168 0.33767}
 addUserKnob {1 src_colorspace_name l src +DISABLED}
 src_colorspace_name ACEScg
 addUserKnob {26 ""}
 addUserKnob {26 dst_gamut_chromaticities_label l " " T "DST Gamut Chromaticity Coordinates"}
 addUserKnob {35 dst_presets l preset M {gamut/ACES "knobs this \{drxy \{0.73470 0.26530\} dgxy \{0.00000 1.00000\} dbxy \{0.00010 -0.07700\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{ACES\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ACEScg "knobs this \{drxy \{0.713 0.293\} dgxy \{0.165 0.830\} dbxy \{0.128 0.044\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{ACEScg\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Filmlight E-Gamut" "knobs this \{ drxy \{0.8 0.3177\} dgxy \{0.18 0.9\} dbxy \{0.065 -0.0805\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Filmlight E-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/DaVinci WG" "knobs this \{ drxy \{0.8 0.3130\} dgxy \{0.1682 0.9877\} dbxy \{0.079 -0.1155\} dwxy \{0.3127 0.329\} dst_colorspace_name \{DaVinci WG\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/Rec709 "knobs this \{drxy \{0.64000 0.33000\} dgxy \{0.30000 0.60000\} dbxy \{0.15000 0.06000\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Rec709\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/Rec2020 "knobs this \{drxy \{0.70800 0.29200\} dgxy \{0.17000 0.79700\} dbxy \{0.13100 0.04600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Rec2020\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3D60 "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{P3D60\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3D65 "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.3127 0.329\} dst_colorspace_name \{P3D65\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3DCI "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.314 0.351\} dst_colorspace_name \{P3DCI\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Arri AlexaWideGamut" "knobs this \{drxy \{0.68400 0.31300\} dgxy \{0.22100 0.84800\} dbxy \{0.08610 -0.10200\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Arri AlexaWideGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDDRAGONcolor "knobs this \{drxy \{0.753044222785 0.327830576682\} dgxy \{0.299570228481 0.700699321956\} dbxy \{0.079642066735 -0.0549379510888\} dwxy \{0.321683187724 0.337673316035\} dst_colorspace_name \{REDDRAGONcolor\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDDRAGONcolor2 "knobs this \{drxy \{0.753044491143 0.327831029513\} dgxy \{0.299570490451 0.700699415614\} dbxy \{0.145011584278 0.0510971250879\} dwxy \{0.321683210353 0.337673610062\} dst_colorspace_name \{REDDRAGONcolor2\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor "knobs this \{drxy \{0.699747001291 0.329046930313\} dgxy \{0.304264039024 0.623641145129\} dbxy \{0.134913961296 0.0347174412813\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor2 "knobs this \{drxy \{0.878682510476 0.32496400741\} dgxy \{0.300888714367 0.679054755791\} dbxy \{0.0953986946056 -0.0293793268343\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor2\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor3 "knobs this \{drxy \{0.701181035906 0.329014155583\} dgxy \{0.300600304652 0.683788834269\} dbxy \{0.108154455624 -0.00868817578666\} dwxy \{0.321683210353 0.337673610062\} dst_colorspace_name \{REDcolor3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor4 "knobs this \{drxy \{0.701180591892 0.329013699116\} dgxy \{0.300600395529 0.683788824257\} dbxy \{0.145331946229 0.0516168036226\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor4\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDWideGamutRGB "knobs this \{drxy \{0.780308 0.304253\} dgxy \{0.121595 1.493994\} dbxy \{0.095612 -0.084589\} dwxy \{0.3127 0.329\} dst_colorspace_name \{REDWideGamutRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/GoPro Protune Native" "knobs this \{drxy \{0.69848046 0.19302645\} dgxy \{0.32955538 1.02459662\} dbxy \{0.10844263 -0.03467857\} dwxy \{0.3127 0.329\} dst_colorspace_name \{GoPro Protune Native\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/CanonCinemaGamut "knobs this \{drxy \{0.74 0.27\} dgxy \{0.17 1.14\} dbxy \{0.08 -0.1\} dwxy \{0.3127 0.329\} dst_colorspace_name \{CanonCinemaGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SonySGamut "knobs this \{drxy \{0.73 0.28\} dgxy \{0.14 0.855\} dbxy \{0.1 -0.05\} dwxy \{0.3127 0.329\} dst_colorspace_name \{SonySGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SonySGamut3Cine "knobs this \{drxy \{0.766 0.275\} dgxy \{0.225 0.8\} dbxy \{0.089 -0.087\} dwxy \{0.3127 0.329\} dst_colorspace_name \{SonySGamut3Cine\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/PanasonicVGamut "knobs this \{drxy \{0.730 0.280\} dgxy \{0.165 0.840\} dbxy \{0.100 -0.030\} dwxy \{0.3127 0.329\} dst_colorspace_name \{PanasonicVGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/DJI D-Gamut" "knobs this \{drxy \{0.71 0.31\} dgxy \{0.21 0.88\} dbxy \{0.09 -0.08\} dwxy \{0.3127 0.329\} dst_colorspace_name \{DJI D-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Fujifilm F-Gamut" "knobs this \{drxy \{0.70800 0.29200\} dgxy \{0.17000 0.79700\} dbxy \{0.13100 0.04600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Fujifilm F-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMDFilmV1 "knobs this \{drxy \{0.9173 0.2502\} dgxy \{0.2833 1.7072\} dbxy \{0.0856 -0.0708\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMDFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD4kFilmV1 "knobs this \{drxy \{0.7422 0.2859\} dgxy \{0.4140 1.3035\} dbxy \{0.0342 -0.0833\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMD4kFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD4kFilmV3 "knobs this \{drxy \{1.0625 0.3948\} dgxy \{0.3689 0.7775\} dbxy \{0.0956 -0.0332\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMD4kFilmV3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD46kFilmV1 "knobs this \{drxy \{0.9175 0.2983\} dgxy \{0.2983 1.2835\} dbxy \{0.0756 -0.0860\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMD46kFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD46kFilmV3 "knobs this \{drxy \{0.8608 0.3689\} dgxy \{0.3282 0.6156\} dbxy \{0.0783 -0.0233\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMD46kFilmV3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMDWideGamutV4 "knobs this \{drxy \{0.7177 0.3171\} dgxy \{0.2280 0.8616\} dbxy \{0.1006 -0.0820\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMDWideGamutV4\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/AdobeRGB\t" "knobs this \{drxy \{0.6400 0.3300\} dgxy \{0.2100 0.7100\} dbxy \{0.1500 0.0600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{AdobeRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/AdobeWideGamutRGB "knobs this \{drxy \{0.7347 0.2653\} dgxy \{0.1152 0.8264\} dbxy \{0.1566 0.0177\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{AdobeWideGamutRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ROMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01  8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{ROMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/RIMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01 8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{RIMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ERIMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01 8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{ERIMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ProPhotoRGB "knobs this \{drxy \{0.734699 0.265301\} dgxy \{0.159597 0.840403\} dbxy \{0.036598 0.000105\} dwxy \{0.345704 0.358540\} dst_colorspace_name \{ProPhotoRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/RusselRGB "knobs this \{drxy \{0.6900 0.3100\} dgxy \{0.1800 0.7700\} dbxy \{0.1000 0.0200\} dwxy \{0.33243 0.34744\} dst_colorspace_name \{RusselRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SharpRGB "knobs this \{drxy \{0.6898 0.3206\} dgxy \{0.0736 0.9003\} dbxy \{0.1166 0.0374\} dwxy \{0.33333333 0.33333333\} dst_colorspace_name \{SharpRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/AppleRGB "knobs this \{drxy \{0.6250 0.3400\} dgxy \{0.2800 0.5950\} dbxy \{0.1550 0.0700\} dwxy \{0.3127 0.329\} dst_colorspace_name \{AppleRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BestRGB "knobs this \{drxy \{0.735191637630662 0.264808362369338\} dgxy \{0.215336134453781 0.774159663865546\} dbxy \{0.130122950819672 0.034836065573770\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{BestRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ D60" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.32162624 0.337737\} dst_colorspace_name \{XYZ D60\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ D65" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.3127 0.329\} dst_colorspace_name \{XYZ D65\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ E" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.333333333333 0.333333333333\}  dst_colorspace_name \{XYZ E\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()"}}
 addUserKnob {12 drxy l r t "Red xy chromaticity coordinates in CIE 1931 colorspace."}
 drxy {0.8125976563 0.2649462891}
 addUserKnob {12 dgxy l g t "Green xy chromaticity coordinates in CIE 1931 colorspace."}
 dgxy {0.13046875 0.9126953125}
 addUserKnob {12 dbxy l b t "Blue xy chromaticity coordinates in CIE 1931 colorspace."}
 dbxy {0.089453125 -0.1078125}
 addUserKnob {12 dwxy l w t "Whitepoint xy chromaticity coordinates in CIE 1931 colorspace."}
 dwxy {0.32168 0.33767}
 addUserKnob {1 dst_colorspace_name l dst +DISABLED}
 dst_colorspace_name ACEScg
 addUserKnob {26 ""}
 addUserKnob {26 chromatic_adaptation_label l " " T "Chromatic Adaptation"}
 addUserKnob {4 cat_method l method t "Choose the chromatic adaptation method for adapting whitepoint." M {cat02 bradford cmccat2000 xyz_scaling none "" fairchild bianco cat02_brill_cat bianco_pc cmccat97 sharp von_kries "" ""}}
 addUserKnob {26 ""}
 addUserKnob {6 invert t "Invert direction of matrix." +STARTLINE}
 addUserKnob {22 calculate_matrix l "Calculate Matrix" t "Calculate 3x3 matrix based on the specified colorspace chromaticities." T "import nuke\nfloat3 = nuke.math.Vector3\nfloat3x3 = nuke.math.Matrix3\n\n\ndef transpose(m):\n    # Transpose (swap rows and columns) of a nuke.math.Matrix3\n    return float3x3(m\[0], m\[1], m\[2], m\[3], m\[4], m\[5], m\[6], m\[7], m\[8])\n\ndef set_matrix(m):\n    # Populate a nuke.math.Matrix3 with a 3x3 python list (either 3x3 or 1x9)\n    if len(m) is 3 and \[isinstance(r, list) for r in m]:\n        m = sum(m, \[])\n    o = float3x3(m\[0], m\[3], m\[6], m\[1], m\[4], m\[7], m\[2], m\[5], m\[8])\n    return o\n\ndef diag(v):\n    # Create a diagonal 3x3 matrix from a 1x3 vector\n    return float3x3(v\[0], 0, 0, 0, v\[1], 0, 0, 0, v\[2])\n\n\ndef xyY_to_XYZ(xyY):\n    # Convert an xyY chromaticity value to XYZ\n    x = xyY\[0]\n    y = xyY\[1]\n    if len(xyY) is 2:\n        # Assume an xy chromaticity coordinate, use default Y\n        Y = 1.0\n    else:\n        Y = xyY\[2]\n    XYZ = float3(x * Y / max(y, 1e-10), Y, (1.0 - x - y) * Y / max(y, 1e-10))\n    return XYZ\n\ndef xy_to_xyz(xy):\n    return float3(xy\[0], xy\[1], 1.0 - xy\[0] - xy\[1])\n\n\ndef calc_cat(src_xy, dst_xy, cat_method='cat02'):\n    # Calculate Von Kries chromatic adaptation transform matrix,\n    # given a source and destination illuminant and CAT method.\n    # Illuminant is given as xy chromaticity coordinates. \n    # CAT method is the name of one of the below cone response matrices.\n\n    crmtxs = \{\n        \"bianco\": \[\[0.8752, 0.2787, -0.1539], \[-0.8904, 1.8709, 0.0195], \[-0.0061, 0.0162, 0.9899]],\n        \"bianco_pc\": \[\[0.6489, 0.3915, -0.0404], \[-0.3775, 1.3055, 0.072], \[-0.0271, 0.0888, 0.9383]],\n        \"bradford\": \[\[0.8951, 0.2664, -0.1614], \[-0.7502, 1.7135, 0.0367], \[0.0389, -0.0685, 1.0296]],\n        \"cat02\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.003, 0.0136, 0.9834]],\n        \"cat02_brill_cat\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.0, 0.0, 1.0]],\n        \"cmccat2000\": \[\[0.7982, 0.3389, -0.1371], \[-0.5918, 1.5512, 0.0406], \[0.0008, 0.0239, 0.9753]],\n        \"cmccat97\": \[\[0.8951, -0.7502, 0.0389], \[0.2664, 1.7135, 0.0685], \[-0.1614, 0.0367, 1.0296]],\n        \"fairchild\": \[\[0.8562, 0.3372, -0.1934], \[-0.836, 1.8327, 0.0033], \[0.0357, -0.0469, 1.0112]],\n        \"sharp\": \[\[1.2694, -0.0988, -0.1706], \[-0.8364, 1.8006, 0.0357], \[0.0297, -0.0315, 1.0018]],\n        \"von_kries\": \[\[0.40024, 0.7076, -0.08081], \[-0.2263, 1.16532, 0.0457], \[0.0, 0.0, 0.91822]],\n        \"xyz_scaling\": \[\[1.0, 0.0, 0.0], \[0.0, 1.0, 0.0], \[0.0, 0.0, 1.0]]\n    \}\n    \n    cat_method = cat_method.lower().replace(' ', '_')\n    # Return identity matrix if no match\n    if cat_method not in crmtxs.keys():\n        m = float3x3()\n        m.makeIdentity()\n        return m\n        \n    crmtx = set_matrix(crmtxs\[cat_method])\n\n    # Get XYZ values from xy chromaticity coordinates\n    src_XYZ = xyY_to_XYZ(src_xy)\n    dst_XYZ = xyY_to_XYZ(dst_xy)\n\n    # Calculate source and destination cone response matrices\n    src_crmtx = transpose(crmtx) * src_XYZ\n    dst_crmtx = transpose(crmtx) * dst_XYZ\n\n    von_kries_matrix = diag(dst_crmtx / src_crmtx)\n    cat_mtx = float3x3()\n    cat_mtx = crmtx * (von_kries_matrix * crmtx.inverse())\n\n    return cat_mtx\n\n\ndef calc_npm(chr):\n    # Calculate a normalized primaries matrix from the specified chromaticity coordinates,\n    # given 2x4 list of xy chromaticity coordinates: red, green, blue, and white\n    rxyz, gxyz, bxyz, wxyz = map(xy_to_xyz, chr)\n    wy = chr\[3]\[1]\n    wxyz = float3(wxyz.x / wy, wxyz.y / wy, wxyz.z / wy)\n    np_mtx = float3x3(rxyz\[0], gxyz\[0], bxyz\[0],\n                      rxyz\[1], gxyz\[1], bxyz\[1],\n                      rxyz\[2], gxyz\[2], bxyz\[2])\n    wscale = np_mtx.inverse() * wxyz \n    np_mtx = transpose(np_mtx * diag(wscale))\n    return np_mtx\n\ndef is_xyz(c):\n    # return true if primaries are XYZ\n    return c\[:3] == \[\[1.0, 0.0], \[0.0, 1.0], \[0.0, 0.0]]\n\n\ndef start(node):\n    identity_mtx = float3x3()\n    identity_mtx.makeIdentity()\n\n    invert = node\['invert'].getValue()\n    cat_method = node\['cat_method'].value()\n\n    src_chr = \[node\[k].getValue() for k in \['rxy', 'gxy', 'bxy', 'wxy']]\n    dst_chr = \[node\[k].getValue() for k in \['drxy', 'dgxy', 'dbxy', 'dwxy']]\n\n    # bypass double scale if source or destination is XYZ\n    if is_xyz(src_chr):\n        rgb_to_xyz = identity_mtx\n    else:\n        rgb_to_xyz = calc_npm(src_chr)\n    \n    if is_xyz(dst_chr):\n        xyz_to_rgb = identity_mtx\n    else:\n        xyz_to_rgb = calc_npm(dst_chr).inverse()\n\n    if src_chr\[3] == dst_chr\[3]:\n        cat_mtx = identity_mtx\n    else:\n        cat_mtx = calc_cat(src_chr\[3], dst_chr\[3], cat_method)\n\n    mtx = (rgb_to_xyz * cat_mtx) * xyz_to_rgb\n\n    if invert:\n        mtx = mtx.inverse()\n\n    node\['matrix'].setValue(mtx)\n\n\nif __name__=='__main__':\n    start(nuke.thisNode())" +STARTLINE}
 addUserKnob {22 create_matrix_node l "Create Matrix" t "Create ColorMatrix node with the current values." -STARTLINE T "node = nuke.thisNode()\nnode\['calculate_matrix'].execute()\nnuke.root().begin()\n_ = \[n.setSelected(False) for n in nuke.allNodes(recurseGroups=True)]\nm = nuke.createNode('ColorMatrix')\nm\['matrix'].setValue(node\['matrix'].getValue())\nm.setXYpos(node.xpos()-120, node.ypos())\nsrc_name = node\['src_colorspace_name'].getValue()\ndst_name = node\['dst_colorspace_name'].getValue()\nif node\['invert'].getValue():\n    label = '\{1\} to \{0\}'.format(src_name, dst_name)\nelse:\n    label = '\{0\} to \{1\}'.format(src_name, dst_name)\nm\['label'].setValue(label)"}
 addUserKnob {41 matrix T ColorMatrix.matrix}
 addUserKnob {22 clear l Clear T "n = nuke.thisNode()\nn\['matrix'].setValue(\[1,0,0,0,1,0,0,0,1])\nn\['label'].setValue('')" +STARTLINE}
 addUserKnob {22 show_matrix l Show t "Show matrix values in a popup window for copying." T "node = nuke.thisNode()\nshow_4x4 = node\['show_matrix_4x4'].getValue()\nshow_commas = node\['show_matrix_commas'].getValue()\n\nif show_commas:\n    sep = ', '\nelse:\n    sep = ' '\n\nmtx = \[format(i, '.8f') for i in node\['matrix'].getValue()]\n\nif show_4x4:\n    z = \['0']\n    mtx = mtx\[0:3] + z + mtx\[3:6] + z + mtx\[6:9] + z*4 + \['1']\n\nnuke.message(sep.join(mtx))" +STARTLINE}
 addUserKnob {6 show_matrix_4x4 l "show 4x4" t "present values in a 4x4 matrix (useful for ocio)" -STARTLINE}
 addUserKnob {6 show_matrix_commas l "show comma sep" t "show matrix comma separated." -STARTLINE}
 addUserKnob {22 save_spimtx l "Save spimtx" T "# inspired by ColorMatrixPlus by hpd\ndef write_spimtx(mtx_node, spimtx_file):\n    mtx_vals = mtx_node\['matrix'].getValue()\n    with open(spimtx_file, \"w\") as f:\n        f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n            mtx_vals\[0], mtx_vals\[1], mtx_vals\[2]) )\n        f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n            mtx_vals\[3], mtx_vals\[4], mtx_vals\[5]) )\n        f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n            mtx_vals\[6], mtx_vals\[7], mtx_vals\[8]) )\n\nnode = nuke.thisNode()\nfilepath = nuke.getFilename('Save Matrix', '*.spimtx')\n\nif filepath:\n    if not filepath.endswith('.spimtx'):\n        filepath = filepath + '.spimtx'\n    write_spimtx(node, filepath)" +STARTLINE}
 addUserKnob {22 load_spimtx l "Load spimtx" -STARTLINE T "# Inspired by ColorMatrixPlus by hpd\ndef load_spimtx(spimtx, mtx_node):\n    with open( spimtx, 'r') as file:\n        lines = file.readlines()\n    matrix_values = list()\n    for line in lines:\n        matrix_values.extend( map(float, line.strip().split(' ')\[0:3]) )\n    mtx_node\['matrix'].setValue(matrix_values)\n\nspimtx = nuke.getFilename('Load SPIMTX', '*.spimtx')\nif spimtx:\n    load_spimtx( spimtx, nuke.thisNode() )\n"}
}
 Input {
  inputs 0
  name Input
  xpos -40
  ypos 206
 }
 ColorMatrix {
  matrix {
      {0.8891872168 0.04843750596 0.0623754859}
      {0.07645788789 0.7566657662 0.1668763906}
      {0.05304532498 0.03478367627 0.9121709466}
    }
  name ColorMatrix
  xpos -40
  ypos 254
 }
 Output {
  name Output
  xpos -40
  ypos 302
 }
end_group
set Ne2879600 [stack 0]
Group {
 name Tonemap_Siragusano_Presets1
 xpos 1922
 ypos 295
 addUserKnob {20 Tonemap}
 addUserKnob {35 presets l " " M {"presets/SDR - Dark" "knobs this \{Lp 100 Lw 105 Lr 160 w 0 p 1.3 t0 0.02 n \{Lw/Lp\}\}" "presets/SDR - Dim" "knobs this \{Lp 100 Lw 105 Lr 160 w 0 p 1.25 t0 0.02 n \{Lw/Lp\}\}" "presets/SDR - Average" "knobs this \{Lp 100 Lw 105 Lr 160 w 0 p 1.2 t0 0.02 n \{Lw/Lp\}\}" "presets/Rec.2100 PQ ST-2084 600 nit" "knobs this \{Lp 10000 Lw 642 Lr 115 w 0 p 1.15 t0 0.02 n \{Lw/Lp\}\}" "presets/Rec.2100 PQ ST-2084 1000 nit" "knobs this \{Lp 10000 Lw 1100 Lr 120 w 0 p 1.15 t0 0.02 n \{Lw/Lp\}\}" "presets/Rec.2100 PQ ST-2084 2000 nit" "knobs this \{Lp 10000 Lw 2300 Lr 120 w 0.1 p 1.15 t0 0.02 n \{Lw/Lp\}\}" "presets/Rec.2100 PQ ST-2084 4000 nit" "knobs this \{Lp 10000 Lw 4970 Lr 120 w 0.2 p 1.15 t0 0.02 n \{Lw/Lp\}\}"}}
 addUserKnob {7 Lp t "peak white" R 100 10000}
 Lp 100
 addUserKnob {7 Lw t "Peak white in nits" R 100 4000}
 Lw 105
 addUserKnob {7 Lr t "Reference white in nits." R 48 1000}
 Lr 160
 addUserKnob {7 w l exposure t "scene-referred exposure control" R -2 2}
 addUserKnob {7 p l contrast t "display-referred power function" R 0.8 2}
 p 1.2
 addUserKnob {7 t0 l toe t "shadow toe flare compensation" R 0 0.1}
 t0 0.02
 addUserKnob {78 s l scale n 2}
 s {{pow(s.1,1/p)/pow(2,w)} {Lw/Lr}}
 addUserKnob {7 n l normalize t "normalize peak to output" R 0 2}
 n {{Lw/Lp}}
 addUserKnob {4 direction M {forward inverse}}
}
 Input {
  inputs 0
  name Input
  xpos -40
  ypos -40
 }
set Ne2847200 [stack 0]
 Expression {
  expr0 r*(s.1/n)
  expr1 g*(s.1/n)
  expr2 b*(s.1/n)
  name InvScale
  note_font Helvetica
  xpos 70
  ypos 21
 }
 Expression {
  expr0 (r+sqrt(r*(r+4*t0)))/2
  expr1 (g+sqrt(g*(g+4*t0)))/2
  expr2 (b+sqrt(b*(b+4*t0)))/2
  name InvToe
  note_font Helvetica
  xpos 70
  ypos 51
 }
 Expression {
  expr0 (s.0*pow(r/s.1,1/p))/(1-pow(r/s.1,1/p))
  expr1 (s.0*pow(g/s.1,1/p))/(1-pow(g/s.1,1/p))
  expr2 (s.0*pow(b/s.1,1/p))/(1-pow(b/s.1,1/p))
  name InvCompress
  note_font Helvetica
  xpos 70
  ypos 81
 }
push $Ne2847200
 Expression {
  expr0 s.1*pow(r/(r+s.0),p)
  expr1 s.1*pow(g/(g+s.0),p)
  expr2 s.1*pow(b/(b+s.0),p)
  name Compress
  note_font Helvetica
  xpos -150
  ypos 21
 }
 Expression {
  expr0 (r*r)/(r+t0)
  expr1 (g*g)/(g+t0)
  expr2 (b*b)/(b+t0)
  name Toe
  note_font Helvetica
  xpos -150
  ypos 51
 }
 Expression {
  expr0 r*(n/s.1)
  expr1 g*(n/s.1)
  expr2 b*(n/s.1)
  name Scale
  note_font Helvetica
  xpos -150
  ypos 81
 }
 Switch {
  inputs 2
  which {{parent.direction}}
  name SwitchDirection
  note_font Helvetica
  xpos -40
  ypos 141
 }
 Output {
  name Output
  xpos -40
  ypos 200
 }
end_group
Group {
 name OutputPrimaries
 tile_color 0xbd91c9ff
 xpos 1922
 ypos 355
 addUserKnob {20 GamutConvert_tab l GamutConvert}
 addUserKnob {26 gamut_chromaticities_label l " " T "SRC Gamut Chromaticity Coordinates"}
 addUserKnob {35 src_presets l preset M {gamut/ACES "knobs this \{rxy \{0.73470 0.26530\} gxy \{0.00000 1.00000\} bxy \{0.00010 -0.07700\} wxy \{0.32168 0.33767\} src_colorspace_name \{ACES\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ACEScg "knobs this \{rxy \{0.713 0.293\} gxy \{0.165 0.830\} bxy \{0.128 0.044\} wxy \{0.32168 0.33767\} src_colorspace_name \{ACEScg\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Filmlight E-Gamut" "knobs this \{ rxy \{0.8 0.3177\} gxy \{0.18 0.9\} bxy \{0.065 -0.0805\} wxy \{0.3127 0.329\} src_colorspace_name \{Filmlight E-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/DaVinci WG" "knobs this \{ rxy \{0.8 0.3130\} gxy \{0.1682 0.9877\} bxy \{0.079 -0.1155\} wxy \{0.3127 0.329\} src_colorspace_name \{DaVinci WG\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/Rec709 "knobs this \{rxy \{0.64000 0.33000\} gxy \{0.30000 0.60000\} bxy \{0.15000 0.06000\} wxy \{0.3127 0.329\} src_colorspace_name \{Rec709\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/Rec2020 "knobs this \{rxy \{0.70800 0.29200\} gxy \{0.17000 0.79700\} bxy \{0.13100 0.04600\} wxy \{0.3127 0.329\} src_colorspace_name \{Rec2020\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3D60 "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.32168 0.33767\} src_colorspace_name \{P3D60\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3D65 "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.3127 0.329\} src_colorspace_name \{P3D65\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3DCI "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.314 0.351\} src_colorspace_name \{P3DCI\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Arri AlexaWideGamut" "knobs this \{rxy \{0.68400 0.31300\} gxy \{0.22100 0.84800\} bxy \{0.08610 -0.10200\} wxy \{0.3127 0.329\} src_colorspace_name \{Arri AlexaWideGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDDRAGONcolor "knobs this \{rxy \{0.753044222785 0.327830576682\} gxy \{0.299570228481 0.700699321956\} bxy \{0.079642066735 -0.0549379510888\} wxy \{0.321683187724 0.337673316035\} src_colorspace_name \{REDDRAGONcolor\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDDRAGONcolor2 "knobs this \{rxy \{0.753044491143 0.327831029513\} gxy \{0.299570490451 0.700699415614\} bxy \{0.145011584278 0.0510971250879\} wxy \{0.321683210353 0.337673610062\} src_colorspace_name \{REDDRAGONcolor2\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor "knobs this \{rxy \{0.699747001291 0.329046930313\} gxy \{0.304264039024 0.623641145129\} bxy \{0.134913961296 0.0347174412813\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor2 "knobs this \{rxy \{0.878682510476 0.32496400741\} gxy \{0.300888714367 0.679054755791\} bxy \{0.0953986946056 -0.0293793268343\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor2\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor3 "knobs this \{rxy \{0.701181035906 0.329014155583\} gxy \{0.300600304652 0.683788834269\} bxy \{0.108154455624 -0.00868817578666\} wxy \{0.321683210353 0.337673610062\} src_colorspace_name \{REDcolor3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor4 "knobs this \{rxy \{0.701180591892 0.329013699116\} gxy \{0.300600395529 0.683788824257\} bxy \{0.145331946229 0.0516168036226\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor4\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDWideGamutRGB "knobs this \{rxy \{0.780308 0.304253\} gxy \{0.121595 1.493994\} bxy \{0.095612 -0.084589\} wxy \{0.3127 0.329\} src_colorspace_name \{REDWideGamutRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/GoPro Protune Native" "knobs this \{rxy \{0.69848046 0.19302645\} gxy \{0.32955538 1.02459662\} bxy \{0.10844263 -0.03467857\} wxy \{0.3127 0.329\} src_colorspace_name \{GoPro Protune Native\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/CanonCinemaGamut "knobs this \{rxy \{0.74 0.27\} gxy \{0.17 1.14\} bxy \{0.08 -0.1\} wxy \{0.3127 0.329\} src_colorspace_name \{CanonCinemaGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SonySGamut "knobs this \{rxy \{0.73 0.28\} gxy \{0.14 0.855\} bxy \{0.1 -0.05\} wxy \{0.3127 0.329\} src_colorspace_name \{SonySGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SonySGamut3Cine "knobs this \{rxy \{0.766 0.275\} gxy \{0.225 0.8\} bxy \{0.089 -0.087\} wxy \{0.3127 0.329\} src_colorspace_name \{SonySGamut3Cine\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/PanasonicVGamut "knobs this \{rxy \{0.730 0.280\} gxy \{0.165 0.840\} bxy \{0.100 -0.030\} wxy \{0.3127 0.329\} src_colorspace_name \{PanasonicVGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/DJI D-Gamut" "knobs this \{rxy \{0.71 0.31\} gxy \{0.21 0.88\} bxy \{0.09 -0.08\} wxy \{0.3127 0.329\} src_colorspace_name \{DJI D-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Fujifilm F-Gamut" "knobs this \{rxy \{0.70800 0.29200\} gxy \{0.17000 0.79700\} bxy \{0.13100 0.04600\} wxy \{0.3127 0.329\} src_colorspace_name \{Fujifilm F-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMDFilmV1 "knobs this \{rxy \{0.9173 0.2502\} gxy \{0.2833 1.7072\} bxy \{0.0856 -0.0708\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMDFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD4kFilmV1 "knobs this \{rxy \{0.7422 0.2859\} gxy \{0.4140 1.3035\} bxy \{0.0342 -0.0833\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMD4kFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD4kFilmV3 "knobs this \{rxy \{1.0625 0.3948\} gxy \{0.3689 0.7775\} bxy \{0.0956 -0.0332\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMD4kFilmV3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD46kFilmV1 "knobs this \{rxy \{0.9175 0.2983\} gxy \{0.2983 1.2835\} bxy \{0.0756 -0.0860\} wxy \{0.3127 0.329\} src_colorspace_name \{BMD46kFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD46kFilmV3 "knobs this \{rxy \{0.8608 0.3689\} gxy \{0.3282 0.6156\} bxy \{0.0783 -0.0233\} wxy \{0.3127 0.329\} src_colorspace_name \{BMD46kFilmV3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMDWideGamutV4 "knobs this \{rxy \{0.7177 0.3171\} gxy \{0.2280 0.8616\} bxy \{0.1006 -0.0820\} wxy \{0.3127 0.329\} src_colorspace_name \{BMDWideGamutV4\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/AdobeRGB\t" "knobs this \{rxy \{0.6400 0.3300\} gxy \{0.2100 0.7100\} bxy \{0.1500 0.0600\} wxy \{0.3127 0.329\} src_colorspace_name \{AdobeRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/AdobeWideGamutRGB "knobs this \{rxy \{0.7347 0.2653\} gxy \{0.1152 0.8264\} bxy \{0.1566 0.0177\} wxy \{0.3457 0.3585\} src_colorspace_name \{AdobeWideGamutRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ROMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01  8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{ROMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/RIMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01 8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{RIMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ERIMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01 8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{ERIMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ProPhotoRGB "knobs this \{rxy \{0.734699 0.265301\} gxy \{0.159597 0.840403\} bxy \{0.036598 0.000105\} wxy \{0.345704 0.358540\} src_colorspace_name \{ProPhotoRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/RusselRGB "knobs this \{rxy \{0.6900 0.3100\} gxy \{0.1800 0.7700\} bxy \{0.1000 0.0200\} wxy \{0.33243 0.34744\} src_colorspace_name \{RusselRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SharpRGB "knobs this \{rxy \{0.6898 0.3206\} gxy \{0.0736 0.9003\} bxy \{0.1166 0.0374\} wxy \{0.33333333 0.33333333\} src_colorspace_name \{SharpRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/AppleRGB "knobs this \{rxy \{0.6250 0.3400\} gxy \{0.2800 0.5950\} bxy \{0.1550 0.0700\} wxy \{0.3127 0.329\} src_colorspace_name \{AppleRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BestRGB "knobs this \{rxy \{0.735191637630662 0.264808362369338\} gxy \{0.215336134453781 0.774159663865546\} bxy \{0.130122950819672 0.034836065573770\} wxy \{0.3457 0.3585\} src_colorspace_name \{BestRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ D60" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.32162624 0.337737\} src_colorspace_name \{XYZ D60\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ D65" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.3127 0.329\} src_colorspace_name \{XYZ D65\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ E" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.333333333333 0.333333333333\}  src_colorspace_name \{XYZ E\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()"}}
 addUserKnob {12 rxy l r t "Red xy chromaticity coordinates in CIE 1931 colorspace."}
 rxy {{parent.RenderingPrimaries.drxy} {parent.RenderingPrimaries.drxy}}
 addUserKnob {12 gxy l g t "Green xy chromaticity coordinates in CIE 1931 colorspace."}
 gxy {{parent.RenderingPrimaries.dgxy} {parent.RenderingPrimaries.dgxy}}
 addUserKnob {12 bxy l b t "Blue xy chromaticity coordinates in CIE 1931 colorspace."}
 bxy {{parent.RenderingPrimaries.dbxy} {parent.RenderingPrimaries.dbxy}}
 addUserKnob {12 wxy l w t "Whitepoint xy chromaticity coordinates in CIE 1931 colorspace."}
 wxy {{parent.RenderingPrimaries.dwxy} {parent.RenderingPrimaries.dwxy}}
 addUserKnob {1 src_colorspace_name l src +DISABLED}
 src_colorspace_name ACEScg
 addUserKnob {26 ""}
 addUserKnob {26 dst_gamut_chromaticities_label l " " T "DST Gamut Chromaticity Coordinates"}
 addUserKnob {35 dst_presets l preset M {gamut/ACES "knobs this \{drxy \{0.73470 0.26530\} dgxy \{0.00000 1.00000\} dbxy \{0.00010 -0.07700\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{ACES\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ACEScg "knobs this \{drxy \{0.713 0.293\} dgxy \{0.165 0.830\} dbxy \{0.128 0.044\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{ACEScg\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Filmlight E-Gamut" "knobs this \{ drxy \{0.8 0.3177\} dgxy \{0.18 0.9\} dbxy \{0.065 -0.0805\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Filmlight E-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/DaVinci WG" "knobs this \{ drxy \{0.8 0.3130\} dgxy \{0.1682 0.9877\} dbxy \{0.079 -0.1155\} dwxy \{0.3127 0.329\} dst_colorspace_name \{DaVinci WG\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/Rec709 "knobs this \{drxy \{0.64000 0.33000\} dgxy \{0.30000 0.60000\} dbxy \{0.15000 0.06000\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Rec709\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/Rec2020 "knobs this \{drxy \{0.70800 0.29200\} dgxy \{0.17000 0.79700\} dbxy \{0.13100 0.04600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Rec2020\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3D60 "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{P3D60\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3D65 "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.3127 0.329\} dst_colorspace_name \{P3D65\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/P3DCI "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.314 0.351\} dst_colorspace_name \{P3DCI\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Arri AlexaWideGamut" "knobs this \{drxy \{0.68400 0.31300\} dgxy \{0.22100 0.84800\} dbxy \{0.08610 -0.10200\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Arri AlexaWideGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDDRAGONcolor "knobs this \{drxy \{0.753044222785 0.327830576682\} dgxy \{0.299570228481 0.700699321956\} dbxy \{0.079642066735 -0.0549379510888\} dwxy \{0.321683187724 0.337673316035\} dst_colorspace_name \{REDDRAGONcolor\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDDRAGONcolor2 "knobs this \{drxy \{0.753044491143 0.327831029513\} dgxy \{0.299570490451 0.700699415614\} dbxy \{0.145011584278 0.0510971250879\} dwxy \{0.321683210353 0.337673610062\} dst_colorspace_name \{REDDRAGONcolor2\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor "knobs this \{drxy \{0.699747001291 0.329046930313\} dgxy \{0.304264039024 0.623641145129\} dbxy \{0.134913961296 0.0347174412813\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor2 "knobs this \{drxy \{0.878682510476 0.32496400741\} dgxy \{0.300888714367 0.679054755791\} dbxy \{0.0953986946056 -0.0293793268343\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor2\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor3 "knobs this \{drxy \{0.701181035906 0.329014155583\} dgxy \{0.300600304652 0.683788834269\} dbxy \{0.108154455624 -0.00868817578666\} dwxy \{0.321683210353 0.337673610062\} dst_colorspace_name \{REDcolor3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDcolor4 "knobs this \{drxy \{0.701180591892 0.329013699116\} dgxy \{0.300600395529 0.683788824257\} dbxy \{0.145331946229 0.0516168036226\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor4\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/REDWideGamutRGB "knobs this \{drxy \{0.780308 0.304253\} dgxy \{0.121595 1.493994\} dbxy \{0.095612 -0.084589\} dwxy \{0.3127 0.329\} dst_colorspace_name \{REDWideGamutRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/GoPro Protune Native" "knobs this \{drxy \{0.69848046 0.19302645\} dgxy \{0.32955538 1.02459662\} dbxy \{0.10844263 -0.03467857\} dwxy \{0.3127 0.329\} dst_colorspace_name \{GoPro Protune Native\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/CanonCinemaGamut "knobs this \{drxy \{0.74 0.27\} dgxy \{0.17 1.14\} dbxy \{0.08 -0.1\} dwxy \{0.3127 0.329\} dst_colorspace_name \{CanonCinemaGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SonySGamut "knobs this \{drxy \{0.73 0.28\} dgxy \{0.14 0.855\} dbxy \{0.1 -0.05\} dwxy \{0.3127 0.329\} dst_colorspace_name \{SonySGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SonySGamut3Cine "knobs this \{drxy \{0.766 0.275\} dgxy \{0.225 0.8\} dbxy \{0.089 -0.087\} dwxy \{0.3127 0.329\} dst_colorspace_name \{SonySGamut3Cine\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/PanasonicVGamut "knobs this \{drxy \{0.730 0.280\} dgxy \{0.165 0.840\} dbxy \{0.100 -0.030\} dwxy \{0.3127 0.329\} dst_colorspace_name \{PanasonicVGamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/DJI D-Gamut" "knobs this \{drxy \{0.71 0.31\} dgxy \{0.21 0.88\} dbxy \{0.09 -0.08\} dwxy \{0.3127 0.329\} dst_colorspace_name \{DJI D-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/Fujifilm F-Gamut" "knobs this \{drxy \{0.70800 0.29200\} dgxy \{0.17000 0.79700\} dbxy \{0.13100 0.04600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Fujifilm F-Gamut\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMDFilmV1 "knobs this \{drxy \{0.9173 0.2502\} dgxy \{0.2833 1.7072\} dbxy \{0.0856 -0.0708\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMDFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD4kFilmV1 "knobs this \{drxy \{0.7422 0.2859\} dgxy \{0.4140 1.3035\} dbxy \{0.0342 -0.0833\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMD4kFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD4kFilmV3 "knobs this \{drxy \{1.0625 0.3948\} dgxy \{0.3689 0.7775\} dbxy \{0.0956 -0.0332\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMD4kFilmV3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD46kFilmV1 "knobs this \{drxy \{0.9175 0.2983\} dgxy \{0.2983 1.2835\} dbxy \{0.0756 -0.0860\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMD46kFilmV1\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMD46kFilmV3 "knobs this \{drxy \{0.8608 0.3689\} dgxy \{0.3282 0.6156\} dbxy \{0.0783 -0.0233\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMD46kFilmV3\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BMDWideGamutV4 "knobs this \{drxy \{0.7177 0.3171\} dgxy \{0.2280 0.8616\} dbxy \{0.1006 -0.0820\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMDWideGamutV4\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/AdobeRGB\t" "knobs this \{drxy \{0.6400 0.3300\} dgxy \{0.2100 0.7100\} dbxy \{0.1500 0.0600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{AdobeRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/AdobeWideGamutRGB "knobs this \{drxy \{0.7347 0.2653\} dgxy \{0.1152 0.8264\} dbxy \{0.1566 0.0177\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{AdobeWideGamutRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ROMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01  8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{ROMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/RIMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01 8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{RIMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ERIMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01 8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{ERIMM\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/ProPhotoRGB "knobs this \{drxy \{0.734699 0.265301\} dgxy \{0.159597 0.840403\} dbxy \{0.036598 0.000105\} dwxy \{0.345704 0.358540\} dst_colorspace_name \{ProPhotoRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/RusselRGB "knobs this \{drxy \{0.6900 0.3100\} dgxy \{0.1800 0.7700\} dbxy \{0.1000 0.0200\} dwxy \{0.33243 0.34744\} dst_colorspace_name \{RusselRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/SharpRGB "knobs this \{drxy \{0.6898 0.3206\} dgxy \{0.0736 0.9003\} dbxy \{0.1166 0.0374\} dwxy \{0.33333333 0.33333333\} dst_colorspace_name \{SharpRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/AppleRGB "knobs this \{drxy \{0.6250 0.3400\} dgxy \{0.2800 0.5950\} dbxy \{0.1550 0.0700\} dwxy \{0.3127 0.329\} dst_colorspace_name \{AppleRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" gamut/BestRGB "knobs this \{drxy \{0.735191637630662 0.264808362369338\} dgxy \{0.215336134453781 0.774159663865546\} dbxy \{0.130122950819672 0.034836065573770\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{BestRGB\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ D60" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.32162624 0.337737\} dst_colorspace_name \{XYZ D60\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ D65" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.3127 0.329\} dst_colorspace_name \{XYZ D65\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()" "gamut/XYZ E" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.333333333333 0.333333333333\}  dst_colorspace_name \{XYZ E\}\}; python -exec nuke.thisNode().knob('calculate_matrix').execute()"}}
 addUserKnob {12 drxy l r t "Red xy chromaticity coordinates in CIE 1931 colorspace."}
 drxy {0.64 0.33}
 addUserKnob {12 dgxy l g t "Green xy chromaticity coordinates in CIE 1931 colorspace."}
 dgxy {0.3 0.6}
 addUserKnob {12 dbxy l b t "Blue xy chromaticity coordinates in CIE 1931 colorspace."}
 dbxy {0.15 0.06}
 addUserKnob {12 dwxy l w t "Whitepoint xy chromaticity coordinates in CIE 1931 colorspace."}
 dwxy {0.3127 0.329}
 addUserKnob {1 dst_colorspace_name l dst +DISABLED}
 dst_colorspace_name Rec709
 addUserKnob {26 ""}
 addUserKnob {26 chromatic_adaptation_label l " " T "Chromatic Adaptation"}
 addUserKnob {4 cat_method l method t "Choose the chromatic adaptation method for adapting whitepoint." M {cat02 bradford cmccat2000 xyz_scaling none "" fairchild bianco cat02_brill_cat bianco_pc cmccat97 sharp von_kries "" ""}}
 addUserKnob {26 ""}
 addUserKnob {6 invert t "Invert direction of matrix." +STARTLINE}
 addUserKnob {22 calculate_matrix l "Calculate Matrix" t "Calculate 3x3 matrix based on the specified colorspace chromaticities." T "import nuke\nfloat3 = nuke.math.Vector3\nfloat3x3 = nuke.math.Matrix3\n\n\ndef transpose(m):\n    # Transpose (swap rows and columns) of a nuke.math.Matrix3\n    return float3x3(m\[0], m\[1], m\[2], m\[3], m\[4], m\[5], m\[6], m\[7], m\[8])\n\ndef set_matrix(m):\n    # Populate a nuke.math.Matrix3 with a 3x3 python list (either 3x3 or 1x9)\n    if len(m) is 3 and \[isinstance(r, list) for r in m]:\n        m = sum(m, \[])\n    o = float3x3(m\[0], m\[3], m\[6], m\[1], m\[4], m\[7], m\[2], m\[5], m\[8])\n    return o\n\ndef diag(v):\n    # Create a diagonal 3x3 matrix from a 1x3 vector\n    return float3x3(v\[0], 0, 0, 0, v\[1], 0, 0, 0, v\[2])\n\n\ndef xyY_to_XYZ(xyY):\n    # Convert an xyY chromaticity value to XYZ\n    x = xyY\[0]\n    y = xyY\[1]\n    if len(xyY) is 2:\n        # Assume an xy chromaticity coordinate, use default Y\n        Y = 1.0\n    else:\n        Y = xyY\[2]\n    XYZ = float3(x * Y / max(y, 1e-10), Y, (1.0 - x - y) * Y / max(y, 1e-10))\n    return XYZ\n\ndef xy_to_xyz(xy):\n    return float3(xy\[0], xy\[1], 1.0 - xy\[0] - xy\[1])\n\n\ndef calc_cat(src_xy, dst_xy, cat_method='cat02'):\n    # Calculate Von Kries chromatic adaptation transform matrix,\n    # given a source and destination illuminant and CAT method.\n    # Illuminant is given as xy chromaticity coordinates. \n    # CAT method is the name of one of the below cone response matrices.\n\n    crmtxs = \{\n        \"bianco\": \[\[0.8752, 0.2787, -0.1539], \[-0.8904, 1.8709, 0.0195], \[-0.0061, 0.0162, 0.9899]],\n        \"bianco_pc\": \[\[0.6489, 0.3915, -0.0404], \[-0.3775, 1.3055, 0.072], \[-0.0271, 0.0888, 0.9383]],\n        \"bradford\": \[\[0.8951, 0.2664, -0.1614], \[-0.7502, 1.7135, 0.0367], \[0.0389, -0.0685, 1.0296]],\n        \"cat02\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.003, 0.0136, 0.9834]],\n        \"cat02_brill_cat\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.0, 0.0, 1.0]],\n        \"cmccat2000\": \[\[0.7982, 0.3389, -0.1371], \[-0.5918, 1.5512, 0.0406], \[0.0008, 0.0239, 0.9753]],\n        \"cmccat97\": \[\[0.8951, -0.7502, 0.0389], \[0.2664, 1.7135, 0.0685], \[-0.1614, 0.0367, 1.0296]],\n        \"fairchild\": \[\[0.8562, 0.3372, -0.1934], \[-0.836, 1.8327, 0.0033], \[0.0357, -0.0469, 1.0112]],\n        \"sharp\": \[\[1.2694, -0.0988, -0.1706], \[-0.8364, 1.8006, 0.0357], \[0.0297, -0.0315, 1.0018]],\n        \"von_kries\": \[\[0.40024, 0.7076, -0.08081], \[-0.2263, 1.16532, 0.0457], \[0.0, 0.0, 0.91822]],\n        \"xyz_scaling\": \[\[1.0, 0.0, 0.0], \[0.0, 1.0, 0.0], \[0.0, 0.0, 1.0]]\n    \}\n    \n    cat_method = cat_method.lower().replace(' ', '_')\n    # Return identity matrix if no match\n    if cat_method not in crmtxs.keys():\n        m = float3x3()\n        m.makeIdentity()\n        return m\n        \n    crmtx = set_matrix(crmtxs\[cat_method])\n\n    # Get XYZ values from xy chromaticity coordinates\n    src_XYZ = xyY_to_XYZ(src_xy)\n    dst_XYZ = xyY_to_XYZ(dst_xy)\n\n    # Calculate source and destination cone response matrices\n    src_crmtx = transpose(crmtx) * src_XYZ\n    dst_crmtx = transpose(crmtx) * dst_XYZ\n\n    von_kries_matrix = diag(dst_crmtx / src_crmtx)\n    cat_mtx = float3x3()\n    cat_mtx = crmtx * (von_kries_matrix * crmtx.inverse())\n\n    return cat_mtx\n\n\ndef calc_npm(chr):\n    # Calculate a normalized primaries matrix from the specified chromaticity coordinates,\n    # given 2x4 list of xy chromaticity coordinates: red, green, blue, and white\n    rxyz, gxyz, bxyz, wxyz = map(xy_to_xyz, chr)\n    wy = chr\[3]\[1]\n    wxyz = float3(wxyz.x / wy, wxyz.y / wy, wxyz.z / wy)\n    np_mtx = float3x3(rxyz\[0], gxyz\[0], bxyz\[0],\n                      rxyz\[1], gxyz\[1], bxyz\[1],\n                      rxyz\[2], gxyz\[2], bxyz\[2])\n    wscale = np_mtx.inverse() * wxyz \n    np_mtx = transpose(np_mtx * diag(wscale))\n    return np_mtx\n\ndef is_xyz(c):\n    # return true if primaries are XYZ\n    return c\[:3] == \[\[1.0, 0.0], \[0.0, 1.0], \[0.0, 0.0]]\n\n\ndef start(node):\n    identity_mtx = float3x3()\n    identity_mtx.makeIdentity()\n\n    invert = node\['invert'].getValue()\n    cat_method = node\['cat_method'].value()\n\n    src_chr = \[node\[k].getValue() for k in \['rxy', 'gxy', 'bxy', 'wxy']]\n    dst_chr = \[node\[k].getValue() for k in \['drxy', 'dgxy', 'dbxy', 'dwxy']]\n\n    # bypass double scale if source or destination is XYZ\n    if is_xyz(src_chr):\n        rgb_to_xyz = identity_mtx\n    else:\n        rgb_to_xyz = calc_npm(src_chr)\n    \n    if is_xyz(dst_chr):\n        xyz_to_rgb = identity_mtx\n    else:\n        xyz_to_rgb = calc_npm(dst_chr).inverse()\n\n    if src_chr\[3] == dst_chr\[3]:\n        cat_mtx = identity_mtx\n    else:\n        cat_mtx = calc_cat(src_chr\[3], dst_chr\[3], cat_method)\n\n    mtx = (rgb_to_xyz * cat_mtx) * xyz_to_rgb\n\n    if invert:\n        mtx = mtx.inverse()\n\n    node\['matrix'].setValue(mtx)\n\n\nif __name__=='__main__':\n    start(nuke.thisNode())" +STARTLINE}
 addUserKnob {22 create_matrix_node l "Create Matrix" t "Create ColorMatrix node with the current values." -STARTLINE T "node = nuke.thisNode()\nnode\['calculate_matrix'].execute()\nnuke.root().begin()\n_ = \[n.setSelected(False) for n in nuke.allNodes(recurseGroups=True)]\nm = nuke.createNode('ColorMatrix')\nm\['matrix'].setValue(node\['matrix'].getValue())\nm.setXYpos(node.xpos()-120, node.ypos())\nsrc_name = node\['src_colorspace_name'].getValue()\ndst_name = node\['dst_colorspace_name'].getValue()\nif node\['invert'].getValue():\n    label = '\{1\} to \{0\}'.format(src_name, dst_name)\nelse:\n    label = '\{0\} to \{1\}'.format(src_name, dst_name)\nm\['label'].setValue(label)"}
 addUserKnob {41 matrix T ColorMatrix.matrix}
 addUserKnob {22 clear l Clear T "n = nuke.thisNode()\nn\['matrix'].setValue(\[1,0,0,0,1,0,0,0,1])\nn\['label'].setValue('')" +STARTLINE}
 addUserKnob {22 show_matrix l Show t "Show matrix values in a popup window for copying." T "node = nuke.thisNode()\nshow_4x4 = node\['show_matrix_4x4'].getValue()\nshow_commas = node\['show_matrix_commas'].getValue()\n\nif show_commas:\n    sep = ', '\nelse:\n    sep = ' '\n\nmtx = \[format(i, '.8f') for i in node\['matrix'].getValue()]\n\nif show_4x4:\n    z = \['0']\n    mtx = mtx\[0:3] + z + mtx\[3:6] + z + mtx\[6:9] + z*4 + \['1']\n\nnuke.message(sep.join(mtx))" +STARTLINE}
 addUserKnob {6 show_matrix_4x4 l "show 4x4" t "present values in a 4x4 matrix (useful for ocio)" -STARTLINE}
 addUserKnob {6 show_matrix_commas l "show comma sep" t "show matrix comma separated." -STARTLINE}
 addUserKnob {22 save_spimtx l "Save spimtx" T "# inspired by ColorMatrixPlus by hpd\ndef write_spimtx(mtx_node, spimtx_file):\n    mtx_vals = mtx_node\['matrix'].getValue()\n    with open(spimtx_file, \"w\") as f:\n        f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n            mtx_vals\[0], mtx_vals\[1], mtx_vals\[2]) )\n        f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n            mtx_vals\[3], mtx_vals\[4], mtx_vals\[5]) )\n        f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n            mtx_vals\[6], mtx_vals\[7], mtx_vals\[8]) )\n\nnode = nuke.thisNode()\nfilepath = nuke.getFilename('Save Matrix', '*.spimtx')\n\nif filepath:\n    if not filepath.endswith('.spimtx'):\n        filepath = filepath + '.spimtx'\n    write_spimtx(node, filepath)" +STARTLINE}
 addUserKnob {22 load_spimtx l "Load spimtx" -STARTLINE T "# Inspired by ColorMatrixPlus by hpd\ndef load_spimtx(spimtx, mtx_node):\n    with open( spimtx, 'r') as file:\n        lines = file.readlines()\n    matrix_values = list()\n    for line in lines:\n        matrix_values.extend( map(float, line.strip().split(' ')\[0:3]) )\n    mtx_node\['matrix'].setValue(matrix_values)\n\nspimtx = nuke.getFilename('Load SPIMTX', '*.spimtx')\nif spimtx:\n    load_spimtx( spimtx, nuke.thisNode() )\n"}
}
 Input {
  inputs 0
  name Input
  xpos -40
  ypos 206
 }
 ColorMatrix {
  matrix {
      {2.00240469 -0.950789392 -0.05161637068}
      {-0.2615073025 1.533845305 -0.2723381221}
      {-0.0862056464 -0.21917817 1.305384159}
    }
  name ColorMatrix
  xpos -40
  ypos 254
 }
 Output {
  name Output
  xpos -40
  ypos 302
 }
end_group
Group {
 name Saturation1
 xpos 1922
 ypos 427
 addUserKnob {20 Saturation}
 addUserKnob {4 method M {weighted maximum average ""}}
 addUserKnob {35 weight_presets l "" +STARTLINE M {weights/ACEScg "knobs this \{w \{0.26806405 0.67246455 0.05947147\}\}" weights/Rec.2020 "knobs this \{w \{0.26270026 0.67799819 0.05930173\}\}" weights/P3D65 "knobs this \{w \{0.22897467 0.69173867 0.07928693\}\}" weights/Rec.709 "knobs this \{w \{0.21263911 0.71516877 0.07219233\}\}" ""}}
 addUserKnob {78 w l "" t "luminance weighting" -STARTLINE n 3}
 w {0.21263911 0.71516877 0.07219233}
 addUserKnob {7 s l saturation R 0 4}
 s 1
}
 Input {
  inputs 0
  name Input
  xpos 290
  ypos 620
 }
 Expression {
  temp_name3 L
  temp_expr3 method==0?w.0*r+w.1*g+w.2*b:method==1?max(r,g,b):method==2?(r+g+b)/3:0
  expr0 L*(1-s)+r*s
  expr1 L*(1-s)+g*s
  expr2 L*(1-s)+b*s
  expr3 L
  name Expression
  xpos 290
  ypos 681
 }
 Output {
  name Output
  xpos 290
  ypos 740
 }
end_group
Group {
 name InverseEOTF5
 label "\[value eotf]"
 xpos 1922
 ypos 481
 addUserKnob {20 EOTF_tab l EOTF}
 addUserKnob {4 eotf t "Choose the inverse EOTF to apply for the target display device." M {None "sRGB Display" BT.1886 "Gamma 2.6" PQ HLG "" "" "" ""}}
 eotf BT.1886
}
 Input {
  inputs 0
  name Input
  xpos 400
  ypos -160
 }
 Dot {
  name Dot1
  xpos 434
  ypos -96
 }
set Ne27e2b00 [stack 0]
 Dot {
  name Dot3
  xpos 544
  ypos -96
 }
set Ne27e2400 [stack 0]
 Dot {
  name Dot4
  xpos 654
  ypos -96
 }
 Multiply {
  channels rgb
  value 10
  name Multiply1
  label "scale input 0.1x for 1000 nit match between PQ and HLG"
  xpos 620
  ypos -76
 }
 Expression {
  temp_name0 Yd
  temp_expr0 0.2627*r+0.6780*g+0.0593*b
  expr0 r*pow(Yd,(1-_g)/_g)
  expr1 g*pow(Yd,(1-_g)/_g)
  expr2 b*pow(Yd,(1-_g)/_g)
  name HLG_InverseOOTF
  xpos 620
  ypos -40
  addUserKnob {20 CONSTANTS_tab l CONSTANTS}
  addUserKnob {7 _g t "Gamma: Extended model for gamma variation according to peak display luminance and surround luminance: BT.2390-8 p32" R 0 2}
  _g {{1.2*pow(1.111,log(Lw/1000)/log(2))*pow(0.98,log(max(1e-6,Lamb)/5)/log(2))}}
  addUserKnob {7 Lw R 600 4000}
  Lw 1000
  addUserKnob {7 Lamb t "ambient luminance level in nits" R 0 200}
  Lamb 5
 }
 Expression {
  expr0 r<=1/12?sqrt(3*r):_a*log(12*r-_b)+_c
  expr1 g<=1/12?sqrt(3*g):_a*log(12*g-_b)+_c
  expr2 b<=1/12?sqrt(3*b):_a*log(12*b-_b)+_c
  name HLG_OETF
  xpos 620
  ypos -10
  addUserKnob {20 CONSTANTS_tab l CONSTANTS}
  addUserKnob {7 _a t alpha}
  _a 0.17883277
  addUserKnob {7 _b t beta}
  _b {{1-4*_a}}
  addUserKnob {7 _c}
  _c {{0.5-_a*log(4*_a)}}
 }
push $Ne27e2400
 Expression {
  expr0 pow((c_1+c_2*pow(r*Lw/10000,m_1))/(1+c_3*pow(r*Lw/10000,m_1)),m_2)
  expr1 pow((c_1+c_2*pow(g*Lw/10000,m_1))/(1+c_3*pow(g*Lw/10000,m_1)),m_2)
  expr2 pow((c_1+c_2*pow(b*Lw/10000,m_1))/(1+c_3*pow(b*Lw/10000,m_1)),m_2)
  name ST2084_InverseEOTF
  xpos 510
  ypos -70
  addUserKnob {20 CONSTANTS_tab l CONSTANTS}
  addUserKnob {7 m_1}
  m_1 {{2610/4096*(1/4)}}
  addUserKnob {7 m_2}
  m_2 {{2523/4096*128}}
  addUserKnob {7 c_1}
  c_1 {{107/128}}
  addUserKnob {7 c_2}
  c_2 {{2413/128}}
  addUserKnob {7 c_3}
  c_3 {{2392/128}}
  addUserKnob {7 Lw t "Display peak luminance in nits" R 600 4000}
  Lw 10000
 }
push $Ne27e2b00
 Expression {
  expr0 sign(r)*pow(fabs(r),1/p)
  expr1 sign(g)*pow(fabs(g),1/p)
  expr2 sign(b)*pow(fabs(b),1/p)
  name power
  xpos 400
  ypos -70
  addUserKnob {20 Params_tab l Params}
  addUserKnob {7 p l power R 0.2 2}
  p {{eotf?2+eotf*0.2:1}}
 }
 Switch {
  inputs 3
  which {{max(0,eotf-3)}}
  name SwitchInverseEOTF
  xpos 400
  ypos -10
 }
 Output {
  name Output
  xpos 400
  ypos 80
 }
end_group
Dot {
 name Dot25
 note_font "Helvetica Bold"
 note_font_size 24
 note_font_color 0xff
 xpos 1956
 ypos 611
}
StickyNote {
 inputs 0
 name StickyNote11
 tile_color 0x272727ff
 label "
\n8).  Or, if desired you can adjust saturation of specific primaries \n      using the Output CalcPrimaries node"
 note_font Helvetica
 note_font_size 8
 note_font_color 0xa8a8a8ff
 xpos 1098
 ypos 488
}
StickyNote {
 inputs 0
 name StickyNote1
 tile_color 0x272727ff
 label "
\n3).  Set DST Gamut Chromaticity Coordinates for your display device"
 note_font Helvetica
 note_font_size 8
 note_font_color 0xa8a8a8ff
 xpos 2059
 ypos 362
}
StickyNote {
 inputs 0
 name StickyNote7
 tile_color 0x272727ff
 label "
\n4).  Set Inverse EOTF for your display device"
 note_font Helvetica
 note_font_size 8
 note_font_color 0xa8a8a8ff
 xpos 2062
 ypos 479
}
StickyNote {
 inputs 0
 name StickyNote10
 tile_color 0x272727ff
 label "
\n7).  Adjust saturation to taste if desired"
 note_font Helvetica
 note_font_size 8
 note_font_color 0xa8a8a8ff
 xpos 2033
 ypos 419
}
StickyNote {
 inputs 0
 name StickyNote8
 tile_color 0x272727ff
 label "
\n5).  Connect viewer to this node"
 note_font Helvetica
 note_font_size 8
 note_font_color 0xa8a8a8ff
 xpos 1885
 ypos 565
}
StickyNote {
 inputs 0
 name StickyNote9
 tile_color 0x272727ff
 label "
\n6).  Press Ctrl+i to create a 2nd viewer, and connect it here.\n      Adjust the 2d coordinates.\n     for r, g, b to set the primaries for the rendering gamut.\n     if you need a reference  for position you can set the pink node to\n     one of it's presets."
 note_font Helvetica
 note_font_size 8
 note_font_color 0xa8a8a8ff
 xpos 1294
 ypos 289
}
Constant {
 inputs 0
 color 1
 format "2048 2048 0 0 2048 2048 1 square_2K"
 name Constant2
 note_font Helvetica
 xpos 1208
 ypos -115
 postage_stamp false
}
Expression {
 temp_name0 n
 temp_expr0 input.width/8
 channel0 {rgba.red rgba.green rgba.blue none}
 expr0 x/width*(1-y/height)
 channel3 alpha
 expr3 1
 name Expression7
 xpos 1208
 ypos -86
}
Expression {
 temp_name0 start
 temp_expr0 360
 temp_name1 end
 temp_expr1 830
 channel0 {rgba.red rgba.green rgba.blue none}
 expr0 r*(end-start)+start
 channel1 none
 channel2 none
 expr3 1
 name Expression2
 xpos 1208
 ypos -56
}
ColorLookup {
 lut {master {}
   red {curve x360 0.0001299 C 0.00014585 0.0001638 0.000184 0.00020669 0.0002321 0.00026073 0.00029307 0.00032939 0.00036991 0.0004149 0.00046416 0.00051899 0.00058185 0.00065523 0.0007416 0.00084503 0.00096453 0.00109495 0.00123115 0.001368 0.00150205 0.00164233 0.00180238 0.00199576 0.002236 0.00253539 0.0028926 0.00330083 0.00375324 0.004243 0.00476239 0.00533005 0.00597871 0.00674112 0.00765 0.00875137 0.01002888 0.0114217 0.01286901 0.01431 0.01570443 0.01714744 0.01878122 0.02074801 0.02319 0.02620736 0.02978248 0.03388092 0.03846824 0.04351 0.0489956 0.0550226 0.0617188 0.069212 0.07763 0.08695811 0.09717672 0.1084063 0.1207672 0.13438 0.1493582 0.16539571 0.1819831 0.19861101 0.21477 0.23018681 0.24487969 0.25877729 0.27180791 0.28389999 0.29494381 0.3048965 0.31378731 0.32164541 0.3285 0.3343513 0.33921009 0.34312129 0.3461296 0.34828001 0.3495999 0.3501474 0.35001299 0.349287 0.34806001 0.34637329 0.34426239 0.3418088 0.3390941 0.3362 0.33319771 0.33004111 0.32663569 0.32288679 0.31869999 0.3140251 0.30888399 0.3032904 0.2972579 0.29080001 0.28397009 0.27672139 0.2689178 0.26042271 0.2511 0.2408475 0.2298512 0.2184072 0.2068115 0.19536 0.18421359 0.1733273 0.16268811 0.1522833 0.14210001 0.1321786 0.1225696 0.1132752 0.1042979 0.09564 0.08729955 0.07930804 0.07171776 0.06458099 0.05795001 0.05186211 0.04628152 0.04115088 0.03641283 0.03201 0.0279172 0.0241444 0.020687 0.0175404 0.0147 0.01216179 0.00991996 0.00796724 0.00629635 0.0049 0.00377717 0.00294532 0.00242488 0.00223629 0.0024 0.00292552 0.00383656 0.00517484 0.00698208 0.0093 0.01214949 0.01553588 0.01947752 0.02399277 0.0291 0.03481485 0.04112016 0.04798504 0.05537861 0.06327 0.07163501 0.08046224 0.08973996 0.09945645 0.1096 0.1201674 0.1311145 0.1423679 0.15385421 0.1655 0.17725711 0.18914001 0.2011694 0.21336579 0.2257499 0.2383209 0.2510668 0.26399219 0.2771017 0.2904 0.30389121 0.31757259 0.33143839 0.3454828 0.35969999 0.37408391 0.3886396 0.4033784 0.41831151 0.43344989 0.44879529 0.46433601 0.480064 0.49597129 0.51205009 0.52829587 0.54469162 0.56120938 0.57782149 0.59450001 0.6112209 0.62797582 0.64476019 0.66156971 0.67839998 0.69523919 0.7120586 0.72882837 0.7455188 0.76209998 0.77854317 0.79482561 0.81092638 0.82682478 0.84249997 0.85793251 0.87308162 0.88789439 0.90231812 0.9163 0.9297995 0.94279838 0.95527762 0.96721792 0.97860003 0.9893856 0.99954879 1.00908923 1.01800644 1.02629995 1.03398275 1.04098594 1.04718804 1.05246675 1.05669999 1.05979443 1.06179917 1.06280684 1.0629096 1.06219995 1.06073523 1.05844355 1.05522442 1.05097675 1.04560006 1.03903687 1.03136074 1.02266622 1.0130477 1.00259995 0.99136752 0.97933137 0.96649158 0.9528479 0.93839997 0.92319399 0.90724403 0.89050198 0.87291998 0.85444993 0.83508402 0.814946 0.794186 0.77295399 0.75139999 0.72958362 0.70758879 0.68560219 0.66381037 0.64240003 0.62151492 0.6011138 0.58110517 0.56139767 0.54189998 0.52259952 0.50354642 0.4847436 0.46619391 0.4479 0.42986131 0.41209799 0.39464399 0.37753329 0.3608 0.34445629 0.32851681 0.31301919 0.29800111 0.28349999 0.26954481 0.25611839 0.2431896 0.2307272 0.21870001 0.2070971 0.19592319 0.1851708 0.1748323 0.1649 0.1553667 0.14623 0.13749 0.1291467 0.1212 0.1136397 0.106465 0.09969044 0.09333061 0.0874 0.08190096 0.07680428 0.07207712 0.06768664 0.0636 0.05980685 0.05628216 0.05297104 0.04981861 0.04677 0.04378405 0.04087536 0.03807264 0.03540461 0.0329 0.03056419 0.02838056 0.02634484 0.02445275 0.0227 0.02108429 0.01959988 0.01823732 0.01698717 0.01584 0.01479064 0.01383132 0.01294868 0.0121292 0.01135916 0.01062935 0.00993885 0.00928842 0.00867885 0.00811092 0.00758239 0.00708875 0.00662731 0.00619541 0.00579035 0.00540983 0.00505258 0.00471751 0.00440351 0.00410946 0.00383391 0.00357575 0.00333434 0.00310907 0.00289933 0.00270435 0.00252302 0.00235417 0.00219662 0.00204919 0.00191096 0.00178144 0.00166011 0.00154646 0.00143997 0.00134004 0.00124628 0.00115847 0.00107643 0.00099995 0.00092874 0.00086243 0.00080075 0.0007434 0.00069008 0.00064052 0.0005945 0.00055186 0.00051243 0.00047602 0.00044245 0.00041151 0.00038298 0.00035665 0.0003323 0.00030976 0.00028889 0.00026954 0.00025157 0.00023483 0.00021917 0.00020453 0.00019084 0.00017807 0.00016615 0.00015502 0.00014462 0.00013491 0.00012585 0.00011741 0.00010955 0.00010222 9.539e-05 8.902e-05 8.308e-05 7.751e-05 7.231e-05 6.746e-05 6.293e-05 5.871e-05 5.477e-05 5.11e-05 4.768e-05 4.449e-05 4.151e-05 3.873e-05 3.614e-05 3.372e-05 3.146e-05 2.935e-05 2.738e-05 2.552e-05 2.379e-05 2.218e-05 2.067e-05 1.927e-05 1.797e-05 1.675e-05 1.562e-05 1.456e-05 1.357e-05 1.265e-05 1.18e-05 1.1e-05 1.025e-05 9.56e-06 8.91e-06 8.31e-06 7.75e-06 7.22e-06 6.73e-06 6.28e-06 5.85e-06 5.46e-06 5.09e-06 4.74e-06 4.42e-06 4.12e-06 3.84e-06 3.58e-06 3.34e-06 3.11e-06 2.9e-06 2.71e-06 2.52e-06 2.35e-06 2.19e-06 2.04e-06 1.91e-06 1.78e-06 1.66e-06 1.54e-06 1.44e-06 1.34e-06 S 1.25e-06}
   green {curve x360 3.92e-06 C 4.39e-06 4.93e-06 5.53e-06 6.21e-06 6.97e-06 7.81e-06 8.77e-06 9.84e-06 1.104e-05 1.239e-05 1.389e-05 1.556e-05 1.744e-05 1.958e-05 2.202e-05 2.484e-05 2.804e-05 3.153e-05 3.522e-05 3.9e-05 4.283e-05 4.691e-05 5.159e-05 5.718e-05 6.4e-05 7.234e-05 8.221e-05 9.351e-05 0.00010614 0.00012 0.00013498 0.00015149 0.00017021 0.00019182 0.000217 0.00024691 0.00028124 0.00031852 0.00035727 0.000396 0.00043371 0.00047302 0.00051788 0.00057222 0.00064 0.00072456 0.0008255 0.00094116 0.00106988 0.00121 0.00136209 0.00153075 0.00172037 0.00193532 0.00218 0.0024548 0.002764 0.0031178 0.0035264 0.004 0.00454624 0.00515932 0.00582928 0.00654616 0.0073 0.00808651 0.00890872 0.00976768 0.01066443 0.0116 0.01257317 0.01358272 0.01462968 0.01571509 0.01684 0.01800736 0.01921448 0.02045392 0.02171824 0.023 0.02429461 0.02561024 0.02695857 0.02835125 0.0298 0.03131083 0.03288368 0.03452112 0.03622571 0.038 0.03984667 0.041768 0.043766 0.04584267 0.048 0.05024368 0.05257304 0.05498056 0.05745872 0.06 0.06260197 0.06527752 0.06804208 0.07091109 0.0739 0.077016 0.0802664 0.0836668 0.0872328 0.09098 0.09491755 0.09904584 0.1033674 0.1078846 0.1126 0.117532 0.1226744 0.12799279 0.1334528 0.13902 0.1446764 0.1504693 0.15646189 0.1627177 0.1693 0.1762431 0.18355811 0.1912735 0.19941799 0.20802 0.2171199 0.2267345 0.2368571 0.2474812 0.2586 0.2701849 0.28229389 0.2950505 0.30857801 0.32300001 0.33840209 0.35468581 0.37169859 0.3892875 0.4073 0.42562991 0.44430959 0.4633944 0.48293951 0.50300002 0.52356929 0.54451197 0.56568998 0.58696532 0.60820001 0.6293456 0.65030682 0.67087519 0.69084239 0.70999998 0.72818518 0.74546361 0.76196939 0.7778368 0.79320002 0.80811042 0.82249618 0.83630681 0.8494916 0.86199999 0.87381083 0.88496238 0.89549363 0.90544319 0.91485012 0.92373478 0.93209243 0.93992257 0.94722521 0.954 0.9602561 0.96600741 0.97126061 0.97602248 0.98030001 0.98409241 0.98741817 0.99031281 0.99281162 0.99495012 0.99671078 0.99809831 0.99911201 0.99974817 1 0.99985671 0.99930459 0.99832553 0.99689871 0.995 0.9926005 0.98974258 0.98644441 0.98272407 0.97860003 0.97408372 0.96917123 0.96385682 0.95813489 0.95200002 0.94545043 0.93849921 0.93116277 0.92345762 0.91540003 0.90700638 0.89827722 0.8892048 0.8797816 0.87 0.85986131 0.849392 0.83862197 0.82758129 0.81629997 0.80479473 0.793082 0.781192 0.76915473 0.75700003 0.74475408 0.73242241 0.7200036 0.70749652 0.69489998 0.68221921 0.66947162 0.65667439 0.64384478 0.63099998 0.61815548 0.60531437 0.59247559 0.57963789 0.5668 0.5539611 0.54113722 0.5283528 0.51563227 0.50300002 0.4904688 0.47803041 0.46567759 0.4534032 0.44119999 0.42908001 0.417036 0.40503201 0.39303201 0.38100001 0.36891839 0.3568272 0.34477681 0.33281761 0.32100001 0.30933809 0.2978504 0.28659359 0.27562451 0.26499999 0.25476319 0.2448896 0.2353344 0.22605281 0.21699999 0.20816161 0.1995488 0.1911552 0.1829744 0.175 0.1672235 0.15964641 0.1522776 0.1451259 0.1382 0.1315003 0.1250248 0.1187792 0.1127691 0.107 0.1014762 0.09618864 0.09112296 0.08626485 0.0816 0.07712064 0.07282552 0.06871008 0.06476976 0.061 0.05739621 0.05395504 0.05067376 0.04754965 0.04458 0.04175872 0.03908496 0.03656384 0.03420048 0.032 0.02996261 0.02807664 0.02632936 0.02470805 0.0232 0.02180077 0.02050112 0.01928108 0.01812069 0.017 0.01590379 0.01483718 0.01381068 0.01283478 0.01192 0.01106831 0.01027339 0.00953331 0.00884616 0.00821 0.00762378 0.00708542 0.00659148 0.00613848 0.005723 0.00534306 0.0049958 0.0046764 0.00438007 0.004102 0.00383845 0.0035891 0.00335422 0.00313409 0.002929 0.00273814 0.00255988 0.00239324 0.00223728 0.002091 0.00195359 0.00182458 0.00170358 0.00159019 0.001484 0.0013845 0.00129127 0.00120409 0.00112274 0.001047 0.00097659 0.00091111 0.00085013 0.00079324 0.00074 0.00069008 0.00064331 0.0005995 0.00055845 0.00052 0.00048391 0.00045005 0.00041835 0.00038872 0.0003611 0.00033538 0.00031144 0.00028917 0.00026845 0.0002492 0.0002313 0.00021469 0.00019929 0.00018505 0.0001719 0.00015978 0.0001486 0.0001383 0.00012879 0.00012 0.00011186 0.00010432 9.734e-05 9.085e-05 8.48e-05 7.915e-05 7.386e-05 6.892e-05 6.43e-05 6e-05 5.598e-05 5.223e-05 4.872e-05 4.545e-05 4.24e-05 3.956e-05 3.692e-05 3.445e-05 3.215e-05 3e-05 2.799e-05 2.611e-05 2.436e-05 2.272e-05 2.12e-05 1.978e-05 1.845e-05 1.722e-05 1.606e-05 1.499e-05 1.399e-05 1.305e-05 1.218e-05 1.136e-05 1.06e-05 9.89e-06 9.22e-06 8.59e-06 8.01e-06 7.47e-06 6.96e-06 6.49e-06 6.05e-06 5.64e-06 5.26e-06 4.9e-06 4.57e-06 4.26e-06 3.97e-06 3.7e-06 3.45e-06 3.22e-06 3e-06 2.8e-06 2.61e-06 2.43e-06 2.27e-06 2.11e-06 1.97e-06 1.84e-06 1.71e-06 1.6e-06 1.49e-06 1.39e-06 1.29e-06 1.21e-06 1.12e-06 1.05e-06 9.8e-07 9.1e-07 8.5e-07 7.9e-07 7.4e-07 6.9e-07 6.4e-07 6e-07 5.6e-07 5.2e-07 4.8e-07 S 4.5e-07}
   blue {curve x360 0.0006061 C 0.00068088 0.00076515 0.00086001 0.00096659 0.001086 0.00122059 0.00137273 0.00154358 0.00173429 0.001946 0.00217778 0.00243581 0.00273195 0.00307806 0.003486 0.00397523 0.00454088 0.00515832 0.00580291 0.00645 0.00708322 0.00774549 0.00850115 0.00941454 0.01054999 0.0119658 0.01365587 0.01558805 0.01773015 0.02005001 0.02251136 0.02520288 0.02827972 0.03189704 0.03621 0.04143771 0.04750372 0.05411988 0.06099803 0.06785001 0.07448632 0.08136156 0.08915364 0.09854048 0.1102 0.1246133 0.1417017 0.16130351 0.1832568 0.20739999 0.23369209 0.26261139 0.29477459 0.33079851 0.37130001 0.4162091 0.4654642 0.51969481 0.5795303 0.64560002 0.71848381 0.79671329 0.87784588 0.95943898 1.0390501 1.11536729 1.18849707 1.25812328 1.32392955 1.38559997 1.44263518 1.49480355 1.54219031 1.58488071 1.62295997 1.65640485 1.68529594 1.70987451 1.73038209 1.74705994 1.76004458 1.76962328 1.77626371 1.78043342 1.78260004 1.78296816 1.78169978 1.77919817 1.7758671 1.77210998 1.76825893 1.76403904 1.7589438 1.75246632 1.74409997 1.73355949 1.7208581 1.70593691 1.68873715 1.66919994 1.64752865 1.62341273 1.59602225 1.56452799 1.52810001 1.4861114 1.43952155 1.38987994 1.33873618 1.28763998 1.23742235 1.18782425 1.13876104 1.09014797 1.04190004 0.99419761 0.94734728 0.90145308 0.8566193 0.81295007 0.77051729 0.7294448 0.68991357 0.65210491 0.61619997 0.58232862 0.55041617 0.52033758 0.49196729 0.46518001 0.4399246 0.41618359 0.39388219 0.3729459 0.35330001 0.33485779 0.31755209 0.30133751 0.28616861 0.27200001 0.25881711 0.2464838 0.2347718 0.2234533 0.2123 0.20116919 0.19011959 0.1792254 0.1685608 0.1582 0.1481383 0.1383758 0.1289942 0.1200751 0.1117 0.1039048 0.09666748 0.08998272 0.08384531 0.07824999 0.07320899 0.06867816 0.06456784 0.06078835 0.05725001 0.05390435 0.05074664 0.04775276 0.04489859 0.04216 0.03950728 0.03693564 0.03445836 0.03208872 0.02984 0.02771181 0.02569444 0.02378716 0.02198925 0.0203 0.01871805 0.01724036 0.01586364 0.01458461 0.0134 0.01230723 0.01130188 0.01037792 0.00952931 0.00875 0.0080352 0.0073816 0.0067854 0.0062428 0.00575 0.0053036 0.0048998 0.0045342 0.0042024 0.0039 0.0036232 0.0033706 0.0031414 0.0029348 0.00275 0.0025852 0.0024386 0.0023094 0.0021968 0.0021 0.00201773 0.0019482 0.0018898 0.00184093 0.0018 0.00176627 0.0017378 0.0017112 0.00168307 0.00165 0.00161013 0.0015644 0.0015136 0.00145853 0.0014 0.00133667 0.00127 0.001205 0.00114667 0.0011 0.0010688 0.0010494 0.0010356 0.0010212 0.001 0.00096864 0.00092992 0.00088688 0.00084256 0.0008 0.00076096 0.00072368 0.00068592 0.00064544 0.0006 0.00054787 0.0004916 0.0004354 0.00038347 0.00034 0.00030725 0.00028316 0.00026544 0.00025181 0.00024 0.00022955 0.00022064 0.00021196 0.00020219 0.00019 0.00017421 0.00015564 0.00013596 0.00011685 0.0001 8.613e-05 7.46e-05 6.5e-05 5.693e-05 5e-05 4.416e-05 3.948e-05 3.572e-05 3.264e-05 3e-05 2.765e-05 2.556e-05 2.364e-05 2.181e-05 2e-05 1.813e-05 1.62e-05 1.42e-05 1.213e-05 1e-05 7.73e-06 5.4e-06 3.2e-06 1.33e-06 0 0 0 0 0 0 0 0 S 0}
   alpha {}}
 name ColorLookup6
 xpos 1208
 ypos 4
}
set Ne2964f00 [stack 0]
Expression {
 expr0 y<(height-big)?0:xwidth/3*2?(x-width/3*2)/(width/3):0
 expr2 y<(height-big)?0:x>width/3&&xwidth/3*2?1-(x-width/3*2)/(width/3):0
 expr3 y<(height-big)?0:1
 name Expression10
 note_font Helvetica
 xpos 1098
 ypos 5
 addUserKnob {20 User}
 addUserKnob {7 big R 0 100}
 big 8
}
Group {
 name RGB_to_XYZ_D65_
 tile_color 0x8ab444ff
 xpos 1098
 ypos 64
 addUserKnob {20 RGB_to_XYZ_tab l RGB_to_XYZ}
 addUserKnob {4 gamut M {ACES ACEScg "Filmlight E-Gamut" "DaVinci WG" Rec709 Rec2020 P3D60 P3D65 P3DCI AdobeRGB "Arri Alexa WideGamut" REDWideGamutRGB CanonCinemaGamut SonySGamut SonySGamut3Cine BMDWideGamutV4}}
 gamut "Arri Alexa WideGamut"
 addUserKnob {41 matrix T ColorMatrix.matrix}
 addUserKnob {41 invert -STARTLINE T ColorMatrix.invert}
}
 Input {
  inputs 0
  name Input
  xpos 290
  ypos -580
 }
 Dot {
  name Dot391
  xpos 324
  ypos -516
 }
set Ne293e400 [stack 0]
 ColorMatrix {
  matrix {
      {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}}
      {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}}
      {{"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"} {"SwitchGamut.input\[value SwitchGamut.which].matrix"}}
    }
  name ColorMatrix
  note_font Helvetica
  xpos 290
  ypos -339
 }
 Output {
  name Output
  xpos 290
  ypos -250
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.638199985 0.2318339199 0.1299659461}
      {0.2680045366 0.8326835632 -0.1006879508}
      {-0.02700686455 -0.07951174676 1.106518626}
    }
  name ColorMatrix280
  label "BMDWideGamutV4 to XYZ D65"
  note_font Helvetica
  xpos 2050
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.6303120852 0.2619010508 0.1077866852}
      {0.2150758505 0.8850685358 -0.1001443267}
      {-0.02944366075 -0.02539661899 1.054840207}
    }
  name ColorMatrix279
  label "SonySGamut3Cine to XYZ D65"
  note_font Helvetica
  xpos 1940
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.7433091998 0.1355149448 0.121175684}
      {0.2709797025 0.7866065502 -0.05758608133}
      {-0.008886438794 0.004223868717 1.004662395}
    }
  name ColorMatrix278
  label "SonySGamut to XYZ D65"
  note_font Helvetica
  xpos 1830
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.753374815 0.1364434063 0.1101816669}
      {0.2612613738 0.8696424365 -0.1309035271}
      {-0.0088850623 -0.2171433568 1.226028442}
    }
  name ColorMatrix2
  label "CanonCinemaGamut to XYZ D65"
  note_font Helvetica
  xpos 1720
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.7736025453 0.07218572497 0.154211551}
      {0.2866941094 0.8429791927 -0.1296732426}
      {-0.07316493243 -0.3189391792 1.392104149}
    }
  name ColorMatrix277
  label "REDWideGamutRGB to XYZ D65"
  note_font Helvetica
  xpos 1610
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.6712647676 0.225895524 0.1028395444}
      {0.2919538021 0.8238409758 -0.11579483}
      {0.002569448669 -0.06155249104 1.058983088}
    }
  name ColorMatrix276
  label "Arri AlexaWideGamut to XYZ D65"
  note_font Helvetica
  xpos 1500
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.6067286134 0.1952306777 0.1980403513}
      {0.297344923 0.627363503 0.07529146969}
      {0.02482086048 0.06490825117 0.9102708101}
    }
  name ColorMatrix281
  label "AdobeRGB to XYZ D65"
  note_font Helvetica
  xpos 1390
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.4787762463 0.3158869743 0.2053366601}
      {0.2126924992 0.7093909383 0.07791686803}
      {0.0004741555313 0.05068216845 0.9488437176}
    }
  name ColorMatrix275
  label "P3DCI to XYZ D65"
  note_font Helvetica
  xpos 1280
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.5119343996 0.2795160115 0.2085496932}
      {0.2289746702 0.6917386651 0.07928693295}
      {-6.241469008e-10 0.04142423347 0.9585757852}
    }
  name ColorMatrix1
  label "P3D65 to XYZ D65"
  note_font Helvetica
  xpos 1170
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.5230477452 0.2702760398 0.2066760808}
      {0.234437868 0.6870626211 0.07849972695}
      {0.0004090408329 0.04529011995 0.9543009996}
    }
  name ColorMatrix274
  label "P3D60 to XYZ D65"
  note_font Helvetica
  xpos 1060
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.670160532 0.1521552503 0.1776841432}
      {0.2627002597 0.6779981852 0.05930172652}
      {-8.170549792e-10 0.0257770475 0.9742228985}
    }
  name ColorMatrix273
  label "Rec2020 to XYZ D65"
  note_font Helvetica
  xpos 950
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.4338874221 0.3762239516 0.1898886263}
      {0.2126391083 0.7151687741 0.07219232619}
      {0.01775004528 0.1094476134 0.8728022575}
    }
  name ColorMatrix272
  label "Rec709 to XYZ D65"
  note_font Helvetica
  xpos 840
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.7371433377 0.1565298587 0.10632658}
      {0.2741185129 0.8736318946 -0.1477504224}
      {-0.09087020159 -0.1266189069 1.217489123}
    }
  name ColorMatrix271
  label "DaVinci WG to XYZ D65"
  note_font Helvetica
  xpos 730
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.742166698 0.1725921929 0.08524093777}
      {0.280130744 0.820206821 -0.1003373861}
      {-0.09529476613 -0.06694526225 1.162240028}
    }
  name ColorMatrix270
  label "Filmlight E-Gamut to XYZ D65"
  note_font Helvetica
  xpos 620
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.6864269972 0.1338092536 0.179763481}
      {0.2680640519 0.6724645495 0.05947146937}
      {-0.005022625439 0.004758977331 1.000263691}
    }
  name ColorMatrix269
  label "ACEScg to XYZ D65"
  note_font Helvetica
  xpos 510
  ypos -465
 }
push $Ne293e400
 ColorMatrix {
  matrix {
      {0.9875583053 -0.006041352171 0.01848266274}
      {0.338093549 0.7272140384 -0.06530748308}
      {0.00066398934 0.000751514337 0.9985846281}
    }
  name ColorMatrix267
  label "ACES to XYZ D65"
  note_font Helvetica
  xpos 400
  ypos -465
 }
 Switch {
  inputs 16
  which {{gamut}}
  name SwitchGamut
  note_font Helvetica
  xpos 1280
  ypos -339
 }
end_group
push $Ne2964f00
Merge2 {
 inputs 2
 bbox B
 name Merge3
 note_font Helvetica
 xpos 1208
 ypos 65
}
Dot {
 name Dot22
 note_font "Helvetica Bold"
 note_font_size 24
 note_font_color 0xff
 xpos 1242
 ypos 128
}
set Ne28ccf00 [stack 0]
Colorspace {
 colorspace_in CIE-XYZ
 primary_in "Adobe (1998)"
 colorspace_out CIE-Yxy
 name Colorspace2
 label "\[value colorspace_in] -> \[value colorspace_out]"
 xpos 1318
 ypos 118
}
push $Ne28ccf00
BlinkScript {
 inputs 2
 ProgramGroup 1
 KernelDescription "2 \"PlotChromaticity_grid\" iterate pixelWise b2e7b5f8a89bdb0629aa8cc2eae387ef3436f24cb0af642eeba41235874506c4 3 \"col\" Read Random \"Yxy\" Read Random \"dst\" Write Random 6 \"padding\" Float 1 AAAAAA== \"left_margin\" Float 1 AAAAAA== \"tolerance\" Float 1 AAAAAA== \"antialias\" Bool 1 AA== \"draw_axes\" Bool 1 AA== \"grid_color\" Float 4 AAAAAAAAAAAAAAAAAAAAAA== 6 \"padding\" 1 1 \"left_margin\" 1 1 \"tolerance\" 1 1 \"antialias\" 1 1 \"draw_axes\" 1 1 \"grid_color\" 4 1 2 \"outsize\" Float 1 1 AAAAAA== \"offset\" Float 1 1 AAAAAA=="
 kernelSource "kernel PlotChromaticity_grid : public ImageComputationKernel\n\{\n  Image col;\n  Image Yxy;\n  Image dst;\n\nparam:\n  float padding;\n  float left_margin;\n  float tolerance;\n  bool antialias;\n  bool draw_axes;\n  float4 grid_color;\n\nlocal:\n  float outsize;\n  float offset;\n\n  void init() \{\n    // calculate output width and height and offset based on padding\n    outsize = float(dst.bounds.height()/padding);\n    // xy offset for margin on lower left corner\n    offset = dst.bounds.height()*left_margin;\n  \}\n\n  float gaussian(float d, float a, float expv) \{\n    return max(0.0f, exp(-a*d*d)-expv);\n  \}\n\n  float gaussian_filter(float x, float y, float r) \{\n    // return gaussian weighted distance from origin (0, 0)\n    // given coordinate (x, y) and radius r\n    float a = 1.5f; // rate falloff\n    float expv = exp(-a*r*r);\n    return gaussian(x, a, expv) * gaussian(y, a, expv);\n  \}\n\n  void write_aa(float x, float y, float4 rgb) \{\n    // skip black pixels\n    if (rgb.x == 0.0f && rgb.y == 0.0f && rgb.z == 0.0f) return;\n    \n    // size of pixel neighborhood = n*2+1 by n*2+1\n    int n = 2;\n\n    // center of neighborhood\n    int u0 = round(x);\n    int v0 = round(y);\n\n    // skip if center pixel weight is greater than tolerance\n    if ( dst.bounds.inside(u0, v0)) \{\n      if (dst(u0, v0, 3) >= tolerance) return;\n    \}\n\n    // loop over neighborhood\n    for (int j = -n; j <= n; j++) \{\n      int v = v0 + j;\n      for (int i = -n; i <= n; i++) \{\n        int u = u0 + i;\n        if ( dst.bounds.inside(u, v)) \{\n          // get filter weight for coord (u,v)\n          float w = gaussian_filter(u-x, v-y, float(n));\n          float4 c0 = dst(u, v); // existing color\n\n          // merge current color sample over existing color sample\n          for (int k=0; k<3; k++) \{\n            dst(u, v, k) = rgb\[k]*w+c0\[k]*(1-w); \n          \}\n\n          // merge current weight over existing weight\n          float w0 = dst(u, v, 3);\n          dst(u, v, 3) = w+w0*(1-w);\n        \}\n      \}\n    \}\n  \}\n\n  void draw_grid() \{\n    // grid width in pixels. expresses a 0 to 1 range in CIE xy\n    float grid_width = 1.0f * outsize + offset;\n    // draw grid lines\n    float i = offset;\n    while (i <= grid_width && i > 0.0f) \{\n      write_aa(offset, i, grid_color);\n      write_aa(i, offset, grid_color);\n      i += 1.0;\n    \}\n    // cross-hatching interval in pixels\n    float hatch_interval = (grid_width - offset) * 0.1f;\n    // cross-hatch length in pixels\n    float hatch_width = outsize * 0.01f;\n    i = offset;\n    while (i <= grid_width) \{\n      i += hatch_interval;\n      float j = 0.0;\n      while (j <= hatch_width/2) \{\n        write_aa(offset+j, i, grid_color);\n        write_aa(offset-j, i, grid_color);\n        write_aa(i, offset+j, grid_color);\n        write_aa(i, offset-j, grid_color);\n        j += 1.0;\n      \}\n    \}\n  \}\n\n  void process(int2 pos) \{\n    float4 rgba = col(pos.x, pos.y);\n    \n    // Get CIE xy position from Yxy input for current pixel\n    float2 xy = float2(Yxy(pos.x, pos.y, 1), Yxy(pos.x, pos.y, 2));\n    \n    // Find output pixel coordinate for this CIE xy pixel value\n    float2 out_coord = float2(xy.x * outsize + offset, xy.y * outsize + offset);\n\n    // For each RGB component, write value from color input to output coordinate\n    if (antialias) \{\n      write_aa(out_coord.x, out_coord.y, rgba);\n    \} else \{\n      // For each RGB component, write value from color input to output coordinate\n      int2 p = int2(round(out_coord.x), round(out_coord.y));\n      if (dst.bounds.inside(p.x, p.y)) \{\n        for (int k=0; k<3; k++) \{\n          dst(p.x, p.y, k) = col(pos.x, pos.y, k);\n        \}\n        dst(p.x, p.y, 3) = 1.0f;\n      \}\n    \}\n\n    // draw CIExy coordinate system axes\n    if (draw_axes && pos.x == 0 && pos.y == 0) \{\n      draw_grid();\n    \}\n  \}\n\};"
 useGPUIfAvailable {{parent.use_gpu}}
 rebuild ""
 PlotChromaticity_grid_padding 1
 PlotChromaticity_grid_left_margin 0.1
 PlotChromaticity_grid_tolerance 1
 PlotChromaticity_grid_antialias true
 PlotChromaticity_grid_draw_axes true
 PlotChromaticity_grid_grid_color 0.14
 format "2048 2048 0 0 2048 2048 1 square_2K"
 rebuild_finalise ""
 name PlotInput2
 xpos 1208
 ypos 178
}
Dot {
 name Dot23
 note_font "Helvetica Bold"
 note_font_size 24
 note_font_color 0xff
 xpos 1242
 ypos 368
}
set Ne15eeb00 [stack 0]
NoOp {
 name CalcPrimaries_Rendering
 knobChanged "import nuke\nfloat3 = nuke.math.Vector3\nfloat3x3 = nuke.math.Matrix3\n\n\ndef transpose(m):\n    # Transpose (swap rows and columns) of a nuke.math.Matrix3\n    return float3x3(m\[0], m\[1], m\[2], m\[3], m\[4], m\[5], m\[6], m\[7], m\[8])\n\ndef set_matrix(m):\n    # Populate a nuke.math.Matrix3 with a 3x3 python list (either 3x3 or 1x9)\n    if len(m) is 3 and \[isinstance(r, list) for r in m]:\n        m = sum(m, \[])\n    o = float3x3(m\[0], m\[3], m\[6], m\[1], m\[4], m\[7], m\[2], m\[5], m\[8])\n    return o\n\ndef diag(v):\n    # Create a diagonal 3x3 matrix from a 1x3 vector\n    return float3x3(v\[0], 0, 0, 0, v\[1], 0, 0, 0, v\[2])\n\n\ndef xyY_to_XYZ(xyY):\n    # Convert an xyY chromaticity value to XYZ\n    x = xyY\[0]\n    y = xyY\[1]\n    if len(xyY) is 2:\n        # Assume an xy chromaticity coordinate, use default Y\n        Y = 1.0\n    else:\n        Y = xyY\[2]\n    XYZ = float3(x * Y / max(y, 1e-10), Y, (1.0 - x - y) * Y / max(y, 1e-10))\n    return XYZ\n\ndef xy_to_xyz(xy):\n    return float3(xy\[0], xy\[1], 1.0 - xy\[0] - xy\[1])\n\n\ndef calc_cat(src_xy, dst_xy, cat_method='cat02'):\n    # Calculate Von Kries chromatic adaptation transform matrix,\n    # given a source and destination illuminant and CAT method.\n    # Illuminant is given as xy chromaticity coordinates. \n    # CAT method is the name of one of the below cone response matrices.\n\n    crmtxs = \{\n        \"bianco\": \[\[0.8752, 0.2787, -0.1539], \[-0.8904, 1.8709, 0.0195], \[-0.0061, 0.0162, 0.9899]],\n        \"bianco_pc\": \[\[0.6489, 0.3915, -0.0404], \[-0.3775, 1.3055, 0.072], \[-0.0271, 0.0888, 0.9383]],\n        \"bradford\": \[\[0.8951, 0.2664, -0.1614], \[-0.7502, 1.7135, 0.0367], \[0.0389, -0.0685, 1.0296]],\n        \"cat02\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.003, 0.0136, 0.9834]],\n        \"cat02_brill_cat\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.0, 0.0, 1.0]],\n        \"cmccat2000\": \[\[0.7982, 0.3389, -0.1371], \[-0.5918, 1.5512, 0.0406], \[0.0008, 0.0239, 0.9753]],\n        \"cmccat97\": \[\[0.8951, -0.7502, 0.0389], \[0.2664, 1.7135, 0.0685], \[-0.1614, 0.0367, 1.0296]],\n        \"fairchild\": \[\[0.8562, 0.3372, -0.1934], \[-0.836, 1.8327, 0.0033], \[0.0357, -0.0469, 1.0112]],\n        \"sharp\": \[\[1.2694, -0.0988, -0.1706], \[-0.8364, 1.8006, 0.0357], \[0.0297, -0.0315, 1.0018]],\n        \"von_kries\": \[\[0.40024, 0.7076, -0.08081], \[-0.2263, 1.16532, 0.0457], \[0.0, 0.0, 0.91822]],\n        \"xyz_scaling\": \[\[1.0, 0.0, 0.0], \[0.0, 1.0, 0.0], \[0.0, 0.0, 1.0]]\n    \}\n    \n    cat_method = cat_method.lower().replace(' ', '_')\n    # Return identity matrix if no match\n    if cat_method not in crmtxs.keys():\n        m = float3x3()\n        m.makeIdentity()\n        return m\n        \n    crmtx = set_matrix(crmtxs\[cat_method])\n\n    # Get XYZ values from xy chromaticity coordinates\n    src_XYZ = xyY_to_XYZ(src_xy)\n    dst_XYZ = xyY_to_XYZ(dst_xy)\n\n    # Calculate source and destination cone response matrices\n    src_crmtx = transpose(crmtx) * src_XYZ\n    dst_crmtx = transpose(crmtx) * dst_XYZ\n\n    von_kries_matrix = diag(dst_crmtx / src_crmtx)\n    cat_mtx = float3x3()\n    cat_mtx = crmtx * (von_kries_matrix * crmtx.inverse())\n\n    return cat_mtx\n\n\ndef calc_npm(chr):\n    # Calculate a normalized primaries matrix from the specified chromaticity coordinates,\n    # given 2x4 list of xy chromaticity coordinates: red, green, blue, and white\n    rxyz, gxyz, bxyz, wxyz = map(xy_to_xyz, chr)\n    wy = chr\[3]\[1]\n    wxyz = float3(wxyz.x / wy, wxyz.y / wy, wxyz.z / wy)\n    np_mtx = float3x3(rxyz\[0], gxyz\[0], bxyz\[0],\n                      rxyz\[1], gxyz\[1], bxyz\[1],\n                      rxyz\[2], gxyz\[2], bxyz\[2])\n    wscale = np_mtx.inverse() * wxyz \n    np_mtx = transpose(np_mtx * diag(wscale))\n    return np_mtx\n\ndef is_xyz(c):\n    # return true if primaries are XYZ\n    return c\[:3] == \[\[1.0, 0.0], \[0.0, 1.0], \[0.0, 0.0]]\n\n\ndef start(node):\n    identity_mtx = float3x3()\n    identity_mtx.makeIdentity()\n\n    invert = node\['invert'].getValue()\n    cat_method = node\['cat_method'].value()\n\n    src_chr = \[node\[k].getValue() for k in \['rxy', 'gxy', 'bxy', 'wxy']]\n    dst_chr = \[node\[k].getValue() for k in \['drxy', 'dgxy', 'dbxy', 'dwxy']]\n\n    # bypass double scale if source or destination is XYZ\n    if is_xyz(src_chr):\n        rgb_to_xyz = identity_mtx\n    else:\n        rgb_to_xyz = calc_npm(src_chr)\n    \n    if is_xyz(dst_chr):\n        xyz_to_rgb = identity_mtx\n    else:\n        xyz_to_rgb = calc_npm(dst_chr).inverse()\n\n    if src_chr\[3] == dst_chr\[3]:\n        cat_mtx = identity_mtx\n    else:\n        cat_mtx = calc_cat(src_chr\[3], dst_chr\[3], cat_method)\n\n    mtx = (rgb_to_xyz * cat_mtx) * xyz_to_rgb\n\n    if invert:\n        mtx = mtx.inverse()\n\n    node\['matrix'].setValue(mtx)\n\n\nn = nuke.thisNode()\nk = nuke.thisKnob()\nif k.name() in \['rxy', 'gxy', 'bxy']:\n    tg = nuke.toNode(n\['target_node'].getValue())\n    margin = n\['margin'].getValue()\n    coord = k.getValue()\n    coord = \[coord\[0]/n.width()-margin, coord\[1]/n.height()-margin]\n    tg\['d\{0\}'.format(k.name())].setValue(coord)\n    start(tg)"
 note_font Helvetica
 xpos 1401
 ypos 365
 addUserKnob {20 User}
 addUserKnob {1 target_node l "target node"}
 target_node RenderingPrimaries
 addUserKnob {7 margin}
 margin {{parent.PlotInput2.PlotChromaticity_grid_left_margin}}
 addUserKnob {6 dst t "target dst xy instead of src" +STARTLINE}
 dst true
 addUserKnob {26 ""}
 addUserKnob {35 presets l "" +STARTLINE M {"presets/wide 01" "knobs this \{rxy \{1755.5 784.5\} gxy \{455 2013\} bxy \{357.7999878 25.39999962\} \}" "presets/wide 02" "knobs this \{rxy \{1848.5 763.5\} gxy \{538 2232\} bxy \{430 82\}\}" "presets/wide 03" "knobs this \{rxy \{1869 747.5\} gxy \{472 2074\} bxy \{388 -16\}\}" ""}}
 addUserKnob {12 rxy}
 rxy {1869 747.5}
 addUserKnob {12 gxy}
 gxy {472 2074}
 addUserKnob {12 bxy}
 bxy {388 -16}
}
StickyNote {
 inputs 0
 name StickyNote4
 tile_color 0x272727ff
 label "
\n1). Connect an input image in ACEScg"
 note_font Helvetica
 note_font_size 8
 note_font_color 0xa8a8a8ff
 xpos 2036
 ypos -150
}
push $Ne15eeb00
NoOp {
 name CalcPrimaries_Output
 knobChanged "import nuke\nfloat3 = nuke.math.Vector3\nfloat3x3 = nuke.math.Matrix3\n\n\ndef transpose(m):\n    # Transpose (swap rows and columns) of a nuke.math.Matrix3\n    return float3x3(m\[0], m\[1], m\[2], m\[3], m\[4], m\[5], m\[6], m\[7], m\[8])\n\ndef set_matrix(m):\n    # Populate a nuke.math.Matrix3 with a 3x3 python list (either 3x3 or 1x9)\n    if len(m) is 3 and \[isinstance(r, list) for r in m]:\n        m = sum(m, \[])\n    o = float3x3(m\[0], m\[3], m\[6], m\[1], m\[4], m\[7], m\[2], m\[5], m\[8])\n    return o\n\ndef diag(v):\n    # Create a diagonal 3x3 matrix from a 1x3 vector\n    return float3x3(v\[0], 0, 0, 0, v\[1], 0, 0, 0, v\[2])\n\n\ndef xyY_to_XYZ(xyY):\n    # Convert an xyY chromaticity value to XYZ\n    x = xyY\[0]\n    y = xyY\[1]\n    if len(xyY) is 2:\n        # Assume an xy chromaticity coordinate, use default Y\n        Y = 1.0\n    else:\n        Y = xyY\[2]\n    XYZ = float3(x * Y / max(y, 1e-10), Y, (1.0 - x - y) * Y / max(y, 1e-10))\n    return XYZ\n\ndef xy_to_xyz(xy):\n    return float3(xy\[0], xy\[1], 1.0 - xy\[0] - xy\[1])\n\n\ndef calc_cat(src_xy, dst_xy, cat_method='cat02'):\n    # Calculate Von Kries chromatic adaptation transform matrix,\n    # given a source and destination illuminant and CAT method.\n    # Illuminant is given as xy chromaticity coordinates. \n    # CAT method is the name of one of the below cone response matrices.\n\n    crmtxs = \{\n        \"bianco\": \[\[0.8752, 0.2787, -0.1539], \[-0.8904, 1.8709, 0.0195], \[-0.0061, 0.0162, 0.9899]],\n        \"bianco_pc\": \[\[0.6489, 0.3915, -0.0404], \[-0.3775, 1.3055, 0.072], \[-0.0271, 0.0888, 0.9383]],\n        \"bradford\": \[\[0.8951, 0.2664, -0.1614], \[-0.7502, 1.7135, 0.0367], \[0.0389, -0.0685, 1.0296]],\n        \"cat02\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.003, 0.0136, 0.9834]],\n        \"cat02_brill_cat\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.0, 0.0, 1.0]],\n        \"cmccat2000\": \[\[0.7982, 0.3389, -0.1371], \[-0.5918, 1.5512, 0.0406], \[0.0008, 0.0239, 0.9753]],\n        \"cmccat97\": \[\[0.8951, -0.7502, 0.0389], \[0.2664, 1.7135, 0.0685], \[-0.1614, 0.0367, 1.0296]],\n        \"fairchild\": \[\[0.8562, 0.3372, -0.1934], \[-0.836, 1.8327, 0.0033], \[0.0357, -0.0469, 1.0112]],\n        \"sharp\": \[\[1.2694, -0.0988, -0.1706], \[-0.8364, 1.8006, 0.0357], \[0.0297, -0.0315, 1.0018]],\n        \"von_kries\": \[\[0.40024, 0.7076, -0.08081], \[-0.2263, 1.16532, 0.0457], \[0.0, 0.0, 0.91822]],\n        \"xyz_scaling\": \[\[1.0, 0.0, 0.0], \[0.0, 1.0, 0.0], \[0.0, 0.0, 1.0]]\n    \}\n    \n    cat_method = cat_method.lower().replace(' ', '_')\n    # Return identity matrix if no match\n    if cat_method not in crmtxs.keys():\n        m = float3x3()\n        m.makeIdentity()\n        return m\n        \n    crmtx = set_matrix(crmtxs\[cat_method])\n\n    # Get XYZ values from xy chromaticity coordinates\n    src_XYZ = xyY_to_XYZ(src_xy)\n    dst_XYZ = xyY_to_XYZ(dst_xy)\n\n    # Calculate source and destination cone response matrices\n    src_crmtx = transpose(crmtx) * src_XYZ\n    dst_crmtx = transpose(crmtx) * dst_XYZ\n\n    von_kries_matrix = diag(dst_crmtx / src_crmtx)\n    cat_mtx = float3x3()\n    cat_mtx = crmtx * (von_kries_matrix * crmtx.inverse())\n\n    return cat_mtx\n\n\ndef calc_npm(chr):\n    # Calculate a normalized primaries matrix from the specified chromaticity coordinates,\n    # given 2x4 list of xy chromaticity coordinates: red, green, blue, and white\n    rxyz, gxyz, bxyz, wxyz = map(xy_to_xyz, chr)\n    wy = chr\[3]\[1]\n    wxyz = float3(wxyz.x / wy, wxyz.y / wy, wxyz.z / wy)\n    np_mtx = float3x3(rxyz\[0], gxyz\[0], bxyz\[0],\n                      rxyz\[1], gxyz\[1], bxyz\[1],\n                      rxyz\[2], gxyz\[2], bxyz\[2])\n    wscale = np_mtx.inverse() * wxyz \n    np_mtx = transpose(np_mtx * diag(wscale))\n    return np_mtx\n\ndef is_xyz(c):\n    # return true if primaries are XYZ\n    return c\[:3] == \[\[1.0, 0.0], \[0.0, 1.0], \[0.0, 0.0]]\n\n\ndef start(node):\n    identity_mtx = float3x3()\n    identity_mtx.makeIdentity()\n\n    invert = node\['invert'].getValue()\n    cat_method = node\['cat_method'].value()\n\n    src_chr = \[node\[k].getValue() for k in \['rxy', 'gxy', 'bxy', 'wxy']]\n    dst_chr = \[node\[k].getValue() for k in \['drxy', 'dgxy', 'dbxy', 'dwxy']]\n\n    # bypass double scale if source or destination is XYZ\n    if is_xyz(src_chr):\n        rgb_to_xyz = identity_mtx\n    else:\n        rgb_to_xyz = calc_npm(src_chr)\n    \n    if is_xyz(dst_chr):\n        xyz_to_rgb = identity_mtx\n    else:\n        xyz_to_rgb = calc_npm(dst_chr).inverse()\n\n    if src_chr\[3] == dst_chr\[3]:\n        cat_mtx = identity_mtx\n    else:\n        cat_mtx = calc_cat(src_chr\[3], dst_chr\[3], cat_method)\n\n    mtx = (rgb_to_xyz * cat_mtx) * xyz_to_rgb\n\n    if invert:\n        mtx = mtx.inverse()\n\n    node\['matrix'].setValue(mtx)\n\n\nn = nuke.thisNode()\nk = nuke.thisKnob()\nif k.name() in \['rxy', 'gxy', 'bxy']:\n    tg = nuke.toNode(n\['target_node'].getValue())\n    margin = n\['margin'].getValue()\n    coord = k.getValue()\n    coord = \[coord\[0]/n.width()-margin, coord\[1]/n.height()-margin]\n    tg\['d\{0\}'.format(k.name())].setValue(coord)\n    start(tg)"
 note_font Helvetica
 xpos 1208
 ypos 533
 addUserKnob {20 User}
 addUserKnob {1 target_node l "target node"}
 target_node OutputPrimaries
 addUserKnob {7 margin}
 margin {{parent.PlotInput2.PlotChromaticity_grid_left_margin}}
 addUserKnob {6 dst t "target dst xy instead of src" +STARTLINE}
 dst true
 addUserKnob {26 ""}
 addUserKnob {35 presets l "" +STARTLINE M {"presets/wide 01" "knobs this \{rxy \{1755.5 784.5\} gxy \{455 2013\} bxy \{357.7999878 25.39999962\} \}" "presets/wide 02" "knobs this \{rxy \{1848.5 763.5\} gxy \{538 2232\} bxy \{430 82\}\}" "presets/wide 03" "knobs this \{rxy \{1869 747.5\} gxy \{472 2074\} bxy \{388 -16\}\}" ""}}
 addUserKnob {12 rxy}
 rxy {1869.09 747.32}
 addUserKnob {12 gxy}
 gxy {472 2074}
 addUserKnob {12 bxy}
 bxy {388 -16}
}
push $Ne2879600
Group {
 name Tonemap_PiecewiseHyperbolic5
 xpos 1788
 ypos 275
 addUserKnob {20 Tonemap}
 addUserKnob {35 presets l " " M {"presets/SDR - Dark" "knobs this \{Lw \{100 100\} Lg 10 g \{0.18 \{Lg/Lw.0*pow(2,ex)\}\} w \{40 \{Lw.1/Lw.0\}\} ex 0 p 1.3 ps 1 t0 0.003\}" "presets/SDR - Dim" "knobs this \{Lw \{100 100\} Lg 10 g \{0.18 \{Lg/Lw.0*pow(2,ex)\}\} w \{40 \{Lw.1/Lw.0\}\} ex 0 p 1.3 ps 0.95 t0 0.003\}" "presets/SDR - Average" "knobs this \{Lw \{100 100\} Lg 10 g \{0.18 \{Lg/Lw.0*pow(2,ex)\}\} w \{40 \{Lw.1/Lw.0\}\} ex 0 p 1.3 ps 0.9 t0 0.003\}" "presets/Rec.2100 PQ ST-2084 600 nit" "knobs this \{Lw \{10000 600\} Lg 14 g \{0.18 \{Lg/Lw.0*pow(2,ex)\}\} w \{80 \{Lw.1/Lw.0\}\} ex \{\{0.1*log(Lw.1/1000)/log(2)\}\} p 1.2 t0 0.0001\}" "presets/Rec.2100 PQ ST-2084 1000 nit" "knobs this \{Lw \{10000 1000\} Lg 14 g \{0.18 \{Lg/Lw.0*pow(2,ex)\}\} w \{90 \{Lw.1/Lw.0\}\} ex \{\{0.1*log(Lw.1/1000)/log(2)\}\} p 1.2 t0 0.0001\}" "presets/Rec.2100 PQ ST-2084 2000 nit" "knobs this \{Lw \{10000 2000\} Lg 14 g \{0.18 \{Lg/Lw.0*pow(2,ex)\}\} w \{100 \{Lw.1/Lw.0\}\} ex \{\{0.1*log(Lw.1/1000)/log(2)\}\} p 1.2 t0 0.0001\}" "presets/Rec.2100 PQ ST-2084 4000 nit" "knobs this \{Lw \{10000 4000\} Lg 14 g \{0.18 \{Lg/Lw.0*pow(2,ex)\}\} w \{110 \{Lw.1/Lw.0\}\} ex \{\{0.1*log(Lw.1/1000)/log(2)\}\} p 1.2 t0 0.0001\}" "" ""}}
 addUserKnob {78 Lw t "Peak white to reference white ratio. Useful for HDR, if you need to ouput a 1000 nit peak luminance image in the 10,000 nit peak luminance ST-2084 PQ container for example." n 2}
 Lw {100 100}
 addUserKnob {7 Lg t "Grey luminance in nits." R 4 20}
 Lg 10
 addUserKnob {26 ""}
 addUserKnob {7 ex l exposure t "scene-referred exposure control"}
 addUserKnob {78 g l grey t "input -> output grey" n 2}
 g {0.18 {Lg/Lw.0*pow(2,ex)}}
 addUserKnob {78 w l white t "input -> output white" n 2}
 w {40 {Lw.1/Lw.0}}
 addUserKnob {7 p l contrast R 0.8 2}
 p 1.3
 addUserKnob {7 ps l surround t "surround compensation: un-pivoted power function" R 0.8 1.2}
 ps 0.9
 addUserKnob {7 t0 l toe R 0 0.01}
 t0 0.003
 addUserKnob {78 s l scale n 2}
 s {{pow(g.1,1/p)/g.0} {(s.0*pow(w.0-g.0,2)*pow(g.0*s.0-pow(w.1,1/p),2))/pow(s.0*w.0-pow(w.1,1/p),2)}}
 addUserKnob {4 direction M {forward inverse}}
 addUserKnob {26 ""}
 addUserKnob {26 plot_label l " " T "desmos plot"}
}
 Input {
  inputs 0
  name Input
  xpos -40
  ypos -70
 }
set Ne15ec800 [stack 0]
 Expression {
  expr0 w.1*pow(r/w.1,1/ps)
  expr1 w.1*pow(g/w.1,1/ps)
  expr2 w.1*pow(b/w.1,1/ps)
  name InvSurround
  note_font Helvetica
  xpos 70
  ypos 21
 }
 Expression {
  temp_name0 st
  temp_expr0 (w.1+t0)/w.1
  expr0 (r+sqrt(r*(4*st*t0+r)))/(2*st)
  expr1 (g+sqrt(g*(4*st*t0+g)))/(2*st)
  expr2 (b+sqrt(b*(4*st*t0+b)))/(2*st)
  name InvToe
  note_font Helvetica
  xpos 70
  ypos 51
 }
 Expression {
  temp_name0 h0
  temp_expr0 g.0-sqrt(s.1/s.0)
  temp_name1 h1
  temp_expr1 s.0*g.0+sqrt(s.0*s.1)
  expr0 r>g.1?h0-s.1/(pow(r,1/p)-h1):pow(r,1/p)/s.0
  expr1 g>g.1?h0-s.1/(pow(g,1/p)-h1):pow(g,1/p)/s.0
  expr2 b>g.1?h0-s.1/(pow(b,1/p)-h1):pow(b,1/p)/s.0
  name InvCompress
  note_font Helvetica
  xpos 70
  ypos 81
 }
push $Ne15ec800
 Expression {
  temp_name0 h0
  temp_expr0 g.0-sqrt(s.1/s.0)
  temp_name1 h1
  temp_expr1 s.0*g.0+sqrt(s.0*s.1)
  expr0 r>g.0?pow(h1-s.1/(r-h0),p):pow(s.0*r,p)
  expr1 g>g.0?pow(h1-s.1/(g-h0),p):pow(s.0*g,p)
  expr2 b>g.0?pow(h1-s.1/(b-h0),p):pow(s.0*b,p)
  name Shoulder
  note_font Helvetica
  xpos -150
  ypos 21
 }
 Expression {
  temp_name0 st
  temp_expr0 (w.1+t0)/w.1
  expr0 (st*r*r)/(r+t0)
  expr1 (st*g*g)/(g+t0)
  expr2 (st*b*b)/(b+t0)
  name Toe
  note_font Helvetica
  xpos -150
  ypos 51
 }
 Expression {
  expr0 w.1*pow(r/w.1,ps)
  expr1 w.1*pow(g/w.1,ps)
  expr2 w.1*pow(b/w.1,ps)
  name Surround
  note_font Helvetica
  xpos -150
  ypos 81
 }
 Switch {
  inputs 2
  which {{parent.direction}}
  name SwitchDirection
  note_font Helvetica
  xpos -40
  ypos 141
 }
 Output {
  name Output
  xpos -40
  ypos 200
 }
end_group
StickyNote {
 inputs 0
 name StickyNote5
 tile_color 0x272727ff
 label "
\n2).  Choose a tonemap preset for your display device or customize the settings to make your own curve."
 note_font Helvetica
 note_font_size 8
 note_font_color 0xa8a8a8ff
 xpos 2063
 ypos 285
}
Group {
 inputs 0
 name Tonemap_ToeLast
 xpos 2774
 ypos -220
 addUserKnob {20 Tonemap}
 addUserKnob {35 presets l " " M {"presets/SDR - Dark" "knobs this \{Lp \{Lw\} Lw 100 Lg 11.5 c 1.4 ps 1 t0 0.01\}" "presets/SDR - Dim" "knobs this \{Lp \{Lw\} Lw 100 Lg 11.5 c 1.4 ps .95 t0 0.01\}" "presets/SDR - Average" "knobs this \{Lp \{Lw\} Lw 100 Lg 11.5 c 1.4 ps .9 t0 0.01\}" "presets/Rec.2100 PQ ST-2084 600 nit" "knobs this \{Lp 10000 Lw 600 Lg 14 c 1.2 ps 1 t0 0.001\}" "presets/Rec.2100 PQ ST-2084 1000 nit" "knobs this \{Lp 10000 Lw 1000 Lg 14 c 1.2 ps 1 t0 0.0001\}" "presets/Rec.2100 PQ ST-2084 2000 nit" "knobs this \{Lp 10000 Lw 2000 Lg 14 c 1.2 ps 1 t0 0.0001\}" "presets/Rec.2100 PQ ST-2084 4000 nit" "knobs this \{Lp 10000 Lw 4000 Lg 14 c 1.2 ps 1 t0 0.0001\}"}}
 addUserKnob {7 Lp t "Peak luminance in nits" R 48 10000}
 Lp {{Lw}}
 addUserKnob {7 Lw t "Normalized white luminance in nits" R 48 4000}
 Lw 100
 addUserKnob {7 Lg t "Grey luminance in nits." R 4 20}
 Lg 11.5
 addUserKnob {7 c l contrast R 0.8 2}
 c 1.4
 addUserKnob {7 ps l surround t "surround compensation: unconstrained power function" R 0.8 1.2}
 ps 0.9
 addUserKnob {7 t0 l toe R 0 0.1}
 t0 0.01
 addUserKnob {26 ""}
 addUserKnob {7 p t "power (combination of grey-constrained contrast and unconstrained surround compensation)" R 0.5 4}
 p {{c*ps}}
 addUserKnob {78 g l grey t "input -> output grey" n 2}
 g {0.18 {Lg/Lp}}
 addUserKnob {7 w t "input exposure" R 0 100}
 w {{-pow(g.1/s.1,1/c)/(g.0*(pow(g.1/s.1,1/c)-1))}}
 addUserKnob {7 h R 1 2}
 h {{0.048*Lw/1000+1.037}}
 addUserKnob {78 s l scale n 2}
 s {{w*max(1,pow(Lw/1000,0.1))} {Lw/Lp*h}}
 addUserKnob {4 direction M {forward inverse}}
 addUserKnob {26 ""}
 addUserKnob {26 plot_label l " " T "desmos plot"}
}
 Input {
  inputs 0
  name Input
  xpos -40
  ypos -70
 }
 Dot {
  name Dot1
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xff
  xpos -6
  ypos -6
 }
set Ne1237900 [stack 0]
 Expression {
  expr0 r/s.1
  expr1 g/s.1
  expr2 b/s.1
  name InvOutputScale
  note_font Helvetica
  xpos 70
  ypos 21
 }
 Expression {
  temp_name0 rt
  temp_expr0 pow(0.5*(r+sqrt(r*(4*t0+r))),1/p)
  temp_name1 gt
  temp_expr1 pow(0.5*(g+sqrt(g*(4*t0+g))),1/p)
  temp_name2 bt
  temp_expr2 pow(0.5*(b+sqrt(b*(4*t0+b))),1/p)
  expr0 rt/(1-rt)
  expr1 gt/(1-gt)
  expr2 bt/(1-bt)
  name InvCompress
  note_font Helvetica
  xpos 70
  ypos 51
 }
 Expression {
  expr0 r/s.0
  expr1 g/s.0
  expr2 b/s.0
  name InputScale1
  note_font Helvetica
  xpos 70
  ypos 81
 }
push $Ne1237900
 Expression {
  expr0 r*s.0
  expr1 g*s.0
  expr2 b*s.0
  name InputScale
  note_font Helvetica
  xpos -150
  ypos 21
 }
 Expression {
  temp_name0 rt
  temp_expr0 pow(r/(r+1),p)
  temp_name1 gt
  temp_expr1 pow(g/(g+1),p)
  temp_name2 bt
  temp_expr2 pow(b/(b+1),p)
  expr0 (rt*rt)/(rt+t0)
  expr1 (gt*gt)/(gt+t0)
  expr2 (bt*bt)/(bt+t0)
  name Compression
  note_font Helvetica
  xpos -150
  ypos 51
 }
 Expression {
  expr0 r*s.1
  expr1 g*s.1
  expr2 b*s.1
  name OutputScale
  note_font Helvetica
  selected true
  xpos -150
  ypos 81
 }
 Switch {
  inputs 2
  which {{parent.direction}}
  name SwitchDirection
  note_font Helvetica
  xpos -40
  ypos 141
 }
 Output {
  name Output
  xpos -40
  ypos 200
 }
end_group
Group {
 inputs 0
 name Tonemap_PiecewiseHyperbolic_v3
 xpos 3437
 ypos -220
 addUserKnob {20 Tonemap}
 addUserKnob {35 presets l " " M {"presets/SDR - Dark" "knobs this \{Lp \{Lw\} Lw 100 Lg 10.5 c 1.4 ps 1 t0 0.004 th \{Lg/Lw\}\}" "presets/SDR - Dim" "knobs this \{Lp \{Lw\} Lw 100 Lg 10.5 c 1.4 ps .95 t0 0.004 th \{Lg/Lw\}\}" "presets/SDR - Average" "knobs this \{Lp \{Lw\} Lw 100 Lg 10.5 c 1.4 ps .9 t0 0.004 th \{Lg/Lw\}\}" "presets/Rec.2100 PQ ST-2084 600 nit" "knobs this \{Lp 10000 Lw 600 Lg 14 c 1.2 ps 1 t0 0.001 th \{Lg/Lw\}\}" "presets/Rec.2100 PQ ST-2084 1000 nit" "knobs this \{Lp 10000 Lw 1000 Lg 14 c 1.2 ps 1 t0 0.0001 th \{Lg/Lw\}\}" "presets/Rec.2100 PQ ST-2084 2000 nit" "knobs this \{Lp 10000 Lw 2000 Lg 14 c 1.2 ps 1 t0 0.0001 th \{Lg/Lw\}\}" "presets/Rec.2100 PQ ST-2084 4000 nit" "knobs this \{Lp 10000 Lw 4000 Lg 14 c 1.2 ps 1 t0 0.0001 th \{Lg/Lw\}\}"}}
 addUserKnob {7 Lp t "Peak luminance in nits" R 48 10000}
 Lp 10000
 addUserKnob {7 Lw t "Normalized white luminance in nits" R 48 4000}
 Lw 2310
 addUserKnob {7 Lg t "Grey luminance in nits." R 4 20}
 Lg 14
 addUserKnob {7 c l contrast R 0.8 2}
 c 1.2
 addUserKnob {7 ps l surround t "surround compensation: unconstrained power function" R 0.8 1.2}
 ps 1
 addUserKnob {7 t0 l toe R 0 0.1}
 t0 0.0001
 addUserKnob {26 ""}
 addUserKnob {7 th t "hyperbolic compression threshold. " R 0 0.5}
 th {{Lg/Lw}}
 addUserKnob {7 p t "power (combination of grey-constrained contrast and unconstrained surround compensation)" R 0.5 4}
 p {{c*ps}}
 addUserKnob {78 g l grey t "input -> output grey" n 2}
 g {0.18 {Lg/Lp}}
 addUserKnob {7 w t "input exposure" R 0 100}
 w {{th>pow(g.1/s.1,1/c)?pow(g.1/s.1,1/c)/g.0:(2*th*pow(g.1/s.1,1/c)-pow(g.1/s.1,1/c)-th*th)/(g.0*(pow(g.1/s.1,1/c)-1))}}
 addUserKnob {7 h R 1 2}
 h {{0.048*Lw/1000+1.037}}
 addUserKnob {78 s l scale n 2}
 s {{w*max(1,pow(Lw/1000,0.1))} {Lw/Lp*h}}
 addUserKnob {4 direction M {forward inverse}}
 addUserKnob {26 ""}
 addUserKnob {26 plot_label l " " T "desmos plot"}
}
 Input {
  inputs 0
  name Input
  xpos -40
  ypos -70
 }
 Dot {
  name Dot1
  note_font "Helvetica Bold"
  note_font_size 24
  note_font_color 0xff
  xpos -6
  ypos -6
 }
set Ne13eab00 [stack 0]
 Expression {
  expr0 r/s.1
  expr1 g/s.1
  expr2 b/s.1
  name InvOutputScale
  note_font Helvetica
  xpos 70
  ypos 21
 }
 Expression {
  expr0 (r+sqrt(r*(4*t0+r)))/2
  channel1 {-rgba.red rgba.green -rgba.blue none}
  expr1 (g+sqrt(g*(4*t0+g)))/2
  expr2 (b+sqrt(b*(4*t0+b)))/2
  name InvToe
  note_font Helvetica
  xpos 70
  ypos 51
 }
 Expression {
  expr0 pow(r,1/p)
  expr1 pow(g,1/p)
  expr2 pow(b,1/p)
  name InvPower
  note_font Helvetica
  xpos 70
  ypos 81
 }
 Expression {
  expr0 r>th?th+1/(1/(r-th)-1/(1-th)):r
  expr1 g>th?th+1/(1/(g-th)-1/(1-th)):g
  expr2 b>th?th+1/(1/(b-th)-1/(1-th)):b
  name InvShoulder
  note_font Helvetica
  xpos 70
  ypos 111
 }
 Expression {
  expr0 r/s.0
  expr1 g/s.0
  expr2 b/s.0
  name InvInputScale
  note_font Helvetica
  xpos 70
  ypos 141
 }
push $Ne13eab00
 Expression {
  expr0 r*s.0
  expr1 g*s.0
  expr2 b*s.0
  name InputScale
  note_font Helvetica
  xpos -150
  ypos 21
 }
 Expression {
  expr0 r>th?th+1/(1/(r-th)+1/(1-th)):r
  expr1 g>th?th+1/(1/(g-th)+1/(1-th)):g
  expr2 b>th?th+1/(1/(b-th)+1/(1-th)):b
  name Shoulder
  note_font Helvetica
  xpos -150
  ypos 51
 }
 Expression {
  expr0 pow(r,p)
  expr1 pow(g,p)
  expr2 pow(b,p)
  name Power
  note_font Helvetica
  xpos -150
  ypos 81
 }
 Expression {
  expr0 (r*r)/(r+t0)
  channel1 {-rgba.red rgba.green -rgba.blue none}
  expr1 (g*g)/(g+t0)
  expr2 (b*b)/(b+t0)
  name Toe
  note_font Helvetica
  xpos -150
  ypos 111
 }
 Expression {
  expr0 r*s.1
  expr1 g*s.1
  expr2 b*s.1
  name OutputScale
  note_font Helvetica
  selected true
  xpos -150
  ypos 141
 }
 Switch {
  inputs 2
  which {{parent.direction}}
  name SwitchDirection
  note_font Helvetica
  xpos -40
  ypos 201
 }
 Output {
  name Output
  xpos -40
  ypos 290
 }
end_group