diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 3a803c25b..12311d14b 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1171,6 +1171,9 @@ void Crop::update(int todo) bool cclutili = parent->cclutili; LUTu dummy; + + parent->ipf.shadowsHighlights(labnCrop, params.sh.enabled, params.sh.lab,params.sh.highlights ,params.sh.shadows, params.sh.radius, skip, params.sh.htonalwidth, params.sh.stonalwidth); + if (params.localContrast.enabled) { // Alberto's local contrast parent->ipf.localContrast(labnCrop, labnCrop->L, params.localContrast, false, skip); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 04158a50e..1bcdef5c3 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -1284,9 +1284,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if ((todo & (M_LUMINANCE + M_COLOR)) || (todo & M_AUTOEXP)) { nprevl->CopyFrom(oprevl); - histCCurve.clear(); histLCurve.clear(); + + ipf.shadowsHighlights(nprevl, params->sh.enabled, params->sh.lab,params->sh.highlights ,params->sh.shadows, params->sh.radius, scale, params->sh.htonalwidth, params->sh.stonalwidth); + if (params->localContrast.enabled) { // Alberto's local contrast ipf.localContrast(nprevl, nprevl->L, params->localContrast, false, scale); diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 82a03712b..261724384 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -3590,7 +3590,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } // shadowsHighlights(lab); - shadowsHighlights(lab, params->sh.enabled, params->sh.lab,params->sh.highlights ,params->sh.shadows, params->sh.radius, scale, params->sh.htonalwidth, params->sh.stonalwidth); + // shadowsHighlights(lab, params->sh.enabled, params->sh.lab,params->sh.highlights ,params->sh.shadows, params->sh.radius, scale, params->sh.htonalwidth, params->sh.stonalwidth); /* if (params->localContrast.enabled) { // Alberto's local contrast diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 778d26ebb..6abd9ec4f 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -5713,7 +5713,8 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexpo const int xend = rtengine::min(static_cast(lp.xc + lp.lx) - cx, original->W); const int bfw = xend - xstart; const int bfh = yend - ystart; - // printf("h=%f l=%f c=%f s=%f\n", hueref, lumaref, chromaref, sobelref); +// printf("h=%f l=%f c=%f s=%f\n", hueref, lumaref, chromaref, sobelref); +// printf("bfh=%i bfw=%i\n", bfh, bfw); const float ach = lp.trans / 100.f; float varsens = lp.sensex; @@ -12252,7 +12253,6 @@ void ImProcFunctions::Lab_Local( const int xend = rtengine::min(static_cast(lp.xc + lp.lx) - cx, original->W); int bfh = yend - ystart; int bfw = xend - xstart; - if (bfw > 65 && bfh > 65) { array2D bufsh(bfw, bfh); JaggedArray bufchrom(bfw, bfh, true); @@ -12271,9 +12271,9 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif - for (int y = 0; y < bfh; y++) { - for (int x = 0; x < bfw; x++) { - loctemp->L[y][x] = original->L[y + ystart][x + xstart]; + for (int y = ystart; y < yend; y++) { + for (int x = xstart; x < xend; x++) { + loctemp->L[y - ystart][x - xstart] = original->L[y][x]; } } @@ -12360,6 +12360,7 @@ void ImProcFunctions::Lab_Local( bufsh[y - ystart][x - xstart] = origcbdl->L[y - ystart][x - xstart] = original->L[y][x]; loctemp->a[y - ystart][x - xstart] = origcbdl->a[y - ystart][x - xstart] = original->a[y][x]; loctemp->b[y - ystart][x - xstart] = origcbdl->b[y - ystart][x - xstart] = original->b[y][x]; + loctemp->L[y - ystart][x - xstart] = origcbdl->b[y - ystart][x - xstart] = original->L[y][x]; } } @@ -12373,6 +12374,7 @@ void ImProcFunctions::Lab_Local( ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, lp.mulloc, 1.f, lp.threshol, lp.clarityml, lp.contresid, skinprot, false, b_l, t_l, t_r, b_r, choice, sk, multiThread); + if (lp.softradiuscb > 0.f) { softproc(origcbdl.get(), loctemp.get(), lp.softradiuscb, bfh, bfw, 0.001, 0.00001, 0.5f, sk, multiThread, 1); } @@ -12385,6 +12387,7 @@ void ImProcFunctions::Lab_Local( bool invmask = false; maskrecov(loctemp.get(), original, bufmaskorigcb.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); } + } transit_shapedetect(6, loctemp.get(), originalmaskcb.get(), bufchrom, false, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); @@ -12393,6 +12396,7 @@ void ImProcFunctions::Lab_Local( //chroma CBDL begin here if (lp.chromacb > 0.f && !nochroma) { + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif @@ -12448,14 +12452,15 @@ void ImProcFunctions::Lab_Local( } transit_shapedetect(7, loctemp.get(), nullptr, bufchrom, false, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); - bufsh.free(); - - if (lp.recur) { - original->CopyFrom(transformed, multiThread); - float avge; - calc_ref(sp, original, transformed, 0, 0, original->W, original->H, sk, huerefblur, chromarefblur, lumarefblur, hueref, chromaref, lumaref, sobelref, avge, locwavCurveden, locwavdenutili); - } } + bufsh.free(); + + if (lp.recur) { + original->CopyFrom(transformed, multiThread); + float avge; + calc_ref(sp, original, transformed, 0, 0, original->W, original->H, sk, huerefblur, chromarefblur, lumarefblur, hueref, chromaref, lumaref, sobelref, avge, locwavCurveden, locwavdenutili); + } + } } } diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 8d91bdcd7..1f071e37a 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -76,13 +76,13 @@ int refreshmap[rtengine::NUMOFEVENTS] = { 0, // free entry RGBCURVE | M_AUTOEXP, // EvDCPToneCurve, ALLNORAW, // EvDCPIlluminant, - RETINEX, // EvSHEnabled, - AUTOEXP, // EvSHHighlights, - AUTOEXP, // EvSHShadows, - AUTOEXP, // EvSHHLTonalW, - AUTOEXP, // EvSHSHTonalW, + LUMINANCECURVE, // EvSHEnabled, + LUMINANCECURVE, // EvSHHighlights, + LUMINANCECURVE, // EvSHShadows, + LUMINANCECURVE, // EvSHHLTonalW, + LUMINANCECURVE, // EvSHSHTonalW, AUTOEXP, // EvSHLContrast, - RETINEX, // EvSHRadius, + LUMINANCECURVE, // EvSHRadius, ALLNORAW, // EvCTRotate, ALLNORAW, // EvCTHFlip, ALLNORAW, // EvCTVFlip, diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index c526a7d1a..2f0eb5b25 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1438,6 +1438,8 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 16); + ipf.shadowsHighlights(labView, params.sh.enabled, params.sh.lab,params.sh.highlights ,params.sh.shadows, params.sh.radius, 16, params.sh.htonalwidth, params.sh.stonalwidth); + if (params.localContrast.enabled) { // Alberto's local contrast ipf.localContrast(labView, labView->L, params.localContrast, false, 16); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 147bba408..fc4109545 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1346,6 +1346,9 @@ private: bool ccutili, cclutili; CurveFactory::complexsgnCurve(autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 1); + + ipf.shadowsHighlights(labView, params.sh.enabled, params.sh.lab,params.sh.highlights ,params.sh.shadows, params.sh.radius, 1, params.sh.htonalwidth, params.sh.stonalwidth); + if (params.localContrast.enabled) { // Alberto's local contrast ipf.localContrast(labView, labView->L, params.localContrast, false, 1);//scale); diff --git a/rtgui/shadowshighlights.cc b/rtgui/shadowshighlights.cc index f6ab4811a..a168527d6 100644 --- a/rtgui/shadowshighlights.cc +++ b/rtgui/shadowshighlights.cc @@ -28,7 +28,7 @@ using namespace rtengine::procparams; ShadowsHighlights::ShadowsHighlights () : FoldableToolPanel(this, "shadowshighlights", M("TP_SHADOWSHLIGHTS_LABEL"), false, true) { auto m = ProcEventMapper::getInstance(); - EvSHColorspace = m->newEvent(RGBCURVE, "HISTORY_MSG_SH_COLORSPACE"); + EvSHColorspace = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_SH_COLORSPACE"); Gtk::Box* hb = Gtk::manage (new Gtk::Box ()); hb->pack_start(*Gtk::manage(new Gtk::Label(M("TP_DIRPYRDENOISE_MAIN_COLORSPACE") + ": ")), Gtk::PACK_SHRINK);