X-Git-Url: http://users.mur.at/ms/git/gitweb/?a=blobdiff_plain;f=aces_1.0.0%2Fpython%2Faces_ocio%2Fcolorspaces%2Fgeneral.py;h=71b7950b113227cf9094b166f8f99c03fd73b190;hb=5af97e4c92efec7ac9b0e1e0ac2e65dddafbc420;hp=4b6d80188ad0387d7b6a72a19d451802b0d5aa0d;hpb=36923d39d480194173ef6309448d2d1e7acd3afc;p=OpenColorIO-Configs.git 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 4b6d801..71b7950 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__ = '' @@ -25,7 +24,16 @@ __email__ = 'aces@oscars.org' __status__ = 'Production' __all__ = ['create_matrix_colorspace', - 'create_colorspaces'] + 'create_transfer_colorspace', + 'create_matrix_plus_transfer_colorspace', + 'transfer_function_sRGB_to_linear', + 'transfer_function_Rec709_to_linear', + 'transfer_function_Rec2020_10bit_to_linear', + 'transfer_function_Rec2020_12bit_to_linear', + 'transfer_function_Rec1886_to_linear', + 'create_colorspaces', + 'create_raw'] + # ------------------------------------------------------------------------- # *Matrix Transform* @@ -33,19 +41,25 @@ __all__ = ['create_matrix_colorspace', def create_matrix_colorspace(name='matrix', from_reference_values=None, to_reference_values=None, - aliases=[]): + aliases=None): """ - Object description. + Creates a ColorSpace that only uses *Matrix Transforms* Parameters ---------- - parameter : type - Parameter description. + name : str, optional + Aliases for this colorspace + from_reference_values : list of matrices + List of matrices to convert from the reference colorspace to this space + to_reference_values : list of matrices + List of matrices to convert to the reference colorspace from this space + aliases : list of str, optional + Aliases for this colorspace Returns ------- - type - Return value description. + ColorSpace + A *Matrix Transform*-based ColorSpace """ if from_reference_values is None: @@ -54,6 +68,9 @@ def create_matrix_colorspace(name='matrix', if to_reference_values is None: to_reference_values = [] + if aliases is None: + aliases = [] + cs = ColorSpace(name) cs.description = 'The %s color space' % name cs.aliases = aliases @@ -61,9 +78,9 @@ def create_matrix_colorspace(name='matrix', cs.family = 'Utility' cs.is_data = False - # A linear space needs allocation variables - cs.allocation_type = ocio.Constants.ALLOCATION_LG2 - cs.allocation_vars = [-8, 5, 0.00390625] + # A linear space needs allocation variables. + cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM + cs.allocation_vars = [0, 1] cs.to_reference_transforms = [] if to_reference_values: @@ -83,36 +100,42 @@ def create_matrix_colorspace(name='matrix', return cs + # ------------------------------------------------------------------------- -# *Matrix Transform* +# *Transfer Function Transform* # ------------------------------------------------------------------------- -def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer', - transfer_function_name='transfer_function', - transfer_function=lambda x: x, - lut_directory='/tmp', - lut_resolution_1d=1024, - from_reference_values=None, - to_reference_values=None, - aliases=[]): +def create_transfer_colorspace(name='transfer', + transfer_function_name='transfer_function', + transfer_function=lambda x: x, + lut_directory='/tmp', + lut_resolution_1d=1024, + aliases=None): """ - Object description. + Creates a ColorSpace that only uses transfer functions encoded as 1D LUTs Parameters ---------- - parameter : type - Parameter description. + name : str, optional + Aliases for this colorspace + transfer_function_name : str, optional + The name of the transfer function + transfer_function : function, optional + The transfer function to be evaluated + lut_directory : str or unicode + The directory to use when generating LUTs + lut_resolution_1d : int + The resolution of generated 1D LUTs + aliases : list of str + Aliases for this colorspace Returns ------- - type - Return value description. + ColorSpace + A *LUT1D Transform*-based ColorSpace representing a transfer function """ - if from_reference_values is None: - from_reference_values = [] - - if to_reference_values is None: - to_reference_values = [] + if aliases is None: + aliases = [] cs = ColorSpace(name) cs.description = 'The %s color space' % name @@ -121,16 +144,16 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer', cs.family = 'Utility' cs.is_data = False - # A linear space needs allocation variables - cs.allocation_type = ocio.Constants.ALLOCATION_LG2 - cs.allocation_vars = [-8, 5, 0.00390625] + # A linear space needs allocation variables. + cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM + cs.allocation_vars = [0, 1] - # Sample the transfer function + # Sampling the transfer function. data = array.array('f', '\0' * lut_resolution_1d * 4) for c in range(lut_resolution_1d): data[c] = transfer_function(c / (lut_resolution_1d - 1)) - # Write the sampled data to a LUT + # Writing the sampled data to a *LUT*. lut = '%s_to_linear.spi1d' % transfer_function_name genlut.write_SPI_1d( os.path.join(lut_directory, lut), @@ -140,7 +163,7 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer', lut_resolution_1d, 1) - # Create the 'to_reference' transforms + # Creating the *to_reference* transforms. cs.to_reference_transforms = [] cs.to_reference_transforms.append({ 'type': 'lutFile', @@ -148,14 +171,105 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer', 'interpolation': 'linear', 'direction': 'forward'}) + # Creating the *from_reference* transforms. + cs.from_reference_transforms = [] + + return cs + + +# ------------------------------------------------------------------------- +# *Transfer Function + Matrix Transform* +# ------------------------------------------------------------------------- +def create_matrix_plus_transfer_colorspace( + name='matrix_plus_transfer', + transfer_function_name='transfer_function', + transfer_function=lambda x: x, + lut_directory='/tmp', + lut_resolution_1d=1024, + from_reference_values=None, + to_reference_values=None, + aliases=None): + """ + Creates a ColorSpace that uses transfer functions encoded as 1D LUTs and + matrice + + Parameters + ---------- + name : str, optional + Aliases for this colorspace + transfer_function_name : str, optional + The name of the transfer function + transfer_function : function, optional + The transfer function to be evaluated + lut_directory : str or unicode + The directory to use when generating LUTs + lut_resolution_1d : int + The resolution of generated 1D LUTs + from_reference_values : list of matrices + List of matrices to convert from the reference colorspace to this space + to_reference_values : list of matrices + List of matrices to convert to the reference colorspace from this space + aliases : list of str + Aliases for this colorspace + + Returns + ------- + ColorSpace + A *Matrx and LUT1D Transform*-based ColorSpace representing a transfer + function and matrix + """ + + if from_reference_values is None: + from_reference_values = [] + + if to_reference_values is None: + to_reference_values = [] + + if aliases is None: + aliases = [] + + cs = ColorSpace(name) + cs.description = 'The %s color space' % name + cs.aliases = aliases + cs.equality_group = name + cs.family = 'Utility' + cs.is_data = False + + # A linear space needs allocation variables. + cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM + cs.allocation_vars = [0, 1] + + # Sampling the transfer function. + data = array.array('f', '\0' * lut_resolution_1d * 4) + for c in range(lut_resolution_1d): + data[c] = transfer_function(c / (lut_resolution_1d - 1)) + + # Writing the sampled data to a *LUT*. + lut = '%s_to_linear.spi1d' % transfer_function_name + genlut.write_SPI_1d( + os.path.join(lut_directory, lut), + 0, + 1, + data, + lut_resolution_1d, + 1) + + # Creating the *to_reference* transforms. + cs.to_reference_transforms = [] if to_reference_values: + cs.to_reference_transforms.append({ + 'type': 'lutFile', + 'path': lut, + 'interpolation': 'linear', + 'direction': 'forward'}) + for matrix in to_reference_values: cs.to_reference_transforms.append({ 'type': 'matrix', 'matrix': mat44_from_mat33(matrix), 'direction': 'forward'}) - # Create the 'from_reference' transforms + # Creating the *from_reference* transforms. cs.from_reference_transforms = [] if from_reference_values: for matrix in from_reference_values: @@ -164,114 +278,176 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer', 'matrix': mat44_from_mat33(matrix), 'direction': 'forward'}) - cs.from_reference_transforms.append({ - 'type': 'lutFile', - 'path': lut, - 'interpolation': 'linear', - 'direction': 'inverse'}) + cs.from_reference_transforms.append({ + 'type': 'lutFile', + 'path': lut, + 'interpolation': 'linear', + 'direction': 'inverse'}) return cs -# Transfer functions for standard color spaces + +# Transfer functions for standard colorspaces. def transfer_function_sRGB_to_linear(v): + """ + The sRGB (IEC 61966-2-1) transfer function + + Parameters + ---------- + v : float + The normalized value to pass through the function + + Returns + ------- + float + A converted value + """ a = 1.055 b = 0.04045 d = 12.92 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): + """ + The Rec.709 transfer function + + Parameters + ---------- + v : float + The normalized value to pass through the function + + Returns + ------- + float + A converted value + """ 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): + """ + The Rec.2020 10-bit transfer function + + Parameters + ---------- + v : float + The normalized value to pass through the function + + Returns + ------- + float + A converted value + """ 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): + """ + The Rec.2020 12-bit transfer function + + Parameters + ---------- + v : float + The normalized value to pass through the function + + Returns + ------- + float + A converted value + """ 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): + """ + The Rec.1886 transfer function + + Parameters + ---------- + v : float + The normalized value to pass through the function + + Returns + ------- + float + A converted value + """ g = 2.4 Lw = 1 Lb = 0 - # Ignoring legal to full scaling for now - #v = (1023.0*v - 64.0)/876.0 + # Ignoring legal to full scaling for now. + # 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, - lut_resolution_3d): + lut_resolution_1d): """ Generates the colorspace conversions. Parameters ---------- - parameter : type - Parameter description. + lut_directory : str or unicode + The directory to use when generating LUTs + lut_resolution_1d : int + The resolution of generated 1D LUTs Returns ------- - type - Return value description. + list + A list of colorspaces for general colorspaces and encodings """ colorspaces = [] - # + # ------------------------------------------------------------------------- # XYZ - # - cs = create_matrix_colorspace('XYZ', - to_reference_values=[aces.ACES_XYZ_TO_AP0], - from_reference_values=[aces.ACES_AP0_TO_XYZ], - aliases=["lin_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']) colorspaces.append(cs) - # - # AP1 - # - cs = create_matrix_colorspace( - 'Linear - AP1', - to_reference_values=[aces.ACES_AP1_TO_AP0], - from_reference_values=[aces.ACES_AP0_TO_AP1], - aliases=["lin_ap1"]) - colorspaces.append(cs) - - # + # ------------------------------------------------------------------------- # P3-D60 - # - # *ACES* to *Linear*, *P3D60* primaries. + # ------------------------------------------------------------------------- + # *ACES* to *Linear*, *P3D60* primaries XYZ_to_P3D60 = [2.4027414142, -0.8974841639, -0.3880533700, -0.8325796487, 1.7692317536, 0.0237127115, 0.0388233815, -0.0824996856, 1.0363685997] @@ -279,190 +455,169 @@ def create_colorspaces(lut_directory, cs = create_matrix_colorspace( 'Linear - P3-D60', from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_P3D60], - aliases=["lin_p3d60"]) + aliases=['lin_p3d60']) colorspaces.append(cs) - # + # ------------------------------------------------------------------------- # P3-DCI - # - # *ACES* to *Linear*, *P3DCI* primaries. - XYZ_to_P3DCI = [2.7253940305, -1.0180030062, -0.4401631952, - -0.7951680258, 1.6897320548, 0.0226471906, - 0.0412418914, -0.0876390192, 1.1009293786] + # ------------------------------------------------------------------------- + # *ACES* to *Linear*, *P3DCI* primaries, using Bradford chromatic + # adaptation + XYZ_to_P3DCI = [2.66286135, -1.11031783, -0.42271635, + -0.82282376, 1.75861704, 0.02502194, + 0.03932561, -0.08383448, 1.0372175] cs = create_matrix_colorspace( 'Linear - P3-DCI', from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_P3DCI], - aliases=["lin_p3dci"]) - colorspaces.append(cs) - - # - # Rec 709 - # - # *ACES* to *Linear*, *Rec. 709* primaries. - XYZ_to_Rec709 = [3.2409699419, -1.5373831776, -0.4986107603, - -0.9692436363, 1.8759675015, 0.0415550574, - 0.0556300797, -0.2039769589, 1.0569715142] - - cs = create_matrix_colorspace( - 'Linear - Rec.709', - from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709], - aliases=["lin_rec709"]) + aliases=['lin_p3dci']) colorspaces.append(cs) - # *Linear* to *Rec. 709* Transfer Function* - cs = create_matrix_plus_transfer_colorspace( - 'Curve - Rec.709', - 'rec709', - transfer_function_Rec709_to_linear, - lut_directory, - lut_resolution_1d, - aliases=["crv_rec709"]) - colorspaces.append(cs) - - # *ACES* to *Rec. 709* Primaries + Transfer Function* - cs = create_matrix_plus_transfer_colorspace( - 'Rec.709', - 'rec709', - transfer_function_Rec709_to_linear, - lut_directory, - lut_resolution_1d, - from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709], - aliases=["rec709"]) - colorspaces.append(cs) - - # + # ------------------------------------------------------------------------- # sRGB - # - # *ACES* to *Linear*, *Rec. 709* primaries. - # sRGB and Rec 709 use the same gamut - XYZ_to_Rec709 = [3.2409699419, -1.5373831776, -0.4986107603, - -0.9692436363, 1.8759675015, 0.0415550574, - 0.0556300797, -0.2039769589, 1.0569715142] + # ------------------------------------------------------------------------- + # *sRGB* and *Rec 709* use the same gamut. + + # *ACES* to *Linear*, *Rec. 709* primaries, D65 white point, using + # Bradford chromatic adaptation + XYZ_to_Rec709 = [3.20959735, -1.55742955, -0.49580497, + -0.97098887, 1.88517118, 0.03948941, + 0.05971934, -0.21010444, 1.14312482] cs = create_matrix_colorspace( 'Linear - sRGB', from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709], - aliases=["lin_sRGB"]) + aliases=['lin_srgb']) colorspaces.append(cs) # *Linear* to *sRGB* Transfer Function* - cs = create_matrix_plus_transfer_colorspace( + cs = create_transfer_colorspace( 'Curve - sRGB', 'sRGB', transfer_function_sRGB_to_linear, lut_directory, lut_resolution_1d, - aliases=["crv_sRGB"]) + aliases=['crv_srgb']) colorspaces.append(cs) # *ACES* to *sRGB* Primaries + Transfer Function* cs = create_matrix_plus_transfer_colorspace( - 'sRGB', + 'sRGB - Texture', 'sRGB', transfer_function_sRGB_to_linear, lut_directory, lut_resolution_1d, from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709], - aliases=["sRGB"]) + aliases=['srgb_texture']) colorspaces.append(cs) - # - # Rec 1886 - # - # *ACES* to *Linear*, *Rec. 709* primaries. - # Rec 1886 and Rec 709 use the same gamut - XYZ_to_Rec709 = [3.2409699419, -1.5373831776, -0.4986107603, - -0.9692436363, 1.8759675015, 0.0415550574, - 0.0556300797, -0.2039769589, 1.0569715142] - + # ------------------------------------------------------------------------- + # Rec 709 + # ------------------------------------------------------------------------- + # *sRGB* and *Rec 709* use the same gamut. cs = create_matrix_colorspace( - 'Linear - Rec.1886', + 'Linear - Rec.709', from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709], - aliases=["lin_rec1886"]) + aliases=['lin_rec709']) colorspaces.append(cs) - # *Linear* to *sRGB* Transfer Function* - cs = create_matrix_plus_transfer_colorspace( - 'Curve - Rec.1886', - 'rec1886', - transfer_function_Rec1886_to_linear, + # *Linear* to *Rec. 709* Transfer Function* + cs = create_transfer_colorspace( + 'Curve - Rec.709', + 'rec709', + transfer_function_Rec709_to_linear, lut_directory, lut_resolution_1d, - aliases=["crv_rec1886"]) + aliases=['crv_rec709']) colorspaces.append(cs) - # *ACES* to *sRGB* Primaries + Transfer Function* + # *ACES* to *Rec. 709* Primaries + Transfer Function* cs = create_matrix_plus_transfer_colorspace( - 'Rec.1886', - 'rec1886', - transfer_function_Rec1886_to_linear, + 'Rec.709 - Camera', + 'rec709', + transfer_function_Rec709_to_linear, lut_directory, lut_resolution_1d, from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709], - aliases=["rec1886"]) + aliases=['rec709_camera']) colorspaces.append(cs) - # + # ------------------------------------------------------------------------- # Rec 2020 - # - # *ACES* to *Linear*, *Rec. 2020* primaries. - XYZ_to_Rec2020 = [1.7166511880, -0.3556707838, -0.2533662814, - -0.6666843518, 1.6164812366, 0.0157685458, - 0.0176398574, -0.0427706133, 0.9421031212] + # ------------------------------------------------------------------------- + # *ACES* to *Linear*, *Rec. 2020* primaries, D65 white point, using + # Bradford chromatic adaptation + XYZ_to_Rec2020 = [1.69662619, -0.36551982, -0.24857099, + -0.67039877, 1.62348187, 0.01503821, + 0.02063163, -0.04775634, 1.01910818] cs = create_matrix_colorspace( 'Linear - Rec.2020', from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec2020], - aliases=["lin_rec2020"]) + aliases=['lin_rec2020']) colorspaces.append(cs) # *Linear* to *Rec. 2020 10 bit* Transfer Function* - cs = create_matrix_plus_transfer_colorspace( - 'Curve - Rec.2020 - 10 bit', + cs = create_transfer_colorspace( + 'Curve - Rec.2020', 'rec2020', transfer_function_Rec2020_10bit_to_linear, lut_directory, lut_resolution_1d, - aliases=["crv_rec202010bit"]) + aliases=['crv_rec2020']) colorspaces.append(cs) # *ACES* to *Rec. 2020 10 bit* Primaries + Transfer Function* cs = create_matrix_plus_transfer_colorspace( - 'Rec.2020 10 bit - Rec.2020', + 'Rec.2020 - Camera', 'rec2020', transfer_function_Rec2020_10bit_to_linear, lut_directory, lut_resolution_1d, from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec2020], - aliases=["rec202010bit"]) + aliases=['rec2020_camera']) colorspaces.append(cs) - # *Linear* to *Rec. 2020 10 bit* Transfer Function* + # ------------------------------------------------------------------------- + # Rec 1886 + # ------------------------------------------------------------------------- + # *Linear* to *Rec.1886* Transfer Function* + cs = create_transfer_colorspace( + 'Curve - Rec.1886', + 'rec1886', + transfer_function_Rec1886_to_linear, + lut_directory, + lut_resolution_1d, + aliases=['crv_rec1886']) + colorspaces.append(cs) + + # *ACES* to *Rec. 709* Primaries + Transfer Function* cs = create_matrix_plus_transfer_colorspace( - 'Curve - Rec.2020 - 12 bit', - 'rec2020', - transfer_function_Rec2020_12bit_to_linear, + 'Rec.709 - Display', + 'rec1886', + transfer_function_Rec1886_to_linear, lut_directory, lut_resolution_1d, - aliases=["crv_rec202012bit"]) + from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709], + aliases=['rec709_display']) colorspaces.append(cs) - # *ACES* to *Rec. 2020 10 bit* Primaries + Transfer Function* + # *ACES* to *Rec. 2020* Primaries + Transfer Function* cs = create_matrix_plus_transfer_colorspace( - 'Rec.2020 12 bit - Rec.2020', - 'rec2020', - transfer_function_Rec2020_12bit_to_linear, + 'Rec.2020 - Display', + 'rec1886', + transfer_function_Rec1886_to_linear, lut_directory, lut_resolution_1d, from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec2020], - aliases=["rec202012bit"]) + aliases=['rec2020_display']) colorspaces.append(cs) - # + # ------------------------------------------------------------------------- # ProPhoto - # - # *ACES* to *Linear*, *Pro Photo* primaries. + # ------------------------------------------------------------------------- + # *ACES* to *Linear*, *Pro Photo* primaries, D50 white point, using + # Bradford chromatic adaptation AP0_to_RIMM = [1.2412367771, -0.1685692287, -0.0726675484, 0.0061203066, 1.083151174, -0.0892714806, -0.0032853314, 0.0099796402, 0.9933056912] @@ -470,13 +625,14 @@ def create_colorspaces(lut_directory, cs = create_matrix_colorspace( 'Linear - RIMM ROMM (ProPhoto)', from_reference_values=[AP0_to_RIMM], - aliases=["lin_prophoto", "lin_rimm"]) + aliases=['lin_prophoto', 'lin_rimm']) colorspaces.append(cs) - # + # ------------------------------------------------------------------------- # Adobe RGB - # - # *ACES* to *Linear*, *Adobe RGB* primaries. + # ------------------------------------------------------------------------- + # *ACES* to *Linear*, *Adobe RGB* primaries, D65 white point, using + # Bradford chromatic adaptation AP0_to_ADOBERGB = [1.7245603168, -0.4199935942, -0.3045667227, -0.2764799142, 1.3727190877, -0.0962391734, -0.0261255258, -0.0901747807, 1.1163003065] @@ -484,37 +640,47 @@ def create_colorspaces(lut_directory, cs = create_matrix_colorspace( 'Linear - Adobe RGB', from_reference_values=[AP0_to_ADOBERGB], - aliases=["lin_adobergb"]) + aliases=['lin_adobergb']) colorspaces.append(cs) - # + # ------------------------------------------------------------------------- # Adobe Wide Gamut RGB - # - - # *ACES* to *Linear*, *Adobe Wide Gamut RGB* primaries. - AP0_to_ADOBERGB = [1.3809814778, -0.1158594573, -0.2651220205, - 0.0057015535, 1.0402949043, -0.0459964578, - -0.0038908746, -0.0597091815, 1.0636000561] + # ------------------------------------------------------------------------- + # *ACES* to *Linear*, *Adobe Wide Gamut RGB* primaries, D50 white point, + # using Bradford chromatic adaptation + AP0_to_ADOBEWIDEGAMUT = [1.3809814778, -0.1158594573, -0.2651220205, + 0.0057015535, 1.0402949043, -0.0459964578, + -0.0038908746, -0.0597091815, 1.0636000561] cs = create_matrix_colorspace( 'Linear - Adobe Wide Gamut RGB', - from_reference_values=[AP0_to_ADOBERGB], - aliases=["lin_adobewidegamutrgb"]) + from_reference_values=[AP0_to_ADOBEWIDEGAMUT], + aliases=['lin_adobewidegamutrgb']) colorspaces.append(cs) return colorspaces def create_raw(): + """ + Creates the *raw* color space + + Parameters + ---------- + None + + Returns + ------- + ColorSpace + *raw* and all its identifying information + """ # *Raw* utility space - name = "Raw" + name = 'Raw' raw = ColorSpace(name) raw.description = 'The %s color space' % name - raw.aliases = [] + raw.aliases = ['raw'] raw.equality_group = name raw.family = 'Utility' raw.is_data = True return raw - -