Skip to content

Commit

Permalink
PR: ACES 1.x Varnishing (AcademySoftwareFoundation#132)
Browse files Browse the repository at this point in the history
* Implement various aliasing and naming updates.

Signed-off-by: Thomas Mansencal <[email protected]>

* Insert the *Un-tone-mapped* view transform at the beginning of the view transforms list for *OpenColorIO* profile lesser or equal to 2.3.

Signed-off-by: Thomas Mansencal <[email protected]>

* Update various colourspace names according to latest *ASWF Color Interop Forum* recommendations.

Signed-off-by: Thomas Mansencal <[email protected]>

* Address code review notes.

Signed-off-by: Thomas Mansencal <[email protected]>

* Re-order various *Colorspace*s and *NamedTransform*s.

Signed-off-by: Thomas Mansencal <[email protected]>

---------

Signed-off-by: Thomas Mansencal <[email protected]>
  • Loading branch information
KelSolaar authored Sep 17, 2024
1 parent bc2614e commit 9c764b4
Show file tree
Hide file tree
Showing 16 changed files with 103 additions and 74 deletions.
40 changes: 20 additions & 20 deletions opencolorio_config_aces/clf/transforms/ocio/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def generate_clf_transforms_ocio(output_directory):
style=style,
)

name = "AP0_to_CIE-XYZ-D65-Scene-referred"
name = "AP0_to_CIE_XYZ-D65-Scene-referred"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
M_ACES = colour.RGB_COLOURSPACES["ACES2065-1"].matrix_RGB_to_XYZ
Expand All @@ -118,7 +118,7 @@ def generate_clf_transforms_ocio(output_directory):
filename,
[matrix_transform(M_XYZ)],
clf_transform_id,
"AP0 to CIE-XYZ-D65",
"AP0 to CIE XYZ-D65",
"ACES2065-1",
"CIE XYZ, D65 white point",
)
Expand Down Expand Up @@ -171,7 +171,7 @@ def generate_clf_transforms_ocio(output_directory):
"linear Adobe RGB (1998) primaries, D65 white point",
)

name = "AP0_to_sRGB-Scene-referred"
name = "AP0_to_sRGB-Encoded-Rec709"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
clf_transforms[filename] = generate_clf_transform(
Expand All @@ -181,12 +181,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform("sRGB"),
],
clf_transform_id,
"AP0 to sRGB Rec.709",
"AP0 to sRGB Encoded Rec.709 (sRGB)",
"ACES2065-1",
"sRGB",
)

name = "AP0_to_Gamma1.8_Rec709-Scene-referred"
name = "AP0_to_Gamma1.8_Encoded_Rec709"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
clf_transforms[filename] = generate_clf_transform(
Expand All @@ -196,12 +196,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(1.8),
],
clf_transform_id,
"AP0 to Gamma 1.8 Rec.709 - Scene-referred",
"AP0 to Gamma 1.8 Encoded Rec.709",
"ACES2065-1",
"1.8 gamma-corrected Rec.709 primaries, D65 white point",
)

name = "AP0_to_Gamma2.2_Rec709-Scene-referred"
name = "AP0_to_Gamma2.2_Encoded_Rec709"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
clf_transforms[filename] = generate_clf_transform(
Expand All @@ -211,12 +211,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(2.2),
],
clf_transform_id,
"AP0 to Gamma 2.2 Rec.709 - Scene-referred",
"AP0 to Gamma 2.2 Encoded Rec.709",
"ACES2065-1",
"2.2 gamma-corrected Rec.709 primaries, D65 white point",
)

name = "AP0_to_Gamma2.4_Rec709-Scene-referred"
name = "AP0_to_Gamma2.4_Encoded_Rec709"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
clf_transforms[filename] = generate_clf_transform(
Expand All @@ -226,12 +226,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(2.4),
],
clf_transform_id,
"AP0 to Gamma 2.4 Rec.709 - Scene-referred",
"AP0 to Gamma 2.4 Encoded Rec.709",
"ACES2065-1",
"2.4 gamma-corrected Rec.709 primaries, D65 white point",
)

name = "AP0_to_Gamma2.2_AP1-Scene-referred"
name = "AP0_to_Gamma2.2_Encoded_AP1"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
clf_transforms[filename] = generate_clf_transform(
Expand All @@ -241,12 +241,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(2.2),
],
clf_transform_id,
"AP0 to Gamma 2.2 AP1 - Scene-referred",
"AP0 to Gamma 2.2 Encoded AP1",
"ACES2065-1",
"2.2 gamma-corrected AP1 primaries, ACES ~=D60 white point",
)

name = "AP0_to_sRGB_Encoded_AP1-Scene-referred"
name = "AP0_to_sRGB_Encoded_AP1"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
clf_transforms[filename] = generate_clf_transform(
Expand All @@ -256,27 +256,27 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform("sRGB"),
],
clf_transform_id,
"AP0 to sRGB Encoded AP1 - Scene-referred",
"AP0 to sRGB Encoded AP1",
"ACES2065-1",
"sRGB Encoded AP1 primaries, ACES ~=D60 white point",
)

name = "AP0_to_sRGB_Encoded_P3-D65-Scene-referred"
name = "AP0_to_sRGB_Encoded_P3-D65"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
clf_transforms[filename] = generate_clf_transform(
filename,
[
matrix_RGB_to_RGB_transform("ACES2065-1", "P3-D65"),
matrix_RGB_to_RGB_transform("ACES2065-1", "Display P3"),
gamma_transform("sRGB"),
],
clf_transform_id,
"AP0 to sRGB Encoded P3-D65 - Scene-referred",
"AP0 to sRGB Encoded P3-D65",
"ACES2065-1",
"sRGB Encoded P3-D65 primaries, D65 white point",
)

name = "AP0_to_AdobeRGB-Scene-referred"
name = "AP0_to_Gamma2.2_Encoded_AdobeRGB"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
clf_transforms[filename] = generate_clf_transform(
Expand All @@ -286,9 +286,9 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(563 / 256),
],
clf_transform_id,
"AP0 to Adobe RGB (1998) - Scene-referred",
"AP0 to Gamma 2.2 Encoded AdobeRGB",
"ACES2065-1",
"Adobe RGB (1998) primaries, D65 white point",
"2.2 gamma-corrected AdobeRGB primaries, D65 white point",
)

return clf_transforms
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_CIE-XYZ-D65-Scene-referred:1.0" name="AP0 to CIE-XYZ-D65">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_CIE_XYZ-D65-Scene-referred:1.0" name="AP0 to CIE XYZ-D65">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>CIE XYZ, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma1.8_Rec709-Scene-referred:1.0" name="AP0 to Gamma 1.8 Rec.709 - Scene-referred">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma1.8_Encoded_Rec709:1.0" name="AP0 to Gamma 1.8 Encoded Rec.709">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>1.8 gamma-corrected Rec.709 primaries, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.2_AP1-Scene-referred:1.0" name="AP0 to Gamma 2.2 AP1 - Scene-referred">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.2_Encoded_AP1:1.0" name="AP0 to Gamma 2.2 Encoded AP1">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>2.2 gamma-corrected AP1 primaries, ACES ~=D60 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_AdobeRGB-Scene-referred:1.0" name="AP0 to Adobe RGB (1998) - Scene-referred">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.2_Encoded_AdobeRGB:1.0" name="AP0 to Gamma 2.2 Encoded AdobeRGB">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>Adobe RGB (1998) primaries, D65 white point</OutputDescriptor>
<OutputDescriptor>2.2 gamma-corrected AdobeRGB primaries, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
<Array dim="3 3">
1.72456031681181 -0.419993594161504 -0.304566722650304
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.2_Rec709-Scene-referred:1.0" name="AP0 to Gamma 2.2 Rec.709 - Scene-referred">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.2_Encoded_Rec709:1.0" name="AP0 to Gamma 2.2 Encoded Rec.709">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>2.2 gamma-corrected Rec.709 primaries, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.4_Rec709-Scene-referred:1.0" name="AP0 to Gamma 2.4 Rec.709 - Scene-referred">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Gamma2.4_Encoded_Rec709:1.0" name="AP0 to Gamma 2.4 Encoded Rec.709">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>2.4 gamma-corrected Rec.709 primaries, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB-Scene-referred:1.0" name="AP0 to sRGB Rec.709">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB-Encoded-Rec709:1.0" name="AP0 to sRGB Encoded Rec.709 (sRGB)">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>sRGB</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB_Encoded_AP1-Scene-referred:1.0" name="AP0 to sRGB Encoded AP1 - Scene-referred">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB_Encoded_AP1:1.0" name="AP0 to sRGB Encoded AP1">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>sRGB Encoded AP1 primaries, ACES ~=D60 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB_Encoded_P3-D65-Scene-referred:1.0" name="AP0 to sRGB Encoded P3-D65 - Scene-referred">
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB_Encoded_P3-D65:1.0" name="AP0 to sRGB Encoded P3-D65">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>sRGB Encoded P3-D65 primaries, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
22 changes: 17 additions & 5 deletions opencolorio_config_aces/config/cg/generate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ def view_filterer(transform):

data.inactive_colorspaces = [
*inactive_colorspaces,
"CIE-XYZ-D65 - Display-referred",
"CIE XYZ-D65 - Display-referred",
]

# Roles Filtering & Update
Expand All @@ -1177,19 +1177,19 @@ def view_filterer(transform):

data.roles.update(
{
ocio.ROLE_COLOR_PICKING: "sRGB - Scene-referred",
ocio.ROLE_COLOR_PICKING: "sRGB Encoded Rec.709 (sRGB)",
ocio.ROLE_COLOR_TIMING: format_optional_prefix("ACEScct", "ACES", scheme),
ocio.ROLE_COMPOSITING_LOG: format_optional_prefix(
"ACEScct", "ACES", scheme
),
ocio.ROLE_DATA: "Raw",
ocio.ROLE_INTERCHANGE_DISPLAY: "CIE-XYZ-D65 - Display-referred",
ocio.ROLE_INTERCHANGE_DISPLAY: "CIE XYZ-D65 - Display-referred",
ocio.ROLE_INTERCHANGE_SCENE: format_optional_prefix(
"ACES2065-1", "ACES", scheme
),
ocio.ROLE_MATTE_PAINT: format_optional_prefix("ACEScct", "ACES", scheme),
ocio.ROLE_SCENE_LINEAR: format_optional_prefix("ACEScg", "ACES", scheme),
ocio.ROLE_TEXTURE_PAINT: "sRGB - Scene-referred",
ocio.ROLE_TEXTURE_PAINT: "sRGB Encoded Rec.709 (sRGB)",
}
)

Expand Down Expand Up @@ -1234,7 +1234,6 @@ def view_filterer(transform):
dependency_versions=dependency_versions,
additional_data=True,
)

# TODO: Pickling "PyOpenColorIO.ColorSpace" fails on early "PyOpenColorIO"
# versions.
try:
Expand All @@ -1243,3 +1242,16 @@ def view_filterer(transform):
)
except TypeError as error:
logging.critical(error)

if dependency_versions.ocio.minor <= 3:
config = ocio.Config.CreateFromFile( # pyright:ignore
str(build_directory / config_basename)
)
view_transforms = list(config.getViewTransforms())
view_transforms = [view_transforms[-1], *view_transforms[:-1]]
config.clearViewTransforms()
for view_transform in view_transforms:
config.addViewTransform(view_transform)

with open(build_directory / config_basename, "w") as file:
file.write(config.serialize())
Loading

0 comments on commit 9c764b4

Please sign in to comment.