-
Notifications
You must be signed in to change notification settings - Fork 125
/
ODT.Academy.P3D60_48nits.ctl
96 lines (77 loc) · 2.76 KB
/
ODT.Academy.P3D60_48nits.ctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// <ACEStransformID>urn:ampas:aces:transformId:v1.5:ODT.Academy.P3D60_48nits.a1.0.3</ACEStransformID>
// <ACESuserName>ACES 1.0 Output - P3-D60</ACESuserName>
//
// Output Device Transform - P3D60
//
//
// Summary :
// This transform is intended for mapping OCES onto a P3 digital cinema
// projector that is calibrated to a D60 white point at 48 cd/m^2. The assumed
// observer adapted white is D60, and the viewing environment is that of a dark
// theater.
//
// Device Primaries :
// CIE 1931 chromaticities: x y Y
// Red: 0.68 0.32
// Green: 0.265 0.69
// Blue: 0.15 0.06
// White: 0.32168 0.33767 48 cd/m^2
//
// Display EOTF :
// Gamma: 2.6
//
// Assumed observer adapted white point:
// CIE 1931 chromaticities: x y
// 0.32168 0.33767
//
// Viewing Environment:
// Environment specified in SMPTE RP 431-2-2007
//
import "ACESlib.Utilities";
import "ACESlib.Transform_Common";
import "ACESlib.ODT_Common";
import "ACESlib.Tonescales";
/* --- ODT Parameters --- */
const Chromaticities DISPLAY_PRI = P3D60_PRI;
const float XYZ_2_DISPLAY_PRI_MAT[4][4] = XYZtoRGB( DISPLAY_PRI, 1.0);
const float DISPGAMMA = 2.6;
void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut
)
{
float oces[3] = { rIn, gIn, bIn};
// OCES to RGB rendering space
float rgbPre[3] = mult_f3_f44( oces, AP0_2_AP1_MAT);
// Apply the tonescale independently in rendering-space RGB
float rgbPost[3];
rgbPost[0] = segmented_spline_c9_fwd( rgbPre[0]);
rgbPost[1] = segmented_spline_c9_fwd( rgbPre[1]);
rgbPost[2] = segmented_spline_c9_fwd( rgbPre[2]);
// Scale luminance to linear code value
float linearCV[3];
linearCV[0] = Y_2_linCV( rgbPost[0], CINEMA_WHITE, CINEMA_BLACK);
linearCV[1] = Y_2_linCV( rgbPost[1], CINEMA_WHITE, CINEMA_BLACK);
linearCV[2] = Y_2_linCV( rgbPost[2], CINEMA_WHITE, CINEMA_BLACK);
// Convert to display primary encoding
// Rendering space RGB to XYZ
float XYZ[3] = mult_f3_f44( linearCV, AP1_2_XYZ_MAT);
// CIE XYZ to display primaries
linearCV = mult_f3_f44( XYZ, XYZ_2_DISPLAY_PRI_MAT);
// Handle out-of-gamut values
// Clip values < 0 or > 1 (i.e. projecting outside the display primaries)
linearCV = clamp_f3( linearCV, 0., 1.);
// Encode linear code values with transfer function
float outputCV[3] = pow_f3( linearCV, 1./ DISPGAMMA);
rOut = outputCV[0];
gOut = outputCV[1];
bOut = outputCV[2];
aOut = aIn;
}