Xiaomi Mi-Log / Rec.2020

Fig. 1: Xiaomi Mi-Log / Rec.2020 — CIE 1931 xy.
Fig. 2: Xiaomi Mi-Log / Rec.2020 encoding curve, L = 0.18 × 2^stops.
xy
Red0.70800.2920
Green0.17000.7970
Blue0.13100.0460
White (D65)0.31270.3290

Primaries, white point and luma coefficients (Y = 0.2627R + 0.6780G + 0.0593B) follow Section 4 of the white paper / BT.2020-2; chromaticity coordinates use the CIE 1931 2° observer.

Encoding has three segments: for R ≥ 0.01974185, P = 0.09271529·log₂(R + 0.01384578) + 0.67291850; for −0.09023729 ≤ R < 0.01974185, P = 18.10531998·(R + 0.09023729)²; for R < −0.09023729, P = 0. 18% grey → 0.45345968 (463 in 10-bit full range).

Transfer function

CurveMi-Log
Black / white point (10-bit code values)0 / 1023
Linear 0 → code0.1474
18% grey → code0.4535
Linear 1.0 → code0.6748

Encoding: convertFromLinear

vec4 convertFromLinear(vec4 val, int clip)
{
    float R0 = -0.09023729;
    float Rt = 0.01974185;
    float c  = 18.10531998;
    float g  = 0.09271529;
    float b  = 0.01384578;
    float d  = 0.67291850;

    vec3 P = val.rgb;
    P.r = P.r >= Rt ? g*log2(P.r+b)+d : (P.r >= R0 ? c*(P.r-R0)*(P.r-R0) : 0.0);
    P.g = P.g >= Rt ? g*log2(P.g+b)+d : (P.g >= R0 ? c*(P.g-R0)*(P.g-R0) : 0.0);
    P.b = P.b >= Rt ? g*log2(P.b+b)+d : (P.b >= R0 ? c*(P.b-R0)*(P.b-R0) : 0.0);
    return vec4(P, val.a);
}

Decoding: convertToLinear

vec4 convertToLinear(vec4 val, int clip)
{
    float R0 = -0.09023729;
    float Rt = 0.01974185;
    float c  = 18.10531998;
    float g  = 0.09271529;
    float b  = 0.01384578;
    float d  = 0.67291850;
    float Pt = c*(Rt-R0)*(Rt-R0);

    vec3 R = val.rgb;
    R.r = R.r >= Pt ? exp2((R.r-d)/g)-b : (R.r >= 0.0 ? sqrt(R.r/c)+R0 : R0);
    R.g = R.g >= Pt ? exp2((R.g-d)/g)-b : (R.g >= 0.0 ? sqrt(R.g/c)+R0 : R0);
    R.b = R.b >= Pt ? exp2((R.b-d)/g)-b : (R.b >= 0.0 ? sqrt(R.b/c)+R0 : R0);
    return vec4(R, val.a);
}

RGB → XYZ matrix

RGB → XYZ
[ 0.636958048301 0.144616903586 0.168880975164 ]
[ 0.262700212011 0.677998071519 0.059301716470 ]
[ 0.000000000000 0.028072693049 1.060985057711 ]

Use this space Gamut compare ↗ Transfer compare ↗

Sources

  1. Xiaomi: Xiaomi Log Profile White Paper (2024-12, PDF inside ZIP; official Mi-Log ACES package)