Clean and format code

This commit is contained in:
Desmis 2020-01-21 18:33:29 +01:00
parent 4fa494da55
commit f53b1b4580
2 changed files with 162 additions and 131 deletions

View File

@ -1472,6 +1472,7 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, floa
float &b = rgb->b(y, x); float &b = rgb->b(y, x);
float t = Y[y][x]; float t = Y[y][x];
float t2; float t2;
if (t > noise && (t2 = norm(r, g, b)) > noise) { if (t > noise && (t2 = norm(r, g, b)) > noise) {
float c = apply(t, false); float c = apply(t, false);
float f = c / t; float f = c / t;
@ -4406,11 +4407,13 @@ void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, co
case 0: { // outside selection and outside transition zone => full effect, no transition case 0: { // outside selection and outside transition zone => full effect, no transition
float difL = loctemp[y][x] - original->L[y][x]; float difL = loctemp[y][x] - original->L[y][x];
transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE); transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE);
if (sharshow) { if (sharshow) {
transformed->a[y][x] = 0.f; transformed->a[y][x] = 0.f;
transformed->b[y][x] = ampli * 5.f * difL * reducdE; transformed->b[y][x] = ampli * 5.f * difL * reducdE;
} else if (previewshar) { } else if (previewshar) {
float difbdisp = reducview * 10000.f * lp.colorde; float difbdisp = reducview * 10000.f * lp.colorde;
if (transformed->L[y][x] < darklim) { //enhance dark luminance as user can see! if (transformed->L[y][x] < darklim) { //enhance dark luminance as user can see!
float dark = transformed->L[y][x]; float dark = transformed->L[y][x];
transformed->L[y][x] = dark * aadark + bbdark; transformed->L[y][x] = dark * aadark + bbdark;
@ -4436,11 +4439,13 @@ void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, co
difL *= factorx; difL *= factorx;
transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE); transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE);
if (sharshow) { if (sharshow) {
transformed->a[y][x] = 0.f; transformed->a[y][x] = 0.f;
transformed->b[y][x] = ampli * 5.f * difL * reducdE; transformed->b[y][x] = ampli * 5.f * difL * reducdE;
} else if (previewshar) { } else if (previewshar) {
float difbdisp = reducview * 10000.f * lp.colorde; float difbdisp = reducview * 10000.f * lp.colorde;
if (transformed->L[y][x] < darklim) { //enhance dark luminance as user can see! if (transformed->L[y][x] < darklim) { //enhance dark luminance as user can see!
float dark = transformed->L[y][x]; float dark = transformed->L[y][x];
transformed->L[y][x] = dark * aadark + bbdark; transformed->L[y][x] = dark * aadark + bbdark;
@ -4580,11 +4585,13 @@ void ImProcFunctions::Sharp_Local(int call, float **loctemp, int senstype, const
} }
transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE); transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE);
if (sharshow) { if (sharshow) {
transformed->a[y][x] = 0.f; transformed->a[y][x] = 0.f;
transformed->b[y][x] = ampli * 5.f * difL * reducdE; transformed->b[y][x] = ampli * 5.f * difL * reducdE;
} else if (previewshar) { } else if (previewshar) {
float difbdisp = reducview * 10000.f * lp.colorde; float difbdisp = reducview * 10000.f * lp.colorde;
if (transformed->L[y][x] < darklim) { //enhance dark luminance as user can see! if (transformed->L[y][x] < darklim) { //enhance dark luminance as user can see!
float dark = transformed->L[y][x]; float dark = transformed->L[y][x];
transformed->L[y][x] = dark * aadark + bbdark; transformed->L[y][x] = dark * aadark + bbdark;
@ -11648,15 +11655,16 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
for (int y = 0; y < bfhr; y++) { for (int y = 0; y < bfhr; y++) {
for (int x = 0; x < bfwr; x++) { for (int x = 0; x < bfwr; x++) {
// datain[y * bfwr + x] = temp->L[y][x] - bufexpfin->L[y][x];
datain[y * bfwr + x] = bufexpfin->L[y][x]; datain[y * bfwr + x] = bufexpfin->L[y][x];
} }
} }
int showorig = lp.showmasksoftmet; int showorig = lp.showmasksoftmet;
if (lp.showmasksoftmet >= 5) { if (lp.showmasksoftmet >= 5) {
showorig = 0; showorig = 0;
} }
//ImProcFunctions::retinex_pde(datain, dataout, bfwr, bfhr, 8.f * lp.strng, 1.f, dE, lp.showmasksoftmet, 1, 1);
ImProcFunctions::retinex_pde(datain, dataout, bfwr, bfhr, 8.f * lp.strng, 1.f, dE, showorig, 1, 1); ImProcFunctions::retinex_pde(datain, dataout, bfwr, bfhr, 8.f * lp.strng, 1.f, dE, showorig, 1, 1);
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16) #pragma omp parallel for schedule(dynamic,16)
@ -12167,7 +12175,6 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
transit_shapedetect2(call, 10, bufgb.get(), tmp1.get(), originalmasklc.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); transit_shapedetect2(call, 10, bufgb.get(), tmp1.get(), originalmasklc.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk);
// transit_shapedetect(10, tmp1.get(), nullptr, bufchro, false, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk);
tmp1.reset(); tmp1.reset();
} }

View File

@ -74,6 +74,7 @@ static double blurSlider2radius(double sval)
if (radius > MAXRAD) { if (radius > MAXRAD) {
radius = MAXRAD; radius = MAXRAD;
} }
return radius; return radius;
} }
@ -1699,6 +1700,7 @@ pe(nullptr)
if (complexsoft < 2) { if (complexsoft < 2) {
exposeBox->pack_start(*blurexpde); exposeBox->pack_start(*blurexpde);
} }
exposeBox->pack_start(*exptoolexp); exposeBox->pack_start(*exptoolexp);
@ -1945,6 +1947,7 @@ pe(nullptr)
if (complexsoft < 2) { if (complexsoft < 2) {
shadhighBox->pack_start(*blurSHde); shadhighBox->pack_start(*blurSHde);
} }
shadhighBox->pack_start(*gamFrame); shadhighBox->pack_start(*gamFrame);
// shadhighBox->pack_start(*gradSHFrame); // shadhighBox->pack_start(*gradSHFrame);
@ -2863,6 +2866,7 @@ pe(nullptr)
enablecontrastConn = expcontrast->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expcontrast)); enablecontrastConn = expcontrast->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expcontrast));
fftwlcConn = fftwlc->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::fftwlcChanged)); fftwlcConn = fftwlc->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::fftwlcChanged));
csThreshold->setAdjusterListener(this); csThreshold->setAdjusterListener(this);
if (showtooltip) { if (showtooltip) {
expcontrast->set_tooltip_text(M("TP_LOCALLAB_EXPCONTRAST_TOOLTIP")); expcontrast->set_tooltip_text(M("TP_LOCALLAB_EXPCONTRAST_TOOLTIP"));
} }
@ -2945,6 +2949,7 @@ pe(nullptr)
// wavshapecompre->setTooltip(M("TP_LOCALLAB_COMPRESS_TOOLTIP")); // wavshapecompre->setTooltip(M("TP_LOCALLAB_COMPRESS_TOOLTIP"));
// wavshapecomp->setTooltip(M("TP_LOCALLAB_COMPRESS_TOOLTIP")); // wavshapecomp->setTooltip(M("TP_LOCALLAB_COMPRESS_TOOLTIP"));
} }
if (showtooltip) { if (showtooltip) {
llshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); llshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP"));
} }
@ -3100,12 +3105,15 @@ pe(nullptr)
blurcontBox->pack_start(*gradwavFrame); blurcontBox->pack_start(*gradwavFrame);
blurcontBox->pack_start(*contFrame); blurcontBox->pack_start(*contFrame);
blurcontBox->pack_start(*compreFrame); blurcontBox->pack_start(*compreFrame);
if (complexsoft < 2) { if (complexsoft < 2) {
blurcontBox->pack_start(*compFrame); blurcontBox->pack_start(*compFrame);
} }
blurcontBox->pack_start(*blurlevelFrame); blurcontBox->pack_start(*blurlevelFrame);
expcontrastpyr->add(*blurcontBox, false); expcontrastpyr->add(*blurcontBox, false);
if (showtooltip) { if (showtooltip) {
fatdet->set_tooltip_text(M("TP_LOCALLAB_COMPFRAME_TOOLTIP")); fatdet->set_tooltip_text(M("TP_LOCALLAB_COMPFRAME_TOOLTIP"));
} }
@ -3146,6 +3154,7 @@ pe(nullptr)
if (complexsoft < 2) { if (complexsoft < 2) {
contrastBox->pack_start(*fftwlc); contrastBox->pack_start(*fftwlc);
} }
masklcCurveEditorG->setCurveListener(this); masklcCurveEditorG->setCurveListener(this);
CCmasklcshape->setIdentityValue(0.); CCmasklcshape->setIdentityValue(0.);
CCmasklcshape->setResetCurve(FlatCurveType(defSpot.CCmasklccurve.at(0)), defSpot.CCmasklccurve); CCmasklcshape->setResetCurve(FlatCurveType(defSpot.CCmasklccurve.at(0)), defSpot.CCmasklccurve);
@ -4407,6 +4416,7 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit
r->colorde = pp->locallab.spots.at(i).colorde; r->colorde = pp->locallab.spots.at(i).colorde;
r->transitweak = pp->locallab.spots.at(i).transitweak; r->transitweak = pp->locallab.spots.at(i).transitweak;
r->transitgrad = pp->locallab.spots.at(i).transitgrad; r->transitgrad = pp->locallab.spots.at(i).transitgrad;
if (complexsoft == 2) { if (complexsoft == 2) {
r->transitweak = 1; r->transitweak = 1;
r->transitgrad = 0; r->transitgrad = 0;
@ -4496,6 +4506,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited
r->sensiexclu = newSpot->sensiexclu; r->sensiexclu = newSpot->sensiexclu;
r->structexclu = newSpot->structexclu; r->structexclu = newSpot->structexclu;
r->struc = newSpot->struc; r->struc = newSpot->struc;
if (complexsoft == 2) { if (complexsoft == 2) {
r->shapeMethod = 0; r->shapeMethod = 0;
} }
@ -4560,10 +4571,12 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited
r->colorde = newSpot->colorde; r->colorde = newSpot->colorde;
r->transitweak = newSpot->transitweak; r->transitweak = newSpot->transitweak;
r->transitgrad = newSpot->transitgrad; r->transitgrad = newSpot->transitgrad;
if (complexsoft == 2) { if (complexsoft == 2) {
r->transitweak = 1; r->transitweak = 1;
r->transitgrad = 0; r->transitgrad = 0;
} }
r->scopemask = newSpot->scopemask; r->scopemask = newSpot->scopemask;
r->lumask = newSpot->lumask; r->lumask = newSpot->lumask;
r->avoid = newSpot->avoid; r->avoid = newSpot->avoid;
@ -4747,6 +4760,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited
} else { } else {
r->shapeMethod = 3; r->shapeMethod = 3;
} }
if (complexsoft == 2) { if (complexsoft == 2) {
r->shapeMethod = 0; r->shapeMethod = 0;
} }
@ -4801,6 +4815,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited
r->colorde = newSpot->colorde; r->colorde = newSpot->colorde;
r->transitweak = newSpot->transitweak; r->transitweak = newSpot->transitweak;
r->transitgrad = newSpot->transitgrad; r->transitgrad = newSpot->transitgrad;
if (complexsoft == 2) { if (complexsoft == 2) {
r->transitweak = 1; r->transitweak = 1;
r->transitgrad = 0; r->transitgrad = 0;
@ -4896,10 +4911,12 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited
pp->locallab.spots.at(pp->locallab.selspot).sensiexclu = r->sensiexclu; pp->locallab.spots.at(pp->locallab.selspot).sensiexclu = r->sensiexclu;
pp->locallab.spots.at(pp->locallab.selspot).structexclu = r->structexclu; pp->locallab.spots.at(pp->locallab.selspot).structexclu = r->structexclu;
pp->locallab.spots.at(pp->locallab.selspot).struc = r->struc; pp->locallab.spots.at(pp->locallab.selspot).struc = r->struc;
if (complexsoft == 2) { if (complexsoft == 2) {
pp->locallab.spots.at(pp->locallab.selspot).shapeMethod = "IND"; pp->locallab.spots.at(pp->locallab.selspot).shapeMethod = "IND";
r->shapeMethod = 0; r->shapeMethod = 0;
} }
if (r->shapeMethod == 0) { if (r->shapeMethod == 0) {
pp->locallab.spots.at(pp->locallab.selspot).shapeMethod = "IND"; pp->locallab.spots.at(pp->locallab.selspot).shapeMethod = "IND";
} else if (r->shapeMethod == 1) { } else if (r->shapeMethod == 1) {
@ -4941,6 +4958,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited
pp->locallab.spots.at(pp->locallab.selspot).colorde = r->colorde; pp->locallab.spots.at(pp->locallab.selspot).colorde = r->colorde;
pp->locallab.spots.at(pp->locallab.selspot).transitweak = r->transitweak; pp->locallab.spots.at(pp->locallab.selspot).transitweak = r->transitweak;
pp->locallab.spots.at(pp->locallab.selspot).transitgrad = r->transitgrad; pp->locallab.spots.at(pp->locallab.selspot).transitgrad = r->transitgrad;
if (complexsoft == 2) { if (complexsoft == 2) {
r->transitweak = 1; r->transitweak = 1;
r->transitgrad = 0; r->transitgrad = 0;
@ -6818,6 +6836,7 @@ void Locallab::curveChanged(CurveEditor* ce)
} }
} }
//denoise //denoise
if (getEnabled() && expdenoi->getEnabled()) { if (getEnabled() && expdenoi->getEnabled()) {
@ -8249,6 +8268,7 @@ void Locallab::inversexChanged()
expMethod->show(); expMethod->show();
exnoiseMethod->show(); exnoiseMethod->show();
expgradexp->show(); expgradexp->show();
if (expMethod->get_active_row_number() == 0) { if (expMethod->get_active_row_number() == 0) {
pdeFrame->hide(); pdeFrame->hide();
softradiusexp->show(); softradiusexp->show();
@ -12330,6 +12350,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
lapmaskbl->setValue(0); lapmaskbl->setValue(0);
LLmaskblshapewav->reset(); LLmaskblshapewav->reset();
} }
/* /*
if (fftwbl->get_active()) { if (fftwbl->get_active()) {
radius->setLimits(1.5, 1000., 0.5, 1.5); radius->setLimits(1.5, 1000., 0.5, 1.5);
@ -12338,6 +12359,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
} }
*/ */
radius->setValue(pp->locallab.spots.at(index).radius); radius->setValue(pp->locallab.spots.at(index).radius);
/* /*
if (complexsoft == 2) { if (complexsoft == 2) {
radius->setLimits(1.5, 100., 0.5, 1.5); radius->setLimits(1.5, 100., 0.5, 1.5);
@ -12559,6 +12581,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
LLmaskcbshape->setCurve(pp->locallab.spots.at(index).LLmaskcbcurve); LLmaskcbshape->setCurve(pp->locallab.spots.at(index).LLmaskcbcurve);
HHmaskcbshape->setCurve(pp->locallab.spots.at(index).HHmaskcbcurve); HHmaskcbshape->setCurve(pp->locallab.spots.at(index).HHmaskcbcurve);
Lmaskcbshape->setCurve(pp->locallab.spots.at(index).Lmaskcbcurve); Lmaskcbshape->setCurve(pp->locallab.spots.at(index).Lmaskcbcurve);
/* /*
if (complexsoft == 2) { if (complexsoft == 2) {
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
@ -13352,6 +13375,7 @@ void Locallab::updateSpecificGUIState()
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
multipliersh[i]->hide(); multipliersh[i]->hide();
} }
expgradsh->hide(); expgradsh->hide();
detailSH->hide(); detailSH->hide();