Skip to content

Commit 586c6eb

Browse files
committed
Update default values and README link to calculations.
1 parent 0e9cc52 commit 586c6eb

File tree

8 files changed

+51
-46
lines changed

8 files changed

+51
-46
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ The following implementations are available in the [model](model) directory:
2828
- Nuke Script for [The Foundry Nuke](https://www.foundry.com/products/nuke)
2929
- Python Script for [Numpy](https://numpy.org/)
3030

31+
## Default Parameter Values
32+
This [Google Colab notebook](https://colab.research.google.com/drive/1ZMSQhyhXtAYQXfop6qhifXudDiPu4eTV?usp=sharing) shows calculations for the threshold values needed to protect the colors of the ColorChecker24, as defined in Annexe B of [TB-2014-004](http://j.mp/TB-2014-004), and the distance limits needed to map the entirety of a set of common camera encoding gamuts into AP1.
33+
3134
## Research
3235

3336
The [research](research) directory contains a mix of useful resources pertaining to research, experimentation and analysis conducted by the Virtual Working Group.

model/GamutCompress.dctl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
DEFINE_UI_PARAMS(threshold_r, threshold c, DCTLUI_SLIDER_FLOAT, 0.8f, 0.4f, 1.0f, 0.0f);
2-
DEFINE_UI_PARAMS(threshold_g, threshold m, DCTLUI_SLIDER_FLOAT, 0.8f, 0.4f, 1.0f, 0.0f);
3-
DEFINE_UI_PARAMS(threshold_b, threshold y, DCTLUI_SLIDER_FLOAT, 0.8f, 0.4f, 1.0f, 0.0f);
1+
DEFINE_UI_PARAMS(threshold_r, threshold c, DCTLUI_SLIDER_FLOAT, 0.815f, 0.4f, 1.0f, 0.0f);
2+
DEFINE_UI_PARAMS(threshold_g, threshold m, DCTLUI_SLIDER_FLOAT, 0.803f, 0.4f, 1.0f, 0.0f);
3+
DEFINE_UI_PARAMS(threshold_b, threshold y, DCTLUI_SLIDER_FLOAT, 0.88f, 0.4f, 1.0f, 0.0f);
44
DEFINE_UI_PARAMS(power, power, DCTLUI_SLIDER_FLOAT, 1.2f, 1.0f, 3.0f, 1.0f);
5-
DEFINE_UI_PARAMS(cyan, cyan, DCTLUI_SLIDER_FLOAT, 0.09f, 0.0f, 1.0f, 0.0f);
6-
DEFINE_UI_PARAMS(magenta, magenta, DCTLUI_SLIDER_FLOAT, 0.24f, 0.0f, 1.0f, 0.0f);
7-
DEFINE_UI_PARAMS(yellow, yellow, DCTLUI_SLIDER_FLOAT, 0.12f, 0.0f, 1.0f, 0.0f);
5+
DEFINE_UI_PARAMS(cyan, cyan, DCTLUI_SLIDER_FLOAT, 0.147f, 0.0f, 1.0f, 0.0f);
6+
DEFINE_UI_PARAMS(magenta, magenta, DCTLUI_SLIDER_FLOAT, 0.264f, 0.0f, 1.0f, 0.0f);
7+
DEFINE_UI_PARAMS(yellow, yellow, DCTLUI_SLIDER_FLOAT, 0.312f, 0.0f, 1.0f, 0.0f);
88
DEFINE_UI_PARAMS(working_colorspace, working space, DCTLUI_COMBO_BOX, 0, {acescct, acescc, acescg}, {acescct, acescc, acescg});
99
DEFINE_UI_PARAMS(invert, invert, DCTLUI_CHECK_BOX, 0);
1010
DEFINE_UI_PARAMS(overlay, overlay graph, DCTLUI_CHECK_BOX, 0)

model/GamutCompress.fuse

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,23 @@ function Create()
7373
InThresholdR = self:AddInput("threshold_c", "threshold_c", {
7474
LINKID_DataType = "Number",
7575
INPID_InputControl = "SliderControl",
76-
INP_Default = 0.8,
76+
INP_Default = 0.815,
7777
INP_MinAllowed = 0.4,
7878
INP_MaxScale = 0.9999,
7979
})
8080

8181
InThresholdG = self:AddInput("threshold_m", "threshold_m", {
8282
LINKID_DataType = "Number",
8383
INPID_InputControl = "SliderControl",
84-
INP_Default = 0.8,
84+
INP_Default = 0.803,
8585
INP_MinAllowed = 0.4,
8686
INP_MaxScale = 0.9999,
8787
})
8888

8989
InThresholdB = self:AddInput("threshold_y", "threshold_y", {
9090
LINKID_DataType = "Number",
9191
INPID_InputControl = "SliderControl",
92-
INP_Default = 0.8,
92+
INP_Default = 0.88,
9393
INP_MinAllowed = 0.4,
9494
INP_MaxScale = 0.9999,
9595
})
@@ -107,23 +107,23 @@ function Create()
107107
InCyan = self:AddInput("cyan", "cyan", {
108108
LINKID_DataType = "Number",
109109
INPID_InputControl = "SliderControl",
110-
INP_Default = 0.09,
110+
INP_Default = 0.147,
111111
INP_MinAllowed = 0,
112112
INP_MaxScale = 1,
113113
})
114114

115115
InMagenta = self:AddInput("magenta", "magenta", {
116116
LINKID_DataType = "Number",
117117
INPID_InputControl = "SliderControl",
118-
INP_Default = 0.24,
118+
INP_Default = 0.264,
119119
INP_MinAllowed = 0,
120120
INP_MaxScale = 1,
121121
})
122122

123123
InYellow = self:AddInput("yellow", "yellow", {
124124
LINKID_DataType = "Number",
125125
INPID_InputControl = "SliderControl",
126-
INP_Default = 0.12,
126+
INP_Default = 0.312,
127127
INP_MinAllowed = 0,
128128
INP_MaxScale = 1,
129129
})

model/GamutCompress.nk

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Group {
1111
addUserKnob {41 magenta t "Maximum distance beyond the blue-red gamut boundary to compress to the gamut boundary." T compress.magenta}
1212
addUserKnob {41 yellow t "Maximum distance beyond the red-green gamut boundary to compress to the gamut boundary." T compress.yellow}
1313
addUserKnob {6 overlay l "graph overlay" +STARTLINE}
14-
addUserKnob {22 reset t "Reset knobs to default values. Distance limits are calculated based on an the average of a selection of digital cinema cameras." T "n = nuke.thisNode()\nnuke.root().begin()\ndefaults = \{\n 'threshold': 0.8,\n 'power': 1.2,\n 'cyan': 0.09,\n 'magenta':0.24,\n 'yellow': 0.12,\n\}\nfor k, v in defaults.items():\n n\[k].setValue(v)" +STARTLINE}
14+
addUserKnob {22 reset t "Reset knobs to default values. Distance limits are calculated based on an the average of a selection of digital cinema cameras." T "n = nuke.thisNode()\nnuke.root().begin()\ndefaults = \{\n 'threshold': (0.815, 0.803, 0.88),\n 'power': 1.2,\n 'cyan': 0.147,\n 'magenta':0.264,\n 'yellow': 0.312,\n\}\nfor k, v in defaults.items():\n n\[k].setValue(v)" +STARTLINE}
1515
addUserKnob {26 ""}
1616
addUserKnob {4 direction M {forward inverse}}
1717
addUserKnob {20 info_tab l Info}
@@ -29,7 +29,7 @@ Group {
2929
xpos -6
3030
ypos -174
3131
}
32-
set N3ebe5400 [stack 0]
32+
set N5a326400 [stack 0]
3333
Dot {
3434
name Dot2
3535
xpos -226
@@ -42,8 +42,8 @@ set N3ebe5400 [stack 0]
4242
xpos -260
4343
ypos -130
4444
}
45-
set N3ebe4c00 [stack 0]
46-
push $N3ebe5400
45+
set N78acdc00 [stack 0]
46+
push $N5a326400
4747
Merge2 {
4848
inputs 2
4949
operation minus
@@ -55,13 +55,13 @@ push $N3ebe5400
5555
xpos -40
5656
ypos -130
5757
}
58-
push $N3ebe4c00
58+
push $N78acdc00
5959
Dot {
6060
name Dot1
6161
xpos -226
6262
ypos -78
6363
}
64-
set N3ebe4400 [stack 0]
64+
set N78acd400 [stack 0]
6565
Expression {
6666
expr0 abs(r)
6767
expr1 abs(g)
@@ -70,7 +70,7 @@ set N3ebe4400 [stack 0]
7070
xpos -167
7171
ypos -81
7272
}
73-
set N3ebe4000 [stack 0]
73+
set N78acd000 [stack 0]
7474
Merge2 {
7575
inputs 2
7676
operation divide
@@ -82,7 +82,7 @@ set N3ebe4000 [stack 0]
8282
xpos -40
8383
ypos -82
8484
}
85-
set N5e5b3c00 [stack 0]
85+
set N78accc00 [stack 0]
8686
Expression {
8787
expr0 "2 * x / (width - 1)"
8888
expr1 "2 * x / (width - 1)"
@@ -123,7 +123,7 @@ set N5e5b3c00 [stack 0]
123123
xpos -6
124124
ypos -30
125125
}
126-
set N5e5b3000 [stack 0]
126+
set N78acc000 [stack 0]
127127
Dot {
128128
name Dot1
129129
xpos 434
@@ -149,7 +149,7 @@ set N5e5b3000 [stack 0]
149149
addUserKnob {7 p R 1 5}
150150
p {{parent.power}}
151151
}
152-
push $N5e5b3000
152+
push $N78acc000
153153
Dot {
154154
name Dot6
155155
xpos -446
@@ -197,35 +197,35 @@ push $N5e5b3000
197197
xpos 180
198198
ypos 185
199199
}
200-
push $N3ebe4400
200+
push $N78acd400
201201
Dot {
202202
name Dot3
203203
xpos -226
204204
ypos 234
205205
}
206-
push $N3ebe4000
206+
push $N78acd000
207207
Dot {
208208
name Dot7
209209
xpos -133
210210
ypos 185
211211
}
212-
push $N5e5b3c00
212+
push $N78accc00
213213
Group {
214214
name compress
215215
xpos -40
216216
ypos 62
217217
addUserKnob {20 compress}
218218
addUserKnob {18 threshold R 0.4 1}
219-
threshold 0.8
219+
threshold {0.815 0.803 0.88}
220220
addUserKnob {6 threshold_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
221221
addUserKnob {7 power R 1 3}
222222
power 1.2
223223
addUserKnob {7 cyan}
224-
cyan 0.09
224+
cyan 0.147
225225
addUserKnob {7 magenta}
226-
magenta 0.24
226+
magenta 0.264
227227
addUserKnob {7 yellow}
228-
yellow 0.12
228+
yellow 0.312
229229
addUserKnob {26 ""}
230230
addUserKnob {26 ""}
231231
addUserKnob {6 invert +STARTLINE}
@@ -242,7 +242,7 @@ push $N5e5b3c00
242242
xpos -6
243243
ypos -30
244244
}
245-
set N5e0fc800 [stack 0]
245+
set N73b23800 [stack 0]
246246
Dot {
247247
name Dot1
248248
xpos 434
@@ -268,7 +268,7 @@ set N5e0fc800 [stack 0]
268268
addUserKnob {7 p R 1 5}
269269
p {{parent.power}}
270270
}
271-
push $N5e0fc800
271+
push $N73b23800
272272
Dot {
273273
name Dot6
274274
xpos -446
@@ -329,7 +329,7 @@ push $N5e0fc800
329329
xpos -40
330330
ypos 230
331331
}
332-
set N5d480c00 [stack 0]
332+
set N6a8a9c00 [stack 0]
333333
Merge2 {
334334
inputs 2
335335
name Merge7
@@ -341,7 +341,7 @@ set N5d480c00 [stack 0]
341341
xpos 214
342342
ypos 268
343343
}
344-
push $N5d480c00
344+
push $N6a8a9c00
345345
Switch {
346346
inputs 2
347347
which {{parent.overlay}}

model/GamutCompress.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ https://community.acescentral.com/c/aces-development-acesnext/vwg-aces-gamut-map
6666
</Uniform>
6767
<Uniform Inc="0.01" Tooltip="Percentage of the outer gamut boundary to protect. A value of 0.8 means 20% of the outer gamut will be utilized for gamut compression."
6868
Row="3" Col="0" Page="0" IconType="None" ValueType="Position" Type="vec3" ChannelName="threshold" DisplayName="threshold" Name="threshold">
69-
<SubUniform ResDependent="None" Max="1.0" Min="0.4" Default="0.8">
69+
<SubUniform ResDependent="None" Max="1.0" Min="0.4" Default="0.815">
7070
</SubUniform>
71-
<SubUniform ResDependent="None" Max="1.0" Min="0.4" Default="0.8">
71+
<SubUniform ResDependent="None" Max="1.0" Min="0.4" Default="0.803">
7272
</SubUniform>
73-
<SubUniform ResDependent="None" Max="1.0" Min="0.4" Default="0.8">
73+
<SubUniform ResDependent="None" Max="1.0" Min="0.4" Default="0.88">
7474
</SubUniform>
7575
</Uniform>
7676
<Uniform ResDependent="None" Max="3" Min="1" Default="1.2" Inc="0.01"
@@ -79,15 +79,15 @@ https://community.acescentral.com/c/aces-development-acesnext/vwg-aces-gamut-map
7979
Be wary of high values if accurate inversion is important to you."
8080
Row="3" Col="1" Page="0" Type="float" ChannelName="power" DisplayName="power" Name="power">
8181
</Uniform>
82-
<Uniform ResDependent="None" Max="1.0" Min="0.0" Default="0.09" Inc="0.01"
82+
<Uniform ResDependent="None" Max="1.0" Min="0.0" Default="0.147" Inc="0.01"
8383
Tooltip="Maximum distance beyond the green-blue gamut boundary to compress to the gamut boundary."
8484
Row="0" Col="0" Page="0" Type="float" ChannelName="cyan" DisplayName="cyan" Name="cyan">
8585
</Uniform>
86-
<Uniform ResDependent="None" Max="1.0" Min="0.0" Default="0.24" Inc="0.01"
86+
<Uniform ResDependent="None" Max="1.0" Min="0.0" Default="0.264" Inc="0.01"
8787
Tooltip="Maximum distance beyond the blue-red gamut boundary to compress to the gamut boundary."
8888
Row="1" Col="0" Page="0" Type="float" ChannelName="magenta" DisplayName="magenta" Name="magenta">
8989
</Uniform>
90-
<Uniform ResDependent="None" Max="1.0" Min="0.0" Default="0.12" Inc="0.01"
90+
<Uniform ResDependent="None" Max="1.0" Min="0.0" Default="0.312" Inc="0.01"
9191
Tooltip="Maximum distance beyond the red-green gamut boundary to compress to the gamut boundary."
9292
Row="2" Col="0" Page="0" Type="float" ChannelName="yellow" DisplayName="yellow" Name="yellow">
9393
</Uniform>

model/GamutCompress_blink.nk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ Group {
77
addUserKnob {6 use_gpu l "use gpu" t "use gpu for blinkscript node" -STARTLINE}
88
use_gpu true
99
addUserKnob {18 threshold t "Percentage of the gamut protect. A value of 0.8 means 20% of the outer gamut will be utilized for gamut compression." R 0.4 1}
10-
threshold 0.8
10+
threshold {0.815 0.803 0.88}
1111
addUserKnob {6 threshold_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
1212
addUserKnob {7 power t "Adjust the aggressiveness of the curve. 1 is equal to reinhard. Higher values bias compressed values closer to the gamut boundary." R 1 3}
1313
power 1.2
1414
addUserKnob {26 distance_limit_label l " " t "Specifies the distance beyond the gamut boundary to map to the gamut boundary for each color component." T "<b>distance limit"}
1515
addUserKnob {7 cyan t "Maximum distance beyond the green-blue gamut boundary to compress to the gamut boundary." R 0.001 1}
16-
cyan 0.09
16+
cyan 0.147
1717
addUserKnob {7 magenta t "Maximum distance beyond the blue-red gamut boundary to compress to the gamut boundary." R 0.001 1}
18-
magenta 0.24
18+
magenta 0.264
1919
addUserKnob {7 yellow t "Maximum distance beyond the red-green gamut boundary to compress to the gamut boundary." R 0.001 1}
20-
yellow 0.12
20+
yellow 0.312
2121
addUserKnob {6 overlay l "graph overlay" +STARTLINE}
22-
addUserKnob {22 reset t "Reset knobs to default values. Distance limits are calculated based on an the average of a selection of digital cinema cameras." T "n = nuke.thisNode()\nnuke.root().begin()\ndefaults = \{\n 'threshold': 0.8,\n 'power': 1.2,\n 'cyan': 0.09,\n 'magenta':0.24,\n 'yellow': 0.12,\n\}\nfor k, v in defaults.items():\n n\[k].setValue(v)" +STARTLINE}
22+
addUserKnob {22 reset t "Reset knobs to default values. Distance limits are calculated based on an the average of a selection of digital cinema cameras." T "n = nuke.thisNode()\nnuke.root().begin()\ndefaults = \{\n 'threshold': (0.815, 0.803, 0.88),\n 'power': 1.2,\n 'cyan': 0.147,\n 'magenta':0.264,\n 'yellow': 0.312,\n\}\nfor k, v in defaults.items():\n n\[k].setValue(v)" +STARTLINE}
2323
addUserKnob {26 ""}
2424
addUserKnob {4 direction M {forward inverse}}
2525
addUserKnob {20 info_tab l Info}

model/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ DCC Implementations for the following software packages are included. For specif
2929
- [DCTL for Resolve Studio](/model/docs/doc-resolve.md)
3030
- [Matchbox for Flame, Scratch and Baselight](/model/docs/doc-flame.md)
3131

32+
A Python implementation is also included.
33+
3234
## Default Parameter Values
33-
This [Google Colab notebook](https://colab.research.google.com/drive/1YNpvXfbipfVl2K5GYgo_byn2gV2iwGcm?usp=sharing) shows calculations for the threshold values needed to protect the colors of the ColorChecker24, [as defined in Table D.1 of SMPTE ST.2065-1](https://docs.google.com/spreadsheets/d/14S63V-BpG9l9KoNFvLb7W02dPRb3LNjdLRT7RZjKtkY), and the distance limits needed to map the entirety of a set of common camera encoding gamuts into AP1.
35+
This [Google Colab notebook](https://colab.research.google.com/drive/1ZMSQhyhXtAYQXfop6qhifXudDiPu4eTV?usp=sharing) shows calculations for the threshold values needed to protect the colors of the ColorChecker24, as defined in Annexe B of [TB-2014-004](http://j.mp/TB-2014-004), and the distance limits needed to map the entirety of a set of common camera encoding gamuts into AP1.
3436

3537
## Documentation
3638
For more information about [how the it works](/model/docs/gamut-compress-algorithm.md) and [how to use it](/model/docs/gamut-compress-documentation.md), please check out the [documentation](/model/docs).

model/gamut_compress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def compress(dist, lim, thr, invert, power):
3434
return cdist
3535

3636

37-
def main(rgb, invert=False, threshold=0.8, cyan=0.09, magenta=0.24, yellow=0.12, power=1.2):
37+
def main(rgb, invert=False, threshold=[0.815, 0.803, 0.88], cyan=0.147, magenta=0.264, yellow=0.312, power=1.2):
3838
rgb = np.asarray(rgb)
3939
threshold = np.asarray(threshold)
4040
if not threshold.shape:

0 commit comments

Comments
 (0)