Skip to content

Commit 986a74b

Browse files
Add Panasonic CLFs (#63)
* Add Panasonic CLFs Signed-off-by: Doug Walker <doug.walker@autodesk.com> * Fix formatting issue Signed-off-by: Doug Walker <doug.walker@autodesk.com> Co-authored-by: Thomas Mansencal <thomas.mansencal@gmail.com>
1 parent a4cc1e6 commit 986a74b

File tree

6 files changed

+177
-0
lines changed

6 files changed

+177
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright Contributors to the OpenColorIO Project.
3+
4+
from .generate import generate_panasonic
5+
6+
__all__ = [
7+
"generate_panasonic",
8+
]
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright Contributors to the OpenColorIO Project.
3+
"""
4+
*Panasonic* CLF Transforms Generation
5+
=====================================
6+
7+
Defines procedures for generating Panasonic *Common LUT Format* (CLF)
8+
transforms for the OpenColorIO project.
9+
"""
10+
11+
import PyOpenColorIO as ocio
12+
from pathlib import Path
13+
14+
from opencolorio_config_aces.clf import (
15+
create_conversion_matrix,
16+
generate_clf,
17+
)
18+
19+
__author__ = "OpenColorIO Contributors"
20+
__copyright__ = "Copyright Contributors to the OpenColorIO Project."
21+
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
22+
__maintainer__ = "OpenColorIO Contributors"
23+
__email__ = "ocio-dev@lists.aswf.io"
24+
__status__ = "Production"
25+
26+
__all__ = [
27+
"generate_panasonic",
28+
]
29+
30+
DEST_DIR = Path(__file__).parent.resolve() / "input"
31+
32+
TF_ID_PREFIX = "urn:aswf:ocio:transformId:1.0:"
33+
TF_ID_SUFFIX = ":1.0"
34+
35+
CLF_SUFFIX = ".clf"
36+
37+
38+
def generate_panasonic():
39+
"""Make the CLF file for V-Log - V-Gamut plus matrix/curve CLFs."""
40+
41+
# Based on the document "VARICAM_V-Log_V-Gamut.pdf" dated November 28, 2014.
42+
# The resulting CLF was reviewed by Panasonic.
43+
44+
if not DEST_DIR.exists():
45+
DEST_DIR.mkdir()
46+
47+
cut1 = 0.01
48+
b = 0.00873
49+
c = 0.241514
50+
d = 0.598206
51+
52+
LIN_SLP = 1.0
53+
LIN_OFF = b
54+
LOG_SLP = c
55+
LOG_OFF = d
56+
LIN_SB = cut1
57+
BASE = 10.0
58+
59+
lct = ocio.LogCameraTransform(
60+
base=BASE,
61+
linSideBreak=[LIN_SB] * 3,
62+
logSideSlope=[LOG_SLP] * 3,
63+
logSideOffset=[LOG_OFF] * 3,
64+
linSideSlope=[LIN_SLP] * 3,
65+
linSideOffset=[LIN_OFF] * 3,
66+
direction=ocio.TRANSFORM_DIR_INVERSE,
67+
)
68+
69+
mtx = create_conversion_matrix("V-Gamut", "ACES2065-1", "Bradford")
70+
71+
# Using the CSC ID here because there is a slight discrepancy between the matrix
72+
# coefficients of the CSC and IDT CTL and the CLF matches the CSC transform.
73+
aces_transform_id = (
74+
"urn:ampas:aces:transformId:v1.5:"
75+
"ACEScsc.Academy.VLog_VGamut_to_ACES.a1.1.0"
76+
)
77+
78+
# Generate full transform.
79+
80+
generate_clf(
81+
ocio.GroupTransform(
82+
transforms=[
83+
lct,
84+
mtx,
85+
]
86+
),
87+
TF_ID_PREFIX
88+
+ "Panasonic:Input:VLog-VGamut_to_ACES2065-1"
89+
+ TF_ID_SUFFIX,
90+
"Panasonic V-Log - V-Gamut (SUP v3) to ACES2065-1",
91+
DEST_DIR / ("VLog-VGamut_to_ACES2065-1" + CLF_SUFFIX),
92+
"Panasonic V-Log - V-Gamut (SUP v3)",
93+
"ACES2065-1",
94+
aces_transform_id,
95+
)
96+
97+
# Generate transform for primaries only.
98+
99+
generate_clf(
100+
ocio.GroupTransform([mtx]),
101+
TF_ID_PREFIX
102+
+ "Panasonic:Input:Linear-VGamut_to_ACES2065-1"
103+
+ TF_ID_SUFFIX,
104+
"Linear Panasonic V-Gamut (SUP v3) to ACES2065-1",
105+
DEST_DIR / ("Linear-VGamut_to_ACES2065-1" + CLF_SUFFIX),
106+
"Linear Panasonic V-Gamut (SUP v3)",
107+
"ACES2065-1",
108+
None,
109+
)
110+
111+
# Generate named transform for log curve only.
112+
113+
generate_clf(
114+
ocio.GroupTransform([lct]),
115+
TF_ID_PREFIX + "Panasonic:Input:VLog_Log_to_Linear" + TF_ID_SUFFIX,
116+
"Panasonic V-Log (SUP v3) Log to Linear Curve",
117+
DEST_DIR / ("VLog-Curve" + CLF_SUFFIX),
118+
"Panasonic V-Log (SUP v3) Log (arbitrary primaries)",
119+
"Panasonic V-Log (SUP v3) Linear (arbitrary primaries)",
120+
None,
121+
)
122+
123+
return 0
124+
125+
126+
if __name__ == "__main__":
127+
import sys
128+
129+
sys.exit(generate_panasonic())
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:Panasonic:Input:Linear-VGamut_to_ACES2065-1:1.0" name="Linear Panasonic V-Gamut (SUP v3) to ACES2065-1">
3+
<InputDescriptor>Linear Panasonic V-Gamut (SUP v3)</InputDescriptor>
4+
<OutputDescriptor>ACES2065-1</OutputDescriptor>
5+
<Matrix inBitDepth="32f" outBitDepth="32f">
6+
<Array dim="3 3">
7+
0.72461670413153 0.166915288193706 0.108468007674764
8+
0.021390245413146 0.984908155703054 -0.00629840111620093
9+
-0.00923556287076562 -0.00105690563900513 1.01029246850977
10+
</Array>
11+
</Matrix>
12+
</ProcessList>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:Panasonic:Input:VLog_Log_to_Linear:1.0" name="Panasonic V-Log (SUP v3) Log to Linear Curve">
3+
<InputDescriptor>Panasonic V-Log (SUP v3) Log (arbitrary primaries)</InputDescriptor>
4+
<OutputDescriptor>Panasonic V-Log (SUP v3) Linear (arbitrary primaries)</OutputDescriptor>
5+
<Log inBitDepth="32f" outBitDepth="32f" style="cameraLogToLin">
6+
<LogParams base="10" linSideSlope="1" linSideOffset="0.00873" logSideSlope="0.241514" logSideOffset="0.598206" linSideBreak="0.01" />
7+
</Log>
8+
</ProcessList>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ProcessList compCLFversion="3" id="urn:aswf:ocio:transformId:1.0:Panasonic:Input:VLog-VGamut_to_ACES2065-1:1.0" name="Panasonic V-Log - V-Gamut (SUP v3) to ACES2065-1">
3+
<InputDescriptor>Panasonic V-Log - V-Gamut (SUP v3)</InputDescriptor>
4+
<OutputDescriptor>ACES2065-1</OutputDescriptor>
5+
<Info>
6+
<ACEStransformID>urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.VLog_VGamut_to_ACES.a1.1.0</ACEStransformID>
7+
</Info>
8+
<Log inBitDepth="32f" outBitDepth="32f" style="cameraLogToLin">
9+
<LogParams base="10" linSideSlope="1" linSideOffset="0.00873" logSideSlope="0.241514" logSideOffset="0.598206" linSideBreak="0.01" />
10+
</Log>
11+
<Matrix inBitDepth="32f" outBitDepth="32f">
12+
<Array dim="3 3">
13+
0.72461670413153 0.166915288193706 0.108468007674764
14+
0.021390245413146 0.984908155703054 -0.00629840111620093
15+
-0.00923556287076562 -0.00105690563900513 1.01029246850977
16+
</Array>
17+
</Matrix>
18+
</ProcessList>

tasks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ def build_clfs(ctx: Context):
230230
ctx.run("python generate.py")
231231
with ctx.cd("opencolorio_config_aces/clf/transforms/blackmagic"):
232232
ctx.run("python generate.py")
233+
with ctx.cd("opencolorio_config_aces/clf/transforms/panasonic"):
234+
ctx.run("python generate.py")
233235
with ctx.cd("opencolorio_config_aces/clf/transforms/sony"):
234236
ctx.run("python generate.py")
235237

0 commit comments

Comments
 (0)