Disabled benchmark code

This commit is contained in:
heckflosse
2018-05-28 23:10:28 +02:00
parent 9f3b2a5bdd
commit 9a865449c3
2 changed files with 21 additions and 24 deletions

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "rtengine.h"
#include "improcfun.h" #include "improcfun.h"
#include "gauss.h" #include "gauss.h"
#include "bilateral2.h" #include "bilateral2.h"
@@ -24,7 +24,7 @@
#include "rt_math.h" #include "rt_math.h"
#include "sleef.c" #include "sleef.c"
#include "opthelper.h" #include "opthelper.h"
#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
using namespace std; using namespace std;
@@ -322,7 +322,7 @@ void ImProcFunctions::sharpening (LabImage* lab, const SharpeningParams &sharpen
deconvsharpening (lab->L, b2, lab->W, lab->H, sharpenParam); deconvsharpening (lab->L, b2, lab->W, lab->H, sharpenParam);
return; return;
} }
BENCHFUN
// Rest is UNSHARP MASK // Rest is UNSHARP MASK
float** b3 = nullptr; float** b3 = nullptr;
@@ -649,24 +649,15 @@ void ImProcFunctions::MLsharpen (LabImage* lab)
//! \param luminance : Luminance channel of image //! \param luminance : Luminance channel of image
void ImProcFunctions::MLmicrocontrast(float** luminance, int W, int H) void ImProcFunctions::MLmicrocontrast(float** luminance, int W, int H)
{ {
if (!params->sharpenMicro.enabled || params->sharpenMicro.contrast == 100) { if (!params->sharpenMicro.enabled || params->sharpenMicro.contrast == 100 || params->sharpenMicro.amount < 1.0) {
return; return;
} }
BENCHFUN BENCHFUN
const int k = params->sharpenMicro.matrix ? 1 : 2; const int k = params->sharpenMicro.matrix ? 1 : 2;
// k=2 matrix 5x5 k=1 matrix 3x3 // k=2 matrix 5x5 k=1 matrix 3x3
const int width = W, height = H; const int width = W, height = H;
const float uniform = params->sharpenMicro.uniformity; //between 0 to 100 const int unif = params->sharpenMicro.uniformity / 10.0f; //put unif between 0 to 10
const int unif = (int)(uniform / 10.0f); //put unif between 0 to 10 const float amount = (k == 1 ? 2.7f : 1.f) * params->sharpenMicro.amount / 1500.0f; //amount 2000.0 quasi no artifacts ==> 1500 = maximum, after artifacts, 25/9 if 3x3
float amount = params->sharpenMicro.amount / 1500.0f; //amount 2000.0 quasi no artifacts ==> 1500 = maximum, after artifacts
if (amount < 0.000001f) {
return;
}
if (k == 1) {
amount *= 2.7f; //25/9 if 3x3
}
if (settings->verbose) { if (settings->verbose) {
printf ("Micro-contrast amount %f\n", amount); printf ("Micro-contrast amount %f\n", amount);
@@ -694,7 +685,6 @@ BENCHFUN
const float Cont4[11] = {0.8f, 0.85f, 0.9f, 0.95f, 1.0f, 1.05f, 1.10f, 1.150f, 1.2f, 1.25f, 1.40f}; const float Cont4[11] = {0.8f, 0.85f, 0.9f, 0.95f, 1.0f, 1.05f, 1.10f, 1.150f, 1.2f, 1.25f, 1.40f};
const float Cont5[11] = {1.0f, 1.1f, 1.2f, 1.25f, 1.3f, 1.4f, 1.45f, 1.50f, 1.6f, 1.65f, 1.80f}; const float Cont5[11] = {1.0f, 1.1f, 1.2f, 1.25f, 1.3f, 1.4f, 1.45f, 1.50f, 1.6f, 1.65f, 1.80f};
const float s = amount;
constexpr float sqrt2 = sqrt(2.0); constexpr float sqrt2 = sqrt(2.0);
constexpr float sqrt1d25 = sqrt(1.25); constexpr float sqrt1d25 = sqrt(1.25);
float *LM = new float[width * height]; //allocation for Luminance float *LM = new float[width * height]; //allocation for Luminance
@@ -734,9 +724,9 @@ BENCHFUN
contrast = std::min(contrast, 1.f); contrast = std::min(contrast, 1.f);
//matrix 5x5 //matrix 5x5
float temp = v + 4.f *( v * (s + sqrt2 * s)); //begin 3x3 float temp = v + 4.f *( v * (amount + sqrt2 * amount)); //begin 3x3
float temp1 = sqrt2 * s *(LM[offset - width - 1] + LM[offset - width + 1] + LM[offset + width - 1] + LM[offset + width + 1]); float temp1 = sqrt2 * amount *(LM[offset - width - 1] + LM[offset - width + 1] + LM[offset + width - 1] + LM[offset + width + 1]);
temp1 += s * (LM[offset - width] + LM[offset - 1] + LM[offset + 1] + LM[offset + width]); temp1 += amount * (LM[offset - width] + LM[offset - 1] + LM[offset + 1] + LM[offset + width]);
temp -= temp1; temp -= temp1;
@@ -749,7 +739,7 @@ BENCHFUN
temp2 -= sqrt2 * (LM[offset + 2 * width - 2] + LM[offset + 2 * width + 2] + LM[offset - 2 * width - 2] + LM[offset - 2 * width + 2]); temp2 -= sqrt2 * (LM[offset + 2 * width - 2] + LM[offset + 2 * width + 2] + LM[offset - 2 * width - 2] + LM[offset - 2 * width + 2]);
temp2 += 18.601126159f * v ; // 18.601126159 = 4 + 4 * sqrt(2) + 8 * sqrt(1.25) temp2 += 18.601126159f * v ; // 18.601126159 = 4 + 4 * sqrt(2) + 8 * sqrt(1.25)
temp2 *= 2.f * s; temp2 *= 2.f * amount;
temp += temp2; temp += temp2;
} }

View File

@@ -1007,7 +1007,7 @@ void ColorToningParams::getCurves(ColorGradientCurve& colorCurveLUT, OpacityCurv
SharpeningParams::SharpeningParams() : SharpeningParams::SharpeningParams() :
enabled(false), enabled(false),
contrast(0.0), contrast(20.0),
radius(0.5), radius(0.5),
amount(200), amount(200),
threshold(20, 80, 2000, 1200, false), threshold(20, 80, 2000, 1200, false),
@@ -1017,10 +1017,10 @@ SharpeningParams::SharpeningParams() :
halocontrol(false), halocontrol(false),
halocontrol_amount(85), halocontrol_amount(85),
method("usm"), method("usm"),
deconvamount(75), deconvamount(100),
deconvradius(0.75), deconvradius(0.75),
deconviter(30), deconviter(30),
deconvdamping(20) deconvdamping(0)
{ {
} }
@@ -3675,7 +3675,14 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
if (keyFile.has_group ("Sharpening")) { if (keyFile.has_group ("Sharpening")) {
assignFromKeyfile(keyFile, "Sharpening", "Enabled", pedited, sharpening.enabled, pedited->sharpening.enabled); assignFromKeyfile(keyFile, "Sharpening", "Enabled", pedited, sharpening.enabled, pedited->sharpening.enabled);
assignFromKeyfile(keyFile, "Sharpening", "Contrast", pedited, sharpening.contrast, pedited->sharpening.contrast); if (ppVersion >= 334) {
assignFromKeyfile(keyFile, "Sharpening", "Contrast", pedited, sharpening.contrast, pedited->sharpening.contrast);
} else {
sharpening.contrast = 0;
if (pedited) {
pedited->sharpening.contrast = true;
}
}
assignFromKeyfile(keyFile, "Sharpening", "Radius", pedited, sharpening.radius, pedited->sharpening.radius); assignFromKeyfile(keyFile, "Sharpening", "Radius", pedited, sharpening.radius, pedited->sharpening.radius);
assignFromKeyfile(keyFile, "Sharpening", "Amount", pedited, sharpening.amount, pedited->sharpening.amount); assignFromKeyfile(keyFile, "Sharpening", "Amount", pedited, sharpening.amount, pedited->sharpening.amount);