projects
/
OpenColorIO-Configs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Roles now have some assignments
[OpenColorIO-Configs.git]
/
aces_1.0.0
/
python
/
aces_ocio
/
create_sony_colorspaces.py
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
..
2419f03
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
@@
-5,7
+5,12
@@
Implements support for *Sony* colorspaces conversions and transfer functions.
"""
Implements support for *Sony* colorspaces conversions and transfer functions.
"""
+from __future__ import division
+
import array
import array
+import os
+
+import PyOpenColorIO as ocio
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
@@
-25,7
+30,8
@@
def create_s_log(gamut,
transfer_function,
name,
lut_directory,
transfer_function,
name,
lut_directory,
- lut_resolution_1d):
+ lut_resolution_1d,
+ aliases):
"""
Object description.
"""
Object description.
@@
-50,24
+56,29
@@
def create_s_log(gamut,
cs = ColorSpace(name)
cs.description = name
cs = ColorSpace(name)
cs.description = name
+ cs.aliases = aliases
cs.equality_group = ''
cs.family = 'Sony'
cs.is_data = False
cs.equality_group = ''
cs.family = '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.
w = 940.
def s_log1_to_linear(s_log):
b = 64.
ab = 90.
w = 940.
- if
(s_log >= ab)
:
+ if
s_log >= ab
:
linear = ((pow(10.,
linear = ((pow(10.,
- (
((s_log - b) /
-
(w - b) - 0.616596 - 0.03) / 0.432699)) -
+ (((s_log - b) /
+ (w - b) - 0.616596 - 0.03) / 0.432699)) -
0.037584) * 0.9)
else:
0.037584) * 0.9)
else:
- linear = (
- ((s_log - b) / (
- w - b) - 0.030001222851889303) / 5.) * 0.9
+ linear = (((s_log - b) / (
+ w - b) - 0.030001222851889303) / 5.) * 0.9
return linear
def s_log2_to_linear(s_log):
return linear
def s_log2_to_linear(s_log):
@@
-75,7
+86,7
@@
def create_s_log(gamut,
ab = 90.
w = 940.
ab = 90.
w = 940.
- if
(s_log >= ab)
:
+ if
s_log >= ab
:
linear = ((219. * (pow(10.,
(((s_log - b) /
(w - b) - 0.616596 - 0.03) / 0.432699)) -
linear = ((219. * (pow(10.,
(((s_log - b) /
(w - b) - 0.616596 - 0.03) / 0.432699)) -
@@
-86,12
+97,12
@@
def create_s_log(gamut,
return linear
def s_log3_to_linear(code_value):
return linear
def s_log3_to_linear(code_value):
- if code_value >=
(171.2102946929)
:
- linear = (pow(10
.0, ((code_value - 420.
0) / 261.5)) *
+ if code_value >=
171.2102946929
:
+ linear = (pow(10
, ((code_value - 42
0) / 261.5)) *
(0.18 + 0.01) - 0.01)
else:
(0.18 + 0.01) - 0.01)
else:
- linear = (code_value - 95
.0) * 0.01125000 / (171.2102946929 - 95.0
)
- # print(codeValue, linear)
+ linear = (code_value - 95
) * 0.01125000 / (171.2102946929 - 95
)
+
return linear
cs.to_reference_transforms = []
return linear
cs.to_reference_transforms = []
@@
-99,66
+110,60
@@
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):
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
lut = '%s_to_linear.spi1d' % transfer_function
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
-
- # print('Writing %s' % lut)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0,
+ 1,
+ data,
+ lut_resolution_1d,
+ 1)
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
- 'direction': 'forward'
- })
+ 'direction': 'forward'})
elif transfer_function == 'S-Log2':
data = array.array('f', '\0' * lut_resolution_1d * 4)
for c in range(lut_resolution_1d):
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
lut = '%s_to_linear.spi1d' % transfer_function
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
-
- # print('Writing %s' % lut)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0,
+ 1,
+ data,
+ lut_resolution_1d,
+ 1)
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
- 'direction': 'forward'
- })
+ 'direction': 'forward'})
elif transfer_function == 'S-Log3':
data = array.array('f', '\0' * lut_resolution_1d * 4)
for c in range(lut_resolution_1d):
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
lut = '%s_to_linear.spi1d' % transfer_function
- genlut.write_SPI_1d(lut_directory + '/' + lut,
- 0.0,
- 1.0,
- data,
- lut_resolution_1d,
- 1)
-
- # print('Writing %s' % lut)
+ genlut.write_SPI_1d(
+ os.path.join(lut_directory, lut),
+ 0,
+ 1,
+ data,
+ lut_resolution_1d,
+ 1)
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
- 'direction': 'forward'
- })
+ 'direction': 'forward'})
if gamut == 'S-Gamut':
cs.to_reference_transforms.append({
if gamut == 'S-Gamut':
cs.to_reference_transforms.append({
@@
-222,22
+227,24
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
colorspaces = []
colorspaces = []
- #
S-Log1
+ #
*S-Log1*
s_log1_s_gamut = create_s_log(
'S-Gamut',
'S-Log1',
'S-Log',
lut_directory,
s_log1_s_gamut = create_s_log(
'S-Gamut',
'S-Log1',
'S-Log',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["slog1_sgamut"])
colorspaces.append(s_log1_s_gamut)
colorspaces.append(s_log1_s_gamut)
- #
S-Log2
+ #
*S-Log2*
s_log2_s_gamut = create_s_log(
'S-Gamut',
'S-Log2',
'S-Log2',
lut_directory,
s_log2_s_gamut = create_s_log(
'S-Gamut',
'S-Log2',
'S-Log2',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["slog2_sgamut"])
colorspaces.append(s_log2_s_gamut)
s_log2_s_gamut_daylight = create_s_log(
colorspaces.append(s_log2_s_gamut)
s_log2_s_gamut_daylight = create_s_log(
@@
-245,7
+252,8
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'S-Log2',
'S-Log2',
lut_directory,
'S-Log2',
'S-Log2',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["slog2_sgamutday"])
colorspaces.append(s_log2_s_gamut_daylight)
s_log2_s_gamut_tungsten = create_s_log(
colorspaces.append(s_log2_s_gamut_daylight)
s_log2_s_gamut_tungsten = create_s_log(
@@
-253,16
+261,18
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'S-Log2',
'S-Log2',
lut_directory,
'S-Log2',
'S-Log2',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["slog2_sgamuttung"])
colorspaces.append(s_log2_s_gamut_tungsten)
colorspaces.append(s_log2_s_gamut_tungsten)
- #
S-Log3
+ #
*S-Log3*
s_log3_s_gamut3Cine = create_s_log(
'S-Gamut3.Cine',
'S-Log3',
'S-Log3',
lut_directory,
s_log3_s_gamut3Cine = create_s_log(
'S-Gamut3.Cine',
'S-Log3',
'S-Log3',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["slog3_sgamutcine"])
colorspaces.append(s_log3_s_gamut3Cine)
s_log3_s_gamut3 = create_s_log(
colorspaces.append(s_log3_s_gamut3Cine)
s_log3_s_gamut3 = create_s_log(
@@
-270,16
+280,18
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'S-Log3',
'S-Log3',
lut_directory,
'S-Log3',
'S-Log3',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["slog3_sgamut3"])
colorspaces.append(s_log3_s_gamut3)
colorspaces.append(s_log3_s_gamut3)
- # Linearization
o
nly
+ # Linearization
O
nly
s_log1 = create_s_log(
'',
'S-Log1',
'S-Log',
lut_directory,
s_log1 = create_s_log(
'',
'S-Log1',
'S-Log',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["crv_slog1"])
colorspaces.append(s_log1)
s_log2 = create_s_log(
colorspaces.append(s_log1)
s_log2 = create_s_log(
@@
-287,7
+299,8
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'S-Log2',
'S-Log2',
lut_directory,
'S-Log2',
'S-Log2',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["crv_slog2"])
colorspaces.append(s_log2)
s_log3 = create_s_log(
colorspaces.append(s_log2)
s_log3 = create_s_log(
@@
-295,16
+308,18
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'S-Log3',
'S-Log3',
lut_directory,
'S-Log3',
'S-Log3',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["crv_slog3"])
colorspaces.append(s_log3)
colorspaces.append(s_log3)
- # Primaries
o
nly
+ # Primaries
O
nly
s_gamut = create_s_log(
'S-Gamut',
'',
'S-Log',
lut_directory,
s_gamut = create_s_log(
'S-Gamut',
'',
'S-Log',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["lin_sgamut"])
colorspaces.append(s_gamut)
s_gamut_daylight = create_s_log(
colorspaces.append(s_gamut)
s_gamut_daylight = create_s_log(
@@
-312,7
+327,8
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'',
'S-Log2',
lut_directory,
'',
'S-Log2',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["lin_sgamutday"])
colorspaces.append(s_gamut_daylight)
s_gamut_tungsten = create_s_log(
colorspaces.append(s_gamut_daylight)
s_gamut_tungsten = create_s_log(
@@
-320,7
+336,8
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'',
'S-Log2',
lut_directory,
'',
'S-Log2',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["lin_sgamuttung"])
colorspaces.append(s_gamut_tungsten)
s_gamut3Cine = create_s_log(
colorspaces.append(s_gamut_tungsten)
s_gamut3Cine = create_s_log(
@@
-328,7
+345,8
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'',
'S-Log3',
lut_directory,
'',
'S-Log3',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["lin_sgamut3cine"])
colorspaces.append(s_gamut3Cine)
s_gamut3 = create_s_log(
colorspaces.append(s_gamut3Cine)
s_gamut3 = create_s_log(
@@
-336,7
+354,8
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
'',
'S-Log3',
lut_directory,
'',
'S-Log3',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["lin_sgamut3"])
colorspaces.append(s_gamut3)
return colorspaces
colorspaces.append(s_gamut3)
return colorspaces