< Previous | Contents | Next >

About DCTL

DCTL files are actually color transformation scripts that DaVinci Resolve sees and applies just like any other LUT. Unlike other LUTs, which are 1D or 3D lookup tables of values that approximate image

transformations using interpolation, DCTL files are actually comprised of computer code that directly transforms images using combinations of math functions that you devise. Additionally, DCTL files run natively on the GPU of your workstation, so they can be fast.

Anyone with the mathematical know-how can make and install a DCTL. Simply enter your transformation code, using a syntax that’s similar to C (described in more detail below), into any text editor capable of saving a plain ASCII text file, and make sure its name ends with the “.dctl” (DaVinci Color Transform Language) file extension. Once that’s done, move the file to the LUT directory of your workstation. Where that is depends on which OS you’re using:

On Mac OS X: Library/Application Support/Blackmagic Design/DaVinci Resolve/LUT/

On Windows: C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT

On Linux: /home/resolve/LUT


When DaVinci Resolve starts up, assuming the syntax of your .dctl is correct, they appear in the Color page Node contextual menu within the DaVinci CTL submenu.


DCTL Syntax

Users need to put   DEVICE  in front of each function they write. For example:

  DEVICE  float2 DoSomething()


The main entry function (transform) should come after all other functions, with the following format argument:

  DEVICE  float3 transform(float p_R, float p_G, float p_B)


The main entry function must also have a float3 return value.

For the following floating point math functions, please use the described syntax:


float

_fabs(float)


//

Absolute Value

float

_powf(float x, float y


//

Compute x to the power of y

float

_logf(float)


//

Natural logarithm

float

_log2f(float)


//

Base 2 logarithm

float

_log10f(float)


//

Base 10 logarithm

float

_exp2f(float)


//

Exponential base 2

float

_expf(float)


//

Exponential base E

float

_copysignf(float x, float

y)

//

Return x with sign changed to sign y

float

_fmaxf(float x, float y)


//

Return y if x < y

float _fminf(float x, float y) // Return y if x > y


float _saturatef(float x, float minVal, float maxVal)

// Return min(max(x, minVal), maxVal)

float _sqrtf(float) // Square root

int _ceil(float // Round to integer toward + infinity

int _floor(float) // Round to integer toward - infinity float _fmod(float x, float y) // Modulus. Returns x – y * trunc(x / y) float _fremainder(float x, float y) // Floating point remainder

int _round(float x) // Integral value nearest to x rounding


float

_hypotf(float x,

float

y)

//

Square root of (x^2 + y^2)

float

_atan2f(float x)



//

Arc tangent of (y / x)

float

_sinf(float x)



//

Sine

float

_cosf(float x)



//

Cosine

float

_acosf(float x)



//

Arc cosine

float

_asinf(float x)



//

Arc sine

float

_fdivide(float x,

float

y)

//

Return (x / y)

float

_frecip(float x)



//

Return (1 / x)


The following functions support integer type:

min, max, abs, rotate


Other supported C Math functions include:

acosh, acospi, asinh, asinpi, atan, atanh, atanpi, atan2pi, cbrt, cosh, cospi, exp10, expm1, trunc, fdim, fma, lgamma, log1p, logb, rint, round, rsqrt, sincos, sinh, sinpi, tan, tanh, tanpi, tgamma


Vector types float2, float3, and float4 are supported. The data fields are:

float x float y float z float w


To generate a vector value, use make_floatN() where N = 2, 3, or 4.

Users can define their own structure using “typedef struct.” For example:

typedef struct

{

float c00, c01, c02; float c10, c11, c12;

} Matrix;