Skip to content

Commit

Permalink
Added LogB400, Reorganized LUTs, Added basic installer
Browse files Browse the repository at this point in the history
  • Loading branch information
RikshaDriver committed Sep 17, 2023
1 parent e88ebff commit 5de9649
Show file tree
Hide file tree
Showing 27 changed files with 249 additions and 25 deletions.
25 changes: 25 additions & 0 deletions IDT/GoPro_Protune-LogB400_Rec709_ACES.dctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//GoPro Protune LogB=400 IDT for ACES workflow inside DaVinci Resolve
#if (__RESOLVE_VER_MAJOR__ >= 17)
DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0)
#endif

//Rec709 to ACES using CAT02
__CONSTANT__ float rec709[3][3] = {{0.4395756842f, 0.3839125893f, 0.1765117265f},{ 0.0896003829f, 0.8147141542f, 0.0956854629f},{ 0.0174154827f, 0.1087343522f, 0.8738501650f}};

__DEVICE__ float protune_to_linear(float xV) {
return ((_powf(400.0f, xV) - 1.0f) / 399.0f);
}


__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) {

p_R = protune_to_linear(p_R);
p_G = protune_to_linear(p_G);
p_B = protune_to_linear(p_B);

float rVal = rec709[0][0] * p_R + rec709[0][1] * p_G + rec709[0][2] * p_B;
float gVal = rec709[1][0] * p_R + rec709[1][1] * p_G + rec709[1][2] * p_B;
float bVal = rec709[2][0] * p_R + rec709[2][1] * p_G + rec709[2][2] * p_B;

return make_float3( rVal, gVal, bVal);
}
13 changes: 13 additions & 0 deletions Install_Windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
xcopy "LUT\" "%ProgramData%\Blackmagic Design\DaVinci Resolve\Support\LUT\"
xcopy "IDT\" "%AppData%\Blackmagic Design\DaVinci Resolve\Support\ACES Transforms\IDT\"

if errorlevel 0 goto success
:success
msg "%username%" Transforms installed successfully!
goto exit

if not errorlevel 0 goto fail
msg "%username%" Transform installation failed! Please install manually.
goto exit

:exit
23 changes: 23 additions & 0 deletions Install_nix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

#Simple Installer. Use at your own risk!

if [ $(uname -s) = "Linux" ]; then
IDT_FOLDER="${HOME}/.local/share/DaVinciResolve/ACES Transforms/IDT"
ODT_FOLDER="${HOME}/.local/share/DaVinciResolve/ACES Transforms/ODT"
LUT_FOLDER="/opt/resolve/LUT"

elif [ $(uname -s) = "darwin" ]; then
IDT_FOLDER="${HOME}/Library/Application Support/Blackmagic Design/DaVinci Resolve/ACES Transforms/IDT"
ODT_FOLDER="${HOME}/Library/Application Support/Blackmagic Design/DaVinci Resolve/ACES Transforms/ODT"
LUT_FOLDER="/Library/Application Support/Blackmagic Design/DaVinci Resolve/LUT"
fi

mkdir -p "${IDT_FOLDER}"
mkdir -p "${ODT_FOLDER}"

cp IDT/*.dctl "${IDT_FOLDER}/" && echo "Installed IDTs" || echo "Failed to install IDTs"
cp ODT/*.dctl "${ODT_FOLDER}/" && echo "Installed ODTs" || echo "Failed to install ODTs"
sudo cp -R LUT/ "${LUT_FOLDER}/" && echo "Installed DCTLs to LUT Folder" || echo "Failed to install DCTLs to LUT Folder"

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//GoPro Protune Input Transform for DaVinci YRGB workflow inside DaVinci Resolve

//Protune Rec.709 to DaVinci Wide Gamut
__CONSTANT__ float rec709_to_dwg[3][3] = { { 0.5627674560f, 0.3235165887f, 0.1137159553f}, { 0.0777546353f, 0.7495773462f, 0.1726680186f}, { 0.0646691999f, 0.1919986920f, 0.7433321080f} };

__DEVICE__ float protune_to_linear(float xV) {
return ((_powf(400.0f, xV) - 1.0f) / 399.0f);
}

__DEVICE__ float lin_to_inter(float x) {
if(x > 0.00262409f) return (_log2f(x + 0.0075f) + 7.0f) * 0.07329248f;
else return x * 10.44426855f;
}

__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) {

float3 RGBv;

p_R = protune_to_linear(p_R);
p_G = protune_to_linear(p_G);
p_B = protune_to_linear(p_B);

RGBv.x = lin_to_inter(rec709_to_dwg[0][0] * p_R + rec709_to_dwg[0][1] * p_G + rec709_to_dwg[0][2] * p_B);
RGBv.y = lin_to_inter(rec709_to_dwg[1][0] * p_R + rec709_to_dwg[1][1] * p_G + rec709_to_dwg[1][2] * p_B);
RGBv.z = lin_to_inter(rec709_to_dwg[2][0] * p_R + rec709_to_dwg[2][1] * p_G + rec709_to_dwg[2][2] * p_B);

return RGBv;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//GoPro Protune Input Transform for DaVinci YRGB workflow inside DaVinci Resolve

//Protune Rec.709 to Rec.2020
__CONSTANT__ float rec709_to_rec2020[3][3] = { { 0.6274038959f, 0.3292830384f, 0.0433130657f}, { 0.0690972894f, 0.9195403951f, 0.0113623156f}, { 0.0163914389f, 0.0880133079f, 0.8955952532f} };

__DEVICE__ float protune_to_linear(float xV) {
return ((_powf(400.0f, xV) - 1.0f) / 399.0f);
}

__DEVICE__ float lin_to_inter(float x) {
if(x > 0.00262409f) return (_log2f(x + 0.0075f) + 7.0f) * 0.07329248f;
else return x * 10.44426855f;
}

__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) {

float3 RGBv;

p_R = protune_to_linear(p_R);
p_G = protune_to_linear(p_G);
p_B = protune_to_linear(p_B);

RGBv.x = lin_to_inter(rec709_to_rec2020[0][0] * p_R + rec709_to_rec2020[0][1] * p_G + rec709_to_rec2020[0][2] * p_B);
RGBv.y = lin_to_inter(rec709_to_rec2020[1][0] * p_R + rec709_to_rec2020[1][1] * p_G + rec709_to_rec2020[1][2] * p_B);
RGBv.z = lin_to_inter(rec709_to_rec2020[2][0] * p_R + rec709_to_rec2020[2][1] * p_G + rec709_to_rec2020[2][2] * p_B);

return RGBv;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//GoPro Protune Input Transform for DaVinci YRGB workflow inside DaVinci Resolve

__DEVICE__ float protune_to_linear(float xV) {
return ((_powf(400.0f, xV) - 1.0f) / 399.0f);
}

__DEVICE__ float lin_to_gamma(float x) {
if(x >= 0) return _powf(x, 1.0f/2.2f);
else return 0.0f;
}


__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) {

p_R = lin_to_gamma(protune_to_linear(p_R));
p_G = lin_to_gamma(protune_to_linear(p_G));
p_B = lin_to_gamma(protune_to_linear(p_B));

return make_float3(p_R,p_G,p_B);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//GoPro Protune Input Transform for DaVinci YRGB workflow inside DaVinci Resolve

__DEVICE__ float protune_to_linear(float xV) {
return ((_powf(400.0f, xV) - 1.0f) / 399.0f);
}

__DEVICE__ float lin_to_gamma(float x) {
if(x >= 0) return _powf(x, 1.0f/2.4f);
else return 0.0f;
}


__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) {

p_R = lin_to_gamma(protune_to_linear(p_R));
p_G = lin_to_gamma(protune_to_linear(p_G));
p_B = lin_to_gamma(protune_to_linear(p_B));

return make_float3(p_R,p_G,p_B);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//GoPro Protune Input Transform for DaVinci YRGB workflow inside DaVinci Resolve

__DEVICE__ float protune_to_linear(float xV) {
return ((_powf(400.0f, xV) - 1.0f) / 399.0f);
}

__DEVICE__ float lin_to_gamma(float x) {
if(x >= 0) return _powf(x, 1.0f/2.6f);
else return 0.0f;
}


__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) {

p_R = lin_to_gamma(protune_to_linear(p_R));
p_G = lin_to_gamma(protune_to_linear(p_G));
p_B = lin_to_gamma(protune_to_linear(p_B));

return make_float3(p_R,p_G,p_B);
}
19 changes: 19 additions & 0 deletions LUT/LogB400/Rec.709/GoPro_Protune-LogB400_Rec709_Rec709_Scene.dctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//GoPro Protune Input Transform for DaVinci YRGB workflow inside DaVinci Resolve

__DEVICE__ float protune_to_linear(float xV) {
return ((_powf(400.0f, xV) - 1.0f) / 399.0f);
}

__DEVICE__ float lin_to_rec(float x) {
if(x < .0018f) return 4.5f * x;
else return 1.099f * _powf(x,0.45f) - 0.099f;
}

__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) {

p_R = lin_to_rec(protune_to_linear(p_R));
p_G = lin_to_rec(protune_to_linear(p_G));
p_B = lin_to_rec(protune_to_linear(p_B));

return make_float3(p_R,p_G,p_B);
}
File renamed without changes.
78 changes: 53 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ The DCTL files contain ACES IDTs, ODTs and various Gamma/Gamut transforms.

Older instances of the transforms with the colour derived matrices are contained in the Legacy folder.

Installation can be done automatically by using the included Windows batch file and/or the *nix (Linux/Unix) shell script.

Manual installation details are listed in the sections below.


### LUT Folder
Save the non-ACES DCTL files in the LUT folder to the relevant location based on the host Operating System as noted below:
Expand Down Expand Up @@ -126,23 +130,27 @@ Not possible with current release.

The Protune Gamma curve is defined within the 0 - 1 range with the peak being equivalent to SDR Peak White. Despite this, the curve has a significantly higher Middle Gray value of 68% IRE. A significant portion of the curve is allocated to the lower code values under Middle Gray. This means that when footage is corrected using the transforms, anything under-exposed will be pushed further towards the shadows. To counteract this, the footage should either be exposed correctly, or under-exposed by 1-2 stops when recording and adjusted in accordingly after applying the transform.

### DaVinci YRGB Color Science

#### Usage in DaVinci CTL or via LUT Menu
Select the relevant dctl file via the LUT menu (or DaVinci CTL if using Resolve 16 or below). Ensure Input Color Space is set to Bypass (or Same as Timeline) for the relevant clip. Ensure the selected DCTL matches with the project's Timeline Color Space and Gamma. Input DRT should be set to None.


### ACES Color Science

### Usage as ACES IDT or ODT
#### Usage as ACES IDT or ODT

As of Resolve 17, the IDT can be loaded as an Input Transform via the Project settings and the ODT can also be loaded as an Output Transform via the Project settings.

As of Resolve 17.2, the IDT files can be selected as ACES Input Transforms for individual clips.


### Usage via ACES Transforms
#### Usage via ACES Transforms

The IDT and ODT can be used through Resolve's ACES Transforms OFX plugin


### Usage in DaVinci CTL or via LUT Menu
Select the relevant dctl file via the DaVinci CTL or LUT Menu. Ensure Input Color Space is set to Bypass (or Same as Timeline) for the relevant clip. Ensure the selected DCTL matches with the project's Timeline Color Space and Gamma. Input DRT should be set to None.


#### Usage in ACES via LUT Menu
To use in ACES via the LUT menu (or DaVinci CTL if using Resolve 16 or below), copy the IDT folder contents to the LUT folder and comment out the first few lines as follows:

```
Expand All @@ -151,6 +159,9 @@ To use in ACES via the LUT menu (or DaVinci CTL if using Resolve 16 or below), c
//#endif
```

Ensure Input Transform is set to None for each clip.



## Tutorials

Expand All @@ -160,14 +171,17 @@ To use in ACES via the LUT menu (or DaVinci CTL if using Resolve 16 or below), c



## ACEScc / ACEScct Input Transforms
## ACES Input Transforms

#### GoPro_Protune_Native_ACES_v2.dctl
IDT for ACES using Protune (FLAT) Gamma with Native Color Space - with CAT02 Chromatic Adaptation for use in DaVinci Resolve

#### GoPro_Protune_Rec709_ACES.dctl
IDT for ACES using Protune (FLAT) Gamma with Rec.709 (non-Native) Color Space - with CAT02 Chromatic Adaptation for use in DaVinci Resolve

#### GoPro_Protune-LogB400_Rec709_ACES.dctl
IDT for ACES using Protune (FLAT) LogB=400 Custom Gamma with Rec.709 (non-Native) Color Space - with CAT02 Chromatic Adaptation for use in DaVinci Resolve

#### GoPro_Protune_Native_Bradford-CA_ACES.dctl (Legacy)
Legacy IDT for ACES using Protune (FLAT) Gamma with Native Color Space - with Bradford Chromatic Adaptation (For test purposes only)

Expand All @@ -176,7 +190,7 @@ Legacy IDT for ACES using Protune (FLAT) Gamma with Rec.709 (non-Native) Color S



## ACEScc / ACEScct Output Transforms
## ACES Output Transforms

#### Protune Native ODT - CSC.dctl
ODT for ACES with output to Protune (FLAT) Gamma with Native Color Space - with CAT02 Chromatic Adaptation for use in DaVinci Resolve
Expand All @@ -185,58 +199,72 @@ ODT for ACES with output to Protune (FLAT) Gamma with Native Color Space - with

## DaVinci Intermediate Transforms

### Native Color Gamut

#### GoPro_Protune_Native_DWG_DaVinci-Intermediate_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to DaVinci Wide Gamut and DaVinci Intermediate

#### GoPro_Protune_Native_Rec2020_DaVinci-Intermediate_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to Rec.2020 and DaVinci Intermediate

### Rec.709 Color Gamut

#### GoPro_Protune_Rec709_DWG_DaVinci-Intermediate.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Rec.709 Color Space - output to DaVinci Wide Gamut and DaVinci Intermediate

#### GoPro_Protune_Rec709_Rec2020_DaVinci-Intermediate.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Rec.709 Color Space - output to Rec.2020 and DaVinci Intermediate

#### GoPro_Protune-LogB400_Rec709_DWG_DaVinci-Intermediate.dctl
Input Transform for YRGB using Protune (FLAT) LogB=400 Custom Gamma with Rec.709 Color Space - output to DaVinci Wide Gamut and DaVinci Intermediate

#### GoPro_Protune-LogB400_Rec709_Rec2020_DaVinci-Intermediate.dctl
Input Transform for YRGB using Protune (FLAT) LogB=400 Custom Gamma with Rec.709 Color Space - output to Rec.2020 and DaVinci Intermediate


## Other DaVinci YRGB Transforms

### Native Color Gamut

#### GoPro_Protune_Native_Rec709_Scene_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to Rec.709 Scene

#### GoPro_Protune_Rec709_Rec709_Scene.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Rec.709 Color Space - output to Rec.709 Scene

#### GoPro_Protune_Native_Rec709_Gamma-2.2_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to Rec.709 Gamma 2.2

#### GoPro_Protune_Rec709_Rec709_Gamma-2.2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Rec.709 Color Space - output to Rec.709 Gamma 2.2

#### GoPro_Protune_Native_Rec709_Gamma-2.4_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to Rec.709 Gamma 2.4

#### GoPro_Protune_Native_Rec709_Gamma-2.6_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to Rec.709 Gamma 2.6

#### GoPro_Protune_Native_P3-D65_Scene_v2_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to P3-D65 Scene


### Rec.709 Color Gamut

#### GoPro_Protune_Rec709_Rec709_Scene.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Rec.709 Color Space - output to Rec.709 Scene

#### GoPro_Protune_Rec709_Rec709_Gamma-2.2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Rec.709 Color Space - output to Rec.709 Gamma 2.2

#### GoPro_Protune_Rec709_Rec709_Gamma-2.4.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Rec.709 Color Space - output to Rec.709 Gamma 2.4

#### GoPro_Protune_Rec709_Rec709_Gamma-2.6.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Rec.709 Color Space - output to Rec.709 Gamma 2.6

#### GoPro_Protune_Native_P3-D65_Scene_v2_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to P3-D65 Scene

#### GoPro_Protune_Native_P3-D65_Gamma-2.2_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to P3-D65 Gamma 2.2
#### GoPro_Protune-LogB400_Rec709_Rec709_Scene.dctl
Input Transform for YRGB using Protune (FLAT) LogB=400 Custom Gamma with Rec.709 Color Space - output to Rec.709 Scene

#### GoPro_Protune_Native_P3-D65_Gamma-2.4_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to P3-D65 Gamma 2.4
#### GoPro_Protune-LogB400_Rec709_Rec709_Gamma-2.2.dctl
Input Transform for YRGB using Protune (FLAT) LogB=400 Custom Gamma with Rec.709 Color Space - output to Rec.709 Gamma 2.2

#### GoPro_Protune_Native_P3-D65_Gamma-2.6_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to P3-D65 Gamma 2.6
#### GoPro_Protune-LogB400_Rec709_Rec709_Gamma-2.4.dctl
Input Transform for YRGB using Protune (FLAT) LogB=400 Custom Gamma with Rec.709 Color Space - output to Rec.709 Gamma 2.4

#### GoPro_Protune_Native_DCI-P3_Gamma-2.6_v2.dctl
Input Transform for YRGB using Protune (FLAT) Gamma with Native Color Space - output to DCI-P3 Gamma 2.6
#### GoPro_Protune-LogB400_Rec709_Rec709_Gamma-2.6.dctl
Input Transform for YRGB using Protune (FLAT) LogB=400 Custom Gamma with Rec.709 Color Space - output to Rec.709 Gamma 2.6

0 comments on commit 5de9649

Please sign in to comment.