First version blur by level

This commit is contained in:
Desmis 2020-03-26 07:19:54 +01:00
parent 51f1198b65
commit ea56e57ec2
5 changed files with 57 additions and 22 deletions

View File

@ -806,7 +806,7 @@ HISTORY_MSG_THRESWAV;Balance threshold
HISTORY_MSG_SOFTWAV;Soft radius HISTORY_MSG_SOFTWAV;Soft radius
HISTORY_MSG_WAVOLDSH;Old algorithm HISTORY_MSG_WAVOLDSH;Old algorithm
HISTORY_MSG_WAVOFFSET;Offset HISTORY_MSG_WAVOFFSET;Offset
HISTORY_MSG_TMSHAPE;Compression by level HISTORY_MSG_BLSHAPE;Blur by level
HISTORY_MSG_WAVBL;Blur levels HISTORY_MSG_WAVBL;Blur levels
HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b> HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b>
@ -2141,6 +2141,7 @@ TP_WAVELET_BALCHRO_TOOLTIP;If enabled, the 'Contrast balance' curve or slider al
TP_WAVELET_BANONE;None TP_WAVELET_BANONE;None
TP_WAVELET_BASLI;Slider TP_WAVELET_BASLI;Slider
TP_WAVELET_BATYPE;Contrast balance method TP_WAVELET_BATYPE;Contrast balance method
TP_WAVELET_BLCURVE;Blur by levels
TP_WAVELET_CBENAB;Toning and Color Balance TP_WAVELET_CBENAB;Toning and Color Balance
TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted
TP_WAVELET_CCURVE;Local contrast TP_WAVELET_CCURVE;Local contrast
@ -2297,7 +2298,6 @@ TP_WAVELET_TMSCALE;Scale
TP_WAVELET_TMSTRENGTH;Compression strength TP_WAVELET_TMSTRENGTH;Compression strength
TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image.
TP_WAVELET_TMEDGS;Edge stopping TP_WAVELET_TMEDGS;Edge stopping
TP_WAVELET_TMURVE;(un)Compression by Level
TP_WAVELET_TON;Toning TP_WAVELET_TON;Toning
TP_WAVELET_USH;None TP_WAVELET_USH;None
TP_WAVELET_USHARP;Clarity method TP_WAVELET_USHARP;Clarity method

View File

@ -207,8 +207,8 @@ public:
void WaveletcontAllL(LabImage * lab, float **varhue, float **varchrom, const wavelet_decomposition &WaveletCoeffs_L, const Wavblcurve & wavblcurve, void WaveletcontAllL(LabImage * lab, float **varhue, float **varchrom, const wavelet_decomposition &WaveletCoeffs_L, const Wavblcurve & wavblcurve,
struct cont_params &cp, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili); struct cont_params &cp, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili);
void WaveletcontAllLfinal(const wavelet_decomposition &WaveletCoeffs_L, const cont_params &cp, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL); void WaveletcontAllLfinal(const wavelet_decomposition &WaveletCoeffs_L, const cont_params &cp, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL);
void WaveletcontAllAB(LabImage * lab, float **varhue, float **varchrom, const wavelet_decomposition &WaveletCoeffs_a, const WavOpacityCurveW & waOpacityCurveW, void WaveletcontAllAB(LabImage * lab, float **varhue, float **varchrom, const wavelet_decomposition &WaveletCoeffs_a, const Wavblcurve & wavblcurve, const WavOpacityCurveW & waOpacityCurveW,
struct cont_params &cp, const bool useChannelA); struct cont_params &cp, const bool useChannelA, int skip);
void WaveletAandBAllAB(const wavelet_decomposition &WaveletCoeffs_a, const wavelet_decomposition &WaveletCoeffs_b, void WaveletAandBAllAB(const wavelet_decomposition &WaveletCoeffs_a, const wavelet_decomposition &WaveletCoeffs_b,
const cont_params &cp, FlatCurve* hhcurve, bool hhutili); const cont_params &cp, FlatCurve* hhcurve, bool hhutili);
void ContAllL(float **koeLi, float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * lab, float **varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, void ContAllL(float **koeLi, float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * lab, float **varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp,

View File

@ -59,6 +59,7 @@ struct cont_params {
float sigm; float sigm;
int chrom; int chrom;
int chro; int chro;
float chrwav;
int contrast; int contrast;
float th; float th;
float thH; float thH;
@ -209,6 +210,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
cp.toningena = params->wavelet.exptoning; cp.toningena = params->wavelet.exptoning;
cp.noiseena = params->wavelet.expnoise; cp.noiseena = params->wavelet.expnoise;
cp.blena = params->wavelet.expbl; cp.blena = params->wavelet.expbl;
cp.chrwav = 0.01f * params->wavelet.chrwav;
if (params->wavelet.Backmethod == "black") { if (params->wavelet.Backmethod == "black") {
cp.backm = 0; cp.backm = 0;
@ -1061,7 +1063,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
const std::unique_ptr<wavelet_decomposition> adecomp(new wavelet_decomposition(labco->data + datalen, labco->W, labco->H, levwava, 1, skip, rtengine::max(1, wavNestedLevels), DaubLen)); const std::unique_ptr<wavelet_decomposition> adecomp(new wavelet_decomposition(labco->data + datalen, labco->W, labco->H, levwava, 1, skip, rtengine::max(1, wavNestedLevels), DaubLen));
if (!adecomp->memoryAllocationFailed) { if (!adecomp->memoryAllocationFailed) {
WaveletcontAllAB(labco, varhue, varchro, *adecomp, waOpacityCurveW, cp, true); WaveletcontAllAB(labco, varhue, varchro, *adecomp, wavblcurve, waOpacityCurveW, cp, true, skip);
adecomp->reconstruct(labco->data + datalen, cp.strength); adecomp->reconstruct(labco->data + datalen, cp.strength);
} }
} }
@ -1080,7 +1082,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
const std::unique_ptr<wavelet_decomposition> bdecomp(new wavelet_decomposition(labco->data + 2 * datalen, labco->W, labco->H, levwavb, 1, skip, rtengine::max(1, wavNestedLevels), DaubLen)); const std::unique_ptr<wavelet_decomposition> bdecomp(new wavelet_decomposition(labco->data + 2 * datalen, labco->W, labco->H, levwavb, 1, skip, rtengine::max(1, wavNestedLevels), DaubLen));
if (!bdecomp->memoryAllocationFailed) { if (!bdecomp->memoryAllocationFailed) {
WaveletcontAllAB(labco, varhue, varchro, *bdecomp, waOpacityCurveW, cp, false); WaveletcontAllAB(labco, varhue, varchro, *bdecomp, wavblcurve, waOpacityCurveW, cp, false, skip);
bdecomp->reconstruct(labco->data + 2 * datalen, cp.strength); bdecomp->reconstruct(labco->data + 2 * datalen, cp.strength);
} }
} }
@ -1100,8 +1102,8 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
const std::unique_ptr<wavelet_decomposition> bdecomp(new wavelet_decomposition(labco->data + 2 * datalen, labco->W, labco->H, levwavab, 1, skip, rtengine::max(1, wavNestedLevels), DaubLen)); const std::unique_ptr<wavelet_decomposition> bdecomp(new wavelet_decomposition(labco->data + 2 * datalen, labco->W, labco->H, levwavab, 1, skip, rtengine::max(1, wavNestedLevels), DaubLen));
if (!adecomp->memoryAllocationFailed && !bdecomp->memoryAllocationFailed) { if (!adecomp->memoryAllocationFailed && !bdecomp->memoryAllocationFailed) {
WaveletcontAllAB(labco, varhue, varchro, *adecomp, waOpacityCurveW, cp, true); WaveletcontAllAB(labco, varhue, varchro, *adecomp,wavblcurve, waOpacityCurveW, cp, true, skip);
WaveletcontAllAB(labco, varhue, varchro, *bdecomp, waOpacityCurveW, cp, false); WaveletcontAllAB(labco, varhue, varchro, *bdecomp, wavblcurve, waOpacityCurveW, cp, false, skip);
WaveletAandBAllAB(*adecomp, *bdecomp, cp, hhCurve, hhutili); WaveletAandBAllAB(*adecomp, *bdecomp, cp, hhCurve, hhutili);
adecomp->reconstruct(labco->data + datalen, cp.strength); adecomp->reconstruct(labco->data + datalen, cp.strength);
@ -2085,9 +2087,9 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
for (int co = 0; co < Hlvl_L * Wlvl_L; co++) { for (int co = 0; co < Hlvl_L * Wlvl_L; co++) {
bef[co] = WavCoeffs_L[dir][co]; bef[co] = WavCoeffs_L[dir][co];
} }
klev = 0.25f * (wavblcurve[lvl * 55.5f]); klev = (wavblcurve[lvl * 55.5f]);
klev *= 50.f / skip; klev *= lvl * 50.f / skip;
boxblur(bef, aft, klev, Wlvl_L, Hlvl_L, false); boxblur(bef, aft, klev, Wlvl_L, Hlvl_L, false);
for (int co = 0; co < Hlvl_L * Wlvl_L; co++) { for (int co = 0; co < Hlvl_L * Wlvl_L; co++) {
@ -2173,8 +2175,8 @@ void ImProcFunctions::WaveletAandBAllAB(const wavelet_decomposition &WaveletCoef
} }
void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float **varchrom, const wavelet_decomposition &WaveletCoeffs_ab, const WavOpacityCurveW & waOpacityCurveW, void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float **varchrom, const wavelet_decomposition &WaveletCoeffs_ab, const Wavblcurve & wavblcurve, const WavOpacityCurveW & waOpacityCurveW,
struct cont_params &cp, const bool useChannelA) struct cont_params &cp, const bool useChannelA, int skip)
{ {
int maxlvl = WaveletCoeffs_ab.maxlevel(); int maxlvl = WaveletCoeffs_ab.maxlevel();
@ -2297,6 +2299,16 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float
} }
} }
bool wavcurvecomp = false;//not enable if 0.75
if (wavblcurve) {
for (int i = 0; i < 500; i++) {
if (wavblcurve[i] != 0.) {
wavcurvecomp = true;
}
}
}
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp for schedule(dynamic) collapse(2) #pragma omp for schedule(dynamic) collapse(2)
#endif #endif
@ -2309,6 +2321,29 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float
float ** WavCoeffs_ab = WaveletCoeffs_ab.level_coeffs(lvl); float ** WavCoeffs_ab = WaveletCoeffs_ab.level_coeffs(lvl);
ContAllAB(labco, maxlvl, varhue, varchrom, WavCoeffs_ab, WavCoeffs_ab0, lvl, dir, waOpacityCurveW, cp, Wlvl_ab, Hlvl_ab, useChannelA); ContAllAB(labco, maxlvl, varhue, varchrom, WavCoeffs_ab, WavCoeffs_ab0, lvl, dir, waOpacityCurveW, cp, Wlvl_ab, Hlvl_ab, useChannelA);
if(wavblcurve && wavcurvecomp && cp.blena && cp.chrwav > 0.f) {
float * bef = new float[Wlvl_ab * Hlvl_ab];
float * aft = new float[Wlvl_ab * Hlvl_ab];
float klev;
for (int co = 0; co < Hlvl_ab * Wlvl_ab; co++) {
bef[co] = WavCoeffs_ab[dir][co];
}
klev = (wavblcurve[lvl * 55.5f]);
klev *= cp.chrwav * lvl * 100.f / skip;
boxblur(bef, aft, klev, Wlvl_ab, Hlvl_ab, false);
for (int co = 0; co < Hlvl_ab * Wlvl_ab; co++) {
WavCoeffs_ab[dir][co] = aft[co];
}
delete bef;
delete aft;
}
} }
} }

View File

@ -63,7 +63,7 @@ Wavelet::Wavelet() :
FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), true, true), FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), true, true),
curveEditorG(new CurveEditorGroup(options.lastWaveletCurvesDir, M("TP_WAVELET_CONTEDIT"))), curveEditorG(new CurveEditorGroup(options.lastWaveletCurvesDir, M("TP_WAVELET_CONTEDIT"))),
CCWcurveEditorG(new CurveEditorGroup(options.lastWaveletCurvesDir, M("TP_WAVELET_CCURVE"))), CCWcurveEditorG(new CurveEditorGroup(options.lastWaveletCurvesDir, M("TP_WAVELET_CCURVE"))),
curveEditortm(new CurveEditorGroup(options.lastWaveletCurvesDir, M("TP_WAVELET_TMURVE"))), curveEditorbl(new CurveEditorGroup(options.lastWaveletCurvesDir, M("TP_WAVELET_BLCURVE"))),
curveEditorRES(new CurveEditorGroup(options.lastWaveletCurvesDir)), curveEditorRES(new CurveEditorGroup(options.lastWaveletCurvesDir)),
curveEditorGAM(new CurveEditorGroup(options.lastWaveletCurvesDir)), curveEditorGAM(new CurveEditorGroup(options.lastWaveletCurvesDir)),
separatorNeutral(Gtk::manage(new Gtk::HSeparator())), separatorNeutral(Gtk::manage(new Gtk::HSeparator())),
@ -186,7 +186,7 @@ Wavelet::Wavelet() :
EvWavoldsh = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVOLDSH"); EvWavoldsh = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVOLDSH");
EvWavoffset = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVOFFSET"); EvWavoffset = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVOFFSET");
EvWavsoftwav = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_SOFTWAV"); EvWavsoftwav = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_SOFTWAV");
EvWavblshape = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_blshape"); EvWavblshape = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_BLSHAPE");
expsettings->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expsettings)); expsettings->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expsettings));
@ -643,18 +643,18 @@ Wavelet::Wavelet() :
//Blur Wavelet //Blur Wavelet
ToolParamBlock* const blBox = Gtk::manage(new ToolParamBlock()); ToolParamBlock* const blBox = Gtk::manage(new ToolParamBlock());
curveEditortm->setCurveListener(this); curveEditorbl->setCurveListener(this);
blshape = static_cast<FlatCurveEditor*>(curveEditortm->addCurve(CT_Flat, "", nullptr, false, false)); blshape = static_cast<FlatCurveEditor*>(curveEditorbl->addCurve(CT_Flat, "", nullptr, false, false));
blshape->setIdentityValue(0.); blshape->setIdentityValue(0.);
blshape->setResetCurve(FlatCurveType(default_params.blcurve.at(0)), default_params.blcurve); blshape->setResetCurve(FlatCurveType(default_params.blcurve.at(0)), default_params.blcurve);
blshape->setTooltip(M("TP_WAVELET_CURVEEDITOR_CC_TOOLTIP")); blshape->setTooltip(M("TP_WAVELET_CURVEEDITOR_CC_TOOLTIP"));
curveEditortm->curveListComplete(); curveEditorbl->curveListComplete();
curveEditortm->show(); curveEditorbl->show();
blBox->pack_start(*curveEditortm, Gtk::PACK_SHRINK, 4); blBox->pack_start(*curveEditorbl, Gtk::PACK_SHRINK, 4);
chrwav->setAdjusterListener(this); chrwav->setAdjusterListener(this);
@ -1008,7 +1008,7 @@ Wavelet::~Wavelet()
delete opaCurveEditorG; delete opaCurveEditorG;
delete opacityCurveEditorG; delete opacityCurveEditorG;
delete curveEditortm; delete curveEditorbl;
delete CCWcurveEditorG; delete CCWcurveEditorG;
delete curveEditorRES; delete curveEditorRES;
delete curveEditorGAM; delete curveEditorGAM;
@ -2640,7 +2640,7 @@ void Wavelet::setBatchMode(bool batchMode)
opacityCurveEditorG->setBatchMode(batchMode); opacityCurveEditorG->setBatchMode(batchMode);
opacityCurveEditorW->setBatchMode(batchMode); opacityCurveEditorW->setBatchMode(batchMode);
opacityCurveEditorWL->setBatchMode(batchMode); opacityCurveEditorWL->setBatchMode(batchMode);
curveEditortm->setBatchMode(batchMode); curveEditorbl->setBatchMode(batchMode);
curveEditorRES->setBatchMode(batchMode); curveEditorRES->setBatchMode(batchMode);
curveEditorGAM->setBatchMode(batchMode); curveEditorGAM->setBatchMode(batchMode);
sigma->showEditedCB(); sigma->showEditedCB();

View File

@ -147,7 +147,7 @@ private:
CurveEditorGroup* const curveEditorG; CurveEditorGroup* const curveEditorG;
CurveEditorGroup* const CCWcurveEditorG; CurveEditorGroup* const CCWcurveEditorG;
CurveEditorGroup* const curveEditortm; CurveEditorGroup* const curveEditorbl;
CurveEditorGroup* const curveEditorRES; CurveEditorGroup* const curveEditorRES;
CurveEditorGroup* const curveEditorGAM; CurveEditorGroup* const curveEditorGAM;
Gtk::HSeparator* const separatorNeutral; Gtk::HSeparator* const separatorNeutral;