From 3ad786745cf11fade334ff41aad0573dfcd7c04e Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 23 Mar 2021 16:59:54 +0100 Subject: [PATCH] LA - Move colortoning labgrid from rgb to lab - issue #6132 (#6173) * Move colortoning labgrid from rgb to lab * Remove unnecessary variables --- rtengine/dcrop.cc | 3 +++ rtengine/improccoordinator.cc | 3 +++ rtengine/improcfun.cc | 14 +++++++------- rtengine/rtthumbnail.cc | 5 +++++ rtengine/simpleprocess.cc | 5 +++++ rtgui/colortoning.cc | 3 ++- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 12311d14b..fb0394df5 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1171,6 +1171,9 @@ void Crop::update(int todo) bool cclutili = parent->cclutili; LUTu dummy; + if (params.colorToning.enabled && params.colorToning.method == "LabGrid") { + parent->ipf.colorToningLabGrid(labnCrop, 0,labnCrop->W , 0, labnCrop->H, false); + } 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); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index c12bbb822..49e92c5c9 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -1286,6 +1286,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) nprevl->CopyFrom(oprevl); histCCurve.clear(); histLCurve.clear(); + if (params->colorToning.enabled && params->colorToning.method == "LabGrid") { + ipf.colorToningLabGrid(nprevl, 0, nprevl->W, 0, nprevl->H, false); + } 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); diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 9998f3615..047f045e2 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -2231,7 +2231,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } bool hasColorToning = params->colorToning.enabled && bool (ctOpacityCurve) && bool (ctColorCurve) && params->colorToning.method != "LabGrid"; - bool hasColorToningLabGrid = params->colorToning.enabled && params->colorToning.method == "LabGrid"; +// bool hasColorToningLabGrid = params->colorToning.enabled && params->colorToning.method == "LabGrid"; // float satLimit = float(params->colorToning.satProtectionThreshold)/100.f*0.7f+0.3f; // float satLimitOpacity = 1.f-(float(params->colorToning.saturatedOpacity)/100.f); float strProtect = pow_F((float (params->colorToning.strength) / 100.f), 0.4f); @@ -3184,9 +3184,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++) { @@ -3565,9 +3565,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); + // } } diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 2f0eb5b25..1cc45aef6 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1438,6 +1438,11 @@ 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); + + if (params.colorToning.enabled && params.colorToning.method == "LabGrid") { + ipf.colorToningLabGrid(labView, 0,labView->W , 0, labView->H, false); + } + 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) { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index fc4109545..c8e1a4877 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1347,6 +1347,11 @@ private: CurveFactory::complexsgnCurve(autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 1); + + if (params.colorToning.enabled && params.colorToning.method == "LabGrid") { + ipf.colorToningLabGrid(labView, 0,labView->W , 0, labView->H, false); + } + 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) { diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index d3c485baa..51ca3a4bc 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -346,7 +346,8 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR //------------------------------------------------------------------------ // LAB grid auto m = ProcEventMapper::getInstance(); - EvColorToningLabGridValue = m->newEvent(RGBCURVE, "HISTORY_MSG_COLORTONING_LABGRID_VALUE"); +// EvColorToningLabGridValue = m->newEvent(RGBCURVE, "HISTORY_MSG_COLORTONING_LABGRID_VALUE"); + EvColorToningLabGridValue = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABGRID_VALUE"); labgrid = Gtk::manage(new LabGrid(EvColorToningLabGridValue, M("TP_COLORTONING_LABGRID_VALUES"))); pack_start(*labgrid, Gtk::PACK_EXPAND_WIDGET, 4); //------------------------------------------------------------------------