several improvment to process wavelet contrast

This commit is contained in:
Desmis 2019-12-15 11:53:46 +01:00
parent 9d7d0c816e
commit cf674f0818
3 changed files with 143 additions and 125 deletions

View File

@ -2212,7 +2212,7 @@ TP_LOCALLAB_CHROMASK_TOOLTIP;You can use this slider to desaturated background (
TP_LOCALLAB_CHRRT;Chroma
TP_LOCALLAB_CIRCRADIUS;Spot size
TP_LOCALLAB_CLARICRES;Merge Chroma
TP_LOCALLAB_CLARIFRA;Sharp mask and Clarity
TP_LOCALLAB_CLARIFRA;Clarity & Sharp mask - Blend images
TP_LOCALLAB_CLARILRES;Merge Luma
TP_LOCALLAB_CLARISOFT;Soft radius
TP_LOCALLAB_CLARITYML;Clarity

View File

@ -10764,129 +10764,6 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
bool exec = false;
if (mL != 0.f && mC == 0.f) {
mC = 0.0001f;
exec = true;
}
if (mC != 0.f && mL == 0.f) {
mL = 0.0001f;
exec = true;
}
if (mL != 0.f && mC != 0.f) {
exec = true;
}
if (mL != 0.f) {
wavelet_decomposition *wdspotresid = new wavelet_decomposition(tmpresid->L[0], tmpresid->W, tmpresid->H, wavelet_level, 1, sk, numThreads, 6);
if (wdspotresid->memoryAllocationFailed) {
return;
}
int maxlvlresid = wdspotresid->maxlevel();
if (maxlvlresid > 4) {//Clarity
for (int dir = 1; dir < 4; dir++) {
for (int level = 0; level < maxlvlresid; ++level) {
int W_L = wdspotresid->level_W(level);
int H_L = wdspotresid->level_H(level);
float **wav_Lresid = wdspotresid->level_coeffs(level);
for (int i = 0; i < W_L * H_L; i++) {
wav_Lresid[dir][i] = 0.f;
}
}
}
} else {//Sharp
float *wav_L0resid = wdspotresid->coeff0;
int W_L = wdspotresid->level_W(0);
int H_L = wdspotresid->level_H(0);
for (int i = 0; i < W_L * H_L; i++) {
wav_L0resid[i] = 0.f;
}
}
wdspotresid->reconstruct(tmpresid->L[0], 1.f);
delete wdspotresid;
}
if (mC != 0.f) {
wavelet_decomposition *wdspotresida = new wavelet_decomposition(tmpresid->a[0], tmpresid->W, tmpresid->H, wavelet_level, 1, sk, numThreads, 6);
if (wdspotresida->memoryAllocationFailed) {
return;
}
int maxlvlresid = wdspotresida->maxlevel();
if (maxlvlresid > 4) {//Clarity
for (int dir = 1; dir < 4; dir++) {
for (int level = 0; level < maxlvlresid; ++level) {
int W_L = wdspotresida->level_W(level);
int H_L = wdspotresida->level_H(level);
float **wav_Lresida = wdspotresida->level_coeffs(level);
for (int i = 0; i < W_L * H_L; i++) {
wav_Lresida[dir][i] = 0.f;
}
}
}
} else {//Sharp
float *wav_L0resida = wdspotresida->coeff0;
int W_L = wdspotresida->level_W(0);
int H_L = wdspotresida->level_H(0);
for (int i = 0; i < W_L * H_L; i++) {
wav_L0resida[i] = 0.f;
}
}
wdspotresida->reconstruct(tmpresid->a[0], 1.f);
delete wdspotresida;
}
if (mC != 0.f) {
wavelet_decomposition *wdspotresidb = new wavelet_decomposition(tmpresid->b[0], tmpresid->W, tmpresid->H, wavelet_level, 1, sk, numThreads, 6);
if (wdspotresidb->memoryAllocationFailed) {
return;
}
int maxlvlresid = wdspotresidb->maxlevel();
if (maxlvlresid > 4) {//Clarity
for (int dir = 1; dir < 4; dir++) {
for (int level = 0; level < maxlvlresid; ++level) {
int W_L = wdspotresidb->level_W(level);
int H_L = wdspotresidb->level_H(level);
float **wav_Lresidb = wdspotresidb->level_coeffs(level);
for (int i = 0; i < W_L * H_L; i++) {
wav_Lresidb[dir][i] = 0.f;
}
}
}
} else {//Sharp
float *wav_L0residb = wdspotresidb->coeff0;
int W_L = wdspotresidb->level_W(0);
int H_L = wdspotresidb->level_H(0);
for (int i = 0; i < W_L * H_L; i++) {
wav_L0residb[i] = 0.f;
}
}
wdspotresidb->reconstruct(tmpresid->b[0], 1.f);
delete wdspotresidb;
}
int maxlvl;
const float contrast = params->locallab.spots.at(sp).residcont;
@ -11017,6 +10894,144 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
}
//copy previous calculation in merge possibilities
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int y = 0; y < bfhr; y++) {
for (int x = 0; x < bfwr; x++) {
tmpresid->L[y][x] = tmp1->L[y][x];
tmpresid->a[y][x] = tmp1->a[y][x];
tmpresid->b[y][x] = tmp1->b[y][x];
}
}
if (mL != 0.f && mC == 0.f) {
mC = 0.0001f;
exec = true;
}
if (mC != 0.f && mL == 0.f) {
mL = 0.0001f;
exec = true;
}
if (mL != 0.f && mC != 0.f) {
exec = true;
}
if (mL != 0.f) {
wavelet_decomposition *wdspotresid = new wavelet_decomposition(tmpresid->L[0], tmpresid->W, tmpresid->H, wavelet_level, 1, sk, numThreads, 6);
if (wdspotresid->memoryAllocationFailed) {
return;
}
int maxlvlresid = wdspotresid->maxlevel();
if (maxlvlresid > 4) {//Clarity
for (int dir = 1; dir < 4; dir++) {
for (int level = 0; level < maxlvlresid; ++level) {
int W_L = wdspotresid->level_W(level);
int H_L = wdspotresid->level_H(level);
float **wav_Lresid = wdspotresid->level_coeffs(level);
for (int i = 0; i < W_L * H_L; i++) {
wav_Lresid[dir][i] = 0.f;
}
}
}
} else {//Sharp
float *wav_L0resid = wdspotresid->coeff0;
int W_L = wdspotresid->level_W(0);
int H_L = wdspotresid->level_H(0);
for (int i = 0; i < W_L * H_L; i++) {
wav_L0resid[i] = 0.f;
}
}
wdspotresid->reconstruct(tmpresid->L[0], 1.f);
delete wdspotresid;
}
if (mC != 0.f) {
wavelet_decomposition *wdspotresida = new wavelet_decomposition(tmpresid->a[0], tmpresid->W, tmpresid->H, wavelet_level, 1, sk, numThreads, 6);
if (wdspotresida->memoryAllocationFailed) {
return;
}
int maxlvlresid = wdspotresida->maxlevel();
if (maxlvlresid > 4) {//Clarity
for (int dir = 1; dir < 4; dir++) {
for (int level = 0; level < maxlvlresid; ++level) {
int W_L = wdspotresida->level_W(level);
int H_L = wdspotresida->level_H(level);
float **wav_Lresida = wdspotresida->level_coeffs(level);
for (int i = 0; i < W_L * H_L; i++) {
wav_Lresida[dir][i] = 0.f;
}
}
}
} else {//Sharp
float *wav_L0resida = wdspotresida->coeff0;
int W_L = wdspotresida->level_W(0);
int H_L = wdspotresida->level_H(0);
for (int i = 0; i < W_L * H_L; i++) {
wav_L0resida[i] = 0.f;
}
}
wdspotresida->reconstruct(tmpresid->a[0], 1.f);
delete wdspotresida;
}
if (mC != 0.f) {
wavelet_decomposition *wdspotresidb = new wavelet_decomposition(tmpresid->b[0], tmpresid->W, tmpresid->H, wavelet_level, 1, sk, numThreads, 6);
if (wdspotresidb->memoryAllocationFailed) {
return;
}
int maxlvlresid = wdspotresidb->maxlevel();
if (maxlvlresid > 4) {//Clarity
for (int dir = 1; dir < 4; dir++) {
for (int level = 0; level < maxlvlresid; ++level) {
int W_L = wdspotresidb->level_W(level);
int H_L = wdspotresidb->level_H(level);
float **wav_Lresidb = wdspotresidb->level_coeffs(level);
for (int i = 0; i < W_L * H_L; i++) {
wav_Lresidb[dir][i] = 0.f;
}
}
}
} else {//Sharp
float *wav_L0residb = wdspotresidb->coeff0;
int W_L = wdspotresidb->level_W(0);
int H_L = wdspotresidb->level_H(0);
for (int i = 0; i < W_L * H_L; i++) {
wav_L0residb[i] = 0.f;
}
}
wdspotresidb->reconstruct(tmpresid->b[0], 1.f);
delete wdspotresidb;
}
float thr = 0.001f;
int flag = 0;

View File

@ -553,7 +553,9 @@ residcont(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDCONT"), -100, 100, 1, 0))
residblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDBLUR"), 0., 100., 0.5, 0.))),
levelblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LEVELBLUR"), 0., 100., 0.5, 0.))),
clarilres(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARILRES"), -20., 100., 0.5, 0.))),
clarisoft(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARISOFT"), 0., 100., 0.5, 0.))),
//clarisoft(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARISOFT"), 0., 100., 0.5, 0.))),
clarisoft(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), -10.0, 1000.0, 0.5, 0.))),
claricres(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARICRES"), -20., 100., 0.5, 0.))),
sensilc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))),
residchro(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDCHRO"), -100, 100, 1, 0))),
@ -2851,6 +2853,7 @@ pe(nullptr)
residchro->setAdjusterListener(this);
sigma->setAdjusterListener(this);
clarilres->setAdjusterListener(this);
clarisoft->setLogScale(10, -10);
clarisoft->setAdjusterListener(this);
claricres->setAdjusterListener(this);