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:
cc938ac
)
Code formatting.
author
Thomas Mansencal
<thomas.mansencal@gmail.com>
Tue, 26 May 2015 07:54:42 +0000
(09:54 +0200)
committer
Thomas Mansencal
<thomas.mansencal@gmail.com>
Tue, 26 May 2015 07:54:42 +0000
(09:54 +0200)
aces_1.0.0/python/aces_ocio/create_aces_colorspaces.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/create_aces_config.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/create_general_colorspaces.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/create_gopro_colorspaces.py
patch
|
blob
|
history
aces_1.0.0/python/aces_ocio/create_panasonic_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_colorspaces.py
b/aces_1.0.0/python/aces_ocio/create_aces_colorspaces.py
index
4849ff4
..
7316a53
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/create_aces_colorspaces.py
+++ b/
aces_1.0.0/python/aces_ocio/create_aces_colorspaces.py
@@
-146,7
+146,7
@@
def create_ACEScc(aces_ctl_directory,
'float',
input_scale,
1,
'float',
input_scale,
1,
- {'transferFunctionOnly':1},
+ {'transferFunctionOnly':
1},
cleanup,
aces_ctl_directory,
min_value,
cleanup,
aces_ctl_directory,
min_value,
@@
-199,12
+199,12
@@
def create_ACESproxy(aces_ctl_directory,
ctls = [os.path.join(aces_ctl_directory,
'ACESproxy',
'ACEScsc.ACESproxy10i_to_ACES.a1.0.0.ctl'),
ctls = [os.path.join(aces_ctl_directory,
'ACESproxy',
'ACEScsc.ACESproxy10i_to_ACES.a1.0.0.ctl'),
-
# This transform gets back to the *AP1* primaries.
-
# Useful as the 1d LUT is only covering the transfer function.
-
# The primaries switch is covered by the matrix below:
-
os.path.join(aces_ctl_directory,
-
'ACEScg',
-
'ACEScsc.ACES_to_ACEScg.a1.0.0.ctl')]
+ # This transform gets back to the *AP1* primaries.
+ # Useful as the 1d LUT is only covering the transfer function.
+ # The primaries switch is covered by the matrix below:
+ os.path.join(aces_ctl_directory,
+ 'ACEScg',
+ 'ACEScsc.ACES_to_ACEScg.a1.0.0.ctl')]
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
@@
-434,6
+434,7
@@
def create_ADX(lut_directory,
cs.from_reference_transforms = []
return cs
cs.from_reference_transforms = []
return cs
+
# -------------------------------------------------------------------------
# *Generic Log Transform*
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# *Generic Log Transform*
# -------------------------------------------------------------------------
@@
-504,18
+505,19
@@
def create_generic_log(aces_ctl_directory,
cs.from_reference_transforms = []
return cs
cs.from_reference_transforms = []
return cs
+
# -------------------------------------------------------------------------
# *base Dolby PQ Transform*
# -------------------------------------------------------------------------
def create_dolbypq(aces_CTL_directory,
# -------------------------------------------------------------------------
# *base Dolby PQ Transform*
# -------------------------------------------------------------------------
def create_dolbypq(aces_CTL_directory,
-
lut_directory,
-
lut_resolution_1d,
-
cleanup,
-
name='pq',
-
aliases=[],
-
min_value=0.0,
-
max_value=1.0,
-
input_scale=1.0):
+ lut_directory,
+ lut_resolution_1d,
+ cleanup,
+ name='pq',
+ aliases=[],
+ min_value=0.0,
+ max_value=1.0,
+ input_scale=1.0):
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
@@
-524,9
+526,9
@@
def create_dolbypq(aces_CTL_directory,
cs.is_data = False
ctls = [os.path.join(
cs.is_data = False
ctls = [os.path.join(
-
aces_CTL_directory,
-
'utilities',
-
'ACESlib.OCIO_shaper_dolbypq_to_lin.a1.0.0.ctl')]
+ aces_CTL_directory,
+ 'utilities',
+ 'ACESlib.OCIO_shaper_dolbypq_to_lin.a1.0.0.ctl')]
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
@@
-554,21
+556,22
@@
def create_dolbypq(aces_CTL_directory,
cs.from_reference_transforms = []
return cs
cs.from_reference_transforms = []
return cs
+
# -------------------------------------------------------------------------
# *Dolby PQ Transform that considers a fixed linear range*
# -------------------------------------------------------------------------
def create_dolbypq_scaled(aces_CTL_directory,
# -------------------------------------------------------------------------
# *Dolby PQ Transform that considers a fixed linear range*
# -------------------------------------------------------------------------
def create_dolbypq_scaled(aces_CTL_directory,
-
lut_directory,
-
lut_resolution_1d,
-
cleanup,
-
name='pq',
-
aliases=[],
-
min_value=0.0,
-
max_value=1.0,
-
input_scale=1.0,
-
middle_grey=0.18,
-
min_exposure=-6.0,
-
max_exposure=6.5):
+ lut_directory,
+ lut_resolution_1d,
+ cleanup,
+ name='pq',
+ aliases=[],
+ min_value=0.0,
+ max_value=1.0,
+ input_scale=1.0,
+ middle_grey=0.18,
+ min_exposure=-6.0,
+ max_exposure=6.5):
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
@@
-577,9
+580,9
@@
def create_dolbypq_scaled(aces_CTL_directory,
cs.is_data = False
ctls = [os.path.join(
cs.is_data = False
ctls = [os.path.join(
-
aces_CTL_directory,
-
'utilities',
-
'ACESlib.OCIO_shaper_dolbypq_to_lin_param.a1.0.0.ctl')]
+ aces_CTL_directory,
+ 'utilities',
+ 'ACESlib.OCIO_shaper_dolbypq_to_lin_param.a1.0.0.ctl')]
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
@@
-609,6
+612,7
@@
def create_dolbypq_scaled(aces_CTL_directory,
cs.from_reference_transforms = []
return cs
cs.from_reference_transforms = []
return cs
+
# -------------------------------------------------------------------------
# *Individual LMT*
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# *Individual LMT*
# -------------------------------------------------------------------------
@@
-732,6
+736,7
@@
def create_ACES_LMT(lmt_name,
return cs
return cs
+
# -------------------------------------------------------------------------
# *LMTs*
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# *LMTs*
# -------------------------------------------------------------------------
@@
-816,6
+821,7
@@
def create_LMTs(aces_ctl_directory,
return colorspaces
return colorspaces
+
# -------------------------------------------------------------------------
# *ACES RRT* with supplied *ODT*.
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# *ACES RRT* with supplied *ODT*.
# -------------------------------------------------------------------------
@@
-978,6
+984,7
@@
def create_ACES_RRT_plus_ODT(odt_name,
return cs
return cs
+
# -------------------------------------------------------------------------
# *ODTs*
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# *ODTs*
# -------------------------------------------------------------------------
@@
-1056,20
+1063,25
@@
def create_ODTs(aces_ctl_directory,
log2_shaper_copy_colorspace.equality_group = log2_shaper_copy_name
log2_shaper_copy_colorspace.family = log2_shaper_colorspace.family
log2_shaper_copy_colorspace.is_data = log2_shaper_colorspace.is_data
log2_shaper_copy_colorspace.equality_group = log2_shaper_copy_name
log2_shaper_copy_colorspace.family = log2_shaper_colorspace.family
log2_shaper_copy_colorspace.is_data = log2_shaper_colorspace.is_data
- log2_shaper_copy_colorspace.to_reference_transforms = list(log2_shaper_colorspace.to_reference_transforms)
- log2_shaper_copy_colorspace.from_reference_transforms = list(log2_shaper_colorspace.from_reference_transforms)
+ log2_shaper_copy_colorspace.to_reference_transforms = list(
+ log2_shaper_colorspace.to_reference_transforms)
+ log2_shaper_copy_colorspace.from_reference_transforms = list(
+ log2_shaper_colorspace.from_reference_transforms)
colorspaces.append(log2_shaper_copy_colorspace)
# Defining the *Log2 shaper that includes the AP1* primaries.
log2_shaper_api1_name = "%s - AP1" % "Log2 Shaper"
log2_shaper_api1_colorspace = ColorSpace(log2_shaper_api1_name)
log2_shaper_api1_colorspace.description = 'The %s color space' % log2_shaper_api1_name
colorspaces.append(log2_shaper_copy_colorspace)
# Defining the *Log2 shaper that includes the AP1* primaries.
log2_shaper_api1_name = "%s - AP1" % "Log2 Shaper"
log2_shaper_api1_colorspace = ColorSpace(log2_shaper_api1_name)
log2_shaper_api1_colorspace.description = 'The %s color space' % log2_shaper_api1_name
- log2_shaper_api1_colorspace.aliases = ["%s_ap1" % compact(log2_shaper_copy_name)]
+ log2_shaper_api1_colorspace.aliases = [
+ "%s_ap1" % compact(log2_shaper_copy_name)]
log2_shaper_api1_colorspace.equality_group = log2_shaper_api1_name
log2_shaper_api1_colorspace.family = log2_shaper_colorspace.family
log2_shaper_api1_colorspace.is_data = log2_shaper_colorspace.is_data
log2_shaper_api1_colorspace.equality_group = log2_shaper_api1_name
log2_shaper_api1_colorspace.family = log2_shaper_colorspace.family
log2_shaper_api1_colorspace.is_data = log2_shaper_colorspace.is_data
- log2_shaper_api1_colorspace.to_reference_transforms = list(log2_shaper_colorspace.to_reference_transforms)
- log2_shaper_api1_colorspace.from_reference_transforms = list(log2_shaper_colorspace.from_reference_transforms)
+ log2_shaper_api1_colorspace.to_reference_transforms = list(
+ log2_shaper_colorspace.to_reference_transforms)
+ log2_shaper_api1_colorspace.from_reference_transforms = list(
+ log2_shaper_colorspace.from_reference_transforms)
# *AP1* primaries to *AP0* primaries.
log2_shaper_api1_colorspace.to_reference_transforms.append({
# *AP1* primaries to *AP0* primaries.
log2_shaper_api1_colorspace.to_reference_transforms.append({
@@
-1088,8
+1100,10
@@
def create_ODTs(aces_ctl_directory,
shaper_api1_colorspace.equality_group = shaper_api1_name
shaper_api1_colorspace.family = log2_shaper_colorspace.family
shaper_api1_colorspace.is_data = log2_shaper_colorspace.is_data
shaper_api1_colorspace.equality_group = shaper_api1_name
shaper_api1_colorspace.family = log2_shaper_colorspace.family
shaper_api1_colorspace.is_data = log2_shaper_colorspace.is_data
- shaper_api1_colorspace.to_reference_transforms = list(log2_shaper_api1_colorspace.to_reference_transforms)
- shaper_api1_colorspace.from_reference_transforms = list(log2_shaper_api1_colorspace.from_reference_transforms)
+ shaper_api1_colorspace.to_reference_transforms = list(
+ log2_shaper_api1_colorspace.to_reference_transforms)
+ shaper_api1_colorspace.from_reference_transforms = list(
+ log2_shaper_api1_colorspace.from_reference_transforms)
colorspaces.append(shaper_api1_colorspace)
# Define the base *Dolby PQ Shaper*
colorspaces.append(shaper_api1_colorspace)
# Define the base *Dolby PQ Shaper*
@@
-1152,7
+1166,7
@@
def create_ODTs(aces_ctl_directory,
# Pick a specific shaper
#
rrt_shaper = log2_shaper_data
# Pick a specific shaper
#
rrt_shaper = log2_shaper_data
- #rrt_shaper = dolbypq_scaled_shaper_data
+ #
rrt_shaper = dolbypq_scaled_shaper_data
# *RRT + ODT* combinations.
sorted_odts = sorted(odt_info.iteritems(), key=lambda x: x[1])
# *RRT + ODT* combinations.
sorted_odts = sorted(odt_info.iteritems(), key=lambda x: x[1])
@@
-1462,7
+1476,7
@@
def create_colorspaces(aces_ctl_directory,
ACES = create_ACES()
ACEScc = create_ACEScc(aces_ctl_directory, lut_directory,
ACES = create_ACES()
ACEScc = create_ACEScc(aces_ctl_directory, lut_directory,
- lut_resolution_1d, cleanup,
+ lut_resolution_1d, cleanup,
min_value=-0.35840, max_value=1.468)
colorspaces.append(ACEScc)
min_value=-0.35840, max_value=1.468)
colorspaces.append(ACEScc)
@@
-1500,15
+1514,14
@@
def create_colorspaces(aces_ctl_directory,
ACEScc)
colorspaces.extend(odts)
ACEScc)
colorspaces.extend(odts)
- roles = {'color_picking' : ACEScg.name,
- 'color_timing' : ACEScc.name,
- 'compositing_log' : ACEScc.name,
- 'data' : '',
- 'default' : ACES.name,
- 'matte_paint' : ACEScc.name,
- 'reference' : '',
- 'scene_linear' : ACES.name,
- 'texture_paint' : ''}
-
+ roles = {'color_picking': ACEScg.name,
+ 'color_timing': ACEScc.name,
+ 'compositing_log': ACEScc.name,
+ 'data': '',
+ 'default': ACES.name,
+ 'matte_paint': ACEScc.name,
+ 'reference': '',
+ 'scene_linear': ACES.name,
+ 'texture_paint': ''}
return ACES, colorspaces, displays, ACEScc, roles
return ACES, colorspaces, displays, ACEScc, roles
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
16ba58c
..
1c11f5e
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
@@
-406,9
+406,9
@@
def create_config(config_data, nuke=False):
views.append(display)
# Works with Nuke Studio and Mari, but not Nuke
views.append(display)
# Works with Nuke Studio and Mari, but not Nuke
- #display_name = 'Utility'
+ #
display_name = 'Utility'
#displays.append(display_name)
#displays.append(display_name)
-
+
linear_display_space_name = config_data['linearDisplaySpace'].name
log_display_space_name = config_data['logDisplaySpace'].name
linear_display_space_name = config_data['linearDisplaySpace'].name
log_display_space_name = config_data['logDisplaySpace'].name
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
a8bb7b9
..
01d2c2d
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/create_general_colorspaces.py
+++ b/
aces_1.0.0/python/aces_ocio/create_general_colorspaces.py
@@
-79,6
+79,7
@@
def create_generic_matrix(name='matrix',
return cs
return cs
+
def create_colorspaces(lut_directory,
lut_resolution_1d,
lut_resolution_3d):
def create_colorspaces(lut_directory,
lut_resolution_1d,
lut_resolution_3d):
@@
-191,6
+192,7
@@
def create_colorspaces(lut_directory,
return colorspaces
return colorspaces
+
def create_raw():
# *Raw* utility space
name = "Raw"
def create_raw():
# *Raw* utility space
name = "Raw"
diff --git
a/aces_1.0.0/python/aces_ocio/create_gopro_colorspaces.py
b/aces_1.0.0/python/aces_ocio/create_gopro_colorspaces.py
index
b032baa
..
b208537
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/create_gopro_colorspaces.py
+++ b/
aces_1.0.0/python/aces_ocio/create_gopro_colorspaces.py
@@
-102,9
+102,9
@@
def create_protune(gamut,
if gamut == 'Protune Gamut':
cs.to_reference_transforms.append({
'type': 'matrix',
if gamut == 'Protune Gamut':
cs.to_reference_transforms.append({
'type': 'matrix',
- 'matrix': [
0.533448429, 0.32413911,
0.142412421, 0,
- -0.050729924,
1.07572006, -0.024990416, 0,
-
0.071419661, -0.290521962, 1.219102381, 0,
+ 'matrix': [
0.533448429, 0.32413911,
0.142412421, 0,
+ -0.050729924, 1.07572006, -0.024990416, 0,
+ 0.071419661, -0.290521962, 1.219102381, 0,
0, 0, 0, 1],
'direction': 'forward'})
0, 0, 0, 1],
'direction': 'forward'})
diff --git
a/aces_1.0.0/python/aces_ocio/create_panasonic_colorspaces.py
b/aces_1.0.0/python/aces_ocio/create_panasonic_colorspaces.py
index
5bbb26d
..
b8998c7
100644
(file)
--- a/
aces_1.0.0/python/aces_ocio/create_panasonic_colorspaces.py
+++ b/
aces_1.0.0/python/aces_ocio/create_panasonic_colorspaces.py
@@
-73,7
+73,7
@@
def create_v_log(gamut,
if (x <= cutInv):
return (x - 0.125) / 5.6
else:
if (x <= cutInv):
return (x - 0.125) / 5.6
else:
- return pow(10, (x
-d)/
c) - b
+ return pow(10, (x
- d) /
c) - b
cs.to_reference_transforms = []
cs.to_reference_transforms = []
@@
-100,10
+100,10
@@
def create_v_log(gamut,
if gamut == 'V-Gamut':
cs.to_reference_transforms.append({
'type': 'matrix',
if gamut == 'V-Gamut':
cs.to_reference_transforms.append({
'type': 'matrix',
- 'matrix': [
0.724382758, 0.166748484,
0.108497411, 0.0,
-
0.021354009,
0.985138372, -0.006319092, 0.0,
- -0.009234278, -0.00104295,
1.010272625, 0.0,
-
0, 0, 0, 1.0],
+ 'matrix': [
0.724382758, 0.166748484,
0.108497411, 0.0,
+
0.021354009,
0.985138372, -0.006319092, 0.0,
+ -0.009234278, -0.00104295, 1.010272625, 0.0,
+ 0, 0, 0, 1.0],
'direction': 'forward'})
cs.from_reference_transforms = []
'direction': 'forward'})
cs.from_reference_transforms = []
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
66a0d6e
..
f94bf34
100755
(executable)
--- a/
aces_1.0.0/python/aces_ocio/generate_lut.py
+++ b/
aces_1.0.0/python/aces_ocio/generate_lut.py
@@
-78,12
+78,12
@@
def generate_1d_LUT_image(ramp_1d_path,
ramp.close()
ramp.close()
-def write_SPI_1d(filename,
- from_min,
- from_max,
- data,
- entries,
- channels,
+def write_SPI_1d(filename,
+ from_min,
+ from_max,
+ data,
+ entries,
+ channels,
components=3):
"""
Object description.
components=3):
"""
Object description.
@@
-120,12
+120,12
@@
def write_SPI_1d(filename,
fp.write('}\n')
fp.write('}\n')
-def write_CSP_1d(filename,
- from_min,
- from_max,
- data,
- entries,
- channels,
+def write_CSP_1d(filename,
+ from_min,
+ from_max,
+ data,
+ entries,
+ channels,
components=3):
"""
Object description.
components=3):
"""
Object description.
@@
-168,25
+168,26
@@
def write_CSP_1d(filename,
fp.write('%d\n' % entries)
if components == 1:
fp.write('%d\n' % entries)
if components == 1:
- for i in range(0, entries):
- entry = ''
- for j in range(3):
- entry = '%s %s' % (entry, data[i * channels])
- fp.write('%s\n' % entry)
+
for i in range(0, entries):
+
entry = ''
+
for j in range(3):
+
entry = '%s %s' % (entry, data[i * channels])
+
fp.write('%s\n' % entry)
else:
else:
- for i in range(entries):
- entry = ''
- for j in range(components):
- entry = '%s %s' % (entry, data[i * channels + j])
- fp.write('%s\n' % entry)
+
for i in range(entries):
+
entry = ''
+
for j in range(components):
+
entry = '%s %s' % (entry, data[i * channels + j])
+
fp.write('%s\n' % entry)
fp.write('\n')
fp.write('\n')
-def write_CTL_1d(filename,
- from_min,
- from_max,
- data,
- entries,
- channels,
+
+def write_CTL_1d(filename,
+ from_min,
+ from_max,
+ data,
+ entries,
+ channels,
components=3):
"""
Object description.
components=3):
"""
Object description.
@@
-208,7
+209,7
@@
def write_CTL_1d(filename,
with open(filename, 'w') as fp:
fp.write('// %d x %d LUT generated by "generate_lut"\n' % (
with open(filename, 'w') as fp:
fp.write('// %d x %d LUT generated by "generate_lut"\n' % (
- entries, components))
+
entries, components))
fp.write('\n')
fp.write('const float min1d = %3.9f;\n' % from_min)
fp.write('const float max1d = %3.9f;\n' % from_max)
fp.write('\n')
fp.write('const float min1d = %3.9f;\n' % from_min)
fp.write('const float max1d = %3.9f;\n' % from_max)
@@
-216,24
+217,24
@@
def write_CTL_1d(filename,
# Write LUT
if components == 1:
# Write LUT
if components == 1:
- fp.write('const float lut[] = {\n')
- for i in range(0, entries):
- fp.write('%s' % data[i * channels])
- if i != (entries-1):
- fp.write(',')
- fp.write('\n')
- fp.write('};\n')
- fp.write('\n')
- else:
- for j in range(components):
- fp.write('const float lut%d[] = {\n' % j)
+ fp.write('const float lut[] = {\n')
for i in range(0, entries):
fp.write('%s' % data[i * channels])
for i in range(0, entries):
fp.write('%s' % data[i * channels])
- if i != (entries
-
1):
- fp.write(',')
+ if i != (entries
-
1):
+
fp.write(',')
fp.write('\n')
fp.write('};\n')
fp.write('\n')
fp.write('\n')
fp.write('};\n')
fp.write('\n')
+ else:
+ for j in range(components):
+ fp.write('const float lut%d[] = {\n' % j)
+ for i in range(0, entries):
+ fp.write('%s' % data[i * channels])
+ if i != (entries - 1):
+ fp.write(',')
+ fp.write('\n')
+ fp.write('};\n')
+ fp.write('\n')
fp.write('void main\n')
fp.write('(\n')
fp.write('void main\n')
fp.write('(\n')
@@
-253,13
+254,13
@@
def write_CTL_1d(filename,
fp.write('\n')
fp.write(' // Apply LUT\n')
if components == 1:
fp.write('\n')
fp.write(' // Apply LUT\n')
if components == 1:
- fp.write(' r = lookup1D(lut, min1d, max1d, r);\n')
- fp.write(' g = lookup1D(lut, min1d, max1d, g);\n')
- fp.write(' b = lookup1D(lut, min1d, max1d, b);\n')
+
fp.write(' r = lookup1D(lut, min1d, max1d, r);\n')
+
fp.write(' g = lookup1D(lut, min1d, max1d, g);\n')
+
fp.write(' b = lookup1D(lut, min1d, max1d, b);\n')
elif components == 3:
elif components == 3:
- fp.write(' r = lookup1D(lut0, min1d, max1d, r);\n')
- fp.write(' g = lookup1D(lut1, min1d, max1d, g);\n')
- fp.write(' b = lookup1D(lut2, min1d, max1d, b);\n')
+
fp.write(' r = lookup1D(lut0, min1d, max1d, r);\n')
+
fp.write(' g = lookup1D(lut1, min1d, max1d, g);\n')
+ fp.write(' b = lookup1D(lut2, min1d, max1d, b);\n')
fp.write('\n')
fp.write(' rOut = r;\n')
fp.write(' gOut = g;\n')
fp.write('\n')
fp.write(' rOut = r;\n')
fp.write(' gOut = g;\n')
@@
-267,12
+268,13
@@
def write_CTL_1d(filename,
fp.write(' aOut = aIn;\n')
fp.write('}\n')
fp.write(' aOut = aIn;\n')
fp.write('}\n')
-def write_1d(filename,
- from_min,
- from_max,
- data,
- data_entries,
- data_channels,
+
+def write_1d(filename,
+ from_min,
+ from_max,
+ data,
+ data_entries,
+ data_channels,
lut_components=3,
format='spi1d'):
"""
lut_components=3,
format='spi1d'):
"""
@@
-289,38
+291,39
@@
def write_1d(filename,
Return value description.
"""
Return value description.
"""
- ocioFormatsToExtensions = {'cinespace'
: 'csp',
- 'flame'
: '3dl',
- 'icc'
: 'icc',
- 'houdini'
: 'lut',
- 'lustre'
: '3dl',
- 'ctl'
: 'ctl'}
+ ocioFormatsToExtensions = {'cinespace': 'csp',
+ 'flame': '3dl',
+ 'icc': 'icc',
+ 'houdini': 'lut',
+ 'lustre': '3dl',
+ 'ctl': 'ctl'}
if format in ocioFormatsToExtensions:
if format in ocioFormatsToExtensions:
- if ocioFormatsToExtensions[format] == 'csp':
- write_CSP_1d(filename,
- from_min,
- from_max,
- data,
- data_entries,
- data_channels,
- lut_components)
- elif ocioFormatsToExtensions[format] == 'ctl':
- write_CTL_1d(filename,
+ if ocioFormatsToExtensions[format] == 'csp':
+ write_CSP_1d(filename,
+ from_min,
+ from_max,
+ data,
+ data_entries,
+ data_channels,
+ lut_components)
+ elif ocioFormatsToExtensions[format] == 'ctl':
+ write_CTL_1d(filename,
+ from_min,
+ from_max,
+ data,
+ data_entries,
+ data_channels,
+ lut_components)
+ else:
+ write_SPI_1d(filename,
from_min,
from_max,
data,
data_entries,
data_channels,
lut_components)
from_min,
from_max,
data,
data_entries,
data_channels,
lut_components)
- else:
- write_SPI_1d(filename,
- from_min,
- from_max,
- data,
- data_entries,
- data_channels,
- lut_components)
+
def generate_1d_LUT_from_image(ramp_1d_path,
output_path=None,
def generate_1d_LUT_from_image(ramp_1d_path,
output_path=None,
@@
-356,8
+359,8
@@
def generate_1d_LUT_from_image(ramp_1d_path,
type = oiio.FLOAT
ramp_data = ramp.read_image(type)
type = oiio.FLOAT
ramp_data = ramp.read_image(type)
- write_1d(output_path, min_value, max_value,
- ramp_data, ramp_width, ramp_channels, channels, format)
+ write_1d(output_path, min_value, max_value,
+
ramp_data, ramp_width, ramp_channels, channels, format)
def generate_3d_LUT_image(ramp_3d_path, resolution=32):
def generate_3d_LUT_image(ramp_3d_path, resolution=32):
@@
-388,8
+391,8
@@
def generate_3d_LUT_image(ramp_3d_path, resolution=32):
lut_extract.execute()
lut_extract.execute()
-def generate_3d_LUT_from_image(ramp_3d_path,
- output_path=None,
+def generate_3d_LUT_from_image(ramp_3d_path,
+ output_path=None,
resolution=32,
format='spi3d'):
"""
resolution=32,
format='spi3d'):
"""
@@
-409,56
+412,56
@@
def generate_3d_LUT_from_image(ramp_3d_path,
if output_path is None:
output_path = '%s.%s' % (ramp_3d_path, 'spi3d')
if output_path is None:
output_path = '%s.%s' % (ramp_3d_path, 'spi3d')
- ocioFormatsToExtensions = {'cinespace'
: 'csp',
- 'flame'
: '3dl',
- 'icc'
: 'icc',
- 'houdini'
: 'lut',
- 'lustre'
: '3dl'}
+ ocioFormatsToExtensions = {'cinespace': 'csp',
+ 'flame': '3dl',
+ 'icc': 'icc',
+ 'houdini': 'lut',
+ 'lustre': '3dl'}
if format == 'spi3d' or not (format in ocioFormatsToExtensions):
if format == 'spi3d' or not (format in ocioFormatsToExtensions):
- # Extract a spi3d LUT
- args = ['--extract',
- '--cubesize',
- str(resolution),
- '--maxwidth',
- str(resolution * resolution),
- '--input',
- ramp_3d_path,
- '--output',
- output_path]
- lut_extract = Process(description='extract a 3d LUT',
- cmd='ociolutimage',
- args=args)
- lut_extract.execute()
+
# Extract a spi3d LUT
+
args = ['--extract',
+
'--cubesize',
+
str(resolution),
+
'--maxwidth',
+
str(resolution * resolution),
+
'--input',
+
ramp_3d_path,
+
'--output',
+
output_path]
+
lut_extract = Process(description='extract a 3d LUT',
+
cmd='ociolutimage',
+
args=args)
+
lut_extract.execute()
else:
else:
- output_path_spi3d = '%s.%s' % (output_path, 'spi3d')
-
- # Extract a spi3d LUT
- args = ['--extract',
- '--cubesize',
- str(resolution),
- '--maxwidth',
- str(resolution * resolution),
- '--input',
- ramp_3d_path,
- '--output',
- output_path_spi3d]
- lut_extract = Process(description='extract a 3d LUT',
- cmd='ociolutimage',
- args=args)
- lut_extract.execute()
-
- # Convert to a different format
- args = ['--lut',
- output_path_spi3d,
- '--format',
- format,
- output_path]
- lut_convert = Process(description='convert a 3d LUT',
- cmd='ociobakelut',
- args=args)
- lut_convert.execute()
+
output_path_spi3d = '%s.%s' % (output_path, 'spi3d')
+
+
# Extract a spi3d LUT
+
args = ['--extract',
+
'--cubesize',
+
str(resolution),
+
'--maxwidth',
+
str(resolution * resolution),
+
'--input',
+
ramp_3d_path,
+
'--output',
+
output_path_spi3d]
+
lut_extract = Process(description='extract a 3d LUT',
+
cmd='ociolutimage',
+
args=args)
+
lut_extract.execute()
+
+
# Convert to a different format
+
args = ['--lut',
+
output_path_spi3d,
+
'--format',
+
format,
+
output_path]
+
lut_convert = Process(description='convert a 3d LUT',
+
cmd='ociobakelut',
+
args=args)
+
lut_convert.execute()
def apply_CTL_to_image(input_image,
def apply_CTL_to_image(input_image,
@@
-739,9
+742,9
@@
def generate_3d_LUT_from_CTL(lut_path,
corrected_LUT_image,
lut_resolution)
corrected_LUT_image,
lut_resolution)
- generate_3d_LUT_from_image(corrected_LUT_image,
- lut_path,
- lut_resolution,
+ generate_3d_LUT_from_image(corrected_LUT_image,
+ lut_path,
+ lut_resolution,
format)
if cleanup:
format)
if cleanup:
@@
-755,6
+758,7
@@
def generate_3d_LUT_from_CTL(lut_path,
lut_path_spi3d = '%s.%s' % (lut_path, 'spi3d')
os.remove(lut_path_spi3d)
lut_path_spi3d = '%s.%s' % (lut_path, 'spi3d')
os.remove(lut_path_spi3d)
+
def main():
"""
Object description.
def main():
"""
Object description.