1 /*
2  *  This file is part of RawTherapee.
3  *
4  *  Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
5  *
6  *  RawTherapee is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  RawTherapee is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with RawTherapee.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef _ICCMATRICES_
20 #define _ICCMATRICES_
21 
22 // Bradford transform between illuminants
23 const double d65_d50[3][3] =  {{0.9555766, -0.0230393,  0.0631636},
24     { -0.0282895,  1.0099416,  0.0210077},
25     {0.0122982, -0.0204830,  1.3299098}
26 };
27 
28 const double d50_d65[3][3] =  {{ 1.0478112,  0.0228866, -0.0501270},
29     {0.0295424,  0.9904844, -0.0170491},
30     { -0.0092345,  0.0150436,  0.7521316}
31 };
32 
33 // Color space conversion to/from XYZ; color spaces adapted to D65
34 const double xyz_sRGBd65[3][3] = {{0.4124564,  0.3575761,  0.1804375},
35     {0.2126729,  0.7151522,  0.0721750},   // WARNING: the summ of this line is > 1.0
36     {0.0193339,  0.1191920,  0.9503041}
37 };
38 
39 const double sRGBd65_xyz[3][3] = {{ 3.2404542, -1.5371385, -0.4985314},
40     { -0.9692660,  1.8760108,  0.0415560},
41     {0.0556434, -0.2040259,  1.0572252}
42 };
43 
44 //%%%%%%%%%%%%%%%%%%%%%%%%
45 //    TEST using Gabor's matrices
46 /*const double xyz_sRGB[3][3] = {{0.435859,   0.385336, 0.143023},
47     {0.222385,   0.717021,  0.0605936 },
48     {0.0139162,   0.0971389,  0.713817}};
49 
50 const double sRGB_xyz[3][3] = {{3.13593293538656,        -1.61878246026431,        -0.490913888760734},
51     {-0.978702373022194,        1.91609508555177,        0.0334453372795315},
52     {0.0720490013929888,       -0.22919049060526,       1.40593851447263}};*/
53 //%%%%%%%%%%%%%%%%%%%%%%%%
54 
55 
56 // Color space conversion to/from XYZ; color spaces adapted to D50 using Bradford transform
57 const double xyz_sRGB[3][3] = {{0.4360747,  0.3850649,  0.1430804},
58     {0.2225045,  0.7168786,  0.0606169},
59     {0.0139322,  0.0971045,  0.7141733}
60 };
61 
62 const double sRGB_xyz[3][3] = {{3.1338561, -1.6168667, -0.4906146},
63     { -0.9787684,  1.9161415,  0.0334540},
64     {0.0719453, -0.2289914,  1.4052427}
65 };
66 
67 const double xyz_adobe[3][3] =    {{0.6097559,  0.2052401,  0.1492240},
68     {0.3111242,  0.6256560,  0.0632197},
69     {0.0194811,  0.0608902,  0.7448387}
70 };
71 
72 const double adobe_xyz[3][3] =    {{1.9624274, -0.6105343, -0.3413404},
73     { -0.9787684,  1.9161415,  0.0334540},
74     {0.0286869, -0.1406752,  1.3487655}
75 };
76 
77 const double xyz_prophoto[3][3] = {{0.7976749,  0.1351917,  0.0313534},
78     {0.2880402,  0.7118741,  0.0000857},
79     {0.0000000,  0.0000000,  0.8252100}
80 };
81 
82 const double prophoto_xyz[3][3] = {{1.3459433, -0.2556075, -0.0511118},
83     { -0.5445989,  1.5081673,  0.0205351},
84     {0.0000000,  0.0000000,  1.2118128}
85 };
86 
87 const double xyz_widegamut[3][3] = {{0.7161046,  0.1009296,  0.1471858},
88     {0.2581874,  0.7249378,  0.0168748},
89     {0.0000000,  0.0517813,  0.7734287}
90 };
91 
92 const double widegamut_xyz[3][3] = {{ 1.4628067, -0.1840623, -0.2743606},
93     { -0.5217933,  1.4472381,  0.0677227},
94     {0.0349342, -0.0968930,  1.2884099}
95 };
96 
97 const double xyz_bruce[3][3] = {{0.4941816,  0.3204834,  0.1495550},
98     {0.2521531,  0.6844869,  0.0633600},
99     {0.0157886,  0.0629304,  0.7464909}
100 };
101 
102 const double bruce_xyz[3][3] = {{2.6502856, -1.2014485, -0.4289936},
103     { -0.9787684,  1.9161415,  0.0334540},
104     {0.0264570, -0.1361227,  1.3458542}
105 };
106 
107 const double xyz_beta[3][3] = {{0.6712537,  0.1745834,  0.1183829},
108     {0.3032726,  0.6637861,  0.0329413},
109     {0.0000000,  0.0407010,  0.7845090}
110 };
111 
112 const double beta_xyz[3][3] = {{1.6832270, -0.4282363, -0.2360185},
113     { -0.7710229,  1.7065571,  0.0446900},
114     {0.0400013, -0.0885376,  1.2723640}
115 };
116 
117 const double xyz_best[3][3] = {{0.6326696,  0.2045558,  0.1269946},
118     {0.2284569,  0.7373523,  0.0341908},
119     {0.0000000,  0.0095142,  0.8156958}
120 };
121 
122 const double best_xyz[3][3] = {{1.7552599, -0.4836786, -0.2530000},
123     { -0.5441336,  1.5068789,  0.0215528},
124     {0.0063467, -0.0175761,  1.2256959}
125 };
126 
127 
128 /*const double sRGB_d50[3][3] = {{0.4360520246092,  0.2224915978656,    0.0139291219896},
129                                {0.38508159282,    0.716886060114,     0.09709700166},
130                                {0.1430874138552,  0.0606214863936,    0.714185469944}};
131 
132 const double d50_sRGB[3][3] = {{3.13405134405167,-0.978762729953942,  0.0719425766617001},
133                                {-1.61702771153574,1.91614222810656,  -0.228971178679309},
134                                {-0.49065220876631,0.0334496273068589, 1.40521830559074}};*/
135 
136 /*
137 // Gabor's matrices
138 const double sRGB_d50[3][3] = {{0.435859,   0.222385,   0.0139162},
139                                 {0.385336,   0.717021,   0.0971389},
140                                 {0.143023,   0.0605936,  0.713817}};
141 
142 const double d50_sRGB[3][3] = {{3.13593293538656,        -0.978702373022194,        0.0720490013929888},
143                                 {-1.61878246026431,        1.91609508555177,        -0.22919049060526},
144                                 {-0.490913888760734,       0.0334453372795315,       1.40593851447263}};
145 
146 const double adobe_d50[3][3] =    {{0.6097395054954,  0.3111142944042,    0.0194773131652},
147                                    {0.2052518325737,  0.6256618480686,    0.0608872306106},
148                                    {0.1492308013399,  0.0632241329247,    0.744846530711}};
149 const double d50_adobe[3][3] =    {{1.9624959949628,  -0.978762712052774,  0.0286904764959749},
150                                    {-0.610587687828765,1.91614073756734,  -0.140667763143042},
151                                    {-0.34136021627766, 0.0334501217627688, 1.34875045144924}};
152 const double prophoto_d50[3][3] = {{0.797675, 0.288040,   0.000000},
153                                    {0.135192, 0.711874,   0.000000},
154                                    {0.0313534,0.000086,   0.825210}};
155 const double d50_prophoto[3][3] = {{1.34594335079331,    -0.544598514291158,  0},
156                                    {-0.255608118122657,   1.50816768465213,   0},
157                                    {-0.0511117387775285,  0.0205345459181255, 1.21181275069376}};
158 const double widegamut_d50[3][3] = {{0.716105,  0.258187,   0.000000},
159                                     {0.100930,  0.724938,   0.0517813},
160                                     {0.147186,  0.0168748,  0.773429}};
161 const double d50_widegamut[3][3] = {{1.46280597103052,  -0.521792197260068, 0.0349341417298585},
162                                     {-0.184062984909417, 1.44723786022891, -0.0968930022172314},
163                                     {-0.27436071519732,  0.0677226440980744,1.28840945122198}};
164 const double bruce_d50[3][3] = {{0.4941607255908,   0.2521412970174,    0.0157852934504},
165                                 {0.3204990468435,   0.684494580042,     0.062927176507},
166                                 {0.1495612990809,   0.0633643619597,    0.746498914581}};
167 const double d50_bruce[3][3] = {{2.65042308164152, -0.978762745761462,  0.0264609493245811},
168                                 {-1.20155941925411, 1.9161402914007,   -0.136115844662896},
169                                 {-0.42902228923717, 0.0334495071197919, 1.34583900936772}};
170 const double beta_d50[3][3] = {{0.671254,   0.303273,   0.000000},
171                                {0.174583,   0.663786,   0.040701},
172                                {0.118383,   0.0329413,  0.784509}};
173 const double d50_beta[3][3] = {{1.68322591962771,   -0.771023599950842, 0.0400013658754702},
174                                {-0.428235060337656,  1.70655704781303, -0.0885376438040078},
175                                {-0.236018598193503,  0.0446902191738489,1.27236406897742}};
176 const double best_d50[3][3] = {{0.632670,   0.228457,   0.000000},
177                                {0.204556,   0.737352,   0.00951424},
178                                {0.126995,   0.0341908,  0.815696}};
179 const double d50_best[3][3] = {{1.75525923340349,   -0.544133953997468, 0.00634675299435191},
180                                {-0.483679025800866,  1.50687975713407, -0.017576175021718},
181                                {-0.253000840399762,  0.0215532098817316,1.22569552576991}};
182  */
183 #endif
184