From e438e0e60411d51c059cd1873355732e885b0625 Mon Sep 17 00:00:00 2001 From: Lawrence37 <45837045+Lawrence37@users.noreply.github.com> Date: Sun, 4 Feb 2024 15:43:33 -0800 Subject: [PATCH] Some more cherry-picking for 5.10 (#6937) * Local adjustments - Show additional settings - link with complexity (#6899) * Change hishow -additional seeting - with complexity * Modify windows.yml and appimage.yml * Fixed bug in duplicate spot * Remove pre-dev builds * Update camconst.json white levels for 1DxII * Fix warnings: conversion to double/float, unused variables, register keyword * Fix crash when opening image in editor Do not access uninitialized raw image data. The raw data is requested when the demosaic mode is set to None and the cursor is moved over the image in the editor. It can occur before the raw data is loaded. * Fix sRGB working profile crash The sRGB working profile cannot be found under some conditions because the profile name is stored as a Glib::ustring and the same strings may not be equal when using different locales. Use std::string whenever comparing profile names. --------- Co-authored-by: Desmis Co-authored-by: CarVac Co-authored-by: Alexander Gruzintsev <0v3rt1r3d@gmail.com> --- CMakeLists.txt | 4 ++++ rtengine/camconst.json | 13 +++++++++---- rtengine/dfmanager.cc | 1 - rtengine/iccstore.cc | 19 ++++++++++--------- rtengine/procparams.cc | 2 +- rtengine/rawimagesource.cc | 20 +++++++++++++++++--- rtgui/dirbrowser.cc | 5 ++++- rtgui/editwindow.h | 2 +- rtgui/flatfield.cc | 2 +- rtgui/locallab.cc | 1 + rtgui/lockablecolorpicker.h | 2 +- rtgui/pointermotionlistener.h | 2 +- 12 files changed, 50 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abb86a108..7b7c797d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -538,6 +538,10 @@ pkg_check_modules(LCMS REQUIRED lcms2>=2.6) pkg_check_modules(EXPAT REQUIRED expat>=2.1) pkg_check_modules(FFTW3F REQUIRED fftw3f) +# By default little-cms2 uses 'register' keyword which is deprecated and removed in c++17 +# This definition forces not to use it +add_definitions("-DCMS_NO_REGISTER_KEYWORD") + #Set the appropriate FFTW flags on macOS if(APPLE AND OPTION_OMP) set(EXTRA_LIB "-L${LOCAL_PREFIX}/lib -lfftw3f_omp -lfftw3f -lm") diff --git a/rtengine/camconst.json b/rtengine/camconst.json index e77822967..dba157aab 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -389,13 +389,18 @@ Camera constants: "ranges": { // black levels are read from raw masked pixels // white levels are same for all colors all ISOs, but safety margin vary on ISO + // actually not, 160 & 320 & 640 seem to have different white levels per color "white": [ { "iso": 50, "levels": 16350 }, // typical for all ISOs: 16383, stdev 2.25 { "iso": 100, "levels": 16350 }, // stdev 2.25 - { "iso": [ 125, 160, 200, 250 ], "levels": 16340 }, // stdev 2.5 - { "iso": [ 320, 400, 500 ], "levels": 16330 }, // stdev 2.95 - { "iso": [ 640, 800, 1000 ], "levels": 16320 }, // stdev x, 4.0 , x - { "iso": [ 1250, 1600, 2000 ], "levels": 16300 }, // stdev x, 6.0 , x + { "iso": [ 125, 200, 250 ], "levels": 16340 }, // stdev 2.5 + { "iso": 160, "levels": [ 16340, 14450, 15600 ] }, // based on CarVac's testing + { "iso": [ 400, 500 ], "levels": 16330 }, // stdev 2.95 + { "iso": 320, "levels": [ 16330, 16000, 16330 ] }, // based on CarVac's testing + { "iso": [ 800, 1000 ], "levels": 16320 }, // stdev x, 4.0 , x + { "iso": 640, "levels": [ 16320, 15800, 16320 ] }, // based on CarVac's testing + { "iso": [ 1600, 2000 ], "levels": 16300 }, // stdev x, 6.0 , x + { "iso": 1250, "levels": [ 16300, 16050, 16300 ] }, // based on CarVac's testing { "iso": [ 2500, 3200, 4000 ], "levels": 16250 }, // STDEV x, 9.8 , x { "iso": [ 5000, 6400, 8000 ], "levels": 16150 }, // stdev x, 17, x { "iso": [ 10000, 12800, 16000 ], "levels": 16100 }, // stdev x, 34 , x diff --git a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc index 52de10339..5ad664b52 100644 --- a/rtengine/dfmanager.cc +++ b/rtengine/dfmanager.cc @@ -317,7 +317,6 @@ private: typedef std::map > bpList_t; dfList_t dfList; bpList_t bpList; - bool initialized; Glib::ustring currentPath; dfInfo* addFileInfo(const Glib::ustring &filename, bool pool = true); dfInfo* find(const std::string &mak, const std::string &mod, int isospeed, double shut, time_t t); diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 8ba5fb4af..af1b94fbe 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -18,6 +18,7 @@ */ #include #include +#include #include #include @@ -51,9 +52,9 @@ namespace // Not recursive void loadProfiles( const Glib::ustring& dirName, - std::map* profiles, - std::map* profileContents, - std::map* profileNames, + std::map* profiles, + std::map* profileContents, + std::map* profileNames, bool nameUpper ) { @@ -114,8 +115,8 @@ void loadProfiles( bool loadProfile( const Glib::ustring& profile, const Glib::ustring& dirName, - std::map* profiles, - std::map* profileContents + std::map* profiles, + std::map* profileContents ) { if (dirName.empty() || profiles == nullptr) { @@ -996,10 +997,10 @@ parse_error: return false; } - using ProfileMap = std::map; - using MatrixMap = std::map; - using ContentMap = std::map; - using NameMap = std::map; + using ProfileMap = std::map; + using MatrixMap = std::map; + using ContentMap = std::map; + using NameMap = std::map; ProfileMap wProfiles; // ProfileMap wProfilesGamma; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 72ee30a64..8fe436576 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2990,7 +2990,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : avoidrad(0.), transitweak(1.0), transitgrad(0.0), - hishow(false), + hishow(options.complexity != 2), activ(true), blwh(false), recurs(false), diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index ec91bdbe4..8149c0464 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include #include #include #include @@ -743,6 +744,8 @@ void RawImageSource::getWBMults(const ColorTemp &ctemp, const RAWParams &raw, st void RawImageSource::getImage(const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const RAWParams &raw) { + assert(rawData.getHeight() == H && rawData.getWidth() == W); + MyMutex::MyLock lock(getImageMutex); tran = defTransform(ri, tran); @@ -1744,6 +1747,8 @@ void RawImageSource::preprocess(const RAWParams &raw, const LensProfParams &lens void RawImageSource::demosaic(const RAWParams &raw, bool autoContrast, double &contrastThreshold, bool cache) { + assert(rawData.getHeight() == H && rawData.getWidth() == W); + MyTime t1, t2; t1.set(); @@ -3837,6 +3842,8 @@ void RawImageSource::hlRecovery(const std::string &method, float* red, float* gr void RawImageSource::getAutoExpHistogram(LUTu & histogram, int& histcompr) { + assert(rawData.getHeight() == H && rawData.getWidth() == W); + // BENCHFUN histcompr = 3; @@ -5307,8 +5314,8 @@ void RawImageSource::ItcWB(bool extra, double &tempref, double &greenref, double Glib::ustring profuse; profuse = "JDCmax"; - int limx = 0.05f; - int limy = 0.04f; + float limx = 0.05f; + float limy = 0.04f; if (wbpar.itcwb_prim == "srgb") { profuse = "sRGB"; @@ -7480,6 +7487,8 @@ void RawImageSource::getrgbloc(int begx, int begy, int yEn, int xEn, int cx, int void RawImageSource::getAutoWBMultipliersitc(bool extra, double & tempref, double & greenref, double & tempitc, double & greenitc, float &temp0, float &delta, int &bia, int &dread, int &kcam, int &nocam, float &studgood, float &minchrom, int &kmin, float &minhist, float &maxhist, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double & rm, double & gm, double & bm, const WBParams & wbpar, const ColorManagementParams & cmp, const RAWParams & raw, const ToneCurveParams &hrp) { + assert(rawData.getHeight() == H && rawData.getWidth() == W); + // BENCHFUN constexpr double clipHigh = 64000.0; @@ -7704,6 +7713,8 @@ void RawImageSource::getAutoWBMultipliersitc(bool extra, double & tempref, doubl void RawImageSource::getAutoWBMultipliers(double &rm, double &gm, double &bm) { + assert(rawData.getHeight() == H && rawData.getWidth() == W); + // BENCHFUN constexpr double clipHigh = 64000.0; @@ -7920,6 +7931,7 @@ void RawImageSource::getAutoWBMultipliers(double &rm, double &gm, double &bm) ColorTemp RawImageSource::getSpotWB(std::vector &red, std::vector &green, std::vector &blue, int tran, double equal, StandardObserver observer) { + assert(rawData.getHeight() == H && rawData.getWidth() == W); int x; int y; @@ -8259,7 +8271,7 @@ void RawImageSource::init() void RawImageSource::getRawValues(int x, int y, int rotate, int &R, int &G, int &B) { - if (d1x) { // Nikon D1x has special sensor. We just skip it + if (rawData.getWidth() != W || rawData.getHeight() != H || d1x) { // Nikon D1x has special sensor. We just skip it R = G = B = 0; return; } @@ -8307,6 +8319,8 @@ bool RawImageSource::isGainMapSupported() const void RawImageSource::applyDngGainMap(const float black[4], const std::vector &gainMaps) { + assert(rawData.getHeight() == H && rawData.getWidth() == W); + // now we can apply each gain map to raw_data array2D mvals[2][2]; diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index 7f5a4c3e3..925fdc606 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -393,7 +393,9 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) char* dcpy = strdup (absDirPath.c_str()); char* dir = strtok (dcpy, "/\\"); +#ifdef _WIN32 int count = 0; +#endif expandSuccess = true; #ifndef _WIN32 @@ -436,8 +438,9 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) ++ix; ++i; } - +#ifdef _WIN32 count++; +#endif dir = strtok(nullptr, "/\\"); } diff --git a/rtgui/editwindow.h b/rtgui/editwindow.h index a5932c081..02b7cd23b 100644 --- a/rtgui/editwindow.h +++ b/rtgui/editwindow.h @@ -24,7 +24,7 @@ #include "guiutils.h" class EditorPanel; -class ExternalEditor; +struct ExternalEditor; class RTWindow; class EditWindow : diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 21cdb4315..5246381c3 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -445,7 +445,7 @@ void FlatField::setGainMap(bool enabled) { flatFieldFromMetaData->set_sensitive(enabled); if (!enabled) { idle_register.add( - [this, enabled]() -> bool + [this]() -> bool { disableListener(); flatFieldFromMetaData->setValue(false); diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index e3bda566e..38e84154e 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -845,6 +845,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r.colorde = newSpot->colorde; r.colorscope = newSpot->colorscope; r.avoidrad = newSpot->avoidrad; + r.hishow = newSpot->hishow; r.activ = newSpot->activ; r.blwh = newSpot->blwh; r.recurs = newSpot->recurs; diff --git a/rtgui/lockablecolorpicker.h b/rtgui/lockablecolorpicker.h index b18a56028..3de6256e9 100644 --- a/rtgui/lockablecolorpicker.h +++ b/rtgui/lockablecolorpicker.h @@ -30,7 +30,7 @@ namespace rtengine namespace procparams { -class ColorManagementParams; +struct ColorManagementParams; } diff --git a/rtgui/pointermotionlistener.h b/rtgui/pointermotionlistener.h index f9fda419c..2f19ae0b9 100644 --- a/rtgui/pointermotionlistener.h +++ b/rtgui/pointermotionlistener.h @@ -28,7 +28,7 @@ namespace rtengine namespace procparams { -class ColorManagementParams; +struct ColorManagementParams; }