From 1be40beafad4e791536c5c994589899904d5d5ba Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 May 2019 22:54:00 +0200 Subject: [PATCH 1/3] Scan clut folder: use std::set instead of std::set --- rtgui/filmsimulation.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtgui/filmsimulation.cc b/rtgui/filmsimulation.cc index 30ae09f9a..915e3a6d3 100644 --- a/rtgui/filmsimulation.cc +++ b/rtgui/filmsimulation.cc @@ -8,6 +8,8 @@ #include "../rtengine/clutstore.h" #include "../rtengine/procparams.h" +#define BENCHMARK +#include "../rtengine/StopWatch.h" using namespace rtengine; using namespace rtengine::procparams; @@ -305,6 +307,7 @@ ClutComboBox::ClutModel::ClutModel(const Glib::ustring &path) int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) { + BENCHFUNMICRO if (path.empty() || !Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { return 0; } @@ -364,7 +367,7 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) } // Fill menu structure with CLUT files - std::set entries; + std::set entries; unsigned long fileCount = 0; From ea2e9dd27434aefd629b8abc5d18ffe88e0e0752 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 May 2019 23:04:14 +0200 Subject: [PATCH 2/3] Scan clut folder: check for .png first because most of cluts are png --- rtgui/filmsimulation.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/filmsimulation.cc b/rtgui/filmsimulation.cc index 915e3a6d3..3c0c1de23 100644 --- a/rtgui/filmsimulation.cc +++ b/rtgui/filmsimulation.cc @@ -396,7 +396,7 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) HaldCLUT::splitClutFilename (entry, name, extension, profileName); extension = extension.casefold(); - if (extension.compare("tif") != 0 && extension.compare("png") != 0) { + if (extension != "png" && extension != "tif") { continue; } From 141e9f632fb7a7c61faebd4e623ff05cf2fda4bf Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 May 2019 23:12:40 +0200 Subject: [PATCH 3/3] Scan clut folder: Don't check for unused profile --- rtengine/clutstore.cc | 25 ++++++++++++++----------- rtengine/clutstore.h | 3 ++- rtgui/filmsimulation.cc | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/rtengine/clutstore.cc b/rtengine/clutstore.cc index 9ee976907..10b7a2c38 100644 --- a/rtengine/clutstore.cc +++ b/rtengine/clutstore.cc @@ -270,7 +270,8 @@ void rtengine::HaldCLUT::splitClutFilename( const Glib::ustring& filename, Glib::ustring& name, Glib::ustring& extension, - Glib::ustring& profile_name + Glib::ustring& profile_name, + bool checkProfile ) { Glib::ustring basename = Glib::path_get_basename(filename); @@ -284,17 +285,19 @@ void rtengine::HaldCLUT::splitClutFilename( name = basename; } - profile_name = "sRGB"; + if (checkProfile) { + profile_name = "sRGB"; - if (!name.empty()) { - for (const auto& working_profile : rtengine::ICCStore::getInstance()->getWorkingProfiles()) { - if ( - !working_profile.empty() // This isn't strictly needed, but an empty wp name should be skipped anyway - && std::search(name.rbegin(), name.rend(), working_profile.rbegin(), working_profile.rend()) == name.rbegin() - ) { - profile_name = working_profile; - name.erase(name.size() - working_profile.size()); - break; + if (!name.empty()) { + for (const auto& working_profile : rtengine::ICCStore::getInstance()->getWorkingProfiles()) { + if ( + !working_profile.empty() // This isn't strictly needed, but an empty wp name should be skipped anyway + && std::search(name.rbegin(), name.rend(), working_profile.rbegin(), working_profile.rend()) == name.rbegin() + ) { + profile_name = working_profile; + name.erase(name.size() - working_profile.size()); + break; + } } } } diff --git a/rtengine/clutstore.h b/rtengine/clutstore.h index a43526f78..cd94bc18b 100644 --- a/rtengine/clutstore.h +++ b/rtengine/clutstore.h @@ -39,7 +39,8 @@ public: const Glib::ustring& filename, Glib::ustring& name, Glib::ustring& extension, - Glib::ustring& profile_name + Glib::ustring& profile_name, + bool checkProfile = true ); private: diff --git a/rtgui/filmsimulation.cc b/rtgui/filmsimulation.cc index 3c0c1de23..dd29f1313 100644 --- a/rtgui/filmsimulation.cc +++ b/rtgui/filmsimulation.cc @@ -393,7 +393,7 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) Glib::ustring name; Glib::ustring extension; Glib::ustring profileName; - HaldCLUT::splitClutFilename (entry, name, extension, profileName); + HaldCLUT::splitClutFilename (entry, name, extension, profileName, false); extension = extension.casefold(); if (extension != "png" && extension != "tif") {