This file is indexed.

/usr/share/radiance/xyz_srgb.cal is in radiance-materials 4R1+20120125-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
{ RCSid $Id: xyz_srgb.cal,v 1.2 2005/04/28 17:20:34 greg Exp $ }
{
        Convert between XYZ and RGB coordinates.

        2/17/95

        Be sure that CIE_x_r, etc. definitions are consistent with
        those in ray/src/common/color.h.
}

{*** The whole calculation is based on the CIE (x,y) chromaticities below ***}

CIE_x_r                :.640;		{ CCIR709 primaries }
CIE_y_r                :.330;
CIE_x_g                :.300;
CIE_y_g                :.600;
CIE_x_b                :0.150;
CIE_y_b                :0.060;

CIE_x_w:.3127;	{ Illuminant D65 }
CIE_y_w:.3290;

WHTEFFICACY :   179. ;          { luminous efficacy of uniform white light }

{ Derived constants }

CIE_D :         CIE_x_r*(CIE_y_g - CIE_y_b) +
                                CIE_x_g*(CIE_y_b - CIE_y_r) +
                                CIE_x_b*(CIE_y_r - CIE_y_g) ;

CIE_C_rD :      (1./CIE_y_w) *  ( CIE_x_w*(CIE_y_g - CIE_y_b) -
                                  CIE_y_w*(CIE_x_g - CIE_x_b) +
                                  CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g     ) ;

CIE_C_gD :      (1./CIE_y_w) *  ( CIE_x_w*(CIE_y_b - CIE_y_r) -
                                  CIE_y_w*(CIE_x_b - CIE_x_r) -
                                  CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r     ) ;

CIE_C_bD :      (1./CIE_y_w) *  ( CIE_x_w*(CIE_y_r - CIE_y_g) -
                                  CIE_y_w*(CIE_x_r - CIE_x_g) +
                                  CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r     ) ;

{ Convert CIE XYZ coordinates to RGB }

XYZ2RGB(i,j) : select(i*3+j+1,
        (CIE_y_g - CIE_y_b - CIE_x_b*CIE_y_g + CIE_y_b*CIE_x_g)/CIE_C_rD,
        (CIE_x_b - CIE_x_g - CIE_x_b*CIE_y_g + CIE_x_g*CIE_y_b)/CIE_C_rD,
        (CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g)/CIE_C_rD,
        (CIE_y_b - CIE_y_r - CIE_y_b*CIE_x_r + CIE_y_r*CIE_x_b)/CIE_C_gD,
        (CIE_x_r - CIE_x_b - CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r)/CIE_C_gD,
        (CIE_x_b*CIE_y_r - CIE_x_r*CIE_y_b)/CIE_C_gD,
        (CIE_y_r - CIE_y_g - CIE_y_r*CIE_x_g + CIE_y_g*CIE_x_r)/CIE_C_bD,
        (CIE_x_g - CIE_x_r - CIE_x_g*CIE_y_r + CIE_x_r*CIE_y_g)/CIE_C_bD,
        (CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r)/CIE_C_bD
);

{ noneg(x) : if(x, x, 0); }
noneg(x) : x;

R(X,Y,Z) :      noneg(XYZ2RGB(0,0)*X + XYZ2RGB(0,1)*Y + XYZ2RGB(0,2)*Z);
G(X,Y,Z) :      noneg(XYZ2RGB(1,0)*X + XYZ2RGB(1,1)*Y + XYZ2RGB(1,2)*Z);
B(X,Y,Z) :      noneg(XYZ2RGB(2,0)*X + XYZ2RGB(2,1)*Y + XYZ2RGB(2,2)*Z);

{ Convert RGB to CIE XYZ coordinates }

RGB2XYZ(i,j) : select(i*3+j+1,
        CIE_x_r*CIE_C_rD/CIE_D,CIE_x_g*CIE_C_gD/CIE_D,CIE_x_b*CIE_C_bD/CIE_D,
        CIE_y_r*CIE_C_rD/CIE_D,CIE_y_g*CIE_C_gD/CIE_D,CIE_y_b*CIE_C_bD/CIE_D,
        (1.-CIE_x_r-CIE_y_r)*CIE_C_rD/CIE_D,
        (1.-CIE_x_g-CIE_y_g)*CIE_C_gD/CIE_D,
        (1.-CIE_x_b-CIE_y_b)*CIE_C_bD/CIE_D
);

X(R,G,B) :      RGB2XYZ(0,0)*R + RGB2XYZ(0,1)*G + RGB2XYZ(0,2)*B;
Y(R,G,B) :      RGB2XYZ(1,0)*R + RGB2XYZ(1,1)*G + RGB2XYZ(1,2)*B;
Z(R,G,B) :      RGB2XYZ(2,0)*R + RGB2XYZ(2,1)*G + RGB2XYZ(2,2)*B;

{ Convert spectral radiance in watts/sr/m^2 to luminance in cd/m^2 }

luminance(r,g,b) = WHTEFFICACY * Y(r,g,b) ;