Skip to content

Commit 47781dc

Browse files
committed
Improve behavior DR vs deltaE - log encoding and pre-ciecam
1 parent 4584cc2 commit 47781dc

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

rtengine/iplocallab.cc

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ struct local_params {
699699
float decaycie;
700700
float blurciemask;
701701
float contciemask;
702-
702+
bool islogcie;
703703
int noiselequal;
704704
float noisechrodetail;
705705
float bilat;
@@ -862,7 +862,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
862862
// if (thre > 8.f || thre < 0.f) {//to avoid artifacts if user does not clear cache with new settings. Can be suppressed after
863863
// thre = 2.f;
864864
// }
865-
thre = LIM(thre, 0.f, 10.0f);
865+
thre = LIM(thre, 0.f, 15.0f);
866866

867867
double local_x = locallab.spots.at(sp).loc.at(0) / 2000.0;
868868
double local_y = locallab.spots.at(sp).loc.at(2) / 2000.0;
@@ -952,7 +952,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
952952
lp.showmask_met = ll_Mask;
953953
lp.showmaskciemet = llcieMask;
954954
lp.fftcieMask = locallab.spots.at(sp).fftcieMask;
955-
955+
lp.islogcie = locallab.spots.at(sp).logcie;
956956
lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llsoftMask == 0 && llColorMaskinv == 0 && llSHMaskinv == 0 && llColorMask == 0 && llExpMaskinv == 0 && lllcMask == 0 && llsharMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0;// Exposure mask is deactivated if Color & Light mask is visible
957957
lp.enaColorMaskinv = locallab.spots.at(sp).enaColorMask && llColorMaskinv == 0 && llSHMaskinv == 0 && llsoftMask == 0 && lllcMask == 0 && llsharMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0;// Exposure mask is deactivated if Color & Light mask is visible
958958
lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && llColorMask == 0 && llColorMaskinv == 0 && llsoftMask == 0 && lllcMask == 0 && llsharMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0;// Exposure mask is deactivated if Color & Light mask is visible
@@ -9173,12 +9173,19 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in
91739173

91749174
//parameters deltaE
91759175
//increase a bit lp.thr and lp.iterat and kL if HDR only with log encoding and CAM16 Jz
9176-
if (senstype == 11 || senstype == 31) {
9176+
int limvarsens = 50;
9177+
if ((senstype == 11 || (senstype == 31 && lp.islogcie)) && (varsens < limvarsens)) {
91779178
lp.thr *= 1.2f;
91789179
lp.iterat *= 1.2f;
9179-
kL *= 1.2f;
9180+
kL /= 1.2f;
9181+
} else if ((senstype == 11 || (senstype == 31 && lp.islogcie)) && (varsens >= limvarsens)) {
9182+
lp.thr += 10.f;
9183+
lp.thr = LIM(lp.thr, 0.f, 15.0f);
9184+
lp.balance -= 2.3f;
9185+
lp.balance = LIM(lp.balance, 0.05f, 2.5f);
9186+
kL = lp.balance / SQR(327.68f);
91809187
}
9181-
9188+
91829189
const float mindE = 2.f + MINSCOPE * varsens * lp.thr;
91839190
const float maxdE = 5.f + MAXSCOPE * varsens * (1 + 0.1f * lp.thr);
91849191
const float mindElim = 2.f + MINSCOPE * limscope * lp.thr;
@@ -9264,8 +9271,14 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in
92649271

92659272
const float dE = rsob + std::sqrt(kab * (kch * chrodelta2 + kH * huedelta2) + kL * SQR(refL - maskptr->L[y][x]));
92669273
//reduction action with deltaE
9267-
const float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, varsens);
9268-
9274+
float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, varsens);
9275+
// float reducdEL = reducdE;
9276+
if ((senstype == 11 || ( senstype == 31 && lp.islogcie)) && (varsens >= limvarsens)) {
9277+
int maxvarsens = 90;
9278+
float ared = (1.f - reducdE) / (maxvarsens - limvarsens);
9279+
float bred = 1.f - ared * maxvarsens;
9280+
reducdE = ared * varsens + bred;
9281+
}
92699282
float cli = (bufexpfin->L[y][x] - bufexporig->L[y][x]);
92709283
float cla = (bufexpfin->a[y][x] - bufexporig->a[y][x]);
92719284
float clb = (bufexpfin->b[y][x] - bufexporig->b[y][x]);

rtgui/controlspotpanel.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ ControlSpotPanel::ControlSpotPanel():
7272
transitgrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSITGRAD"), -1.0, 1.0, 0.01, 0.0))),
7373
feather_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FEATVALUE"), 10., 100., 0.1, 25.))),
7474
struc_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1.0, 12.0, 0.1, 4.0))),
75-
thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0.0, 10.0, 0.1, 2.0))),
75+
thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0.0, 15.0, 0.1, 2.0))),
7676
iter_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0.2, 10.0, 0.1, 2.0))),
77-
balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16.png")), Gtk::manage(new RTImage("circle-white-small.png"))))),
77+
balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.05, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16.png")), Gtk::manage(new RTImage("circle-white-small.png"))))),
7878
balanh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALANH"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16.png")), Gtk::manage(new RTImage("circle-red-green-small.png"))))),
7979
colorde_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORDE"), -15, 15, 2, 5, Gtk::manage(new RTImage("circle-blue-yellow-small.png")), Gtk::manage(new RTImage("circle-gray-green-small.png"))))),
8080
colorscope_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORSCOPE"), 0., 100.0, 1., 30.))),

0 commit comments

Comments
 (0)