X-Git-Url: http://users.mur.at/ms/git/gitweb/?p=OpenColorIO-Configs.git;a=blobdiff_plain;f=aces_1.0.0%2Fpython%2Faces_ocio%2Fcolorspaces%2Fgeneral.py;h=3059b064e2774d6f9b1f3eff3221afdb6850e3ec;hp=1a05f06c81122bbcd59a8b32f841bbc4315767c7;hb=cad9d48a0f1067769435904348e9fffeffd25eb9;hpb=01bc8e5971bed3bf33197715d7c38c785f41467d diff --git a/aces_1.0.0/python/aces_ocio/colorspaces/general.py b/aces_1.0.0/python/aces_ocio/colorspaces/general.py index 1a05f06..3059b06 100644 --- a/aces_1.0.0/python/aces_ocio/colorspaces/general.py +++ b/aces_1.0.0/python/aces_ocio/colorspaces/general.py @@ -16,7 +16,6 @@ import aces_ocio.generate_lut as genlut 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__ = '' @@ -27,6 +26,7 @@ __status__ = 'Production' __all__ = ['create_matrix_colorspace', 'create_colorspaces'] + # ------------------------------------------------------------------------- # *Matrix Transform* # ------------------------------------------------------------------------- @@ -83,6 +83,7 @@ def create_matrix_colorspace(name='matrix', return cs + # ------------------------------------------------------------------------- # *Transfer Function Transform* # ------------------------------------------------------------------------- @@ -144,6 +145,8 @@ def create_transfer_colorspace(name='transfer', cs.from_reference_transforms = [] return cs + + # create_transfer_colorspace # ------------------------------------------------------------------------- @@ -234,6 +237,8 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer', 'direction': 'inverse'}) return cs + + # create_matrix_plus_transfer_colorspace # Transfer functions for standard color spaces @@ -244,55 +249,60 @@ def transfer_function_sRGB_to_linear(v): 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, @@ -317,9 +327,9 @@ def create_colorspaces(lut_directory, # 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) # @@ -549,5 +559,3 @@ def create_raw(): raw.is_data = True return raw - -