From 79b3ff8e6e559e85c5eec1a80460f5da4212447e Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Tue, 24 Sep 2019 18:59:02 +0200 Subject: [PATCH] capture sharpening: allow negative corner boost --- rtengine/capturesharpening.cc | 17 ++++++++++------- rtgui/pdsharpening.cc | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/rtengine/capturesharpening.cc b/rtengine/capturesharpening.cc index e08243713..ef8a55a6e 100644 --- a/rtengine/capturesharpening.cc +++ b/rtengine/capturesharpening.cc @@ -581,14 +581,17 @@ BENCHFUN gauss5x5mult(tmpThr, tmpIThr, fullTileSize, fullTileSize, kernel5); } } else { - if (sigmaCornerOffset > 0.0) { - float lkernel7[7][7]; + if (sigmaCornerOffset != 0.0) { const float distance = sqrt(rtengine::SQR(i + tileSize / 2 - H / 2) + rtengine::SQR(j + tileSize / 2 - W / 2)); - compute7x7kernel(sigma + distanceFactor * distance, lkernel7); - for (int k = 0; k < iterations - 1; ++k) { - // apply 7x7 gaussian blur and divide luminance by result of gaussian blur - gauss7x7div(tmpIThr, tmpThr, lumThr, fullTileSize, fullTileSize, lkernel7); - gauss7x7mult(tmpThr, tmpIThr, fullTileSize, fullTileSize, lkernel7); + const float sigmaTile = sigma + distanceFactor * distance; + if (sigmaTile >= 0.4f) { + float lkernel7[7][7]; + compute7x7kernel(sigma + distanceFactor * distance, lkernel7); + for (int k = 0; k < iterations - 1; ++k) { + // apply 7x7 gaussian blur and divide luminance by result of gaussian blur + gauss7x7div(tmpIThr, tmpThr, lumThr, fullTileSize, fullTileSize, lkernel7); + gauss7x7mult(tmpThr, tmpIThr, fullTileSize, fullTileSize, lkernel7); + } } } else { for (int k = 0; k < iterations; ++k) { diff --git a/rtgui/pdsharpening.cc b/rtgui/pdsharpening.cc index cd34a466e..759461ba5 100644 --- a/rtgui/pdsharpening.cc +++ b/rtgui/pdsharpening.cc @@ -55,7 +55,7 @@ PdSharpening::PdSharpening() : FoldableToolPanel(this, "capturesharpening", M("T dradius = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS"), 0.4, 1.15, 0.01, 0.75)); dradius->addAutoButton(); dradius->setAutoValue(true); - dradiusOffset = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS_BOOST"), 0.0, 0.5, 0.01, 0.0)); + dradiusOffset = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS_BOOST"), -0.5, 0.5, 0.01, 0.0)); diter = Gtk::manage(new Adjuster(M("TP_SHARPENING_RLD_ITERATIONS"), 1, 100, 1, 20)); rld->pack_start(*gamma); rld->pack_start(*dradius);