From 03afede8820c0c12b6784ecaf5b5ac4f2072b145 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Mon, 22 Jan 2018 13:38:23 +0100 Subject: [PATCH 01/11] Some tweaks to curve extraction from histogram matching --- rtengine/histmatching.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index be618d4d7..3032b36e0 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -108,7 +108,7 @@ void mappingToCurve(const std::vector &mapping, std::vector &curve) int v = mapping[i]; bool change = i > 0 && v != mapping[i-1]; int diff = i - prev; - if (change && std::abs(diff - step) <= 1) { + if ((change && std::abs(diff - step) <= 1) || diff > step * 2) { curve.push_back(coord(i)); curve.push_back(coord(v)); prev = i; @@ -117,10 +117,13 @@ void mappingToCurve(const std::vector &mapping, std::vector &curve) }; doit(0, idx, idx > step ? step : idx / 2, true); doit(idx, int(mapping.size()), step, idx - step > step / 2); - if (curve.size() <= 2 || curve.back() < 0.99 || (1 - curve[curve.size()-2] > step / 512.0 && curve.back() < coord(mapping.back()))) { - curve.emplace_back(1.0); - curve.emplace_back(1.0); + if (curve.size() > 2 && (1 - curve[curve.size()-2] <= step / (256.0 * 3))) { + curve.pop_back(); + curve.pop_back(); } + curve.push_back(1.0); + curve.push_back(1.0); + if (curve.size() < 4) { curve = { DCT_Linear }; // not enough points, fall back to linear } else { From ac1238e77402842dc10d1de45b923a14bfb74444 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Mon, 22 Jan 2018 15:50:17 +0100 Subject: [PATCH 02/11] added hotfix for #3794 -- to be revised after 5.4 is out --- rtengine/rtthumbnail.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 59d19cc15..1a8d18897 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -150,6 +150,11 @@ Thumbnail* Thumbnail::loadFromImage (const Glib::ustring& fname, int &w, int &h, ImageIO* img = imgSrc.getImageIO(); + // agriggio -- hotfix for #3794, to be revised once a proper solution is implemented + if (std::max(img->getWidth(), img->getHeight()) / std::min(img->getWidth(), img->getHeight()) >= 10) { + return nullptr; + } + Thumbnail* tpp = new Thumbnail (); unsigned char* data; From fc77fd6964709be43e54de98ce4999ff35116cc3 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 22 Jan 2018 19:04:42 +0100 Subject: [PATCH 03/11] Remove all BENCHMARK defines --- rtengine/demosaic_algos.cc | 1 - rtengine/histmatching.cc | 1 - rtengine/improcfun.cc | 1 - rtengine/rawimagesource.cc | 1 - rtengine/tmo_fattal02.cc | 1 - 5 files changed, 5 deletions(-) diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 16c0204dd..68b2ad8bb 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -37,7 +37,6 @@ #include "sleef.c" #include "opthelper.h" #include "median.h" -//#define BENCHMARK #include "StopWatch.h" #ifdef _OPENMP #include diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index 3032b36e0..699448bbb 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -26,7 +26,6 @@ #include "iccstore.h" #include "../rtgui/mydiagonalcurve.h" #include "improcfun.h" -#define BENCHMARK #include "StopWatch.h" #include #include diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 312494fd2..d0c78f906 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -40,7 +40,6 @@ #include "improccoordinator.h" #include "clutstore.h" #include "ciecam02.h" -//#define BENCHMARK #include "StopWatch.h" #include "../rtgui/ppversion.h" #include "../rtgui/guiutils.h" diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 4c777a30e..ea7b0e559 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -38,7 +38,6 @@ #include #endif #include "opthelper.h" -#define BENCHMARK #include "StopWatch.h" #define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) #undef CLIPD diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index c5e7c407f..4fb11ff19 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -69,7 +69,6 @@ #include "improcfun.h" #include "settings.h" #include "iccstore.h" -//#define BENCHMARK #include "StopWatch.h" #include "sleef.c" #include "opthelper.h" From d921f0359a9358abadb5ce5891c1fdfb5edd6417 Mon Sep 17 00:00:00 2001 From: TooWaBoo Date: Mon, 22 Jan 2018 20:34:30 +0100 Subject: [PATCH 04/11] Update TooWaBlue theme v2.62 Changed switch color --- rtdata/themes/TooWaBlue-GTK3-20_.css | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rtdata/themes/TooWaBlue-GTK3-20_.css b/rtdata/themes/TooWaBlue-GTK3-20_.css index af7fb00af..a65fb2d3e 100644 --- a/rtdata/themes/TooWaBlue-GTK3-20_.css +++ b/rtdata/themes/TooWaBlue-GTK3-20_.css @@ -2,7 +2,7 @@ This file is part of RawTherapee. Copyright (c) 2016-2017 TooWaBoo - Version 2.61 + Version 2.62 RawTherapee is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1242,7 +1242,8 @@ switch { switch slider { border: 0.08334em solid @bg-entry-border; - background-image: linear-gradient(to bottom, shade (@accent-color2,1.15), shade (@accent-color2,.85)); + background-color: shade (@bg-light-grey, .85); + background-image: linear-gradient(to bottom, rgba(125,125,125,.4), rgba(60,60,60,.4)); border: 0.08334em solid @bg-entry-border; box-shadow: inset 0 0.08334em rgba(242, 242, 242, 0.1); border-radius: 0.2em 0 0 0.2em; @@ -1252,12 +1253,13 @@ switch:checked slider{ } switch:hover slider { - background-image: linear-gradient(to bottom, shade (@accent-color2,1.20), shade (@accent-color2,.90)); + background-color: shade (@bg-light-grey, .65); + background-image: linear-gradient(to bottom, rgba(125,125,125,.4), rgba(60,60,60,.4)); } switch:checked { - background-color: rgb(140,0,20); - color: @headline-big; + background-color: @accent-color2; + color: @headline-big; } switch:disabled:not(:checked) { @@ -1265,10 +1267,8 @@ switch:disabled:not(:checked) { background-image: none; background-color: shade (@bg-light-grey, .85); } -switch:disabled slider { - background-image: linear-gradient(to bottom, rgba(125,125,125,.4), rgba(60,60,60,.4)); - background-color: shade (@bg-light-grey, .85); -} + + /** end ****************************************************************************************/ /*** Buttons ***********************************************************************************/ From 16c8f18976007f73714c419d3a0b27bf225ee025 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Mon, 22 Jan 2018 23:00:37 +0100 Subject: [PATCH 05/11] make sure that the idle callback set by CropHandler::setDetailedCrop gets called before redraws Fixes #4224 --- rtgui/crophandler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index 0abff627b..6228cb1c7 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -411,7 +411,7 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp return FALSE; }; - idle_register.add(func, idle_helper); + idle_register.add(func, idle_helper, G_PRIORITY_HIGH_IDLE); } cimg.unlock (); From bc6dad6eb9df4809a4f7d562b612baf0f9c4889a Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 23 Jan 2018 00:16:19 +0100 Subject: [PATCH 06/11] histogram matching: fixed typo in calculating the crop --- rtengine/histmatching.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index 699448bbb..4216c4581 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -203,7 +203,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) std::cout << "histogram matching: cropping target to get an aspect ratio of " << std::fixed << std::setprecision(2) << thumb_ratio << ":1, new full size is " << fw << "x" << fh << std::endl; } } - PreviewProps pp(0, 0, fw, fh, skip); + PreviewProps pp(cx, cy, fw, fh, skip); ColorTemp currWB = getWB(); std::unique_ptr image(new Imagefloat(int(fw / skip), int(fh / skip))); getImage(currWB, TR_NONE, image.get(), pp, neutral.toneCurve, neutral.raw); From 09d020cca3020e4051cc2329d60d598af26a9806 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Tue, 23 Jan 2018 01:29:43 +0100 Subject: [PATCH 07/11] Added -DWITH_BENCHFUN to build-rawtherapee --- tools/build-rawtherapee | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/build-rawtherapee b/tools/build-rawtherapee index 5c13df061..3b994b670 100755 --- a/tools/build-rawtherapee +++ b/tools/build-rawtherapee @@ -137,6 +137,7 @@ cmake \ -DWITH_PROF="OFF" \ -DWITH_SAN="OFF" \ -DWITH_SYSTEM_KLT="OFF" \ + -DWITH_BENCHFUN="OFF" \ "$HOME/programs/code-${prog}" || exit 1 make --jobs="$cpuCount" install || exit 1 From e5fe9b47df611e38e0e39c914302431276ce61bf Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 23 Jan 2018 08:58:31 +0100 Subject: [PATCH 08/11] fixed bug in setting the queue running/paused icons for METM layouts Fixes #4323 --- rtgui/batchqueuepanel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index 054160d91..ba07f6f4d 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -228,7 +228,7 @@ void BatchQueuePanel::updateTab (int qsize, int forceOrientation) if (!qsize ) { grid->attach_next_to(*Gtk::manage (new RTImage ("processing.png")), Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*Gtk::manage (new Gtk::Label (M("MAIN_FRAME_BATCHQUEUE") )), Gtk::POS_RIGHT, 1, 1); - } else if (!qStartStop->get_active()) { + } else if (qStartStop->get_active()) { grid->attach_next_to(*Gtk::manage (new RTImage ("processing-play.png")), Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*Gtk::manage (new Gtk::Label (M("MAIN_FRAME_BATCHQUEUE") + " [" + Glib::ustring::format( qsize ) + "]" )), Gtk::POS_RIGHT, 1, 1); } else { From 9a4359995f9c739486dba59f4afadf65b9a9b0ab Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 23 Jan 2018 10:36:50 +0100 Subject: [PATCH 09/11] Suppress manuel settings fot local contrsat and edge detection in wavelet --- rtengine/ipwavelet.cc | 15 +++++++-------- rtengine/settings.h | 8 -------- rtgui/options.cc | 45 ------------------------------------------- rtgui/wavelet.cc | 2 +- 4 files changed, 8 insertions(+), 62 deletions(-) diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index e54a249f6..04db1c314 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -1876,11 +1876,10 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * // I adapted the principle but have profoundly changed the algorithm // One can 1) change all parameters and found good parameters; //one can also chnage in calckoe - float edd = settings->ed_detec; - float eddlow = settings->ed_low; //5 to 40 + float edd = 3.f; + float eddlow = 15.f; float eddlipinfl = 0.005f * cp.edgsens + 0.4f; float eddlipampl = 1.f + cp.edgampl / 50.f; - // float eddlow=5.f + cp.edgampl/2.f;//settings->ed_low;//5 to 40 if(cp.detectedge) { //enabled Lipschitz control...more memory..more time... @@ -2579,11 +2578,11 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit scaleskip[sc] = scales[sc] / skip; } - float t_r = settings->top_right; - float t_l = settings->top_left; - float b_r = settings->bot_right; - float edd = settings->ed_detec; - float eddstrength = settings->ed_detecStr; + float t_r = 40.f; + float t_l = 10.f; + float b_r = 75.f; + float edd = 3.f; + float eddstrength = 1.3f; float aedstr = (eddstrength - 1.f) / 90.f; float bedstr = 1.f - 10.f * aedstr; diff --git a/rtengine/settings.h b/rtengine/settings.h index 686c2b547..8f24f18f1 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -83,14 +83,6 @@ public: double artifact_cbdl; double level0_cbdl; double level123_cbdl; - double bot_left; - double top_left; - double top_right; - double bot_right; - double ed_detec; - double ed_detecStr; - double ed_low; - Glib::ustring lensfunDbDirectory; ///< The directory containing the lensfun database. If empty, the system defaults will be used (as described in http://lensfun.sourceforge.net/manual/dbsearch.html) /** Creates a new instance of Settings. diff --git a/rtgui/options.cc b/rtgui/options.cc index 4ef8c4a22..90b7378a6 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -560,14 +560,6 @@ void Options::setDefaults () rtSettings.artifact_cbdl = 4.; rtSettings.level0_cbdl = 0; rtSettings.level123_cbdl = 30; - rtSettings.bot_left = 0; - rtSettings.top_left = 10; - rtSettings.top_right = 40; - rtSettings.bot_right = 75; - rtSettings.ed_detec = 3; //between 2 and 10 - rtSettings.ed_detecStr = 1.3; //not use - rtSettings.ed_low = 15.; //between 5 to 40 - rtSettings.ciecamfloat = true; rtSettings.protectred = 60; @@ -716,35 +708,6 @@ void Options::readFromFile (Glib::ustring fname) if ( keyFile.has_key ("General", "Verbose")) { rtSettings.verbose = keyFile.get_boolean ( "General", "Verbose"); } - - if (keyFile.has_key ("General", "BotLeft")) { - rtSettings.bot_left = keyFile.get_double ("General", "BotLeft"); - } - - if (keyFile.has_key ("General", "TopLeft")) { - rtSettings.top_left = keyFile.get_double ("General", "TopLeft"); - } - - if (keyFile.has_key ("General", "TopRight")) { - rtSettings.top_right = keyFile.get_double ("General", "TopRight"); - } - - if (keyFile.has_key ("General", "BotRight")) { - rtSettings.bot_right = keyFile.get_double ("General", "BotRight"); - } - - if (keyFile.has_key ("General", "EDdetec")) { - rtSettings.ed_detec = keyFile.get_double ("General", "EDdetec"); - } - - if (keyFile.has_key ("General", "EDdetecStr")) { - rtSettings.ed_detecStr = keyFile.get_double ("General", "EDdetecStr"); - } - - if (keyFile.has_key ("General", "EDLow")) { - rtSettings.ed_low = keyFile.get_double ("General", "EDLow"); - } - } if (keyFile.has_group ("External Editor")) { @@ -1829,14 +1792,6 @@ void Options::saveToFile (Glib::ustring fname) keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath); keyFile.set_string ("General", "FlatFieldsPath", rtSettings.flatFieldsPath); keyFile.set_boolean ("General", "Verbose", rtSettings.verbose); - keyFile.set_double ("General", "BotLeft", rtSettings.bot_left); - keyFile.set_double ("General", "TopLeft", rtSettings.top_left); - keyFile.set_double ("General", "TopRight", rtSettings.top_right); - keyFile.set_double ("General", "BotRight", rtSettings.bot_right); - keyFile.set_double ("General", "EDdetec", rtSettings.ed_detec); - keyFile.set_double ("General", "EDdetecStr", rtSettings.ed_detecStr); - keyFile.set_double ("General", "EDLow", rtSettings.ed_low); - keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo); keyFile.set_string ("External Editor", "GimpDir", gimpDir); keyFile.set_string ("External Editor", "PhotoshopDir", psDir); diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index d3a594848..160abf07e 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -100,7 +100,7 @@ Wavelet::Wavelet() : bllev(Gtk::manage(new ThresholdAdjuster(M("TP_WAVELET_LOWLIGHT"), 0., 100., 0., 2., 50., 25., 0, false))), pastlev(Gtk::manage(new ThresholdAdjuster(M("TP_WAVELET_PASTEL"), 0., 70., 0., 2., 30., 20., 0, false))), satlev(Gtk::manage(new ThresholdAdjuster(M("TP_WAVELET_SAT"), 0., 130., 30., 45., 130., 100., 0, false))), - edgcont(Gtk::manage(new ThresholdAdjuster(M("TP_WAVELET_EDGCONT"), 0., 100., options.rtSettings.bot_left, options.rtSettings.top_left, options.rtSettings.bot_right, options.rtSettings.top_right, 0., false))), + edgcont(Gtk::manage(new ThresholdAdjuster(M("TP_WAVELET_EDGCONT"), 0., 100., 0, 10, 75, 40, 0., false))), level0noise(Gtk::manage(new ThresholdAdjuster(M("TP_WAVELET_LEVZERO"), -30., 100., 0., M("TP_WAVELET_STREN"), 1., 0., 100., 0., M("TP_WAVELET_NOIS"), 1., nullptr, false))), level1noise(Gtk::manage(new ThresholdAdjuster(M("TP_WAVELET_LEVONE"), -30., 100., 0., M("TP_WAVELET_STREN"), 1., 0., 100., 0., M("TP_WAVELET_NOIS"), 1., nullptr, false))), level2noise(Gtk::manage(new ThresholdAdjuster(M("TP_WAVELET_LEVTWO"), -30., 100., 0., M("TP_WAVELET_STREN"), 1., 0., 100., 0., M("TP_WAVELET_NOIS"), 1., nullptr, false))), From 4cd1ad066d6e914aeed1d1cb6b555cbfedaf1704 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 23 Jan 2018 13:44:58 +0100 Subject: [PATCH 10/11] imagefloat: correctly clip the values when outputting to 8- or 16-bit formats Fixes #4310 --- rtengine/imagefloat.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rtengine/imagefloat.cc b/rtengine/imagefloat.cc index bfeb85534..fa45c53ba 100644 --- a/rtengine/imagefloat.cc +++ b/rtengine/imagefloat.cc @@ -163,15 +163,15 @@ void Imagefloat::getScanline (int row, unsigned char* buffer, int bps) } else if (bps == 16) { unsigned short *sbuffer = (unsigned short *)buffer; for (int i = 0, ix = 0; i < width; i++) { - sbuffer[ix++] = r(row, i); - sbuffer[ix++] = g(row, i); - sbuffer[ix++] = b(row, i); + sbuffer[ix++] = CLIP(r(row, i)); + sbuffer[ix++] = CLIP(g(row, i)); + sbuffer[ix++] = CLIP(b(row, i)); } } else if (bps == 8) { for (int i = 0, ix = 0; i < width; i++) { - buffer[ix++] = rtengine::uint16ToUint8Rounded(r(row, i)); - buffer[ix++] = rtengine::uint16ToUint8Rounded(g(row, i)); - buffer[ix++] = rtengine::uint16ToUint8Rounded(b(row, i)); + buffer[ix++] = rtengine::uint16ToUint8Rounded(CLIP(r(row, i))); + buffer[ix++] = rtengine::uint16ToUint8Rounded(CLIP(g(row, i))); + buffer[ix++] = rtengine::uint16ToUint8Rounded(CLIP(b(row, i))); } } } From 4046a3c9b99f3bdb768c0315b8b3addc06102427 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 23 Jan 2018 14:46:15 +0100 Subject: [PATCH 11/11] Fixed typo --- tools/build-rawtherapee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-rawtherapee b/tools/build-rawtherapee index 3b994b670..183d0a3d2 100755 --- a/tools/build-rawtherapee +++ b/tools/build-rawtherapee @@ -137,7 +137,7 @@ cmake \ -DWITH_PROF="OFF" \ -DWITH_SAN="OFF" \ -DWITH_SYSTEM_KLT="OFF" \ - -DWITH_BENCHFUN="OFF" \ + -DWITH_BENCHMARK="OFF" \ "$HOME/programs/code-${prog}" || exit 1 make --jobs="$cpuCount" install || exit 1