Code formatting.
[OpenColorIO-Configs.git] / aces_1.0.0 / python / aces_ocio / colorspaces / aces.py
index fee6274..531d02b 100644 (file)
@@ -26,7 +26,6 @@ from aces_ocio.utilities import (
     sanitize,
     compact)
 
-
 __author__ = 'ACES Developers'
 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
 __license__ = ''
@@ -125,16 +124,23 @@ def create_ACEScc(aces_ctl_directory,
 
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
-    cs.aliases = ["acescc_ap1"]
+    cs.aliases = ["acescc", "acescc_ap1"]
     cs.equality_group = ''
     cs.family = 'ACES'
     cs.is_data = False
     cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
     cs.allocation_vars = [min_value, max_value]
+    cs.aces_transform_id = "ACEScsc.ACEScc_to_ACES.a1.0.0"
 
     ctls = [os.path.join(aces_ctl_directory,
                          'ACEScc',
-                         'ACEScsc.ACEScc_to_ACES.a1.0.0.ctl')]
+                         'ACEScsc.ACEScc_to_ACES.a1.0.0.ctl'),
+            # This transform gets back to the *AP1* primaries.
+            # Useful as the 1d LUT is only covering the transfer function.
+            # The primaries switch is covered by the matrix below:
+            os.path.join(aces_ctl_directory,
+                         'ACEScg',
+                         'ACEScsc.ACES_to_ACEScg.a1.0.0.ctl')]
     lut = '%s_to_linear.spi1d' % name
 
     lut = sanitize(lut)
@@ -146,7 +152,7 @@ def create_ACEScc(aces_ctl_directory,
         'float',
         input_scale,
         1,
-        {'transferFunctionOnly': 1},
+        {},
         cleanup,
         aces_ctl_directory,
         min_value,
@@ -191,11 +197,13 @@ def create_ACESproxy(aces_ctl_directory,
 
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
-    cs.aliases = ["acesproxy_ap1"]
+    cs.aliases = ["acesproxy", "acesproxy_ap1"]
     cs.equality_group = ''
     cs.family = 'ACES'
     cs.is_data = False
 
+    cs.aces_transform_id = "ACEScsc.ACESproxy10i_to_ACES.a1.0.0"
+
     ctls = [os.path.join(aces_ctl_directory,
                          'ACESproxy',
                          'ACEScsc.ACESproxy10i_to_ACES.a1.0.0.ctl'),
@@ -213,8 +221,8 @@ def create_ACESproxy(aces_ctl_directory,
         os.path.join(lut_directory, lut),
         ctls,
         lut_resolution_1d,
-        'uint16',
-        64,
+        'float',
+        1,
         1,
         {},
         cleanup,
@@ -264,13 +272,15 @@ def create_ACEScg(aces_ctl_directory,
 
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
-    cs.aliases = ["lin_ap1"]
+    cs.aliases = ["acescg", "lin_ap1"]
     cs.equality_group = ''
     cs.family = 'ACES'
     cs.is_data = False
     cs.allocation_type = ocio.Constants.ALLOCATION_LG2
     cs.allocation_vars = [-8, 5, 0.00390625]
 
+    cs.aces_transform_id = "ACEScsc.ACEScg_to_ACES.a1.0.0"
+
     cs.to_reference_transforms = []
 
     # *AP1* primaries to *AP0* primaries.
@@ -280,6 +290,13 @@ def create_ACEScg(aces_ctl_directory,
         'direction': 'forward'})
 
     cs.from_reference_transforms = []
+
+    # *AP1* primaries to *AP0* primaries.
+    cs.from_reference_transforms.append({
+        'type': 'matrix',
+        'matrix': mat44_from_mat33(ACES_AP0_TO_AP1),
+        'direction': 'forward'})
+
     return cs
 
 
@@ -313,6 +330,8 @@ def create_ADX(lut_directory,
     cs.is_data = False
 
     if bit_depth == 10:
+        cs.aces_transform_id = "ACEScsc.ADX10_to_ACES.a1.0.0"
+
         cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT10
         ADX_to_CDD = [1023 / 500, 0, 0, 0,
                       0, 1023 / 500, 0, 0,
@@ -320,6 +339,8 @@ def create_ADX(lut_directory,
                       0, 0, 0, 1]
         offset = [-95 / 500, -95 / 500, -95 / 500, 0]
     elif bit_depth == 16:
+        cs.aces_transform_id = "ACEScsc.ADX16_to_ACES.a1.0.0"
+
         cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT16
         ADX_to_CDD = [65535 / 8000, 0, 0, 0,
                       0, 65535 / 8000, 0, 0,
@@ -474,7 +495,7 @@ def create_generic_log(aces_ctl_directory,
     ctls = [os.path.join(
         aces_ctl_directory,
         'utilities',
-        'ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl')]
+        'ACESlib.Log2_to_Lin_param.a1.0.0.ctl')]
     lut = '%s_to_linear.spi1d' % name
 
     lut = sanitize(lut)
@@ -528,7 +549,7 @@ def create_dolbypq(aces_CTL_directory,
     ctls = [os.path.join(
         aces_CTL_directory,
         'utilities',
-        'ACESlib.OCIO_shaper_dolbypq_to_lin.a1.0.0.ctl')]
+        'ACESlib.DolbyPQ_to_Lin.a1.0.0.ctl')]
     lut = '%s_to_linear.spi1d' % name
 
     lut = sanitize(lut)
@@ -582,7 +603,7 @@ def create_dolbypq_scaled(aces_CTL_directory,
     ctls = [os.path.join(
         aces_CTL_directory,
         'utilities',
-        'ACESlib.OCIO_shaper_dolbypq_to_lin_param.a1.0.0.ctl')]
+        'ACESlib.DolbyPQ_to_lin_param.a1.0.0.ctl')]
     lut = '%s_to_linear.spi1d' % name
 
     lut = sanitize(lut)
@@ -650,6 +671,7 @@ def create_ACES_LMT(lmt_name,
     cs.is_data = False
     cs.allocation_type = ocio.Constants.ALLOCATION_LG2
     cs.allocation_vars = [-8, 5, 0.00390625]
+    cs.aces_transform_id = lmt_values['transformID']
 
     pprint.pprint(lmt_values)
 
@@ -795,10 +817,10 @@ def create_LMTs(aces_ctl_directory,
         lmt_shaper_name,
         os.path.join('%s',
                      'utilities',
-                     'ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl'),
+                     'ACESlib.Log2_to_Lin_param.a1.0.0.ctl'),
         os.path.join('%s',
                      'utilities',
-                     'ACESlib.OCIO_shaper_lin_to_log2_param.a1.0.0.ctl'),
+                     'ACESlib.Lin_to_Log2_param.a1.0.0.ctl'),
         shaper_input_scale_generic_log2,
         lmt_params]
 
@@ -859,6 +881,8 @@ def create_ACES_RRT_plus_ODT(odt_name,
     cs.family = 'Output'
     cs.is_data = False
 
+    cs.aces_transform_id = odt_values['transformID']
+
     pprint.pprint(odt_values)
 
     # Generating the *shaper* transform.
@@ -1046,10 +1070,10 @@ def create_ODTs(aces_ctl_directory,
         log2_shaper_name,
         os.path.join('%s',
                      'utilities',
-                     'ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl'),
+                     'ACESlib.Log2_to_Lin_param.a1.0.0.ctl'),
         os.path.join('%s',
                      'utilities',
-                     'ACESlib.OCIO_shaper_lin_to_log2_param.a1.0.0.ctl'),
+                     'ACESlib.Lin_to_Log2_param.a1.0.0.ctl'),
         shaper_input_scale_generic_log2,
         log2_params]
 
@@ -1059,7 +1083,8 @@ def create_ODTs(aces_ctl_directory,
     log2_shaper_copy_name = "Log2 Shaper"
     log2_shaper_copy_colorspace = ColorSpace(log2_shaper_copy_name)
     log2_shaper_copy_colorspace.description = 'The %s color space' % log2_shaper_copy_name
-    log2_shaper_copy_colorspace.aliases = ["crv_%s" % compact(log2_shaper_copy_name)]
+    log2_shaper_copy_colorspace.aliases = [
+        "crv_%s" % compact(log2_shaper_copy_name)]
     log2_shaper_copy_colorspace.equality_group = log2_shaper_copy_name
     log2_shaper_copy_colorspace.family = log2_shaper_colorspace.family
     log2_shaper_copy_colorspace.is_data = log2_shaper_colorspace.is_data
@@ -1125,10 +1150,10 @@ def create_ODTs(aces_ctl_directory,
         dolbypq_shaper_name,
         os.path.join('%s',
                      'utilities',
-                     'ACESlib.OCIO_shaper_dolbypq_to_lin.a1.0.0.ctl'),
+                     'ACESlib.DolbyPQ_to_Lin.a1.0.0.ctl'),
         os.path.join('%s',
                      'utilities',
-                     'ACESlib.OCIO_shaper_lin_to_dolbypq.a1.0.0.ctl'),
+                     'ACESlib.Lin_to_DolbyPQ.a1.0.0.ctl'),
         1.0,
         {}]
 
@@ -1153,10 +1178,10 @@ def create_ODTs(aces_ctl_directory,
         dolbypq_scaled_shaper_name,
         os.path.join('%s',
                      'utilities',
-                     'ACESlib.OCIO_shaper_dolbypq_to_lin_param.a1.0.0.ctl'),
+                     'ACESlib.DolbyPQ_to_Lin_param.a1.0.0.ctl'),
         os.path.join('%s',
                      'utilities',
-                     'ACESlib.OCIO_shaper_lin_to_dolbypq_param.a1.0.0.ctl'),
+                     'ACESlib.Lin_to_DolbyPQ_param.a1.0.0.ctl'),
         1.0,
         log2_params]
 
@@ -1174,15 +1199,20 @@ def create_ODTs(aces_ctl_directory,
     for odt in sorted_odts:
         (odt_name, odt_values) = odt
 
-        # Generating legal range transform for *ODTs* that can generate 
+        # Generating only full range transform for *ODTs* that can generate 
         # either *legal* or *full* output.
+
+        # Uncomment these lines and the lower section and flip the 'legalRange' value to 1
+        # to recover the old behavior, where both legal and full range LUTs were generated
         if odt_values['transformHasFullLegalSwitch']:
-            odt_name_legal = '%s - Legal' % odt_values['transformUserName']
-        else:
-            odt_name_legal = odt_values['transformUserName']
+            # odt_name_legal = '%s - Legal' % odt_values['transformUserName']
+            odt_legal['legalRange'] = 0
+        # else:
+        #    odt_name_legal = odt_values['transformUserName']
+
+        odt_name_legal = odt_values['transformUserName']
 
         odt_legal = odt_values.copy()
-        odt_legal['legalRange'] = 1
 
         odt_aliases = ["out_%s" % compact(odt_name_legal)]
 
@@ -1199,11 +1229,11 @@ def create_ODTs(aces_ctl_directory,
         colorspaces.append(cs)
 
         displays[odt_name_legal] = {
-            'Linear': linear_display_space,
+            'Raw': linear_display_space,
             'Log': log_display_space,
             'Output Transform': cs}
 
-
+        '''
         # Generating full range transform for *ODTs* that can generate 
         # either *legal* or *full* output.
         if odt_values['transformHasFullLegalSwitch']:
@@ -1228,9 +1258,10 @@ def create_ODTs(aces_ctl_directory,
             colorspaces.append(cs_full)
 
             displays[odt_name_full] = {
-                'Linear': linear_display_space,
+                'Raw': linear_display_space,
                 'Log': log_display_space,
                 'Output Transform': cs_full}
+        '''
 
     return (colorspaces, displays)