From a9fd4f0fed25ba4af44f06ce8dc3c06abb380e90 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 26 Jan 2019 11:51:44 +0100 Subject: [PATCH] Fixed crash in local retinex --- rtengine/ipretinex.cc | 4 +++- rtgui/locallab.cc | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index a490595cb..c50a8a68a 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -53,7 +53,8 @@ namespace { void retinex_scales(float* scales, int nscales, int mode, int s, float high) -{ +{ if(s < 3) s = 3;//to avoid crash in MSRlocal if nei small + if (nscales == 1) { scales[0] = (float)s / 2.f; } else if (nscales == 2) { @@ -851,6 +852,7 @@ void ImProcFunctions::MSRLocal(int sp, float** luminance, float** templ, const f constexpr auto maxRetinexScales = 8; float RetinexScales[maxRetinexScales]; + // retinex_scales(RetinexScales, scal, moderetinex, nei, high); retinex_scales(RetinexScales, scal, moderetinex, nei, high); diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 74179343b..f8e7bbea4 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -110,7 +110,7 @@ Locallab::Locallab(): // Retinex str(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STR"), 0, 100, 1, 0))), chrrt(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHRRT"), 0, 100, 1, 0))), - neigh(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NEIGH"), -100, 150, 1, 100))),//14, 150, 1, 50))), + neigh(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NEIGH"), 14, 200, 1, 50))),//14, 150, 1, 50))), vart(Gtk::manage(new Adjuster(M("TP_LOCALLAB_VART"), 50, 500, 1, 200))), dehaz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DEHAZ"), 0, 100, 1, 0))), sensih(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIH"), 0, 100, 1, 19))),