From: Thomas Mansencal Date: Wed, 28 Jan 2015 19:52:36 +0000 (+0100) Subject: Implement __future__ division support. X-Git-Url: http://users.mur.at/ms/git/gitweb/?p=OpenColorIO-Configs.git;a=commitdiff_plain;h=89360f70a6c71121580324ed3c125a83c3973887 Implement __future__ division support. --- diff --git a/aces_1.0.0/python/aces_ocio/create_aces_colorspaces.py b/aces_1.0.0/python/aces_ocio/create_aces_colorspaces.py index 0a79ec6..c69fcac 100644 --- a/aces_1.0.0/python/aces_ocio/create_aces_colorspaces.py +++ b/aces_1.0.0/python/aces_ocio/create_aces_colorspaces.py @@ -5,6 +5,8 @@ Implements support for *ACES* colorspaces conversions and transfer functions. """ +from __future__ import division + import math import numpy import os @@ -94,9 +96,9 @@ def create_ACEScc(aces_ctl_directory, lut_resolution_1d, cleanup, name='ACEScc', - min_value=0.0, - max_value=1.0, - input_scale=1.0): + min_value=0, + max_value=1, + input_scale=1): """ Creates the *ACEScc* colorspace. @@ -137,7 +139,7 @@ def create_ACEScc(aces_ctl_directory, lut_resolution_1d, 'float', input_scale, - 1.0, + 1, {}, cleanup, aces_ctl_directory, @@ -205,8 +207,8 @@ def create_ACESproxy(aces_ctl_directory, ctls, lut_resolution_1d, 'uint16', - 64.0, - 1.0, + 64, + 1, {}, cleanup, aces_ctl_directory) @@ -300,18 +302,18 @@ def create_ADX(lut_directory, if bit_depth == 10: cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT10 - ADX_to_CDD = [1023.0 / 500.0, 0.0, 0.0, 0.0, - 0.0, 1023.0 / 500.0, 0.0, 0.0, - 0.0, 0.0, 1023.0 / 500.0, 0.0, - 0.0, 0.0, 0.0, 1.0] - offset = [-95.0 / 500.0, -95.0 / 500.0, -95.0 / 500.0, 0.0] + ADX_to_CDD = [1023 / 500, 0, 0, 0, + 0, 1023 / 500, 0, 0, + 0, 0, 1023 / 500, 0, + 0, 0, 0, 1] + offset = [-95 / 500, -95 / 500, -95 / 500, 0] elif bit_depth == 16: cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT16 - ADX_to_CDD = [65535.0 / 8000.0, 0.0, 0.0, 0.0, - 0.0, 65535.0 / 8000.0, 0.0, 0.0, - 0.0, 0.0, 65535.0 / 8000.0, 0.0, - 0.0, 0.0, 0.0, 1.0] - offset = [-1520.0 / 8000.0, -1520.0 / 8000.0, -1520.0 / 8000.0, 0.0] + ADX_to_CDD = [65535 / 8000, 0, 0, 0, + 0, 65535 / 8000, 0, 0, + 0, 0, 65535 / 8000, 0, + 0, 0, 0, 1] + offset = [-1520 / 8000, -1520 / 8000, -1520 / 8000, 0] cs.to_reference_transforms = [] @@ -328,7 +330,7 @@ def create_ADX(lut_directory, 'matrix': [0.75573, 0.22197, 0.02230, 0, 0.05901, 0.96928, -0.02829, 0, 0.16134, 0.07406, 0.76460, 0, - 0.0, 0.0, 0.0, 1.0], + 0, 0, 0, 1], 'direction': 'forward'}) # Copied from *Alex Fry*'s *adx_cid_to_rle.py* @@ -361,13 +363,13 @@ def create_ADX(lut_directory, -1.121718645000000, -0.926545676714876] - REF_PT = ((7120.0 - 1520.0) / 8000.0 * (100.0 / 55.0) - - math.log(0.18, 10.0)) + REF_PT = ((7120 - 1520) / 8000 * (100 / 55) - + math.log(0.18, 10)) def cid_to_rle(x): if x <= 0.6: return interpolate_1D(x, LUT_1D_xp, LUT_1D_fp) - return (100.0 / 55.0) * x - REF_PT + return (100 / 55) * x - REF_PT def fit(value, from_min, from_max, to_min, to_max): if from_min == from_max: @@ -376,11 +378,11 @@ def create_ADX(lut_directory, to_max - to_min) + to_min num_samples = 2 ** 12 - domain = (-0.19, 3.0) + domain = (-0.19, 3) data = [] for i in xrange(num_samples): - x = i / (num_samples - 1.0) - x = fit(x, 0.0, 1.0, domain[0], domain[1]) + x = i / (num_samples - 1) + x = fit(x, 0, 1, domain[0], domain[1]) data.append(cid_to_rle(x)) lut = 'ADX_CID_to_RLE.spi1d' @@ -414,7 +416,7 @@ def create_ADX(lut_directory, 'matrix': [0.72286, 0.12630, 0.15084, 0, 0.11923, 0.76418, 0.11659, 0, 0.01427, 0.08213, 0.90359, 0, - 0.0, 0.0, 0.0, 1.0], + 0, 0, 0, 1], 'direction': 'forward'}) cs.from_reference_transforms = [] @@ -429,7 +431,7 @@ def create_ACES_LMT(lmt_name, lut_resolution_1d=1024, lut_resolution_3d=64, cleanup=True, - aliases=[]): + aliases=None): """ Creates the *ACES LMT* colorspace. @@ -444,6 +446,9 @@ def create_ACES_LMT(lmt_name, *ACES LMT* colorspace. """ + if aliases is None: + aliases = [] + cs = ColorSpace('%s' % lmt_name) cs.description = 'The ACES Look Transform: %s' % lmt_name cs.aliases = aliases @@ -471,8 +476,8 @@ def create_ACES_LMT(lmt_name, ctls, lut_resolution_1d, 'float', - 1.0 / shaper_input_scale, - 1.0, + 1 / shaper_input_scale, + 1, shaper_params, cleanup, aces_ctl_directory) @@ -499,8 +504,8 @@ def create_ACES_LMT(lmt_name, ctls, lut_resolution_3d, 'float', - 1.0 / shaper_input_scale, - 1.0, + 1 / shaper_input_scale, + 1, shaper_params, cleanup, aces_ctl_directory) @@ -530,7 +535,7 @@ def create_ACES_LMT(lmt_name, ctls, lut_resolution_3d, 'half', - 1.0, + 1, shaper_input_scale, shaper_params, cleanup, @@ -557,7 +562,7 @@ def create_ACES_RRT_plus_ODT(odt_name, lut_resolution_1d=1024, lut_resolution_3d=64, cleanup=True, - aliases=[]): + aliases=None): """ Object description. @@ -572,6 +577,9 @@ def create_ACES_RRT_plus_ODT(odt_name, Return value description. """ + if aliases is None: + aliases = [] + cs = ColorSpace('%s' % odt_name) cs.description = '%s - %s Output Transform' % ( odt_values['transformUserNamePrefix'], odt_name) @@ -605,8 +613,8 @@ def create_ACES_RRT_plus_ODT(odt_name, ctls, lut_resolution_1d, 'float', - 1.0 / shaper_input_scale, - 1.0, + 1 / shaper_input_scale, + 1, shaper_params, cleanup, aces_ctl_directory) @@ -651,8 +659,8 @@ def create_ACES_RRT_plus_ODT(odt_name, ctls, lut_resolution_3d, 'float', - 1.0 / shaper_input_scale, - 1.0, + 1 / shaper_input_scale, + 1, shaper_params, cleanup, aces_ctl_directory) @@ -700,7 +708,7 @@ def create_ACES_RRT_plus_ODT(odt_name, ctls, lut_resolution_3d, 'half', - 1.0, + 1, shaper_input_scale, shaper_params, cleanup, @@ -725,11 +733,11 @@ def create_generic_log(aces_ctl_directory, cleanup, name='log', aliases=[], - min_value=0.0, - max_value=1.0, - input_scale=1.0, + min_value=0, + max_value=1, + input_scale=1, middle_grey=0.18, - min_exposure=-6.0, + min_exposure=-6, max_exposure=6.5): """ Creates the *Generic Log* colorspace. @@ -766,7 +774,7 @@ def create_generic_log(aces_ctl_directory, lut_resolution_1d, 'float', input_scale, - 1.0, + 1, {'middleGrey': middle_grey, 'minExposure': min_exposure, 'maxExposure': max_exposure}, @@ -820,7 +828,7 @@ def create_LMTs(aces_ctl_directory, lmt_shaper_name_aliases = ['crv_lmtshaper'] lmt_params = { 'middleGrey': 0.18, - 'minExposure': -10.0, + 'minExposure': -10, 'maxExposure': 6.5} lmt_shaper = create_generic_log(aces_ctl_directory, @@ -834,7 +842,7 @@ def create_LMTs(aces_ctl_directory, aliases=lmt_shaper_name_aliases) colorspaces.append(lmt_shaper) - shaper_input_scale_generic_log2 = 1.0 + shaper_input_scale_generic_log2 = 1 # *Log 2* shaper name and *CTL* transforms bundled up. lmt_shaper_data = [ @@ -904,7 +912,7 @@ def create_ODTs(aces_ctl_directory, log2_shaper_name_aliases = ["crv_%s" % compact(shaper_name)] log2_params = { 'middleGrey': 0.18, - 'minExposure': -6.0, + 'minExposure': -6, 'maxExposure': 6.5} log2_shaper = create_generic_log( @@ -919,7 +927,7 @@ def create_ODTs(aces_ctl_directory, aliases=log2_shaper_name_aliases) colorspaces.append(log2_shaper) - shaper_input_scale_generic_log2 = 1.0 + shaper_input_scale_generic_log2 = 1 # *Log 2* shaper name and *CTL* transforms bundled up. log2_shaper_data = [ diff --git a/aces_1.0.0/python/aces_ocio/create_aces_config.py b/aces_1.0.0/python/aces_ocio/create_aces_config.py index 96382e0..7c43a68 100755 --- a/aces_1.0.0/python/aces_ocio/create_aces_config.py +++ b/aces_1.0.0/python/aces_ocio/create_aces_config.py @@ -5,6 +5,8 @@ Defines objects creating the *ACES* configuration. """ +from __future__ import division + import os import sys diff --git a/aces_1.0.0/python/aces_ocio/create_arri_colorspaces.py b/aces_1.0.0/python/aces_ocio/create_arri_colorspaces.py index 76af824..13533d5 100644 --- a/aces_1.0.0/python/aces_ocio/create_arri_colorspaces.py +++ b/aces_1.0.0/python/aces_ocio/create_arri_colorspaces.py @@ -5,6 +5,8 @@ Implements support for *ARRI* colorspaces conversions and transfer functions. """ +from __future__ import division + import array import math import os @@ -63,7 +65,7 @@ def create_log_c(gamut, # Globals. IDT_maker_version = '0.08' - nominal_EI = 400.0 + nominal_EI = 400 black_signal = 0.003907 mid_gray_signal = 0.01 encoding_gain = 0.256598 @@ -74,8 +76,8 @@ def create_log_c(gamut, 0.89 - 1) / 3 + 1) * encoding_gain def log_c_inverse_parameters_for_EI(EI): - cut = 1.0 / 9.0 - slope = 1.0 / (cut * math.log(10)) + cut = 1 / 9 + slope = 1 / (cut * math.log(10)) offset = math.log10(cut) - slope * cut gain = EI / nominal_EI gray = mid_gray_signal / gain @@ -83,10 +85,10 @@ def create_log_c(gamut, enc_gain = gain_for_EI(EI) enc_offset = encoding_offset for i in range(0, 3): - nz = ((95.0 / 1023.0 - enc_offset) / enc_gain - offset) / slope + nz = ((95 / 1023 - enc_offset) / enc_gain - offset) / slope enc_offset = encoding_offset - math.log10(1 + nz) * enc_gain - a = 1.0 / gray + a = 1 / gray b = nz - black_signal / gray e = slope * a * enc_gain f = enc_gain * (slope * b + offset) + enc_offset @@ -111,10 +113,10 @@ def create_log_c(gamut, p = log_c_inverse_parameters_for_EI(exposure_index) breakpoint = p['e'] * p['cut'] + p['f'] if code_value > breakpoint: - linear = ((pow(10, (code_value / 1023.0 - p['d']) / p['c']) - + linear = ((pow(10, (code_value / 1023 - p['d']) / p['c']) - p['b']) / p['a']) else: - linear = (code_value / 1023.0 - p['f']) / p['e'] + linear = (code_value / 1023 - p['f']) / p['e'] return linear cs.to_reference_transforms = [] @@ -122,7 +124,7 @@ def create_log_c(gamut, if transfer_function == 'V3 LogC': data = array.array('f', '\0' * lut_resolution_1d * 4) for c in range(lut_resolution_1d): - data[c] = log_c_to_linear(1023.0 * c / (lut_resolution_1d - 1), + data[c] = log_c_to_linear(1023 * c / (lut_resolution_1d - 1), int(exposure_index)) lut = '%s_to_linear.spi1d' % ( @@ -132,8 +134,8 @@ def create_log_c(gamut, genlut.write_SPI_1d( os.path.join(lut_directory, lut), - 0.0, - 1.0, + 0, + 1, data, lut_resolution_1d, 1) @@ -178,8 +180,8 @@ def create_colorspaces(lut_directory, lut_resolution_1d): transfer_function = 'V3 LogC' gamut = 'Wide Gamut' - # EIs = [160.0, 200.0, 250.0, 320.0, 400.0, 500.0, 640.0, 800.0, - # 1000.0, 1280.0, 1600.0, 2000.0, 2560.0, 3200.0] + # EIs = [160, 200, 250, 320, 400, 500, 640, 800, + # 1000, 1280, 1600, 2000, 2560, 3200] EIs = [160, 200, 250, 320, 400, 500, 640, 800, 1000, 1280, 1600, 2000, 2560, 3200] default_EI = 800 diff --git a/aces_1.0.0/python/aces_ocio/create_canon_colorspaces.py b/aces_1.0.0/python/aces_ocio/create_canon_colorspaces.py index ec419fd..f63c1bb 100644 --- a/aces_1.0.0/python/aces_ocio/create_canon_colorspaces.py +++ b/aces_1.0.0/python/aces_ocio/create_canon_colorspaces.py @@ -5,6 +5,8 @@ Implements support for *Canon* colorspaces conversions and transfer functions. """ +from __future__ import division + import array import os @@ -58,7 +60,7 @@ def create_c_log(gamut, cs.is_data = False def legal_to_full(code_value): - return (code_value - 64.0) / (940.0 - 64.0) + return (code_value - 64) / (940 - 64) def c_log_to_linear(code_value): # log = fullToLegal(c1 * log10(c2*linear + 1) + c3) @@ -67,7 +69,7 @@ def create_c_log(gamut, c2 = 10.1596 c3 = 0.0730597 - linear = (pow(10.0, (legal_to_full(code_value) - c3) / c1) - 1.0) / c2 + linear = (pow(10, (legal_to_full(code_value) - c3) / c1) - 1) / c2 linear *= 0.9 return linear @@ -77,13 +79,13 @@ def create_c_log(gamut, if transfer_function == 'Canon-Log': data = array.array('f', '\0' * lut_resolution_1d * 4) for c in range(lut_resolution_1d): - data[c] = c_log_to_linear(1023.0 * c / (lut_resolution_1d - 1)) + data[c] = c_log_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) @@ -97,50 +99,50 @@ def create_c_log(gamut, if gamut == 'Rec. 709 Daylight': cs.to_reference_transforms.append({ 'type': 'matrix', - 'matrix': [0.561538969, 0.402060105, 0.036400926, 0.0, - 0.092739623, 0.924121198, -0.016860821, 0.0, - 0.084812961, 0.006373835, 0.908813204, 0.0, - 0, 0, 0, 1.0], + 'matrix': [0.561538969, 0.402060105, 0.036400926, 0, + 0.092739623, 0.924121198, -0.016860821, 0, + 0.084812961, 0.006373835, 0.908813204, 0, + 0, 0, 0, 1], 'direction': 'forward'}) elif gamut == 'Rec. 709 Tungsten': cs.to_reference_transforms.append({ 'type': 'matrix', - 'matrix': [0.566996399, 0.365079418, 0.067924183, 0.0, - 0.070901044, 0.880331008, 0.048767948, 0.0, - 0.073013542, -0.066540862, 0.99352732, 0.0, - 0, 0, 0, 1.0], + 'matrix': [0.566996399, 0.365079418, 0.067924183, 0, + 0.070901044, 0.880331008, 0.048767948, 0, + 0.073013542, -0.066540862, 0.99352732, 0, + 0, 0, 0, 1], 'direction': 'forward'}) elif gamut == 'DCI-P3 Daylight': cs.to_reference_transforms.append({ 'type': 'matrix', - 'matrix': [0.607160575, 0.299507286, 0.093332140, 0.0, - 0.004968120, 1.050982224, -0.055950343, 0.0, - -0.007839939, 0.000809127, 1.007030813, 0.0, - 0, 0, 0, 1.0], + 'matrix': [0.607160575, 0.299507286, 0.093332140, 0, + 0.004968120, 1.050982224, -0.055950343, 0, + -0.007839939, 0.000809127, 1.007030813, 0, + 0, 0, 0, 1], 'direction': 'forward'}) elif gamut == 'DCI-P3 Tungsten': cs.to_reference_transforms.append({ 'type': 'matrix', - 'matrix': [0.650279125, 0.253880169, 0.095840706, 0.0, - -0.026137986, 1.017900530, 0.008237456, 0.0, - 0.007757558, -0.063081669, 1.055324110, 0.0, - 0, 0, 0, 1.0], + 'matrix': [0.650279125, 0.253880169, 0.095840706, 0, + -0.026137986, 1.017900530, 0.008237456, 0, + 0.007757558, -0.063081669, 1.055324110, 0, + 0, 0, 0, 1], 'direction': 'forward'}) elif gamut == 'Cinema Gamut Daylight': cs.to_reference_transforms.append({ 'type': 'matrix', - 'matrix': [0.763064455, 0.149021161, 0.087914384, 0.0, - 0.003657457, 1.10696038, -0.110617837, 0.0, - -0.009407794, -0.218383305, 1.227791099, 0.0, - 0, 0, 0, 1.0], + 'matrix': [0.763064455, 0.149021161, 0.087914384, 0, + 0.003657457, 1.10696038, -0.110617837, 0, + -0.009407794, -0.218383305, 1.227791099, 0, + 0, 0, 0, 1], 'direction': 'forward'}) elif gamut == 'Cinema Gamut Tungsten': cs.to_reference_transforms.append({ 'type': 'matrix', - 'matrix': [0.817416293, 0.090755698, 0.091828009, 0.0, - -0.035361374, 1.065690585, -0.030329211, 0.0, - 0.010390366, -0.299271107, 1.288880741, 0.0, - 0, 0, 0, 1.0], + 'matrix': [0.817416293, 0.090755698, 0.091828009, 0, + -0.035361374, 1.065690585, -0.030329211, 0, + 0.010390366, -0.299271107, 1.288880741, 0, + 0, 0, 0, 1], 'direction': 'forward'}) cs.from_reference_transforms = [] diff --git a/aces_1.0.0/python/aces_ocio/create_general_colorspaces.py b/aces_1.0.0/python/aces_ocio/create_general_colorspaces.py index c1e10cb..410f844 100644 --- a/aces_1.0.0/python/aces_ocio/create_general_colorspaces.py +++ b/aces_1.0.0/python/aces_ocio/create_general_colorspaces.py @@ -5,6 +5,8 @@ Implements support for general colorspaces conversions and transfer functions. """ +from __future__ import division + import aces_ocio.create_aces_colorspaces as aces from aces_ocio.utilities import ColorSpace, mat44_from_mat33 diff --git a/aces_1.0.0/python/aces_ocio/create_red_colorspaces.py b/aces_1.0.0/python/aces_ocio/create_red_colorspaces.py index 5443f16..2bdea91 100644 --- a/aces_1.0.0/python/aces_ocio/create_red_colorspaces.py +++ b/aces_1.0.0/python/aces_ocio/create_red_colorspaces.py @@ -5,6 +5,8 @@ Implements support for *RED* colorspaces conversions and transfer functions. """ +from __future__ import division + import array import os @@ -59,29 +61,29 @@ def create_RED_log_film(gamut, def cineon_to_linear(code_value): n_gamma = 0.6 - black_point = 95.0 - white_point = 685.0 + black_point = 95 + white_point = 685 code_value_to_density = 0.002 - black_linear = pow(10.0, (black_point - white_point) * ( + black_linear = pow(10, (black_point - white_point) * ( code_value_to_density / n_gamma)) - code_linear = pow(10.0, (code_value - white_point) * ( + code_linear = pow(10, (code_value - white_point) * ( code_value_to_density / n_gamma)) - return (code_linear - black_linear) / (1.0 - black_linear) + return (code_linear - black_linear) / (1 - black_linear) cs.to_reference_transforms = [] if transfer_function == 'REDlogFilm': data = array.array('f', '\0' * lut_resolution_1d * 4) for c in range(lut_resolution_1d): - data[c] = cineon_to_linear(1023.0 * c / (lut_resolution_1d - 1)) + data[c] = cineon_to_linear(1023 * c / (lut_resolution_1d - 1)) lut = 'CineonLog_to_linear.spi1d' genlut.write_SPI_1d( os.path.join(lut_directory, lut), - 0.0, - 1.0, + 0, + 1, data, lut_resolution_1d, 1) 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..c16b708 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,6 +5,8 @@ Implements support for *Sony* colorspaces conversions and transfer functions. """ +from __future__ import division + import array import os @@ -89,10 +91,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 +103,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 +122,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 +141,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) diff --git a/aces_1.0.0/python/aces_ocio/generate_lut.py b/aces_1.0.0/python/aces_ocio/generate_lut.py index 4ed78fe..a9b84c3 100755 --- a/aces_1.0.0/python/aces_ocio/generate_lut.py +++ b/aces_1.0.0/python/aces_ocio/generate_lut.py @@ -6,6 +6,8 @@ Defines objects to generate various kind of 1d, 2d and 3d LUTs in various file formats. """ +from __future__ import division + import array import os import sys @@ -36,8 +38,8 @@ __all__ = ['generate_1d_LUT_image', def generate_1d_LUT_image(ramp_1d_path, resolution=1024, - min_value=0.0, - max_value=1.0): + min_value=0, + max_value=1): """ Object description. @@ -110,8 +112,8 @@ def write_SPI_1d(filename, from_min, from_max, data, entries, channels): def generate_1d_LUT_from_image(ramp_1d_path, output_path=None, - min_value=0.0, - max_value=1.0): + min_value=0, + max_value=1): """ Object description. @@ -207,8 +209,8 @@ def generate_3d_LUT_from_image(ramp_3d_path, output_path=None, resolution=32): def apply_CTL_to_image(input_image, output_image, ctl_paths=None, - input_scale=1.0, - output_scale=1.0, + input_scale=1, + output_scale=1, global_params=None, aces_ctl_directory=None): """ @@ -288,13 +290,13 @@ def generate_1d_LUT_from_CTL(lut_path, ctl_paths, lut_resolution=1024, identity_LUT_bit_depth='half', - input_scale=1.0, - output_scale=1.0, + input_scale=1, + output_scale=1, global_params=None, cleanup=True, aces_ctl_directory=None, - min_value=0.0, - max_value=1.0): + min_value=0, + max_value=1): """ Object description. @@ -426,8 +428,8 @@ def generate_3d_LUT_from_CTL(lut_path, ctl_paths, lut_resolution=64, identity_LUT_bit_depth='half', - input_scale=1.0, - output_scale=1.0, + input_scale=1, + output_scale=1, global_params=None, cleanup=True, aces_ctl_directory=None): @@ -518,10 +520,10 @@ def main(): p.add_option('--ctlReleasePath', '-r', type='string', default='') p.add_option('--bitDepth', '-b', type='string', default='float') p.add_option('--keepTempImages', '', action='store_true') - p.add_option('--minValue', '', type='float', default=0.0) - p.add_option('--maxValue', '', type='float', default=1.0) - p.add_option('--inputScale', '', type='float', default=1.0) - p.add_option('--outputScale', '', type='float', default=1.0) + p.add_option('--minValue', '', type='float', default=0) + p.add_option('--maxValue', '', type='float', default=1) + p.add_option('--inputScale', '', type='float', default=1) + p.add_option('--outputScale', '', type='float', default=1) p.add_option('--ctlRenderParam', '-p', type='string', nargs=2, action='append') diff --git a/aces_1.0.0/python/aces_ocio/process.py b/aces_1.0.0/python/aces_ocio/process.py index 062855e..bb8f199 100755 --- a/aces_1.0.0/python/aces_ocio/process.py +++ b/aces_1.0.0/python/aces_ocio/process.py @@ -6,6 +6,8 @@ A process wrapper class that maintains the text output and execution status of a process or a list of other process wrappers which carry such data. """ +from __future__ import division + import os import sys import traceback diff --git a/aces_1.0.0/python/aces_ocio/tests/tests_aces_config.py b/aces_1.0.0/python/aces_ocio/tests/tests_aces_config.py index 229c880..f41349e 100644 --- a/aces_1.0.0/python/aces_ocio/tests/tests_aces_config.py +++ b/aces_1.0.0/python/aces_ocio/tests/tests_aces_config.py @@ -5,6 +5,8 @@ Defines unit tests for *ACES* configuration. """ +from __future__ import division + import hashlib import os import re diff --git a/aces_1.0.0/python/aces_ocio/utilities.py b/aces_1.0.0/python/aces_ocio/utilities.py index 6ad832b..75222f1 100644 --- a/aces_1.0.0/python/aces_ocio/utilities.py +++ b/aces_1.0.0/python/aces_ocio/utilities.py @@ -5,6 +5,8 @@ Defines various package utilities objects. """ +from __future__ import division + import os import re from collections import OrderedDict @@ -43,7 +45,7 @@ class ColorSpace(object): to_reference_transforms=[], from_reference_transforms=[], allocation_type=OCIO.Constants.ALLOCATION_UNIFORM, - allocation_vars=[0.0, 1.0]): + allocation_vars=[0, 1]): """ Object description. @@ -86,10 +88,10 @@ def mat44_from_mat33(mat33): Return value description. """ - return [mat33[0], mat33[1], mat33[2], 0.0, - mat33[3], mat33[4], mat33[5], 0.0, - mat33[6], mat33[7], mat33[8], 0.0, - 0, 0, 0, 1.0] + return [mat33[0], mat33[1], mat33[2], 0, + mat33[3], mat33[4], mat33[5], 0, + mat33[6], mat33[7], mat33[8], 0, + 0, 0, 0, 1] def filter_words(words, filters_in=None, filters_out=None, flags=0): diff --git a/aces_1.0.0/python/bin/create_aces_config b/aces_1.0.0/python/bin/create_aces_config index b59fa39..b889dd5 100755 --- a/aces_1.0.0/python/bin/create_aces_config +++ b/aces_1.0.0/python/bin/create_aces_config @@ -5,6 +5,8 @@ Creates the *ACES* configuration. """ +from __future__ import division + import os import sys diff --git a/aces_1.0.0/python/bin/tests_aces_config b/aces_1.0.0/python/bin/tests_aces_config index 6fe08ed..190c40f 100755 --- a/aces_1.0.0/python/bin/tests_aces_config +++ b/aces_1.0.0/python/bin/tests_aces_config @@ -5,6 +5,8 @@ Tests the *ACES* configuration. """ +from __future__ import division + import os import unittest import sys