From 6ebc03b638b7817a7f7f3a38a24cc72ba7fa95d3 Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 20 Nov 2019 12:53:29 +0100 Subject: [PATCH] Improve GUI for merge file --- rtengine/iplocallab.cc | 60 ++++++++++++++++++++++++------------------ rtgui/locallab.cc | 48 +++++++++++++++++++++++++++++++-- rtgui/locallab.h | 1 + 3 files changed, 82 insertions(+), 27 deletions(-) diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 4247adcc2..c54196ad6 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -12387,7 +12387,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } } + float kd = 1.f;//correction to ctoning + if (lp.mergemet >= 2) { kd = 10.f * 0.01f * lp.strengrid; } @@ -12465,8 +12467,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bufcolfin->L[ir][jr] = bufcolcalcL; if (lp.mergemet >= 2) { - bufcolfin->a[ir][jr] = bufcolcalca * (1.f + 0.01f * (chprosl + chprocu)); - bufcolfin->b[ir][jr] = bufcolcalcb * (1.f + 0.01f * (chprosl + chprocu)); + bufcolfin->a[ir][jr] = bufcolcalca * (1.f + 0.01f * (chprosl + chprocu)); + bufcolfin->b[ir][jr] = bufcolcalcb * (1.f + 0.01f * (chprosl + chprocu)); } } @@ -12579,14 +12581,14 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bufcolfin->L[y][x] = (lp.opacol) * bufprov->L[y][x] + (1.f - lp.opacol) * bufcolreserv->L[y][x]; bufcolfin->a[y][x] = (lp.opacol) * bufprov->a[y][x] + (1.f - lp.opacol) * bufcolreserv->a[y][x]; bufcolfin->b[y][x] = (lp.opacol) * bufprov->b[y][x] + (1.f - lp.opacol) * bufcolreserv->b[y][x]; - + } } } - // if (conthr > 0.f && lp.mergemet != 4) { + // if (conthr > 0.f && lp.mergemet != 4) { if (conthr > 0.f) { #ifdef _OPENMP @@ -12611,7 +12613,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o std::unique_ptr buftemp; buftemp.reset(new LabImage(bfw, bfh)); bufprov.reset(new LabImage(bfw, bfh)); - + if (lp.mergemet == 4) { #ifdef _OPENMP @@ -12625,7 +12627,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bufprov->a[y][x] = (1.f - rdE[y][x]) * bufcolfin->a[y][x] + (rdE[y][x]) * bufcolreserv->a[y][x]; bufprov->b[y][x] = (1.f - rdE[y][x]) * bufcolfin->b[y][x] + (rdE[y][x]) * bufcolreserv->b[y][x]; } - } + } } else { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) @@ -12637,9 +12639,10 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bufprov->a[y][x] = (rdE[y][x]) * bufcolfin->a[y][x] + (1.f - rdE[y][x]) * bufcolreserv->a[y][x]; bufprov->b[y][x] = (rdE[y][x]) * bufcolfin->b[y][x] + (1.f - rdE[y][x]) * bufcolreserv->b[y][x]; } - } - + } + } + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -12693,7 +12696,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } if (conthr > 0.f) { - // if (conthr > 0.f && lp.mergemet != 4) { + // if (conthr > 0.f && lp.mergemet != 4) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -12714,17 +12717,17 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lp.mergecolMethod > 0 && lp.mergecolMethod <= 16) { //first deltaE #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) + #pragma omp parallel for schedule(dynamic,16) #endif - for (int y = 0; y < bfh ; y++) { - for (int x = 0; x < bfw; x++) { - bufcolfin->L[y][x] = (rdE[y][x]) * bufcolfin->L[y][x] + (1.f - rdE[y][x]) * bufcolreserv->L[y][x]; - bufcolfin->a[y][x] = (rdE[y][x]) * bufcolfin->a[y][x] + (1.f - rdE[y][x]) * bufcolreserv->a[y][x]; - bufcolfin->b[y][x] = (rdE[y][x]) * bufcolfin->b[y][x] + (1.f - rdE[y][x]) * bufcolreserv->b[y][x]; - } + for (int y = 0; y < bfh ; y++) { + for (int x = 0; x < bfw; x++) { + bufcolfin->L[y][x] = (rdE[y][x]) * bufcolfin->L[y][x] + (1.f - rdE[y][x]) * bufcolreserv->L[y][x]; + bufcolfin->a[y][x] = (rdE[y][x]) * bufcolfin->a[y][x] + (1.f - rdE[y][x]) * bufcolreserv->a[y][x]; + bufcolfin->b[y][x] = (rdE[y][x]) * bufcolfin->b[y][x] + (1.f - rdE[y][x]) * bufcolreserv->b[y][x]; } - + } + //prepare RGB values in 0 1(or more)for current image and reserved Imagefloat *tmpImageorig = nullptr; tmpImageorig = new Imagefloat(bfw, bfh); @@ -13110,6 +13113,10 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } + if (lp.softradiuscol > 0.f) { + softproc(bufcolreserv.get(), bufcolfin.get(), lp.softradiuscol, bfh, bfw, 0.0001, 0.00001, 0.1f, sk, multiThread, 0); + } + if (nottransit) { //special only transition //may be we can add preview... @@ -13146,18 +13153,21 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } - if (lp.softradiuscol > 0.f) { - softproc(bufcolorig.get(), bufcolfin.get(), lp.softradiuscol, bfh, bfw, 0.0001, 0.00001, 0.1f, sk, multiThread, 0); - } + if (!nottransit) { + + if (lp.softradiuscol > 0.f) { + softproc(bufcolorig.get(), bufcolfin.get(), lp.softradiuscol, bfh, bfw, 0.0001, 0.00001, 0.1f, sk, multiThread, 0); + } #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) + #pragma omp parallel for schedule(dynamic,16) #endif - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - buflight[ir][jr] = CLIPRET((bufcolfin->L[ir][jr] - bufcolorig->L[ir][jr]) / 328.f); - } + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + buflight[ir][jr] = CLIPRET((bufcolfin->L[ir][jr] - bufcolorig->L[ir][jr]) / 328.f); + } + } } diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index b2c237b28..b9b353c81 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -159,6 +159,7 @@ Locallab::Locallab(): // Color & Light llCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_LUM"))), HCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_HLH"))), + H2CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_HLH"))), rgbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_RGB"))), maskCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), maskHCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASKH"))), @@ -171,7 +172,7 @@ Locallab::Locallab(): toneMethod(Gtk::manage(new MyComboBoxText())), rgbshape(static_cast(rgbCurveEditorG->addCurve(CT_Diagonal, "", toneMethod))), LHshape(static_cast(HCurveEditorG->addCurve(CT_Flat, "L(H)", nullptr, false, true))), - HHshape(static_cast(HCurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true))), + HHshape(static_cast(H2CurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true))), CCmaskshape(static_cast(maskCurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false))), LLmaskshape(static_cast(maskCurveEditorG->addCurve(CT_Flat, "L(L)", nullptr, false, false))), HHmaskshape(static_cast(maskCurveEditorG->addCurve(CT_Flat, "LC(H)", nullptr, false, true))), @@ -777,6 +778,8 @@ pe(nullptr) const std::vector& mLHshape = six_shape; LHshape->setBottomBarBgGradient(mLHshape); + HCurveEditorG->curveListComplete(); + H2CurveEditorG->setCurveListener(this); HHshape->setIdentityValue(0.); HHshape->setResetCurve(FlatCurveType(defSpot.HHcurve.at(0)), defSpot.HHcurve); @@ -790,7 +793,7 @@ pe(nullptr) const std::vector& mHHshape = six_shape; HHshape->setBottomBarBgGradient(mHHshape); - HCurveEditorG->curveListComplete(); + H2CurveEditorG->curveListComplete(); rgbCurveEditorG->setCurveListener(this); @@ -978,6 +981,7 @@ pe(nullptr) colorBox->pack_start(*qualcurvbox); colorBox->pack_start(*llCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor colorBox->pack_start(*HCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + colorBox->pack_start(*H2CurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor colorBox->pack_start(*rgbCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor colorBox->pack_start(*special); colorBox->pack_start(*invers); @@ -5534,12 +5538,20 @@ void Locallab::merMethodChanged() sensi->set_sensitive(true); structcol->set_sensitive(true); blurcolde->set_sensitive(true); + H2CurveEditorG->set_sensitive(true); + rgbCurveEditorG->set_sensitive(true); + special->set_sensitive(true); + invers->set_sensitive(true); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 1) { mask7->hide(); sensi->set_sensitive(true); structcol->set_sensitive(true); blurcolde->set_sensitive(true); + H2CurveEditorG->set_sensitive(true); + rgbCurveEditorG->set_sensitive(true); + special->set_sensitive(true); + invers->set_sensitive(true); // conthrcol->hide(); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 2) { @@ -5547,12 +5559,20 @@ void Locallab::merMethodChanged() sensi->set_sensitive(false); structcol->set_sensitive(false); blurcolde->set_sensitive(false); + H2CurveEditorG->set_sensitive(false); + rgbCurveEditorG->set_sensitive(false); + special->set_sensitive(false); + invers->set_sensitive(false); // conthrcol->show(); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 3) { sensi->set_sensitive(false); structcol->set_sensitive(false); blurcolde->set_sensitive(false); + H2CurveEditorG->set_sensitive(false); + rgbCurveEditorG->set_sensitive(false); + special->set_sensitive(false); + invers->set_sensitive(false); mask7->show(); // conthrcol->show(); gridmerFrame->hide(); @@ -5562,6 +5582,10 @@ void Locallab::merMethodChanged() blurcolde->set_sensitive(false); sensi->set_sensitive(false); structcol->set_sensitive(false); + H2CurveEditorG->set_sensitive(false); + rgbCurveEditorG->set_sensitive(false); + special->set_sensitive(false); + invers->set_sensitive(false); gridmerFrame->show(); } @@ -10297,12 +10321,20 @@ void Locallab::updateSpecificGUIState() structcol->set_sensitive(true); sensi->set_sensitive(true); blurcolde->set_sensitive(true); + H2CurveEditorG->set_sensitive(true); + rgbCurveEditorG->set_sensitive(true); + special->set_sensitive(true); + invers->set_sensitive(true); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 1) { mask7->hide(); structcol->set_sensitive(true); sensi->set_sensitive(true); blurcolde->set_sensitive(true); + H2CurveEditorG->set_sensitive(true); + rgbCurveEditorG->set_sensitive(true); + special->set_sensitive(true); + invers->set_sensitive(true); // conthrcol->hide(); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 2) { @@ -10310,6 +10342,10 @@ void Locallab::updateSpecificGUIState() structcol->set_sensitive(false); sensi->set_sensitive(false); blurcolde->set_sensitive(false); + H2CurveEditorG->set_sensitive(false); + rgbCurveEditorG->set_sensitive(false); + special->set_sensitive(false); + invers->set_sensitive(false); // conthrcol->show(); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 3) { @@ -10317,6 +10353,10 @@ void Locallab::updateSpecificGUIState() structcol->set_sensitive(false); sensi->set_sensitive(false); blurcolde->set_sensitive(false); + H2CurveEditorG->set_sensitive(false); + rgbCurveEditorG->set_sensitive(false); + special->set_sensitive(false); + invers->set_sensitive(false); mask7->show(); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 3) { @@ -10324,6 +10364,10 @@ void Locallab::updateSpecificGUIState() structcol->set_sensitive(false); sensi->set_sensitive(false); blurcolde->set_sensitive(false); + H2CurveEditorG->set_sensitive(false); + rgbCurveEditorG->set_sensitive(false); + special->set_sensitive(false); + invers->set_sensitive(false); // conthrcol->hide(); gridmerFrame->show(); } diff --git a/rtgui/locallab.h b/rtgui/locallab.h index bbe72c6cb..8543fe7f6 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -77,6 +77,7 @@ private: // Color & Light CurveEditorGroup* const llCurveEditorG; CurveEditorGroup* const HCurveEditorG; + CurveEditorGroup* const H2CurveEditorG; CurveEditorGroup* const rgbCurveEditorG; CurveEditorGroup* const maskCurveEditorG; CurveEditorGroup* const maskHCurveEditorG;