2 # -*- coding: utf-8 -*-
5 Implements support for *ACES* colorspaces conversions and transfer functions.
8 from __future__ import division
18 import PyOpenColorIO as ocio
20 from aces_ocio.generate_lut import (
21 generate_1d_LUT_from_CTL,
22 generate_3d_LUT_from_CTL,
24 from aces_ocio.utilities import (
30 __author__ = 'ACES Developers'
31 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
33 __maintainer__ = 'ACES Developers'
34 __email__ = 'aces@oscars.org'
35 __status__ = 'Production'
37 __all__ = ['ACES_AP1_TO_AP0',
48 'create_Dolby_PQ_shaper',
51 'create_ACES_RRT_plus_ODT',
53 'create_shapers_dolbypq'
54 'create_shapers_log2',
61 # Matrix converting *ACES AP1* primaries to *ACES AP0*.
62 ACES_AP1_TO_AP0 = [0.6954522414, 0.1406786965, 0.1638690622,
63 0.0447945634, 0.8596711185, 0.0955343182,
64 -0.0055258826, 0.0040252103, 1.0015006723]
66 # Matrix converting *ACES AP0* primaries to *ACES AP1*.
67 ACES_AP0_TO_AP1 = [1.4514393161, -0.2365107469, -0.2149285693,
68 -0.0765537734, 1.1762296998, -0.0996759264,
69 0.0083161484, -0.0060324498, 0.9977163014]
71 # Matrix converting *ACES AP0* primaries to *XYZ*.
72 ACES_AP0_TO_XYZ = [0.9525523959, 0.0000000000, 0.0000936786,
73 0.3439664498, 0.7281660966, -0.0721325464,
74 0.0000000000, 0.0000000000, 1.0088251844]
76 # Matrix converting *ACES AP0* primaries to *XYZ*.
77 ACES_XYZ_TO_AP0 = [1.0498110175, 0.0000000000, -0.0000974845,
78 -0.4959030231, 1.3733130458, 0.0982400361,
79 0.0000000000, 0.0000000000, 0.9912520182]
84 Creates the *ACES2065-1* reference color space
93 *ACES2065-1* and all its identifying information
96 # Defining the reference colorspace.
97 aces2065_1 = ColorSpace('ACES2065-1')
98 aces2065_1.description = (
99 'The Academy Color Encoding System reference color space')
100 aces2065_1.equality_group = ''
101 aces2065_1.aliases = ['lin_ap0', 'aces']
102 aces2065_1.family = 'ACES'
103 aces2065_1.is_data = False
104 aces2065_1.allocation_type = ocio.Constants.ALLOCATION_LG2
105 aces2065_1.allocation_vars = [-8, 5, 0.00390625]
110 def create_ACEScc(aces_ctl_directory,
119 Creates the *ACEScc* reference color space
123 aces_ctl_directory : str or unicode
124 The path to the aces 'transforms/ctl/utilities'
125 lut_directory : str or unicode
126 The directory to use when generating LUTs
127 lut_resolution_1d : int
128 The resolution of generated 1D LUTs
130 Whether or not to clean up the intermediate images
131 name : str or unicode, optional
132 The name of the ColorSpace
133 min_value : float, optional
134 The minimum value to consider for the space
135 max_value : float, optional
136 The maximum value to consider for the space
137 input_scale : float, optional
138 A scale factor to divide input values
143 *ACEScc* and all its identifying information
146 cs = ColorSpace(name)
147 cs.description = 'The %s color space' % name
148 cs.aliases = ['acescc', 'acescc_ap1']
149 cs.equality_group = ''
152 cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
153 cs.allocation_vars = [min_value, max_value]
154 cs.aces_transform_id = 'ACEScsc.ACEScc_to_ACES.a1.0.0'
156 ctls = [os.path.join(aces_ctl_directory,
158 'ACEScsc.ACEScc_to_ACES.a1.0.0.ctl'),
159 # This transform gets back to the *AP1* primaries.
160 # Useful as the 1d LUT is only covering the transfer function.
161 # The primaries switch is covered by the matrix below:
162 os.path.join(aces_ctl_directory,
164 'ACEScsc.ACES_to_ACEScg.a1.0.0.ctl')]
165 lut = '%s_to_linear.spi1d' % name
169 generate_1d_LUT_from_CTL(
170 os.path.join(lut_directory, lut),
183 cs.to_reference_transforms = []
184 cs.to_reference_transforms.append({
187 'interpolation': 'linear',
188 'direction': 'forward'})
190 # *AP1* primaries to *AP0* primaries
191 cs.to_reference_transforms.append({
193 'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
194 'direction': 'forward'})
196 cs.from_reference_transforms = []
200 def create_ACESproxy(aces_ctl_directory,
206 Creates the *ACESproxy* color space
210 aces_ctl_directory : str or unicode
211 The path to the aces 'transforms/ctl/utilities'
212 lut_directory : str or unicode
213 The directory to use when generating LUTs
214 lut_resolution_1d : int
215 The resolution of generated 1D LUTs
217 Whether or not to clean up the intermediate images
218 name : str or unicode, optional
219 The name of the ColorSpace
224 *ACESproxy* and all its identifying information
227 cs = ColorSpace(name)
228 cs.description = 'The %s color space' % name
229 cs.aliases = ['acesproxy', 'acesproxy_ap1']
230 cs.equality_group = ''
234 cs.aces_transform_id = 'ACEScsc.ACESproxy10i_to_ACES.a1.0.0'
236 ctls = [os.path.join(aces_ctl_directory,
238 'ACEScsc.ACESproxy10i_to_ACES.a1.0.0.ctl'),
239 # This transform gets back to the *AP1* primaries.
240 # Useful as the 1d LUT is only covering the transfer function.
241 # The primaries switch is covered by the matrix below:
242 os.path.join(aces_ctl_directory,
244 'ACEScsc.ACES_to_ACEScg.a1.0.0.ctl')]
245 lut = '%s_to_linear.spi1d' % name
249 generate_1d_LUT_from_CTL(
250 os.path.join(lut_directory, lut),
263 cs.to_reference_transforms = []
264 cs.to_reference_transforms.append({
267 'interpolation': 'linear',
268 'direction': 'forward'})
270 # *AP1* primaries to *AP0* primaries
271 cs.to_reference_transforms.append({
273 'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
274 'direction': 'forward'})
276 cs.from_reference_transforms = []
280 # -------------------------------------------------------------------------
282 # -------------------------------------------------------------------------
285 Creates the *ACEScg* color space
294 *ACEScg* and all its identifying information
299 cs = ColorSpace(name)
300 cs.description = 'The %s color space' % name
301 cs.aliases = ['acescg', 'lin_ap1']
302 cs.equality_group = ''
305 cs.allocation_type = ocio.Constants.ALLOCATION_LG2
306 cs.allocation_vars = [-8, 5, 0.00390625]
308 cs.aces_transform_id = 'ACEScsc.ACEScg_to_ACES.a1.0.0'
310 cs.to_reference_transforms = []
312 # *AP1* primaries to *AP0* primaries
313 cs.to_reference_transforms.append({
315 'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
316 'direction': 'forward'})
318 cs.from_reference_transforms = []
320 # Commented out because specifying the inverse matrix causes some
321 # of OCIO's checks to see if a set of transforms can be collapsed
324 # *AP1* primaries to *AP0* primaries
325 #cs.from_reference_transforms.append({
327 # 'matrix': mat44_from_mat33(ACES_AP0_TO_AP1),
328 # 'direction': 'forward'})
333 # -------------------------------------------------------------------------
335 # -------------------------------------------------------------------------
336 def create_ADX(lut_directory,
340 Creates the *ADX* color space
344 lut_directory : str or unicode
345 The directory to use when generating LUTs
347 Choose either 10 or 16 bit ADX
348 name : str or unicode, optional
349 The name of the ColorSpace
354 *ADX* and all its identifying information
357 name = '%s%s' % (name, bit_depth)
358 cs = ColorSpace(name)
359 cs.description = '%s color space - used for film scans' % name
360 cs.aliases = ['adx%s' % str(bit_depth)]
361 cs.equality_group = ''
366 cs.aces_transform_id = 'ACEScsc.ADX10_to_ACES.a1.0.0'
368 cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT10
369 ADX_to_CDD = [1023 / 500, 0, 0, 0,
373 offset = [-95 / 500, -95 / 500, -95 / 500, 0]
374 elif bit_depth == 16:
375 cs.aces_transform_id = 'ACEScsc.ADX16_to_ACES.a1.0.0'
377 cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT16
378 ADX_to_CDD = [65535 / 8000, 0, 0, 0,
379 0, 65535 / 8000, 0, 0,
380 0, 0, 65535 / 8000, 0,
382 offset = [-1520 / 8000, -1520 / 8000, -1520 / 8000, 0]
384 cs.to_reference_transforms = []
386 # Converting from *ADX* to *Channel-Dependent Density*.
387 cs.to_reference_transforms.append({
389 'matrix': ADX_to_CDD,
391 'direction': 'forward'})
393 # Converting from *Channel-Dependent Density* to
394 # *Channel-Independent Density*.
395 cs.to_reference_transforms.append({
397 'matrix': [0.75573, 0.22197, 0.02230, 0,
398 0.05901, 0.96928, -0.02829, 0,
399 0.16134, 0.07406, 0.76460, 0,
401 'direction': 'forward'})
403 # Copied from *Alex Fry*'s *adx_cid_to_rle.py*
404 def create_CID_to_RLE_LUT():
406 def interpolate_1d(x, xp, fp):
407 return numpy.interp(x, xp, fp)
409 LUT_1D_XP = [-0.190000000000000,
421 LUT_1D_FP = [-6.000000000000000,
433 REF_PT = ((7120 - 1520) / 8000 * (100 / 55) -
438 return interpolate_1d(x, LUT_1D_XP, LUT_1D_FP)
439 return (100 / 55) * x - REF_PT
441 def fit(value, from_min, from_max, to_min, to_max):
442 if from_min == from_max:
443 raise ValueError('from_min == from_max')
444 return (value - from_min) / (from_max - from_min) * (
445 to_max - to_min) + to_min
447 num_samples = 2 ** 12
450 for i in xrange(num_samples):
451 x = i / (num_samples - 1)
452 x = fit(x, 0, 1, domain[0], domain[1])
453 data.append(cid_to_rle(x))
455 lut = 'ADX_CID_to_RLE.spi1d'
456 write_SPI_1d(os.path.join(lut_directory, lut),
464 # Converting *Channel Independent Density* values to
465 # *Relative Log Exposure* values.
466 lut = create_CID_to_RLE_LUT()
467 cs.to_reference_transforms.append({
470 'interpolation': 'linear',
471 'direction': 'forward'})
473 # Converting *Relative Log Exposure* values to
474 # *Relative Exposure* values.
475 cs.to_reference_transforms.append({
478 'direction': 'inverse'})
480 # Convert *Relative Exposure* values to *ACES* values.
481 cs.to_reference_transforms.append({
483 'matrix': [0.72286, 0.12630, 0.15084, 0,
484 0.11923, 0.76418, 0.11659, 0,
485 0.01427, 0.08213, 0.90359, 0,
487 'direction': 'forward'})
489 cs.from_reference_transforms = []
493 # -------------------------------------------------------------------------
494 # Generic *Log* Transform
495 # -------------------------------------------------------------------------
496 def create_generic_log(aces_ctl_directory,
509 Creates the *Generic Log* colorspace.
513 aces_ctl_directory : str or unicode
514 The path to the aces 'transforms/ctl/utilities'
515 lut_directory : str or unicode
516 The directory to use when generating LUTs
517 lut_resolution_1d : int
518 The resolution of generated 1D LUTs
520 Whether or not to clean up the intermediate images
521 name : str or unicode, optional
522 The name of the ColorSpace
523 aliases : list of str or unicode, optional
524 The alias names to use for the ColorSpace
525 min_value : float, optional
526 The minimum value to consider for the space
527 max_value : float, optional
528 The maximum value to consider for the space
529 input_scale : float, optional
530 A scale factor to divide input values
531 middle_grey : float, optional
532 The middle of the dynamic range covered by the transfer function
533 min_exposure : float, optional
534 The offset from middle grey, in stops, that defines the low end of the dynamic
535 range covered by the transfer function
536 max_exposure : float, optional
537 The offset from middle grey, in stops, that defines the high end of the dynamic
538 range covered by the transfer function
543 *Generic Log* colorspace.
549 cs = ColorSpace(name)
550 cs.description = 'The %s color space' % name
552 cs.equality_group = name
553 cs.family = 'Utility'
556 ctls = [os.path.join(
559 'ACESlib.Log2_to_Lin_param.a1.0.0.ctl')]
560 lut = '%s_to_linear.spi1d' % name
564 generate_1d_LUT_from_CTL(
565 os.path.join(lut_directory, lut),
571 {'middleGrey': middle_grey,
572 'minExposure': min_exposure,
573 'maxExposure': max_exposure},
580 cs.to_reference_transforms = []
581 cs.to_reference_transforms.append({
584 'interpolation': 'linear',
585 'direction': 'forward'})
587 cs.from_reference_transforms = []
591 # -------------------------------------------------------------------------
592 # Base *Dolby PQ* Transform
593 # -------------------------------------------------------------------------
594 def create_Dolby_PQ(aces_ctl_directory,
604 Creates the generic *Dolby PQ* colorspace.
608 aces_ctl_directory : str or unicode
609 The path to the aces 'transforms/ctl/utilities'
610 lut_directory : str or unicode
611 The directory to use when generating LUTs
612 lut_resolution_1d : int
613 The resolution of generated 1D LUTs
615 Whether or not to clean up the intermediate images
616 name : str or unicode, optional
617 The name of the ColorSpace
618 aliases : list of str or unicode, optional
619 The alias names to use for the ColorSpace
620 min_value : float, optional
621 The minimum value to consider for the space
622 max_value : float, optional
623 The maximum value to consider for the space
624 input_scale : float, optional
625 A scale factor to divide input values
630 Generic *Dolby PQ* colorspace.
636 cs = ColorSpace(name)
637 cs.description = 'The %s color space' % name
639 cs.equality_group = name
640 cs.family = 'Utility'
643 ctls = [os.path.join(
646 'ACESlib.DolbyPQ_to_Lin.a1.0.0.ctl')]
647 lut = '%s_to_linear.spi1d' % name
651 generate_1d_LUT_from_CTL(
652 os.path.join(lut_directory, lut),
664 cs.to_reference_transforms = []
665 cs.to_reference_transforms.append({
668 'interpolation': 'linear',
669 'direction': 'forward'})
671 cs.from_reference_transforms = []
675 # -------------------------------------------------------------------------
676 # *Dolby PQ* Transform - Fixed Linear Range
677 # -------------------------------------------------------------------------
678 def create_Dolby_PQ_shaper(aces_ctl_directory,
691 Creates a *Dolby PQ* colorspace that covers a specific dynamic range
695 aces_ctl_directory : str or unicode
696 The path to the aces 'transforms/ctl/utilities'
697 lut_directory : str or unicode
698 The directory to use when generating LUTs
699 lut_resolution_1d : int
700 The resolution of generated 1D LUTs
702 Whether or not to clean up the intermediate images
703 name : str or unicode, optional
704 The name of the ColorSpace
705 aliases : list of str or unicode, optional
706 The alias names to use for the ColorSpace
707 min_value : float, optional
708 The minimum value to consider for the space
709 max_value : float, optional
710 The maximum value to consider for the space
711 input_scale : float, optional
712 A scale factor to divide input values
713 middle_grey : float, optional
714 The middle of the dynamic range covered by the transfer function
715 min_exposure : float, optional
716 The offset from middle grey, in stops, that defines the low end of the dynamic
717 range covered by the transfer function
718 max_exposure : float, optional
719 The offset from middle grey, in stops, that defines the high end of the dynamic
720 range covered by the transfer function
725 A *Dolby PQ* colorspace that covers a specific dynamic range
731 cs = ColorSpace(name)
732 cs.description = 'The %s color space' % name
734 cs.equality_group = name
735 cs.family = 'Utility'
738 ctls = [os.path.join(
741 'ACESlib.OCIOshaper_to_Lin_param.a1.0.0.ctl')]
742 lut = '%s_to_linear.spi1d' % name
746 generate_1d_LUT_from_CTL(
747 os.path.join(lut_directory, lut),
753 {'middleGrey': middle_grey,
754 'minExposure': min_exposure,
755 'maxExposure': max_exposure},
761 cs.to_reference_transforms = []
762 cs.to_reference_transforms.append({
765 'interpolation': 'linear',
766 'direction': 'forward'})
768 cs.from_reference_transforms = []
772 # -------------------------------------------------------------------------
774 # -------------------------------------------------------------------------
775 def create_ACES_LMT(lmt_name,
780 lut_resolution_3d=64,
784 Creates an *ACES Look Transform (LMT)* colorspace.
788 lmt_name : str or unicode
789 The name of the Look Transform (LMT)
791 A collection of values that define the Look Transform's attributes and behavior
793 A collection of values that define the Shaper to use when generating LUTs to
794 represent the Look Transform
795 aces_ctl_directory : str or unicode
796 The path to the aces 'transforms/ctl/utilities'
797 lut_directory : str or unicode
798 The directory to use when generating LUTs
799 lut_resolution_3d : int, optional
800 The resolution of generated 3D LUTs
801 cleanup : bool, optional
802 Whether or not to clean up the intermediate images
803 aliases : list of str or unicode, optional
804 The alias names to use for the ColorSpace
809 An *ACES LMT* colorspace.
815 cs = ColorSpace('%s' % lmt_name)
816 cs.description = 'The ACES Look Transform: %s' % lmt_name
818 cs.equality_group = ''
821 cs.allocation_type = ocio.Constants.ALLOCATION_LG2
822 cs.allocation_vars = [-8, 5, 0.00390625]
823 cs.aces_transform_id = lmt_values['transformID']
825 pprint.pprint(lmt_values)
827 # Generating the *shaper* transform.
830 shaper_from_aces_ctl,
832 shaper_params) = shaper_info
834 shaper_lut = '%s_to_linear.spi1d' % shaper_name
835 shaper_lut = sanitize(shaper_lut)
837 shaper_ocio_transform = {
840 'interpolation': 'linear',
841 'direction': 'inverse'}
843 # Generating the forward transform.
844 cs.from_reference_transforms = []
846 if 'transformCTL' in lmt_values:
847 ctls = [shaper_to_aces_ctl % aces_ctl_directory,
848 os.path.join(aces_ctl_directory,
849 lmt_values['transformCTL'])]
850 lut = '%s.%s.spi3d' % (shaper_name, lmt_name)
854 generate_3d_LUT_from_CTL(
855 os.path.join(lut_directory, lut),
859 1 / shaper_input_scale,
865 cs.from_reference_transforms.append(shaper_ocio_transform)
866 cs.from_reference_transforms.append({
869 'interpolation': 'tetrahedral',
870 'direction': 'forward'})
872 # Generating the inverse transform.
873 cs.to_reference_transforms = []
875 if 'transformCTLInverse' in lmt_values:
876 ctls = [os.path.join(aces_ctl_directory,
877 lmt_values['transformCTLInverse']),
878 shaper_from_aces_ctl % aces_ctl_directory]
879 lut = 'Inverse.%s.%s.spi3d' % (lmt_name, shaper_name)
883 generate_3d_LUT_from_CTL(
884 os.path.join(lut_directory, lut),
895 cs.to_reference_transforms.append({
898 'interpolation': 'tetrahedral',
899 'direction': 'forward'})
901 shaper_inverse = shaper_ocio_transform.copy()
902 shaper_inverse['direction'] = 'forward'
903 cs.to_reference_transforms.append(shaper_inverse)
908 # -------------------------------------------------------------------------
910 # -------------------------------------------------------------------------
911 def create_LMTs(aces_ctl_directory,
918 Create ColorSpaces representing the *ACES Look Transforms*
922 aces_ctl_directory : str or unicode
923 The path to the aces 'transforms/ctl/utilities'
924 lut_directory : str or unicode
925 The directory to use when generating LUTs
926 lut_resolution_1d : int
927 The resolution of generated 1D LUTs
928 lut_resolution_3d : int
929 The resolution of generated 3D LUTs
931 Whether or not to clean up the intermediate images
932 aliases : list of str or unicode, optional
933 The alias names to use for the ColorSpace
935 A collection of values that define the Look Transforms that need to be
941 ColorSpaces representing the *ACES Look Transforms*
946 # -------------------------------------------------------------------------
948 # -------------------------------------------------------------------------
949 lmt_lut_resolution_1d = max(4096, lut_resolution_1d)
950 lmt_lut_resolution_3d = max(65, lut_resolution_3d)
952 # Defining the *Log 2* shaper.
953 lmt_shaper_name = 'LMT Shaper'
954 lmt_shaper_name_aliases = ['crv_lmtshaper']
960 lmt_shaper = create_generic_log(aces_ctl_directory,
962 lmt_lut_resolution_1d,
964 name=lmt_shaper_name,
965 middle_grey=lmt_params['middleGrey'],
966 min_exposure=lmt_params['minExposure'],
967 max_exposure=lmt_params['maxExposure'],
968 aliases=lmt_shaper_name_aliases)
969 colorspaces.append(lmt_shaper)
971 shaper_input_scale_generic_log2 = 1
973 # *Log 2* shaper name and *CTL* transforms bundled up.
978 'ACESlib.Log2_to_Lin_param.a1.0.0.ctl'),
981 'ACESlib.Lin_to_Log2_param.a1.0.0.ctl'),
982 shaper_input_scale_generic_log2,
985 sorted_lmts = sorted(lmt_info.iteritems(), key=lambda x: x[1])
987 for lmt in sorted_lmts:
988 lmt_name, lmt_values = lmt
989 lmt_aliases = ['look_%s' % compact(lmt_values['transformUserName'])]
990 cs = create_ACES_LMT(
991 lmt_values['transformUserName'],
996 lmt_lut_resolution_3d,
999 colorspaces.append(cs)
1004 # -------------------------------------------------------------------------
1005 # *ACES RRT* with supplied *ODT*.
1006 # -------------------------------------------------------------------------
1007 def create_ACES_RRT_plus_ODT(odt_name,
1012 lut_resolution_3d=64,
1016 Creates an *ACES Output Transform (RRT + ODT)* colorspace.
1020 odt_name : str or unicode
1021 The name of the Output Transform (RRT + ODT)
1023 A collection of values that define the Output Transform's attributes and behavior
1025 A collection of values that define the Shaper to use when generating LUTs to
1026 represent the Output Transform
1027 aces_ctl_directory : str or unicode
1028 The path to the aces 'transforms/ctl/utilities'
1029 lut_directory : str or unicode
1030 The directory to use when generating LUTs
1031 lut_resolution_3d : int, optional
1032 The resolution of generated 3D LUTs
1033 cleanup : bool, optional
1034 Whether or not to clean up the intermediate images
1035 aliases : list of str or unicode, optional
1036 The alias names to use for the ColorSpace
1041 An *ACES Output Transform (RRT + ODT)* colorspace.
1047 cs = ColorSpace('%s' % odt_name)
1048 cs.description = '%s - %s Output Transform' % (
1049 odt_values['transformUserNamePrefix'], odt_name)
1050 cs.aliases = aliases
1051 cs.equality_group = ''
1052 cs.family = 'Output'
1055 cs.aces_transform_id = odt_values['transformID']
1057 pprint.pprint(odt_values)
1059 # Generating the *shaper* transform.
1062 shaper_from_aces_ctl,
1064 shaper_params) = shaper_info
1066 if 'legalRange' in odt_values:
1067 shaper_params['legalRange'] = odt_values['legalRange']
1069 shaper_params['legalRange'] = 0
1071 shaper_lut = '%s_to_linear.spi1d' % shaper_name
1072 shaper_lut = sanitize(shaper_lut)
1074 shaper_ocio_transform = {
1077 'interpolation': 'linear',
1078 'direction': 'inverse'}
1080 # Generating the *forward* transform.
1081 cs.from_reference_transforms = []
1083 if 'transformLUT' in odt_values:
1084 transform_lut_file_name = os.path.basename(
1085 odt_values['transformLUT'])
1086 lut = os.path.join(lut_directory, transform_lut_file_name)
1087 shutil.copy(odt_values['transformLUT'], lut)
1089 cs.from_reference_transforms.append(shaper_ocio_transform)
1090 cs.from_reference_transforms.append({
1092 'path': transform_lut_file_name,
1093 'interpolation': 'tetrahedral',
1094 'direction': 'forward'})
1095 elif 'transformCTL' in odt_values:
1097 shaper_to_aces_ctl % aces_ctl_directory,
1098 os.path.join(aces_ctl_directory,
1101 os.path.join(aces_ctl_directory,
1103 odt_values['transformCTL'])]
1104 lut = '%s.RRT.a1.0.0.%s.spi3d' % (shaper_name, odt_name)
1108 generate_3d_LUT_from_CTL(
1109 os.path.join(lut_directory, lut),
1113 1 / shaper_input_scale,
1119 cs.from_reference_transforms.append(shaper_ocio_transform)
1120 cs.from_reference_transforms.append({
1123 'interpolation': 'tetrahedral',
1124 'direction': 'forward'})
1126 # Generating the *inverse* transform.
1127 cs.to_reference_transforms = []
1129 if 'transformLUTInverse' in odt_values:
1130 transform_lut_inverse_file_name = os.path.basename(
1131 odt_values['transformLUTInverse'])
1132 lut = os.path.join(lut_directory, transform_lut_inverse_file_name)
1133 shutil.copy(odt_values['transformLUTInverse'], lut)
1135 cs.to_reference_transforms.append({
1137 'path': transform_lut_inverse_file_name,
1138 'interpolation': 'tetrahedral',
1139 'direction': 'forward'})
1141 shaper_inverse = shaper_ocio_transform.copy()
1142 shaper_inverse['direction'] = 'forward'
1143 cs.to_reference_transforms.append(shaper_inverse)
1144 elif 'transformCTLInverse' in odt_values:
1145 ctls = [os.path.join(aces_ctl_directory,
1147 odt_values['transformCTLInverse']),
1148 os.path.join(aces_ctl_directory,
1150 'InvRRT.a1.0.0.ctl'),
1151 shaper_from_aces_ctl % aces_ctl_directory]
1152 lut = 'InvRRT.a1.0.0.%s.%s.spi3d' % (odt_name, shaper_name)
1156 generate_3d_LUT_from_CTL(
1157 os.path.join(lut_directory, lut),
1167 cs.to_reference_transforms.append({
1170 'interpolation': 'tetrahedral',
1171 'direction': 'forward'})
1173 shaper_inverse = shaper_ocio_transform.copy()
1174 shaper_inverse['direction'] = 'forward'
1175 cs.to_reference_transforms.append(shaper_inverse)
1179 # -------------------------------------------------------------------------
1181 # -------------------------------------------------------------------------
1182 def create_shapers_log2(aces_ctl_directory,
1191 Creates a *Log base 2* colorspace that covers a specific dynamic range
1195 aces_ctl_directory : str or unicode
1196 The path to the aces 'transforms/ctl/utilities'
1197 lut_directory : str or unicode
1198 The directory to use when generating LUTs
1199 lut_resolution_1d : int
1200 The resolution of generated 1D LUTs
1202 Whether or not to clean up the intermediate images
1203 shaper_name : str or unicode, optional
1204 The name of the ColorSpace
1206 The middle of the dynamic range covered by the transfer function
1207 min_exposure : float
1208 The offset from middle grey, in stops, that defines the low end of the dynamic
1209 range covered by the transfer function
1210 max_exposure : float
1211 The offset from middle grey, in stops, that defines the high end of the dynamic
1212 range covered by the transfer function
1217 A *Log base 2* colorspace that covers a specific dynamic range
1223 # Defining the *Log 2* shaper for *ODTs covering 48 nit output*.
1224 log2_shaper_name = shaper_name
1225 log2_shaper_name_aliases = ['crv_%s' % compact(log2_shaper_name)]
1227 'middleGrey': middle_grey,
1228 'minExposure': min_exposure,
1229 'maxExposure': max_exposure}
1231 log2_shaper_colorspace = create_generic_log(
1236 name=log2_shaper_name,
1237 middle_grey=log2_params['middleGrey'],
1238 min_exposure=log2_params['minExposure'],
1239 max_exposure=log2_params['maxExposure'],
1240 aliases=log2_shaper_name_aliases)
1241 colorspaces.append(log2_shaper_colorspace)
1243 shaper_input_scale_generic_log2 = 1
1245 # *Log 2* shaper name and *CTL* transforms bundled up.
1246 log2_shaper_data = [
1250 'ACESlib.Log2_to_Lin_param.a1.0.0.ctl'),
1253 'ACESlib.Lin_to_Log2_param.a1.0.0.ctl'),
1254 shaper_input_scale_generic_log2,
1257 shaper_data[log2_shaper_name] = log2_shaper_data
1259 # Defining the *Log2 shaper that includes the AP1* primaries.
1260 log2_shaper_api1_name = '%s - AP1' % log2_shaper_name
1261 log2_shaper_api1_colorspace = copy.deepcopy(log2_shaper_colorspace)
1263 log2_shaper_api1_colorspace.name = log2_shaper_api1_name
1264 log2_shaper_api1_colorspace.description = (
1265 'The %s color space' % log2_shaper_api1_name)
1266 log2_shaper_api1_colorspace.aliases = [
1267 '%s_ap1' % compact(log2_shaper_name)]
1268 log2_shaper_api1_colorspace.equality_group = log2_shaper_api1_name
1270 # *AP1* primaries to *AP0* primaries
1271 log2_shaper_api1_colorspace.to_reference_transforms.append({
1273 'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
1274 'direction': 'forward'
1276 colorspaces.append(log2_shaper_api1_colorspace)
1278 return shaper_data, colorspaces
1280 # -------------------------------------------------------------------------
1281 # *Dolby PQ-based Shapers*
1282 # -------------------------------------------------------------------------
1283 def create_shapers_dolbypq(aces_ctl_directory,
1292 Creates two *Dolby PQ* colorspaces, one with now gamut conversion, the other with
1293 the conversion from *ACES* *AP0* to *AP1*
1297 aces_ctl_directory : str or unicode
1298 The path to the aces 'transforms/ctl/utilities'
1299 lut_directory : str or unicode
1300 The directory to use when generating LUTs
1301 lut_resolution_1d : int
1302 The resolution of generated 1D LUTs
1304 Whether or not to clean up the intermediate images
1305 shaper_name : str or unicode, optional
1306 The name of the ColorSpace
1308 The middle of the dynamic range covered by the transfer function
1309 min_exposure : float
1310 The offset from middle grey, in stops, that defines the low end of the dynamic
1311 range covered by the transfer function
1312 max_exposure : float
1313 The offset from middle grey, in stops, that defines the high end of the dynamic
1314 range covered by the transfer function
1319 Values defining a Shaper
1321 A list of *Dolby PQ* colorspaces that covers a specific dynamic range
1326 # Define the *Dolby PQ Shaper that considers a fixed linear range*
1327 dolby_pq_shaper_name = shaper_name
1328 dolby_pq_shaper_name_aliases = ['crv_%s' % compact(dolby_pq_shaper_name)]
1331 'middleGrey': middle_grey,
1332 'minExposure': min_exposure,
1333 'maxExposure': max_exposure}
1335 dolby_pq_shaper_colorspace = create_Dolby_PQ_shaper(
1340 name=dolby_pq_shaper_name,
1341 aliases=dolby_pq_shaper_name_aliases,
1342 middle_grey=dolby_pq_params['middleGrey'],
1343 min_exposure=dolby_pq_params['minExposure'],
1344 max_exposure=dolby_pq_params['maxExposure'])
1345 colorspaces.append(dolby_pq_shaper_colorspace)
1347 # *Dolby PQ* shaper name and *CTL* transforms bundled up.
1348 dolby_pq_shaper_data = [
1349 dolby_pq_shaper_name,
1352 'ACESlib.OCIOshaper_to_Lin_param.a1.0.0.ctl'),
1355 'ACESlib.Lin_to_OCIOshaper_param.a1.0.0.ctl'),
1359 shaper_data[dolby_pq_shaper_name] = dolby_pq_shaper_data
1361 # Defining the *Dolby PQ shaper that includes the AP1* primaries.
1362 dolby_pq_shaper_api1_name = '%s - AP1' % dolby_pq_shaper_name
1363 dolby_pq_shaper_api1_colorspace = copy.deepcopy(dolby_pq_shaper_colorspace)
1365 dolby_pq_shaper_api1_colorspace.name = dolby_pq_shaper_api1_name
1366 dolby_pq_shaper_api1_colorspace.description = (
1367 'The %s color space' % dolby_pq_shaper_api1_name)
1368 dolby_pq_shaper_api1_colorspace.aliases = [
1369 '%s_ap1' % compact(dolby_pq_shaper_name)]
1370 dolby_pq_shaper_api1_colorspace.equality_group = dolby_pq_shaper_api1_name
1372 # *AP1* primaries to *AP0* primaries
1373 dolby_pq_shaper_api1_colorspace.to_reference_transforms.append({
1375 'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
1376 'direction': 'forward'
1378 colorspaces.append(dolby_pq_shaper_api1_colorspace)
1380 return shaper_data, colorspaces
1383 # -------------------------------------------------------------------------
1385 # -------------------------------------------------------------------------
1386 def create_shapers(aces_ctl_directory,
1392 Creates sets of shaper colorspaces covering the *Log 2* and *Dolby PQ*
1393 transfer functions and dynamic ranges suitable of use with the 48 nit,
1394 1000 nit, 2000 nit and 4000 nit *ACES Output Transforms*
1398 aces_ctl_directory : str or unicode
1399 The path to the aces 'transforms/ctl/utilities'
1400 lut_directory : str or unicode
1401 The directory to use when generating LUTs
1402 lut_resolution_1d : int
1403 The resolution of generated 1D LUTs
1405 Whether or not to clean up the intermediate images
1410 Values defining a set of Shapers
1412 A list of Shaper colorspaces that covers a varying dynamic ranges and
1419 # Define the base *Log2 48 nits shaper*
1421 (log2_48nits_shaper_data,
1422 log2_48nits_colorspaces) = create_shapers_log2(aces_ctl_directory,
1426 'Log2 48 nits Shaper',
1430 colorspaces.extend(log2_48nits_colorspaces)
1431 shaper_data.update(log2_48nits_shaper_data)
1433 # Define the base *Log2 1000 nits shaper*
1435 (log2_1000nits_shaper_data,
1436 log2_1000nits_colorspaces) = create_shapers_log2(aces_ctl_directory,
1440 'Log2 1000 nits Shaper',
1444 colorspaces.extend(log2_1000nits_colorspaces)
1445 shaper_data.update(log2_1000nits_shaper_data)
1447 # Define the base *Log2 2000 nits shaper*
1449 (log2_2000nits_shaper_data,
1450 log2_2000nits_colorspaces) = create_shapers_log2(aces_ctl_directory,
1454 'Log2 2000 nits Shaper',
1458 colorspaces.extend(log2_2000nits_colorspaces)
1459 shaper_data.update(log2_2000nits_shaper_data)
1461 # Define the base *Log2 4000 nits shaper*
1463 (log2_4000nits_shaper_data,
1464 log2_4000nits_colorspaces) = create_shapers_log2(aces_ctl_directory,
1468 'Log2 4000 nits Shaper',
1472 colorspaces.extend(log2_4000nits_colorspaces)
1473 shaper_data.update(log2_4000nits_shaper_data)
1475 # Define the base *Dolby PQ transfer function*
1477 dolby_pq_shaper_name = 'Dolby PQ 10000'
1478 dolby_pq_shaper_name_aliases = ['crv_%s' % 'dolbypq_10000']
1480 dolby_pq_shaper_colorspace = create_Dolby_PQ(
1485 name=dolby_pq_shaper_name,
1486 aliases=dolby_pq_shaper_name_aliases)
1487 colorspaces.append(dolby_pq_shaper_colorspace)
1489 # *Dolby PQ* shaper name and *CTL* transforms bundled up.
1490 dolby_pq_shaper_data = [
1491 dolby_pq_shaper_name,
1494 'ACESlib.DolbyPQ_to_Lin.a1.0.0.ctl'),
1497 'ACESlib.Lin_to_DolbyPQ.a1.0.0.ctl'),
1501 shaper_data[dolby_pq_shaper_name] = dolby_pq_shaper_data
1503 # Define the *Dolby PQ 48 nits shaper*
1505 (dolbypq_48nits_shaper_data,
1506 dolbypq_48nits_colorspaces) = create_shapers_dolbypq(aces_ctl_directory,
1510 'Dolby PQ 48 nits Shaper',
1514 colorspaces.extend(dolbypq_48nits_colorspaces)
1515 shaper_data.update(dolbypq_48nits_shaper_data)
1517 # Define the *Dolby PQ 1000 nits shaper*
1519 (dolbypq_1000nits_shaper_data,
1520 dolbypq_1000nits_colorspaces) = create_shapers_dolbypq(aces_ctl_directory,
1524 'Dolby PQ 1000 nits Shaper',
1528 colorspaces.extend(dolbypq_1000nits_colorspaces)
1529 shaper_data.update(dolbypq_1000nits_shaper_data)
1531 # Define the *Dolby PQ 2000 nits shaper*
1533 (dolbypq_2000nits_shaper_data,
1534 dolbypq_2000nits_colorspaces) = create_shapers_dolbypq(aces_ctl_directory,
1538 'Dolby PQ 2000 nits Shaper',
1542 colorspaces.extend(dolbypq_2000nits_colorspaces)
1543 shaper_data.update(dolbypq_2000nits_shaper_data)
1545 # Define the *Dolby PQ 4000 nits shaper*
1547 (dolbypq_4000nits_shaper_data,
1548 dolbypq_4000nits_colorspaces) = create_shapers_dolbypq(aces_ctl_directory,
1552 'Dolby PQ 4000 nits Shaper',
1556 colorspaces.extend(dolbypq_4000nits_colorspaces)
1557 shaper_data.update(dolbypq_4000nits_shaper_data)
1559 return shaper_data, colorspaces
1561 # -------------------------------------------------------------------------
1563 # -------------------------------------------------------------------------
1564 def create_ODTs(aces_ctl_directory,
1571 linear_display_space,
1574 Create ColorSpaces representing the *ACES Output Transforms*
1578 aces_ctl_directory : str or unicode
1579 The path to the aces 'transforms/ctl/utilities'
1580 lut_directory : str or unicode
1581 The directory to use when generating LUTs
1582 lut_resolution_1d : int
1583 The resolution of generated 1D LUTs
1584 lut_resolution_3d : int
1585 The resolution of generated 3D LUTs
1587 A collection of values that define the Output Transforms that need to be
1589 shaper_name : str or unicode, optional
1590 The name of Shaper ColorSpace to use when generating LUTs
1592 Whether or not to clean up the intermediate images
1593 linear_display_space : lstr or unicode
1594 The name of the ColorSpace to use for the raw or linear View
1595 log_display_space : lstr or unicode
1596 The name of the ColorSpace to use for the log View
1601 ColorSpaces representing the *ACES Output Transforms*
1603 Collections of names and ColorSpaces corresponding to the Displays and
1610 # -------------------------------------------------------------------------
1611 # *RRT / ODT* Shaper Options
1612 # -------------------------------------------------------------------------
1613 shaper_data, shaper_colorspaces = create_shapers(aces_ctl_directory,
1618 colorspaces.extend(shaper_colorspaces)
1620 # Assumes shaper has variants covering the range expected by the
1621 # 48 nit, 1000 nit, 2000 nit and 4000 nit Ouput Transforms
1622 rrt_shaper_48nits = shaper_data[shaper_name]
1623 rrt_shaper_1000nits = shaper_data[shaper_name.replace("48 nits", "1000 nits")]
1624 rrt_shaper_2000nits = shaper_data[shaper_name.replace("48 nits", "2000 nits")]
1625 rrt_shaper_4000nits = shaper_data[shaper_name.replace("48 nits", "4000 nits")]
1627 # *RRT + ODT* combinations.
1628 sorted_odts = sorted(odt_info.iteritems(), key=lambda x: x[1])
1630 for odt in sorted_odts:
1631 (odt_name, odt_values) = odt
1633 if odt_values['transformHasFullLegalSwitch']:
1634 odt_legal['legalRange'] = 0
1636 odt_name_legal = odt_values['transformUserName']
1637 odt_legal = odt_values.copy()
1638 odt_aliases = ['out_%s' % compact(odt_name_legal)]
1640 if odt_name_legal in ['P3-D60 PQ (1000 nits)']:
1641 rrt_shaper = rrt_shaper_1000nits
1642 elif odt_name_legal in ['P3-D60 PQ (2000 nits)']:
1643 rrt_shaper = rrt_shaper_2000nits
1644 elif odt_name_legal in ['P3-D60 PQ (4000 nits)']:
1645 rrt_shaper = rrt_shaper_4000nits
1647 rrt_shaper = rrt_shaper_48nits
1649 cs = create_ACES_RRT_plus_ODT(
1658 colorspaces.append(cs)
1660 displays[odt_name_legal] = {
1661 'Raw': linear_display_space,
1662 'Log': log_display_space,
1663 'Output Transform': cs}
1665 return colorspaces, displays
1668 def get_transform_info(ctl_transform):
1670 Returns the information stored in first couple of lines of an official
1671 *ACES Transform* CTL file
1675 ctl_transform : str or unicode
1676 The path to the CTL file to be scraped.
1681 Combination of Transform ID, User Name, User Name Prefix and Full/Legal
1685 with open(ctl_transform, 'rb') as fp:
1686 lines = fp.readlines()
1688 # Retrieving the *transform ID* and *User Name*.
1689 transform_id = lines[1][3:].split('<')[1].split('>')[1].strip()
1690 transform_user_name = '-'.join(
1691 lines[2][3:].split('<')[1].split('>')[1].split('-')[1:]).strip()
1692 transform_user_name_prefix = (
1693 lines[2][3:].split('<')[1].split('>')[1].split('-')[0].strip())
1695 # Figuring out if this transform has options for processing *full* and
1697 transform_full_legal_switch = False
1699 if line.strip() == 'input varying int legalRange = 0':
1700 # print( '%s has legal range flag' % transform_user_name)
1701 transform_full_legal_switch = True
1704 return (transform_id,
1705 transform_user_name,
1706 transform_user_name_prefix,
1707 transform_full_legal_switch)
1710 def get_ODTs_info(aces_ctl_directory):
1712 Returns the information describing the names and CTL files associated with
1713 the *ACES Output Transforms* in a given ACES release
1717 aces_ctl_directory : str or unicode
1718 The path to the base *ACES* CTL directory
1723 Collecton of dicts, one describing each *ACES Output Transform*
1726 # TODO: Investigate usage of *files_walker* definition here.
1727 # Credit to *Alex Fry* for the original approach here.
1728 odt_dir = os.path.join(aces_ctl_directory, 'odt')
1730 for dir_name, subdir_list, file_list in os.walk(odt_dir):
1731 for fname in file_list:
1732 all_odt.append((os.path.join(dir_name, fname)))
1734 odt_ctls = [x for x in all_odt if
1735 ('InvODT' not in x) and (os.path.split(x)[-1][0] != '.')]
1739 for odt_ctl in odt_ctls:
1740 odt_tokens = os.path.split(odt_ctl)
1742 # Handling nested directories.
1743 odt_path_tokens = os.path.split(odt_tokens[-2])
1744 odt_dir = odt_path_tokens[-1]
1745 while odt_path_tokens[-2][-3:] != 'odt':
1746 odt_path_tokens = os.path.split(odt_path_tokens[-2])
1747 odt_dir = os.path.join(odt_path_tokens[-1], odt_dir)
1749 # Building full name.
1750 transform_ctl = odt_tokens[-1]
1751 odt_name = string.join(transform_ctl.split('.')[1:-1], '.')
1753 # Finding id, user name and user name prefix.
1755 transform_user_name,
1756 transform_user_name_prefix,
1757 transform_full_legal_switch) = get_transform_info(
1758 os.path.join(aces_ctl_directory, 'odt', odt_dir, transform_ctl))
1761 transform_ctl_inverse = 'InvODT.%s.ctl' % odt_name
1762 if not os.path.exists(
1763 os.path.join(odt_tokens[-2], transform_ctl_inverse)):
1764 transform_ctl_inverse = None
1766 # Adding to list of *ODTs*.
1768 odts[odt_name]['transformCTL'] = os.path.join(odt_dir, transform_ctl)
1769 if transform_ctl_inverse is not None:
1770 odts[odt_name]['transformCTLInverse'] = os.path.join(
1771 odt_dir, transform_ctl_inverse)
1773 odts[odt_name]['transformID'] = transform_id
1774 odts[odt_name]['transformUserNamePrefix'] = transform_user_name_prefix
1775 odts[odt_name]['transformUserName'] = transform_user_name
1777 'transformHasFullLegalSwitch'] = transform_full_legal_switch
1779 forward_ctl = odts[odt_name]['transformCTL']
1781 print('ODT : %s' % odt_name)
1782 print('\tTransform ID : %s' % transform_id)
1783 print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
1784 print('\tTransform User Name : %s' % transform_user_name)
1786 '\tHas Full / Legal Switch : %s' % transform_full_legal_switch)
1787 print('\tForward ctl : %s' % forward_ctl)
1788 if 'transformCTLInverse' in odts[odt_name]:
1789 inverse_ctl = odts[odt_name]['transformCTLInverse']
1790 print('\tInverse ctl : %s' % inverse_ctl)
1792 print('\tInverse ctl : %s' % 'None')
1799 def get_LMTs_info(aces_ctl_directory):
1801 Returns the information describing the names and CTL files associated with
1802 the *ACES Look Transforms* in a given ACES release
1806 aces_ctl_directory : str or unicode
1807 The path to the base *ACES* CTL directory
1812 Collecton of dicts, one describing each *ACES Look Transform*
1815 # TODO: Investigate refactoring with previous definition.
1817 # Credit to Alex Fry for the original approach here
1818 lmt_dir = os.path.join(aces_ctl_directory, 'lmt')
1820 for dir_name, subdir_list, file_list in os.walk(lmt_dir):
1821 for fname in file_list:
1822 all_lmt.append((os.path.join(dir_name, fname)))
1824 lmt_ctls = [x for x in all_lmt if
1825 ('InvLMT' not in x) and ('README' not in x) and (
1826 os.path.split(x)[-1][0] != '.')]
1830 for lmt_ctl in lmt_ctls:
1831 lmt_tokens = os.path.split(lmt_ctl)
1833 # Handlimg nested directories.
1834 lmt_path_tokens = os.path.split(lmt_tokens[-2])
1835 lmt_dir = lmt_path_tokens[-1]
1836 while lmt_path_tokens[-2][-3:] != 'ctl':
1837 lmt_path_tokens = os.path.split(lmt_path_tokens[-2])
1838 lmt_dir = os.path.join(lmt_path_tokens[-1], lmt_dir)
1840 # Building full name.
1841 transform_ctl = lmt_tokens[-1]
1842 lmt_name = string.join(transform_ctl.split('.')[1:-1], '.')
1844 # Finding id, user name and user name prefix.
1846 transform_user_name,
1847 transform_user_name_prefix,
1848 transform_full_legal_switch) = get_transform_info(
1849 os.path.join(aces_ctl_directory, lmt_dir, transform_ctl))
1852 transform_ctl_inverse = 'InvLMT.%s.ctl' % lmt_name
1853 if not os.path.exists(
1854 os.path.join(lmt_tokens[-2], transform_ctl_inverse)):
1855 transform_ctl_inverse = None
1858 lmts[lmt_name]['transformCTL'] = os.path.join(lmt_dir, transform_ctl)
1859 if transform_ctl_inverse is not None:
1860 lmts[lmt_name]['transformCTLInverse'] = os.path.join(
1861 lmt_dir, transform_ctl_inverse)
1863 lmts[lmt_name]['transformID'] = transform_id
1864 lmts[lmt_name]['transformUserNamePrefix'] = transform_user_name_prefix
1865 lmts[lmt_name]['transformUserName'] = transform_user_name
1867 forward_ctl = lmts[lmt_name]['transformCTL']
1869 print('LMT : %s' % lmt_name)
1870 print('\tTransform ID : %s' % transform_id)
1871 print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
1872 print('\tTransform User Name : %s' % transform_user_name)
1873 print('\t Forward ctl : %s' % forward_ctl)
1874 if 'transformCTLInverse' in lmts[lmt_name]:
1875 inverse_ctl = lmts[lmt_name]['transformCTLInverse']
1876 print('\t Inverse ctl : %s' % inverse_ctl)
1878 print('\t Inverse ctl : %s' % 'None')
1885 def create_colorspaces(aces_ctl_directory,
1894 Generates the *ACES* colorspaces, displays and views
1898 aces_ctl_directory : str or unicode
1899 The path to the aces 'transforms/ctl/utilities'
1900 lut_directory : str or unicode
1901 The directory to use when generating LUTs
1902 lut_resolution_1d : int
1903 The resolution of generated 1D LUTs
1904 lut_resolution_3d : int
1905 The resolution of generated 3D LUTs
1907 A collection of values that define the Look Transforms that need to be
1910 A collection of values that define the Output Transforms that need to be
1912 shaper_name : str or unicode, optional
1913 The name of Shaper ColorSpace to use when generating LUTs
1915 Whether or not to clean up the intermediate images
1920 A collection of values defining
1921 the reference colorspace : ACES
1922 a list of the colorspaces created
1923 a list of the displays created
1924 a list of the general log colorspace
1925 a list of the role assignments
1926 the name of the default display
1931 ACES = create_ACES()
1933 ACEScc = create_ACEScc(aces_ctl_directory, lut_directory,
1934 lut_resolution_1d, cleanup,
1935 min_value=-0.35840, max_value=1.468)
1936 colorspaces.append(ACEScc)
1938 ACESproxy = create_ACESproxy(aces_ctl_directory, lut_directory,
1939 lut_resolution_1d, cleanup)
1940 colorspaces.append(ACESproxy)
1942 ACEScg = create_ACEScg()
1943 colorspaces.append(ACEScg)
1945 ADX10 = create_ADX(lut_directory, bit_depth=10)
1946 colorspaces.append(ADX10)
1948 ADX16 = create_ADX(lut_directory, bit_depth=16)
1949 colorspaces.append(ADX16)
1951 lmts = create_LMTs(aces_ctl_directory,
1957 colorspaces.extend(lmts)
1959 odts, displays = create_ODTs(aces_ctl_directory,
1968 colorspaces.extend(odts)
1970 # TODO: Investigate if there is a way to retrieve these values from *CTL*.
1971 default_display = 'sRGB (D60 sim.)'
1972 color_picking = 'Rec.709'
1974 roles = {'color_picking': color_picking,
1975 'color_timing': ACEScc.name,
1976 'compositing_log': ACEScc.name,
1978 'default': ACES.name,
1979 'matte_paint': ACEScc.name,
1981 'scene_linear': ACEScg.name,
1982 'texture_paint': '',
1983 'compositing_linear': ACEScg.name,
1984 'rendering': ACEScg.name}
1986 return ACES, colorspaces, displays, ACEScc, roles, default_display