From 344735bb8b6672c9fbdef32802d1cab08f4f90ef Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 12 Oct 2020 11:13:32 +0200 Subject: [PATCH] Change call edge to Ftblockdn --- rtengine/FTblockDN.cc | 10 ++++++++++ rtengine/ipwavelet.cc | 29 ++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index d43fa6baa..bef60e59a 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -2378,6 +2378,11 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkAB(wavelet_decomposition& Wavele { int maxlvl = WaveletCoeffs_L.maxlevel(); + if (local == 1) { + maxlvl = 6; //for local denoise + } + + if (local == 2) { maxlvl = 7; //for local denoise } @@ -2615,6 +2620,11 @@ bool ImProcFunctions::WaveletDenoiseAllAB(wavelet_decomposition& WaveletCoeffs_L int maxlvl = WaveletCoeffs_L.maxlevel(); + if (local == 1) { + maxlvl = 6; //for local denoise + } + + if (local == 2) { maxlvl = 7; //for local denoise } diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 31cb07566..613e74723 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -673,6 +673,9 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const maxlevelcrop = 5; } + if (minwin * skip < 32) { + maxlevelcrop = 4; + } int levwav = params->wavelet.thres; if(params->wavelet.expnoise) { @@ -753,6 +756,10 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const maxlev2 = 5; } + if (minsizetile < 32) { + maxlev2 = 4; + } + levwav = rtengine::min(maxlev2, levwav); #ifdef _OPENMP @@ -1068,6 +1075,8 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const bool usechrom = cp.chromfi > 0.f || cp.chromco > 0.f; levwavL = rtengine::min(maxlevelcrop, levwavL); + levwavL = rtengine::min(maxlev2, levwavL); + if (settings->verbose) { printf("Level decomp L=%i\n", levwavL); } @@ -1761,7 +1770,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const if (!hhutili) { //always a or b int levwava = levwav; - if (!exblurab && cp.chrores == 0.f && cp.blurcres == 0.f && params->wavelet.CLmethod == "all" && !cp.cbena) { // no processing of residual ab => we probably can reduce the number of levels + if (!exblurab && cp.chrores == 0.f && cp.blurcres == 0.f && !cp.tonemap && !cp.resena && !cp.chromena && !cp.finena && !cp.edgeena&& params->wavelet.CLmethod == "all" && !cp.cbena) { // no processing of residual ab => we probably can reduce the number of levels while (levwava > 0 && !cp.diag && (((cp.CHmet == 2 && (cp.chro == 0.f || cp.mul[levwava - 1] == 0.f)) || (cp.CHmet != 2 && (levwava == 10 || (!cp.curv || cp.mulC[levwava - 1] == 0.f))))) && (!cp.opaRG || levwava == 10 || (cp.opaRG && cp.mulopaRG[levwava - 1] == 0.f)) && ((levwava == 10 || (cp.CHSLmet == 1 && cp.mulC[levwava - 1] == 0.f)))) { levwava--; } @@ -1774,31 +1783,40 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const } levwava = rtengine::min(maxlevelcrop, levwava); + levwava = rtengine::min(maxlev2, levwava); if (settings->verbose) { printf("Leval decomp a=%i\n", levwava); } if (levwava > 0) { const std::unique_ptr adecomp(new wavelet_decomposition(labco->data + datalen, labco->W, labco->H, levwava, 1, skip, rtengine::max(1, wavNestedLevels), DaubLen)); - if (!adecomp->memory_allocation_failed()) { + if(levwava == 6) { + edge = 1; + } if (cp.noiseena && ((cp.chromfi > 0.f || cp.chromco > 0.f) && cp.quamet == 0 )) { + WaveletDenoiseAllAB(*Ldecomp, *adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, 1); + } else if (cp.chromfi > 0.f && cp.chromco >= 2.f){ WaveletDenoiseAll_BiShrinkAB(*Ldecomp, *adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, 1); WaveletDenoiseAllAB(*Ldecomp, *adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, 1); + } Evaluate2(*adecomp, meanab, meanNab, sigmaab, sigmaNab, MaxPab, MaxNab, wavNestedLevels); + WaveletcontAllAB(labco, varhue, varchro, *adecomp, wavblcurve, waOpacityCurveW, cp, true, skip, meanab, sigmaab); + adecomp->reconstruct(labco->data + datalen, cp.strength); + } } int levwavb = levwav; - if (!exblurab && cp.chrores == 0.f && cp.blurcres == 0.f && params->wavelet.CLmethod == "all" && !cp.cbena) { // no processing of residual ab => we probably can reduce the number of levels + if (!exblurab && cp.chrores == 0.f && cp.blurcres == 0.f && !cp.tonemap && !cp.resena && !cp.chromena && !cp.finena && !cp.edgeena && params->wavelet.CLmethod == "all" && !cp.cbena) { // no processing of residual ab => we probably can reduce the number of levels while (levwavb > 0 && !cp.diag && (((cp.CHmet == 2 && (cp.chro == 0.f || cp.mul[levwavb - 1] == 0.f)) || (cp.CHmet != 2 && (levwavb == 10 || (!cp.curv || cp.mulC[levwavb - 1] == 0.f))))) && (!cp.opaBY || levwavb == 10 || (cp.opaBY && cp.mulopaBY[levwavb - 1] == 0.f)) && ((levwavb == 10 || (cp.CHSLmet == 1 && cp.mulC[levwavb - 1] == 0.f)))) { levwavb--; } @@ -1812,12 +1830,17 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const levwavb = rtengine::min(maxlevelcrop, levwavb); + levwavb = rtengine::min(maxlev2, levwavb); + if (settings->verbose) { printf("Leval decomp b=%i\n", levwavb); } if (levwavb > 0) { const std::unique_ptr bdecomp(new wavelet_decomposition(labco->data + 2 * datalen, labco->W, labco->H, levwavb, 1, skip, rtengine::max(1, wavNestedLevels), DaubLen)); + if(levwavb == 6) { + edge = 1; + } if (!bdecomp->memory_allocation_failed()) { // if (cp.noiseena && ((cp.chromfi > 0.f || cp.chromco > 0.f) && cp.chromco < 2.f )) {