Blackmagic Film Gen 5

图 1:Blackmagic Film Gen 5 — CIE 1931 xy。
图 2:Blackmagic Film Gen 5 编码曲线,L = 0.18 × 2^stops。
xy
Red0.71770.3171
Green0.22800.8616
Blue0.1006-0.0820
White (D65)0.31270.3290

传递函数

曲线BMD Film Gen5
黑点 / 白点(10-bit 码值)145 / 529
线性 0 → 编码0.0925
18% 灰 → 编码0.3836
线性 1.0 → 编码0.5305

编码:convertFromLinear

vec4 convertFromLinear(vec4 val, int clip)
{
	const float lin_cut = 0.005;
	const float a = 0.08692876065491224;
	const float b = 0.005494072432257808;
	const float c = 0.5300133392291939;
	const float d = 8.283605932402494;
	const float e = 0.09246575342465753;

	vec3 P = val.rgb;

	P.r = P.r > lin_cut ? a * log(P.r + b) + c : d * P.r + e;
	P.g = P.g > lin_cut ? a * log(P.g + b) + c : d * P.g + e;
	P.b = P.b > lin_cut ? a * log(P.b + b) + c : d * P.b + e;
	
    return vec4(P,val.a);
}

解码:convertToLinear

vec4 convertToLinear(vec4 val)
{
	const float lin_cut = 0.005;
	const float a = 0.08692876065491224;
	const float b = 0.005494072432257808;
	const float c = 0.5300133392291939;
	const float d = 8.283605932402494;
	const float e = 0.09246575342465753;
	const float log_cut = d*lin_cut + e;

	vec3 P = val.rgb;

	P.r = P.r > log_cut ? exp((P.r - c) / a) - b : (P.r - e) / d;
	P.g = P.g > log_cut ? exp((P.g - c) / a) - b : (P.g - e) / d;
	P.b = P.b > log_cut ? exp((P.b - c) / a) - b : (P.b - e) / d;

    return vec4(P,val.a);
}

RGB → XYZ 矩阵

RGB → XYZ
[ 0.606530871498 0.220408142075 0.123479032143 ]
[ 0.267989356475 0.832731055201 -0.100720411676 ]
[ -0.029442507772 -0.086610625332 1.204862394237 ]

用这个空间 色域比对 ↗ 传递函数比对 ↗