diff --git a/rtdata/languages/default b/rtdata/languages/default index 16322be7a..5dccad51a 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2162,6 +2162,8 @@ TP_LOCALLAB_MERGENONE;None TP_LOCALLAB_MERGEONE;Short Curves 'L' Mask TP_LOCALLAB_MERGETWO;Original(Mask 7) TP_LOCALLAB_MERGETHR;Original(Mask 7) + Mask LCH +TP_LOCALLAB_MERGEFOU;Previous Spot(Mask 7) +TP_LOCALLAB_MERGEFIV;Previous Spot(Mask 7) + Mask LCH TP_LOCALLAB_MERGE1COLFRA;Merge with Original TP_LOCALLAB_OPACOL;Opacity TP_LOCALLAB_MERGECOLFRA;Mask LCH diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 0c952a954..4ea4578ff 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -49,7 +49,7 @@ namespace rtengine { Crop::Crop(ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow) - : PipetteBuffer(editDataProvider), origCrop(nullptr), laboCrop(nullptr), labnCrop(nullptr), reservCrop(nullptr), + : PipetteBuffer(editDataProvider), origCrop(nullptr), laboCrop(nullptr), labnCrop(nullptr), reservCrop(nullptr), lastorigCrop(nullptr), cropImg(nullptr), shbuf_real(nullptr), transCrop(nullptr), cieCrop(nullptr), shbuffer(nullptr), updating(false), newUpdatePending(false), skip(10), cropx(0), cropy(0), cropw(-1), croph(-1), @@ -866,6 +866,7 @@ void Crop::update(int todo) //I made a little change here. Rather than have luminanceCurve (and others) use in/out lab images, we can do more if we copy right here. labnCrop->CopyFrom(laboCrop); reservCrop->CopyFrom(laboCrop); + lastorigCrop->CopyFrom(laboCrop); //parent->ipf.luminanceCurve (labnCrop, labnCrop, parent->lumacurve); @@ -1061,7 +1062,7 @@ void Crop::update(int todo) sca); // Locallab mask are only shown for selected spot if (sp == params.locallab.selspot) { - parent->ipf.Lab_Local(1, sp, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, locRETtransCurve, + parent->ipf.Lab_Local(1, sp, (float**)shbuffer, labnCrop, labnCrop, reservCrop, lastorigCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, locRETtransCurve, lllocalcurve2,locallutili, loclhCurve, lochhCurve, lmasklocalcurve2, localmaskutili, lmaskexplocalcurve2, localmaskexputili, @@ -1087,7 +1088,7 @@ void Crop::update(int todo) parent->locallListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } } else { - parent->ipf.Lab_Local(1, sp, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, locRETtransCurve, + parent->ipf.Lab_Local(1, sp, (float**)shbuffer, labnCrop, labnCrop, reservCrop, lastorigCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, locRETtransCurve, lllocalcurve2,locallutili, loclhCurve, lochhCurve, lmasklocalcurve2, localmaskutili, lmaskexplocalcurve2, localmaskexputili, @@ -1109,6 +1110,9 @@ void Crop::update(int todo) huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } + + lastorigCrop->CopyFrom(labnCrop); + lllocalcurve2.clear(); lightCurveloc2.clear(); rgblocalcurve2.clear(); @@ -1386,6 +1390,11 @@ void Crop::freeAll() reservCrop = nullptr; } + if (lastorigCrop) { + delete lastorigCrop; + lastorigCrop = nullptr; + } + /* if (lablocCrop ) { delete lablocCrop; @@ -1572,6 +1581,11 @@ bool Crop::setCropSizes(int rcx, int rcy, int rcw, int rch, int skip, bool inter reservCrop = new LabImage(cropw, croph); + if (lastorigCrop) { + delete lastorigCrop; // labnCrop can't be resized + } + + lastorigCrop = new LabImage(cropw, croph); /* if (lablocCrop) { delete lablocCrop; // labnCrop can't be resized diff --git a/rtengine/dcrop.h b/rtengine/dcrop.h index ccf9a8333..ea7a53473 100644 --- a/rtengine/dcrop.h +++ b/rtengine/dcrop.h @@ -44,6 +44,7 @@ protected: LabImage* laboCrop; // "one chunk" allocation LabImage* labnCrop; // "one chunk" allocation LabImage* reservCrop; // "one chunk" allocation + LabImage* lastorigCrop; // "one chunk" allocation Image8* cropImg; // "one chunk" allocation ; displayed image in monitor color space, showing the output profile as well (soft-proofing enabled, which then correspond to workimg) or not float * shbuf_real; // "one chunk" allocation diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 0919955ed..13d4d5ada 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -168,6 +168,7 @@ ImProcCoordinator::ImProcCoordinator() : //locallab locallListener(nullptr), reserv(nullptr), + lastorigimp(nullptr), coordX(0), coordY(0), localX(0), localY(0), lllocalcurve(65536, 0), cclocalcurve(65536, 0), @@ -895,6 +896,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (todo & (M_LUMINANCE + M_COLOR)) { nprevl->CopyFrom(oprevl); reserv->CopyFrom(oprevl); + lastorigimp->CopyFrom(oprevl); // int maxspot = 1; progress("Applying Color Boost...", 100 * readyphase / numofphases); @@ -1079,7 +1081,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) float Tmax; if (sp == params->locallab.selspot) { - ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, locRETtransCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, + ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv, lastorigimp, 0, 0, pW, pH, scale, locRETgainCurve, locRETtransCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, lmasklocalcurve, localmaskutili, lmaskexplocalcurve, localmaskexputili, lmaskSHlocalcurve, localmaskSHutili, @@ -1104,7 +1106,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locallListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } } else { - ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, locRETtransCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, + ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv, lastorigimp, 0, 0, pW, pH, scale, locRETgainCurve, locRETtransCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, lmasklocalcurve, localmaskutili, lmaskexplocalcurve, localmaskexputili, lmaskSHlocalcurve, localmaskSHutili, @@ -1125,6 +1127,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, lastsav, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } + + lastorigimp->CopyFrom(nprevl); + //recalculate references after if (params->locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reserv, reserv, 0, 0, pW, pH, scale, huerefblu, chromarefblu, lumarefblu, huer, chromar, lumar, sobeler, avg); @@ -1457,6 +1462,8 @@ void ImProcCoordinator::freeAll() nprevl = nullptr; delete reserv; reserv = nullptr; + delete lastorigimp; + lastorigimp = nullptr; if (ncie) { delete ncie; @@ -1511,6 +1518,7 @@ void ImProcCoordinator::setScale(int prevscale) oprevl = new LabImage(pW, pH); nprevl = new LabImage(pW, pH); reserv = new LabImage(pW, pH); + lastorigimp = new LabImage(pW, pH); // nprevloc = new LabImage (pW, pH); //ncie is only used in ImProcCoordinator::updatePreviewImage, it will be allocated on first use and deleted if not used anymore diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 4139064f9..20027ac48 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -230,7 +230,8 @@ protected: //locallab LocallabListener* locallListener; - LabImage *reserv; + LabImage *reserv; + LabImage *lastorigimp; int coordX, coordY, localX, localY; LUTf lllocalcurve; LUTf cclocalcurve; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 115a3fb0b..9b5455b11 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -262,7 +262,7 @@ public: void calc_ref(int sp, LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huerefblur, double &chromarefblur, double &lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, float &avg); void copy_ref(LabImage* spotbuffer, LabImage* original, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp, double &huerefspot, double &chromarefspot, double &lumarefspot); void paste_ref(LabImage* spotbuffer, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp); - void Lab_Local(int call, int sp, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, const LocretitransCurve &locRETtransCcurve, LUTf & lllocalcurve, bool & locallutili, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, + void Lab_Local(int call, int sp, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, LabImage* lastorig, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, const LocretitransCurve &locRETtransCcurve, LUTf & lllocalcurve, bool & locallutili, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, LUTf & lmasklocalcurve, bool & localmaskutili, LUTf & lmaskexplocalcurve, bool & localmaskexputili, LUTf & lmaskSHlocalcurve, bool & localmaskSHutili, diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 75c540653..b996f61ff 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -596,6 +596,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.mergemet = 2; } else if (locallab.spots.at(sp).mergeMethod == "origmas") { lp.mergemet = 3; + } else if (locallab.spots.at(sp).mergeMethod == "lastspot") { + lp.mergemet = 4; + } else if (locallab.spots.at(sp).mergeMethod == "lastspotmas") { + lp.mergemet = 5; } if (locallab.spots.at(sp).mergecolMethod == "one") { @@ -7427,7 +7431,7 @@ void rgbtone(float& maxval, float& medval, float& minval, LUTf & lutToneCurve) } -void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * original, LabImage * transformed, LabImage * reserved, int cx, int cy, int oW, int oH, int sk, +void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * original, LabImage * transformed, LabImage * reserved, LabImage * lastorig, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, const LocretitransCurve & locRETtransCcurve, LUTf & lllocalcurve, bool & locallutili, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, LUTf & lmasklocalcurve, bool & localmaskutili, LUTf & lmaskexplocalcurve, bool & localmaskexputili, @@ -12059,9 +12063,15 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { + if(lp.mergemet == 2 || lp.mergemet == 3) { bufcolreserv->L[y][x] = reserved->L[y + ystart][x + xstart]; bufcolreserv->a[y][x] = reserved->a[y + ystart][x + xstart]; bufcolreserv->b[y][x] = reserved->b[y + ystart][x + xstart]; + } else { + bufcolreserv->L[y][x] = lastorig->L[y + ystart][x + xstart]; + bufcolreserv->a[y][x] = lastorig->a[y + ystart][x + xstart]; + bufcolreserv->b[y][x] = lastorig->b[y + ystart][x + xstart]; + } } } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 3e707f2df..dc7a160fc 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -975,6 +975,7 @@ private: labView = new LabImage(fw, fh); reservView = new LabImage(fw, fh); + lastorigView = new LabImage(fw, fh); if (params.blackwhite.enabled) { CurveFactory::curveBW(params.blackwhite.beforeCurve, params.blackwhite.afterCurve, hist16, dummy, customToneCurvebw1, customToneCurvebw2, 1); @@ -1085,6 +1086,7 @@ private: // bool locallutili = false; // bool localcutili = false; reservView->CopyFrom(labView); + lastorigView->CopyFrom(labView); if (params.locallab.enabled) { MyTime t1, t2; @@ -1262,7 +1264,7 @@ private: float Tmax; // No Locallab mask is shown in exported picture - ipf.Lab_Local(2, sp, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, locRETtransCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, + ipf.Lab_Local(2, sp, (float**)shbuffer, labView, labView, reservView, lastorigView, 0, 0, fw, fh, 1, locRETgainCurve, locRETtransCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, lmasklocalcurve, localmaskutili, lmaskexplocalcurve, localmaskexputili, lmaskSHlocalcurve, localmaskSHutili, @@ -1283,6 +1285,7 @@ private: huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + lastorigView->CopyFrom(labView); if (params.locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reservView, reservView, 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge); @@ -1328,6 +1331,8 @@ private: delete reservView; reservView = nullptr; + delete lastorigView; + lastorigView = nullptr; ipf.chromiLuminanceCurve(nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); @@ -1825,6 +1830,7 @@ private: Imagefloat *baseImg; LabImage* labView; LabImage* reservView; + LabImage* lastorigView; LUTu hist16; diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 3e98f6df1..5351d591c 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -291,6 +291,8 @@ ControlSpotPanel::ControlSpotPanel(): mergeMethod_->append(M("TP_LOCALLAB_MERGEONE")); mergeMethod_->append(M("TP_LOCALLAB_MERGETWO")); mergeMethod_->append(M("TP_LOCALLAB_MERGETHR")); + mergeMethod_->append(M("TP_LOCALLAB_MERGEFOU")); + mergeMethod_->append(M("TP_LOCALLAB_MERGEFIV")); mergeMethod_->set_active(0); mergeMethodconn_ = mergeMethod_->signal_changed().connect( sigc::mem_fun( diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 5eadae930..b94ef35c8 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -2950,6 +2950,14 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit r->mergeMethod = 3; merge1colFrame->show(); mergecolFrame->show(); + } else if (pp->locallab.spots.at(i).mergeMethod == "lastspot") { + r->mergeMethod = 4; + merge1colFrame->show(); + mergecolFrame->hide(); + } else if (pp->locallab.spots.at(i).mergeMethod == "lastspotmas") { + r->mergeMethod = 5; + merge1colFrame->show(); + mergecolFrame->hide(); } r->sensiexclu = pp->locallab.spots.at(i).sensiexclu; @@ -3083,6 +3091,14 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->mergeMethod = 3; merge1colFrame->show(); mergecolFrame->show(); + } else if (newSpot->mergeMethod == "lastspot") { + r->mergeMethod = 4; + merge1colFrame->show(); + mergecolFrame->hide(); + } else if (newSpot->mergeMethod == "lastspotmas") { + r->mergeMethod = 5; + merge1colFrame->show(); + mergecolFrame->show(); } @@ -3325,6 +3341,14 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->mergeMethod = 3; merge1colFrame->show(); mergecolFrame->show(); + } else if (newSpot->mergeMethod == "lastspot") { + r->mergeMethod = 4; + merge1colFrame->show(); + mergecolFrame->hide(); + } else if (newSpot->mergeMethod == "lastspotmas") { + r->mergeMethod = 5; + merge1colFrame->show(); + mergecolFrame->show(); } r->sensiexclu = newSpot->sensiexclu; @@ -3484,6 +3508,14 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).mergeMethod = "origmas"; merge1colFrame->show(); mergecolFrame->show(); + } else if (r->mergeMethod == 4) { + pp->locallab.spots.at(pp->locallab.selspot).mergeMethod = "lastspot"; + merge1colFrame->show(); + mergecolFrame->hide(); + } else if (r->mergeMethod == 5) { + pp->locallab.spots.at(pp->locallab.selspot).mergeMethod = "lastspotmas"; + merge1colFrame->show(); + mergecolFrame->show(); }