in src/open_vp_cal/core/ocio_config.py [0:0]
def create_inverse_eotf_group(tgt_eotf: str) -> ocio.GroupTransform:
""" Create an OCIO group transform for the inverse EOTF
Args:
tgt_eotf: The target EOTF
Returns: The OCIO group transform for the inverse EOTF
"""
inverse_eotf_group_transform = ocio.GroupTransform()
if tgt_eotf:
if tgt_eotf.startswith("gamma "):
gamma = float(tgt_eotf[5:])
inverse_eotf_group_transform.appendTransform(
ocio.ExponentTransform(
value=[gamma, gamma, gamma, 1],
negativeStyle=ocio.NegativeStyle.NEGATIVE_PASS_THRU,
direction=ocio.TransformDirection.TRANSFORM_DIR_INVERSE)
)
elif tgt_eotf == EOTF.EOTF_ST2084:
# OCIO PQ builtin expects 1 to be 100nits
inverse_eotf_group_transform.appendTransform(
ocio.BuiltinTransform(
"CURVE - ST-2084_to_LINEAR",
direction=ocio.TransformDirection.TRANSFORM_DIR_INVERSE,
)
)
elif tgt_eotf == EOTF.EOTF_BT1886:
inverse_eotf_group_transform.appendTransform(
ocio.ExponentTransform(
value=2.4, negativeStyle=ocio.NegativeStyle.NEGATIVE_PASS_THRU,
direction=ocio.TransformDirection.TRANSFORM_DIR_INVERSE,
)
)
elif tgt_eotf == EOTF.EOTF_SRGB:
inverse_eotf_group_transform.appendTransform(
ocio.ExponentWithLinearTransform(
gamma=[2.4, 2.4, 2.4, 2.4], offset=[0.055, 0.055, 0.055, 0.055],
direction=ocio.TransformDirection.TRANSFORM_DIR_INVERSE,
)
)
else:
raise RuntimeError("Unknown EOTF: " + tgt_eotf)
return inverse_eotf_group_transform