DJI D-Log grading

Needing to grade a D-Log footage in ACES, and never finding the appropriate IDT I use this trick:

I set the Resolve project to YRGB in order to view the footage as it is, without input transformation.

Then in a node, I sent it to 3D Lut Creator via plug in.

When in 3D Lut Creator I set the input Log to DJI D-Log ph4 Pro and the output Log to ACES cct, then pushing the apply button I was back in Resolve, and once set the project to ACES cct I was able to grade with a lot of dynamic without pass to the Rec.709 bottle neck.

I try to save the output lut from 3D Lut Creator and apply it in Resolve, but the results are not the same, they results burned and less dynamic.

The only way to have a preset is to save a still.

Does somebody have a better method?

1 Like
D-Log D-Gamut to ACES AP0 DCTL

// D-Log D-Gamut to ACES AP0 DCTL

typedef struct
{
float3 r0, r1, r2;
} mat3;

DEVICE mat3 make_mat3( float3 A, float3 B, float3 C);
DEVICE float3 mult_f3_f33 (float3 In, mat3 A);
DEVICE mat3 mult_f33_f33(mat3 A, mat3 B);
DEVICE float dlog_to_lin(float in);
DEVICE float3 dlog_to_lin3(float3 in);

DEVICE mat3 make_mat3( float3 A, float3 B, float3 C)
{
mat3 D;
D.r0 = A;
D.r1 = B;
D.r2 = C;
return D;
}

DEVICE float3 mult_f3_f33 (float3 In, mat3 A)
{
float out[3];
float in[3] = {In.x, In.y, In.z};
float a[3][3] = {{A.r0.x, A.r0.y, A.r0.z},
{A.r1.x, A.r1.y, A.r1.z},
{A.r2.x, A.r2.y, A.r2.z}};
for( int i = 0; i < 3; ++i)
{
out[i] = 0.0f;
for( int j = 0; j < 3; ++j)
{
out[i] = out[i] + in[j] * a[i][j];
}
}
return make_float3(out[0], out[1], out[2]);
}

DEVICE mat3 mult_f33_f33( mat3 A, mat3 B)
{
float m[3][3];
float a[3][3] = {{A.r0.x, A.r0.y, A.r0.z},
{A.r1.x, A.r1.y, A.r1.z},
{A.r2.x, A.r2.y, A.r2.z}};
float b[3][3] = {{B.r0.x, B.r0.y, B.r0.z},
{B.r1.x, B.r1.y, B.r1.z},
{B.r2.x, B.r2.y, B.r2.z}};

for( int i = 0; i < 3; ++i)
{
for( int j = 0; j < 3; ++j)
{
m[i][j] = 0.0f;
for( int k = 0; k < 3; ++k)
{
m[i][j] = m[i][j] + a[i][k] * b[k][j];
}
}
}
mat3 M = make_mat3(make_float3(m[0][0], m[0][1], m[0][2]),
make_float3(m[1][0], m[1][1], m[1][2]), make_float3(m[2][0], m[2][1], m[2][2]));
return M;
}

#define dgamut_to_xyz make_mat3(make_float3(0.6482f, 0.1940f, 0.1082f), make_float3(0.2830f, 0.8132f, -0.0962f), make_float3(-0.0183f, -0.0832f, 1.1903f))

#define xyz_to_acesAP0 make_mat3(make_float3(1.0498110175f, 0.0f, -0.0000974845f), make_float3(-0.4959030231f, 1.3733130458f, 0.0982400361f), make_float3(0.0f, 0.0f, 0.9912520182f))

#define dgamut_to_AP0 mult_f33_f33(dgamut_to_xyz, xyz_to_acesAP0)

DEVICE float dlog_to_lin( float in)
{
float out = in <= 0.14f ? (in - 0.0929f) / 6.025f : (_exp10f(3.89616 * in - 2.27752f) - 0.0108f) / 0.9892f;
return out;
}

DEVICE float3 dlog_to_lin3( float3 in)
{
float3 out;
out.x = dlog_to_lin(in.x);
out.y = dlog_to_lin(in.y);
out.z = dlog_to_lin(in.z);
return out;
}

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 rgb = make_float3(p_R, p_G, p_B);

rgb = dlog_to_lin3(rgb);

rgb = mult_f3_f33(rgb, dgamut_to_AP0);

return rgb;
}

You could try using a DCTL as an IDT (right-click on clip thumbnail, choose No Input Transform, then select the DCTL). Rename the attached file so that the suffix is .dctl (it won’t let me upload a file unless it has a more recognised suffix), then place it in the main LUT folder (or subfolder within that). This way you can at least stay in ACES and not have to switch to YRGB.

I haven’t tested it extensively, so there might be a question mark over the D-Gamut to ACES AP0 transform.

1 Like

@Paul_Dore I haven’t actually tested you code, or examined the numbers in detail, but I don’t see a white point adaptation in there. The matrix to convert from another colour space to AP0 is more than a concatenation of the to/from XYZ matrices. It needs to include an adaptation to ACES white, normally using either a Bradford matrix or CAT02.

Thanks Nick, you’re absolutely right (as usual). The absence of a white point adaptation was indeed the reason it was off.

D-Log D-Gamut to ACES AP0 DCTL

// D-Log D-Gamut to ACES AP0 DCTL

typedef struct
{
float3 r0, r1, r2;
} mat3;

DEVICE mat3 make_mat3( float3 A, float3 B, float3 C);
DEVICE float3 mult_f3_f33 (float3 In, mat3 A);
DEVICE float dlog_to_lin(float in);
DEVICE float3 dlog_to_lin3(float3 in);

DEVICE mat3 make_mat3( float3 A, float3 B, float3 C)
{
mat3 D;
D.r0 = A;
D.r1 = B;
D.r2 = C;
return D;
}

DEVICE float3 mult_f3_f33 (float3 In, mat3 A)
{
float out[3];
float in[3] = {In.x, In.y, In.z};
float a[3][3] = {{A.r0.x, A.r0.y, A.r0.z},
{A.r1.x, A.r1.y, A.r1.z},
{A.r2.x, A.r2.y, A.r2.z}};
for( int i = 0; i < 3; ++i)
{
out[i] = 0.0f;
for( int j = 0; j < 3; ++j)
{
out[i] = out[i] + in[j] * a[i][j];
}
}
return make_float3(out[0], out[1], out[2]);
}

#define dgamut_to_AP0 make_mat3(make_float3(0.691279f, 0.214383f, 0.094338f), make_float3(0.066222f, 1.011616f, -0.077838f), make_float3(-0.017299f, -0.077379f, 1.094677f))

DEVICE float dlog_to_lin( float in)
{
float out = in <= 0.14f ? (in - 0.0929f) / 6.025f : (_exp10f(3.89616 * in - 2.27752f) - 0.0108f) / 0.9892f;
return out;
}

DEVICE float3 dlog_to_lin3( float3 in)
{
float3 out;
out.x = dlog_to_lin(in.x);
out.y = dlog_to_lin(in.y);
out.z = dlog_to_lin(in.z);
return out;
}

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 rgb = make_float3(p_R, p_G, p_B);

rgb = dlog_to_lin3(rgb);

rgb = mult_f3_f33(rgb, dgamut_to_AP0);

return rgb;
}

I used an online Color Space Calculator to get the new matrix (including CAT 02).

ACES_DLog_DGamut.ctl (1.4 KB)

(Change the suffix to .dctl)

3 Likes

Thank you very much!

In addition - reloading the project I got the following error:

Error Processing DaVinci CTL
ACES_DLog_DGamut.dctl

So perhaps I’ve done something incorrect? I’m in Resolve 16.1.1 (Support updated us last night from 16) on OSX 10.13.6, if that helps.

Thank you again!

Can I ask a stupid question? I’ve set my clips to No Input Transform and then set the Input LUT to ACES_DLog_DGamut and I see no difference to my clips. Is that right? It’s not what I was expecting! Thanks!

What happens if you apply the DCTL on a node?

The same thing, unfortunately. I’ve been reading some other posts, and wonder if it’s to do with not using Cuda? I’ve AMD graphics cards.

I really like your plugins btw, the Film Grade one for Resolve is almost a standard for setting the contrast levels of a grade here. Thanks for all the work you do!

Have a look at your DaVinci Resolve log file for an indication as to why the DCTL is not working.

You’ll find the relevant file in this location:

/Library/Application Support/Blackmagic Design/DaVinci Resolve/logs/davinci_resolve.log

Thanks for you continued help, I will take a look when I’m back in on Monday.

Hey Michael,

Any luck with the CTL? I get the same error and I’m also on Resolve 16 (16.1.2.026) + AMDs.

Also, thank you @Paul_Dore for sharing it.

1 Like

Hi, here is my version of the IDT to ACES.

My coefficients are a little bit different from Paul’s as I found the chromatic adaption for DJI is not use CAT02, I use the same chromatic adaptation of the DJI and I tested on colorspace transformation to REC709 to check it.

I share it here.

IDT_DJI_DLog_DGamut

@tommyzenth Thank you for the IDT. Does it convert to AP0 or AP1?

edit: Don’t mind the question, I investigated the file and got my answer. Thanks again for the transform

Dear all,

Based on the information in this, more than a year old, thread: I guess that many of us today are using a DCTL-based IDT based on DJI’s White Paper from year 2017 (link earlier in this thread).

Lately, the VFX artists (ACEScg, i.e. Linear AP1) have complained that DJI Drone footage feels “contrasty”, not linearised equally, in comparison to ARRI footage.

Without having dug deeply into the VFX artists’ subjective perceptual experiences yet:

Question 1) Are there any experiences/tests available that are describing whether DJI’s drones, during the five years of new model releases, still are creating nearly identical D-Log & D-Gamut based footage?

Question 2) If there are evolutionary differences between the D-Log & D-Gamut based footage over the years, has anyone or DJI produced additional White Papers, hence additional IDTs?

Thanks in advance!

Kindly, Lars

1 Like

Good question. I’m just a simple online editor but every now and then I edit/grade assets that have some drone footage. Every time I think I have the proper conversion lut something feels off again. There are a lot of different DJI devices today and I’m never really sure if it’s shot in true D-Log/D-Gamut and even if it is the sensors seem to vary so much in quality that you just get vastly different results encoding to the same space. I wouldn’t be surprised if the way they transform their sensors to that space varies a lot due to continued improvements over the years when the encoding space itself never changed if that’s a sensible thing to say.

Curious to know more about this.

I am trying to decipher what is going on with the footage I received in DNG format from a DJI Inspire 2 Drone (X7), and I don’t seem to find the correct path. In fact, all the documentation is geared to colorists eyeballing things and of course, that is not good enough for VFX.

Is there anyone that can point me in the right direction? I want to convert the material to ACEScg to be but the current result looks wrong to me.

Thanks in advance.

1 Like

Can anyone consider making an DJI IDT for their D-Cinelook capture space, It’s not 709 and it’s not D-Log - So annoying.

Have they published any information about it? Otherwise it would have to be reverse engineered using the black box camera approach being worked on by the IDT VWG.

Alternatively, if it is possible to lock off a camera and shoot exactly the same images in both D-Log/D-Gamut and D-Cinelook, it would be possible to find the corresponding values, and fit a curve and matrix for an IDT based on that.

Lots of great info here as I was searching for how people are handling DJI footage in ACES. Outside of Resolve in a dailies situation utilizing software such as Colorfront EXD, I’m curious how people are handling there not being an IDT for any of these cameras. Anyone’s thoughts would be greatly appreciated thank you!