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 |
原色、白点与亮度系数(Y = 0.2627R + 0.6780G + 0.0593B)均按白皮书第 4 节 / BT.2020-2;色度坐标使用 CIE 1931 2° 观察者。
编码分三段:R ≥ 0.01974185 时 P = 0.09271529·log₂(R + 0.01384578) + 0.67291850;−0.09023729 ≤ R < 0.01974185 时 P = 18.10531998·(R + 0.09023729)²;R < −0.09023729 时 P = 0。18% 灰 → 0.45345968(10-bit 全范围 463)。
传递函数
| 曲线 | Mi-Log |
|---|---|
| 黑点 / 白点(10-bit 码值) | 0 / 1023 |
| 线性 0 → 编码 | 0.1474 |
| 18% 灰 → 编码 | 0.4535 |
| 线性 1.0 → 编码 | 0.6748 |
编码: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);
}解码: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 矩阵
RGB → XYZ [ 0.636958048301 0.144616903586 0.168880975164 ] [ 0.262700212011 0.677998071519 0.059301716470 ] [ 0.000000000000 0.028072693049 1.060985057711 ]