X-Git-Url: http://users.mur.at/ms/git/gitweb/?a=blobdiff_plain;f=aces_1.0.0%2Fpython%2Faces_ocio%2Fcreate_sony_colorspaces.py;h=ac6738214d66cc30f7a139812ce094c5e83ca396;hb=e01006569dceecf813d49a22d3ea6ec7b486b2c0;hp=94d1201d9e157d665e3e5e996bb67094b55f075a;hpb=7a7ab56ee2c9a096f14667e9060a14617370e43d;p=OpenColorIO-Configs.git diff --git a/aces_1.0.0/python/aces_ocio/create_sony_colorspaces.py b/aces_1.0.0/python/aces_ocio/create_sony_colorspaces.py index 94d1201..ac67382 100644 --- a/aces_1.0.0/python/aces_ocio/create_sony_colorspaces.py +++ b/aces_1.0.0/python/aces_ocio/create_sony_colorspaces.py @@ -5,9 +5,13 @@ Implements support for *Sony* colorspaces conversions and transfer functions. """ +from __future__ import division + import array import os +import PyOpenColorIO as ocio + import aces_ocio.generate_lut as genlut from aces_ocio.utilities import ColorSpace, mat44_from_mat33 @@ -54,9 +58,14 @@ def create_s_log(gamut, cs.description = name cs.aliases = aliases cs.equality_group = '' - cs.family = 'Sony' + cs.family = 'Input/Sony' cs.is_data = False + # A linear space needs allocation variables + if transfer_function == '': + cs.allocation_type = ocio.Constants.ALLOCATION_LG2 + cs.allocation_vars = [-8, 5, 0.00390625] + def s_log1_to_linear(s_log): b = 64. ab = 90. @@ -89,10 +98,10 @@ def create_s_log(gamut, def s_log3_to_linear(code_value): if code_value >= 171.2102946929: - linear = (pow(10.0, ((code_value - 420.0) / 261.5)) * + linear = (pow(10, ((code_value - 420) / 261.5)) * (0.18 + 0.01) - 0.01) else: - linear = (code_value - 95.0) * 0.01125000 / (171.2102946929 - 95.0) + linear = (code_value - 95) * 0.01125000 / (171.2102946929 - 95) return linear @@ -101,13 +110,13 @@ def create_s_log(gamut, if transfer_function == 'S-Log1': data = array.array('f', '\0' * lut_resolution_1d * 4) for c in range(lut_resolution_1d): - data[c] = s_log1_to_linear(1023.0 * c / (lut_resolution_1d - 1)) + data[c] = s_log1_to_linear(1023 * c / (lut_resolution_1d - 1)) lut = '%s_to_linear.spi1d' % transfer_function genlut.write_SPI_1d( os.path.join(lut_directory, lut), - 0.0, - 1.0, + 0, + 1, data, lut_resolution_1d, 1) @@ -120,13 +129,13 @@ def create_s_log(gamut, elif transfer_function == 'S-Log2': data = array.array('f', '\0' * lut_resolution_1d * 4) for c in range(lut_resolution_1d): - data[c] = s_log2_to_linear(1023.0 * c / (lut_resolution_1d - 1)) + data[c] = s_log2_to_linear(1023 * c / (lut_resolution_1d - 1)) lut = '%s_to_linear.spi1d' % transfer_function genlut.write_SPI_1d( os.path.join(lut_directory, lut), - 0.0, - 1.0, + 0, + 1, data, lut_resolution_1d, 1) @@ -139,13 +148,13 @@ def create_s_log(gamut, elif transfer_function == 'S-Log3': data = array.array('f', '\0' * lut_resolution_1d * 4) for c in range(lut_resolution_1d): - data[c] = s_log3_to_linear(1023.0 * c / (lut_resolution_1d - 1)) + data[c] = s_log3_to_linear(1023 * c / (lut_resolution_1d - 1)) lut = '%s_to_linear.spi1d' % transfer_function genlut.write_SPI_1d( os.path.join(lut_directory, lut), - 0.0, - 1.0, + 0, + 1, data, lut_resolution_1d, 1)