Blackmagic Film Gen 5

Fig. 1: Blackmagic Film Gen 5 — CIE 1931 xy.
Fig. 2: Blackmagic Film Gen 5 encoding curve, L = 0.18 × 2^stops.
xy
Red0.71770.3171
Green0.22800.8616
Blue0.1006-0.0820
White (D65)0.31270.3290

Transfer function

CurveBMD Film Gen5
Black / white point (10-bit code values)145 / 529
Linear 0 → code0.0925
18% grey → code0.3836
Linear 1.0 → code0.5305

Encoding: 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);
}

Decoding: 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 matrix

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

Use this space Gamut compare ↗ Transfer compare ↗