Fujifilm F-Log in Resolve without an IDT

I generated the FLog DCTL with the tool and piped in the numbers from the FLog2 paper.
I do not have access to proper test material for it so can’t claim it’s working as intended.

I also noticed a typo in the comment line at the top of the tool stating “ACES DIT” instead of “ACES IDT” :slight_smile: if he reads this, could be nice to correct it.

// ACES IDT FujiFGamut(Rec.2020) - F-Log2 to AP0 - Linear
DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0)

__DEVICE__ inline float Log_to_linear(float inv)
{
  float outv;
  
if (inv > 0.100686685370811f)
{
 outv = (_powf(10.0f, (1.0f/0.245281f * inv - 0.384316f/0.245281f)) - 0.064829f) /5.555556f;
}
else
{
 outv = (inv - 0.092864f) /  8.799461f;
}
  return outv;
}

__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B)
{
  const float mtx[9] = {0.6788911506598102f,0.15886842237789234f,0.16224042703562752f, 0.04557083087232135f,0.8607127720474108f,0.0937163970408747f, -0.0004857103518124508f,0.025060195735059528f,0.9754255145687619f};

  float r1 = Log_to_linear(p_R);
  float g1 = Log_to_linear(p_G);
  float b1 = Log_to_linear(p_B);
  float r2 = r1 * mtx[0] + g1 * mtx[1] + b1 * mtx[2];
  float g2 = r1 * mtx[3] + g1 * mtx[4] + b1 * mtx[5];
  float b2 = r1 * mtx[6] + g1 * mtx[7] + b1 * mtx[8];

  return make_float3(r2, g2, b2);
}
1 Like