Enable inverse with tone equalizer

This commit is contained in:
Desmis 2019-10-23 07:51:06 +02:00
parent 9dd3d002a4
commit a5298d3434
2 changed files with 160 additions and 73 deletions

View File

@ -1154,6 +1154,7 @@ void tone_eq(array2D<float> &R, array2D<float> &G, array2D<float> &B, const stru
float c = process_pixel(y);
lut[i] = c;
}
/*
#ifdef __SSE2__
vfloat vfactors[12];
@ -1204,6 +1205,7 @@ void tone_eq(array2D<float> &R, array2D<float> &G, array2D<float> &B, const stru
for (int y = 0; y < H; ++y) {
int x = 0;
/*
#ifdef __SSE2__
@ -1233,6 +1235,7 @@ void tone_eq(array2D<float> &R, array2D<float> &G, array2D<float> &B, const stru
B[y][x] *= corr;
}
}
printf("OK 18\n");
}
@ -4518,9 +4521,59 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, struct loca
}
}
if (params->locallab.spots.at(sp).shMethod == "std") {
ImProcFunctions::shadowsHighlights(temp, lp.hsena, 1, lp.highlihs, lp.shadowhs, lp.radiushs, sk, lp.hltonalhs, lp.shtonalhs);
}
if (params->locallab.spots.at(sp).shMethod == "tone") {
int GH = transformed->H;
int GW = transformed->W;
// printf("OK 1 invers \n");
array2D<float> Rtemp;
Rtemp(GW, GH);
array2D<float> Gtemp;
Gtemp(GW, GH);
array2D<float> Btemp;
Btemp(GW, GH);
double scal = (double)(sk);
Imagefloat *tmpImage = nullptr;
tmpImage = new Imagefloat(GW, GH);
lab2rgb(*temp, *tmpImage, params->icm.workingProfile);
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int y = 0; y < GH ; y++) {
for (int x = 0; x < GW; x++) {
Rtemp[y][x] = LIM01(tmpImage->r(y, x) / 65536.f);
Gtemp[y][x] = LIM01(tmpImage->g(y, x) / 65536.f);
Btemp[y][x] = LIM01(tmpImage->b(y, x) / 65536.f);
}
}
tone_eq(Rtemp, Gtemp, Btemp, lp, params->icm.workingProfile, scal, multiThread);
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int y = 0; y < GH ; y++) {
for (int x = 0; x < GW; x++) {
tmpImage->r(y, x) = 65536.f * Rtemp[y][x];
tmpImage->g(y, x) = 65536.f * Gtemp[y][x];
tmpImage->b(y, x) = 65536.f * Btemp[y][x];
}
}
rgb2lab(*tmpImage, *temp, params->icm.workingProfile);
delete tmpImage;
}
}
if (senstype == 1) { //exposure
temp = new LabImage(GW, GH);
#ifdef _OPENMP

View File

@ -487,6 +487,7 @@ Locallab::Locallab():
setExpandAlignProperties(expmaskcol, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
expmaskcol->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmaskcol));
expmaskcol->setLevel(2);
if (showtooltip) {
expmaskcol->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP"));
}
@ -810,6 +811,7 @@ Locallab::Locallab():
setExpandAlignProperties(expmaskexp, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
expmaskexp->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmaskexp));
expmaskexp->setLevel(2);
if (showtooltip) {
expmaskexp->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP"));
}
@ -1048,6 +1050,7 @@ Locallab::Locallab():
if (showtooltip) {
expMethod->set_tooltip_text(M("TP_LOCALLAB_EXPMETHOD_TOOLTIP"));
}
/*
ctboxshmethod = Gtk::manage(new Gtk::HBox());
Gtk::Label* const labelshmethod = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_NOISEMETH") + ":"));
@ -1056,6 +1059,7 @@ Locallab::Locallab():
setExpandAlignProperties(expmasksh, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
expmasksh->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmasksh));
expmasksh->setLevel(2);
if (showtooltip) {
expmasksh->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP"));
}
@ -1066,7 +1070,7 @@ Locallab::Locallab():
if (i == 0) {
ss += Glib::ustring::compose(" (%1)", M("TP_LOCALLAB_LUMADARKEST"));
} else if (i == 5) {
} else if (i == 4) {
ss += Glib::ustring::compose(" (%1)", M("TP_LOCALLAB_LUMAWHITESEST"));
}
@ -1178,9 +1182,11 @@ Locallab::Locallab():
ToolParamBlock* const shadhighBox = Gtk::manage(new ToolParamBlock());
shadhighBox->pack_start(*shMethod);
for (int i = 0; i < 5; i++) {
shadhighBox->pack_start(*multipliersh[i]);
}
shadhighBox->pack_start(*detailSH);
shadhighBox->pack_start(*highlights);
shadhighBox->pack_start(*h_tonalwidth);
@ -1348,6 +1354,7 @@ Locallab::Locallab():
setExpandAlignProperties(expmasktm, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
expmasktm->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmasktm));
expmasktm->setLevel(2);
if (showtooltip) {
expmasktm->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP"));
}
@ -1522,6 +1529,7 @@ Locallab::Locallab():
setExpandAlignProperties(expmaskreti, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
expmaskreti->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmaskreti));
expmaskreti->setLevel(2);
if (showtooltip) {
expmaskreti->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP"));
}
@ -1935,6 +1943,7 @@ Locallab::Locallab():
setExpandAlignProperties(expmaskcb, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
expmaskcb->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmaskcb));
expmaskcb->setLevel(2);
if (showtooltip) {
expmaskcb->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP"));
}
@ -2150,6 +2159,7 @@ Locallab::Locallab():
setExpandAlignProperties(expmaskbl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
expmaskbl->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmaskbl));
expmaskbl->setLevel(2);
if (showtooltip) {
expmaskbl->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP"));
}
@ -3442,11 +3452,13 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pp->locallab.spots.at(pp->locallab.selspot).lapmaskSH = lapmaskSH->getValue();
pp->locallab.spots.at(pp->locallab.selspot).detailSH = detailSH->getIntValue();
pp->locallab.spots.at(pp->locallab.selspot).LmaskSHcurve = LmaskSHshape->getCurve();
if (shMethod->get_active_row_number() == 0) {
pp->locallab.spots.at(pp->locallab.selspot).shMethod = "std";
} else if (shMethod->get_active_row_number() == 1) {
pp->locallab.spots.at(pp->locallab.selspot).shMethod = "tone";
}
for (int i = 0; i < 5; i++) {
pp->locallab.spots.at(pp->locallab.selspot).multsh[i] = multipliersh[i]->getIntValue();
}
@ -3797,9 +3809,11 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pe->locallab.spots.at(pp->locallab.selspot).detailSH = pe->locallab.spots.at(pp->locallab.selspot).detailSH || detailSH->getEditedState();
pe->locallab.spots.at(pp->locallab.selspot).LmaskSHcurve = pe->locallab.spots.at(pp->locallab.selspot).LmaskSHcurve || !LmaskSHshape->isUnChanged();
pe->locallab.spots.at(pp->locallab.selspot).shMethod = pe->locallab.spots.at(pp->locallab.selspot).shMethod || shMethod->get_active_text() != M("GENERAL_UNCHANGED");
for (int i = 0; i < 5; i++) {
pe->locallab.spots.at(pp->locallab.selspot).multsh[i] = pe->locallab.spots.at(pp->locallab.selspot).multsh[i] || multipliersh[i]->getEditedState();
}
// Vibrance
pe->locallab.spots.at(pp->locallab.selspot).expvibrance = pe->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent();
pe->locallab.spots.at(pp->locallab.selspot).saturated = pe->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState();
@ -4104,9 +4118,11 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pedited->locallab.spots.at(pp->locallab.selspot).detailSH = pedited->locallab.spots.at(pp->locallab.selspot).detailSH || detailSH->getEditedState();
pedited->locallab.spots.at(pp->locallab.selspot).LmaskSHcurve = pedited->locallab.spots.at(pp->locallab.selspot).LmaskSHcurve || !LmaskSHshape->isUnChanged();
pedited->locallab.spots.at(pp->locallab.selspot).shMethod = pedited->locallab.spots.at(pp->locallab.selspot).shMethod || shMethod->get_active_text() != M("GENERAL_UNCHANGED");
for (int i = 0; i < 5; i++) {
pedited->locallab.spots.at(pp->locallab.selspot).multsh[i] = pedited->locallab.spots.at(pp->locallab.selspot).multsh[i] || multipliersh[i]->getEditedState();
}
// Vibrance
pedited->locallab.spots.at(pp->locallab.selspot).expvibrance = pedited->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent();
pedited->locallab.spots.at(pp->locallab.selspot).saturated = pedited->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState();
@ -4980,6 +4996,7 @@ void Locallab::shMethodChanged()
for (int i = 0; i < 5; i++) {
multipliersh[i]->hide();
}
detailSH->hide();
highlights->show();
h_tonalwidth->show();
@ -4991,6 +5008,7 @@ void Locallab::shMethodChanged()
for (int i = 0; i < 5; i++) {
multipliersh[i]->show();
}
detailSH->show();
highlights->hide();
h_tonalwidth->hide();
@ -5682,7 +5700,7 @@ void Locallab::inversshChanged()
blurSHde->show();
showmaskSHMethod->hide();
showmaskSHMethodinv->show();
shMethod->set_active(0);
// shMethod->set_active(0);
} else {
// printf("Pas Inv SH\n");
@ -6104,9 +6122,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
slomaskSH->setDefault(defSpot->slomaskSH);
lapmaskSH->setDefault(defSpot->lapmaskSH);
detailSH->setDefault(defSpot->detailSH);
for (int i = 0; i < 5; i++) {
multipliersh[i]->setDefault(defSpot->multsh[i]);
}
// Vibrance
saturated->setDefault((double)defSpot->saturated);
pastels->setDefault((double)defSpot->pastels);
@ -6289,9 +6309,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
slomaskSH->setDefaultEditedState(Irrelevant);
lapmaskSH->setDefaultEditedState(Irrelevant);
detailSH->setDefaultEditedState(Irrelevant);
for (int i = 0; i < 5; i++) {
multipliersh[i]->setDefaultEditedState(Irrelevant);
}
// Vibrance
saturated->setDefaultEditedState(Irrelevant);
pastels->setDefaultEditedState(Irrelevant);
@ -6478,9 +6500,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
slomaskSH->setDefaultEditedState(defSpotState->slomaskSH ? Edited : UnEdited);
lapmaskSH->setDefaultEditedState(defSpotState->lapmaskSH ? Edited : UnEdited);
detailSH->setDefaultEditedState(defSpotState->detailSH ? Edited : UnEdited);
for (int i = 0; i < 5; i++) {
multipliersh[i]->setDefaultEditedState(defSpotState->multsh[i] ? Edited : UnEdited);
}
// Vibrance
saturated->setDefaultEditedState(defSpotState->saturated ? Edited : UnEdited);
pastels->setDefaultEditedState(defSpotState->pastels ? Edited : UnEdited);
@ -7803,9 +7827,11 @@ void Locallab::setBatchMode(bool batchMode)
slomaskSH->showEditedCB();
lapmaskSH->showEditedCB();
detailSH->showEditedCB();
for (int i = 0; i < 5; i++) {
multipliersh[i]->showEditedCB();
}
// Vibrance
saturated->showEditedCB();
pastels->showEditedCB();
@ -8393,11 +8419,13 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
lapmaskSH->setValue(pp->locallab.spots.at(index).lapmaskSH);
detailSH->setValue(pp->locallab.spots.at(index).detailSH);
LmaskSHshape->setCurve(pp->locallab.spots.at(index).LmaskSHcurve);
if (pp->locallab.spots.at(index).shMethod == "std") {
shMethod->set_active(0);
} else if (pp->locallab.spots.at(index).shMethod == "tone") {
shMethod->set_active(1);
}
for (int i = 0; i < 5; i++) {
multipliersh[i]->setValue(pp->locallab.spots.at(index).multsh[i]);
}
@ -8778,9 +8806,11 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
lapmaskSH->setEditedState(spotState->lapmaskSH ? Edited : UnEdited);
detailSH->setEditedState(spotState->detailSH ? Edited : UnEdited);
LmaskSHshape->setUnChanged(!spotState->LmaskSHcurve);
if (!spotState->shMethod) {
shMethod->set_active_text(M("GENERAL_UNCHANGED"));
}
for (int i = 0; i < 5; i++) {
multipliersh[i]->setEditedState(spotState->multsh[i] ? Edited : UnEdited);
}
@ -9122,12 +9152,13 @@ void Locallab::updateSpecificGUIState()
expmasksh->show();
showmaskSHMethodinv->show();
showmaskSHMethod->hide();
shMethod->set_active(0);
// shMethod->set_active(0);
if (shMethod->get_active_row_number() == 0) {
for (int i = 0; i < 5; i++) {
multipliersh[i]->hide();
}
detailSH->hide();
highlights->show();
h_tonalwidth->show();
@ -9136,9 +9167,10 @@ void Locallab::updateSpecificGUIState()
sh_radius->show();
} else if (shMethod->get_active_row_number() == 1) {
for (int i = 0; i < 5; i++) {
multipliersh[i]->hide();
multipliersh[i]->show();
}
detailSH->hide();
detailSH->show();
highlights->hide();
h_tonalwidth->hide();
shadows->hide();
@ -9208,6 +9240,7 @@ void Locallab::updateSpecificGUIState()
for (int i = 0; i < 5; i++) {
multipliersh[i]->hide();
}
detailSH->hide();
highlights->show();
h_tonalwidth->show();
@ -9218,6 +9251,7 @@ void Locallab::updateSpecificGUIState()
for (int i = 0; i < 5; i++) {
multipliersh[i]->show();
}
detailSH->show();
highlights->hide();
h_tonalwidth->hide();