"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "rtengine/colortemp.cc" between
rawtherapee-5.6.tar.xz and rawtherapee-5.7.tar.xz

About: RawTherapee is a powerful cross-platform raw image processing program.

colortemp.cc  (rawtherapee-5.6.tar.xz):colortemp.cc  (rawtherapee-5.7.tar.xz)
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* RawTherapee is distributed in the hope that it will be useful, * RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "colortemp.h" #include "colortemp.h"
#include "rtengine.h" #include "rtengine.h"
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "sleef.c" #include "sleef.c"
#include "settings.h" #include "settings.h"
namespace rtengine namespace rtengine
skipping to change at line 1088 skipping to change at line 1088
gmul = sRGB_xyz[1][0]*X + sRGB_xyz[1][1]*Y + sRGB_xyz[1][2]*Z; gmul = sRGB_xyz[1][0]*X + sRGB_xyz[1][1]*Y + sRGB_xyz[1][2]*Z;
bmul = sRGB_xyz[2][0]*X + sRGB_xyz[2][1]*Y + sRGB_xyz[2][2]*Z; bmul = sRGB_xyz[2][0]*X + sRGB_xyz[2][1]*Y + sRGB_xyz[2][2]*Z;
} else {*/ } else {*/
//recalculate channels multipliers with new values of XYZ tue to whitebalanc e //recalculate channels multipliers with new values of XYZ tue to whitebalanc e
rmul = sRGBd65_xyz[0][0] * Xwb * adj + sRGBd65_xyz[0][1] + sRGBd65_xyz[0][2] * Zwb / adj; // Jacques' empirical modification 5/2013 rmul = sRGBd65_xyz[0][0] * Xwb * adj + sRGBd65_xyz[0][1] + sRGBd65_xyz[0][2] * Zwb / adj; // Jacques' empirical modification 5/2013
gmul = sRGBd65_xyz[1][0] * Xwb + sRGBd65_xyz[1][1] + sRGBd65_xyz[1][2] * Zwb; gmul = sRGBd65_xyz[1][0] * Xwb + sRGBd65_xyz[1][1] + sRGBd65_xyz[1][2] * Zwb;
bmul = sRGBd65_xyz[2][0] * Xwb * adj + sRGBd65_xyz[2][1] + sRGBd65_xyz[2][2] * Zwb / adj; bmul = sRGBd65_xyz[2][0] * Xwb * adj + sRGBd65_xyz[2][1] + sRGBd65_xyz[2][2] * Zwb / adj;
//}; //};
gmul /= green; gmul /= green;
//printf("rmul=%f gmul=%f bmul=%f\n",rmul, gmul, bmul); //printf("rmul=%f gmul=%f bmul=%f\n",rmul, gmul, bmul);
double max = rtengine::max(rmul, gmul, bmul); double maxRGB = rtengine::max(rmul, gmul, bmul);
rmul /= max; rmul /= maxRGB;
gmul /= max; gmul /= maxRGB;
bmul /= max; bmul /= maxRGB;
if(settings->CRI_color != 0) { //activate if CRi_color !=0 if(settings->CRI_color != 0) { //activate if CRi_color !=0
// begin CRI_RT : color rendering index RT - adaptation of CRI by J.Desm is // begin CRI_RT : color rendering index RT - adaptation of CRI by J.Desm is
// CRI = 100 for Blackbody and Daylight // CRI = 100 for Blackbody and Daylight
// calculate from spectral data values X, Y, Z , for color of colorche cker24 , SG, DC, JDC_468 // calculate from spectral data values X, Y, Z , for color of colorche cker24 , SG, DC, JDC_468
// only for lamp different of tungstene // only for lamp different of tungstene
// first calcul with illuminant (choice) // first calcul with illuminant (choice)
// and calcul with : blackbody at equivalent temp of lamp // and calcul with : blackbody at equivalent temp of lamp
// CRI_color-1 = display Lab values of color CRI_color -1 // CRI_color-1 = display Lab values of color CRI_color -1
const double whiteD50[3] = {0.9646019585, 1.0, 0.8244507152}; //calculat e with this tool : spect 5nm const double whiteD50[3] = {0.9646019585, 1.0, 0.8244507152}; //calculat e with this tool : spect 5nm
double CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22; //for CIECAT02
double Xchk[50], Ychk[50], Zchk[50]; //50 : I think it's a good limit fo r number of color : for CRI and Palette double Xchk[50], Ychk[50], Zchk[50]; //50 : I think it's a good limit fo r number of color : for CRI and Palette
double Xcam02[50], Ycam02[50], Zcam02[50]; double Xcam02[50], Ycam02[50], Zcam02[50];
double XchkLamp[50], YchkLamp[50], ZchkLamp[50]; double XchkLamp[50], YchkLamp[50], ZchkLamp[50];
double Xcam02Lamp[50], Ycam02Lamp[50], Zcam02Lamp[50]; double Xcam02Lamp[50], Ycam02Lamp[50], Zcam02Lamp[50];
const double epsilon = 0.008856; //Lab const double epsilon = 0.008856; //Lab
double xr[50], yr[50], zr[50]; double xr[50], yr[50], zr[50];
double fx[50], fy[50], fz[50];
double x, y, z;
double Ywb = 1.0;
int illum; int illum;
int numero_color = settings->CRI_color - 1; int numero_color = settings->CRI_color - 1;
//spectral data illuminant (actually 21): only those necessary (lamp, fl uorescent, LED) others CRI=100 (not Flash...) //spectral data illuminant (actually 21): only those necessary (lamp, fl uorescent, LED) others CRI=100 (not Flash...)
const double* spec_color[] = { const double* spec_color[] = {
ColorchechredC3_spect, ColorchechOraA2_spect, ColorchechYelD3_spect, ColorchechGreE2_spect, ColorchechGreB3_spect, ColorchechredC3_spect, ColorchechOraA2_spect, ColorchechYelD3_spect, ColorchechGreE2_spect, ColorchechGreB3_spect,
ColorchechCyaF3_spect, ColorchechPurD2_spect, ColorchechMagE3_spect, ColorchechSkiA138_13_14_spect, ColorchechGraC4_67_spect, ColorchechCyaF3_spect, ColorchechPurD2_spect, ColorchechMagE3_spect, ColorchechSkiA138_13_14_spect, ColorchechGraC4_67_spect,
ColorchechSkiB166_18_18_spect, ColorchechBluC150_m5_m22_spect, Color chechDCBluN881_m7_m14_spect, ColorchechSGSkiF763_14_26_spect, ColorchechSkiB166_18_18_spect, ColorchechBluC150_m5_m22_spect, Color chechDCBluN881_m7_m14_spect, ColorchechSGSkiF763_14_26_spect,
ColorchechSGSkiK285_11_17_spect, ColorchechWhiA496_spect, Colorchech GreD1_spect, ColorchechSGBlaN3_6_spect, ColorchechSGSkiK285_11_17_spect, ColorchechWhiA496_spect, Colorchech GreD1_spect, ColorchechSGBlaN3_6_spect,
skipping to change at line 1222 skipping to change at line 1218
illum = 20; illum = 20;
} else if (method == "LED CRS SP12 WWMR16") { } else if (method == "LED CRS SP12 WWMR16") {
CRI_type = true; CRI_type = true;
tempw = 3050; tempw = 3050;
illum = 21; illum = 21;
} else { } else {
CRI_type = false; CRI_type = false;
} }
if (CRI_type) { if (CRI_type) {
double x, y, z;
double Ywb = 1.0;
const double* spect_illum[] = { const double* spect_illum[] = {
Daylight5300_spect, Cloudy6200_spect, Shade7600_spect, A2856_spe ct, FluoF1_spect, FluoF2_spect, FluoF3_spect, Daylight5300_spect, Cloudy6200_spect, Shade7600_spect, A2856_spe ct, FluoF1_spect, FluoF2_spect, FluoF3_spect,
FluoF4_spect, FluoF5_spect, FluoF6_spect, FluoF7_spect, FluoF8_s pect, FluoF9_spect, FluoF10_spect, FluoF11_spect, FluoF4_spect, FluoF5_spect, FluoF6_spect, FluoF7_spect, FluoF8_s pect, FluoF9_spect, FluoF10_spect, FluoF11_spect,
FluoF12_spect, HMI_spect, GTI_spect, JudgeIII_spect, Solux3500_s pect, Solux4100_spect, Solux4700_spect, FluoF12_spect, HMI_spect, GTI_spect, JudgeIII_spect, Solux3500_s pect, Solux4100_spect, Solux4700_spect,
NG_Solux4700_spect, NG_CRSSP12WWMR16_spect, NG_CRSSP12WWMR16_spe ct NG_Solux4700_spect, NG_CRSSP12WWMR16_spect, NG_CRSSP12WWMR16_spe ct
}; };
float DeltaE[50], DeltaEs[8]; float DeltaE[50], DeltaEs[8];
float quadCRI = 0.0f, quadCRIs = 0.0f; float quadCRI = 0.0f, quadCRIs = 0.0f;
float CRI_RT = 0.0, CRI[50]; float CRI_RT = 0.0, CRI[50];
skipping to change at line 1280 skipping to change at line 1279
XYZtoCorColorTemp(Xwb, Ywb, Zwb, correl_temp); XYZtoCorColorTemp(Xwb, Ywb, Zwb, correl_temp);
printf("Correlated temperature (lamp)=%i\n", (int) correl_temp); //use only for lamp...otherwise It give an information!! printf("Correlated temperature (lamp)=%i\n", (int) correl_temp); //use only for lamp...otherwise It give an information!!
} }
double Xwb_bb = x / y; //white balance for blackbody double Xwb_bb = x / y; //white balance for blackbody
double Ywb_bb = 1.0; double Ywb_bb = 1.0;
double Zwb_bb = (1.0 - x - y) / y; double Zwb_bb = (1.0 - x - y) / y;
//calculate Matrix CAM02 : better than Von Kries and Bradford==> for Lamp //calculate Matrix CAM02 : better than Von Kries and Bradford==> for Lamp
double adap = 1.0; double adap = 1.0;
double CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02B B12, CAM02BB20, CAM02BB21, CAM02BB22; //for CIECAT02
cieCAT02(Xwb, Ywb, Zwb, CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22, adap); cieCAT02(Xwb, Ywb, Zwb, CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22, adap);
//here new value of X,Y,Z for lamp with chromatic CAM02 adaptation //here new value of X,Y,Z for lamp with chromatic CAM02 adaptation
for(int i = 0; i < N_c; i++) { for(int i = 0; i < N_c; i++) {
Xcam02Lamp[i] = CAM02BB00 * XchkLamp[i] + CAM02BB01 * YchkLamp[i ] + CAM02BB02 * ZchkLamp[i] ; Xcam02Lamp[i] = CAM02BB00 * XchkLamp[i] + CAM02BB01 * YchkLamp[i ] + CAM02BB02 * ZchkLamp[i] ;
Ycam02Lamp[i] = CAM02BB10 * XchkLamp[i] + CAM02BB11 * YchkLamp[i ] + CAM02BB12 * ZchkLamp[i] ; Ycam02Lamp[i] = CAM02BB10 * XchkLamp[i] + CAM02BB11 * YchkLamp[i ] + CAM02BB12 * ZchkLamp[i] ;
Zcam02Lamp[i] = CAM02BB20 * XchkLamp[i] + CAM02BB21 * YchkLamp[i ] + CAM02BB22 * ZchkLamp[i] ; Zcam02Lamp[i] = CAM02BB20 * XchkLamp[i] + CAM02BB21 * YchkLamp[i ] + CAM02BB22 * ZchkLamp[i] ;
} }
//now calculate CAM02 for Blackbody (or Daylight) at tempx //now calculate CAM02 for Blackbody (or Daylight) at tempx
skipping to change at line 1305 skipping to change at line 1305
for(int i = 0; i < N_c; i++) { for(int i = 0; i < N_c; i++) {
Xcam02[i] = CAM02BB00 * Xchk[i] + CAM02BB01 * Ychk[i] + CAM02BB0 2 * Zchk[i] ; Xcam02[i] = CAM02BB00 * Xchk[i] + CAM02BB01 * Ychk[i] + CAM02BB0 2 * Zchk[i] ;
Ycam02[i] = CAM02BB10 * Xchk[i] + CAM02BB11 * Ychk[i] + CAM02BB1 2 * Zchk[i] ; Ycam02[i] = CAM02BB10 * Xchk[i] + CAM02BB11 * Ychk[i] + CAM02BB1 2 * Zchk[i] ;
Zcam02[i] = CAM02BB20 * Xchk[i] + CAM02BB21 * Ychk[i] + CAM02BB2 2 * Zchk[i] ; Zcam02[i] = CAM02BB20 * Xchk[i] + CAM02BB21 * Ychk[i] + CAM02BB2 2 * Zchk[i] ;
// printf("CoulXYZ %i X %f Y %f Z %f\n", i, Xchk[i],Ychk[i],Zch k[i]); // printf("CoulXYZ %i X %f Y %f Z %f\n", i, Xchk[i],Ychk[i],Zch k[i]);
// printf("CoulCAM %i X %f Y %f Z %f\n", i, Xcam02[i],Ycam02[i] ,Zcam02[i]); // printf("CoulCAM %i X %f Y %f Z %f\n", i, Xcam02[i],Ycam02[i] ,Zcam02[i]);
} }
//now conversion to Lab //now conversion to Lab
// Lamp // Lamp
double fx[50], fy[50], fz[50];
for(int i = 0; i < N_c; i++) { for(int i = 0; i < N_c; i++) {
xr[i] = Xcam02Lamp[i] / whiteD50[0]; xr[i] = Xcam02Lamp[i] / whiteD50[0];
yr[i] = Ycam02Lamp[i] / whiteD50[1]; yr[i] = Ycam02Lamp[i] / whiteD50[1];
zr[i] = Zcam02Lamp[i] / whiteD50[2]; zr[i] = Zcam02Lamp[i] / whiteD50[2];
// xr, yr , zr > epsilon // xr, yr , zr > epsilon
if(xr[i] > epsilon) { if(xr[i] > epsilon) {
fx[i] = std::cbrt(xr[i]); fx[i] = std::cbrt(xr[i]);
} else { } else {
 End of changes. 8 change blocks. 
9 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)