From ad48610dfb832b8702c5de6ce427b98984008fed Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 9 Jun 2020 11:00:48 +0200 Subject: [PATCH] Improve and clean code --- rtengine/ipwavelet.cc | 12 ++++++------ rtengine/procparams.cc | 39 ++++++++++++++++++++++++++++++++++++++- rtgui/wavelet.cc | 7 ++----- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index fb358a105..5b0c8e922 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -3726,8 +3726,8 @@ void ImProcFunctions::ContAllL(float *koeLi[12], float *maxkoeLi, bool lipschitz float bbbrS = 1.f - cp.b_rsl * aaarS; if (level <= cp.numlevH) { //in function of levels - // float klevred = 2.f * (waOpacityCurveSH[level * 55.5f] - 0.5f); - // if(klevred > 0.f && level <= 6) {// level < 6 to avoid bad use of the curve if user put negative values positives + // float klevred = 2.f * (waOpacityCurveSH[level * 55.5f] - 0.5f); + // if(klevred > 0.f && level <= 6) {// level < 6 to avoid bad use of the curve if user put negative values positives if ((LL100 > cp.t_lhl * kH[level] && LL100 < cp.t_rhl * kH[level])) { kLlevH = alpha; } else if ((LL100 > cp.b_lhl * kH[level] && LL100 <= cp.t_lhl * kH[level])) { @@ -3737,12 +3737,12 @@ void ImProcFunctions::ContAllL(float *koeLi[12], float *maxkoeLi, bool lipschitz } else { kLlevH = 1.f; } - // kLlevH = 1.f + (kLlevH - 1.f) * klevred; - // kLlevH = 1.f + (kLlevH - 1.f); + // kLlevH = 1.f + (kLlevH - 1.f) * klevred; + // kLlevH = 1.f + (kLlevH - 1.f); } if (level >= (9 - cp.numlevS)) { - // if(klevred < 0.f && level >= 3) {//level > 3 to avoid bad use of the curve if user put positives values negatives + // if(klevred < 0.f && level >= 3) {//level > 3 to avoid bad use of the curve if user put positives values negatives if ((LL100 > cp.t_lsl && LL100 < cp.t_rsl)) { kLlevS = alpha; } else if ((LL100 > cp.b_lsl && LL100 <= cp.t_lsl)) { @@ -3752,7 +3752,7 @@ void ImProcFunctions::ContAllL(float *koeLi[12], float *maxkoeLi, bool lipschitz } else { kLlevS = 1.f; } - // kLlevS = 1.f - (kLlevS - 1.f) * klevred; + // kLlevS = 1.f - (kLlevS - 1.f) * klevred; } } else { diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index fcd55dd11..52a279ae4 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2194,6 +2194,42 @@ WaveletParams::WaveletParams() : 0.35, 0.35 }, + opacityCurveSH{ + static_cast(FCT_MinMaxCPoints), + 0., + 1., + 0.35, + 0.35, + 0.15, + 0.9, + 0.35, + 0.35, + 0.4, + 0.8, + 0.35, + 0.35, + 0.4, + 0.5, + 0.35, + 0.35, + 0.5, + 0.5, + 0.35, + 0.35, + 0.5, + 0.2, + 0.35, + 0.35, + 0.8, + 0.1, + 0.35, + 0.35, + 1.0, + 0., + 0.35, + 0.35 + }, +/* opacityCurveSH{ static_cast(FCT_MinMaxCPoints), 0.0, @@ -2213,6 +2249,7 @@ WaveletParams::WaveletParams() : 0.35, 0.35 }, +*/ opacityCurveBY{ static_cast(FCT_MinMaxCPoints), 0.0, @@ -2343,7 +2380,7 @@ WaveletParams::WaveletParams() : thres(7), chroma(5), chro(0), - threshold(5), + threshold(4), threshold2(5), edgedetect(90), edgedetectthr(20), diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 0a522bd6f..446e62b5e 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -1165,11 +1165,8 @@ void Wavelet::updateGUI() { const int temp2 = threshold2->getValue(); const int temp = threshold->getValue(); - int tempmax = temp + 1; - if(tempmax > 9) { - tempmax = 9; - } - threshold2->setLimits(temp, 9, 1, temp + 1); + const int tempmax = (temp + 1) > 9 ? 9 : temp + 1; + threshold2->setLimits(temp, 9, 1, tempmax); threshold2 ->setValue(temp2); }