Xiaomi Mi-Log / Rec.2020
| x | y | |
|---|---|---|
| Red | 0.7080 | 0.2920 |
| Green | 0.1700 | 0.7970 |
| Blue | 0.1310 | 0.0460 |
| White (D65) | 0.3127 | 0.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
| Curve | Mi-Log |
|---|---|
| Black / white point (10-bit code values) | 0 / 1023 |
| Linear 0 → code | 0.1474 |
| 18% grey → code | 0.4535 |
| Linear 1.0 → code | 0.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 ↗