Fixed crash in denoise with lumacoarse

This commit is contained in:
Desmis
2019-11-07 13:19:08 +01:00
parent a226a9da7a
commit 839bad1bf0
2 changed files with 8 additions and 5 deletions

View File

@@ -2270,7 +2270,6 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(const wavelet_decomposition &W
//simple wavelet shrinkage
float * sfave = buffer[0] + 32;
float * sfaved = buffer[2] + 96;
// float * blurBuffer = buffer[2] + 96;
float mad_Lr = madL[lvl][dir - 1];
/*
@@ -2288,7 +2287,6 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(const wavelet_decomposition &W
for (int i = 0; i < Hlvl_L * Wlvl_L; ++i) {
nvl[i] = 0.f;
}
if ((edge == 1 || edge == 2 || edge == 3) && vari) {
// nvl = blurBuffer; // we need one buffer, but fortunately we don't have to allocate a new one because we can use blurBuffer
if ((edge == 1 || edge == 3)) {
@@ -2346,7 +2344,7 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(const wavelet_decomposition &W
#endif
boxblur(sfave, sfaved, lvl + 2, Wlvl_L, Hlvl_L, false); //increase smoothness by locally averaging shrinkage
// boxblur(sfave, sfaved, blurBuffer, lvl + 2, lvl + 2, Wlvl_L, Hlvl_L); //increase smoothness by locally averaging shrinkage
#ifdef __SSE2__
vfloat sfavev;
vfloat sf_Lv;
@@ -2384,7 +2382,7 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(const wavelet_decomposition &W
}
}
for (int i = 3; i >= 0; i--) {
for (int i = 2; i >= 0; i--) {
if (buffer[i] != nullptr) {
delete[] buffer[i];
}

View File

@@ -6343,7 +6343,7 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f
mxsl = max(mxslid34, mxslid56);
}
printf("OK 1\n");
/*
for(int j=0;j<8;j++){
printf("j=%i slidL=%f\n", j, slidL[j]);
@@ -6392,6 +6392,7 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f
vari[6] = max(0.0001f, kr5 * vari[6]);
}
printf("OK 2\n");
float* noisevarlum = new float[GH * GW];
int GW2 = (GW + 1) / 2;
@@ -6430,9 +6431,13 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f
*/
if ((lp.noiselc < 0.02f && aut == 0) || (mxsl < 1.f && (aut == 1 || aut == 2))) {
WaveletDenoiseAllL(Ldecomp, noisevarlum, madL, vari, edge, numThreads);
} else {
WaveletDenoiseAll_BiShrinkL(Ldecomp, noisevarlum, madL, vari, edge, numThreads);
WaveletDenoiseAllL(Ldecomp, noisevarlum, madL, vari, edge, numThreads);
}
delete[] noisevarlum;