projects
/
OpenColorIO-Configs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2158c15
)
Improve paths handling and strings concatenations.
author
Thomas Mansencal
<thomas.mansencal@gmail.com>
Mon, 19 Jan 2015 12:15:04 +0000
(13:15 +0100)
committer
Thomas Mansencal
<thomas.mansencal@gmail.com>
Mon, 19 Jan 2015 12:15:04 +0000
(13:15 +0100)
aces_1.0.0/python/aces_ocio/create_aces_config.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/create_arri_colorspaces.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/create_canon_colorspaces.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/create_red_colorspaces.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/create_sony_colorspaces.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/generate_lut.py
patch
|
blob
|
history
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
d5aa5e8
..
d19b0ee
100755
(executable)
--- a/
aces_1.0.0/python/aces_ocio/create_aces_config.py
+++ b/
aces_1.0.0/python/aces_ocio/create_aces_config.py
@@
-456,7
+456,7
@@
def generate_LUTs(odt_info,
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
-
lut_directory + '/' + lut
,
+
os.path.join(lut_directory, lut)
,
ctls,
lut_resolution_1d,
'float',
ctls,
lut_resolution_1d,
'float',
@@
-513,7
+513,7
@@
def generate_LUTs(odt_info,
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
-
lut_directory + '/' + lut
,
+
os.path.join(lut_directory, lut)
,
ctls,
lut_resolution_1d,
'uint16',
ctls,
lut_resolution_1d,
'uint16',
@@
-668,7
+668,9
@@
def generate_LUTs(odt_info,
data.append(cid_to_rle(x))
lut = 'ADX_CID_to_RLE.spi1d'
data.append(cid_to_rle(x))
lut = 'ADX_CID_to_RLE.spi1d'
- write_SPI_1d(lut_directory + '/' + lut, RANGE[0], RANGE[1],
+ write_SPI_1d(os.path.join(lut_directory, lut),
+ RANGE[0],
+ RANGE[1],
data,
NUM_SAMPLES, 1)
data,
NUM_SAMPLES, 1)
@@
-763,7
+765,7
@@
def generate_LUTs(odt_info,
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
-
lut_directory + '/' + lut
,
+
os.path.join(lut_directory, lut)
,
ctls,
lut_resolution_1d,
'float',
ctls,
lut_resolution_1d,
'float',
@@
-817,7
+819,7
@@
def generate_LUTs(odt_info,
shaper_params) = shaper_info
shaper_lut = '%s_to_aces.spi1d' % shaper_name
shaper_params) = shaper_info
shaper_lut = '%s_to_aces.spi1d' % shaper_name
- if (not os.path.exists(
lut_directory + '/' + shaper_lut
)):
+ if (not os.path.exists(
os.path.join(lut_directory, shaper_lut)
)):
ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
# Remove spaces and parentheses
ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
# Remove spaces and parentheses
@@
-825,7
+827,7
@@
def generate_LUTs(odt_info,
' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
-
lut_directory + '/' + shaper_lut
,
+
os.path.join(lut_directory, shaper_lut)
,
ctls,
lut_resolution_1d,
'float',
ctls,
lut_resolution_1d,
'float',
@@
-858,7
+860,7
@@
def generate_LUTs(odt_info,
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
-
lut_directory + '/' + lut
,
+
os.path.join(lut_directory, lut)
,
ctls,
lut_resolution_3d,
'float',
ctls,
lut_resolution_3d,
'float',
@@
-893,7
+895,7
@@
def generate_LUTs(odt_info,
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
-
lut_directory + '/' + lut
,
+
os.path.join(lut_directory, lut)
,
ctls,
lut_resolution_3d,
'half',
ctls,
lut_resolution_3d,
'half',
@@
-995,7
+997,7
@@
def generate_LUTs(odt_info,
shaper_params['legalRange'] = 0
shaper_lut = '%s_to_aces.spi1d' % shaper_name
shaper_params['legalRange'] = 0
shaper_lut = '%s_to_aces.spi1d' % shaper_name
- if (not os.path.exists(
lut_directory + '/' + shaper_lut
)):
+ if (not os.path.exists(
os.path.join(lut_directory, shaper_lut)
)):
ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
# Remove spaces and parentheses
ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
# Remove spaces and parentheses
@@
-1003,7
+1005,7
@@
def generate_LUTs(odt_info,
' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
-
lut_directory + '/' + shaper_lut
,
+
os.path.join(lut_directory, shaper_lut)
,
ctls,
lut_resolution_1d,
'float',
ctls,
lut_resolution_1d,
'float',
@@
-1029,7
+1031,7
@@
def generate_LUTs(odt_info,
# Copy into the lut dir
transform_LUT_file_name = os.path.basename(
odt_values['transformLUT'])
# Copy into the lut dir
transform_LUT_file_name = os.path.basename(
odt_values['transformLUT'])
- lut =
lut_directory + '/' + transform_LUT_file_name
+ lut =
os.path.join(lut_directory, transform_LUT_file_name)
shutil.copy(odt_values['transformLUT'], lut)
cs.from_reference_transforms.append(shaper_OCIO_transform)
shutil.copy(odt_values['transformLUT'], lut)
cs.from_reference_transforms.append(shaper_OCIO_transform)
@@
-1052,16
+1054,17
@@
def generate_LUTs(odt_info,
# Remove spaces and parentheses
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
# Remove spaces and parentheses
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
- generate_3d_LUT_from_CTL(lut_directory + '/' + lut,
- # shaperLUT,
- ctls,
- lut_resolution_3d,
- 'float',
- 1.0 / shaper_input_scale,
- 1.0,
- shaper_params,
- cleanup,
- aces_CTL_directory)
+ generate_3d_LUT_from_CTL(
+ os.path.join(lut_directory, lut),
+ # shaperLUT,
+ ctls,
+ lut_resolution_3d,
+ 'float',
+ 1.0 / shaper_input_scale,
+ 1.0,
+ shaper_params,
+ cleanup,
+ aces_CTL_directory)
cs.from_reference_transforms.append(shaper_OCIO_transform)
cs.from_reference_transforms.append({
cs.from_reference_transforms.append(shaper_OCIO_transform)
cs.from_reference_transforms.append({
@@
-1080,7
+1083,7
@@
def generate_LUTs(odt_info,
# Copy into the lut dir
transform_LUT_inverse_file_name = os.path.basename(
odt_values['transformLUTInverse'])
# Copy into the lut dir
transform_LUT_inverse_file_name = os.path.basename(
odt_values['transformLUTInverse'])
- lut =
lut_directory + '/' + transform_LUT_inverse_file_name
+ lut =
os.path.join(lut_directory, transform_LUT_inverse_file_name)
shutil.copy(odt_values['transformLUTInverse'], lut)
cs.to_reference_transforms.append({
shutil.copy(odt_values['transformLUTInverse'], lut)
cs.to_reference_transforms.append({
@@
-1106,7
+1109,7
@@
def generate_LUTs(odt_info,
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
-
lut_directory + '/' + lut
,
+
os.path.join(lut_directory, lut)
,
# None,
ctls,
lut_resolution_3d,
# None,
ctls,
lut_resolution_3d,
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
b428a57
..
117032c
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/create_arri_colorspaces.py
+++ b/
aces_1.0.0/python/aces_ocio/create_arri_colorspaces.py
@@
-7,6
+7,7
@@
Implements support for *ARRI* colorspaces conversions and transfer functions.
import array
import math
import array
import math
+import os
import aces_ocio.generate_lut as genlut
from aces_ocio.utilities import ColorSpace, mat44_from_mat33
import aces_ocio.generate_lut as genlut
from aces_ocio.utilities import ColorSpace, mat44_from_mat33
@@
-130,12
+131,13
@@
def create_log_c(gamut,
# Remove spaces and parentheses
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
# Remove spaces and parentheses
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0.0,
+ 1.0,
+ data,
+ lut_resolution_1d,
+ 1)
# print('Writing %s' % lut)
cs.to_reference_transforms.append({
# print('Writing %s' % lut)
cs.to_reference_transforms.append({
@@
-149,8
+151,8
@@
def create_log_c(gamut,
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33([0.680206, 0.236137, 0.083658,
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33([0.680206, 0.236137, 0.083658,
- 0.085415, 1.017471, -0.102886,
- 0.002057, -0.062563, 1.060506]),
+
0.085415, 1.017471, -0.102886,
+
0.002057, -0.062563, 1.060506]),
'direction': 'forward'
})
'direction': 'forward'
})
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
87e5e3c
..
5159b16
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/create_canon_colorspaces.py
+++ b/
aces_1.0.0/python/aces_ocio/create_canon_colorspaces.py
@@
-6,6
+6,7
@@
Implements support for *Canon* colorspaces conversions and transfer functions.
"""
import array
"""
import array
+import os
import aces_ocio.generate_lut as genlut
from aces_ocio.utilities import ColorSpace
import aces_ocio.generate_lut as genlut
from aces_ocio.utilities import ColorSpace
@@
-77,12
+78,13
@@
def create_c_log(gamut,
data[c] = c_log_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
data[c] = c_log_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0.0,
+ 1.0,
+ data,
+ lut_resolution_1d,
+ 1)
cs.to_reference_transforms.append({
'type': 'lutFile',
cs.to_reference_transforms.append({
'type': 'lutFile',
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
b87eb4a
..
aaf4ce4
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/create_red_colorspaces.py
+++ b/
aces_1.0.0/python/aces_ocio/create_red_colorspaces.py
@@
-6,6
+6,7
@@
Implements support for *RED* colorspaces conversions and transfer functions.
"""
import array
"""
import array
+import os
import aces_ocio.generate_lut as genlut
from aces_ocio.utilities import ColorSpace, mat44_from_mat33
import aces_ocio.generate_lut as genlut
from aces_ocio.utilities import ColorSpace, mat44_from_mat33
@@
-75,12
+76,13
@@
def create_RED_log_film(gamut,
data[c] = cineon_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = 'CineonLog_to_linear.spi1d'
data[c] = cineon_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = 'CineonLog_to_linear.spi1d'
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0.0,
+ 1.0,
+ data,
+ lut_resolution_1d,
+ 1)
cs.to_reference_transforms.append({
'type': 'lutFile',
cs.to_reference_transforms.append({
'type': 'lutFile',
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
7a428ac
..
758ad14
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/create_sony_colorspaces.py
+++ b/
aces_1.0.0/python/aces_ocio/create_sony_colorspaces.py
@@
-6,6
+6,7
@@
Implements support for *Sony* colorspaces conversions and transfer functions.
"""
import array
"""
import array
+import os
import aces_ocio.generate_lut as genlut
from aces_ocio.utilities import ColorSpace, mat44_from_mat33
import aces_ocio.generate_lut as genlut
from aces_ocio.utilities import ColorSpace, mat44_from_mat33
@@
-102,12
+103,13
@@
def create_s_log(gamut,
data[c] = s_log1_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
data[c] = s_log1_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0.0,
+ 1.0,
+ data,
+ lut_resolution_1d,
+ 1)
# print('Writing %s' % lut)
# print('Writing %s' % lut)
@@
-123,12
+125,13
@@
def create_s_log(gamut,
data[c] = s_log2_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
data[c] = s_log2_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0.0,
+ 1.0,
+ data,
+ lut_resolution_1d,
+ 1)
# print('Writing %s' % lut)
# print('Writing %s' % lut)
@@
-144,12
+147,13
@@
def create_s_log(gamut,
data[c] = s_log3_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
data[c] = s_log3_to_linear(1023.0 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0.0,
+ 1.0,
+ data,
+ lut_resolution_1d,
+ 1)
# print('Writing %s' % lut)
# print('Writing %s' % lut)
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
78bc9f6
..
e8e78d8
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/generate_lut.py
+++ b/
aces_1.0.0/python/aces_ocio/generate_lut.py
@@
-133,7
+133,7
@@
def generate_1d_LUT_from_image(ramp_1d_path,
"""
if output_path is None:
"""
if output_path is None:
- output_path =
ramp_1d_path + '.spi1d'
+ output_path =
'%s.%s' % (ramp_1d_path, 'spi1d')
# open image
ramp = oiio.ImageInput.open(ramp_1d_path)
# open image
ramp = oiio.ImageInput.open(ramp_1d_path)
@@
-198,7
+198,7
@@
def generate_3d_LUT_from_image(ramp_3d_path, output_path=None, resolution=32):
"""
if output_path is None:
"""
if output_path is None:
- output_path =
ramp_3d_path + '.spi3d'
+ output_path =
'%s.%s' % (ramp_3d_path, 'spi1d')
args = ['--extract',
'--cubesize',
args = ['--extract',
'--cubesize',
@@
-323,21
+323,21
@@
def generate_1d_LUT_from_CTL(lut_path,
lut_path_base = os.path.splitext(lut_path)[0]
lut_path_base = os.path.splitext(lut_path)[0]
- identity_LUT_image_float =
lut_path_base + '.float.tiff'
+ identity_LUT_image_float =
'%s.%s.%s' % (lut_path_base, 'float', 'tiff')
generate_1d_LUT_image(identity_LUT_image_float,
lut_resolution,
min_value,
max_value)
if identity_LUT_bit_depth != 'half':
generate_1d_LUT_image(identity_LUT_image_float,
lut_resolution,
min_value,
max_value)
if identity_LUT_bit_depth != 'half':
- identity_LUT_image =
lut_path_base + '.uint16.tiff'
+ identity_LUT_image =
'%s.%s.%s' % (lut_path_base, 'uint16', 'tiff')
convert_bit_depth(identity_LUT_image_float,
identity_LUT_image,
identity_LUT_bit_depth)
else:
identity_LUT_image = identity_LUT_image_float
convert_bit_depth(identity_LUT_image_float,
identity_LUT_image,
identity_LUT_bit_depth)
else:
identity_LUT_image = identity_LUT_image_float
- transformed_LUT_image =
lut_path_base + '.transformed.exr'
+ transformed_LUT_image =
'%s.%s.%s' % (lut_path_base, 'transformed', 'exr')
apply_CTL_to_image(identity_LUT_image,
transformed_LUT_image,
ctl_paths,
apply_CTL_to_image(identity_LUT_image,
transformed_LUT_image,
ctl_paths,
@@
-471,21
+471,20
@@
def generate_3d_LUT_from_CTL(lut_path,
lut_path_base = os.path.splitext(lut_path)[0]
lut_path_base = os.path.splitext(lut_path)[0]
- identity_LUT_image_float =
lut_path_base + '.float.tiff'
+ identity_LUT_image_float =
'%s.%s.%s' % (lut_path_base, 'float', 'tiff')
generate_3d_LUT_image(identity_LUT_image_float, lut_resolution)
if identity_LUT_bit_depth != 'half':
generate_3d_LUT_image(identity_LUT_image_float, lut_resolution)
if identity_LUT_bit_depth != 'half':
- identity_LUT_image = (lut_path_base +
- '.' +
- identity_LUT_bit_depth +
- '.tiff')
+ identity_LUT_image = '%s.%s.%s' % (lut_path_base,
+ identity_LUT_bit_depth,
+ 'tiff')
convert_bit_depth(identity_LUT_image_float,
identity_LUT_image,
identity_LUT_bit_depth)
else:
identity_LUT_image = identity_LUT_image_float
convert_bit_depth(identity_LUT_image_float,
identity_LUT_image,
identity_LUT_bit_depth)
else:
identity_LUT_image = identity_LUT_image_float
- transformed_LUT_image =
lut_path_base + '.transformed.exr'
+ transformed_LUT_image =
'%s.%s.%s' % (lut_path_base, 'transformed', 'exr')
apply_CTL_to_image(identity_LUT_image,
transformed_LUT_image,
ctl_paths,
apply_CTL_to_image(identity_LUT_image,
transformed_LUT_image,
ctl_paths,
@@
-494,7
+493,7
@@
def generate_3d_LUT_from_CTL(lut_path,
global_params,
aces_CTL_directory)
global_params,
aces_CTL_directory)
- corrected_LUT_image =
lut_path_base + '.correct.exr'
+ corrected_LUT_image =
'%s.%s.%s' % (lut_path_base, 'correct', 'exr')
corrected_LUT_image = correct_LUT_image(transformed_LUT_image,
corrected_LUT_image,
lut_resolution)
corrected_LUT_image = correct_LUT_image(transformed_LUT_image,
corrected_LUT_image,
lut_resolution)