Wavelet - Fixed crash when blur residual high and zoom high

This commit is contained in:
Desmis
2020-04-12 14:08:06 +02:00
parent c2fae0ce87
commit 60bb7b520b
3 changed files with 40 additions and 27 deletions

View File

@@ -2283,6 +2283,7 @@ TP_WAVELET_RE2;Unchanged
TP_WAVELET_RE3;Reduced
TP_WAVELET_RESBLUR;Blur Luminance
TP_WAVELET_RESBLURC;Blur Chroma
TP_WAVELET_RESBLUR_TOOLTIP;Disabled if zoom > about 500%
TP_WAVELET_RESCHRO;Intensity
TP_WAVELET_RESCON;Shadows
TP_WAVELET_RESCONH;Highlights

View File

@@ -2201,22 +2201,27 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
//Blur luma
if (cp.blurres != 0.f && cp.resena) {
float rad = 0.7f * cp.blurres / skip;
float * bef = new float[W_L * H_L];
float * aft = new float[W_L * H_L];
int minWL = min(W_L, H_L);
float k = 0.5f;
//printf("skip=%i WL=%i HL=%i min=%i\n", skip, W_L, H_L, minWL);
if(minWL > 140) {//disabled if too low windows
float rad = k * cp.blurres / skip;
float * bef = new float[W_L * H_L];
float * aft = new float[W_L * H_L];
for (int i = 0; i < H_L * W_L; i++) {
bef[i] = WavCoeffs_L0[i];
}
for (int i = 0; i < H_L * W_L; i++) {
bef[i] = WavCoeffs_L0[i];
}
boxblur(bef, aft, rad, W_L, H_L, false);
boxblur(bef, aft, rad, W_L, H_L, false);
for (int i = 0; i < H_L * W_L; i++) {
WavCoeffs_L0[i] = aft[i];
}
for (int i = 0; i < H_L * W_L; i++) {
WavCoeffs_L0[i] = aft[i];
}
delete[] bef;
delete[] aft;
delete[] bef;
delete[] aft;
}
}
//
@@ -2670,22 +2675,27 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float
//Blur chroma
if (cp.blurcres != 0.f && cp.resena) {
float rad = 0.7f * cp.blurcres / skip;
float * bef = new float[W_L * H_L];
float * aft = new float[W_L * H_L];
int minWL = min(W_L, H_L);
float k = 0.5f;
//printf("skip=%i WL=%i HL=%i min=%i\n", skip, W_L, H_L, minWL);
if(minWL > 140) {//disabled if too low windows
float rad = k * cp.blurcres / skip;
float * bef = new float[W_L * H_L];
float * aft = new float[W_L * H_L];
for (int i = 0; i < H_L * W_L; i++) {
bef[i] = WavCoeffs_ab0[i];
for (int i = 0; i < H_L * W_L; i++) {
bef[i] = WavCoeffs_ab0[i];
}
boxblur(bef, aft, rad, W_L, H_L, false);
for (int i = 0; i < H_L * W_L; i++) {
WavCoeffs_ab0[i] = aft[i];
}
delete[] bef;
delete[] aft;
}
boxblur(bef, aft, rad, W_L, H_L, false);
for (int i = 0; i < H_L * W_L; i++) {
WavCoeffs_ab0[i] = aft[i];
}
delete[] bef;
delete[] aft;
}

View File

@@ -800,6 +800,8 @@ Wavelet::Wavelet() :
blurBox->pack_start(*resblur);
blurBox->pack_start(*resblurc);
blurFrame->add(*blurBox);
resblur->set_tooltip_text(M("TP_WAVELET_RESBLUR_TOOLTIP"));
resblurc->set_tooltip_text(M("TP_WAVELET_RESBLUR_TOOLTIP"));
chromaFrame->set_label_align(0.025, 0.5);
ToolParamBlock* const chromaBox = Gtk::manage(new ToolParamBlock());