From dcc9699f3afa99dc53f4aaa928d3d919c299a817 Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 10 Jun 2020 08:42:34 +0200 Subject: [PATCH] change behavior level contrast - reset slider extra --- rtdata/languages/default | 2 +- rtengine/ipwavelet.cc | 41 +++++++++++++++++++++------------------- rtgui/wavelet.cc | 6 +++--- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index a7b702d59..3fe241cf3 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2334,7 +2334,7 @@ TP_WAVELET_THRESHOLD2;Coarser levels //TP_WAVELET_THRESHOLD_TOOLTIP;Only levels beyond the chosen value will be affected by the highlight luminance range. Other levels will be fully treated. The chosen value here limits the highest possible value of the shadow levels. : All levels from level 1 up to the chosen value will only be affected within the Finer levels luminance range.\nAll other levels will have the whole range of luminances affected, unless the Coarser levels setting limits it.\nThe chosen value in this slider becomes the minimum possible value of the Coarser levels. //TP_WAVELET_THRESHOLD2_TOOLTIP;Only levels above the choosen value will be affected by the shadow luminance range. Other levels will be fully treated. The highest level possible is limited by the highlight level value (9 minus highlight level value). : Only levels between the chosen value and level 9/Extra will be affected by the Coarser levels luminance range.\nAll other levels will have the whole range of luminances affected, unless the Finer levels setting limits it.\nThe lower level possible that will be considered by the algorithm is limited by the Finer levels value. TP_WAVELET_THRESHOLD_TOOLTIP;Only levels beyond the chosen value will be affected by the highlight luminance range. -TP_WAVELET_THRESHOLD2_TOOLTIP;Only levels above the chosen value and selected 'wavelet levels' will be affected by the shadow luminance range (level 10 is not take into account)) +TP_WAVELET_THRESHOLD2_TOOLTIP;Only levels above the chosen value and selected 'wavelet levels' will be affected by the shadow luminance range. TP_WAVELET_THRESWAV;Balance Threshold TP_WAVELET_THRH;Highlights threshold TP_WAVELET_TILESBIG;Tiles diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 4740fa536..93913aad0 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -3619,10 +3619,12 @@ void ImProcFunctions::ContAllL(float *koeLi[12], float *maxkoeLi, bool lipschitz float red0 = 0.005f * (110.f - lowthr); float red1 = 0.008f * (110.f - lowthr); float red2 = 0.011f * (110.f - lowthr); - +// int n = 0; +// int m = 0; +// int p = 0; +// int q = 0; for (int i = 0; i < W_L * H_L; i++) { - float kLlevH = 1.f; - float kLlevS = 1.f; + float kLlev = 1.f; if (cpMul < 0.f) { lbeta = 1.f; // disabled for negatives values "less contrast" @@ -3727,41 +3729,42 @@ 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 if ((LL100 > cp.t_lhl * kH[level] && LL100 < cp.t_rhl * kH[level])) { - kLlevH = alpha; + kLlev = alpha; } else if ((LL100 > cp.b_lhl * kH[level] && LL100 <= cp.t_lhl * kH[level])) { - kLlevH = aaal * LL100 + bbal; + kLlev = aaal * LL100 + bbal; } else if ((LL100 > cp.t_rhl * kH[level] && LL100 <= cp.b_rhl * kH[level])) { - kLlevH = aaar * LL100 + bbbr; + kLlev = aaar * LL100 + bbbr; } else { - kLlevH = 1.f; + kLlev = 1.f; } - // kLlevH = 1.f + (kLlevH - 1.f) * klevred; - // kLlevH = 1.f + (kLlevH - 1.f); } - if (level >= cp.numlevS) { + if (level >= cp.numlevS - 1) { // 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; + kLlev = alpha; + // n++; } else if ((LL100 > cp.b_lsl && LL100 <= cp.t_lsl)) { - kLlevS = aaalS * LL100 + bbalS; + kLlev = aaalS * LL100 + bbalS; + // m++; } else if ((LL100 > cp.t_rsl && LL100 <= cp.b_rsl)) { - kLlevS = aaarS * LL100 + bbbrS; + kLlev = aaarS * LL100 + bbbrS; + // p++; } else { - kLlevS = 1.f; + kLlev = 1.f; + // q++; } - // kLlevS = 1.f - (kLlevS - 1.f) * klevred; } } else { - kLlevH = kLlevS = alpha; + kLlev = alpha; } - WavCoeffs_L[dir][i] *= (kLlevH * kLlevS); + WavCoeffs_L[dir][i] *= (kLlev); } + + // printf("lev=%i n=%i m=%i p=%i q=%i\n", level, n, m, p, q); } if (waOpacityCurveW) { diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 5e03b0ebb..21e84a52e 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -1166,8 +1166,7 @@ void Wavelet::updateGUI() const int temp2 = threshold2->getValue(); const int temp = threshold->getValue(); const int maxlev = thres->getValue(); - const int tempmax = (temp + 1) > maxlev ? maxlev : temp + 1; - threshold2->setLimits(temp, maxlev, 1, maxlev + 1); + threshold2->setLimits(temp + 1, maxlev, 1, maxlev + 1); threshold2 ->setValue(temp2); } @@ -1175,7 +1174,6 @@ void Wavelet::updateGUImaxlev() { const int temp4 = threshold->getValue(); const int temp3 = thres->getValue(); - // const int tempmax = (temp3) > 9 ? 9 : temp + 1; threshold->setLimits(1, temp3, 1, temp3); threshold ->setValue(temp4); } @@ -3698,6 +3696,8 @@ void Wavelet::neutralPressed() correction[i]->setValue(0); adjusterChanged(correction[i], 0); } + sup->setValue(0); + adjusterChanged(sup, 0); } void Wavelet::neutralchPressed()