projects
/
OpenColorIO-Configs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added vendor-specific names in front of gamuts that may be confused with non-vendor...
[OpenColorIO-Configs.git]
/
aces_1.0.0
/
python
/
aces_ocio
/
create_arri_colorspaces.py
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
..
050dea2
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
@@
-5,12
+5,16
@@
Implements support for *ARRI* colorspaces conversions and transfer functions.
"""
Implements support for *ARRI* colorspaces conversions and transfer functions.
"""
+from __future__ import division
+
import array
import math
import os
import array
import math
import os
+import PyOpenColorIO as ocio
+
import aces_ocio.generate_lut as genlut
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
__author__ = 'ACES Developers'
__author__ = 'ACES Developers'
@@
-29,7
+33,8
@@
def create_log_c(gamut,
exposure_index,
name,
lut_directory,
exposure_index,
name,
lut_directory,
- lut_resolution_1d):
+ lut_resolution_1d,
+ aliases):
"""
Object description.
"""
Object description.
@@
-48,20
+53,26
@@
def create_log_c(gamut,
name = '%s (EI%s) - %s' % (transfer_function, exposure_index, gamut)
if transfer_function == '':
name = '%s (EI%s) - %s' % (transfer_function, exposure_index, gamut)
if transfer_function == '':
- name = 'Linear - %s' % gamut
+ name = 'Linear -
ARRI
%s' % gamut
if gamut == '':
name = '%s (EI%s)' % (transfer_function, exposure_index)
cs = ColorSpace(name)
cs.description = name
if gamut == '':
name = '%s (EI%s)' % (transfer_function, exposure_index)
cs = ColorSpace(name)
cs.description = name
+ cs.aliases = aliases
cs.equality_group = ''
cs.equality_group = ''
- cs.family = 'ARRI'
+ cs.family = '
Input/
ARRI'
cs.is_data = False
cs.is_data = False
- # Globals
+ # A linear space needs allocation variables
+ if transfer_function == '':
+ cs.allocation_type = ocio.Constants.ALLOCATION_LG2
+ cs.allocation_vars = [-8, 5, 0.00390625]
+
+ # Globals.
IDT_maker_version = '0.08'
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
black_signal = 0.003907
mid_gray_signal = 0.01
encoding_gain = 0.256598
@@
-72,23
+83,24
@@
def create_log_c(gamut,
0.89 - 1) / 3 + 1) * encoding_gain
def log_c_inverse_parameters_for_EI(EI):
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
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):
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
enc_offset = encoding_offset - math.log10(1 + nz) * enc_gain
- # Calculate some intermediate values
- 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
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
s = 4 / (0.18 * EI)
t = black_signal
b += a * t
@@
-107,39
+119,34
@@
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']
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)
:
- linear = ((pow(10, (code_value / 1023
.0
- p['d']) / p['c']) -
+ if
code_value > breakpoint
:
+ linear = ((pow(10, (code_value / 1023 - p['d']) / p['c']) -
p['b']) / p['a'])
else:
p['b']) / p['a'])
else:
- linear = (code_value / 1023.0 - p['f']) / p['e']
-
- # print(codeValue, linear)
+ linear = (code_value / 1023 - p['f']) / p['e']
return linear
return linear
-
cs.to_reference_transforms = []
if transfer_function == 'V3 LogC':
data = array.array('f', '\0' * lut_resolution_1d * 4)
for c in range(lut_resolution_1d):
cs.to_reference_transforms = []
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' % (
'%s_%s' % (transfer_function, exposure_index))
int(exposure_index))
lut = '%s_to_linear.spi1d' % (
'%s_%s' % (transfer_function, exposure_index))
- # Remove spaces and parentheses
- lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
+ lut = sanitize(lut)
genlut.write_SPI_1d(
os.path.join(lut_directory, lut),
genlut.write_SPI_1d(
os.path.join(lut_directory, lut),
- 0
.0
,
- 1
.0
,
+ 0,
+ 1,
data,
lut_resolution_1d,
1)
data,
lut_resolution_1d,
1)
- # print('Writing %s' % lut)
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
@@
-180,13
+187,13
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
transfer_function = 'V3 LogC'
gamut = 'Wide Gamut'
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, 80
0,
+ # 1000
, 1280, 1600, 2000, 2560, 320
0]
EIs = [160, 200, 250, 320, 400, 500, 640, 800,
1000, 1280, 1600, 2000, 2560, 3200]
default_EI = 800
EIs = [160, 200, 250, 320, 400, 500, 640, 800,
1000, 1280, 1600, 2000, 2560, 3200]
default_EI = 800
- # Full
c
onversion
+ # Full
C
onversion
for EI in EIs:
log_c_EI_full = create_log_c(
gamut,
for EI in EIs:
log_c_EI_full = create_log_c(
gamut,
@@
-194,10
+201,11
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
EI,
'LogC',
lut_directory,
EI,
'LogC',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["%sei%s_%s" % ("logc3", str(EI), "arriwide")])
colorspaces.append(log_c_EI_full)
colorspaces.append(log_c_EI_full)
- # Linearization
o
nly
+ # Linearization
O
nly
for EI in [800]:
log_c_EI_linearization = create_log_c(
'',
for EI in [800]:
log_c_EI_linearization = create_log_c(
'',
@@
-205,17
+213,19
@@
def create_colorspaces(lut_directory, lut_resolution_1d):
EI,
'LogC',
lut_directory,
EI,
'LogC',
lut_directory,
- lut_resolution_1d)
+ lut_resolution_1d,
+ ["crv_%sei%s" % ("logc3", str(EI))])
colorspaces.append(log_c_EI_linearization)
colorspaces.append(log_c_EI_linearization)
- # Primaries
+ # Primaries
Only
log_c_EI_primaries = create_log_c(
gamut,
'',
default_EI,
'LogC',
lut_directory,
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
colorspaces.append(log_c_EI_primaries)
return colorspaces