diff --git a/rtdata/languages/default b/rtdata/languages/default index 8120419d2..0396b9d8d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1414,6 +1414,7 @@ HISTORY_MSG_FILMNEGATIVE_COLORSPACE;Film negative color space HISTORY_MSG_FILMNEGATIVE_ENABLED;Film Negative HISTORY_MSG_FILMNEGATIVE_REF_SPOT;FN - Reference input HISTORY_MSG_FILMNEGATIVE_VALUES;Film negative values +HISTORY_MSG_GAMUTMUNSEL;Gamut-Munsell HISTORY_MSG_HISTMATCHING;Auto-matched tone curve HISTORY_MSG_HLBL;Color propagation - blur HISTORY_MSG_ICL_LABGRIDCIEXY;Cie xy @@ -1441,6 +1442,7 @@ HISTORY_MSG_LOCALCONTRAST_DARKNESS;Local Contrast - Darkness HISTORY_MSG_LOCALCONTRAST_ENABLED;Local Contrast HISTORY_MSG_LOCALCONTRAST_LIGHTNESS;Local Contrast - Lightness HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius +HISTORY_MSG_LOCAL_GAMUTMUNSEL;Local - Gamut-Munsell HISTORY_MSG_METADATA_MODE;Metadata copy mode HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold HISTORY_MSG_PDSHARPEN_AUTO_CONTRAST;CS - Auto threshold @@ -2608,8 +2610,6 @@ TP_ICM_WORKING_TRC_SRGB;sRGB g=2.4 s=12.92 TP_ICM_WORKING_TRC_TOOLTIP;Only for built-in profiles. TP_IMPULSEDENOISE_LABEL;Impulse Noise Reduction TP_IMPULSEDENOISE_THRESH;Threshold -TP_LABCURVE_AVOIDCOLORSHIFT;Avoid color shift -TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space and apply Munsell correction (Uniform Perceptual Lab). TP_LABCURVE_BRIGHTNESS;Lightness TP_LABCURVE_CHROMATICITY;Chromaticity TP_LABCURVE_CHROMA_TOOLTIP;To apply B&W toning, set Chromaticity to -100. @@ -2674,7 +2674,7 @@ TP_LOCALLAB_ARTIF_TOOLTIP;ΔE scope threshold increases the range of ΔE scope. TP_LOCALLAB_AUTOGRAY;Auto mean luminance (Yb%) TP_LOCALLAB_AUTOGRAYCIE;Auto TP_LOCALLAB_AVOID;Avoid color shift -TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space and apply Munsell correction (Uniform Perceptual Lab).\nMunsell correction always disabled when Jz or CAM16 is used. +TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space and apply Munsell correction (Uniform Perceptual Lab).\nMunsell correction always disabled when Jz or CAM16 or Color Appearance and Lighting is used.\n\nDefault: Munsell.\nMunsell correction: fixes Lab mode hue drifts due to non-linearity, when chromaticity is changed (Uniform Perceptual Lab).\nLab: applies a gamut control, in relative colorimetric, Munsell is then applied.\nXYZ Absolute, applies gamut control, in absolute colorimetric, Munsell is then applied.\nXYZ Relative, applies gamut control, in relative colorimetric, Munsell is then applied. TP_LOCALLAB_AVOIDMUN;Munsell correction only TP_LOCALLAB_AVOIDMUN_TOOLTIP;Munsell correction always disabled when Jz or CAM16 is used. TP_LOCALLAB_AVOIDRAD;Soft radius @@ -2904,6 +2904,11 @@ TP_LOCALLAB_GAMM;Gamma TP_LOCALLAB_GAMMASKCOL;Gamma TP_LOCALLAB_GAMMASK_TOOLTIP;Adjusting Gamma and Slope can provide a soft and artifact-free transformation of the mask by progressively modifying 'L' to avoid any discontinuities. TP_LOCALLAB_GAMSH;Gamma +TP_LOCALLAB_GAMUTNON;None +TP_LOCALLAB_GAMUTLABRELA;Lab +TP_LOCALLAB_GAMUTXYZABSO;XYZ Absolute +TP_LOCALLAB_GAMUTXYZRELA;XYZ Relative +TP_LOCALLAB_GAMUTMUNSELL;Munsell only TP_LOCALLAB_GAMW;Gamma (wavelet pyramids) TP_LOCALLAB_GRADANG;Gradient angle TP_LOCALLAB_GRADANG_TOOLTIP;Rotation angle in degrees: -180 0 +180. diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 15ebcc2e6..0e08a28eb 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -54,7 +54,8 @@ #pragma GCC diagnostic warning "-Wextra" #pragma GCC diagnostic warning "-Wdouble-promotion" -namespace { +namespace +{ using namespace rtengine; @@ -218,32 +219,37 @@ void proPhotoBlue(float *rtemp, float *gtemp, float *btemp, int istart, int tH, } } -void customToneCurve(const ToneCurve &customToneCurve, ToneCurveMode curveMode, float *rtemp, float *gtemp, float *btemp, int istart, int tH, int jstart, int tW, int tileSize, PerceptualToneCurveState ptcApplyState) { +void customToneCurve(const ToneCurve &customToneCurve, ToneCurveMode curveMode, float *rtemp, float *gtemp, float *btemp, int istart, int tH, int jstart, int tW, int tileSize, PerceptualToneCurveState ptcApplyState) +{ if (curveMode == ToneCurveMode::STD) { // Standard - const StandardToneCurve& userToneCurve = static_cast (customToneCurve); + const StandardToneCurve& userToneCurve = static_cast(customToneCurve); + for (int i = istart, ti = 0; i < tH; i++, ti++) { userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], >emp[ti * tileSize], &btemp[ti * tileSize]); } } else if (curveMode == ToneCurveMode::FILMLIKE) { // Adobe like - const AdobeToneCurve& userToneCurve = static_cast (customToneCurve); + const AdobeToneCurve& userToneCurve = static_cast(customToneCurve); + for (int i = istart, ti = 0; i < tH; i++, ti++) { userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], >emp[ti * tileSize], &btemp[ti * tileSize]); } } else if (curveMode == ToneCurveMode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels - const SatAndValueBlendingToneCurve& userToneCurve = static_cast (customToneCurve); + const SatAndValueBlendingToneCurve& userToneCurve = static_cast(customToneCurve); + for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { userToneCurve.Apply(rtemp[ti * tileSize + tj], gtemp[ti * tileSize + tj], btemp[ti * tileSize + tj]); } } } else if (curveMode == ToneCurveMode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted - const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurve); + const WeightedStdToneCurve& userToneCurve = static_cast(customToneCurve); + for (int i = istart, ti = 0; i < tH; i++, ti++) { userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], >emp[ti * tileSize], &btemp[ti * tileSize]); } } else if (curveMode == ToneCurveMode::LUMINANCE) { // apply the curve to the luminance channel - const LuminanceToneCurve& userToneCurve = static_cast (customToneCurve); + const LuminanceToneCurve& userToneCurve = static_cast(customToneCurve); for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { @@ -251,7 +257,8 @@ void customToneCurve(const ToneCurve &customToneCurve, ToneCurveMode curveMode, } } } else if (curveMode == ToneCurveMode::PERCEPTUAL) { // apply curve while keeping color appearance constant - const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve); + const PerceptualToneCurve& userToneCurve = static_cast(customToneCurve); + for (int i = istart, ti = 0; i < tH; i++, ti++) { userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], >emp[ti * tileSize], &btemp[ti * tileSize], ptcApplyState); } @@ -277,7 +284,7 @@ namespace rtengine using namespace procparams; -ImProcFunctions::~ImProcFunctions () +ImProcFunctions::~ImProcFunctions() { if (monitorTransform) { cmsDeleteTransform(monitorTransform); @@ -307,7 +314,7 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R #if !defined(__APPLE__) // No support for monitor profiles on OS X, all data is sRGB monitor = ICCStore::getInstance()->getProfile(monitorProfile); #else - monitor = ICCStore::getInstance()->getProfile (settings->srgb); + monitor = ICCStore::getInstance()->getProfile(settings->srgb); #endif } @@ -325,7 +332,7 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R if (softProof) { cmsHPROFILE oprof = nullptr; RenderingIntent outIntent; - + flags = cmsFLAGS_SOFTPROOFING | cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE; if (!settings->printerProfile.empty()) { @@ -334,9 +341,11 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R if (settings->printerBPC) { flags |= cmsFLAGS_BLACKPOINTCOMPENSATION; } + outIntent = RenderingIntent(settings->printerIntent); } else { oprof = ICCStore::getInstance()->getProfile(params->icm.outputProfile); + if (params->icm.outputBPC) { flags |= cmsFLAGS_BLACKPOINTCOMPENSATION; } @@ -352,20 +361,23 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R // } const auto make_gamma_table = - [](cmsHPROFILE prof, cmsTagSignature tag) -> void + [](cmsHPROFILE prof, cmsTagSignature tag) -> void { + cmsToneCurve *tc = static_cast(cmsReadTag(prof, tag)); + + if (tc) { - cmsToneCurve *tc = static_cast(cmsReadTag(prof, tag)); - if (tc) { - const cmsUInt16Number *table = cmsGetToneCurveEstimatedTable(tc); - cmsToneCurve *tc16 = cmsBuildTabulatedToneCurve16(nullptr, cmsGetToneCurveEstimatedTableEntries(tc), table); - if (tc16) { - cmsWriteTag(prof, tag, tc16); - cmsFreeToneCurve(tc16); - } + const cmsUInt16Number *table = cmsGetToneCurveEstimatedTable(tc); + cmsToneCurve *tc16 = cmsBuildTabulatedToneCurve16(nullptr, cmsGetToneCurveEstimatedTableEntries(tc), table); + + if (tc16) { + cmsWriteTag(prof, tag, tc16); + cmsFreeToneCurve(tc16); } - }; + } + }; cmsHPROFILE softproof = ProfileContent(oprof).toProfile(); + if (softproof) { make_gamma_table(softproof, cmsSigRedTRCTag); make_gamma_table(softproof, cmsSigGreenTRCTag); @@ -439,7 +451,7 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R void ImProcFunctions::firstAnalysis(const Imagefloat* const original, const ProcParams ¶ms, LUTu & histogram) { - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params.icm.workingProfile); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params.icm.workingProfile); lumimul[0] = wprof[1][0]; lumimul[1] = wprof[1][1]; @@ -956,18 +968,20 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb float cz, wh, pfl; int c16 = 1; + if (params->colorappearance.modelmethod == "02") { c16 = 1; - }else if (params->colorappearance.modelmethod == "16") { + } else if (params->colorappearance.modelmethod == "16") { c16 = 16; - } //I don't use PQ here...hence no 21 + } //I don't use PQ here...hence no 21 + float plum = 100.f; - Ciecam02::initcam1float (yb, pilot, f, la, xw, yw, zw, n, d, nbb, ncb, cz, aw, wh, pfl, fl, c, c16, plum); + Ciecam02::initcam1float(yb, pilot, f, la, xw, yw, zw, n, d, nbb, ncb, cz, aw, wh, pfl, fl, c, c16, plum); //printf ("wh=%f \n", wh); const float pow1 = pow_F(1.64f - pow_F(0.29f, n), 0.73f); float nj, nbbj, ncbj, czj, awj, flj; - Ciecam02::initcam2float (yb2, pilotout, f2, la2, xw2, yw2, zw2, nj, dj, nbbj, ncbj, czj, awj, flj, c16, plum); + Ciecam02::initcam2float(yb2, pilotout, f2, la2, xw2, yw2, zw2, nj, dj, nbbj, ncbj, czj, awj, flj, c16, plum); #ifdef __SSE2__ const float reccmcz = 1.f / (c2 * czj); #endif @@ -1011,7 +1025,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb //matrix for current working space - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.workingProfile); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.workingProfile); const float wip[3][3] = { { (float)wiprof[0][0], (float)wiprof[0][1], (float)wiprof[0][2]}, { (float)wiprof[1][0], (float)wiprof[1][1], (float)wiprof[1][2]}, @@ -1084,7 +1098,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb Q, M, s, aw, fl, wh, x, y, z, xw1, yw1, zw1, - c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); + c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); Jbuffer[k] = J; Cbuffer[k] = C; hbuffer[k] = h; @@ -1122,7 +1136,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb Q, M, s, aw, fl, wh, x, y, z, xw1, yw1, zw1, - c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); + c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); #endif float Jpro, Cpro, hpro, Qpro, Mpro, spro; Jpro = J; @@ -1132,6 +1146,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb Mpro = M; spro = s; bool jp = false; + if ((hasColCurve1) && (curveMode == ColorAppearanceParams::TcMode::BRIGHT)) { jp = true; float Qq = Qpro * coefQ; @@ -1141,6 +1156,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb Qq = Qq / coefQ; Qpro = 0.2f * (Qq - Qold) + Qold; } + if ((hasColCurve2) && (curveMode2 == ColorAppearanceParams::TcMode::BRIGHT)) { jp = true; float Qq2 = Qpro * coefQ; @@ -1149,10 +1165,12 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb userColCurveB2.Apply(Qq2); Qq2 = Qq2 / coefQ; Qpro = 0.2f * (Qq2 - Qold2) + Qold2; - } - if(jp) { + } + + if (jp) { Jpro = SQR((10.f * Qpro) / wh); } + // we cannot have all algorithms with all chroma curves if (alg == 0) { Jpro = CAMBrightCurveJ[Jpro * 327.68f]; //lightness CIECAM02 + contrast @@ -1240,73 +1258,73 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb } if (hasColCurve1 && (curveMode == ColorAppearanceParams::TcMode::LIGHT)) { - float Jj = (float) Jpro * 327.68f; - float Jold = Jj; - float Jold100 = (float) Jpro; - float redu = 25.f; - float reduc = 1.f; - const Lightcurve& userColCurveJ1 = static_cast(customColCurve1); - userColCurveJ1.Apply(Jj); + float Jj = (float) Jpro * 327.68f; + float Jold = Jj; + float Jold100 = (float) Jpro; + float redu = 25.f; + float reduc = 1.f; + const Lightcurve& userColCurveJ1 = static_cast(customColCurve1); + userColCurveJ1.Apply(Jj); - if (Jj > Jold) { - if (Jj < 65535.f) { - if (Jold < 327.68f * redu) { - Jj = 0.3f * (Jj - Jold) + Jold; //divide sensibility - } else { - reduc = LIM((100.f - Jold100) / (100.f - redu), 0.f, 1.f); - Jj = 0.3f * reduc * (Jj - Jold) + Jold; //reduct sensibility in highlights - } + if (Jj > Jold) { + if (Jj < 65535.f) { + if (Jold < 327.68f * redu) { + Jj = 0.3f * (Jj - Jold) + Jold; //divide sensibility + } else { + reduc = LIM((100.f - Jold100) / (100.f - redu), 0.f, 1.f); + Jj = 0.3f * reduc * (Jj - Jold) + Jold; //reduct sensibility in highlights } - } else if (Jj > 10.f) { - Jj = 0.8f * (Jj - Jold) + Jold; - } else if (Jj >= 0.f) { - Jj = 0.90f * (Jj - Jold) + Jold; // not zero ==>artifacts } + } else if (Jj > 10.f) { + Jj = 0.8f * (Jj - Jold) + Jold; + } else if (Jj >= 0.f) { + Jj = 0.90f * (Jj - Jold) + Jold; // not zero ==>artifacts + } - Jpro = (float)(Jj / 327.68f); + Jpro = (float)(Jj / 327.68f); - if (Jpro < 1.f) { - Jpro = 1.f; - } + if (Jpro < 1.f) { + Jpro = 1.f; + } } - if (hasColCurve2 && (curveMode2 == ColorAppearanceParams::TcMode::LIGHT)) { - float Jj = (float) Jpro * 327.68f; - float Jold = Jj; - float Jold100 = (float) Jpro; - float redu = 25.f; - float reduc = 1.f; - const Lightcurve& userColCurveJ2 = static_cast(customColCurve2); - userColCurveJ2.Apply(Jj); + if (hasColCurve2 && (curveMode2 == ColorAppearanceParams::TcMode::LIGHT)) { + float Jj = (float) Jpro * 327.68f; + float Jold = Jj; + float Jold100 = (float) Jpro; + float redu = 25.f; + float reduc = 1.f; + const Lightcurve& userColCurveJ2 = static_cast(customColCurve2); + userColCurveJ2.Apply(Jj); - if (Jj > Jold) { - if (Jj < 65535.f) { - if (Jold < 327.68f * redu) { - Jj = 0.3f * (Jj - Jold) + Jold; //divide sensibility - } else { - reduc = LIM((100.f - Jold100) / (100.f - redu), 0.f, 1.f); - Jj = 0.3f * reduc * (Jj - Jold) + Jold; //reduct sensibility in highlights - } - } - } else if (Jj > 10.f) { - if (!t1L) { - Jj = 0.8f * (Jj - Jold) + Jold; - } else { - Jj = 0.4f * (Jj - Jold) + Jold; - } - } else if (Jj >= 0.f) { - if (!t1L) { - Jj = 0.90f * (Jj - Jold) + Jold; // not zero ==>artifacts - } else { - Jj = 0.5f * (Jj - Jold) + Jold; + if (Jj > Jold) { + if (Jj < 65535.f) { + if (Jold < 327.68f * redu) { + Jj = 0.3f * (Jj - Jold) + Jold; //divide sensibility + } else { + reduc = LIM((100.f - Jold100) / (100.f - redu), 0.f, 1.f); + Jj = 0.3f * reduc * (Jj - Jold) + Jold; //reduct sensibility in highlights } } - - Jpro = (float)(Jj / 327.68f); - - if (Jpro < 1.f) { - Jpro = 1.f; + } else if (Jj > 10.f) { + if (!t1L) { + Jj = 0.8f * (Jj - Jold) + Jold; + } else { + Jj = 0.4f * (Jj - Jold) + Jold; } + } else if (Jj >= 0.f) { + if (!t1L) { + Jj = 0.90f * (Jj - Jold) + Jold; // not zero ==>artifacts + } else { + Jj = 0.5f * (Jj - Jold) + Jold; + } + } + + Jpro = (float)(Jj / 327.68f); + + if (Jpro < 1.f) { + Jpro = 1.f; + } } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness @@ -1456,47 +1474,33 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb #else float xx, yy, zz; //process normal==> viewing + TMatrix wprofc = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); + const double wpc[3][3] = {//improve precision with double + {wprofc[0][0], wprofc[0][1], wprofc[0][2]}, + {wprofc[1][0], wprofc[1][1], wprofc[1][2]}, + {wprofc[2][0], wprofc[2][1], wprofc[2][2]} + }; Ciecam02::jch2xyz_ciecam02float(xx, yy, zz, J, C, h, xw2, yw2, zw2, - c2, nc2, pow1n, nbbj, ncbj, flj, czj, dj, awj, c16, plum); + c2, nc2, pow1n, nbbj, ncbj, flj, czj, dj, awj, c16, plum); float x, y, z; x = xx * 655.35f; y = yy * 655.35f; z = zz * 655.35f; float Ll, aa, bb; + //convert xyz=>lab - Color::XYZ2Lab(x, y, z, Ll, aa, bb); - - // gamut control in Lab mode; I must study how to do with cIECAM only if (gamu == 1) { - float Lprov1, Chprov1; - Lprov1 = Ll / 327.68f; - Chprov1 = sqrtf(SQR(aa) + SQR(bb)) / 327.68f; - float2 sincosval; - - if (Chprov1 == 0.0f) { - sincosval.y = 1.f; - sincosval.x = 0.0f; - } else { - sincosval.y = aa / (Chprov1 * 327.68f); - sincosval.x = bb / (Chprov1 * 327.68f); - } - - - //gamut control : Lab values are in gamut - Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f); - lab->L[i][j] = Lprov1 * 327.68f; - lab->a[i][j] = 327.68f * Chprov1 * sincosval.y; - lab->b[i][j] = 327.68f * Chprov1 * sincosval.x; - - } else { - lab->L[i][j] = Ll; - lab->a[i][j] = aa; - lab->b[i][j] = bb; + Color::gamutmap(x, y, z, wpc); } + Color::XYZ2Lab(x, y, z, Ll, aa, bb); + lab->L[i][j] = Ll; + lab->a[i][j] = aa; + lab->b[i][j] = bb; + #endif } } @@ -1592,7 +1596,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb if (params->defringe.enabled) if (execsharp) { lab->deleteLab(); - defringecam (ncie);//defringe adapted to CIECAM + defringecam(ncie); //defringe adapted to CIECAM lab->reallocLab(); } @@ -1603,7 +1607,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb const bool hotbad = params->dirpyrequalizer.skinprotect != 0.0; lab->deleteLab(); - badpixcam (ncie, artifact / scale, 5, 2, chrom, hotbad); //enabled remove artifacts for cbDL + badpixcam(ncie, artifact / scale, 5, 2, chrom, hotbad); //enabled remove artifacts for cbDL lab->reallocLab(); } @@ -1611,7 +1615,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb if (params->colorappearance.badpixsl > 0 && execsharp) { int mode = params->colorappearance.badpixsl; lab->deleteLab(); - badpixcam (ncie, 3.0, 10, mode, 0, true);//for bad pixels CIECAM + badpixcam(ncie, 3.0, 10, mode, 0, true); //for bad pixels CIECAM lab->reallocLab(); } @@ -1620,17 +1624,17 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb buffers[0] = lab->L; buffers[1] = lab->a; buffers[2] = lab->b; - impulsedenoisecam (ncie, buffers); //impulse adapted to CIECAM + impulsedenoisecam(ncie, buffers); //impulse adapted to CIECAM } if (params->sharpenMicro.enabled)if (execsharp) { - MLmicrocontrastcam (ncie); + MLmicrocontrastcam(ncie); } if (params->sharpening.enabled) if (execsharp) { float **buffer = lab->L; // We can use the L-buffer from lab as buffer to save some memory - sharpeningcam (ncie, buffer, showSharpMask); // sharpening adapted to CIECAM + sharpeningcam(ncie, buffer, showSharpMask); // sharpening adapted to CIECAM } //if(params->dirpyrequalizer.enabled) if(execsharp) { @@ -1643,7 +1647,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb float t_l = static_cast(params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; float t_r = static_cast(params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; lab->deleteLab(); - dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, b_l, t_l, t_r, scale); //contrast by detail adapted to CIECAM + dirpyr_equalizercam(ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, b_l, t_l, t_r, scale); //contrast by detail adapted to CIECAM lab->reallocLab(); } @@ -1666,6 +1670,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb #ifdef _OPENMP #pragma omp for schedule(dynamic, 10) #endif + for (int i = 0; i < height; i++) // update CieImages with new values after sharpening, defringe, contrast by detail level for (int j = 0; j < width; j++) { float interm = fabsf(ncie->sh_p[i][j] / (32768.f)); @@ -1685,7 +1690,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb if (epdEnabled && params->colorappearance.tonecie && algepd) { lab->deleteLab(); - EPDToneMapCIE (ncie, a_w, c_, width, height, minQ, maxQ, Iterates, scale ); + EPDToneMapCIE(ncie, a_w, c_, width, height, minQ, maxQ, Iterates, scale); lab->reallocLab(); } @@ -1769,7 +1774,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb Ciecam02::jch2xyz_ciecam02float(xx, yy, zz, ncie->J_p[i][j], ncie_C_p, ncie->h_p[i][j], xw2, yw2, zw2, - c2, nc2, pow1n, nbbj, ncbj, flj, czj, dj, awj, c16, plum); + c2, nc2, pow1n, nbbj, ncbj, flj, czj, dj, awj, c16, plum); float x = (float)xx * 655.35f; float y = (float)yy * 655.35f; float z = (float)zz * 655.35f; @@ -1894,7 +1899,7 @@ void ImProcFunctions::moyeqt(Imagefloat* working, float &moyS, float &eqty) for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - const double s = Color::rgb2s(CLIP(working->r (i, j)), CLIP(working->g (i, j)), CLIP(working->b (i, j))); + const double s = Color::rgb2s(CLIP(working->r(i, j)), CLIP(working->g(i, j)), CLIP(working->b(i, j))); moy += s; sqrs += SQR(s); } @@ -1946,12 +1951,12 @@ filmlike_clip(float *r, float *g, float *b) } } -void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, const LUTf& hltonecurve, const LUTf& shtonecurve, const LUTf& tonecurve, - int sat, const LUTf& rCurve, const LUTf& gCurve, const LUTf& bCurve, float satLimit, float satLimitOpacity, - const ColorGradientCurve& ctColorCurve, const OpacityCurve& ctOpacityCurve, bool opautili, const LUTf& clToningcurve, const LUTf& cl2Toningcurve, - const ToneCurve& customToneCurve1, const ToneCurve& customToneCurve2, const ToneCurve& customToneCurvebw1, const ToneCurve& customToneCurvebw2, - double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfileApplyState& asIn, - LUTu& histToneCurve, size_t chunkSize, bool measure) +void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, const LUTf& hltonecurve, const LUTf& shtonecurve, const LUTf& tonecurve, + int sat, const LUTf& rCurve, const LUTf& gCurve, const LUTf& bCurve, float satLimit, float satLimitOpacity, + const ColorGradientCurve& ctColorCurve, const OpacityCurve& ctOpacityCurve, bool opautili, const LUTf& clToningcurve, const LUTf& cl2Toningcurve, + const ToneCurve& customToneCurve1, const ToneCurve& customToneCurve2, const ToneCurve& customToneCurvebw1, const ToneCurve& customToneCurvebw2, + double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfileApplyState& asIn, + LUTu& histToneCurve, size_t chunkSize, bool measure) { rgbProc(working, lab, pipetteBuffer, hltonecurve, shtonecurve, tonecurve, sat, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, @@ -1959,12 +1964,12 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } // Process RGB image and convert to LAB space -void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, const LUTf& hltonecurve, const LUTf& shtonecurve, const LUTf& tonecurve, - int sat, const LUTf& rCurve, const LUTf& gCurve, const LUTf& bCurve, float satLimit, float satLimitOpacity, - const ColorGradientCurve& ctColorCurve, const OpacityCurve& ctOpacityCurve, bool opautili, const LUTf& clToningcurve, const LUTf& cl2Toningcurve, - const ToneCurve& customToneCurve1, const ToneCurve& customToneCurve2, const ToneCurve& customToneCurvebw1, const ToneCurve& customToneCurvebw2, - double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, double expcomp, int hlcompr, int hlcomprthresh, - DCPProfile *dcpProf, const DCPProfileApplyState& asIn, LUTu& histToneCurve, size_t chunkSize, bool measure) +void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, const LUTf& hltonecurve, const LUTf& shtonecurve, const LUTf& tonecurve, + int sat, const LUTf& rCurve, const LUTf& gCurve, const LUTf& bCurve, float satLimit, float satLimitOpacity, + const ColorGradientCurve& ctColorCurve, const OpacityCurve& ctOpacityCurve, bool opautili, const LUTf& clToningcurve, const LUTf& cl2Toningcurve, + const ToneCurve& customToneCurve1, const ToneCurve& customToneCurve2, const ToneCurve& customToneCurvebw1, const ToneCurve& customToneCurvebw2, + double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, double expcomp, int hlcompr, int hlcomprthresh, + DCPProfile *dcpProf, const DCPProfileApplyState& asIn, LUTu& histToneCurve, size_t chunkSize, bool measure) { std::unique_ptr stop; @@ -1995,8 +2000,8 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } } - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params->icm.workingProfile); - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.workingProfile); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.workingProfile); float toxyz[3][3] = { { @@ -2150,13 +2155,13 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer PerceptualToneCurveState ptc1ApplyState, ptc2ApplyState; if (hasToneCurve1 && curveMode == ToneCurveMode::PERCEPTUAL) { - const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); - userToneCurve.initApplyState (ptc1ApplyState, params->icm.workingProfile); + const PerceptualToneCurve& userToneCurve = static_cast(customToneCurve1); + userToneCurve.initApplyState(ptc1ApplyState, params->icm.workingProfile); } if (hasToneCurve2 && curveMode2 == ToneCurveMode::PERCEPTUAL) { - const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); - userToneCurve.initApplyState (ptc2ApplyState, params->icm.workingProfile); + const PerceptualToneCurve& userToneCurve = static_cast(customToneCurve2); + userToneCurve.initApplyState(ptc2ApplyState, params->icm.workingProfile); } bool hasColorToning = params->colorToning.enabled && bool (ctOpacityCurve) && bool (ctColorCurve) && params->colorToning.method != "LabGrid"; @@ -2351,6 +2356,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } highlightToneCurve(hltonecurve, rtemp, gtemp, btemp, istart, tH, jstart, tW, TS, exp_scale, comp, hlrange); + if (params->toneCurve.black != 0.0) { shadowToneCurve(shtonecurve, rtemp, gtemp, btemp, istart, tH, jstart, tW, TS); } @@ -2402,7 +2408,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer float tmpg[4] ALIGNED16; float tmpb[4] ALIGNED16; - for (; j < tW - 3; j+=4, tj+=4) { + for (; j < tW - 3; j += 4, tj += 4) { //brightness/contrast STVF(tmpr[0], tonecurve(LVF(rtemp[ti * TS + tj]))); STVF(tmpg[0], tonecurve(LVF(gtemp[ti * TS + tj]))); @@ -2683,6 +2689,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer else if (params->colorToning.method == "Splitco") { constexpr float reducac = 0.3f; constexpr int mode = 0; + for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const float r = rtemp[ti * TS + tj]; @@ -3113,9 +3120,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer Color::RGB2Lab(&rtemp[ti * TS], >emp[ti * TS], &btemp[ti * TS], &(lab->L[i][jstart]), &(lab->a[i][jstart]), &(lab->b[i][jstart]), toxyz, tW - jstart); } - // if (hasColorToningLabGrid) { - // colorToningLabGrid(lab, jstart, tW, istart, tH, false); - // } + // if (hasColorToningLabGrid) { + // colorToningLabGrid(lab, jstart, tW, istart, tH, false); + // } } else { // black & white // Auto channel mixer needs whole image, so we now copy to tmpImage and close the tiled processing for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3494,9 +3501,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer for (int i = 0; i < tH; i++) { Color::RGB2Lab(tmpImage->r(i), tmpImage->g(i), tmpImage->b(i), lab->L[i], lab->a[i], lab->b[i], toxyz, tW); - // if (hasColorToningLabGrid) { - // colorToningLabGrid(lab, 0, tW, i, i + 1, false); - // } + // if (hasColorToningLabGrid) { + // colorToningLabGrid(lab, 0, tW, i, i + 1, false); + // } } @@ -3511,7 +3518,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (sCurveEnabled) { - delete sCurve; + delete sCurve; } if (vCurveEnabled) { @@ -3955,7 +3962,7 @@ void ImProcFunctions::toning2col(float r, float g, float b, float &ro, float &go * @param iplow iphigh [0..1] luminance * @param wp wip 3x3 matrix and inverse conversion rgb XYZ **/ -void ImProcFunctions::labtoning (float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, const LUTf & clToningcurve, const LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3] ) +void ImProcFunctions::labtoning(float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, const LUTf & clToningcurve, const LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3]) { ro = CLIP(r); go = CLIP(g); @@ -4014,7 +4021,7 @@ void ImProcFunctions::labtoning (float r, float g, float b, float &ro, float &go } -void ImProcFunctions::luminanceCurve (LabImage* lold, LabImage* lnew, const LUTf& curve) +void ImProcFunctions::luminanceCurve(LabImage* lold, LabImage* lnew, const LUTf& curve) { int W = lold->W; @@ -4034,7 +4041,7 @@ void ImProcFunctions::luminanceCurve (LabImage* lold, LabImage* lnew, const LUTf -void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, const LUTf& acurve, const LUTf& bcurve, const LUTf& satcurve, const LUTf& lhskcurve, const LUTf& clcurve, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLCurve) +void ImProcFunctions::chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, const LUTf& acurve, const LUTf& bcurve, const LUTf& satcurve, const LUTf& lhskcurve, const LUTf& clcurve, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLCurve) { int W = lold->W; int H = lold->H; @@ -4069,7 +4076,8 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW // !params->labCurve.enabled. It is ugly, but it's the smallest code // change that I could find //------------------------------------------------------------------------- - class TempParams { + class TempParams + { const ProcParams **p_; const ProcParams *old_; ProcParams tmp_; @@ -4091,11 +4099,13 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW bool pipette_for_colortoning_labregions = editPipette && params->colorToning.enabled && params->colorToning.method == "LabRegions"; + if (!params->labCurve.enabled && pipette_for_colortoning_labregions) { utili = autili = butili = ccutili = cclutili = clcutili = false; tempparams.reset(new TempParams(¶ms)); curve.makeIdentity(); } + //------------------------------------------------------------------------- @@ -4104,6 +4114,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW // fill pipette buffer with zeros to avoid crashes editWhatever->fill(0.f); } + if (params->blackwhite.enabled && !params->colorToning.enabled) { for (int i = 0; i < lnew->H; ++i) { for (int j = 0; j < lnew->W; ++j) { @@ -4111,6 +4122,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW } } } + return; } @@ -4172,7 +4184,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW // if(params->labCurve.avoidclip ){ // parameter to adapt curve C=f(C) to gamut - if (params->icm.workingProfile == "ProPhoto") { + if (params->icm.workingProfile == "ProPhoto") { adjustr = 1.2f; // 1.2 instead 1.0 because it's very rare to have C>170.. } else if (params->icm.workingProfile == "Adobe RGB") { adjustr = 1.8f; @@ -4203,7 +4215,22 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW const bool clut = clcutili; const double rstprotection = 100. - params->labCurve.rstprotection; // Red and Skin Tones Protection // avoid color shift is disabled when bwToning is activated and enabled if gamut is true in colorappearanace - const bool avoidColorShift = (params->labCurve.avoidcolorshift || (params->colorappearance.gamut && params->colorappearance.enabled)) && !bwToning ; + // const bool avoidColorShift = (params->labCurve.avoidcolorshift || (params->colorappearance.gamut && params->colorappearance.enabled)) && !bwToning ; + //const bool avoidColorS = params->labCurve.avoidcolorshift; + int gamutmuns = 0; + + if (params->labCurve.gamutmunselmethod == "NONE") { + gamutmuns = 0; + } else if (params->labCurve.gamutmunselmethod == "LAB") { + gamutmuns = 1; + } else if (params->labCurve.gamutmunselmethod == "XYZ") { + gamutmuns = 2; + } else if (params->labCurve.gamutmunselmethod == "XYZREL") { + gamutmuns = 3; + } else if (params->labCurve.gamutmunselmethod == "MUN") { + gamutmuns = 4; + } + const float protectRed = (float)settings->protectred; const double protectRedH = settings->protectredh; const float protect_red = rtengine::LIM(protectRed, 20.f, 180.f); //default=60 chroma: one can put more or less if necessary...in 'option' 40...160 @@ -4228,17 +4255,17 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW const float scaleConst = 100.0f / 100.1f; - const bool gamutLch = settings->gamutLch; + //const bool gamutLch = settings->gamutLch; const float amountchroma = (float) settings->amchroma; - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.workingProfile); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.workingProfile); const double wip[3][3] = { {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, {wiprof[2][0], wiprof[2][1], wiprof[2][2]} }; - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params->icm.workingProfile); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); const double wp[3][3] = { {wprof[0][0], wprof[0][1], wprof[0][2]}, {wprof[1][0], wprof[1][1], wprof[1][2]}, @@ -4258,12 +4285,12 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW #endif for (int i = 0; i < H; i++) { - if (avoidColorShift) + // if (avoidColorShift) - // only if user activate Lab adjustments - if (autili || butili || ccutili || cclutili || chutili || lhutili || hhutili || clcutili || utili || chromaticity) { - Color::LabGamutMunsell(lold->L[i], lold->a[i], lold->b[i], W, /*corMunsell*/true, /*lumaMuns*/false, params->toneCurve.hrenabled, /*gamut*/true, wip); - } + // only if user activate Lab adjustments + // if (autili || butili || ccutili || cclutili || chutili || lhutili || hhutili || clcutili || utili || chromaticity) { + // Color::LabGamutMunsell(lold->L[i], lold->a[i], lold->b[i], W, /*corMunsell*/true, /*lumaMuns*/false, params->toneCurve.hrenabled, /*gamut*/true, wip); + // } #ifdef __SSE2__ @@ -4277,7 +4304,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW av = LVFU(lold->a[i][k]); bv = LVFU(lold->b[i][k]); STVF(HHBuffer[k], xatan2f(bv, av)); - STVF (CCBuffer[k], vsqrtf (SQRV (av) + SQRV (bv)) / c327d68v); + STVF(CCBuffer[k], vsqrtf(SQRV(av) + SQRV(bv)) / c327d68v); } for (; k < W; k++) { @@ -4431,8 +4458,8 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW float fx = (0.002f * aprov1) + fy; float fz = fy - (0.005f * bprov1); - float x_ = 65535.f * Color::f2xyz (fx) * Color::D50x; - float z_ = 65535.f * Color::f2xyz (fz) * Color::D50z; + float x_ = 65535.f * Color::f2xyz(fx) * Color::D50x; + float z_ = 65535.f * Color::f2xyz(fz) * Color::D50z; float y_ = Lprov1 > Color::epskapf ? 65535.f * fy * fy * fy : 65535.f * Lprov1 / Color::kappaf; float R, G, B; Color::xyz2rgb(x_, y_, z_, R, G, B, wip); @@ -4704,24 +4731,57 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW btmp -= lold->b[i][j]; } - if (avoidColorShift) { - //gamutmap Lch ==> preserve Hue,but a little slower than gamutbdy for high values...and little faster for low values - if (gamutLch) { - float R, G, B; - //gamut control : Lab values are in gamut - Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f); - lnew->L[i][j] = Lprov1 * 327.68f; - lnew->a[i][j] = 327.68f * Chprov1 * sincosval.y; - lnew->b[i][j] = 327.68f * Chprov1 * sincosval.x; - } else { - //use gamutbdy - //Luv limiter - float Y, u, v; - Color::Lab2Yuv(lnew->L[i][j], atmp, btmp, Y, u, v); - //Yuv2Lab includes gamut restriction map - Color::Yuv2Lab(Y, u, v, lnew->L[i][j], lnew->a[i][j], lnew->b[i][j], wp); + lnew->L[i][j] = Lprov1 * 327.68f; + lnew->a[i][j] = 327.68f * Chprov1 * sincosval.y; + lnew->b[i][j] = 327.68f * Chprov1 * sincosval.x; + + //gamutmap Lch ==> preserve Hue,but a little slower than gamutbdy for high values...and little faster for low values + if (gamutmuns == 1) { + float R, G, B; + //gamut control : Lab values are in gamut + Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f); + lnew->L[i][j] = Lprov1 * 327.68f; + lnew->a[i][j] = 327.68f * Chprov1 * sincosval.y; + lnew->b[i][j] = 327.68f * Chprov1 * sincosval.x; + } + + if (gamutmuns == 2 || gamutmuns == 3) { + + float xg, yg, zg; + Color::Lab2XYZ(lnew->L[i][j], atmp, btmp, xg, yg, zg); + float x0 = xg; + float y0 = yg; + float z0 = zg; + + Color::gamutmap(xg, yg, zg, wp); + + if (gamutmuns == 3) {//0.5f arbitrary coeff + xg = xg + 0.5f * (x0 - xg); + yg = yg + 0.5f * (y0 - yg); + zg = zg + 0.5f * (z0 - zg); } + float Lag, aag2, bbg2; + Color::XYZ2Lab(xg, yg, zg, Lag, aag2, bbg2); + Lprov1 = Lag / 327.68f; + HH = xatan2f(bbg2, aag2); + Chprov1 = std::sqrt(SQR(aag2) + SQR(bbg2)) / 327.68f; + + if (Chprov1 == 0.0f) { + sincosval.y = 1.f; + sincosval.x = 0.0f; + } else { + sincosval.y = aag2 / (Chprov1 * 327.68f); + sincosval.x = bbg2 / (Chprov1 * 327.68f); + } + + lnew->L[i][j] = Lprov1 * 327.68f; + lnew->a[i][j] = 327.68f * Chprov1 * sincosval.y; + lnew->b[i][j] = 327.68f * Chprov1 * sincosval.x; + + } + + if (gamutmuns > 0) { if (utili || autili || butili || ccut || clut || cclutili || chutili || lhutili || hhutili || clcutili || chromaticity) { float correctionHue = 0.f; // Munsell's correction float correctlum = 0.f; @@ -4747,7 +4807,10 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW lnew->a[i][j] = 327.68f * Chprov * sincosval.y; // apply Munsell lnew->b[i][j] = 327.68f * Chprov * sincosval.x; } - } else { + } + + if (gamutmuns == 0) { + // if(Lprov1 > maxlp) maxlp=Lprov1; // if(Lprov1 < minlp) minlp=Lprov1; if (!bwToning) { @@ -4940,11 +5003,12 @@ void ImProcFunctions::EPDToneMapCIE(CieImage *ncie, float a_w, float c_, int Wid if (!params->epd.enabled) { return; } -/* - if (params->wavelet.enabled && params->wavelet.tmrs != 0) { - return; - } -*/ + + /* + if (params->wavelet.enabled && params->wavelet.tmrs != 0) { + return; + } + */ float stren = params->epd.strength; const float edgest = std::min(params->epd.edgeStopping, params->localContrast.enabled ? 3.0 : 4.0); float sca = params->epd.scale; @@ -4954,7 +5018,7 @@ void ImProcFunctions::EPDToneMapCIE(CieImage *ncie, float a_w, float c_, int Wid float *Qpr = ncie->Q_p[0]; if (settings->verbose) { - printf ("minQ=%f maxQ=%f Qpro=%f\n", static_cast(minQ), static_cast(maxQ), static_cast(Qpro)); + printf("minQ=%f maxQ=%f Qpro=%f\n", static_cast(minQ), static_cast(maxQ), static_cast(Qpro)); } if (maxQ > Qpro) { @@ -4993,6 +5057,7 @@ void ImProcFunctions::EPDToneMapCIE(CieImage *ncie, float a_w, float c_, int Wid #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,10) #endif + for (int i = 0; i < Hei; i++) for (int j = 0; j < Wid; j++) { ncie->Q_p[i][j] = (ncie->Q_p[i][j] * Qpro) / gamm; @@ -5043,7 +5108,7 @@ void ImProcFunctions::EPDToneMaplocal(int sp, LabImage *lab, LabImage *tmp1, uns float stren = ((float)params->locallab.spots.at(sp).stren); const float edgest = std::min(params->locallab.spots.at(sp).estop, params->localContrast.enabled ? 3.0 : 4.0); - + float sca = ((float)params->locallab.spots.at(sp).scaltm); float gamm = ((float)params->locallab.spots.at(sp).gamma); float satur = ((float)params->locallab.spots.at(sp).satur) / 100.f; @@ -5064,6 +5129,7 @@ void ImProcFunctions::EPDToneMaplocal(int sp, LabImage *lab, LabImage *tmp1, uns #ifdef _OPENMP #pragma omp parallel for reduction(max:maxL) reduction(min:minL) schedule(dynamic,16) #endif + for (std::size_t i = 0; i < N; i++) { minL = rtengine::min(minL, L[i]); maxL = rtengine::max(maxL, L[i]); @@ -5081,8 +5147,8 @@ void ImProcFunctions::EPDToneMaplocal(int sp, LabImage *lab, LabImage *tmp1, uns #ifdef _OPENMP #pragma omp parallel for #endif - for (std::size_t i = 0; i < N; i++) - { + + for (std::size_t i = 0; i < N; i++) { L[i] = (L[i] - minL) * mult; } @@ -5111,8 +5177,12 @@ void ImProcFunctions::EPDToneMaplocal(int sp, LabImage *lab, LabImage *tmp1, uns //Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping. float s = (1.0f + 38.7889f) * powf(Compression, 1.5856f) / (1.0f + 38.7889f * powf(Compression, 1.5856f)); float sat = s + 0.3f * s * satur; + //printf("s=%f sat=%f \n", s, sat); - if(sat == 1.f) sat = 1.001f; + if (sat == 1.f) { + sat = 1.001f; + } + #ifdef _OPENMP #pragma omp parallel for // removed schedule(dynamic,10) #endif @@ -5159,6 +5229,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip) #ifdef _OPENMP #pragma omp parallel for reduction(min:minL) reduction(max:maxL) #endif + for (size_t i = 1; i < N; i++) { minL = std::min(minL, L[i]); maxL = std::max(maxL, L[i]); @@ -5173,6 +5244,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip) #ifdef _OPENMP #pragma omp parallel for #endif + for (size_t i = 0; i < N; ++i) { L[i] = (L[i] - minL) * (gamm / maxL); } @@ -5186,7 +5258,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip) Iterates = edgest * 15.f; } - epd.CompressDynamicRange (L, sca / skip, edgest, Compression, DetailBoost, Iterates, rew); + epd.CompressDynamicRange(L, sca / skip, edgest, Compression, DetailBoost, Iterates, rew); //Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping. const float s = (1.f + 38.7889f) * std::pow(Compression, 1.5856f) / (1.f + 38.7889f * std::pow(Compression, 1.5856f)); @@ -5195,6 +5267,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip) #ifdef _OPENMP #pragma omp parallel for #endif + for (size_t ii = 0; ii < N; ++ii) { a[ii] *= s; b[ii] *= s; @@ -5242,7 +5315,7 @@ void ImProcFunctions::getAutoExp(const LUTu &histogram, int histcompr, double cl int j = 0; - for (; j < min ((int)ave, imax); ++j) { + for (; j < min((int)ave, imax); ++j) { if (count < 8) { octile[count] += histogram[j]; @@ -5335,7 +5408,7 @@ void ImProcFunctions::getAutoExp(const LUTu &histogram, int histcompr, double cl } //compute clipped white point - unsigned int clippable = (int) (static_cast(sum) * clip / 100.0 ); + unsigned int clippable = (int)(static_cast(sum) * clip / 100.0); clipped = 0; int whiteclip = (imax) - 1; @@ -5414,7 +5487,7 @@ void ImProcFunctions::getAutoExp(const LUTu &histogram, int histcompr, double cl contr = (int) 50.0f * (1.1f - ospread); contr = max(0, min(100, contr)); //take gamma into account - double whiteclipg = (int) (CurveFactory::gamma2(whiteclip * static_cast(corr) / 65536.0) * 65536.0); + double whiteclipg = (int)(CurveFactory::gamma2(whiteclip * static_cast(corr) / 65536.0) * 65536.0); float gavg = 0.; @@ -5594,7 +5667,8 @@ void ImProcFunctions::rgb2lab(const Imagefloat &src, LabImage &dst, const Glib:: } void ImProcFunctions::rgb2lab(const Image8 &src, int x, int y, int w, int h, float L[], float a[], float b[], const procparams::ColorManagementParams &icm, bool consider_histogram_settings) const -{ // Adapted from ImProcFunctions::lab2rgb +{ + // Adapted from ImProcFunctions::lab2rgb const int src_width = src.getWidth(); const int src_height = src.getHeight(); @@ -5626,6 +5700,7 @@ void ImProcFunctions::rgb2lab(const Image8 &src, int x, int y, int w, int h, flo if (icm.outputProfile.empty() || icm.outputProfile == ColorManagementParams::NoICMString) { profile = "sRGB"; } + oprof = ICCStore::getInstance()->getProfile(profile); } @@ -5638,7 +5713,7 @@ void ImProcFunctions::rgb2lab(const Image8 &src, int x, int y, int w, int h, flo lcmsMutex->lock(); cmsHPROFILE LabIProf = cmsCreateLab4Profile(nullptr); - cmsHTRANSFORM hTransform = cmsCreateTransform (oprof, TYPE_RGB_8, LabIProf, TYPE_Lab_FLT, icm.outputIntent, flags); + cmsHTRANSFORM hTransform = cmsCreateTransform(oprof, TYPE_RGB_8, LabIProf, TYPE_Lab_FLT, icm.outputIntent, flags); cmsCloseProfile(LabIProf); lcmsMutex->unlock(); @@ -5662,7 +5737,7 @@ void ImProcFunctions::rgb2lab(const Image8 &src, int x, int y, int w, int h, flo float* ra = a + (i - y) * w; float* rb = b + (i - y) * w; - cmsDoTransform (hTransform, src.data + ix, outbuffer, w); + cmsDoTransform(hTransform, src.data + ix, outbuffer, w); for (int j = 0; j < w; j++) { rL[j] = outbuffer[iy++] * 327.68f; @@ -5691,6 +5766,7 @@ void ImProcFunctions::rgb2lab(const Image8 &src, int x, int y, int w, int h, flo for (int i = y; i < y2; i++) { int offset = (i - y) * w; + for (int j = x; j < x2; j++) { float X, Y, Z; // lab2rgb uses gamma2curve, which is gammatab_srgb. @@ -5782,7 +5858,7 @@ void ImProcFunctions::colorToningLabGrid(LabImage *lab, int xstart, int xend, in float b_scale = (params->colorToning.labgridBHigh - params->colorToning.labgridBLow) / factor / scaling; float b_base = params->colorToning.labgridBLow / scaling; - #ifdef _OPENMP +#ifdef _OPENMP #pragma omp parallel for if (MultiThread) #endif diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 1be1d0371..36c571291 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -257,7 +257,7 @@ enum class BlurType { int shortcu, bool delt, const float hueref, const float chromaref, const float lumaref, float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, bool fftt, float blu_ma, float cont_ma, int indic, float &fab); - void avoidcolshi(const struct local_params& lp, int sp, LabImage * original, LabImage *transformed, int cy, int cx, int sk); + void avoidcolshi(const struct local_params& lp, int sp, LabImage *transformed, LabImage *reserved, int cy, int cx, int sk); void deltaEforMask(float **rdE, int bfw, int bfh, LabImage* bufcolorig, const float hueref, const float chromaref, const float lumaref, float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance, float balanceh); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 62f211ae6..bdc1b6db1 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -12540,12 +12540,31 @@ void ImProcFunctions::clarimerge(const struct local_params& lp, float &mL, float } } -void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImage * original, LabImage *transformed, int cy, int cx, int sk) +void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImage *transformed, LabImage *reserved, int cy, int cx, int sk) { - if (params->locallab.spots.at(sp).avoid && lp.islocal) { + int avoidgamut = 0; + + if (params->locallab.spots.at(sp).avoidgamutMethod == "NONE") { + avoidgamut = 0; + } else if (params->locallab.spots.at(sp).avoidgamutMethod == "LAB") { + avoidgamut = 1; + } else if (params->locallab.spots.at(sp).avoidgamutMethod == "XYZ") { + avoidgamut = 2; + } else if (params->locallab.spots.at(sp).avoidgamutMethod == "XYZREL") { + avoidgamut = 3; + } else if (params->locallab.spots.at(sp).avoidgamutMethod == "MUNS") { + avoidgamut = 4; + } + + if (avoidgamut == 0) { + return; + } + + if (avoidgamut > 0 && lp.islocal) { const float ach = lp.trans / 100.f; bool execmunsell = true; - if(params->locallab.spots.at(sp).expcie && (params->locallab.spots.at(sp).modecam == "all" || params->locallab.spots.at(sp).modecam == "jz" || params->locallab.spots.at(sp).modecam == "cam16")) { + + if (params->locallab.spots.at(sp).expcie && (params->locallab.spots.at(sp).modecam == "all" || params->locallab.spots.at(sp).modecam == "jz" || params->locallab.spots.at(sp).modecam == "cam16")) { execmunsell = false; } @@ -12556,11 +12575,18 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag {wiprof[2][0], wiprof[2][1], wiprof[2][2]} }; + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); + const double wp[3][3] = {//improve precision with double + {wprof[0][0], wprof[0][1], wprof[0][2]}, + {wprof[1][0], wprof[1][1], wprof[1][2]}, + {wprof[2][0], wprof[2][1], wprof[2][2]} + }; + const float softr = params->locallab.spots.at(sp).avoidrad;//max softr = 30 - const bool muns = params->locallab.spots.at(sp).avoidmun;//Munsell control with 200 LUT + // const bool muns = params->locallab.spots.at(sp).avoidmun;//Munsell control with 200 LUT //improve precision with mint and maxt const float tr = std::min(2.f, softr); - const float mint = 0.15f - 0.06f * tr;//between 0.15f and 0.03f + const float mint = 0.15f - 0.06f * tr;//between 0.15f and 0.03f const float maxt = 0.98f + 0.008f * tr;//between 0.98f and 0.996f const bool highlight = params->toneCurve.hrenabled; @@ -12581,6 +12607,7 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < transformed->H; y++) { const int loy = cy + y; const bool isZone0 = loy > lp.yc + lp.ly || loy < lp.yc - lp.lyT; // whole line is zone 0 => we can skip a lot of processing @@ -12640,7 +12667,7 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -12675,42 +12702,103 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag sincosval.y = aa / (Chprov1 * 327.68f); sincosval.x = bb / (Chprov1 * 327.68f); } + #endif + float lnew = transformed->L[y][x]; + float anew = transformed->a[y][x]; + float bnew = transformed->b[y][x]; + Lprov1 = lnew / 327.68f; + //HH = xatan2f(bnew, anew); - Color::pregamutlab(Lprov1, HH, chr); - Chprov1 = rtengine::min(Chprov1, chr); - if(!muns) { - float R, G, B; + if (avoidgamut == 1) { //Lab correction + + Color::pregamutlab(Lprov1, HH, chr); + Chprov1 = rtengine::min(Chprov1, chr); + + float R, G, B; Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, mint, maxt);//replace for best results - } - transformed->L[y][x] = Lprov1 * 327.68f; - transformed->a[y][x] = 327.68f * Chprov1 * sincosval.y; - transformed->b[y][x] = 327.68f * Chprov1 * sincosval.x; + lnew = Lprov1 * 327.68f; + anew = 327.68f * Chprov1 * sincosval.y; + bnew = 327.68f * Chprov1 * sincosval.x; + //HH = xatan2f(bnew, anew); + transformed->a[y][x] = anew; + transformed->b[y][x] = bnew; - if (needHH) { - const float Lprov2 = original->L[y][x] / 327.68f; + } else if (avoidgamut == 2 || avoidgamut == 3) { //XYZ correction + float xg, yg, zg; + const float aag = transformed->a[y][x];//anew + const float bbg = transformed->b[y][x];//bnew + float Lag = transformed->L[y][x]; + + Color::Lab2XYZ(Lag, aag, bbg, xg, yg, zg); + float x0 = xg; + float y0 = yg; + float z0 = zg; + + Color::gamutmap(xg, yg, zg, wp); + + if (avoidgamut == 3) {//0.5f arbitrary coeff + xg = xg + 0.5f * (x0 - xg); + yg = yg + 0.5f * (y0 - yg); + zg = zg + 0.5f * (z0 - zg); + } + + //Color::gamutmap(xg, yg, zg, wp);//Put XYZ in gamut wp + float aag2, bbg2; + Color::XYZ2Lab(xg, yg, zg, Lag, aag2, bbg2); + Lprov1 = Lag / 327.68f; + HH = xatan2f(bbg2, aag2);//rebuild HH in case of...absolute colorimetry + Chprov1 = std::sqrt(SQR(aag2) + SQR(bbg2)) / 327.68f; + + if (Chprov1 == 0.0f) { + sincosval.y = 1.f; + sincosval.x = 0.0f; + } else { + sincosval.y = aag2 / (Chprov1 * 327.68f); + sincosval.x = bbg2 / (Chprov1 * 327.68f); + } + + lnew = Lprov1 * 327.68f; + anew = 327.68f * Chprov1 * sincosval.y; + bnew = 327.68f * Chprov1 * sincosval.x; + transformed->a[y][x] = anew; + transformed->b[y][x] = bnew; + + } + + if (needHH && avoidgamut <= 4) {//Munsell + Lprov1 = lnew / 327.68f; + float Chprov = sqrt(SQR(anew) + SQR(bnew)) / 327.68f; + + const float Lprov2 = reserved->L[y][x] / 327.68f; float correctionHue = 0.f; // Munsell's correction float correctlum = 0.f; - const float memChprov = std::sqrt(SQR(original->a[y][x]) + SQR(original->b[y][x])) / 327.68f; - float Chprov = std::sqrt(SQR(transformed->a[y][x]) + SQR(transformed->b[y][x])) / 327.68f; - if(execmunsell) { + const float memChprov = std::sqrt(SQR(reserved->a[y][x]) + SQR(reserved->b[y][x])) / 327.68f; + + if (execmunsell) { Color::AllMunsellLch(true, Lprov1, Lprov2, HH, Chprov, memChprov, correctionHue, correctlum); } - if (std::fabs(correctionHue) < 0.015f) { - HH += correctlum; // correct only if correct Munsell chroma very small. + if (correctionHue != 0.f || correctlum != 0.f) { + + if (std::fabs(correctionHue) < 0.015f) { + HH += correctlum; // correct only if correct Munsell chroma very small. + } + + sincosval = xsincosf(HH + correctionHue); } - sincosval = xsincosf(HH + correctionHue); - transformed->a[y][x] = 327.68f * Chprov * sincosval.y; // apply Munsell - transformed->b[y][x] = 327.68f * Chprov * sincosval.x; + anew = 327.68f * Chprov * sincosval.y; // apply Munsell + bnew = 327.68f * Chprov * sincosval.x; + transformed->a[y][x] = anew; // apply Munsell + transformed->b[y][x] = bnew; } } } } - //Guidedfilter to reduce artifacts in transitions - if (softr != 0.f) {//soft for L a b because we change color... + //Guidedfilter to reduce artifacts in transitions : case Lab + if (softr != 0.f && avoidgamut == 1) {//soft for L a b because we change color... const float tmpblur = softr < 0.f ? -1.f / softr : 1.f + softr; const int r1 = rtengine::max(6 / sk * tmpblur + 0.5f, 1); const int r2 = rtengine::max(10 / sk * tmpblur + 0.5f, 1); @@ -12734,13 +12822,15 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag for (int y = 0; y < bh ; y++) { for (int x = 0; x < bw; x++) { ble[y][x] = transformed->L[y][x] / 32768.f; - guid[y][x] = original->L[y][x] / 32768.f; + guid[y][x] = reserved->L[y][x] / 32768.f; } } + rtengine::guidedFilter(guid, ble, ble, r2, 0.2f * epsil, multiThread); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bh; y++) { for (int x = 0; x < bw; x++) { transformed->L[y][x] = 32768.f * ble[y][x]; @@ -12757,11 +12847,13 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag blechro[y][x] = std::sqrt(SQR(transformed->b[y][x]) + SQR(transformed->a[y][x])) / 32768.f; } } + rtengine::guidedFilter(guid, blechro, blechro, r1, epsil, multiThread); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bh; y++) { for (int x = 0; x < bw; x++) { const float Chprov1 = std::sqrt(SQR(transformed->a[y][x]) + SQR(transformed->b[y][x])); @@ -13286,7 +13378,7 @@ void ImProcFunctions::Lab_Local( struct local_params lp; calcLocalParams(sp, oW, oH, params->locallab, lp, prevDeltaE, llColorMask, llColorMaskinv, llExpMask, llExpMaskinv, llSHMask, llSHMaskinv, llvibMask, lllcMask, llsharMask, llcbMask, llretiMask, llsoftMask, lltmMask, llblMask, lllogMask, ll_Mask, llcieMask, locwavCurveden, locwavdenutili); - avoidcolshi(lp, sp, original, transformed, cy, cx, sk); + //avoidcolshi(lp, sp, transformed, reserved, cy, cx, sk); const float radius = lp.rad / (sk * 1.4); //0 to 70 ==> see skip int levred; @@ -19188,7 +19280,7 @@ void ImProcFunctions::Lab_Local( // Gamut and Munsell control - very important do not deactivated to avoid crash - avoidcolshi(lp, sp, original, transformed, cy, cx, sk); + avoidcolshi(lp, sp, transformed, reserved, cy, cx, sk); } } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index a83419559..13df614dc 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -137,7 +137,7 @@ enum ProcEventCode { EvHLComprThreshold = 107, EvResizeBoundingBox = 108, EvResizeAppliesTo = 109, - EvLAvoidColorShift = 110, + //EvLAvoidColorShift = 110, obsolete_111 = 111, // obsolete EvLRSTProtection = 112, EvDemosaicDCBIter = 113, @@ -617,7 +617,7 @@ enum ProcEventCode { Evlocallabadjblur = 587, Evlocallabbilateral = 588, Evlocallabsensiden = 589, - Evlocallabavoid = 590, + // Evlocallabavoid = 590, Evlocallabsharcontrast = 591, EvLocenacontrast = 592, Evlocallablcradius = 593, @@ -1067,7 +1067,7 @@ enum ProcEventCode { Evlocallabnlgam = 1037, Evlocallabdivgr = 1038, EvLocallabSpotavoidrad = 1039, - EvLocallabSpotavoidmun = 1040, + //EvLocallabSpotavoidmun = 1040, Evlocallabcontthres = 1041, Evlocallabnorm = 1042, Evlocallabreparw = 1043, diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 371731b93..e6bdc9619 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -608,7 +608,7 @@ LCurveParams::LCurveParams() : brightness(0), contrast(0), chromaticity(0), - avoidcolorshift(false), + gamutmunselmethod("MUN"), rstprotection(0), lcredsk(true) { @@ -630,7 +630,7 @@ bool LCurveParams::operator ==(const LCurveParams& other) const && brightness == other.brightness && contrast == other.contrast && chromaticity == other.chromaticity - && avoidcolorshift == other.avoidcolorshift + && gamutmunselmethod == other.gamutmunselmethod && rstprotection == other.rstprotection && lcredsk == other.lcredsk; } @@ -2848,6 +2848,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : structexclu(0), struc(4.0), shapeMethod("IND"), + avoidgamutMethod("MUNS"), loc{150, 150, 150, 150}, centerX(0), centerY(0), @@ -2862,13 +2863,11 @@ LocallabParams::LocallabSpot::LocallabSpot() : balanh(1.0), colorde(5.0), colorscope(30.0), - avoidrad(0.7), + avoidrad(0.), transitweak(1.0), transitgrad(0.0), hishow(false), activ(true), - avoid(false), - avoidmun(false), blwh(false), recurs(false), laplac(true), @@ -4560,6 +4559,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && structexclu == other.structexclu && struc == other.struc && shapeMethod == other.shapeMethod + && avoidgamutMethod == other.avoidgamutMethod && loc == other.loc && centerX == other.centerX && centerY == other.centerY @@ -4579,8 +4579,6 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && transitgrad == other.transitgrad && hishow == other.hishow && activ == other.activ - && avoid == other.avoid - && avoidmun == other.avoidmun && blwh == other.blwh && recurs == other.recurs && laplac == other.laplac @@ -6045,7 +6043,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->labCurve.brightness, "Luminance Curve", "Brightness", labCurve.brightness, keyFile); saveToKeyfile(!pedited || pedited->labCurve.contrast, "Luminance Curve", "Contrast", labCurve.contrast, keyFile); saveToKeyfile(!pedited || pedited->labCurve.chromaticity, "Luminance Curve", "Chromaticity", labCurve.chromaticity, keyFile); - saveToKeyfile(!pedited || pedited->labCurve.avoidcolorshift, "Luminance Curve", "AvoidColorShift", labCurve.avoidcolorshift, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.gamutmunselmethod, "Luminance Curve", "Gamutmunse", labCurve.gamutmunselmethod, keyFile); saveToKeyfile(!pedited || pedited->labCurve.rstprotection, "Luminance Curve", "RedAndSkinTonesProtection", labCurve.rstprotection, keyFile); saveToKeyfile(!pedited || pedited->labCurve.lcredsk, "Luminance Curve", "LCredsk", labCurve.lcredsk, keyFile); saveToKeyfile(!pedited || pedited->labCurve.lcurve, "Luminance Curve", "LCurve", labCurve.lcurve, keyFile); @@ -6347,6 +6345,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->structexclu, "Locallab", "StructExclu_" + index_str, spot.structexclu, keyFile); saveToKeyfile(!pedited || spot_edited->struc, "Locallab", "Struc_" + index_str, spot.struc, keyFile); saveToKeyfile(!pedited || spot_edited->shapeMethod, "Locallab", "ShapeMethod_" + index_str, spot.shapeMethod, keyFile); + saveToKeyfile(!pedited || spot_edited->avoidgamutMethod, "Locallab", "AvoidgamutMethod_" + index_str, spot.avoidgamutMethod, keyFile); saveToKeyfile(!pedited || spot_edited->loc, "Locallab", "Loc_" + index_str, spot.loc, keyFile); saveToKeyfile(!pedited || spot_edited->centerX, "Locallab", "CenterX_" + index_str, spot.centerX, keyFile); saveToKeyfile(!pedited || spot_edited->centerY, "Locallab", "CenterY_" + index_str, spot.centerY, keyFile); @@ -6366,8 +6365,6 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->transitgrad, "Locallab", "Transitgrad_" + index_str, spot.transitgrad, keyFile); saveToKeyfile(!pedited || spot_edited->hishow, "Locallab", "Hishow_" + index_str, spot.hishow, keyFile); saveToKeyfile(!pedited || spot_edited->activ, "Locallab", "Activ_" + index_str, spot.activ, keyFile); - saveToKeyfile(!pedited || spot_edited->avoid, "Locallab", "Avoid_" + index_str, spot.avoid, keyFile); - saveToKeyfile(!pedited || spot_edited->avoidmun, "Locallab", "Avoidmun_" + index_str, spot.avoidmun, keyFile); saveToKeyfile(!pedited || spot_edited->blwh, "Locallab", "Blwh_" + index_str, spot.blwh, keyFile); saveToKeyfile(!pedited || spot_edited->recurs, "Locallab", "Recurs_" + index_str, spot.recurs, keyFile); saveToKeyfile(!pedited || spot_edited->laplac, "Locallab", "Laplac_" + index_str, spot.laplac, keyFile); @@ -7871,7 +7868,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) // if Saturation == 0, should we set BWToning on? assignFromKeyfile(keyFile, "Luminance Curve", "Saturation", pedited, labCurve.chromaticity, pedited->labCurve.chromaticity); // transform AvoidColorClipping into AvoidColorShift - assignFromKeyfile(keyFile, "Luminance Curve", "AvoidColorClipping", pedited, labCurve.avoidcolorshift, pedited->labCurve.avoidcolorshift); +// assignFromKeyfile(keyFile, "Luminance Curve", "AvoidColorClipping", pedited, labCurve.avoidcolorshift, pedited->labCurve.avoidcolorshift); } else { if (keyFile.has_key("Luminance Curve", "Chromaticity")) { labCurve.chromaticity = keyFile.get_integer("Luminance Curve", "Chromaticity"); @@ -7885,7 +7882,6 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) } } - assignFromKeyfile(keyFile, "Luminance Curve", "AvoidColorShift", pedited, labCurve.avoidcolorshift, pedited->labCurve.avoidcolorshift); assignFromKeyfile(keyFile, "Luminance Curve", "RedAndSkinTonesProtection", pedited, labCurve.rstprotection, pedited->labCurve.rstprotection); } @@ -7914,6 +7910,25 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Luminance Curve", "hhCurve", pedited, labCurve.hhcurve, pedited->labCurve.hhcurve); assignFromKeyfile(keyFile, "Luminance Curve", "LcCurve", pedited, labCurve.lccurve, pedited->labCurve.lccurve); assignFromKeyfile(keyFile, "Luminance Curve", "ClCurve", pedited, labCurve.clcurve, pedited->labCurve.clcurve); + if (keyFile.has_key("Luminance Curve", "Gamutmunse")) { + assignFromKeyfile(keyFile, "Luminance Curve", "Gamutmunse", pedited, labCurve.gamutmunselmethod, pedited->labCurve.gamutmunselmethod); + } else { + if (ppVersion < 303) { + if (keyFile.has_key("Luminance Curve", "AvoidColorClipping")) { + labCurve.gamutmunselmethod = + keyFile.get_boolean("Luminance Curve", "AvoidColorClipping") ? "LAB" : "NONE"; + if (pedited) { + pedited->labCurve.gamutmunselmethod = true; + } + } + } else if (keyFile.has_key("Luminance Curve", "AvoidColorShift")) { + labCurve.gamutmunselmethod = + keyFile.get_boolean("Luminance Curve", "AvoidColorShift") ? "LAB" : "NONE"; + if (pedited) { + pedited->labCurve.gamutmunselmethod = true; + } + } + } } if (keyFile.has_group("Sharpening")) { @@ -8423,6 +8438,16 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "StructExclu_" + index_str, pedited, spot.structexclu, spotEdited.structexclu); assignFromKeyfile(keyFile, "Locallab", "Struc_" + index_str, pedited, spot.struc, spotEdited.struc); assignFromKeyfile(keyFile, "Locallab", "ShapeMethod_" + index_str, pedited, spot.shapeMethod, spotEdited.shapeMethod); + if (keyFile.has_key("Locallab", "AvoidgamutMethod_" + index_str)) { + assignFromKeyfile(keyFile, "Locallab", "AvoidgamutMethod_" + index_str, pedited, spot.avoidgamutMethod, spotEdited.avoidgamutMethod); + } else if (keyFile.has_key("Locallab", "Avoid_" + index_str)) { + const bool avoid = keyFile.get_boolean("Locallab", "Avoid_" + index_str); + const bool munsell = keyFile.has_key("Locallab", "Avoidmun_" + index_str) && keyFile.get_boolean("Locallab", "Avoidmun_" + index_str); + spot.avoidgamutMethod = avoid ? (munsell ? "MUNS" : "LAB") : "NONE"; + if (pedited) { + spotEdited.avoidgamutMethod = true; + } + } assignFromKeyfile(keyFile, "Locallab", "Loc_" + index_str, pedited, spot.loc, spotEdited.loc); assignFromKeyfile(keyFile, "Locallab", "CenterX_" + index_str, pedited, spot.centerX, spotEdited.centerX); assignFromKeyfile(keyFile, "Locallab", "CenterY_" + index_str, pedited, spot.centerY, spotEdited.centerY); @@ -8442,8 +8467,6 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Transitgrad_" + index_str, pedited, spot.transitgrad, spotEdited.transitgrad); assignFromKeyfile(keyFile, "Locallab", "Hishow_" + index_str, pedited, spot.hishow, spotEdited.hishow); assignFromKeyfile(keyFile, "Locallab", "Activ_" + index_str, pedited, spot.activ, spotEdited.activ); - assignFromKeyfile(keyFile, "Locallab", "Avoid_" + index_str, pedited, spot.avoid, spotEdited.avoid); - assignFromKeyfile(keyFile, "Locallab", "Avoidmun_" + index_str, pedited, spot.avoidmun, spotEdited.avoidmun); assignFromKeyfile(keyFile, "Locallab", "Blwh_" + index_str, pedited, spot.blwh, spotEdited.blwh); assignFromKeyfile(keyFile, "Locallab", "Recurs_" + index_str, pedited, spot.recurs, spotEdited.recurs); assignFromKeyfile(keyFile, "Locallab", "Laplac_" + index_str, pedited, spot.laplac, spotEdited.laplac); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 24e1ca036..e86272b0a 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -376,7 +376,7 @@ struct LCurveParams { int brightness; int contrast; int chromaticity; - bool avoidcolorshift; + Glib::ustring gamutmunselmethod; double rstprotection; bool lcredsk; @@ -1019,6 +1019,8 @@ struct LocallabParams { int structexclu; double struc; Glib::ustring shapeMethod; // IND, SYM, INDSL, SYMSL + Glib::ustring avoidgamutMethod; // NONE, LAB, XYZ + std::vector loc; // For ellipse/rectangle: {locX, locXL, locY, locYT} int centerX; int centerY; @@ -1038,8 +1040,6 @@ struct LocallabParams { double transitgrad; bool hishow; bool activ; - bool avoid; - bool avoidmun; bool blwh; bool recurs; bool laplac; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index d45283c38..3916adfbe 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -1185,8 +1185,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { AUTOEXP, //Evlocallabforcebw AUTOEXP, //Evlocallabsigjz AUTOEXP, //Evlocallabsigq - AUTOEXP //Evlocallablogcie - + AUTOEXP //Evlocallablogcie }; diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index 7fcc45312..d869903b5 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -49,7 +49,8 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB metHBox->set_spacing (2); Gtk::Label* metLabel = Gtk::manage (new Gtk::Label (M("TP_BWMIX_MET") + ":")); metHBox->pack_start (*metLabel, Gtk::PACK_SHRINK); - method = Gtk::manage (new MyComboBoxText ()); + + method = Gtk::manage (new MyComboBoxText ()); method->append (M("TP_BWMIX_MET_DESAT")); method->append (M("TP_BWMIX_MET_LUMEQUAL")); method->append (M("TP_BWMIX_MET_CHANMIX")); diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 0d57d98bb..60fde12a6 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -24,6 +24,7 @@ #include "options.h" #include "../rtengine/procparams.h" #include "rtimage.h" +#include "eventmapper.h" using namespace rtengine; using namespace procparams; @@ -55,6 +56,7 @@ ControlSpotPanel::ControlSpotPanel(): qualityMethod_(Gtk::manage(new MyComboBoxText())), //complexMethod_(Gtk::manage(new MyComboBoxText())), wavMethod_(Gtk::manage(new MyComboBoxText())), + avoidgamutMethod_(Gtk::manage(new MyComboBoxText())), sensiexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIEXCLU"), 0, 100, 1, 12))), structexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), @@ -76,15 +78,13 @@ ControlSpotPanel::ControlSpotPanel(): balanh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALANH"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16.png")), Gtk::manage(new RTImage("circle-red-green-small.png"))))), colorde_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORDE"), -15, 15, 2, 5, Gtk::manage(new RTImage("circle-blue-yellow-small.png")), Gtk::manage(new RTImage("circle-gray-green-small.png"))))), colorscope_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORSCOPE"), 0., 100.0, 1., 30.))), - avoidrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_AVOIDRAD"), 0., 30.0, 0.1, 0.7))), + avoidrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_AVOIDRAD"), 0., 30.0, 0.1, 0.))), scopemask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCOPEMASK"), 0, 100, 1, 60))), denoichmask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DENOIMASK"), 0., 100., 0.5, 0))), lumask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LUMASK"), -50, 30, 1, 10, Gtk::manage(new RTImage("circle-yellow-small.png")), Gtk::manage(new RTImage("circle-gray-small.png")) ))), hishow_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_PREVSHOW")))), activ_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ACTIVSPOT")))), - avoid_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AVOID")))), - avoidmun_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AVOIDMUN")))), blwh_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_BLWH")))), recurs_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_RECURS")))), laplac_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LAPLACC")))), @@ -100,6 +100,7 @@ ControlSpotPanel::ControlSpotPanel(): preview_(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), ctboxshape(Gtk::manage(new Gtk::Box())), ctboxshapemethod(Gtk::manage(new Gtk::Box())), + ctboxgamut(Gtk::manage(new Gtk::Box())), controlPanelListener(nullptr), lastObject_(-1), @@ -111,6 +112,8 @@ ControlSpotPanel::ControlSpotPanel(): excluFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_EXCLUF")))), maskPrevActive(false) { + auto m = ProcEventMapper::getInstance(); + EvLocallabavoidgamutMethod = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_GAMUTMUNSEL"); const bool showtooltip = options.showtooltip; pack_start(*hishow_); @@ -397,23 +400,30 @@ ControlSpotPanel::ControlSpotPanel(): activConn_ = activ_->signal_toggled().connect( sigc::mem_fun(*this, &ControlSpotPanel::activChanged)); - avoidConn_ = avoid_->signal_toggled().connect( - sigc::mem_fun(*this, &ControlSpotPanel::avoidChanged)); - avoidmunConn_ = avoidmun_->signal_toggled().connect( - sigc::mem_fun(*this, &ControlSpotPanel::avoidmunChanged)); - - Gtk::Frame* const avFrame = Gtk::manage(new Gtk::Frame()); + Gtk::Label* const labelgamut = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_AVOID") + ":")); + ctboxgamut->pack_start(*labelgamut, Gtk::PACK_SHRINK, 4); + avoidgamutMethod_->append(M("TP_LOCALLAB_GAMUTNON")); + avoidgamutMethod_->append(M("TP_LOCALLAB_GAMUTLABRELA")); + avoidgamutMethod_->append(M("TP_LOCALLAB_GAMUTXYZABSO")); + avoidgamutMethod_->append(M("TP_LOCALLAB_GAMUTXYZRELA")); + avoidgamutMethod_->append(M("TP_LOCALLAB_GAMUTMUNSELL")); + avoidgamutMethod_->set_active(4); + avoidgamutconn_ = avoidgamutMethod_->signal_changed().connect( + sigc::mem_fun( + *this, &ControlSpotPanel::avoidgamutMethodChanged)); + ctboxgamut->pack_start(*avoidgamutMethod_); + if (showtooltip) { + ctboxgamut->set_tooltip_text(M("TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP")); + } + + Gtk::Frame* const avFrame = Gtk::manage(new Gtk::Frame()); ToolParamBlock* const avbox = Gtk::manage(new ToolParamBlock()); avFrame->set_label_align(0.025, 0.5); - avFrame->set_label_widget(*avoid_); + avbox->pack_start(*ctboxgamut); avbox->pack_start(*avoidrad_); - avbox->pack_start(*avoidmun_); avFrame->add(*avbox); specCaseBox->pack_start(*avFrame); - if (showtooltip) { - avoidmun_->set_tooltip_text(M("TP_LOCALLAB_AVOIDMUN_TOOLTIP")); - } blwhConn_ = blwh_->signal_toggled().connect( sigc::mem_fun(*this, &ControlSpotPanel::blwhChanged)); @@ -429,7 +439,6 @@ ControlSpotPanel::ControlSpotPanel(): if (showtooltip) { recurs_->set_tooltip_text(M("TP_LOCALLAB_RECURS_TOOLTIP")); - avoid_->set_tooltip_text(M("TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP")); } specCaseBox->pack_start(*recurs_); @@ -854,8 +863,6 @@ void ControlSpotPanel::load_ControlSpot_param() avoidrad_->setValue((double)row[spots_.avoidrad]); hishow_->set_active(row[spots_.hishow]); activ_->set_active(row[spots_.activ]); - avoid_->set_active(row[spots_.avoid]); - avoidmun_->set_active(row[spots_.avoidmun]); blwh_->set_active(row[spots_.blwh]); recurs_->set_active(row[spots_.recurs]); // laplac_->set_active(row[spots_.laplac]); @@ -868,6 +875,8 @@ void ControlSpotPanel::load_ControlSpot_param() //savrest_->set_active(row[spots_.savrest]); //complexMethod_->set_active(row[spots_.complexMethod]); wavMethod_->set_active(row[spots_.wavMethod]); + avoidgamutMethod_->set_active(row[spots_.avoidgamutMethod]); + } void ControlSpotPanel::controlspotChanged() @@ -1055,6 +1064,34 @@ void ControlSpotPanel::spotMethodChanged() } } +void ControlSpotPanel::avoidgamutMethodChanged() +{ + + // Get selected control spot + const auto s = treeview_->get_selection(); + + if (!s->count_selected_rows()) { + return; + } + const int meth = avoidgamutMethod_->get_active_row_number(); + avoidrad_->show(); + + if(meth == 2 || meth == 3 || meth == 4) { + avoidrad_->hide(); + } + + const auto iter = s->get_selected(); + Gtk::TreeModel::Row row = *iter; + + row[spots_.avoidgamutMethod] = avoidgamutMethod_->get_active_row_number(); + + // Raise event + if (listener) { + listener->panelChanged(EvLocallabavoidgamutMethod, avoidgamutMethod_->get_active_text()); + } + +} + void ControlSpotPanel::shapeMethodChanged() { // printf("shapeMethodChanged\n"); @@ -1217,6 +1254,7 @@ void ControlSpotPanel::updateParamVisibility() // Update Control Spot GUI according to shapeMethod_ combobox state (to be compliant with shapeMethodChanged function) const int method = shapeMethod_->get_active_row_number(); + const int meth = avoidgamutMethod_->get_active_row_number(); if (!batchMode) { if (method == 1 || method == 3) { // Symmetrical cases @@ -1260,6 +1298,12 @@ void ControlSpotPanel::updateParamVisibility() centerY_->show(); } + if(meth == 1) { + avoidrad_->show(); + } else { + avoidrad_->hide(); +} + // Update Control Spot GUI according to spotMethod_ combobox state (to be compliant with spotMethodChanged function) if (multiImage && spotMethod_->get_active_text() == M("GENERAL_UNCHANGED")) { excluFrame->show(); @@ -1588,57 +1632,6 @@ void ControlSpotPanel::hishowChanged() } - -void ControlSpotPanel::avoidChanged() -{ - // printf("avoidChanged\n"); - - // Get selected control spot - const auto s = treeview_->get_selection(); - - if (!s->count_selected_rows()) { - return; - } - - const auto iter = s->get_selected(); - Gtk::TreeModel::Row row = *iter; - row[spots_.avoid] = avoid_->get_active(); - - // Raise event - if (listener) { - if (avoid_->get_active()) { - listener->panelChanged(Evlocallabavoid, M("GENERAL_ENABLED")); - } else { - listener->panelChanged(Evlocallabavoid, M("GENERAL_DISABLED")); - } - } -} - -void ControlSpotPanel::avoidmunChanged() -{ - // printf("avoidmunChanged\n"); - - // Get selected control spot - const auto s = treeview_->get_selection(); - - if (!s->count_selected_rows()) { - return; - } - - const auto iter = s->get_selected(); - Gtk::TreeModel::Row row = *iter; - row[spots_.avoidmun] = avoidmun_->get_active(); - - // Raise event - if (listener) { - if (avoidmun_->get_active()) { - listener->panelChanged(EvLocallabSpotavoidmun, M("GENERAL_ENABLED")); - } else { - listener->panelChanged(EvLocallabSpotavoidmun, M("GENERAL_DISABLED")); - } - } -} - void ControlSpotPanel::activChanged() { // printf("activChanged\n"); @@ -1859,8 +1852,6 @@ void ControlSpotPanel::disableParamlistener(bool cond) avoidrad_->block(cond); hishowconn_.block(cond); activConn_.block(cond); - avoidConn_.block(cond); - avoidmunConn_.block(cond); blwhConn_.block(cond); recursConn_.block(cond); laplacConn_.block(cond); @@ -1872,6 +1863,8 @@ void ControlSpotPanel::disableParamlistener(bool cond) //savrestConn_.block(cond); //complexMethodconn_.block(cond); wavMethodconn_.block(cond); + avoidgamutconn_.block(cond); + } void ControlSpotPanel::setParamEditable(bool cond) @@ -1906,8 +1899,6 @@ void ControlSpotPanel::setParamEditable(bool cond) avoidrad_->set_sensitive(cond); hishow_->set_sensitive(cond); activ_->set_sensitive(cond); - avoid_->set_sensitive(cond); - avoidmun_->set_sensitive(cond); blwh_->set_sensitive(cond); recurs_->set_sensitive(cond); laplac_->set_sensitive(cond); @@ -1920,6 +1911,7 @@ void ControlSpotPanel::setParamEditable(bool cond) //complexMethod_->set_sensitive(cond); wavMethod_->set_sensitive(cond); preview_->set_sensitive(cond); + avoidgamutMethod_->set_sensitive(cond); if (!cond) { // Reset complex parameters visibility to default state @@ -2592,8 +2584,6 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(const int index) r->lumask = row[spots_.lumask]; r->hishow = row[spots_.hishow]; r->activ = row[spots_.activ]; - r->avoid = row[spots_.avoid]; - r->avoidmun = row[spots_.avoidmun]; r->blwh = row[spots_.blwh]; r->recurs = row[spots_.recurs]; r->laplac = row[spots_.laplac]; @@ -2601,6 +2591,7 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(const int index) r->shortc = row[spots_.shortc]; //r->savrest = row[spots_.savrest]; r->wavMethod = row[spots_.wavMethod]; + r->avoidgamutMethod = row[spots_.avoidgamutMethod]; return r; } @@ -2725,8 +2716,6 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot) row[spots_.avoidrad] = newSpot->avoidrad; row[spots_.hishow] = newSpot->hishow; row[spots_.activ] = newSpot->activ; - row[spots_.avoid] = newSpot->avoid; - row[spots_.avoidmun] = newSpot->avoidmun; row[spots_.blwh] = newSpot->blwh; row[spots_.recurs] = newSpot->recurs; row[spots_.laplac] = newSpot->laplac; @@ -2738,6 +2727,7 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot) //row[spots_.savrest] = newSpot->savrest; row[spots_.complexMethod] = newSpot->complexMethod; row[spots_.wavMethod] = newSpot->wavMethod; + row[spots_.avoidgamutMethod] = newSpot->avoidgamutMethod; updateParamVisibility(); disableParamlistener(false); @@ -2845,8 +2835,6 @@ ControlSpotPanel::ControlSpots::ControlSpots() add(avoidrad); add(hishow); add(activ); - add(avoid); - add(avoidmun); add(blwh); add(recurs); add(laplac); @@ -2858,6 +2846,7 @@ ControlSpotPanel::ControlSpots::ControlSpots() //add(savrest); add(complexMethod); add(wavMethod); + add(avoidgamutMethod); } //----------------------------------------------------------------------------- diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index 92406c690..b1e191b0e 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -57,6 +57,7 @@ public: int sensiexclu; int structexclu; int shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) + int avoidgamutMethod; int locX; int locXL; int locY; @@ -79,8 +80,6 @@ public: double avoidrad; bool hishow; bool activ; - bool avoid; - bool avoidmun; bool blwh; bool recurs; bool laplac; @@ -243,7 +242,8 @@ private: void spotMethodChanged(); void shapeMethodChanged(); void qualityMethodChanged(); - //void complexMethodChanged(); + void avoidgamutMethodChanged(); + //void complexMethodChanged(); void wavMethodChanged(); void updateParamVisibility(); @@ -252,8 +252,6 @@ private: void hishowChanged(); void activChanged(); - void avoidChanged(); - void avoidmunChanged(); void blwhChanged(); void recursChanged(); void laplacChanged(); @@ -293,6 +291,7 @@ private: Gtk::TreeModelColumn sensiexclu; Gtk::TreeModelColumn structexclu; Gtk::TreeModelColumn shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) + Gtk::TreeModelColumn avoidgamutMethod; Gtk::TreeModelColumn locX; Gtk::TreeModelColumn locXL; Gtk::TreeModelColumn locY; @@ -315,8 +314,6 @@ private: Gtk::TreeModelColumn avoidrad; Gtk::TreeModelColumn hishow; Gtk::TreeModelColumn activ; - Gtk::TreeModelColumn avoid; - Gtk::TreeModelColumn avoidmun; Gtk::TreeModelColumn blwh; Gtk::TreeModelColumn recurs; Gtk::TreeModelColumn laplac; @@ -347,6 +344,7 @@ private: }; ControlSpots spots_; + rtengine::ProcEvent EvLocallabavoidgamutMethod; // Child widgets Gtk::ScrolledWindow* const scrolledwindow_; @@ -381,6 +379,8 @@ private: //sigc::connection complexMethodconn_; MyComboBoxText* const wavMethod_; sigc::connection wavMethodconn_; + MyComboBoxText* const avoidgamutMethod_; + sigc::connection avoidgamutconn_; Adjuster* const sensiexclu_; Adjuster* const structexclu_; @@ -411,10 +411,6 @@ private: sigc::connection hishowconn_; Gtk::CheckButton* const activ_; sigc::connection activConn_; - Gtk::CheckButton* const avoid_; - sigc::connection avoidConn_; - Gtk::CheckButton* const avoidmun_; - sigc::connection avoidmunConn_; Gtk::CheckButton* const blwh_; sigc::connection blwhConn_; Gtk::CheckButton* const recurs_; @@ -438,6 +434,7 @@ private: Gtk::Box* const ctboxshape; Gtk::Box* const ctboxshapemethod; + Gtk::Box* const ctboxgamut; // Internal variables ControlPanelListener* controlPanelListener; diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index d2279f586..e0e0bfb01 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -19,6 +19,7 @@ #include #include "labcurve.h" +#include "eventmapper.h" #include "curveeditor.h" #include "curveeditorgroup.h" @@ -32,61 +33,80 @@ using namespace rtengine; using namespace rtengine::procparams; -LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL"), false, true) +LCurve::LCurve() : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL"), false, true) { - brightness = Gtk::manage (new Adjuster (M("TP_LABCURVE_BRIGHTNESS"), -100., 100., 1., 0.)); - contrast = Gtk::manage (new Adjuster (M("TP_LABCURVE_CONTRAST"), -100., 100., 1., 0.)); - chromaticity = Gtk::manage (new Adjuster (M("TP_LABCURVE_CHROMATICITY"), -100., 100., 1., 0.)); + auto m = ProcEventMapper::getInstance(); + Evgamutmunsell = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_GAMUTMUNSEL"); + CurveListener::setMulti(true); + brightness = Gtk::manage(new Adjuster(M("TP_LABCURVE_BRIGHTNESS"), -100., 100., 1., 0.)); + contrast = Gtk::manage(new Adjuster(M("TP_LABCURVE_CONTRAST"), -100., 100., 1., 0.)); + chromaticity = Gtk::manage(new Adjuster(M("TP_LABCURVE_CHROMATICITY"), -100., 100., 1., 0.)); chromaticity->set_tooltip_markup(M("TP_LABCURVE_CHROMA_TOOLTIP")); - pack_start (*brightness); - brightness->show (); + pack_start(*brightness); + brightness->show(); - pack_start (*contrast); - contrast->show (); + pack_start(*contrast); + contrast->show(); - pack_start (*chromaticity); - chromaticity->show (); + pack_start(*chromaticity); + chromaticity->show(); - brightness->setAdjusterListener (this); - contrast->setAdjusterListener (this); - chromaticity->setAdjusterListener (this); + brightness->setAdjusterListener(this); + contrast->setAdjusterListener(this); + chromaticity->setAdjusterListener(this); brightness->setLogScale(2, 0, true); contrast->setLogScale(2, 0, true); chromaticity->setLogScale(2, 0, true); //%%%%%%%%%%%%%%%%%% - Gtk::Separator* hsep2 = Gtk::manage (new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); - hsep2->show (); - pack_start (*hsep2, Gtk::PACK_EXPAND_WIDGET, 4); + Gtk::Separator* hsep2 = Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); + hsep2->show(); + pack_start(*hsep2, Gtk::PACK_EXPAND_WIDGET, 4); - avoidcolorshift = Gtk::manage (new Gtk::CheckButton (M("TP_LABCURVE_AVOIDCOLORSHIFT"))); - avoidcolorshift->set_tooltip_text (M("TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP")); - pack_start (*avoidcolorshift, Gtk::PACK_SHRINK, 4); - lcredsk = Gtk::manage (new Gtk::CheckButton (M("TP_LABCURVE_LCREDSK"))); - lcredsk->set_tooltip_markup (M("TP_LABCURVE_LCREDSK_TOOLTIP")); - pack_start (*lcredsk); - rstprotection = Gtk::manage ( new Adjuster (M("TP_LABCURVE_RSTPROTECTION"), 0., 100., 0.1, 0.) ); - pack_start (*rstprotection); - rstprotection->show (); - rstprotection->setAdjusterListener (this); - rstprotection->set_tooltip_text (M("TP_LABCURVE_RSTPRO_TOOLTIP")); + Gtk::Box* metHBox = Gtk::manage(new Gtk::Box()); + metHBox->set_spacing(2); + Gtk::Label* metLabel = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_AVOID") + ":")); + metHBox->pack_start(*metLabel, Gtk::PACK_SHRINK); - acconn = avoidcolorshift->signal_toggled().connect( sigc::mem_fun(*this, &LCurve::avoidcolorshift_toggled) ); - lcconn = lcredsk->signal_toggled().connect( sigc::mem_fun(*this, &LCurve::lcredsk_toggled) ); + gamutmunselmethod = Gtk::manage(new MyComboBoxText()); + gamutmunselmethod->append(M("TP_LOCALLAB_GAMUTNON")); + gamutmunselmethod->append(M("TP_LOCALLAB_GAMUTLABRELA")); + gamutmunselmethod->append(M("TP_LOCALLAB_GAMUTXYZABSO")); + gamutmunselmethod->append(M("TP_LOCALLAB_GAMUTXYZRELA")); + gamutmunselmethod->append(M("TP_LOCALLAB_GAMUTMUNSELL")); + gamutmunselmethod->set_active(4); + gamutmunselmethod->set_tooltip_text(M("TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP")); + metHBox->pack_start(*gamutmunselmethod); + pack_start(*metHBox); + gamutmunselmethodconn = gamutmunselmethod->signal_changed().connect(sigc::mem_fun(*this, &LCurve::gamutmunselChanged)); + + + lcredsk = Gtk::manage(new Gtk::CheckButton(M("TP_LABCURVE_LCREDSK"))); + lcredsk->set_tooltip_markup(M("TP_LABCURVE_LCREDSK_TOOLTIP")); + pack_start(*lcredsk); + + rstprotection = Gtk::manage(new Adjuster(M("TP_LABCURVE_RSTPROTECTION"), 0., 100., 0.1, 0.)); + pack_start(*rstprotection); + rstprotection->show(); + + rstprotection->setAdjusterListener(this); + rstprotection->set_tooltip_text(M("TP_LABCURVE_RSTPRO_TOOLTIP")); + + lcconn = lcredsk->signal_toggled().connect(sigc::mem_fun(*this, &LCurve::lcredsk_toggled)); //%%%%%%%%%%%%%%%%%%% - Gtk::Separator* hsep3 = Gtk::manage (new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); - hsep3->show (); - pack_start (*hsep3, Gtk::PACK_EXPAND_WIDGET, 4); + Gtk::Separator* hsep3 = Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); + hsep3->show(); + pack_start(*hsep3, Gtk::PACK_EXPAND_WIDGET, 4); - curveEditorG = new CurveEditorGroup (options.lastLabCurvesDir); - curveEditorG->setCurveListener (this); + curveEditorG = new CurveEditorGroup(options.lastLabCurvesDir); + curveEditorG->setCurveListener(this); lshape = static_cast(curveEditorG->addCurve(CT_Diagonal, "L*")); lshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_LL_TOOLTIP")); @@ -216,88 +236,111 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL"), // This will add the reset button at the end of the curveType buttons curveEditorG->curveListComplete(); - pack_start (*curveEditorG, Gtk::PACK_SHRINK, 4); - Gtk::Separator* hsepdh = Gtk::manage (new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); - hsepdh->show (); - pack_start (*hsepdh, Gtk::PACK_EXPAND_WIDGET, 4); + pack_start(*curveEditorG, Gtk::PACK_SHRINK, 4); + Gtk::Separator* hsepdh = Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); + hsepdh->show(); + pack_start(*hsepdh, Gtk::PACK_EXPAND_WIDGET, 4); + show_all_children(); } -LCurve::~LCurve () +LCurve::~LCurve() { delete curveEditorG; } -void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) +void LCurve::read(const ProcParams* pp, const ParamsEdited* pedited) { - disableListener (); + disableListener(); + gamutmunselmethodconn.block(true); + + + brightness->setValue(pp->labCurve.brightness); + contrast->setValue(pp->labCurve.contrast); + chromaticity->setValue(pp->labCurve.chromaticity); + adjusterChanged(chromaticity, pp->labCurve.chromaticity); // To update the GUI sensitiveness + //%%%%%%%%%%%%%%%%%%%%%% + rstprotection->setValue(pp->labCurve.rstprotection); + + + bwtconn.block(true); + lcconn.block(true); + lcredsk->set_active(pp->labCurve.lcredsk); + + bwtconn.block(false); + lcconn.block(false); + + lastLCVal = pp->labCurve.lcredsk; + //%%%%%%%%%%%%%%%%%%%%%% + + lshape->setCurve(pp->labCurve.lcurve); + ashape->setCurve(pp->labCurve.acurve); + bshape->setCurve(pp->labCurve.bcurve); + ccshape->setCurve(pp->labCurve.cccurve); + chshape->setCurve(pp->labCurve.chcurve); + lhshape->setCurve(pp->labCurve.lhcurve); + hhshape->setCurve(pp->labCurve.hhcurve); + lcshape->setCurve(pp->labCurve.lccurve); + clshape->setCurve(pp->labCurve.clcurve); + + if (pedited && !pedited->labCurve.gamutmunselmethod) { + gamutmunselmethod->set_active(4); // "Unchanged" + } else if (pp->labCurve.gamutmunselmethod == "NONE") { + gamutmunselmethod->set_active(0); + } else if (pp->labCurve.gamutmunselmethod == "LAB") { + gamutmunselmethod->set_active(1); + } else if (pp->labCurve.gamutmunselmethod == "XYZ") { + gamutmunselmethod->set_active(2); + } else if (pp->labCurve.gamutmunselmethod == "XYZREL") { + gamutmunselmethod->set_active(3); + } else if (pp->labCurve.gamutmunselmethod == "MUN") { + gamutmunselmethod->set_active(4); + } + + gamutmunselChanged(); if (pedited) { - brightness->setEditedState (pedited->labCurve.brightness ? Edited : UnEdited); - contrast->setEditedState (pedited->labCurve.contrast ? Edited : UnEdited); - chromaticity->setEditedState (pedited->labCurve.chromaticity ? Edited : UnEdited); + brightness->setEditedState(pedited->labCurve.brightness ? Edited : UnEdited); + contrast->setEditedState(pedited->labCurve.contrast ? Edited : UnEdited); + chromaticity->setEditedState(pedited->labCurve.chromaticity ? Edited : UnEdited); //%%%%%%%%%%%%%%%%%%%%%% - rstprotection->setEditedState (pedited->labCurve.rstprotection ? Edited : UnEdited); - avoidcolorshift->set_inconsistent (!pedited->labCurve.avoidcolorshift); - lcredsk->set_inconsistent (!pedited->labCurve.lcredsk); + rstprotection->setEditedState(pedited->labCurve.rstprotection ? Edited : UnEdited); + lcredsk->set_inconsistent(!pedited->labCurve.lcredsk); //%%%%%%%%%%%%%%%%%%%%%% - lshape->setUnChanged (!pedited->labCurve.lcurve); - ashape->setUnChanged (!pedited->labCurve.acurve); - bshape->setUnChanged (!pedited->labCurve.bcurve); - ccshape->setUnChanged (!pedited->labCurve.cccurve); - chshape->setUnChanged (!pedited->labCurve.chcurve); - lhshape->setUnChanged (!pedited->labCurve.lhcurve); - hhshape->setUnChanged (!pedited->labCurve.hhcurve); - lcshape->setUnChanged (!pedited->labCurve.lccurve); - clshape->setUnChanged (!pedited->labCurve.clcurve); + lshape->setUnChanged(!pedited->labCurve.lcurve); + ashape->setUnChanged(!pedited->labCurve.acurve); + bshape->setUnChanged(!pedited->labCurve.bcurve); + ccshape->setUnChanged(!pedited->labCurve.cccurve); + chshape->setUnChanged(!pedited->labCurve.chcurve); + lhshape->setUnChanged(!pedited->labCurve.lhcurve); + hhshape->setUnChanged(!pedited->labCurve.hhcurve); + lcshape->setUnChanged(!pedited->labCurve.lccurve); + clshape->setUnChanged(!pedited->labCurve.clcurve); + + if (!pedited->labCurve.gamutmunselmethod) { + gamutmunselmethod->set_active_text(M("GENERAL_UNCHANGED")); + } set_inconsistent(multiImage && !pedited->labCurve.enabled); } - brightness->setValue (pp->labCurve.brightness); - contrast->setValue (pp->labCurve.contrast); - chromaticity->setValue (pp->labCurve.chromaticity); - adjusterChanged(chromaticity, pp->labCurve.chromaticity); // To update the GUI sensitiveness - //%%%%%%%%%%%%%%%%%%%%%% - rstprotection->setValue (pp->labCurve.rstprotection); + gamutmunselmethodconn.block(false); - bwtconn.block (true); - acconn.block (true); - lcconn.block (true); - avoidcolorshift->set_active (pp->labCurve.avoidcolorshift); - lcredsk->set_active (pp->labCurve.lcredsk); - - bwtconn.block (false); - acconn.block (false); - lcconn.block (false); - - lastACVal = pp->labCurve.avoidcolorshift; - lastLCVal = pp->labCurve.lcredsk; - //%%%%%%%%%%%%%%%%%%%%%% - - lshape->setCurve (pp->labCurve.lcurve); - ashape->setCurve (pp->labCurve.acurve); - bshape->setCurve (pp->labCurve.bcurve); - ccshape->setCurve (pp->labCurve.cccurve); - chshape->setCurve (pp->labCurve.chcurve); - lhshape->setCurve (pp->labCurve.lhcurve); - hhshape->setCurve (pp->labCurve.hhcurve); - lcshape->setCurve (pp->labCurve.lccurve); - clshape->setCurve (pp->labCurve.clcurve); setEnabled(pp->labCurve.enabled); - + queue_draw(); - enableListener (); + enableListener(); } -void LCurve::autoOpenCurve () + +void LCurve::autoOpenCurve() { // Open up the first curve if selected bool active = lshape->openIfNonlinear(); @@ -336,7 +379,7 @@ void LCurve::autoOpenCurve () } -void LCurve::setEditProvider (EditDataProvider *provider) +void LCurve::setEditProvider(EditDataProvider *provider) { lshape->setEditProvider(provider); ccshape->setEditProvider(provider); @@ -351,127 +394,128 @@ void LCurve::setEditProvider (EditDataProvider *provider) } -void LCurve::write (ProcParams* pp, ParamsEdited* pedited) +void LCurve::write(ProcParams* pp, ParamsEdited* pedited) { pp->labCurve.enabled = getEnabled(); - - pp->labCurve.brightness = brightness->getValue (); - pp->labCurve.contrast = (int)contrast->getValue (); - pp->labCurve.chromaticity = (int)chromaticity->getValue (); - //%%%%%%%%%%%%%%%%%%%%%% - pp->labCurve.avoidcolorshift = avoidcolorshift->get_active (); - pp->labCurve.lcredsk = lcredsk->get_active (); - pp->labCurve.rstprotection = rstprotection->getValue (); + pp->labCurve.brightness = brightness->getValue(); + pp->labCurve.contrast = (int)contrast->getValue(); + pp->labCurve.chromaticity = (int)chromaticity->getValue(); + //%%%%%%%%%%%%%%%%%%%%%% + pp->labCurve.lcredsk = lcredsk->get_active(); + + pp->labCurve.rstprotection = rstprotection->getValue(); //%%%%%%%%%%%%%%%%%%%%%% - pp->labCurve.lcurve = lshape->getCurve (); - pp->labCurve.acurve = ashape->getCurve (); - pp->labCurve.bcurve = bshape->getCurve (); - pp->labCurve.cccurve = ccshape->getCurve (); - pp->labCurve.chcurve = chshape->getCurve (); - pp->labCurve.lhcurve = lhshape->getCurve (); - pp->labCurve.hhcurve = hhshape->getCurve (); - pp->labCurve.lccurve = lcshape->getCurve (); - pp->labCurve.clcurve = clshape->getCurve (); + pp->labCurve.lcurve = lshape->getCurve(); + pp->labCurve.acurve = ashape->getCurve(); + pp->labCurve.bcurve = bshape->getCurve(); + pp->labCurve.cccurve = ccshape->getCurve(); + pp->labCurve.chcurve = chshape->getCurve(); + pp->labCurve.lhcurve = lhshape->getCurve(); + pp->labCurve.hhcurve = hhshape->getCurve(); + pp->labCurve.lccurve = lcshape->getCurve(); + pp->labCurve.clcurve = clshape->getCurve(); + + if (pedited) { - pedited->labCurve.brightness = brightness->getEditedState (); - pedited->labCurve.contrast = contrast->getEditedState (); - pedited->labCurve.chromaticity = chromaticity->getEditedState (); + pedited->labCurve.brightness = brightness->getEditedState(); + pedited->labCurve.contrast = contrast->getEditedState(); + pedited->labCurve.chromaticity = chromaticity->getEditedState(); //%%%%%%%%%%%%%%%%%%%%%% - pedited->labCurve.avoidcolorshift = !avoidcolorshift->get_inconsistent(); pedited->labCurve.lcredsk = !lcredsk->get_inconsistent(); - pedited->labCurve.rstprotection = rstprotection->getEditedState (); + pedited->labCurve.rstprotection = rstprotection->getEditedState(); + pedited->labCurve.gamutmunselmethod = gamutmunselmethod->get_active_text() != M("GENERAL_UNCHANGED"); - pedited->labCurve.lcurve = !lshape->isUnChanged (); - pedited->labCurve.acurve = !ashape->isUnChanged (); - pedited->labCurve.bcurve = !bshape->isUnChanged (); - pedited->labCurve.cccurve = !ccshape->isUnChanged (); - pedited->labCurve.chcurve = !chshape->isUnChanged (); - pedited->labCurve.lhcurve = !lhshape->isUnChanged (); - pedited->labCurve.hhcurve = !hhshape->isUnChanged (); - pedited->labCurve.lccurve = !lcshape->isUnChanged (); - pedited->labCurve.clcurve = !clshape->isUnChanged (); + pedited->labCurve.lcurve = !lshape->isUnChanged(); + pedited->labCurve.acurve = !ashape->isUnChanged(); + pedited->labCurve.bcurve = !bshape->isUnChanged(); + pedited->labCurve.cccurve = !ccshape->isUnChanged(); + pedited->labCurve.chcurve = !chshape->isUnChanged(); + pedited->labCurve.lhcurve = !lhshape->isUnChanged(); + pedited->labCurve.hhcurve = !hhshape->isUnChanged(); + pedited->labCurve.lccurve = !lcshape->isUnChanged(); + pedited->labCurve.clcurve = !clshape->isUnChanged(); pedited->labCurve.enabled = !get_inconsistent(); + } + if (gamutmunselmethod->get_active_row_number() == 0) { + pp->labCurve.gamutmunselmethod = "NONE"; + } else if (gamutmunselmethod->get_active_row_number() == 1) { + pp->labCurve.gamutmunselmethod = "LAB"; + } else if (gamutmunselmethod->get_active_row_number() == 2) { + pp->labCurve.gamutmunselmethod = "XYZ"; + } else if (gamutmunselmethod->get_active_row_number() == 3) { + pp->labCurve.gamutmunselmethod = "XYZREL"; + } else if (gamutmunselmethod->get_active_row_number() == 4) { + pp->labCurve.gamutmunselmethod = "MUN"; + } + + + } -void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) +void LCurve::setDefaults(const ProcParams* defParams, const ParamsEdited* pedited) { - brightness->setDefault (defParams->labCurve.brightness); - contrast->setDefault (defParams->labCurve.contrast); - chromaticity->setDefault (defParams->labCurve.chromaticity); - rstprotection->setDefault (defParams->labCurve.rstprotection); + brightness->setDefault(defParams->labCurve.brightness); + contrast->setDefault(defParams->labCurve.contrast); + chromaticity->setDefault(defParams->labCurve.chromaticity); + rstprotection->setDefault(defParams->labCurve.rstprotection); if (pedited) { - brightness->setDefaultEditedState (pedited->labCurve.brightness ? Edited : UnEdited); - contrast->setDefaultEditedState (pedited->labCurve.contrast ? Edited : UnEdited); - chromaticity->setDefaultEditedState (pedited->labCurve.chromaticity ? Edited : UnEdited); - rstprotection->setDefaultEditedState (pedited->labCurve.rstprotection ? Edited : UnEdited); + brightness->setDefaultEditedState(pedited->labCurve.brightness ? Edited : UnEdited); + contrast->setDefaultEditedState(pedited->labCurve.contrast ? Edited : UnEdited); + chromaticity->setDefaultEditedState(pedited->labCurve.chromaticity ? Edited : UnEdited); + rstprotection->setDefaultEditedState(pedited->labCurve.rstprotection ? Edited : UnEdited); } else { - brightness->setDefaultEditedState (Irrelevant); - contrast->setDefaultEditedState (Irrelevant); - chromaticity->setDefaultEditedState (Irrelevant); - rstprotection->setDefaultEditedState (Irrelevant); + brightness->setDefaultEditedState(Irrelevant); + contrast->setDefaultEditedState(Irrelevant); + chromaticity->setDefaultEditedState(Irrelevant); + rstprotection->setDefaultEditedState(Irrelevant); } } //%%%%%%%%%%%%%%%%%%%%%% -//Color shift control changed -void LCurve::avoidcolorshift_toggled () + +void LCurve::gamutmunselChanged() { - if (batchMode) { - if (avoidcolorshift->get_inconsistent()) { - avoidcolorshift->set_inconsistent (false); - acconn.block (true); - avoidcolorshift->set_active (false); - acconn.block (false); - } else if (lastACVal) { - avoidcolorshift->set_inconsistent (true); - } - - lastACVal = avoidcolorshift->get_active (); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(Evgamutmunsell, gamutmunselmethod->get_active_text()); } - if (listener && getEnabled()) { - if (avoidcolorshift->get_active ()) { - listener->panelChanged (EvLAvoidColorShift, M("GENERAL_ENABLED")); - } else { - listener->panelChanged (EvLAvoidColorShift, M("GENERAL_DISABLED")); - } - } } -void LCurve::lcredsk_toggled () + +void LCurve::lcredsk_toggled() { if (batchMode) { if (lcredsk->get_inconsistent()) { - lcredsk->set_inconsistent (false); - lcconn.block (true); - lcredsk->set_active (false); - lcconn.block (false); + lcredsk->set_inconsistent(false); + lcconn.block(true); + lcredsk->set_active(false); + lcconn.block(false); } else if (lastLCVal) { - lcredsk->set_inconsistent (true); + lcredsk->set_inconsistent(true); } - lastLCVal = lcredsk->get_active (); + lastLCVal = lcredsk->get_active(); } else { lcshape->refresh(); } if (listener && getEnabled()) { - if (lcredsk->get_active ()) { - listener->panelChanged (EvLLCredsk, M("GENERAL_ENABLED")); + if (lcredsk->get_active()) { + listener->panelChanged(EvLLCredsk, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvLLCredsk, M("GENERAL_DISABLED")); + listener->panelChanged(EvLLCredsk, M("GENERAL_DISABLED")); } } } @@ -484,44 +528,44 @@ void LCurve::lcredsk_toggled () * If more than one curve has been added, the curve listener is automatically * set to 'multi=true', and send a pointer of the modified curve in a parameter */ -void LCurve::curveChanged (CurveEditor* ce) +void LCurve::curveChanged(CurveEditor* ce) { if (listener && getEnabled()) { if (ce == lshape) { - listener->panelChanged (EvLLCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLLCurve, M("HISTORY_CUSTOMCURVE")); } if (ce == ashape) { - listener->panelChanged (EvLaCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLaCurve, M("HISTORY_CUSTOMCURVE")); } if (ce == bshape) { - listener->panelChanged (EvLbCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLbCurve, M("HISTORY_CUSTOMCURVE")); } if (ce == ccshape) { - listener->panelChanged (EvLCCCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLCCCurve, M("HISTORY_CUSTOMCURVE")); } if (ce == chshape) { - listener->panelChanged (EvLCHCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLCHCurve, M("HISTORY_CUSTOMCURVE")); } if (ce == lhshape) { - listener->panelChanged (EvLLHCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLLHCurve, M("HISTORY_CUSTOMCURVE")); } if (ce == hhshape) { - listener->panelChanged (EvLHHCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLHHCurve, M("HISTORY_CUSTOMCURVE")); } if (ce == lcshape) { - listener->panelChanged (EvLLCCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLLCCurve, M("HISTORY_CUSTOMCURVE")); } if (ce == clshape) { - listener->panelChanged (EvLCLCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvLCLCurve, M("HISTORY_CUSTOMCURVE")); } @@ -533,45 +577,43 @@ void LCurve::adjusterChanged(Adjuster* a, double newval) Glib::ustring costr; if (a == brightness) { - costr = Glib::ustring::format (std::setw(3), std::fixed, std::setprecision(2), a->getValue()); + costr = Glib::ustring::format(std::setw(3), std::fixed, std::setprecision(2), a->getValue()); } else if (a == rstprotection) { - costr = Glib::ustring::format (std::setw(3), std::fixed, std::setprecision(1), a->getValue()); + costr = Glib::ustring::format(std::setw(3), std::fixed, std::setprecision(1), a->getValue()); } else { - costr = Glib::ustring::format ((int)a->getValue()); + costr = Glib::ustring::format((int)a->getValue()); } if (a == brightness) { if (listener && getEnabled()) { - listener->panelChanged (EvLBrightness, costr); + listener->panelChanged(EvLBrightness, costr); } } else if (a == contrast) { if (listener && getEnabled()) { - listener->panelChanged (EvLContrast, costr); + listener->panelChanged(EvLContrast, costr); } } else if (a == rstprotection) { if (listener && getEnabled()) { - listener->panelChanged (EvLRSTProtection, costr); + listener->panelChanged(EvLRSTProtection, costr); } } else if (a == chromaticity) { if (multiImage) { //if chromaticity==-100 (lowest value), we enter the B&W mode and avoid color shift and rstprotection has no effect - rstprotection->set_sensitive( true ); - avoidcolorshift->set_sensitive( true ); - lcredsk->set_sensitive( true ); + rstprotection->set_sensitive(true); + lcredsk->set_sensitive(true); } else { //if chromaticity==-100 (lowest value), we enter the B&W mode and avoid color shift and rstprotection has no effect - rstprotection->set_sensitive( int(newval) > -100 ); //no reason for grey rstprotection - avoidcolorshift->set_sensitive( int(newval) > -100 ); - lcredsk->set_sensitive( int(newval) > -100 ); + rstprotection->set_sensitive(int(newval) > -100); //no reason for grey rstprotection + lcredsk->set_sensitive(int(newval) > -100); } if (listener && getEnabled()) { - listener->panelChanged (EvLSaturation, costr); + listener->panelChanged(EvLSaturation, costr); } } } -void LCurve::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) +void LCurve::colorForValue(double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) { float R = 0.f, G = 0.f, B = 0.f; @@ -586,47 +628,54 @@ void LCurve::colorForValue (double valX, double valY, enum ColorCaller::ElemType float value = (1.f - 0.7f) * float(valX) + 0.7f; // whole hue range // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) - Color::hsv2rgb01(float(valY*0.8), float(valX), value, R, G, B); + Color::hsv2rgb01(float(valY * 0.8), float(valX), value, R, G, B); } else if (callerId == 6) { // cc - left bar float value = (1.f - 0.7f) * float(valX) + 0.7f; float hue = (1.14056f - 0.92f) * float(valY) + 0.92f; + if (hue > 1.0f) { hue -= 1.0f; } + // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) Color::hsv2rgb01(hue, float(valX), value, R, G, B); } else if (callerId == 3) { // lc - bottom bar float value = (1.f - 0.7f) * float(valX) + 0.7f; + if (lcredsk->get_active()) { // skin range // -0.1 rad < Hue < 1.6 rad // Y axis / from 0.92 up to 0.14056 float hue = (1.14056f - 0.92f) * float(valY) + 0.92f; + if (hue > 1.0f) { hue -= 1.0f; } + // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) Color::hsv2rgb01(hue, float(valX), value, R, G, B); } else { // whole hue range // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) - Color::hsv2rgb01(float(valY*0.8), float(valX), value, R, G, B); + Color::hsv2rgb01(float(valY * 0.8), float(valX), value, R, G, B); } } else if (callerId == 4) { // LH - bottom bar Color::hsv2rgb01(float(valX), 0.5f, float(valY), R, G, B); } else if (callerId == 5) { // HH - bottom bar float h = float((valY - 0.5) * 0.3 + valX); + if (h > 1.0f) { h -= 1.0f; } else if (h < 0.0f) { h += 1.0f; } + Color::hsv2rgb01(h, 0.5f, 0.5f, R, G, B); } else if (callerId == 7) { // cc and cl - left bar float value = (1.f - 0.7f) * float(valX) + 0.7f; // whole hue range // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) - Color::hsv2rgb01(float(valY*0.8), 1.f - float(valX), value, R, G, B); + Color::hsv2rgb01(float(valY * 0.8), 1.f - float(valX), value, R, G, B); } caller->ccRed = double(R); @@ -634,17 +683,19 @@ void LCurve::colorForValue (double valX, double valY, enum ColorCaller::ElemType caller->ccBlue = double(B); } -void LCurve::setBatchMode (bool batchMode) +void LCurve::setBatchMode(bool batchMode) { - ToolPanel::setBatchMode (batchMode); - brightness->showEditedCB (); - contrast->showEditedCB (); - chromaticity->showEditedCB (); - rstprotection->showEditedCB (); - curveEditorG->setBatchMode (batchMode); + ToolPanel::setBatchMode(batchMode); + brightness->showEditedCB(); + contrast->showEditedCB(); + chromaticity->showEditedCB(); + rstprotection->showEditedCB(); + curveEditorG->setBatchMode(batchMode); lcshape->setBottomBarColorProvider(nullptr, -1); lcshape->setLeftBarColorProvider(nullptr, -1); + gamutmunselmethod->append(M("GENERAL_UNCHANGED")); + } @@ -661,13 +712,13 @@ void LCurve::updateCurveBackgroundHistogram( const LUTu& histLRETI ) { - lshape->updateBackgroundHistogram (histLCurve); - ccshape->updateBackgroundHistogram (histCCurve); - lcshape->updateBackgroundHistogram (histCCurve); - clshape->updateBackgroundHistogram (histLCurve); + lshape->updateBackgroundHistogram(histLCurve); + ccshape->updateBackgroundHistogram(histCCurve); + lcshape->updateBackgroundHistogram(histCCurve); + clshape->updateBackgroundHistogram(histLCurve); } -void LCurve::setAdjusterBehavior (bool bradd, bool contradd, bool satadd) +void LCurve::setAdjusterBehavior(bool bradd, bool contradd, bool satadd) { brightness->setAddMode(bradd); @@ -675,7 +726,7 @@ void LCurve::setAdjusterBehavior (bool bradd, bool contradd, bool satadd) chromaticity->setAddMode(satadd); } -void LCurve::trimValues (rtengine::procparams::ProcParams* pp) +void LCurve::trimValues(rtengine::procparams::ProcParams* pp) { brightness->trimValue(pp->labCurve.brightness); @@ -687,11 +738,11 @@ void LCurve::enabledChanged() { if (listener) { if (get_inconsistent()) { - listener->panelChanged (EvLEnabled, M("GENERAL_UNCHANGED")); + listener->panelChanged(EvLEnabled, M("GENERAL_UNCHANGED")); } else if (getEnabled()) { - listener->panelChanged (EvLEnabled, M("GENERAL_ENABLED")); + listener->panelChanged(EvLEnabled, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvLEnabled, M("GENERAL_DISABLED")); + listener->panelChanged(EvLEnabled, M("GENERAL_DISABLED")); } } } diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index dfb79ae7a..5d762ea9e 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -59,11 +59,14 @@ protected: DiagonalCurveEditor* cdshape; //%%%%%%%%%%%%%%%% - Gtk::CheckButton* avoidcolorshift; Gtk::CheckButton* lcredsk; + MyComboBoxText* gamutmunselmethod; + sigc::connection gamutmunselmethodconn; + rtengine::ProcEvent Evgamutmunsell; + Adjuster* rstprotection; - sigc::connection bwtconn, acconn, lcconn; + sigc::connection bwtconn, lcconn; bool lastACVal, lastLCVal; //%%%%%%%%%%%%%%%% @@ -84,8 +87,8 @@ public: void curveChanged (CurveEditor* ce) override; void adjusterChanged (Adjuster* a, double newval) override; - void avoidcolorshift_toggled (); void lcredsk_toggled(); + void gamutmunselChanged(); void updateCurveBackgroundHistogram( const LUTu& histToneCurve, diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 4fb61c1c6..90312b22b 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -277,6 +277,18 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit } else { r->shapeMethod = 3; } + + if (pp->locallab.spots.at(i).avoidgamutMethod == "NONE") { + r->avoidgamutMethod = 0; + } else if (pp->locallab.spots.at(i).avoidgamutMethod == "LAB") { + r->avoidgamutMethod = 1; + } else if (pp->locallab.spots.at(i).avoidgamutMethod == "XYZ") { + r->avoidgamutMethod= 2; + } else if (pp->locallab.spots.at(i).avoidgamutMethod == "XYZREL") { + r->avoidgamutMethod= 3; + } else if (pp->locallab.spots.at(i).avoidgamutMethod == "MUNS") { + r->avoidgamutMethod= 4; + } r->locX = pp->locallab.spots.at(i).loc.at(0); r->locXL = pp->locallab.spots.at(i).loc.at(1); @@ -306,8 +318,6 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit r->avoidrad = pp->locallab.spots.at(i).avoidrad; r->hishow = pp->locallab.spots.at(i).hishow; r->activ = pp->locallab.spots.at(i).activ; - r->avoid = pp->locallab.spots.at(i).avoid; - r->avoidmun = pp->locallab.spots.at(i).avoidmun; r->blwh = pp->locallab.spots.at(i).blwh; r->recurs = pp->locallab.spots.at(i).recurs; r->laplac = true; //pp->locallab.spots.at(i).laplac; @@ -441,6 +451,18 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->shapeMethod = 3; } + if (newSpot->avoidgamutMethod == "NONE") { + r->avoidgamutMethod = 0; + } else if (newSpot->avoidgamutMethod == "LAB") { + r->avoidgamutMethod = 1; + } else if (newSpot->avoidgamutMethod == "XYZ") { + r->avoidgamutMethod = 2; + } else if (newSpot->avoidgamutMethod == "XYZREL") { + r->avoidgamutMethod = 3; + } else if (newSpot->avoidgamutMethod == "MUNS") { + r->avoidgamutMethod = 4; + } + // Calculate spot size and center position according to preview area if (provider && !batchMode) { provider->getImageSize(imW, imH); @@ -488,8 +510,6 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->avoidrad = newSpot->avoidrad; r->hishow = newSpot->hishow; r->activ = newSpot->activ; - r->avoid = newSpot->avoid; - r->avoidmun = newSpot->avoidmun; r->blwh = newSpot->blwh; r->recurs = newSpot->recurs; r->laplac = newSpot->laplac; @@ -742,6 +762,18 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->shapeMethod = 3; } //printf("n0=%f n1=%f n2=%f n3=%f\n", (double) newSpot->loc.at(0), (double) newSpot->loc.at(1), (double) newSpot->loc.at(2), (double) newSpot->loc.at(3)); + if (newSpot->avoidgamutMethod == "NONE") { + r->avoidgamutMethod = 0; + } else if (newSpot->avoidgamutMethod == "LAB") { + r->avoidgamutMethod = 1; + } else if (newSpot->avoidgamutMethod== "XYZ") { + r->avoidgamutMethod = 2; + } else if (newSpot->avoidgamutMethod== "XYZREL") { + r->avoidgamutMethod = 3; + } else if (newSpot->avoidgamutMethod== "MUNS") { + r->avoidgamutMethod = 4; + } + //printf("n0=%f n1=%f n2=%f n3=%f\n", (double) newSpot->loc.at(0), (double) newSpot->loc.at(1), (double) newSpot->loc.at(2), (double) newSpot->loc.at(3)); // Calculate spot size and center position according to preview area if (provider && !batchMode) { @@ -799,8 +831,6 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->colorscope = newSpot->colorscope; r->avoidrad = newSpot->avoidrad; r->activ = newSpot->activ; - r->avoid = newSpot->avoid; - r->avoidmun = newSpot->avoidmun; r->blwh = newSpot->blwh; r->recurs = newSpot->recurs; r->laplac = newSpot->laplac; @@ -927,6 +957,18 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).shapeMethod = "SYMSL"; } + if (r->avoidgamutMethod == 0) { + pp->locallab.spots.at(pp->locallab.selspot).avoidgamutMethod = "NONE"; + } else if (r->avoidgamutMethod == 1) { + pp->locallab.spots.at(pp->locallab.selspot).avoidgamutMethod = "LAB"; + } else if (r->avoidgamutMethod == 2) { + pp->locallab.spots.at(pp->locallab.selspot).avoidgamutMethod = "XYZ"; + } else if (r->avoidgamutMethod == 3) { + pp->locallab.spots.at(pp->locallab.selspot).avoidgamutMethod = "XYZREL"; + } else if (r->avoidgamutMethod == 4) { + pp->locallab.spots.at(pp->locallab.selspot).avoidgamutMethod = "MUNS"; + } + pp->locallab.spots.at(pp->locallab.selspot).loc.at(0) = r->locX; pp->locallab.spots.at(pp->locallab.selspot).loc.at(1) = r->locXL; pp->locallab.spots.at(pp->locallab.selspot).loc.at(2) = r->locY; @@ -955,8 +997,6 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).avoidrad = r->avoidrad; pp->locallab.spots.at(pp->locallab.selspot).hishow = r->hishow; pp->locallab.spots.at(pp->locallab.selspot).activ = r->activ; - pp->locallab.spots.at(pp->locallab.selspot).avoid = r->avoid; - pp->locallab.spots.at(pp->locallab.selspot).avoidmun = r->avoidmun; pp->locallab.spots.at(pp->locallab.selspot).blwh = r->blwh; pp->locallab.spots.at(pp->locallab.selspot).recurs = r->recurs; pp->locallab.spots.at(pp->locallab.selspot).laplac = r->laplac; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index acdda4e8a..7d641d753 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -104,7 +104,7 @@ void ParamsEdited::set(bool v) labCurve.brightness = v; labCurve.contrast = v; labCurve.chromaticity = v; - labCurve.avoidcolorshift = v; + labCurve.gamutmunselmethod = v; labCurve.rstprotection = v; labCurve.lcredsk = v; localContrast.enabled = v; @@ -804,7 +804,7 @@ void ParamsEdited::initFrom(const std::vector& labCurve.brightness = labCurve.brightness && p.labCurve.brightness == other.labCurve.brightness; labCurve.contrast = labCurve.contrast && p.labCurve.contrast == other.labCurve.contrast; labCurve.chromaticity = labCurve.chromaticity && p.labCurve.chromaticity == other.labCurve.chromaticity; - labCurve.avoidcolorshift = labCurve.avoidcolorshift && p.labCurve.avoidcolorshift == other.labCurve.avoidcolorshift; + labCurve.gamutmunselmethod = labCurve.gamutmunselmethod && p.labCurve.gamutmunselmethod == other.labCurve.gamutmunselmethod; labCurve.rstprotection = labCurve.rstprotection && p.labCurve.rstprotection == other.labCurve.rstprotection; labCurve.lcredsk = labCurve.lcredsk && p.labCurve.lcredsk == other.labCurve.lcredsk; @@ -908,7 +908,6 @@ void ParamsEdited::initFrom(const std::vector& vibrance.avoidcolorshift = vibrance.avoidcolorshift && p.vibrance.avoidcolorshift == other.vibrance.avoidcolorshift; vibrance.pastsattog = vibrance.pastsattog && p.vibrance.pastsattog == other.vibrance.pastsattog; vibrance.skintonescurve = vibrance.skintonescurve && p.vibrance.skintonescurve == other.vibrance.skintonescurve; - colorappearance.enabled = colorappearance.enabled && p.colorappearance.enabled == other.colorappearance.enabled; colorappearance.degree = colorappearance.degree && p.colorappearance.degree == other.colorappearance.degree; colorappearance.autodegree = colorappearance.autodegree && p.colorappearance.autodegree == other.colorappearance.autodegree; @@ -1090,6 +1089,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).structexclu = locallab.spots.at(j).structexclu && pSpot.structexclu == otherSpot.structexclu; locallab.spots.at(j).struc = locallab.spots.at(j).struc && pSpot.struc == otherSpot.struc; locallab.spots.at(j).shapeMethod = locallab.spots.at(j).shapeMethod && pSpot.shapeMethod == otherSpot.shapeMethod; + locallab.spots.at(j).avoidgamutMethod = locallab.spots.at(j).avoidgamutMethod && pSpot.avoidgamutMethod == otherSpot.avoidgamutMethod; locallab.spots.at(j).loc = locallab.spots.at(j).loc && pSpot.loc == otherSpot.loc; locallab.spots.at(j).centerX = locallab.spots.at(j).centerX && pSpot.centerX == otherSpot.centerX; locallab.spots.at(j).centerY = locallab.spots.at(j).centerY && pSpot.centerY == otherSpot.centerY; @@ -1109,8 +1109,6 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).transitgrad = locallab.spots.at(j).transitgrad && pSpot.transitgrad == otherSpot.transitgrad; locallab.spots.at(j).hishow = locallab.spots.at(j).hishow && pSpot.hishow == otherSpot.hishow; locallab.spots.at(j).activ = locallab.spots.at(j).activ && pSpot.activ == otherSpot.activ; - locallab.spots.at(j).avoid = locallab.spots.at(j).avoid && pSpot.avoid == otherSpot.avoid; - locallab.spots.at(j).avoidmun = locallab.spots.at(j).avoidmun && pSpot.avoidmun == otherSpot.avoidmun; locallab.spots.at(j).blwh = locallab.spots.at(j).blwh && pSpot.blwh == otherSpot.blwh; locallab.spots.at(j).recurs = locallab.spots.at(j).recurs && pSpot.recurs == otherSpot.recurs; locallab.spots.at(j).laplac = locallab.spots.at(j).laplac && pSpot.laplac == otherSpot.laplac; @@ -2392,8 +2390,8 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.labCurve.chromaticity = dontforceSet && options.baBehav[ADDSET_LC_CHROMATICITY] ? toEdit.labCurve.chromaticity + mods.labCurve.chromaticity : mods.labCurve.chromaticity; } - if (labCurve.avoidcolorshift) { - toEdit.labCurve.avoidcolorshift = mods.labCurve.avoidcolorshift; + if (labCurve.gamutmunselmethod) { + toEdit.labCurve.gamutmunselmethod = mods.labCurve.gamutmunselmethod; } if (labCurve.rstprotection) { @@ -3434,6 +3432,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).shapeMethod = mods.locallab.spots.at(i).shapeMethod; } + if (locallab.spots.at(i).avoidgamutMethod) { + toEdit.locallab.spots.at(i).avoidgamutMethod = mods.locallab.spots.at(i).avoidgamutMethod; + } + if (locallab.spots.at(i).loc) { toEdit.locallab.spots.at(i).loc = mods.locallab.spots.at(i).loc; } @@ -3510,14 +3512,6 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).activ = mods.locallab.spots.at(i).activ; } - if (locallab.spots.at(i).avoid) { - toEdit.locallab.spots.at(i).avoid = mods.locallab.spots.at(i).avoid; - } - - if (locallab.spots.at(i).avoidmun) { - toEdit.locallab.spots.at(i).avoidmun = mods.locallab.spots.at(i).avoidmun; - } - if (locallab.spots.at(i).blwh) { toEdit.locallab.spots.at(i).blwh = mods.locallab.spots.at(i).blwh; } @@ -7412,6 +7406,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : structexclu(v), struc(v), shapeMethod(v), + avoidgamutMethod(v), loc(v), centerX(v), centerY(v), @@ -7431,8 +7426,6 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : transitgrad(v), hishow(v), activ(v), - avoid(v), - avoidmun(v), blwh(v), recurs(v), laplac(v), @@ -8104,6 +8097,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) structexclu = v; struc = v; shapeMethod = v; + avoidgamutMethod = v; loc = v; centerX = v; centerY = v; @@ -8123,8 +8117,6 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) transitgrad = v; hishow = v; activ = v; - avoid = v; - avoidmun = v; blwh = v; recurs = v; laplac = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 56d71cfa3..616e6d261 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -109,7 +109,7 @@ struct LCurveParamsEdited { bool brightness; bool contrast; bool chromaticity; - bool avoidcolorshift; + bool gamutmunselmethod; bool rstprotection; bool lcurve; bool acurve; @@ -402,6 +402,7 @@ public: bool structexclu; bool struc; bool shapeMethod; + bool avoidgamutMethod; bool loc; bool centerX; bool centerY; @@ -421,8 +422,6 @@ public: bool transitgrad; bool hishow; bool activ; - bool avoid; - bool avoidmun; bool blwh; bool recurs; bool laplac;