set cut_paste_input [stack 0] push $cut_paste_input Group { name OpenDRT addUserKnob {20 OpenDRT} addUserKnob {26 about_label l " " T "\n\nOpenDRT created by Jed Smith\n
v0.2.8 | documentation
"} addUserKnob {41 gamut l "in gamut" T InGamut_to_XYZ.gamut} addUserKnob {26 spacer01 l "" +STARTLINE} addUserKnob {26 tonescale_label l " " T tonescale} addUserKnob {41 Lp T ConstrainedTonescale.Lp} addUserKnob {41 gb T ConstrainedTonescale.gb} addUserKnob {41 Lg +DISABLED T ConstrainedTonescale.Lg} addUserKnob {41 c T ConstrainedTonescale.c} addUserKnob {41 fl l flare T ConstrainedTonescale.fl} addUserKnob {6 dch_enable l "  chroma compression" +STARTLINE} dch_enable true addUserKnob {41 dch l dechroma T Power.dch} addUserKnob {41 chc l "chroma contrast" T PowerPvLerp.p} addUserKnob {6 hs_enable l "  hue shift" +STARTLINE} hs_enable true addUserKnob {41 hs_r l "red shift" T ShiftRGB.s0} addUserKnob {41 hs_g l "green shift" T ShiftRGB.s1} addUserKnob {41 hs_b l "blue shift" T ShiftRGB.s2} addUserKnob {6 chn_enable l "  chroma normalize" +STARTLINE} chn_enable true addUserKnob {26 spacer02 l "" +STARTLINE} 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} } Input { inputs 0 name Input xpos 180 ypos -682 } Group { name InGamut_to_XYZ tile_color 0x429940ff xpos 180 ypos -634 addUserKnob {20 InputGamut_to_XYZ_tab l InputGamut_to_XYZ} addUserKnob {4 gamut l "in gamut" M {ACES ACEScg P3D65 Rec.2020 Rec.709 "Alexa WideGamut" "Red WideGamutRGB" "Sony SGamut3" "Filmlight E-Gamut" "DaVinci Wide Gamut" "" "" ""}} gamut "Filmlight E-Gamut" 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 Nb02d9600 [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 -370 } Output { name Output xpos 290 ypos -250 } push $Nb02d9600 Dot { name Dot391 label " *RGB to XYZ D65 CAT: XYZ Scaling" xpos 434 ypos -546 } set Nb02d8100 [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" xpos 1390 ypos -466 } push $Nb02d8100 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" xpos 1280 ypos -466 } push $Nb02d8100 ColorMatrix { matrix { {0.5990839005 0.2489254922 0.1024464965} {0.2150758207 0.8850684166 -0.1001443192} {-0.03206584975 -0.02765838802 1.148782015} } name ColorMatrix31 label "SonySGamut3 to XYZ D65" xpos 1170 ypos -465 } push $Nb02d8100 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 -466 } push $Nb02d8100 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 -466 } push $Nb02d8100 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 -466 } push $Nb02d8100 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 -466 } push $Nb02d8100 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 -466 } push $Nb02d8100 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 -466 } push $Nb02d8100 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 -466 } Switch { inputs 10 which {{gamut}} name SwitchGamut xpos 400 ypos -370 } end_group Group { name XYZ_to_DisplayGamut tile_color 0x425440ff xpos 180 ypos -610 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 D65" "P3 D60" "P3 DCI" Rec.709 "DCDM X'Y'Z'"}} 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 N4d6a9d00 [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 -399 } Output { name Output xpos 290 ypos -310 } push $N4d6a9d00 Dot { name Dot1 label " XYZ D65 to *RGB CAT: XYZ Scaling" xpos 434 ypos -516 } set N4d6a8800 [stack 0] ColorMatrix { matrix { {1 0 0} {0 1 0} {0 0 1} } name ColorMatrix4 label "XYZ D65 to XYZ E" xpos 950 ypos -465 } push $N4d6a8800 ColorMatrix { matrix { {3.240968943 -1.537382722 -0.4986106157} {-0.9692435861 1.875967264 0.04155508429} {0.05563007668 -0.2039769441 1.056971431} } name ColorMatrix2 label "XYZ D65 to Rec709" xpos 840 ypos -465 } push $N4d6a8800 ColorMatrix { matrix { {2.72539258 -1.01800251 -0.4401629865} {-0.795167923 1.689731836 0.02264717408} {0.04124189168 -0.08763902634 1.100929379} } name ColorMatrix12 label "XYZ D65 to P3DCI" xpos 730 ypos -465 } push $N4d6a8800 ColorMatrix { matrix { {2.40274024 -0.8974836469 -0.3880532086} {-0.8325793743 1.769231319 0.02371269651} {0.03882337734 -0.0824996829 1.036368608} } name ColorMatrix11 label "XYZ D65 to P3D60" xpos 620 ypos -465 } push $N4d6a8800 ColorMatrix { matrix { {2.493495464 -0.9313831329 -0.4027105868} {-0.8294886947 1.762663484 0.02362468652} {0.03584581986 -0.07617236674 0.9568843246} } name ColorMatrix10 label "XYZ D65 to P3D65" xpos 510 ypos -465 } push $N4d6a8800 ColorMatrix { matrix { {1.716650844 -0.3556707203 -0.2533662021} {-0.6666842103 1.616480947 0.01576854289} {0.01763985492 -0.04277061298 0.9421030283} } name ColorMatrix5 label "XYZ D65 to Rec2020" xpos 400 ypos -465 } Switch { inputs 6 which {{gamut}} name SwitchGamut xpos 400 ypos -399 } end_group Dot { name Dot1 xpos 214 ypos -558 } set N4d7dcf00 [stack 0] Dot { name Dot2 xpos -226 ypos -558 } Expression { channel0 rgba expr0 max(1e-8,r*rw+g*gw+b*bw) name WeightedSum xpos -260 ypos -513 addUserKnob {20 Params} addUserKnob {7 rw R 0.05 0.6} rw 0.25 addUserKnob {7 gw R 0.05 0.66} gw {{1-(rw+bw)}} addUserKnob {7 bw R 0.05 0.6} bw 0.3 } set N4d7dc100 [stack 0] Expression { temp_name0 ts0 temp_expr0 invert?(r+sqrt(r*(4*fl+r)))/2:(m*r/(r+s))**c temp_name1 ts temp_expr1 invert?(s*ts0**(1/c))/(m-ts0**(1/c))/r:(ts0**2/(ts0+fl))/r channel0 rgba expr0 min(1,r*ts*(100/Lp)) name ConstrainedTonescale label https://www.desmos.com/calculator/hglnae2ame xpos -260 ypos -425 addUserKnob {20 Params} addUserKnob {7 Lp R 100 1000} Lp 100 addUserKnob {7 Lg +DISABLED R 7 25} Lg {{gy*100}} addUserKnob {7 c R 1 1.4} c 1.1 addUserKnob {7 fl l flare R 0 0.02} fl 0.01 addUserKnob {7 gb} gb 0.12 addUserKnob {26 ""} addUserKnob {7 px R 32 256} px {{256*log(Lp)/log(100)-128}} addUserKnob {7 py R 1 10} py {{Lp/100}} addUserKnob {7 gx} gx 0.18 addUserKnob {7 gy} gy {{11.696/100*(1+gb*log(py)/log(2))}} addUserKnob {7 m0 R 1 4} m0 {{(py+sqrt(py*(4*fl+py)))/2}} addUserKnob {7 m R 1 4} m {{m0**(1/c)*(s+px)/px}} addUserKnob {7 s0 R 1 4} s0 {{(gy+sqrt(gy*(4*fl+gy)))/2}} addUserKnob {7 s R 1 4} s {{(px*gx*(m0**(1/c)-s0**(1/c)))/(px*s0**(1/c)-gx*m0**(1/c))}} addUserKnob {6 invert +STARTLINE} } Dot { name Dot13 xpos -226 ypos -342 } set N4d7b3200 [stack 0] Dot { name Dot9 xpos -226 ypos -126 } set N4d7b2b00 [stack 0] Dot { name Dot3 xpos -226 ypos 13 } push $N4d7dc100 push $N4d7dcf00 MergeExpression { inputs 2 expr0 Ar==0?0:max(-2,Br/Ar) expr1 Ag==0?0:max(-2,Bg/Ag) expr2 Ab==0?0:max(-2,Bb/Ab) name MergeDivideReverse xpos 180 ypos -514 } Expression { expr0 r>t0?r:(r-t0)*pow(pow((t0-r)/(t0-m),1/p)+1,-p)+t0 expr1 g>t0?g:(g-t0)*pow(pow((t0-g)/(t0-m),1/p)+1,-p)+t0 expr2 b>t0?b:(b-t0)*pow(pow((t0-b)/(t0-m),1/p)+1,-p)+t0 name PowerPToe label https://www.desmos.com/calculator/vbceracvcn xpos 180 ypos -472 addUserKnob {20 Params} addUserKnob {7 p} p 0.05 addUserKnob {7 m R -1 0} m -0.05 addUserKnob {7 t0} t0 1 } Dot { name Dot5 xpos 214 ypos -414 } set N4d7b0f00 [stack 0] Expression { temp_name0 mx temp_expr0 max(r,g,b) temp_name1 mn temp_expr1 min(r,g,b) expr0 mx==0?0:(r-mn)/mx expr1 mx==0?0:(g-mn)/mx expr2 mx==0?0:(b-mn)/mx expr3 mx==0?0:1-mn/mx name HueChromaRGB xpos 70 ypos -418 } Expression { expr0 min(2,max(0,r-(g+b))) expr1 min(2,max(0,g-(r+b))) expr2 min(2,max(0,b-(r+g))) name RGB xpos 70 ypos -392 } Dot { name Dot7 xpos 104 ypos -342 } set N4d773900 [stack 0] Dot { name Dot10 xpos 104 ypos -246 } set N4d773200 [stack 0] push $N4d7dc100 MergeExpression { inputs 2 temp_name0 f temp_expr0 (4*Aa*(1-Aa)) channel0 rgba expr0 min(2,r/(m*pow(r/m,p)*f+r*(1-f))) expr3 f name PowerPvLerp xpos -40 ypos -57 addUserKnob {20 Params} addUserKnob {7 p R 1 2} p 1.2 addUserKnob {7 m} m 0.5 } push $N4d7b2b00 push $N4d7b3200 Dot { name Dot6 xpos -116 ypos -342 } set N4d771d00 [stack 0] Expression { channel0 rgba expr0 r**(1/dch)*(1-r)+r*r name Power xpos -150 ypos -299 addUserKnob {20 Params} addUserKnob {7 dch R 0.25 1.25} dch 0.4 } Expression { channel0 rgba expr0 1-r name complement xpos -150 ypos -273 } Dot { name Dot8 xpos -116 ypos -222 } Dot { name Dot4 xpos -6 ypos -222 } set N4d770100 [stack 0] push $N4d773200 Merge2 { inputs 2 operation multiply bbox B name Merge349 xpos 70 ypos -184 } push $N4d770100 push $N4d773900 push $N4d771d00 MergeExpression { inputs 2 channel0 rgba expr0 Br*max(Ar**2,Ag**2,Ab**2) name chf xpos -40 ypos -345 } Expression { channel0 rgba expr0 pow(pow(a/m,1/p)+1,-p) name PowerP xpos -40 ypos -309 addUserKnob {20 Params} addUserKnob {7 m} m 0.25 addUserKnob {7 p} p 0.65 } push $N4d7b0f00 MergeExpression { inputs 2 temp_name0 mx temp_expr0 max(r,g,b) temp_name3 f temp_expr3 Ar channel0 {rgba.red -rgba.green -rgba.blue none} expr0 mx==0?0:r/mx*(1-f)+r*f expr1 mx==0?0:g/mx*(1-f)+g*f expr2 mx==0?0:b/mx*(1-f)+b*f expr3 f maskChannelMask rgba.blue name Normalize xpos 180 ypos -309 disable {{!parent.chn_enable}} } MergeExpression { inputs 2 temp_name0 f temp_expr0 Ar expr0 r*f+1-f expr1 g*f+1-f expr2 b*f+1-f name ChromaCompression41 xpos 180 ypos -226 disable {{!parent.dch_enable}} } MergeExpression { inputs 2+1 expr0 r+Ab*s2-Ag*s1 expr1 g+Ar*s0-Ab*s2 expr2 b+Ag*s1-Ar*s0 maskChannelMask rgba.red name ShiftRGB xpos 180 ypos -130 disable {{!parent.hs_enable}} addUserKnob {20 Params} addUserKnob {7 s0 R -1 1} s0 0.3 addUserKnob {7 s1 R -1 1} s1 -0.1 addUserKnob {7 s2 R -1 1} s2 -0.5 } MergeExpression { inputs 2 temp_name2 f temp_expr2 Ar temp_name3 L temp_expr3 r*rw+g*gw+b*bw expr0 L*(1-f)+r*f expr1 L*(1-f)+g*f expr2 L*(1-f)+b*f name Saturation xpos 180 ypos -58 addUserKnob {20 Params} addUserKnob {7 rw R 0.05 0.6} rw 0.23 addUserKnob {7 gw R 0.05 0.66} gw {{1-(rw+bw)}} addUserKnob {7 bw R 0.05 0.6} bw 0.08 } Merge2 { inputs 2 operation multiply bbox B output rgb name Merge2 xpos 180 ypos 9 } Expression { temp_name0 mx temp_expr0 dcdm?1:s channel0 {rgba.red -rgba.green -rgba.blue none} expr0 max(0,min(mx,r*s)) expr1 max(0,min(mx,g*s)) expr2 max(0,min(mx,b*s)) name DisplayScale xpos 180 ypos 55 addUserKnob {20 Params} addUserKnob {6 pq +STARTLINE} pq {{eotf==4}} addUserKnob {6 hlg -STARTLINE} hlg {{eotf==5}} addUserKnob {6 dcdm -STARTLINE} dcdm {{eotf==3&&display_gamut==5}} addUserKnob {7 s} s {{pq?Lp/10000:hlg?Lp/1000:dcdm?48/52.37:1}} } Group { name InverseEOTF xpos 180 ypos 81 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 -129 } set N4d70b200 [stack 0] Expression { temp_name0 Yd temp_expr0 0.2627*r+0.6780*g+0.0593*b expr0 r==0?0:r*pow(Yd,(1-_g)/_g) expr1 g==0?0:g*pow(Yd,(1-_g)/_g) expr2 b==0?0:b*pow(Yd,(1-_g)/_g) name HLG_InverseOOTF xpos 620 ypos -57 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(Lp/1000)/log(2))*pow(0.98,log(max(1e-6,Lamb)/5)/log(2))}} addUserKnob {7 Lw R 600 4000} Lw {{parent.parent.Lp}} 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 -34 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 $N4d70b200 Expression { temp_name0 rp temp_expr0 pow(r,m_1) temp_name1 gp temp_expr1 pow(g,m_1) temp_name2 bp temp_expr2 pow(b,m_1) expr0 pow((c_1+c_2*rp)/(1+c_3*rp),m_2) expr1 pow((c_1+c_2*gp)/(1+c_3*gp),m_2) expr2 pow((c_1+c_2*bp)/(1+c_3*bp),m_2) name ST2084_InverseEOTF xpos 510 ypos -58 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}} } push $N4d70b200 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 -58 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 14 } Output { name Output xpos 400 ypos 86 } end_group Output { name Output xpos 180 ypos 129 } end_group