Format ipwavelet.cc and wavelet.cc
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
// code dated: December , 2014
|
||||
// code dated: 9 , 2019
|
||||
//
|
||||
// Ipwaveletcc is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@@ -1275,9 +1275,11 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
|
||||
bool multiTh = false;
|
||||
|
||||
#ifdef _OPENMP
|
||||
|
||||
if (numthreads > 1) {
|
||||
multiTh = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _OPENMP
|
||||
@@ -1301,7 +1303,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
|
||||
tmpImage->g(ir, jr) = Y;
|
||||
tmpImage->b(ir, jr) = Z;
|
||||
ble[ir][jr] = Y / 32768.f;
|
||||
|
||||
|
||||
}
|
||||
|
||||
double epsilmax = 0.001;
|
||||
@@ -1327,9 +1329,10 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
|
||||
float Z = tmpImage->b(ir, jr);
|
||||
float L, a, b;
|
||||
Color::XYZ2Lab(X, Y, Z, L, a, b);
|
||||
|
||||
|
||||
dst->L[ir][jr] = L;
|
||||
}
|
||||
|
||||
delete tmpImage;
|
||||
}
|
||||
|
||||
@@ -1781,11 +1784,11 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
|
||||
double contreal = 0.6 * contrast;
|
||||
DiagonalCurve resid_contrast({
|
||||
DCT_NURBS,
|
||||
0, 0,
|
||||
avg - avg * (0.6 - contreal / 250.0), avg - avg * (0.6 + contreal / 250.0),
|
||||
avg + (1. - avg) * (0.6 - contreal / 250.0), avg + (1. - avg) * (0.6 + contreal / 250.0),
|
||||
1, 1
|
||||
});
|
||||
0, 0,
|
||||
avg - avg * (0.6 - contreal / 250.0), avg - avg * (0.6 + contreal / 250.0),
|
||||
avg + (1. - avg) * (0.6 - contreal / 250.0), avg + (1. - avg) * (0.6 + contreal / 250.0),
|
||||
1, 1
|
||||
});
|
||||
|
||||
|
||||
#ifdef _OPENMP
|
||||
@@ -1796,17 +1799,18 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
|
||||
{
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#pragma omp for
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < W_L * H_L; i++) {
|
||||
float buf = LIM01( WavCoeffs_L0[i] / 32768.f);
|
||||
float buf = LIM01(WavCoeffs_L0[i] / 32768.f);
|
||||
buf = resid_contrast.getVal(buf);
|
||||
buf *= 32768.f;
|
||||
WavCoeffs_L0[i] = buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (cp.tonemap && cp.contmet == 1 && cp.resena) {
|
||||
float maxp = max0 * 256.f;
|
||||
@@ -1818,33 +1822,37 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
|
||||
}
|
||||
}
|
||||
|
||||
if ((cp.conres != 0.f || cp.conresH != 0.f) && cp.resena) { // cp.conres = 0.f and cp.comresH = 0.f means that all will be multiplied by 1.f, so we can skip this step
|
||||
LabImage *temp = nullptr;
|
||||
temp = new LabImage(W_L, H_L);
|
||||
if ((cp.conres != 0.f || cp.conresH != 0.f) && cp.resena) { // cp.conres = 0.f and cp.comresH = 0.f means that all will be multiplied by 1.f, so we can skip this step
|
||||
LabImage *temp = nullptr;
|
||||
temp = new LabImage(W_L, H_L);
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#pragma omp for
|
||||
#endif
|
||||
for (int i = 0; i < H_L; i++) {
|
||||
for (int j = 0; j < W_L; j++) {
|
||||
temp->L[i][j] = WavCoeffs_L0[i * W_L + j];
|
||||
}
|
||||
}
|
||||
{
|
||||
ImProcFunctions::shadowsHighlights(temp, true, 1, cp.conresH, cp.conres, cp.radius, skip, cp.thH, cp.th);
|
||||
}
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#endif
|
||||
for (int i = 0; i < H_L; i++) {
|
||||
for (int j = 0; j < W_L; j++) {
|
||||
WavCoeffs_L0[i * W_L + j] = temp->L[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
delete temp;
|
||||
|
||||
for (int i = 0; i < H_L; i++) {
|
||||
for (int j = 0; j < W_L; j++) {
|
||||
temp->L[i][j] = WavCoeffs_L0[i * W_L + j];
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
ImProcFunctions::shadowsHighlights(temp, true, 1, cp.conresH, cp.conres, cp.radius, skip, cp.thH, cp.th);
|
||||
}
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < H_L; i++) {
|
||||
for (int j = 0; j < W_L; j++) {
|
||||
WavCoeffs_L0[i * W_L + j] = temp->L[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
delete temp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel num_threads(wavNestedLevels) if(wavNestedLevels>1)
|
||||
|
102
rtgui/wavelet.cc
102
rtgui/wavelet.cc
@@ -489,7 +489,7 @@ Wavelet::Wavelet() :
|
||||
showmaskConn = showmask->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::showmaskToggled));
|
||||
|
||||
ToolParamBlock* const clariBox = Gtk::manage(new ToolParamBlock());
|
||||
// ushamethod->append(M("TP_WAVELET_USH"));
|
||||
// ushamethod->append(M("TP_WAVELET_USH"));
|
||||
ushamethod->append(M("TP_WAVELET_SHA"));
|
||||
ushamethod->append(M("TP_WAVELET_CLA"));
|
||||
ushamethodconn = ushamethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::ushamethodChanged));
|
||||
@@ -1064,7 +1064,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited)
|
||||
//ushamethod
|
||||
// if (pp->wavelet.ushamethod == "none") {
|
||||
// ushamethod->set_active(0);
|
||||
// } else
|
||||
// } else
|
||||
if (pp->wavelet.ushamethod == "sharp") {
|
||||
ushamethod->set_active(0);
|
||||
} else if (pp->wavelet.ushamethod == "clari") {
|
||||
@@ -1758,9 +1758,9 @@ void Wavelet::write(ProcParams* pp, ParamsEdited* pedited)
|
||||
pp->wavelet.Medgreinf = "less";
|
||||
}
|
||||
|
||||
// if (ushamethod->get_active_row_number() == 0) {
|
||||
// pp->wavelet.ushamethod = "none";
|
||||
// } else
|
||||
// if (ushamethod->get_active_row_number() == 0) {
|
||||
// pp->wavelet.ushamethod = "none";
|
||||
// } else
|
||||
if (ushamethod->get_active_row_number() == 0) {
|
||||
pp->wavelet.ushamethod = "sharp";
|
||||
} else if (ushamethod->get_active_row_number() == 1) {
|
||||
@@ -2319,14 +2319,14 @@ void Wavelet::TMmethodUpdateUI()
|
||||
}
|
||||
}
|
||||
*/
|
||||
if(TMmethod->get_active_row_number() == 1) {
|
||||
edgs->show();
|
||||
scale->show();
|
||||
} else if (TMmethod->get_active_row_number() == 0) {
|
||||
edgs->hide();
|
||||
scale->hide();
|
||||
}
|
||||
|
||||
if (TMmethod->get_active_row_number() == 1) {
|
||||
edgs->show();
|
||||
scale->show();
|
||||
} else if (TMmethod->get_active_row_number() == 0) {
|
||||
edgs->hide();
|
||||
scale->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Wavelet::TMmethodChanged()
|
||||
@@ -2413,14 +2413,14 @@ void Wavelet::ushamethodChanged()
|
||||
Dirmethod->set_sensitive(true);
|
||||
CLmethod->set_sensitive(false);
|
||||
Backmethod->set_sensitive(false);
|
||||
/* } else if (ushamethod->get_active_row_number() == 0 || expclari->getEnabled() == false) {
|
||||
Backmethod->set_active(1);
|
||||
CLmethod->set_active(3);
|
||||
Lmethod->set_active(3);
|
||||
Dirmethod->set_active(3);
|
||||
Lmethod->set_sensitive(false);
|
||||
Dirmethod->set_sensitive(false);
|
||||
*/
|
||||
/* } else if (ushamethod->get_active_row_number() == 0 || expclari->getEnabled() == false) {
|
||||
Backmethod->set_active(1);
|
||||
CLmethod->set_active(3);
|
||||
Lmethod->set_active(3);
|
||||
Dirmethod->set_active(3);
|
||||
Lmethod->set_sensitive(false);
|
||||
Dirmethod->set_sensitive(false);
|
||||
*/
|
||||
} else if (expclari->getEnabled() == false) {
|
||||
Backmethod->set_active(1);
|
||||
CLmethod->set_active(3);
|
||||
@@ -2496,12 +2496,16 @@ void Wavelet::LmethodUpdateUI() {
|
||||
void Wavelet::LmethodChanged()
|
||||
{
|
||||
//LmethodUpdateUI();
|
||||
if(ushamethod->get_active_row_number() == 0 && expclari->getEnabled() == true) {
|
||||
if(Lmethod->get_active_row_number() > 3) Lmethod->set_active(3);
|
||||
if (ushamethod->get_active_row_number() == 0 && expclari->getEnabled() == true) {
|
||||
if (Lmethod->get_active_row_number() > 3) {
|
||||
Lmethod->set_active(3);
|
||||
}
|
||||
}
|
||||
|
||||
if(ushamethod->get_active_row_number() == 1 && expclari->getEnabled() == true) {
|
||||
if(Lmethod->get_active_row_number() < 4) Lmethod->set_active(4);
|
||||
if (ushamethod->get_active_row_number() == 1 && expclari->getEnabled() == true) {
|
||||
if (Lmethod->get_active_row_number() < 4) {
|
||||
Lmethod->set_active(4);
|
||||
}
|
||||
}
|
||||
|
||||
if (listener && (multiImage || getEnabled())) {
|
||||
@@ -2588,23 +2592,23 @@ void Wavelet::setBatchMode(bool batchMode)
|
||||
|
||||
void Wavelet::adjusterUpdateUI(Adjuster* a)
|
||||
{
|
||||
/*
|
||||
if (!batchMode) {
|
||||
if (a == tmrs ) {
|
||||
float tm;
|
||||
tm=tmrs->getValue();
|
||||
if(tm==0.f) tmr->hide();
|
||||
else tmr->show();
|
||||
}
|
||||
else if (a == gamma ) {
|
||||
float tm;
|
||||
tm=tmrs->getValue();
|
||||
if(tm==0.f) tmr->hide();
|
||||
else tmr->show();
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if (!batchMode) {
|
||||
if (a == tmrs ) {
|
||||
float tm;
|
||||
tm=tmrs->getValue();
|
||||
if(tm==0.f) tmr->hide();
|
||||
else tmr->show();
|
||||
}
|
||||
else if (a == gamma ) {
|
||||
float tm;
|
||||
tm=tmrs->getValue();
|
||||
if(tm==0.f) tmr->hide();
|
||||
else tmr->show();
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void Wavelet::adjusterChanged(Adjuster* a, double newval)
|
||||
@@ -2618,15 +2622,16 @@ void Wavelet::adjusterChanged(Adjuster* a, double newval)
|
||||
listener->panelChanged(EvWavresconH, resconH->getTextValue());
|
||||
} else if (a == reschro) {
|
||||
listener->panelChanged(EvWavreschro, reschro->getTextValue());
|
||||
} else if (a == tmrs) {
|
||||
} else if (a == tmrs) {
|
||||
adjusterUpdateUI(a);
|
||||
listener->panelChanged(EvWavtmrs, tmrs->getTextValue());
|
||||
if(tmrs->getValue() != 0 && TMmethod->get_active_row_number() == 1) {
|
||||
edgs->show();
|
||||
scale->show();
|
||||
|
||||
if (tmrs->getValue() != 0 && TMmethod->get_active_row_number() == 1) {
|
||||
edgs->show();
|
||||
scale->show();
|
||||
} else if (TMmethod->get_active_row_number() == 0) {
|
||||
edgs->hide();
|
||||
scale->hide();
|
||||
edgs->hide();
|
||||
scale->hide();
|
||||
}
|
||||
} else if (a == gamma) {
|
||||
adjusterUpdateUI(a);
|
||||
@@ -3305,6 +3310,7 @@ void Wavelet::enableToggled(MyExpander *expander)
|
||||
Backmethod->set_sensitive(false);
|
||||
}
|
||||
}
|
||||
|
||||
event = EvWavenaclari;
|
||||
} else
|
||||
// unknown expander, returning !
|
||||
|
Reference in New Issue
Block a user