Install requirements using
pip install -r requirements.txt
Put a log2linear 1D LUT somewhere, then run:
python log_curve.py --lut_file <path to LUT>
This will compute the parameters of the log to linear conversion function in about 10 - 15 minutes, depending on your computer's speed.
Go to the dctl
folder and download the Aces/Zlog conversion DCTLs. On Windows and MacOS, they go in the IDT
and ODT
folders located in the following directories:
(Windows)
%AppData%\Roaming\Blackmagic Design\DaVinci Resolve\Support\ACES Transforms\
(MacOS)
~/Library/Application Support/Blackmagic Design/DaVinci Resolve/ACES Transformations/
For example, place the aces_to_zlog2.dctl file in the following folder on MacOS:
/Users/<your username>/Library/Application Support/Blackmagic Design/DaVinci Resolve/ACES Transformations/ODT/
or on Windows:
C:\Users\<your username>\AppData\Roaming\Blackmagic Design\DaVinci Resolve\Support\ACES Transforms\ODT\
Once you've done that, restart Resolve and they should show up in the ACES Transform node and in the color mangement settings.
The zlog2 to Linear conversion DCTLs should go in Resolve's normal LUTs folder
Some camera manufacturers do not release the Log to Scene Linear transfer function for their log curves. However, they sometimes provide it in the form of a 1D LUT. The general form of a log to linear conversion is the following function:
def log2linear(x):
if (t > e * cut + f):
return (pow(10, (t - d) / c) - b) / a
else:
return (t - f) / e
And likewise, the inverse of this function is the linear2log curve:
def linear2log(t):
if (x > cut):
return c * log10(a * x + b) + d
else:
return e * x + f
There's only a matter of choosing the correct values for parameters log2linear
function at log2linear
function and the ground truth values found in the 1D LUT.
Ultimately, the objective is to derive the linear2log
conversion, but this is made simpler by matching the log2linear
curve. This is because the linear2log
function has a log function in it, limiting its domain to positive numbers, whereas we can safely pass any value into the log2linear
function and get a differentiable result.
The ground truth log2linear
function is evaluated in the 1D LUT at
Additionally, to find the value of the parameter log2linear
function. The Adam optimizer converged faster than SGD in my tests.