from aces_ocio.colorspaces import aces
from aces_ocio.utilities import ColorSpace, mat44_from_mat33
-
__author__ = 'ACES Developers'
__copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
__license__ = ''
__all__ = ['create_matrix_colorspace',
'create_colorspaces']
+
# -------------------------------------------------------------------------
# *Matrix Transform*
# -------------------------------------------------------------------------
return cs
+
# -------------------------------------------------------------------------
# *Transfer Function Transform*
# -------------------------------------------------------------------------
cs.from_reference_transforms = []
return cs
+
+
# create_transfer_colorspace
# -------------------------------------------------------------------------
'direction': 'inverse'})
return cs
+
+
# create_matrix_plus_transfer_colorspace
# Transfer functions for standard color spaces
g = 2.4
if v < b:
- return v/d
+ return v / d
return pow(((v + (a - 1)) / a), g)
+
def transfer_function_Rec709_to_linear(v):
a = 1.099
b = 0.018
d = 4.5
- g = (1.0/0.45)
+ g = (1.0 / 0.45)
- if v < b*d:
- return v/d
+ if v < b * d:
+ return v / d
return pow(((v + (a - 1)) / a), g)
+
def transfer_function_Rec2020_10bit_to_linear(v):
a = 1.099
b = 0.018
d = 4.5
- g = (1.0/0.45)
+ g = (1.0 / 0.45)
- if v < b*d:
- return v/d
+ if v < b * d:
+ return v / d
return pow(((v + (a - 1)) / a), g)
+
def transfer_function_Rec2020_12bit_to_linear(v):
a = 1.0993
b = 0.0181
d = 4.5
- g = (1.0/0.45)
+ g = (1.0 / 0.45)
- if v < b*d:
- return v/d
+ if v < b * d:
+ return v / d
return pow(((v + (a - 1)) / a), g)
+
def transfer_function_Rec1886_to_linear(v):
g = 2.4
Lw = 1
Lb = 0
# Ignoring legal to full scaling for now
- #v = (1023.0*v - 64.0)/876.0
+ # v = (1023.0*v - 64.0)/876.0
- t = pow(Lw, 1.0/g) - pow(Lb, 1.0/g)
+ t = pow(Lw, 1.0 / g) - pow(Lb, 1.0 / g)
a = pow(t, g)
- b = pow(Lb, 1.0/g)/t
+ b = pow(Lb, 1.0 / g) / t
+
+ return a * pow(max((v + b), 0.0), g)
- return a*pow(max((v + b), 0.0), g)
def create_colorspaces(lut_directory,
lut_resolution_1d,
# XYZ
#
cs = create_matrix_colorspace('XYZ-D60',
- to_reference_values=[aces.ACES_XYZ_TO_AP0],
- from_reference_values=[aces.ACES_AP0_TO_XYZ],
- aliases=["lin_xyz_d60"])
+ to_reference_values=[aces.ACES_XYZ_TO_AP0],
+ from_reference_values=[aces.ACES_AP0_TO_XYZ],
+ aliases=["lin_xyz_d60"])
colorspaces.append(cs)
#
raw.is_data = True
return raw
-
-