ARRI Wide Gamut 4 / LogC4

ARRI Wide Gamut 4 (AWG4) and LogC4 define the gamut and the transfer function respectively.

Fig. 1: ARRI Wide Gamut 4 / LogC4 — CIE 1931 xy.
Fig. 2: ARRI Wide Gamut 4 / LogC4 encoding curve, L = 0.18 × 2^stops.
xy
Red0.73470.2653
Green0.14240.8576
Blue0.0991-0.0308
White (D65)0.31270.3290

A code value of 1.0 corresponds to a linear value of 469.8. The curve is designed for 12-bit as its minimum quantisation depth; the ARRI specification states that 10-bit LogC4 images should not be used for archival or interchange.

Transfer function

CurveARRI-log-C-4
Black / white point (10-bit code values)95 / 437
Linear 0 → code0.0929
18% grey → code0.2784
Linear 1.0 → code0.4275

Encoding: convertFromLinear

vec4 convertFromLinear(vec4 val, int clip)
{
    // "Encoding Function" per 20220501_LogC_Specification.pdf
    const float a = (pow(2.0,18.0) - 16.0) / 117.45;
    const float b = (1023.0 - 95.0) / 1023.0;
    const float b14 = b / 14.0;
    const float c = 95.0 / 1023.0;
    const float s = (7.0 * log(2.0) * pow(2.0, 7.0 - 14.0 * c / b)) / (a * b);
    const float t = (pow(2.0,-c/b14+6.0) - 64.0) / a;

    vec3 q = a * val.rgb + 64.0;

    return vec4
    (
	(val.r >= t) ? (log2(q.r) - 6.0) * b14 + c : (val.r - t) / s,
	(val.g >= t) ? (log2(q.g) - 6.0) * b14 + c : (val.g - t) / s,
	(val.b >= t) ? (log2(q.b) - 6.0) * b14 + c : (val.b - t) / s,
	val.a
    );
}

Decoding: convertToLinear

vec4 convertToLinear(vec4 val)
{
    // "Decoding Function" per 20220501_LogC_Specification.pdf
    const float a = (pow(2.0,18.0) - 16.0) / 117.45;
    const float b = (1023.0 - 95.0) / 1023.0;
    const float b14 = b / 14.0;
    const float c = 95.0 / 1023.0;
    const float s = (7.0 * log(2.0) * pow(2.0, 7.0 - 14.0 * c / b)) / (a * b);
    const float t = (pow(2.0,-c/b14+6.0) - 64.0) / a;

    vec3 p = (val.rgb - c) / b14 + 6.0;

    return vec4
    (
	(val.r >= 0.0) ? (pow(2.0, p.r) - 64.0) / a : val.r * s + t,
	(val.g >= 0.0) ? (pow(2.0, p.g) - 64.0) / a : val.g * s + t,
	(val.b >= 0.0) ? (pow(2.0, p.b) - 64.0) / a : val.b * s + t,
	val.a
    );
}

Matrices

RGB → XYZ
[ 0.704858320407 0.129760295170 0.115837311474 ]
[ 0.254524176404 0.781477732712 -0.036001909116 ]
[ 0.000000000000 0.000000000000 1.089057750760 ]
XYZ → RGB
[ 1.509215472242 -0.250597345204 -0.168811475294 ]
[ -0.491545451661 1.361245545929 0.097282942014 ]
[ 0.000000000000 0.000000000000 0.918224951158 ]

Use this space Gamut compare ↗ Transfer compare ↗

Sources

  1. ARRI: ARRI LogC4 Logarithmic Color Space Specification (2023-05, PDF)
  2. ACES reference implementation: CSC.Arri.LogCv4_to_ACES.ctl