Skip to content

Commit

Permalink
PR: Before ACES 2.0... (AcademySoftwareFoundation#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar authored Aug 25, 2024
1 parent e1daf4e commit bc2614e
Show file tree
Hide file tree
Showing 22 changed files with 203 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ jobs:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
os: [macOS-13, ubuntu-20.04, windows-latest]
# os: [macOS-13, ubuntu-20.04, windows-latest]
os: [macOS-13, ubuntu-20.04]
python-version: [3.11]
fail-fast: false
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 1 addition & 2 deletions opencolorio_config_aces/clf/discover/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,8 +1188,7 @@ def unclassify_clf_transforms(
... discover_clf_transforms())
>>> sorted( # doctest: +ELLIPSIS
... unclassify_clf_transforms(clf_transforms), key=lambda x: x.path)[0]
CLFTransform(\
'arri...input...ARRI.Input.ARRI_LogC3_Curve_EI800.clf')
CLFTransform('apple...input...Apple.Input.Apple_Log-Curve.clf')
"""

unclassified_clf_transforms = []
Expand Down
81 changes: 68 additions & 13 deletions opencolorio_config_aces/clf/transforms/ocio/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
gamma_transform,
generate_clf_transform,
matrix_RGB_to_RGB_transform,
matrix_transform,
)
from opencolorio_config_aces.utilities import required

__author__ = "OpenColorIO Contributors"
__copyright__ = "Copyright Contributors to the OpenColorIO Project."
Expand Down Expand Up @@ -50,9 +52,12 @@
"""


@required("Colour")
def generate_clf_transforms_ocio(output_directory):
"""Generate OCIO Utility CLF transforms."""

import colour

output_directory.mkdir(parents=True, exist_ok=True)

clf_transforms = {}
Expand Down Expand Up @@ -95,6 +100,29 @@ def generate_clf_transforms_ocio(output_directory):
style=style,
)

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
XYZ_ACES = colour.xy_to_XYZ(colour.RGB_COLOURSPACES["ACES2065-1"].whitepoint)
XYZ_D65 = colour.xy_to_XYZ(
colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"]
)
M_XYZ = colour.algebra.matrix_dot(
colour.adaptation.matrix_chromatic_adaptation_VonKries(
XYZ_ACES, XYZ_D65, "Bradford"
),
M_ACES,
)
clf_transforms[filename] = generate_clf_transform(
filename,
[matrix_transform(M_XYZ)],
clf_transform_id,
"AP0 to CIE-XYZ-D65",
"ACES2065-1",
"CIE XYZ, D65 white point",
)

name = "AP0_to_Linear_P3-D65"
clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION)
filename = output_directory / clf_basename(clf_transform_id)
Expand Down Expand Up @@ -131,7 +159,19 @@ def generate_clf_transforms_ocio(output_directory):
"linear Rec.709 primaries, D65 white point",
)

name = "AP0_to_sRGB-Texture"
name = "AP0_to_Linear_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(
filename,
[matrix_RGB_to_RGB_transform("ACES2065-1", "Adobe RGB (1998)")],
clf_transform_id,
"AP0 to Linear Adobe RGB (1998)",
"ACES2065-1",
"linear Adobe RGB (1998) primaries, D65 white point",
)

name = "AP0_to_sRGB-Scene-referred"
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 @@ -146,7 +186,7 @@ def generate_clf_transforms_ocio(output_directory):
"sRGB",
)

name = "AP0_to_Gamma1.8_Rec709-Texture"
name = "AP0_to_Gamma1.8_Rec709-Scene-referred"
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 @@ -156,12 +196,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(1.8),
],
clf_transform_id,
"AP0 to Gamma 1.8 Rec.709 - Texture",
"AP0 to Gamma 1.8 Rec.709 - Scene-referred",
"ACES2065-1",
"1.8 gamma-corrected Rec.709 primaries, D65 white point",
)

name = "AP0_to_Gamma2.2_Rec709-Texture"
name = "AP0_to_Gamma2.2_Rec709-Scene-referred"
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 @@ -171,12 +211,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(2.2),
],
clf_transform_id,
"AP0 to Gamma 2.2 Rec.709 - Texture",
"AP0 to Gamma 2.2 Rec.709 - Scene-referred",
"ACES2065-1",
"2.2 gamma-corrected Rec.709 primaries, D65 white point",
)

name = "AP0_to_Gamma2.4_Rec709-Texture"
name = "AP0_to_Gamma2.4_Rec709-Scene-referred"
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 @@ -186,12 +226,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(2.4),
],
clf_transform_id,
"AP0 to Gamma 2.4 Rec.709 - Texture",
"AP0 to Gamma 2.4 Rec.709 - Scene-referred",
"ACES2065-1",
"2.4 gamma-corrected Rec.709 primaries, D65 white point",
)

name = "AP0_to_Gamma2.2_AP1-Texture"
name = "AP0_to_Gamma2.2_AP1-Scene-referred"
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 @@ -201,12 +241,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform(2.2),
],
clf_transform_id,
"AP0 to Gamma 2.2 AP1 - Texture",
"AP0 to Gamma 2.2 AP1 - Scene-referred",
"ACES2065-1",
"2.2 gamma-corrected AP1 primaries, ACES ~=D60 white point",
)

name = "AP0_to_sRGB_Encoded_AP1-Texture"
name = "AP0_to_sRGB_Encoded_AP1-Scene-referred"
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 @@ -216,12 +256,12 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform("sRGB"),
],
clf_transform_id,
"AP0 to sRGB Encoded AP1 - Texture",
"AP0 to sRGB Encoded AP1 - Scene-referred",
"ACES2065-1",
"sRGB Encoded AP1 primaries, ACES ~=D60 white point",
)

name = "AP0_to_sRGB_Encoded_P3-D65-Texture"
name = "AP0_to_sRGB_Encoded_P3-D65-Scene-referred"
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 @@ -231,11 +271,26 @@ def generate_clf_transforms_ocio(output_directory):
gamma_transform("sRGB"),
],
clf_transform_id,
"AP0 to sRGB Encoded P3-D65 - Texture",
"AP0 to sRGB Encoded P3-D65 - Scene-referred",
"ACES2065-1",
"sRGB Encoded P3-D65 primaries, D65 white point",
)

name = "AP0_to_AdobeRGB-Scene-referred"
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", "Adobe RGB (1998)"),
gamma_transform(563 / 256),
],
clf_transform_id,
"AP0 to Adobe RGB (1998) - Scene-referred",
"ACES2065-1",
"Adobe RGB (1998) primaries, D65 white point",
)

return clf_transforms


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>Adobe RGB (1998) primaries, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
<Array dim="3 3">
1.72456031681181 -0.419993594161504 -0.304566722650304
-0.276479914229922 1.37271908766826 -0.0962391734383339
-0.0261255258256649 -0.0901747806551909 1.11630030648086
</Array>
</Matrix>
<Exponent inBitDepth="32f" outBitDepth="32f" style="basicPassThruRev">
<ExponentParams exponent="2.19921875" />
</Exponent>
</ProcessList>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>CIE XYZ, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
<Array dim="3 3">
0.938279849239345 -0.00445144581227847 0.0166275235564231
0.337368890823117 0.729521566676754 -0.066890457499083
0.00117395084939056 -0.00371070640198378 1.09159450636463
</Array>
</Matrix>
</ProcessList>
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-Texture:1.0" name="AP0 to Gamma 1.8 Rec.709 - Texture">
<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">
<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-Texture:1.0" name="AP0 to Gamma 2.2 AP1 - Texture">
<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">
<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,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-Texture:1.0" name="AP0 to Gamma 2.2 Rec.709 - Texture">
<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">
<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-Texture:1.0" name="AP0 to Gamma 2.4 Rec.709 - Texture">
<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">
<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
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_Linear_AdobeRGB:1.0" name="AP0 to Linear Adobe RGB (1998)">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>linear Adobe RGB (1998) primaries, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
<Array dim="3 3">
1.72456031681181 -0.419993594161504 -0.304566722650304
-0.276479914229922 1.37271908766826 -0.0962391734383339
-0.0261255258256649 -0.0901747806551909 1.11630030648086
</Array>
</Matrix>
</ProcessList>
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-Texture:1.0" name="AP0 to sRGB Rec.709">
<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">
<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-Texture:1.0" name="AP0 to sRGB Encoded AP1 - Texture">
<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">
<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-Texture:1.0" name="AP0 to sRGB Encoded P3-D65 - Texture">
<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">
<InputDescriptor>ACES2065-1</InputDescriptor>
<OutputDescriptor>sRGB Encoded P3-D65 primaries, D65 white point</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<OutputDescriptor>ACES2065-1</OutputDescriptor>
<Matrix inBitDepth="32f" outBitDepth="32f">
<Array dim="3 3">
0.793329741146434 0.0890786256206771 0.117591633232888
0.793329741146434 0.089078625620677 0.117591633232888
0.0155810585252582 1.03271230692988 -0.0482933654551394
-0.0188647477991488 0.0127694120973433 1.0060953357018
-0.0188647477991488 0.0127694120973433 1.00609533570181
</Array>
</Matrix>
</ProcessList>
28 changes: 18 additions & 10 deletions opencolorio_config_aces/config/cg/generate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ def clf_transform_to_description(
if clf_transform.description is not None:
if direction.lower() == "forward":
description.append(
f"Convert {clf_transform.output_descriptor} "
f"to {clf_transform.input_descriptor}"
f"Convert {clf_transform.input_descriptor} "
f"to {clf_transform.output_descriptor}"
)
else:
description.append(
f"Convert {clf_transform.input_descriptor} "
f"to {clf_transform.output_descriptor}"
f"Convert {clf_transform.output_descriptor} "
f"to {clf_transform.input_descriptor}"
)
elif describe in ( # noqa: SIM102
DescriptionStyle.OPENCOLORIO,
Expand Down Expand Up @@ -328,7 +328,7 @@ def clf_transform_to_colorspace(
"name": clf_transform_to_colorspace_name(clf_transform),
"family": clf_transform_to_family(clf_transform),
"description": clf_transform_to_description(
clf_transform, describe, amf_components
clf_transform, describe, amf_components, "Forward"
),
}

Expand Down Expand Up @@ -598,10 +598,15 @@ def style_to_named_transform(
colorspace_signature = clf_transform_to_colorspace(
clf_transform, describe, amf_components, True, **kwargs
)
description = colorspace_signature["description"]
signature.update(colorspace_signature)
signature.pop("from_reference", None)
source = clf_transform.source
description = clf_transform_to_description(
clf_transform,
describe,
amf_components,
"Reverse" if is_reference(source) else "Forward",
)
else:
# TODO: Implement solid "BuiltinTransform" source detection.
source = (
Expand Down Expand Up @@ -1156,7 +1161,10 @@ def view_filterer(transform):

inactive_colorspaces.append(colorspace)

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

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

data.roles.update(
{
ocio.ROLE_COLOR_PICKING: "sRGB - Texture",
ocio.ROLE_COLOR_PICKING: "sRGB - Scene-referred",
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",
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 - Texture",
ocio.ROLE_TEXTURE_PAINT: "sRGB - Scene-referred",
}
)

Expand Down
Loading

0 comments on commit bc2614e

Please sign in to comment.