X-Git-Url: http://users.mur.at/ms/git/gitweb/?a=blobdiff_plain;f=aces_1.0.0%2Fpython%2Faces_ocio%2Fcreate_arri_colorspaces.py;h=e0be8729350757387e67d415e78496cf83c95134;hb=0c0c9313006b5436ae6e09f68d66196b8a48743b;hp=117032cfc2193bc5bd9b4394a081e23770619c1a;hpb=f3a69608e9a350bd245e0578c196470b622af28d;p=OpenColorIO-Configs.git 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 117032c..e0be872 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 @@ -10,7 +10,7 @@ import math import os import aces_ocio.generate_lut as genlut -from aces_ocio.utilities import ColorSpace, mat44_from_mat33 +from aces_ocio.utilities import ColorSpace, mat44_from_mat33, sanitize_path __author__ = 'ACES Developers' @@ -29,7 +29,8 @@ def create_log_c(gamut, exposure_index, name, lut_directory, - lut_resolution_1d): + lut_resolution_1d, + aliases): """ Object description. @@ -54,11 +55,12 @@ def create_log_c(gamut, cs = ColorSpace(name) cs.description = name + cs.aliases = aliases cs.equality_group = '' cs.family = 'ARRI' cs.is_data = False - # Globals + # Globals. IDT_maker_version = '0.08' nominal_EI = 400.0 @@ -77,18 +79,19 @@ def create_log_c(gamut, offset = math.log10(cut) - slope * cut gain = EI / nominal_EI gray = mid_gray_signal / gain - # The higher the EI, the lower the gamma + # The higher the EI, the lower the gamma. 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 enc_offset = encoding_offset - math.log10(1 + nz) * enc_gain - # Calculate some intermediate values + a = 1.0 / gray b = nz - black_signal / gray e = slope * a * enc_gain f = enc_gain * (slope * b + offset) + enc_offset - # Manipulations so we can return relative exposure + + # Ensuring we can return relative exposure. s = 4 / (0.18 * EI) t = black_signal b += a * t @@ -107,16 +110,13 @@ def create_log_c(gamut, def log_c_to_linear(code_value, exposure_index): p = log_c_inverse_parameters_for_EI(exposure_index) breakpoint = p['e'] * p['cut'] + p['f'] - if (code_value > breakpoint): + if code_value > breakpoint: linear = ((pow(10, (code_value / 1023.0 - p['d']) / p['c']) - p['b']) / p['a']) else: linear = (code_value / 1023.0 - p['f']) / p['e'] - - # print(codeValue, linear) return linear - cs.to_reference_transforms = [] if transfer_function == 'V3 LogC': @@ -128,8 +128,7 @@ def create_log_c(gamut, lut = '%s_to_linear.spi1d' % ( '%s_%s' % (transfer_function, exposure_index)) - # Remove spaces and parentheses - lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_') + lut = sanitize_path(lut) genlut.write_SPI_1d( os.path.join(lut_directory, lut), @@ -139,7 +138,6 @@ def create_log_c(gamut, lut_resolution_1d, 1) - # print('Writing %s' % lut) cs.to_reference_transforms.append({ 'type': 'lutFile', 'path': lut, @@ -186,7 +184,7 @@ def create_colorspaces(lut_directory, lut_resolution_1d): 1000, 1280, 1600, 2000, 2560, 3200] default_EI = 800 - # Full conversion + # Full Conversion for EI in EIs: log_c_EI_full = create_log_c( gamut, @@ -194,10 +192,11 @@ def create_colorspaces(lut_directory, lut_resolution_1d): EI, 'LogC', lut_directory, - lut_resolution_1d) + lut_resolution_1d, + ["%sei%s_%s" % ("logc3", str(EI), "arriwide")]) colorspaces.append(log_c_EI_full) - # Linearization only + # Linearization Only for EI in [800]: log_c_EI_linearization = create_log_c( '', @@ -205,17 +204,19 @@ def create_colorspaces(lut_directory, lut_resolution_1d): EI, 'LogC', lut_directory, - lut_resolution_1d) + lut_resolution_1d, + ["crv_%sei%s" % ("logc3", str(EI))]) colorspaces.append(log_c_EI_linearization) - # Primaries + # Primaries Only log_c_EI_primaries = create_log_c( gamut, '', default_EI, 'LogC', lut_directory, - lut_resolution_1d) + lut_resolution_1d, + ["%s_%s" % ('lin', "arriwide")]) colorspaces.append(log_c_EI_primaries) return colorspaces