diff --git a/rtengine/EdgePreservingDecomposition.cc b/rtengine/EdgePreservingDecomposition.cc index 1424af1b3..1c2d0219f 100644 --- a/rtengine/EdgePreservingDecomposition.cc +++ b/rtengine/EdgePreservingDecomposition.cc @@ -6,7 +6,6 @@ #endif #include "sleef.c" #include "opthelper.h" -#define pow_F(a,b) (xexpf(b*xlogf(a))) #define DIAGONALS 5 #define DIAGONALSP1 6 diff --git a/rtengine/ciecam02.cc b/rtengine/ciecam02.cc index 7b5ef63fe..77c57048a 100644 --- a/rtengine/ciecam02.cc +++ b/rtengine/ciecam02.cc @@ -30,7 +30,6 @@ #undef CLIPD #define CLIPD(a) ((a)>0.0?((a)<1.0?(a):1.0):0.0) #define MAXR(a,b) ((a) > (b) ? (a) : (b)) -#define pow_F(a,b) (xexpf(b*xlogf(a))) namespace rtengine { diff --git a/rtengine/color.cc b/rtengine/color.cc index edfe04528..7964cc472 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -25,8 +25,6 @@ #include "opthelper.h" #include "iccstore.h" -#define pow_F(a,b) (xexpf(b*xlogf(a))) - using namespace std; namespace rtengine diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index 08c58176c..ab318aa73 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -24,11 +24,6 @@ #include "sleef.c" #include "settings.h" -#undef CLIPD -#define CLIPD(a) ((a)>0.0?((a)<1.0?(a):1.0):0.0) -#define CLIPQQ(a) ((a)>0?((a)<250?(a):250):0) -#define MAXR(a,b) ((a) > (b) ? (a) : (b)) - namespace rtengine { @@ -70,48 +65,22 @@ static const double cie_colour_match_jd[97][3] = {//350nm to 830nm 5 nm J.Desm {0.000001251141, 0.00000045181, 0.000000} }; -ColorTemp::ColorTemp (double t, double g, double e, const Glib::ustring &m) : temp(t), green(g), equal(e), method(m) +ColorTemp::ColorTemp (double t, double g, double e, const std::string &m) : temp(t), green(g), equal(e), method(m) { - clip (temp, green, equal); } void ColorTemp::clip (double &temp, double &green) { - - if (temp < MINTEMP) { - temp = MINTEMP; - } else if (temp > MAXTEMP) { - temp = MAXTEMP; - } - - if (green < MINGREEN) { - green = MINGREEN; - } else if (green > MAXGREEN) { - green = MAXGREEN; - } + temp = rtengine::LIM(temp, MINTEMP, MAXTEMP); + green = rtengine::LIM(green, MINGREEN, MAXGREEN); } void ColorTemp::clip (double &temp, double &green, double &equal) { - - if (temp < MINTEMP) { - temp = MINTEMP; - } else if (temp > MAXTEMP) { - temp = MAXTEMP; - } - - if (green < MINGREEN) { - green = MINGREEN; - } else if (green > MAXGREEN) { - green = MAXGREEN; - } - - if(equal < MINEQUAL) { - equal = MINEQUAL; - } else if(equal > MAXEQUAL) { - equal = MAXEQUAL; - } + temp = rtengine::LIM(temp, MINTEMP, MAXTEMP); + green = rtengine::LIM(green, MINGREEN, MAXGREEN); + equal = rtengine::LIM(equal, MINEQUAL, MAXEQUAL); } ColorTemp::ColorTemp (double mulr, double mulg, double mulb, double e) : equal(e), method("Custom") @@ -122,7 +91,7 @@ ColorTemp::ColorTemp (double mulr, double mulg, double mulb, double e) : equal(e void ColorTemp::mul2temp (const double rmul, const double gmul, const double bmul, const double equal, double& temp, double& green) const { - double maxtemp = double(MAXTEMP), mintemp = double(MINTEMP); + double maxtemp = MAXTEMP, mintemp = MINTEMP; double tmpr, tmpg, tmpb; temp = (maxtemp + mintemp) / 2; @@ -354,6 +323,37 @@ const double ColorTemp::Flash6500_spect[97] = { 55.72, 51.97, 54.72, 57.46, 58.89, 60.33 }; +const std::map ColorTemp::spectMap = { + {"Daylight", Daylight5300_spect}, + {"Cloudy", Cloudy6200_spect}, + {"Shade", Shade7600_spect}, + {"Tungsten", A2856_spect}, + {"Fluo F1", FluoF1_spect}, + {"Fluo F2", FluoF2_spect}, + {"Fluo F3", FluoF3_spect}, + {"Fluo F4", FluoF4_spect}, + {"Fluo F5", FluoF5_spect}, + {"Fluo F6", FluoF6_spect}, + {"Fluo F7", FluoF7_spect}, + {"Fluo F8", FluoF8_spect}, + {"Fluo F9", FluoF9_spect}, + {"Fluo F10", FluoF10_spect}, + {"Fluo F11", FluoF11_spect}, + {"Fluo F12", FluoF12_spect}, + {"HMI Lamp", HMI_spect}, + {"GTI Lamp", GTI_spect}, + {"JudgeIII Lamp", JudgeIII_spect}, + {"Solux Lamp 3500K", Solux3500_spect}, + {"Solux Lamp 4100K", Solux4100_spect}, + {"Solux Lamp 4700K", Solux4700_spect}, + {"NG Solux Lamp 4700K", NG_Solux4700_spect}, + {"LED LSI Lumelex 2040", NG_LEDLSI2040_spect}, + {"LED CRS SP12 WWMR16", NG_CRSSP12WWMR16_spect}, + {"Flash 5500K", Flash5500_spect}, + {"Flash 6000K", Flash6000_spect}, + {"Flash 6500K", Flash6500_spect} + }; + // Data for Color ==> CRI (Color Rendering Index and Palette // actually 20 color that must be good enough for CRI @@ -844,10 +844,7 @@ const double ColorTemp::ColabSky42_0_m24_spect[97] = { * Gunter Wyszecki and W. S. Stiles, John Wiley & Sons, 1982, pp. 227, 228. */ //adaptation to RT by J.Desmis -#include -/* LERP(a,b,c) = linear interpolation macro, is 'a' when c == 0.0 and 'b' when c == 1.0 */ -#define LERP(a,b,c) (((b) - (a)) * (c) + (a)) int ColorTemp::XYZtoCorColorTemp(double x0, double y0, double z0, double &temp) const { @@ -922,13 +919,13 @@ int ColorTemp::XYZtoCorColorTemp(double x0, double y0, double z0, double &temp) } if (i == 31) { - return(-1); /* bad XYZ input, color temp would be less than minimum of 1666.7 degrees, or too far towards blue */ + return -1; /* bad XYZ input, color temp would be less than minimum of 1666.7 degrees, or too far towards blue */ } di = di / sqrt(1.0 + uvt[i ].t * uvt[i ].t); dm = dm / sqrt(1.0 + uvt[i - 1].t * uvt[i - 1].t); p = dm / (dm - di); /* p = interpolation parameter, 0.0 : i-1, 1.0 : i */ - p = 1.0 / (LERP(rt[i - 1], rt[i], p)); + p = 1.0 / rtengine::intp(p, rt[i], rt[i - 1]); temp = p; return 0; /* success */ } @@ -1025,192 +1022,15 @@ void ColorTemp::cieCAT02(double Xw, double Yw, double Zw, double &CAM02BB00, dou } -void ColorTemp::temp2mulxyz (double tem, const std::string &method, double &Xxyz, double &Zxyz) +void ColorTemp::temp2mulxyz (double temp, const std::string &method, double &Xxyz, double &Zxyz) { - double xD, yD, x_D, y_D, interm; double x, y, z; - if (method == "Daylight" ) { - spectrum_to_xyz_preset(Daylight5300_spect, x, y, z); - } else if(method == "Cloudy" ) { - spectrum_to_xyz_preset(Cloudy6200_spect, x, y, z); - } else if(method == "Shade" ) { - spectrum_to_xyz_preset(Shade7600_spect, x, y, z); - } else if(method == "Tungsten" ) { - spectrum_to_xyz_preset(A2856_spect, x, y, z); - } else if(method == "Fluo F1" ) { - spectrum_to_xyz_preset(FluoF1_spect, x, y, z); - } else if(method == "Fluo F2" ) { - spectrum_to_xyz_preset(FluoF2_spect, x, y, z); - } else if(method == "Fluo F3" ) { - spectrum_to_xyz_preset(FluoF3_spect, x, y, z); - } else if(method == "Fluo F4" ) { - spectrum_to_xyz_preset(FluoF4_spect, x, y, z); - } else if(method == "Fluo F5" ) { - spectrum_to_xyz_preset(FluoF5_spect, x, y, z); - } else if(method == "Fluo F6" ) { - spectrum_to_xyz_preset(FluoF6_spect, x, y, z); - } else if(method == "Fluo F7" ) { - spectrum_to_xyz_preset(FluoF7_spect, x, y, z); - } else if(method == "Fluo F8" ) { - spectrum_to_xyz_preset(FluoF8_spect, x, y, z); - } else if(method == "Fluo F9" ) { - spectrum_to_xyz_preset(FluoF9_spect, x, y, z); - } else if(method == "Fluo F10" ) { - spectrum_to_xyz_preset(FluoF10_spect, x, y, z); - } else if(method == "Fluo F11" ) { - spectrum_to_xyz_preset(FluoF11_spect, x, y, z); - } else if(method == "Fluo F12" ) { - spectrum_to_xyz_preset(FluoF12_spect, x, y, z); - } else if(method == "HMI Lamp" ) { - spectrum_to_xyz_preset(HMI_spect, x, y, z); - } else if(method == "GTI Lamp" ) { - spectrum_to_xyz_preset(GTI_spect, x, y, z); - } else if(method == "JudgeIII Lamp" ) { - spectrum_to_xyz_preset(JudgeIII_spect, x, y, z); - } else if(method == "Solux Lamp 3500K" ) { - spectrum_to_xyz_preset(Solux3500_spect, x, y, z); - } else if(method == "Solux Lamp 4100K" ) { - spectrum_to_xyz_preset(Solux4100_spect, x, y, z); - } else if(method == "Solux Lamp 4700K" ) { - spectrum_to_xyz_preset(Solux4700_spect, x, y, z); - } else if(method == "NG Solux Lamp 4700K" ) { - spectrum_to_xyz_preset(NG_Solux4700_spect, x, y, z); - } else if(method == "LED LSI Lumelex 2040") { - spectrum_to_xyz_preset(NG_LEDLSI2040_spect, x, y, z); - } else if(method == "LED CRS SP12 WWMR16" ) { - spectrum_to_xyz_preset(NG_CRSSP12WWMR16_spect, x, y, z); - } else if(method == "Flash 5500K" ) { - spectrum_to_xyz_preset(Flash5500_spect, x, y, z); - } else if(method == "Flash 6000K" ) { - spectrum_to_xyz_preset(Flash6000_spect, x, y, z); - } else if(method == "Flash 6500K" ) { - spectrum_to_xyz_preset(Flash6500_spect, x, y, z); - } else { - // otherwise we use the Temp+Green generic solution - if (tem <= INITIALBLACKBODY) { - // if temperature is between 2000K and 4000K we use blackbody, because there will be no Daylight reference below 4000K... - // of course, the previous version of RT used the "magical" but wrong formula of U.Fuchs (Ufraw). - spectrum_to_xyz_blackbody(tem, x, y, z); - } else { - // from 4000K up to 25000K: using the D illuminant (daylight) which is standard - double m1, m2; - - if (tem <= 7000) { - x_D = -4.6070e9 / (tem * tem * tem) + 2.9678e6 / (tem * tem) + 0.09911e3 / tem + 0.244063; - } else if (tem <= 25000) { - x_D = -2.0064e9 / (tem * tem * tem) + 1.9018e6 / (tem * tem) + 0.24748e3 / tem + 0.237040; - } else /*if (tem > 25000)*/ { - x_D = -2.0064e9 / (tem * tem * tem) + 1.9018e6 / (tem * tem) + 0.24748e3 / tem + 0.237040 - ((tem - 25000) / 25000) * 0.025; //Jacques empirical adjustemnt for very high temp (underwater !) - } - - y_D = -3.0 * x_D * x_D + 2.87 * x_D - 0.275; - //calculate D -daylight in function of s0, s1, s2 and temp ==> x_D y_D - //S(lamda)=So(lambda)+m1*s1(lambda)+m2*s2(lambda) - interm = (0.0241 + 0.2562 * x_D - 0.734 * y_D); - m1 = (-1.3515 - 1.7703 * x_D + 5.9114 * y_D) / interm; - m2 = (0.03 - 31.4424 * x_D + 30.0717 * y_D) / interm; - spectrum_to_xyz_daylight(m1, m2, x, y, z); - xD = x; - yD = y; - } - - } - - xD = x; - yD = y; - - double X = xD / yD; - double Z = (1.0 - xD - yD) / yD; - Xxyz = X; - Zxyz = Z; - //printf("Xxyz=%f Zxyz=%f\n",Xxyz,Zxyz); -} - -void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, double& gmul, double& bmul) const -{ - - clip (temp, green, equal); - - //printf("temp=%d green=%.3f equal=%.3f\n", (int)temp, (float) green, (float) equal); - - //variables for CRI and display Lab, and palette - double xD, yD, x_D, y_D, interm; - double m1, m2; - - double x, y, z; - double Xchk[50], Ychk[50], Zchk[50]; //50 : I think it's a good limit for number of color : for CRI and Palette - double Xcam02[50], Ycam02[50], Zcam02[50]; - - double XchkLamp[50], YchkLamp[50], ZchkLamp[50]; - double Xcam02Lamp[50], Ycam02Lamp[50], Zcam02Lamp[50]; - const double epsilon = 0.008856; //Lab - const double whiteD50[3] = {0.9646019585, 1.0, 0.8244507152}; //calculate with this tool : spect 5nm - double CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22; //for CIECAT02 - - double xr[50], yr[50], zr[50]; - double fx[50], fy[50], fz[50]; - -// bool palette = false; - // double tempalet; // correlated temperature - // We first test for specially handled methods - if (method == "Daylight" ) { - spectrum_to_xyz_preset(Daylight5300_spect, x, y, z); - } else if(method == "Cloudy" ) { - spectrum_to_xyz_preset(Cloudy6200_spect, x, y, z); - } else if(method == "Shade" ) { - spectrum_to_xyz_preset(Shade7600_spect, x, y, z); - } else if(method == "Tungsten" ) { - spectrum_to_xyz_preset(A2856_spect, x, y, z); - } else if(method == "Fluo F1" ) { - spectrum_to_xyz_preset(FluoF1_spect, x, y, z); - } else if(method == "Fluo F2" ) { - spectrum_to_xyz_preset(FluoF2_spect, x, y, z); - } else if(method == "Fluo F3" ) { - spectrum_to_xyz_preset(FluoF3_spect, x, y, z); - } else if(method == "Fluo F4" ) { - spectrum_to_xyz_preset(FluoF4_spect, x, y, z); - } else if(method == "Fluo F5" ) { - spectrum_to_xyz_preset(FluoF5_spect, x, y, z); - } else if(method == "Fluo F6" ) { - spectrum_to_xyz_preset(FluoF6_spect, x, y, z); - } else if(method == "Fluo F7" ) { - spectrum_to_xyz_preset(FluoF7_spect, x, y, z); - } else if(method == "Fluo F8" ) { - spectrum_to_xyz_preset(FluoF8_spect, x, y, z); - } else if(method == "Fluo F9" ) { - spectrum_to_xyz_preset(FluoF9_spect, x, y, z); - } else if(method == "Fluo F10" ) { - spectrum_to_xyz_preset(FluoF10_spect, x, y, z); - } else if(method == "Fluo F11" ) { - spectrum_to_xyz_preset(FluoF11_spect, x, y, z); - } else if(method == "Fluo F12" ) { - spectrum_to_xyz_preset(FluoF12_spect, x, y, z); - } else if(method == "HMI Lamp" ) { - spectrum_to_xyz_preset(HMI_spect, x, y, z); - } else if(method == "GTI Lamp" ) { - spectrum_to_xyz_preset(GTI_spect, x, y, z); - } else if(method == "JudgeIII Lamp" ) { - spectrum_to_xyz_preset(JudgeIII_spect, x, y, z); - } else if(method == "Solux Lamp 3500K" ) { - spectrum_to_xyz_preset(Solux3500_spect, x, y, z); - } else if(method == "Solux Lamp 4100K" ) { - spectrum_to_xyz_preset(Solux4100_spect, x, y, z); - } else if(method == "Solux Lamp 4700K" ) { - spectrum_to_xyz_preset(Solux4700_spect, x, y, z); - } else if(method == "NG Solux Lamp 4700K" ) { - spectrum_to_xyz_preset(NG_Solux4700_spect, x, y, z); - } else if(method == "LED LSI Lumelex 2040") { - spectrum_to_xyz_preset(NG_LEDLSI2040_spect, x, y, z); - } else if(method == "LED CRS SP12 WWMR16" ) { - spectrum_to_xyz_preset(NG_CRSSP12WWMR16_spect, x, y, z); - } else if(method == "Flash 5500K" ) { - spectrum_to_xyz_preset(Flash5500_spect, x, y, z); - } else if(method == "Flash 6000K" ) { - spectrum_to_xyz_preset(Flash6000_spect, x, y, z); - } else if(method == "Flash 6500K" ) { - spectrum_to_xyz_preset(Flash6500_spect, x, y, z); + const auto iterator = spectMap.find(method); + + if (iterator != spectMap.end()) { + spectrum_to_xyz_preset(iterator->second, x, y, z); } else { // otherwise we use the Temp+Green generic solution if (temp <= INITIALBLACKBODY) { @@ -1219,48 +1039,42 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, spectrum_to_xyz_blackbody(temp, x, y, z); } else { // from 4000K up to 25000K: using the D illuminant (daylight) which is standard + double x_D, y_D; if (temp <= 7000) { x_D = -4.6070e9 / (temp * temp * temp) + 2.9678e6 / (temp * temp) + 0.09911e3 / temp + 0.244063; } else if (temp <= 25000) { x_D = -2.0064e9 / (temp * temp * temp) + 1.9018e6 / (temp * temp) + 0.24748e3 / temp + 0.237040; - } else /*if (temp > 25000)*/ { // above 25000 it's unknown..then I have modified to adjust for underwater - x_D = -2.0064e9 / (temp * temp * temp) + 1.9018e6 / (temp * temp) + 0.24748e3 / temp + 0.237040 - ((temp - 25000) / 25000) * 0.025; //Jacques empirical adjustemnt for very high temp (underwater !) + } else /*if (temp > 25000)*/ { + x_D = -2.0064e9 / (temp * temp * temp) + 1.9018e6 / (temp * temp) + 0.24748e3 / temp + 0.237040 - ((temp - 25000) / 25000) * 0.025; //Jacques empirical adjustment for very high temp (underwater !) } - y_D = (-3.0 * x_D * x_D + 2.87 * x_D - 0.275); //modify blue / red action + y_D = -3.0 * x_D * x_D + 2.87 * x_D - 0.275; //modify blue / red action //calculate D -daylight in function of s0, s1, s2 and temp ==> x_D y_D //S(lamda)=So(lambda)+m1*s1(lambda)+m2*s2(lambda) - interm = (0.0241 + 0.2562 * x_D - 0.734 * y_D); - m1 = (-1.3515 - 1.7703 * x_D + 5.9114 * y_D) / interm; - m2 = (0.03 - 31.4424 * x_D + 30.0717 * y_D) / interm; + double interm = 0.0241 + 0.2562 * x_D - 0.734 * y_D; + double m1 = (-1.3515 - 1.7703 * x_D + 5.9114 * y_D) / interm; + double m2 = (0.03 - 31.4424 * x_D + 30.0717 * y_D) / interm; spectrum_to_xyz_daylight(m1, m2, x, y, z); - xD = x; - yD = y; } } - xD = x; - yD = y; + Xxyz = x / y; + Zxyz = (1.0 - x - y) / y; +} + +void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, double& gmul, double& bmul) const +{ + clip(temp, green, equal); + double Xwb, Zwb; + temp2mulxyz(temp, method, Xwb, Zwb); + float adj = 1.f; if(equal < 0.9999 || equal > 1.0001 ) { adj = (100.f + ( 1000.f - (1000.f * (float)equal) ) / 20.f) / 100.f; } - //printf("adj=%f\n",adj); - double Xwb = xD / yD; - double Ywb = 1.0; - double Zwb = (1.0 - xD - yD) / yD; - - if (settings->verbose) { - // double u=4*xD/(-2*xD+12*yD+3); - // double v=6*yD/(-2*xD+12*yD+3); - // printf("xD=%f yD=%f u=%f v=%f\n",xD,yD,u,v); - if(settings->CRI_color != 0) { - printf("xD=%f yD=%f === Xwb=%f Ywb=%f Zwb=%f\n", xD, yD, Xwb, Ywb, Zwb); - } - } /*if (isRaw) { rmul = sRGB_xyz[0][0]*X + sRGB_xyz[0][1]*Y + sRGB_xyz[0][2]*Z; @@ -1268,36 +1082,41 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, bmul = sRGB_xyz[2][0]*X + sRGB_xyz[2][1]*Y + sRGB_xyz[2][2]*Z; } else {*/ //recalculate channels multipliers with new values of XYZ tue to whitebalance - rmul = sRGBd65_xyz[0][0] * Xwb * adj + sRGBd65_xyz[0][1] * Ywb + sRGBd65_xyz[0][2] * Zwb / adj; // Jacques' empirical modification 5/2013 - gmul = sRGBd65_xyz[1][0] * Xwb + sRGBd65_xyz[1][1] * Ywb + sRGBd65_xyz[1][2] * Zwb; - bmul = sRGBd65_xyz[2][0] * Xwb * adj + sRGBd65_xyz[2][1] * Ywb + sRGBd65_xyz[2][2] * Zwb / adj; + 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; + bmul = sRGBd65_xyz[2][0] * Xwb * adj + sRGBd65_xyz[2][1] + sRGBd65_xyz[2][2] * Zwb / adj; //}; gmul /= green; //printf("rmul=%f gmul=%f bmul=%f\n",rmul, gmul, bmul); - double max = rmul; - - if (gmul > max) { - max = gmul; - } - - if (bmul > max) { - max = bmul; - } + double max = rtengine::max(rmul, gmul, bmul); rmul /= max; gmul /= max; bmul /= max; - // begin CRI_RT : color rendering index RT - adaptation of CRI by J.Desmis - // CRI = 100 for Blackbody and Daylight - // calculate from spectral data values X, Y, Z , for color of colorchecker24 , SG, DC, JDC_468 - //only for lamp different of tungstene - //first calcul with illuminant (choice) - // and calcul with : blackbody at equivalent temp of lamp - 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.Desmis + // CRI = 100 for Blackbody and Daylight + // calculate from spectral data values X, Y, Z , for color of colorchecker24 , SG, DC, JDC_468 + // only for lamp different of tungstene + // first calcul with illuminant (choice) + // and calcul with : blackbody at equivalent temp of lamp // CRI_color-1 = dispaly Lab values of color CRI_color -1 - { + const double whiteD50[3] = {0.9646019585, 1.0, 0.8244507152}; //calculate 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 for number of color : for CRI and Palette + double Xcam02[50], Ycam02[50], Zcam02[50]; + + double XchkLamp[50], YchkLamp[50], ZchkLamp[50]; + double Xcam02Lamp[50], Ycam02Lamp[50], Zcam02Lamp[50]; + const double epsilon = 0.008856; //Lab + + 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 numero_color = settings->CRI_color - 1; diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h index 6f8ed089e..d96e6f5ce 100644 --- a/rtengine/colortemp.h +++ b/rtengine/colortemp.h @@ -19,22 +19,19 @@ #ifndef _COLORTEMP_ #define _COLORTEMP_ -#include #include - -#define pow_F(a,b) (xexpf(b*xlogf(a))) +#include namespace rtengine { -#define MINTEMP 1500 -#define MAXTEMP 60000 -#define MINGREEN 0.02 -#define MAXGREEN 10.0 -#define MINEQUAL 0.8 -#define MAXEQUAL 1.5 - -#define INITIALBLACKBODY 4000 +constexpr double MINTEMP = 1500.0; +constexpr double MAXTEMP = 60000.0; +constexpr double MINGREEN = 0.02; +constexpr double MAXGREEN = 10.0; +constexpr double MINEQUAL = 0.8; +constexpr double MAXEQUAL = 1.5; +constexpr double INITIALBLACKBODY = 4000.0; class ColorTemp @@ -49,12 +46,12 @@ private: static void clip (double &temp, double &green, double &equal); int XYZtoCorColorTemp(double x0, double y0 , double z0, double &temp) const; void temp2mul (double temp, double green, double equal, double& rmul, double& gmul, double& bmul) const; - + const static std::map spectMap; public: ColorTemp () : temp(-1.), green(-1.), equal (1.), method("Custom") {} explicit ColorTemp (double e) : temp(-1.), green(-1.), equal (e), method("Custom") {} - ColorTemp (double t, double g, double e, const Glib::ustring &m); + ColorTemp (double t, double g, double e, const std::string &m); ColorTemp (double mulr, double mulg, double mulb, double e); void update (const double rmul, const double gmul, const double bmul, const double equal, const double tempBias=0.0) diff --git a/rtengine/opthelper.h b/rtengine/opthelper.h index 5e9b97931..d6af9a745 100644 --- a/rtengine/opthelper.h +++ b/rtengine/opthelper.h @@ -22,6 +22,8 @@ #ifndef OPTHELPER_H #define OPTHELPER_H + #define pow_F(a,b) (xexpf(b*xlogf(a))) + #ifdef __SSE2__ #include "sleefsseavx.c" #ifdef __GNUC__