From 65c68364a942df9aefb120cd5ec9d6767222e756 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 20 Mar 2024 17:24:30 +0100 Subject: [PATCH 01/31] dcraw: add support for Fujifilm GFX 100 II --- rtengine/camconst.json | 11 +++++++++++ rtengine/dcraw.cc | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index ce7eabe71..06c23afae 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -1456,6 +1456,17 @@ Camera constants: ] }, + { // Quality C + "make_model": [ "FUJIFILM GFX100 II" ], + "dcraw_matrix" : [ 12806, -5779, -1110, -3546, 11507, 2318, -177, 996, 5715 ], // adobe dcp d65 + "raw_crop": [ + // multi-aspect crop to account for 16-shot pixel shift images + { "frame" : [11808, 8754], "crop" : [ 0, 0, 11664, 8750 ] }, + // this crop has been copied from the GFX 100 one, no sample pixel shift images are available + { "frame" : [23616, 17508], "crop" : [ 0, 4, 23328, 17468 ] } + ] + }, + { // Quality B "make_model": [ "FUJIFILM GFX 50R", "FUJIFILM GFX 50S", "FUJIFILM GFX50S II" ], "dcraw_matrix": [ 11756,-4754,-874,-3056,11045,2305,-381,1457,6006 ], // DNGv9.9 D65 diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 621473589..56d400d3d 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -9676,7 +9676,7 @@ void CLASS identify() apply_tiff(); if (!strcmp(model, "X-T3")) { height = raw_height - 2; - } else if (!strcmp(model, "GFX 100") || !strcmp(model, "GFX100S")) { + } else if (!strcmp(model, "GFX 100") || !strcmp(model, "GFX100S") || !strcmp(model, "GFX100 II")) { load_flags = 0; } if (!load_raw) { From 52e88e89542cfd3e6e87ca10ebc70ae1048b2890 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Fri, 29 Mar 2024 15:16:55 +0100 Subject: [PATCH 02/31] imageio: fix issues/crash on png with transparency If a png has a transparency chunk (tRNS), after converting the transparency to alpha we should also strip alpha (color_type is not updated with PNG_COLOR_MASK_ALPHA flag set) or the row parsing will return also the alpha channel causing a memory overflow. --- rtengine/imageio.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index e2c6c1310..f096213dc 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -285,6 +285,7 @@ int ImageIO::loadPNG (const Glib::ustring &fname) if (png_get_valid(png, info, PNG_INFO_tRNS)) { png_set_tRNS_to_alpha(png); + png_set_strip_alpha(png); } if (color_type & PNG_COLOR_MASK_ALPHA) { From dcc983331dca43c660aceb231704fdeeddbf4be8 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Tue, 12 Mar 2024 08:50:44 +0100 Subject: [PATCH 03/31] thumbnail: rename get/setStage to get/setTrashed Also return a bool in getTrashed since it's already used as a bool in setTrash and in all the checks. --- rtgui/filebrowser.cc | 24 ++++++++++++------------ rtgui/filecatalog.cc | 4 ++-- rtgui/thumbnail.cc | 18 +++++++++--------- rtgui/thumbnail.h | 4 ++-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 26f0d5cd6..661b6051a 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -547,13 +547,13 @@ void FileBrowser::rightClicked () untrash->set_sensitive (false); for (size_t i = 0; i < selected.size(); i++) - if ((static_cast(selected[i]))->thumbnail->getStage()) { + if ((static_cast(selected[i]))->thumbnail->getTrashed()) { untrash->set_sensitive (true); break; } for (size_t i = 0; i < selected.size(); i++) - if (!(static_cast(selected[i]))->thumbnail->getStage()) { + if (!(static_cast(selected[i]))->thumbnail->getTrashed()) { trash->set_sensitive (true); break; } @@ -649,7 +649,7 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry) entry->addButtonSet(new FileThumbnailButtonSet(entry)); entry->getThumbButtonSet()->setRank(entry->thumbnail->getRank()); entry->getThumbButtonSet()->setColorLabel(entry->thumbnail->getColorLabel()); - entry->getThumbButtonSet()->setInTrash(entry->thumbnail->getStage()); + entry->getThumbButtonSet()->setInTrash(entry->thumbnail->getTrashed()); entry->getThumbButtonSet()->setButtonListener(this); entry->resize(getThumbnailHeight()); entry->filtered = !checkFilter(entry); @@ -1023,12 +1023,12 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) const auto thumbnail = mselected[i]->thumbnail; const auto rank = thumbnail->getRank(); const auto colorLabel = thumbnail->getColorLabel(); - const auto stage = thumbnail->getStage(); + const auto stage = thumbnail->getTrashed(); thumbnail->createProcParamsForUpdate (false, true); thumbnail->setRank(rank); thumbnail->setColorLabel(colorLabel); - thumbnail->setStage(stage); + thumbnail->setTrashed(stage); // Empty run to update the thumb rtengine::procparams::ProcParams params = thumbnail->getProcParams (); @@ -1558,8 +1558,8 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) const // true -> ((entry->thumbnail->isRecentlySaved() && filter.showRecentlySaved[0]) && !filter.showRecentlySaved[1]) || ((!entry->thumbnail->isRecentlySaved() && filter.showRecentlySaved[1]) && !filter.showRecentlySaved[0]) || - (entry->thumbnail->getStage() && !filter.showTrash) || - (!entry->thumbnail->getStage() && !filter.showNotTrash)) { + (entry->thumbnail->getTrashed() && !filter.showTrash) || + (!entry->thumbnail->getTrashed() && !filter.showNotTrash)) { return false; } @@ -1625,11 +1625,11 @@ void FileBrowser::toTrashRequested (std::vector tbe) // no need to notify listeners as item goes to trash, likely to be deleted - if (tbe[i]->thumbnail->getStage()) { + if (tbe[i]->thumbnail->getTrashed()) { continue; } - tbe[i]->thumbnail->setStage (true); + tbe[i]->thumbnail->setTrashed (true); if (tbe[i]->getThumbButtonSet()) { tbe[i]->getThumbButtonSet()->setRank (tbe[i]->thumbnail->getRank()); @@ -1649,11 +1649,11 @@ void FileBrowser::fromTrashRequested (std::vector tbe) for (size_t i = 0; i < tbe.size(); i++) { // if thumbnail was marked inTrash=true then param file must be there, no need to run customprofilebuilder - if (!tbe[i]->thumbnail->getStage()) { + if (!tbe[i]->thumbnail->getTrashed()) { continue; } - tbe[i]->thumbnail->setStage (false); + tbe[i]->thumbnail->setTrashed (false); if (tbe[i]->getThumbButtonSet()) { tbe[i]->getThumbButtonSet()->setRank (tbe[i]->thumbnail->getRank()); @@ -1784,7 +1784,7 @@ void FileBrowser::buttonPressed (LWButton* button, int actionCode, void* actionD FileBrowserEntry* entry = static_cast(actionData); tbe.push_back (entry); - if (!entry->thumbnail->getStage()) { + if (!entry->thumbnail->getTrashed()) { toTrashRequested (tbe); } else { fromTrashRequested (tbe); diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 69b9e6dc9..8c5a70628 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -1910,7 +1910,7 @@ void FileCatalog::emptyTrash () std::vector toDel; for (const auto entry : t) { - if ((static_cast(entry))->thumbnail->getStage() == 1) { + if ((static_cast(entry))->thumbnail->getTrashed()) { toDel.push_back(static_cast(entry)); } } @@ -1926,7 +1926,7 @@ bool FileCatalog::trashIsEmpty () const auto& t = fileBrowser->getEntries(); for (const auto entry : t) { - if ((static_cast(entry))->thumbnail->getStage() == 1) { + if ((static_cast(entry))->thumbnail->getTrashed()) { return false; } } diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 266dbacd3..0d413e6a4 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -141,7 +141,7 @@ Thumbnail::Thumbnail(CacheManager* cm, const Glib::ustring& fname, CacheImageDat // TODO? should we call notifylisterners_procParamsChanged here? setRank(cfs.rankOld); - setStage(cfs.inTrashOld); + setTrashed(cfs.inTrashOld); } delete tpp; @@ -444,7 +444,7 @@ void Thumbnail::clearProcParams (int whoClearedIt) // preserve rank, colorlabel and inTrash across clear int rank = getRank(); int colorlabel = getColorLabel(); - int inTrash = getStage(); + int inTrash = getTrashed(); cfs.recentlySaved = false; @@ -460,7 +460,7 @@ void Thumbnail::clearProcParams (int whoClearedIt) setRank(rank); pparamsValid = cfs.rating != rank; setColorLabel(colorlabel); - setStage(inTrash); + setTrashed(inTrash); // params could get validated by rank/inTrash values restored above if (pparamsValid) { @@ -563,7 +563,7 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh // do not update rank, colorlabel and inTrash const int rank = getRank(); const int colorlabel = getColorLabel(); - const int inTrash = getStage(); + const int inTrash = getTrashed(); if (pe) { pe->combine(*pparams, pp, true); @@ -575,7 +575,7 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh setRank(rank); setColorLabel(colorlabel); - setStage(inTrash); + setTrashed(inTrash); if (updateCacheNow) { updateCache(); @@ -1115,15 +1115,15 @@ void Thumbnail::setColorLabel (int colorlabel) } } -int Thumbnail::getStage () const +bool Thumbnail::getTrashed () const { return pparams->inTrash; } -void Thumbnail::setStage (bool stage) +void Thumbnail::setTrashed (bool trashed) { - if (pparams->inTrash != stage) { - pparams->inTrash = stage; + if (pparams->inTrash != trashed) { + pparams->inTrash = trashed; pparamsValid = true; } } diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index 82c4f4738..64014b0e8 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -155,8 +155,8 @@ public: int getColorLabel () const; void setColorLabel (int colorlabel); - int getStage () const; - void setStage (bool stage); + bool getTrashed () const; + void setTrashed (bool trashed); void addThumbnailListener (ThumbnailListener* tnl); void removeThumbnailListener (ThumbnailListener* tnl); From 68fd35d881fd1368e435bb95ccf44fc32fbc7d13 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Tue, 12 Mar 2024 13:55:51 +0100 Subject: [PATCH 04/31] thumbnail: decouple proc params rank/color/trash Add a Properties type that contains values for rank, color and trashed Each value will also contain an edited flag. The properties variable is used to store rank, color and trashed. They are fetched from the proc params and will update the proc params when needed. This is the base for future implementations where some properties (like rank) will be also retrieved from other sources like xmp sidecar files. --- rtgui/thumbnail.cc | 118 ++++++++++++++++++++++++++------------------- rtgui/thumbnail.h | 26 ++++++++++ 2 files changed, 95 insertions(+), 49 deletions(-) diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 0d413e6a4..763735e13 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -133,7 +133,7 @@ Thumbnail::Thumbnail(CacheManager* cm, const Glib::ustring& fname, CacheImageDat generateExifDateTimeStrings (); if (cfs.rankOld >= 0) { - // rank and inTrash were found in cache (old style), move them over to pparams + // rank and inTrash were found in cache (old style), move them over to pparams or xmp sidecar // try to load the last saved parameters from the cache or from the paramfile file createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file @@ -144,6 +144,8 @@ Thumbnail::Thumbnail(CacheManager* cm, const Glib::ustring& fname, CacheImageDat setTrashed(cfs.inTrashOld); } + loadProperties(); + delete tpp; tpp = nullptr; } @@ -173,6 +175,8 @@ Thumbnail::Thumbnail(CacheManager* cm, const Glib::ustring& fname, const std::st initial_ = false; + loadProperties(); + delete tpp; tpp = nullptr; } @@ -306,7 +310,7 @@ const ProcParams& Thumbnail::getProcParamsU () * @param returnParams Ask to return a pointer to a ProcParams object if true * @param force True if the profile has to be re-generated even if it already exists * @param flaggingMode True if the ProcParams will be created because the file browser is being flagging an image - * (rang, to trash, color labels). This parameter is passed to the CPB. + * (rank, to trash, color labels). This parameter is passed to the CPB. * * @return Return a pointer to a ProcPamas structure to be updated if returnParams is true and if everything went fine, NULL otherwise. */ @@ -441,12 +445,6 @@ void Thumbnail::clearProcParams (int whoClearedIt) { MyMutex::MyLock lock(mutex); - // preserve rank, colorlabel and inTrash across clear - int rank = getRank(); - int colorlabel = getColorLabel(); - int inTrash = getTrashed(); - - cfs.recentlySaved = false; pparamsValid = false; @@ -456,13 +454,10 @@ void Thumbnail::clearProcParams (int whoClearedIt) // reset the params to defaults pparams->setDefaults(); - // and restore rank and inTrash - setRank(rank); - pparamsValid = cfs.rating != rank; - setColorLabel(colorlabel); - setTrashed(inTrash); + // preserve rank, colorlabel and inTrash across clear + updateProcParamsProperties(); - // params could get validated by rank/inTrash values restored above + // params could get validated by updateProcParamsProperties if (pparamsValid) { updateCache(); } else { @@ -560,11 +555,6 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh return; } - // do not update rank, colorlabel and inTrash - const int rank = getRank(); - const int colorlabel = getColorLabel(); - const int inTrash = getTrashed(); - if (pe) { pe->combine(*pparams, pp, true); } else { @@ -573,9 +563,8 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh pparamsValid = true; - setRank(rank); - setColorLabel(colorlabel); - setTrashed(inTrash); + // do not update rank, colorlabel and inTrash + updateProcParamsProperties(); if (updateCacheNow) { updateCache(); @@ -1045,7 +1034,6 @@ void Thumbnail::saveThumbnail () */ void Thumbnail::updateCache (bool updatePParams, bool updateCacheImageData) { - if (updatePParams && pparamsValid) { pparams->save ( options.saveParamsFile ? fname + paramFileExtension : "", @@ -1084,48 +1072,34 @@ void Thumbnail::setFileName (const Glib::ustring &fn) cfs.md5 = ::getMD5 (fname); } -int Thumbnail::getRank () const +int Thumbnail::getRank() const { - // prefer the user-set rank over the embedded Rating - // pparams->rank == -1 means that there is no saved rank yet, so we should - // next look for the embedded Rating metadata. - if (pparams->rank != -1) { - return pparams->rank; - } else { - return cfs.rating; - } + return properties.rank; } -void Thumbnail::setRank (int rank) +void Thumbnail::setRank(int rank) { - pparams->rank = rank; - pparamsValid = true; + properties.rank = rank; } -int Thumbnail::getColorLabel () const +int Thumbnail::getColorLabel() const { - return pparams->colorlabel; + return properties.color; } -void Thumbnail::setColorLabel (int colorlabel) +void Thumbnail::setColorLabel(int colorlabel) { - if (pparams->colorlabel != colorlabel) { - pparams->colorlabel = colorlabel; - pparamsValid = true; - } + properties.color = colorlabel; } -bool Thumbnail::getTrashed () const +bool Thumbnail::getTrashed() const { - return pparams->inTrash; + return properties.trashed; } -void Thumbnail::setTrashed (bool trashed) +void Thumbnail::setTrashed(bool trashed) { - if (pparams->inTrash != trashed) { - pparams->inTrash = trashed; - pparamsValid = true; - } + properties.trashed = trashed; } void Thumbnail::addThumbnailListener (ThumbnailListener* tnl) @@ -1239,6 +1213,52 @@ void Thumbnail::getCamWB(double& temp, double& green, rtengine::StandardObserver } } +void Thumbnail::loadProperties() +{ + properties = Properties(); + + // get initial rank from cache or image metadata + if (cfs.exifValid) { + properties.rank.value = rtengine::LIM(cfs.getRating(), 0, 5); + } else { + const std::unique_ptr md(rtengine::FramesMetaData::fromFile(fname)); + if (md && md->hasExif()) { + properties.rank.value = rtengine::LIM(md->getRating(), 0, 5); + } + } + + // update rank and load color, trash from procparams + if (pparamsValid) { + if (pparams->rank >= 0) { + properties.rank.value = pparams->rank; + } + properties.color.value = pparams->colorlabel; + properties.trashed.value = pparams->inTrash; + } +} + +void Thumbnail::updateProcParamsProperties() +{ + if (!properties.edited()) { + return; + } + + if (properties.trashed.edited && properties.trashed != pparams->inTrash) { + pparams->inTrash = properties.trashed; + pparamsValid = true; + } + + if (properties.rank.edited && properties.rank != pparams->rank) { + pparams->rank = properties.rank; + pparamsValid = true; + } + + if (properties.color.edited && properties.color != pparams->colorlabel) { + pparams->colorlabel = properties.color; + pparamsValid = true; + } +} + void Thumbnail::saveMetadata() { if (options.rtSettings.metadata_xmp_sync != rtengine::Settings::MetadataXmpSync::READ_WRITE) { diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index 64014b0e8..e24be18f5 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -78,6 +78,30 @@ class Thumbnail bool initial_; + // Properties holds values and edited states for rank, color and trashed + struct Properties { + template struct Property { + T value; + bool edited; + Property(T v): value(v), edited(false) {} + Property& operator=(T v) + { + value = v; + edited = true; + return *this; + } + operator T() const { return value; } + }; + Property rank; + Property color; + Property trashed; + + explicit Properties(int r=0, int c=0, bool t=false): + rank(r), color(c), trashed(t) {} + bool edited() const { return rank.edited || color.edited || trashed.edited; } + }; + Properties properties; + // vector of listeners std::vector listeners; @@ -90,6 +114,8 @@ class Thumbnail Glib::ustring getCacheFileName (const Glib::ustring& subdir, const Glib::ustring& fext) const; void saveMetadata(); + void loadProperties(); + void updateProcParamsProperties(); public: Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageData* cf); From 1098966a8bbe92e390c4b688eeae23491530832b Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Tue, 12 Mar 2024 18:12:49 +0100 Subject: [PATCH 05/31] Add optional image rank/color load/save from/to xmp sidecar Add optional ability to load/save image rank property from/to xmp sidecar "xmp.Rating" and color property from xmp "xmp.Label" ignoring the ones provided in the processing params file. This behavior is disabled by default and an option under settings -> file browser has been added to enable it. When enabled: * On load: * rank and color are not read from processing params. * rank is mapped from xmp sidecar file rating entry. * color is mapped from xmp sidecar file label entry. * On save: * rank and color are saved to the xmp sidecar * rank and color are also saved to the processing param (pp3) files to keep them in sync Rating mapping: Since rating can be also -1 but rank only goes from 0 to 5, the -1 value is ignored like already done when importing from embedded xmp data. Color mapping: XMP has no color concept, usually programs like digikam uses the label field to write a color name ("Red", "Orange"). The problem is that this isn't standardized and label can be any string. Additionally Rawtherapee has 5 specific colors while other programs can have different colors with different name so they won't be shown if they don't map to the 5 color names supported by rawtherapee. On save only the 5 color supported by rawtherapee wil be saved. Trash is kept only in the profile files for multiple reasons: * There's no trash concept in xmp, there's the rejected concept assigned to a rating == -1. * We could map rejected to trash but in rawtherapee rank and trash are two different values and an image can have both rank >= 0 and trashed set to true. Using an unique value like rating for rank and trash (when -1) will require changing the current rawtherapee logic. * Also digikam only handles ratings from 0 to 5 (no -1) and handles trash in its own internal way without reflecting it in the xmp sidecar. --- rtdata/languages/default | 1 + rtengine/metadata.cc | 13 ----- rtengine/metadata.h | 14 +++++ rtgui/options.cc | 18 +++++++ rtgui/options.h | 6 +++ rtgui/preferences.cc | 7 +++ rtgui/preferences.h | 2 + rtgui/thumbnail.cc | 107 +++++++++++++++++++++++++++++++++++++-- rtgui/thumbnail.h | 1 + 9 files changed, 152 insertions(+), 17 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index a6a8cdc5c..a6897f316 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2033,6 +2033,7 @@ PREFERENCES_THUMBNAIL_INSPECTOR_JPEG;Embedded JPEG preview PREFERENCES_THUMBNAIL_INSPECTOR_MODE;Image to show PREFERENCES_THUMBNAIL_INSPECTOR_RAW;Neutral raw rendering PREFERENCES_THUMBNAIL_INSPECTOR_RAW_IF_NO_JPEG_FULLSIZE;Embedded JPEG if fullsize, neutral raw otherwise +PREFERENCES_THUMBNAIL_RANK_COLOR_MODE;Load/Save thumbnail rank and color from/to XMP sidecars PREFERENCES_TOOLPANEL_AVAILABLETOOLS;Available Tools PREFERENCES_TOOLPANEL_CLONE_FAVORITES;Keep favorite tools in original locations PREFERENCES_TOOLPANEL_CLONE_FAVORITES_TOOLTIP;If set, favorite tools will appear in both the favorites tab and their original tabs.\n\nNote: Enabling this option may result in a slight delay when switching tabs. diff --git a/rtengine/metadata.cc b/rtengine/metadata.cc index 0a55c1424..df8988f5a 100644 --- a/rtengine/metadata.cc +++ b/rtengine/metadata.cc @@ -106,19 +106,6 @@ void clear_metadata_key(Data &data, const Key &key) } } -template -auto to_long(const Iterator &iter, Integer n = Integer{0}) -> decltype( -#if EXIV2_TEST_VERSION(0,28,0) - iter->toInt64() -) { - return iter->toInt64(n); -#else - iter->toLong() -) { - return iter->toLong(n); -#endif -} - } // namespace diff --git a/rtengine/metadata.h b/rtengine/metadata.h index 7424b2720..75d37d46c 100644 --- a/rtengine/metadata.h +++ b/rtengine/metadata.h @@ -97,4 +97,18 @@ private: static std::unique_ptr cache_; }; +template +auto to_long(const Iterator &iter, Integer n = Integer{0}) -> decltype( +#if EXIV2_TEST_VERSION(0,28,0) + iter->toInt64() +) { + return iter->toInt64(n); +#else + iter->toLong() +) { + return iter->toLong(n); +#endif +} + + } // namespace rtengine diff --git a/rtgui/options.cc b/rtgui/options.cc index c8750809b..522bcc26a 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -694,6 +694,7 @@ void Options::setDefaults() lastICCProfCreatorDir = ""; gimpPluginShowInfoDialog = true; maxRecentFolders = 15; + thumbnailRankColorMode = Options::ThumbnailPropertyMode::PROCPARAMS; sortMethod = SORT_BY_NAME; sortDescending = false; rtSettings.lensfunDbDirectory = ""; // set also in main.cc and main-cli.cc @@ -1366,6 +1367,15 @@ void Options::readFromFile(Glib::ustring fname) if (keyFile.has_key("File Browser", "BrowseRecursiveFollowLinks")) { browseRecursiveFollowLinks = keyFile.get_boolean("File Browser", "BrowseRecursiveFollowLinks"); } + + if (keyFile.has_key("File Browser", "ThumbnailRankColorMode")) { + std::string val = keyFile.get_string("File Browser", "ThumbnailRankColorMode"); + if (val == "xmp") { + thumbnailRankColorMode = ThumbnailPropertyMode::XMP; + } else { + thumbnailRankColorMode = ThumbnailPropertyMode::PROCPARAMS; + } + } } if (keyFile.has_group("Clipping Indication")) { @@ -2462,6 +2472,14 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_string_list("File Browser", "RecentFolders", temp); } + switch (thumbnailRankColorMode) { + case ThumbnailPropertyMode::XMP: + keyFile.set_string("File Browser", "ThumbnailRankColorMode", "xmp"); + break; + default: // ThumbnailPropertyMode::PROCPARAMS + keyFile.set_string("File Browser", "ThumbnailRankColorMode", "procparams"); + break; + } keyFile.set_integer("File Browser", "SortMethod", sortMethod); keyFile.set_boolean("File Browser", "SortDescending", sortDescending); keyFile.set_boolean("File Browser", "BrowseRecursive", browseRecursive); diff --git a/rtgui/options.h b/rtgui/options.h index 2b5df3aa6..d65013dac 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -492,6 +492,12 @@ public: size_t maxRecentFolders; // max. number of recent folders stored in options file std::vector recentFolders; // List containing all recent folders + enum class ThumbnailPropertyMode { + PROCPARAMS, // store rank and color in procparams sidecars + XMP // store rank and color xmp sidecar + }; + ThumbnailPropertyMode thumbnailRankColorMode; + enum SortMethod { SORT_BY_NAME, SORT_BY_DATE, diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 527800cb6..eddfc561e 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1470,6 +1470,9 @@ Gtk::Widget* Preferences::getFileBrowserPanel() vbro->pack_start(*sameThumbSize, Gtk::PACK_SHRINK, 0); vbro->pack_start(*ckbInternalThumbIfUntouched, Gtk::PACK_SHRINK, 0); + thumbnailRankColorMode = Gtk::manage(new Gtk::CheckButton(M("PREFERENCES_THUMBNAIL_RANK_COLOR_MODE"))); + vbro->pack_start(*thumbnailRankColorMode, Gtk::PACK_SHRINK, 0); + Gtk::Box* hbrecent = Gtk::manage(new Gtk::Box()); Gtk::Label* labrecent = Gtk::manage (new Gtk::Label (M("PREFERENCES_MAXRECENTFOLDERS") + ":", Gtk::ALIGN_START)); maxRecentFolders = Gtk::manage(new Gtk::SpinButton()); @@ -2029,6 +2032,8 @@ void Preferences::storePreferences() moptions.rtSettings.metadata_xmp_sync = rtengine::Settings::MetadataXmpSync(metadataSyncCombo->get_active_row_number()); moptions.rtSettings.xmp_sidecar_style = rtengine::Settings::XmpSidecarStyle(xmpSidecarCombo->get_active_row_number()); + + moptions.thumbnailRankColorMode = thumbnailRankColorMode->get_active() ? Options::ThumbnailPropertyMode::XMP : Options::ThumbnailPropertyMode::PROCPARAMS; } void Preferences::fillPreferences() @@ -2287,6 +2292,8 @@ void Preferences::fillPreferences() metadataSyncCombo->set_active(int(moptions.rtSettings.metadata_xmp_sync)); xmpSidecarCombo->set_active(int(moptions.rtSettings.xmp_sidecar_style)); + + thumbnailRankColorMode->set_active(moptions.thumbnailRankColorMode == Options::ThumbnailPropertyMode::XMP); } /* diff --git a/rtgui/preferences.h b/rtgui/preferences.h index b34a8348f..191f122f5 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -224,6 +224,8 @@ class Preferences final : Gtk::CheckButton* ckbInternalThumbIfUntouched; + Gtk::CheckButton *thumbnailRankColorMode; + Gtk::Entry* txtCustProfBuilderPath; Gtk::ComboBoxText* custProfBuilderLabelType; diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 763735e13..7ee4d3da1 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -105,6 +105,46 @@ bool CPBDump( return true; } +struct ColorMapper { + std::map indexLabelMap; + std::map labelIndexMap; + + ColorMapper(std::map colors) { + for (const auto& color: colors) { + indexLabelMap.insert({color.first, color.second}); + labelIndexMap.insert({color.second, color.first}); + } + } + + int index(const std::string &label) const + { + auto it = labelIndexMap.find(label); + if (it != labelIndexMap.end()) { + return it->second; + } + return 0; + } + + std::string label(int index) const + { + auto it = indexLabelMap.find(index); + if (it != indexLabelMap.end()) { + return it->second; + } + return ""; + } +}; + +const std::map defaultColors = { + {1, "Red"}, + {2, "Yellow"}, + {3, "Green"}, + {4, "Blue"}, + {5, "Purple"} +}; + +auto defaultColorMapper = ColorMapper(defaultColors); + } // namespace using namespace rtengine::procparams; @@ -1034,6 +1074,8 @@ void Thumbnail::saveThumbnail () */ void Thumbnail::updateCache (bool updatePParams, bool updateCacheImageData) { + updateProcParamsProperties(); + if (updatePParams && pparamsValid) { pparams->save ( options.saveParamsFile ? fname + paramFileExtension : "", @@ -1049,6 +1091,8 @@ void Thumbnail::updateCache (bool updatePParams, bool updateCacheImageData) if (updatePParams && pparamsValid) { saveMetadata(); } + + saveXMPSidecarProperties(); } Thumbnail::~Thumbnail () @@ -1227,13 +1271,37 @@ void Thumbnail::loadProperties() } } - // update rank and load color, trash from procparams + // update rank and color from procparams or xmp sidecar + // load trash from procparams if (pparamsValid) { - if (pparams->rank >= 0) { - properties.rank.value = pparams->rank; + if (options.thumbnailRankColorMode == Options::ThumbnailPropertyMode::PROCPARAMS) { + if (pparams->rank >= 0) { + properties.rank.value = pparams->rank; + } } - properties.color.value = pparams->colorlabel; + properties.trashed.value = pparams->inTrash; + properties.color.value = pparams->colorlabel; + } + + if (options.thumbnailRankColorMode == Options::ThumbnailPropertyMode::XMP) { + try { + auto xmp = rtengine::Exiv2Metadata::getXmpSidecar(fname); + auto pos = xmp.findKey(Exiv2::XmpKey("Xmp.xmp.Rating")); + if (pos != xmp.end()) { + int r = rtengine::to_long(pos); + properties.rank.value = rtengine::LIM(r, 0, 5); + } + + pos = xmp.findKey(Exiv2::XmpKey("Xmp.xmp.Label")); + if (pos != xmp.end()) { + properties.color.value = defaultColorMapper.index(pos->toString()); + } + } catch (std::exception &exc) { + std::cerr << "ERROR loading thumbnail properties data from " + << rtengine::Exiv2Metadata::xmpSidecarPath(fname) + << ": " << exc.what() << std::endl; + } } } @@ -1248,6 +1316,8 @@ void Thumbnail::updateProcParamsProperties() pparamsValid = true; } + // save procparams rank and color also when options.thumbnailRankColorMode == Options::ThumbnailPropertyMode::XMP + // so they'll be kept in sync if (properties.rank.edited && properties.rank != pparams->rank) { pparams->rank = properties.rank; pparamsValid = true; @@ -1259,6 +1329,35 @@ void Thumbnail::updateProcParamsProperties() } } +void Thumbnail::saveXMPSidecarProperties() +{ + if (!properties.edited()) { + return; + } + + if (options.thumbnailRankColorMode != Options::ThumbnailPropertyMode::XMP) { + return; + } + + auto fn = rtengine::Exiv2Metadata::xmpSidecarPath(fname); + try { + auto xmp = rtengine::Exiv2Metadata::getXmpSidecar(fname); + if (properties.rank.edited) { + xmp["Xmp.xmp.Rating"] = std::to_string(properties.rank); + } + if (properties.color.edited) { + xmp["Xmp.xmp.Label"] = defaultColorMapper.label(properties.color); + } + + rtengine::Exiv2Metadata meta; + meta.xmpData() = std::move(xmp); + meta.saveToXmp(fn); + } catch (std::exception &exc) { + std::cerr << "ERROR saving thumbnail properties data to " << fn + << ": " << exc.what() << std::endl; + } +} + void Thumbnail::saveMetadata() { if (options.rtSettings.metadata_xmp_sync != rtengine::Settings::MetadataXmpSync::READ_WRITE) { diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index e24be18f5..c1e52760c 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -116,6 +116,7 @@ class Thumbnail void saveMetadata(); void loadProperties(); void updateProcParamsProperties(); + void saveXMPSidecarProperties(); public: Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageData* cf); From 84134e9aa2a2a7c2acfb08075b3407c38e08e793 Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 12 Apr 2024 07:52:20 +0200 Subject: [PATCH 06/31] Change tweakParams spot.cc - hand-open-hicontrast toolbar.cc (#7029) --- rtgui/spot.cc | 3 +++ rtgui/toolbar.cc | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rtgui/spot.cc b/rtgui/spot.cc index 43fdb632d..ad5fab63e 100644 --- a/rtgui/spot.cc +++ b/rtgui/spot.cc @@ -893,4 +893,7 @@ void Spot::tweakParams(procparams::ProcParams& pparams) pparams.gradient.enabled = false; pparams.pcvignette.enabled = false; pparams.colorappearance.enabled = false; + pparams.locallab.enabled = false; + // pparams.toneCurve.hrenabled = false; // not sure for this one, it could be useful for ExpComp w/o performance penalty + pparams.toneCurve.histmatching = false; } diff --git a/rtgui/toolbar.cc b/rtgui/toolbar.cc index 56237197c..1b59b8b24 100644 --- a/rtgui/toolbar.cc +++ b/rtgui/toolbar.cc @@ -27,8 +27,8 @@ ToolBar::ToolBar () : showColPickers(true), listener (nullptr), pickerListener(n { editingMode = false; - - handimg.reset(new RTImage("hand-open", Gtk::ICON_SIZE_LARGE_TOOLBAR)); + //handimg.reset(new RTImage("hand-open", Gtk::ICON_SIZE_LARGE_TOOLBAR)); + handimg.reset(new RTImage("hand-open-hicontrast", Gtk::ICON_SIZE_LARGE_TOOLBAR)); editinghandimg.reset(new RTImage("crosshair-adjust", Gtk::ICON_SIZE_LARGE_TOOLBAR)); handTool = Gtk::manage (new Gtk::ToggleButton ()); From eaabf66e9c4e65471d2f97f3eb4a89b6eb3271c0 Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:36:08 -0700 Subject: [PATCH 07/31] Register icons folder for Windows installer --- tools/win/InnoSetup/WindowsInnoSetup.iss.in | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/win/InnoSetup/WindowsInnoSetup.iss.in b/tools/win/InnoSetup/WindowsInnoSetup.iss.in index a80925d72..f95657bd7 100644 --- a/tools/win/InnoSetup/WindowsInnoSetup.iss.in +++ b/tools/win/InnoSetup/WindowsInnoSetup.iss.in @@ -102,6 +102,7 @@ Source: "{#MyBuildBasePath}\camconst.json"; DestDir: "{app}"; Flags: ignoreversi Source: "{#MyBuildBasePath}\dcpprofiles\*"; DestDir: "{app}\dcpprofiles\"; Flags: ignoreversion recursesubdirs createallsubdirs ;Source: "{#MyBuildBasePath}\etc\*"; DestDir: "{app}\etc\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#MyBuildBasePath}\iccprofiles\*"; DestDir: "{app}\iccprofiles\"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#MyBuildBasePath}\icons\*"; DestDir: "{app}\icons\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#MyBuildBasePath}\images\*"; DestDir: "{app}\images\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#MyBuildBasePath}\languages\*"; DestDir: "{app}\languages\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#MyBuildBasePath}\licenses\*"; DestDir: "{app}\licenses\"; Flags: ignoreversion recursesubdirs createallsubdirs From 8e312d9c02241031fa091db50546d16d147b17be Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 15 Apr 2024 07:47:19 +0200 Subject: [PATCH 08/31] Local Adjustments - Cam16 - lacam16n2 (new) (#7010) * Restore settings and options * Clean code and windows.yml * Gui improvment * Fixed wrong value maxicam * Change GUI TRC and Log encoding and sigmoid * Clean code locallabtools2 * Fomat locallabtools2 * New calcualtion gray when using Q * Improve sigmoid Q with meanQ * Change labels and tooltip * Change DR with log * Change location GUI TRC * Change GUI sigmoid hide - show * Fixed bug with trc * Added whites to TRC & whites * Small modification whites - comment code * Change GUI and selection for sigmoid and log encoding Q * Change yml worksflow * Added cat to workingtrc rtthumbnail * Delete entries in defualt languages * Blacks and whites distribution * Change tooltips * Fixed some issues * Change GUI hide to set_sensitive * first step white and black log encoding * GUI Labels - tooltips * Compress brightness log encoding * Change compression threshold * Clean procparams * Improve GUI and threshold compression * Improvment GUI and tooltips * First step primaries cam16 * Primaries loc step 2 * Primaries loc step 3 * jdcmax primaries - format iplab2rgb * Improve GUI * Beta RGB primaries and message * Change tooltips * Change order prim * CIExy diagram step 1 * CIExy step 2 * CIExy step 2 * CIExy diagram step 4 * CIExy diagram step 5 * Change improccordinator and locallabtool2s listener * Forgoten delete in improccordinator * Disable setListener * Improve GUI and behavior TRC and Primaries * TRC primaries - illuminant step 1 * TRC primaries - illuminant step 2 * TRC primaries - illuminant step 3 * TRC primaries - illuminant step 4 * Gamut control - remove old listener and added listener locallabcieLC * publish pre dev labels windows appimage * publish pre dev labels windows appimage [] * Move log encoding cie - step 1 * Step 2 * Move Log encoding CIE and improve GUI step 3 * Pre Ciecam midtones step 1 * Mid tones step 2 and tooltips * Forgoten label and tooltips * Improve tooltips - and change yml files * Include repository in appimage and windows.yml - change labels * Forgotten surroundcie in procparams.cc * Improve GUI with expander - clean code * Change tooltip * Clean locallabtools2 - improve Jpro * Bypass Ciecam step 1 * step 2 * Step 3 * Change settings - improve GUI * Clean code * Improve sigmoid cam16 * Improve sigmoid cam16 * Added illuminant E to illmethod * Change iccmatrices * Working profile JDCmax stdA and Abstract Profile * Pre-ciecam JDCmax stdA * Abstract profile - cat method step 1 * Step 3 * Step 4 and various changes * Enable default gamutcontrol - improve GUI * Refine color pre-ciecam * Step 2 * step 3 * Step - 4 * Refine colors Abstract profiles * Expander true Abstract Profile * Clean and comment code * Tooltip pre-ciecam * Change tooltips * Improve GUI free primaries * Labgrid dominant color * Shift dominant color step 1 * Shift xy dominant color * History msg shift * Fixed various bad behavior - change scalrefi * Improve behavior DR vs deltaE - log encoding and pre-ciecam * Limited reduce deltaE to 1 - comment code * Improve behavior TIF/JPG * Forgotten code * Various small changes to refinement color pre-ciecam * Foramt iplab2rgb and simpleprocees - small change meanx meany * Bad behavior with simpleprocess abstract profile and pre-ciecam * Re-enable code for simpleprocess * Iprove iplab2rgb * Improve GUI if selection Jz * provis with precision * Chnage GUI log encoding basic - improve shiftxl shiftyl pre-ciecam * Improve GUI with expanders * Change location pre-ciecam expander * Change label tooltip pre-ciecam * Improve white distribution and equalizer * Bad behavior Source data adjustments * Comment code * Improve Dynamic Range Compression - for some images with very high DR * Clean code * Improve TM fattal with saturation control in LA * saturation control fattal LA * RE-order paramsedit * Change local contrast in LA - log encoding and Cam16 * LA settings avoidcolorshift XYZabsolute * Change GUI precision blackEv WhiteEv BlackEvjz WhiteEvjz * Check button smoothcie - smooth highlights * Change order midtones - log encoding - other method smooth * Change maximum gamma in TRC cam16 * Change maximum slope in TRC cam16 * refine smooth highlights * Small improvment - comment code * Bad behavior - black screen - in Cam16 * setLogscale for slopjcie * Change source data GUI - PQ and other DR functions * PQ mode advanced - adjustments and tooltip * Comment and clean code * Simplified GUI in Basic mode - Source Data Adjustments * Added primaries to source date adjustements - fix basic problem * GUI graduaded filter cie cam16 * Graduated filter - LA Color appearance * More illuminant cam16 - D120 - Tungsten 2000K - Tungsten 1500K * Abstract profile ICM - shift x - shift y * Frame color dominant Abstract profile * Frame color dominant Abstract profile * Illuminant E - abstract profile * Abstact profile - midtones * Abstrcat profile - smooth highlights checkbutton * Abstract Profile - Smooth highligts rtengine * Bad behavior LA gamut - re-enabled Munsell in settings * adapts Abstract profile and auto-match tone curve * Change chromaticity curve c(h) - ppversion 351 and procparams * icmpanel fixed bad wmidtcie * Change in procparams assignfromkeyfile color Management * Remove message in console * Missing code procparams.cc wcat * Clean message in console * Disable ppversion 351 - surround extremely dark * Choice surround scene Disable ciecam * Improve GUI for surround Disable Ciecam * Small change gamutcontrol - message g0..g5 verbose * Remove gautcontrol on limits * Strength log encoding - Source data adjustments * Fixed genral bug in lacam16n - bad behavior color * Checkbutton saturation control - Cam16 log encoding * Change default saturation controle log encoding - false * GUI LA Log encoding - Strength - saturation control - part 1 * Checkbox saturation control LA Log encoding * Change repartition GUI brightnees - hue - chroma * Hide primaries and illuminant in standard mode * Merge with dev 2 * reduces sigmoid Q contrast * Provisory disable Sigmoid Q * Re-enable sigmoid function complexity mode * Re-enable log encoding Q - with Ciecam * GUI improvments - small code improvments * Change tooltip * Simplify GUI mode Basic - Standard - added tooltip * Change tooltip - LA settings - Avoid color shift * hope to fix the bug between Jz and Cam16 * Another change for Jz - format astyle locallabtool2.cc * Clean code GUI - remove Zcam * Change label in Recovery based on luminance mask * Reduces minimum spot size from 2 to 1.5 * Improve behavior GUI with Jzczhz * Clean code iplocallab.cc * Small improvement ciecam02.cc * Fixed bad behvior GUI and code between Cam16 and Jzczhz * Improve Jz and surround effects * Improve Jz and Local contrast Cam16 & Jz taking account surround * Disable local contrast if cam16 and not ciecam surround * Restore epsil 0.001 loccont * Improve local contrast when surround low and Jz * Clean code locallabtool2 - weakened a little Local Contrast in connection with surround * Remove Laplacian threshold in Cam16 and JzCzHz mask * Simplify Mask for JzCzHz * Enable choice complexity mask in mode advanced * Solved bad behavior GUI masks * Optimize GUI mask Jz and cam16 * Change 3 icon .png without png * Remove wrong message in console without problem * Remove warning with & in some tooltips and TP_WBALANCE_AUTO_HEADER * Smoothcie Method GUI * Replace checkbutton smooth highlight bya combobox * Improve behavior GUI - CIECAM - advanced - tempout and greenout * Fixed - I hope - crash when delete spot and cam16 * Clean code with maxcam and dependencies * Added Smooth highlight rolloff or not * Improve smooth lights - gamma mode only - standard and advanced - gray balance * Improve Smoothing lights - take into account the 2 Yb * Change tooltip * Chnage wrong lable scope => slope * Clean and comment code * Reduces the effect of - Smoothing light -Ev mode - Small change range Slope * Scale Yb scene white whiteEv * Hide Scale in some GUI cases * Clean comment code Smotth and TM function * Change GUI - Smooth highlights and tone mapping - allows also Basic * Change labels * Change tooltip * Remove arrow.cur in windows.yml as suggested by Lawrence37 * Reverse last changes * Change limits slope based in SDA * Clean locallabtools2.cc * Set minimum slope based to 0.6 * Change label highlight * Change listener scene parameters to GUI * Clean code sine changes listener * Limits Blackev Whiteev values in slope base to avoid crash * Change a little limits BlackEv WhiteEv * Small changes in console - remove warnings * Change XYZ relative - avoid color shift * Improve gamutmap * re build gamutmap --- .github/workflows/appimage.yml | 2 +- .github/workflows/windows.yml | 2 +- rtdata/languages/default | 157 +- rtengine/ciecam02.cc | 2 +- rtengine/color.cc | 347 ++- rtengine/color.h | 47 +- rtengine/dcrop.cc | 71 +- rtengine/iccmatrices.h | 38 + rtengine/iccstore.cc | 6 +- rtengine/improccoordinator.cc | 266 +- rtengine/improccoordinator.h | 2 + rtengine/improcfun.h | 26 +- rtengine/iplab2rgb.cc | 1226 +++++--- rtengine/iplocallab.cc | 5331 ++++++++++++++++++++------------ rtengine/iptoneequalizer.cc | 35 +- rtengine/procevents.h | 3 +- rtengine/procparams.cc | 474 ++- rtengine/procparams.h | 102 +- rtengine/rawimagesource.cc | 2 +- rtengine/refreshmap.cc | 2 +- rtengine/rtengine.h | 38 +- rtengine/rtthumbnail.cc | 47 +- rtengine/settings.h | 2 +- rtengine/simpleprocess.cc | 297 +- rtgui/colorappearance.cc | 9 +- rtgui/colortoning.cc | 10 +- rtgui/controlspotpanel.cc | 9 +- rtgui/iccprofilecreator.cc | 23 +- rtgui/icmpanel.cc | 330 +- rtgui/icmpanel.h | 33 +- rtgui/labgrid.cc | 71 +- rtgui/labgrid.h | 27 +- rtgui/locallab.cc | 65 +- rtgui/locallab.h | 17 +- rtgui/locallabtools.cc | 33 +- rtgui/locallabtools.h | 209 +- rtgui/locallabtools2.cc | 3314 +++++++++++++++----- rtgui/options.cc | 6 + rtgui/paramsedited.cc | 579 +++- rtgui/paramsedited.h | 89 +- rtgui/wavelet.cc | 6 +- 41 files changed, 9618 insertions(+), 3737 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index cf82dafb8..fd2652345 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '[]' + publish_pre_dev_labels: '["Beep6581:lacam16n2"]' jobs: build: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6963df7c9..2f752f978 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '[]' + publish_pre_dev_labels: '["Beep6581:lacam16n2"]' jobs: build: diff --git a/rtdata/languages/default b/rtdata/languages/default index a6a8cdc5c..88e2f68f2 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1311,7 +1311,7 @@ HISTORY_MSG_1078;Local - Red and skin protection HISTORY_MSG_1079;Local - CIECAM Sigmoid strength J HISTORY_MSG_1080;Local - CIECAM Sigmoid threshold HISTORY_MSG_1081;Local - CIECAM Sigmoid blend -HISTORY_MSG_1082;Local - CIECAM Sigmoid Q BlackEv WhiteEv +HISTORY_MSG_1082;Local - CIECAM Auto threshold HISTORY_MSG_1083;Local - CIECAM Hue HISTORY_MSG_1084;Local - Uses Black Ev - White Ev HISTORY_MSG_1085;Local - Jz lightness @@ -1427,22 +1427,79 @@ HISTORY_MSG_ICL_LABGRIDCIEXY;Cie xy HISTORY_MSG_ICM_AINTENT;Abstract profile intent HISTORY_MSG_ICM_BLUX;Primaries Blue X HISTORY_MSG_ICM_BLUY;Primaries Blue Y +HISTORY_MSG_ICM_CAT;Matrix adaptation HISTORY_MSG_ICM_FBW;Black and White HISTORY_MSG_ICM_GAMUT;Gamut control HISTORY_MSG_ICM_GREX;Primaries Green X HISTORY_MSG_ICM_GREY;Primaries Green Y +HISTORY_MSG_ICM_MIDTCIE;Midtones HISTORY_MSG_ICM_OUTPUT_PRIMARIES;Output - Primaries HISTORY_MSG_ICM_OUTPUT_TEMP;Output - ICC-v4 illuminant D HISTORY_MSG_ICM_OUTPUT_TYPE;Output - Type HISTORY_MSG_ICM_PRESER;Preserve neutral HISTORY_MSG_ICM_REDX;Primaries Red X HISTORY_MSG_ICM_REDY;Primaries Red Y +HISTORY_MSG_ICM_REFI;Refinement Colors +HISTORY_MSG_ICM_SHIFTX;Refinement Colors - shift x +HISTORY_MSG_ICM_SHIFTY;Refinement Colors - shift y +HISTORY_MSG_ICM_SMOOTHCIE;Smooth highlights +HISTORY_MSG_ICM_TRCEXP;Abstract Profile HISTORY_MSG_ICM_WORKING_GAMMA;TRC - Gamma HISTORY_MSG_ICM_WORKING_ILLUM_METHOD;Illuminant method HISTORY_MSG_ICM_WORKING_PRIM_METHOD;Primaries method HISTORY_MSG_ICM_WORKING_SLOPE;TRC - Slope HISTORY_MSG_ICM_WORKING_TRC_METHOD;TRC method HISTORY_MSG_ILLUM;CAL - SC - Illuminant +HISTORY_MSG_LOCAL_CIE_ANGGRAD;Local CIECAM - gradient angle +HISTORY_MSG_LOCAL_CIE_BRICOMP;Local CIECAM Brightness compression +HISTORY_MSG_LOCAL_CIE_BRICOMPTH;Local CIECAM Brightness compression threshold +HISTORY_MSG_LOCAL_CIE_CAT;Matrix adaptation +HISTORY_MSG_LOCAL_CIE_DETAILJZ;Local JzCzHz Local contrast +HISTORY_MSG_LOCAL_CIE_ENAMASKALL;Local CIECAM All mask tools +HISTORY_MSG_LOCAL_CIE_EXPPRECAM;Local CIECAM Pre-Cam +HISTORY_MSG_LOCAL_CIE_GAM;Local CIECAM Gamma +HISTORY_MSG_LOCAL_CIE_GAMUTCIE;Local CIECAM Gamut +HISTORY_MSG_LOCAL_CIE_ILL;Local CIECAM TRC Illuminant +HISTORY_MSG_LOCAL_CIE_LOGCIEQ;Local CIECAM Log encoding Q +HISTORY_MSG_LOCAL_CIE_MIDT;Local CIECAM Mid Tones +HISTORY_MSG_LOCAL_CIE_NORM;Local CIECAM Normalize L +HISTORY_MSG_LOCAL_CIE_PRIM;Local CIECAM TRC Primaries +HISTORY_MSG_LOCAL_CIE_REFI;Local CIECAM Refinement Colors +HISTORY_MSG_LOCAL_CIE_SIG;Sigmoid +HISTORY_MSG_LOCAL_CIE_SIGADAP;Local CIECAM Sigmoid adaptability +HISTORY_MSG_LOCAL_CIE_SIGMET;Local CIECAM - Sigmoid method +HISTORY_MSG_LOCAL_CIE_SLOP;Local CIECAM - Slope +HISTORY_MSG_LOCAL_CIE_SLOPESMO;Local CIECAM - Gray balance +HISTORY_MSG_LOCAL_CIE_SMOOTHMET;Local CIECAM - Smooth lights method +HISTORY_MSG_LOCAL_CIE_STRGRAD;Local CIECAM - gradient strength L +HISTORY_MSG_LOCAL_CIE_TRC;Local CIECAM - TRC +HISTORY_MSG_LOCAL_CIE_REDXL;Local CIECAM - Red X +HISTORY_MSG_LOCAL_CIE_REDYL;Local CIECAM - Red Y +HISTORY_MSG_LOCAL_CIE_GREXL;Local CIECAM - Green X +HISTORY_MSG_LOCAL_CIE_GREYL;Local CIECAM - Green Y +HISTORY_MSG_LOCAL_CIE_BLACKS;Local CIECAM - Blacks distribution +HISTORY_MSG_LOCAL_CIE_BLUXL;Local CIECAM - Blue X +HISTORY_MSG_LOCAL_CIE_BLUYL;Local CIECAM - Blue Y +HISTORY_MSG_LOCAL_CIE_SHIFTXL;Local CIECAM - Shift x +HISTORY_MSG_LOCAL_CIE_SHIFTYL;Local CIECAM - Shift y +HISTORY_MSG_LOCAL_CIE_SMOOTH;Local CIECAM - Scale Yb Scene +HISTORY_MSG_LOCAL_CIE_SATCIE;Local CIECAM - Saturation control +HISTORY_MSG_LOCAL_CIE_STRLOG;Local CIECAM - Log encoding strength +HISTORY_MSG_LOCAL_CIE_WHITES;Local CIECAM - Whites distribution +HISTORY_MSG_LOCAL_CIEMASK_BLURCONT;Local Cie mask blur contrast +HISTORY_MSG_LOCAL_CIEMASK_BLURFFT;Local Cie mask blur fftw +HISTORY_MSG_LOCAL_CIEMASK_BLURRAD;Local Cie mask blur radius +HISTORY_MSG_LOCAL_CIEMASK_CHH;Local Cie mask curve hh +HISTORY_MSG_LOCAL_CIEMASK_HIGH;Local Cie mask highlights +HISTORY_MSG_LOCAL_CIEMASK_SHAD;Local Cie mask shadows +HISTORY_MSG_LOCAL_CIEMASK_STRU;Local Cie mask structure +HISTORY_MSG_LOCAL_CIEMASK_STRU_TOOL;Local Cie mask structure as tool +HISTORY_MSG_LOCAL_CIEMASK_WLC;Local CIECAM mask wavelet Lc +HISTORY_MSG_LOCAL_CIEMASK_WLEV;Local CIECAM mask wavelet levels +HISTORY_MSG_LOCAL_LOG_BLACKS;Local Log - Blacks distribution +HISTORY_MSG_LOCAL_LOG_COMPR;Local Log - Compress brightness +HISTORY_MSG_LOCAL_LOG_SAT;Local Log - Saturation control +HISTORY_MSG_LOCAL_LOG_WHITES;Local Log - Whites distribution HISTORY_MSG_LOCALCONTRAST_AMOUNT;Local Contrast - Amount HISTORY_MSG_LOCALCONTRAST_DARKNESS;Local Contrast - Darkness HISTORY_MSG_LOCALCONTRAST_ENABLED;Local Contrast @@ -2175,6 +2232,7 @@ TC_PRIM_GREX;Gx TC_PRIM_GREY;Gy TC_PRIM_REDX;Rx TC_PRIM_REDY;Ry +TC_PRIM_REFI;Refine colors (white-point) THRESHOLDSELECTOR_B;Bottom THRESHOLDSELECTOR_BL;Bottom-left THRESHOLDSELECTOR_BR;Bottom-right @@ -2662,9 +2720,16 @@ TP_ICM_SAVEREFERENCE_TOOLTIP;Save the linear TIFF image before the input profile TP_ICM_TONECURVE;Tone curve TP_ICM_TONECURVE_TOOLTIP;Employ the embedded DCP tone curve. The setting is only available if the selected DCP has a tone curve. TP_ICM_TRCFRAME;Abstract Profile -TP_ICM_TRCFRAME_TOOLTIP;Also known as 'synthetic' or 'virtual' profiles, which are applied at the end of the processing pipeline (prior to ciecam) allowing you to create custom image effects.\nYou can make changes to the:\n 'Tone response curve', which modifies the tones of the image.\n 'Illuminant' : which allows you to change the profile primaries to adapt them to the shooting conditions.\n 'Destination primaries': which allows you to change the destination primaries with two main uses - channel mixer and calibration.\nNote: Abstract profiles take into account the built-in Working profiles without modifying them. They do not work with custom Working profiles. +TP_ICM_TRCFRAME_TOOLTIP;Also known as 'synthetic' or 'virtual' profiles, which are applied at the end of the processing pipeline (prior to ciecam) allowing you to create custom image effects.\nYou can make changes to the:\n 'Tone response curve', which modifies the tones of the image.\n 'Illuminant' : which allows you to change the profile primaries to adapt them to the shooting conditions.\n 'Destination primaries': which allows you to change the destination primaries with three main uses - channel mixer, restore image color (saturation), calibration.\nNote: Abstract profiles take into account the built-in Working profiles without modifying them. They do not work with custom Working profiles. TP_ICM_TRC_TOOLTIP;Allows you to change the default sRGB 'Tone response curve' in RT (g=2.4 s=12.92).\nThis TRC modifies the tones of the image. The RGB and Lab values, histogram and output (screen, TIF, JPG) are changed:\n-Gamma acts mainly on light tones -Slope acts mainly on dark tones.\nYou can choose any pair of 'gamma and slope' (values >1) and the algorithm will ensure that there is continuity between the linear and parabolic parts of the curve.\nA selection other than 'none' activates the 'Illuminant' and 'Destination primaries' menus. TP_ICM_WORKINGPROFILE;Working Profile +TP_ICM_WORKING_CAT;Matrix adaptation +TP_ICM_WORKING_CAT_BRAD;Bradford +TP_ICM_WORKING_CAT_CAT16;Cat16 +TP_ICM_WORKING_CAT_CAT02;Cat02 +TP_ICM_WORKING_CAT_TOOLTIP;Performs the chromatic adaptation of the XYZ conversion matrix. Default Bradford +TP_ICM_WORKING_CAT_VK;Von Kries +TP_ICM_WORKING_CAT_XYZ;XYZ scale TP_ICM_WORKING_CIEDIAG;CIE xy diagram TP_ICM_WORKING_ILLU;Illuminant TP_ICM_WORKING_ILLU_1500;Tungsten 1500K @@ -2676,10 +2741,13 @@ TP_ICM_WORKING_ILLU_D60;D60 TP_ICM_WORKING_ILLU_D65;D65 TP_ICM_WORKING_ILLU_D80;D80 TP_ICM_WORKING_ILLU_D120;D120 +TP_ICM_WORKING_ILLU_E;E TP_ICM_WORKING_ILLU_NONE;Default TP_ICM_WORKING_ILLU_STDA;stdA 2875K +TP_ICM_WORKING_NON;None TP_ICM_WORKING_PRESER;Preserves Pastel tones TP_ICM_WORKING_PRIM;Destination primaries +TP_ICM_WORKING_PRIM_TOOLTIP;Destination primaries (Advanced): which allows you to change the destination primaries to restore or change image color (saturation), the color balance is significantly preserved when the 'Working Profile' and the 'Destination primaries' are not too different, 'Working Profiles' are not modified. Perform a gamut control.\nWhen 'Custom LA (sliders)' is selected you can modify the values of the 3 primaries Red, Green, Blue for X and Y. TP_ICM_WORKING_PRIMFRAME_TOOLTIP;When 'Custom CIE xy diagram' is selected in 'Destination- primaries'' combobox, you can modify the values of the 3 primaries directly on the graph.\nNote that in this case, the white point position on the graph will not be updated. TP_ICM_WORKING_PRIM_AC0;ACESp0 TP_ICM_WORKING_PRIM_ACE;ACESp1 @@ -2689,7 +2757,9 @@ TP_ICM_WORKING_PRIM_BRU;BruceRGB TP_ICM_WORKING_PRIM_BST;BestRGB TP_ICM_WORKING_PRIM_CUS;Custom (sliders) TP_ICM_WORKING_PRIM_CUSGR;Custom (CIE xy Diagram) +TP_ICM_WORKING_PRIM_FREE;Custom LA (sliders) TP_ICM_WORKING_PRIM_JDCMAX;JDC Max +TP_ICM_WORKING_PRIM_JDCMAXSTDA;JDC Max stdA TP_ICM_WORKING_PRIM_NONE;Default TP_ICM_WORKING_PRIM_PROP;ProPhoto TP_ICM_WORKING_PRIM_REC;Rec2020 @@ -2770,9 +2840,9 @@ TP_LOCALLAB_AMOUNT;Amount TP_LOCALLAB_ARTIF;Shape detection TP_LOCALLAB_ARTIF_TOOLTIP;ΔE scope threshold increases the range of ΔE scope. High values are for very wide gamut images.\nIncreasing ΔE decay can improve shape detection, but can also reduce the scope. TP_LOCALLAB_AUTOGRAY;Auto mean luminance (Yb%) -TP_LOCALLAB_AUTOGRAYCIE;Auto +TP_LOCALLAB_AUTOGRAYCIE;Automatic TP_LOCALLAB_AVOID;Avoid color shift -TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space and apply Munsell correction (Uniform Perceptual Lab).\nMunsell correction always disabled when Jz or CAM16 or Color Appearance and Lighting is used.\n\nDefault: Munsell.\nMunsell correction: fixes Lab mode hue drifts due to non-linearity, when chromaticity is changed (Uniform Perceptual Lab).\nLab: applies a gamut control, in relative colorimetric, Munsell is then applied.\nXYZ Absolute, applies gamut control, in absolute colorimetric, Munsell is then applied.\nXYZ Relative, applies gamut control, in relative colorimetric, Munsell is then applied. +TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space and apply Munsell correction (Uniform Perceptual Lab).\n\nDefault: Munsell only.\nMunsell only, fixes Lab mode hue drifts due to non-linearity, when chromaticity is changed (Uniform Perceptual Lab).\nLab, applies a gamut control, in relative colorimetric, Munsell is then applied.\nXYZ Absolute, applies gamut control, in absolute colorimetric, Munsell is then applied.\nXYZ Relative, applies gamut control, in relative colorimetric, Munsell is then applied. TP_LOCALLAB_AVOIDMUN;Munsell correction only TP_LOCALLAB_AVOIDMUN_TOOLTIP;Munsell correction always disabled when Jz or CAM16 is used. TP_LOCALLAB_AVOIDRAD;Soft radius @@ -2815,9 +2885,12 @@ TP_LOCALLAB_BUTTON_DEL;Delete TP_LOCALLAB_BUTTON_DUPL;Duplicate TP_LOCALLAB_BUTTON_REN;Rename TP_LOCALLAB_BUTTON_VIS;Show/Hide +TP_LOCALLAB_BWEVNONE;None +TP_LOCALLAB_BWEVSIG;Activated +TP_LOCALLAB_BWEVSIGLOG;Sigmoid & Log-Encoding TP_LOCALLAB_BWFORCE;Uses Black Ev & White Ev TP_LOCALLAB_CAM16PQREMAP;HDR PQ (Peak Luminance) -TP_LOCALLAB_CAM16PQREMAP_TOOLTIP;PQ (Perceptual Quantizer) adapted to CAM16. Allows you to change the internal PQ function (usually 10000 cd/m2 - default 100 cd/m2 - disabled for 100 cd/m2).\nCan be used to adapt to different devices and images. +TP_LOCALLAB_CAM16PQREMAP_TOOLTIP;PQ (Perceptual Quantizer) adapted to CAM16 (experimental). Allows you to change the internal PQ function (usually 10000 cd/m2 - default 100 cd/m2 - disabled for 100 cd/m2).\nCan be used to adapt to different devices and images. For example to match Cam16 processing with the maximum monitor brightness of 400cd/m2. TP_LOCALLAB_CAM16_FRA;Cam16 Image Adjustments TP_LOCALLAB_CAMMODE;CAM model TP_LOCALLAB_CAMMODE_CAM16;CAM 16 @@ -2844,6 +2917,11 @@ TP_LOCALLAB_CHROMASK_TOOLTIP;Changes the chroma of the mask if one exists (i.e. TP_LOCALLAB_CHROML;Chroma (C) TP_LOCALLAB_CHRRT;Chroma TP_LOCALLAB_CIE;Color appearance (Cam16 & JzCzHz) +TP_LOCALLAB_CIE_SMOOTH_NONE;None +TP_LOCALLAB_CIE_SMOOTH_EV;Ev based +TP_LOCALLAB_CIE_SMOOTHFRAME;Highlight attenuation +TP_LOCALLAB_CIE_SMOOTH_GAMMA;Slope based +TP_LOCALLAB_CIE_SMOOTH_GAMMA ROLLOFF;Gamma based TP_LOCALLAB_CIEC;Use Ciecam environment parameters TP_LOCALLAB_CIECAMLOG_TOOLTIP;This module is based on the CIECAM color appearance model which was designed to better simulate how human vision perceives colors under different lighting conditions.\nThe first Ciecam process 'Scene conditions' is carried out by Log encoding, it also uses 'Absolute luminance' at the time of shooting.\nThe second Ciecam process 'Image adjustments' is simplified and uses only 3 variables (local contrast, contrast J, saturation s).\nThe third Ciecam process 'Viewing conditions' adapts the output to the intended viewing conditions (monitor, TV, projector, printer, etc.) so that the chromatic and contrast appearance is preserved across the display environment. TP_LOCALLAB_CIECOLORFRA;Color @@ -2878,10 +2956,14 @@ TP_LOCALLAB_COLORSCOPE;Scope (color tools) TP_LOCALLAB_COLORSCOPE_TOOLTIP;Common Scope slider for Color and Light, Shadows/Highlights, Vibrance.\nOther tools have their own scope controls. TP_LOCALLAB_COLOR_CIE;Color curve TP_LOCALLAB_COLOR_TOOLNAME;Color & Light +TP_LOCALLAB_COLORFRAME;Dominant color TP_LOCALLAB_COL_NAME;Name TP_LOCALLAB_COL_VIS;Status TP_LOCALLAB_COMPFRA;Directional contrast TP_LOCALLAB_COMPREFRA;Wavelet level tone mapping +TP_LOCALLAB_COMPRCIE;Brightness compression +TP_LOCALLAB_COMPRCIETH;Compression threshold +TP_LOCALLAB_COMPRLOG_TOOLTIP;This algorithm compress the data before log conversion, above the theshold slider value. To use in conjunction with Whites distribution. TP_LOCALLAB_CONTCOL;Contrast threshold TP_LOCALLAB_CONTFRA;Contrast by level TP_LOCALLAB_CONTRAST;Contrast @@ -2912,7 +2994,7 @@ TP_LOCALLAB_DELTAD;Delta balance TP_LOCALLAB_DELTAEC;ΔE Image mask TP_LOCALLAB_DENOI1_EXP;Denoise based on luminance mask TP_LOCALLAB_DENOI2_EXP;Recovery based on luminance mask -TP_LOCALLAB_DENOIBILAT_TOOLTIP;Allows you to reduce impulse or 'salt & pepper' noise. +TP_LOCALLAB_DENOIBILAT_TOOLTIP;Allows you to reduce impulse or 'salt & pepper' noise. TP_LOCALLAB_DENOICHROC_TOOLTIP;Allows you to deal with blotches and packets of noise. TP_LOCALLAB_DENOICHRODET_TOOLTIP;Allows you to recover chrominance detail by progressively applying a Fourier transform (DCT). TP_LOCALLAB_DENOICHROF_TOOLTIP;Allows you to adjust fine-detail chrominance noise. @@ -2932,6 +3014,7 @@ TP_LOCALLAB_DETAIL;Local contrast TP_LOCALLAB_DETAILFRA;Edge detection - DCT TP_LOCALLAB_DETAILSH;Details TP_LOCALLAB_DETAILTHR;Lum/chrom detail threshold +TP_LOCALLAB_DISAB_CIECAM;Disable Ciecam or Weak Jz surround TP_LOCALLAB_DIVGR;Gamma TP_LOCALLAB_DUPLSPOTNAME;Copy TP_LOCALLAB_EDGFRA;Edge sharpness @@ -2939,6 +3022,7 @@ TP_LOCALLAB_EDGSHOW;Show all tools TP_LOCALLAB_ELI;Ellipse TP_LOCALLAB_ENABLE_AFTER_MASK;Use Tone Mapping TP_LOCALLAB_ENABLE_MASK;Enable mask +TP_LOCALLAB_ENABLE_MASKALL;Enable all mask tools TP_LOCALLAB_ENABLE_MASKAFT;Use all algorithms Exposure TP_LOCALLAB_ENARETIMASKTMAP_TOOLTIP;If enabled the Mask uses Restored Data after Transmission Map instead of Original data. TP_LOCALLAB_ENH;Enhanced @@ -2970,7 +3054,7 @@ TP_LOCALLAB_EXPCONTRASTPYR_TOOLTIP;See the documentation for Wavelet Levels.\nTh TP_LOCALLAB_EXPCONTRAST_TOOLTIP;Avoid spots that are too small ( < 32x32 pixels).\nUse low 'Transition value' and high 'Transition decay' and 'Scope' to simulate small spots and deal with defects.\nUse 'Clarity and Sharp mask and Blend and Soften Images' if necessary by adjusting 'Soft radius' to reduce artifacts. TP_LOCALLAB_EXPCURV;Curves TP_LOCALLAB_EXPGRAD;Graduated Filter -TP_LOCALLAB_EXPGRADCOL_TOOLTIP;A graduated filter is available in Color and Light (luminance, chrominance & hue gradients, and 'Merge file'), Exposure (luminance grad.), Exposure Mask (luminance grad.), Shadows/Highlights (luminance grad.), Vibrance (luminance, chrominance & hue gradients), Local contrast & wavelet pyramid (local contrast grad.).\nFeather is located in Settings. +TP_LOCALLAB_EXPGRADCOL_TOOLTIP;A graduated filter is available in Color and Light (luminance, chrominance & hue gradients, and 'Merge file'), Exposure (luminance grad.), Exposure Mask (luminance grad.), Shadows/Highlights (luminance grad.), Vibrance (luminance, chrominance & hue gradients), Local contrast & wavelet pyramid (local contrast grad.).\nFeather is located in Settings. TP_LOCALLAB_EXPLAPBAL_TOOLTIP;Changes the transformed/original image blend. TP_LOCALLAB_EXPLAPGAMM_TOOLTIP;Changes the behaviour for images with too much or too little contrast by adding a gamma curve before and after the Laplace transform. TP_LOCALLAB_EXPLAPLIN_TOOLTIP;Changes the behaviour for underexposed images by adding a linear component prior to applying the Laplace transform. @@ -3134,8 +3218,11 @@ TP_LOCALLAB_LOGAUTOGRAY_TOOLTIP;Automatically calculates the 'Mean luminance' fo TP_LOCALLAB_LOGAUTO_TOOLTIP;Pressing this button will calculate the dynamic range and 'Mean luminance' for the scene conditions if the 'Auto mean luminance (Yb%)' is checked).\nAlso calculates the absolute luminance at the time of shooting.\nPress the button again to adjust the automatically calculated values. TP_LOCALLAB_LOGBASE_TOOLTIP;Default = 2.\nValues less than 2 reduce the action of the algorithm making the shadows darker and the highlights brighter.\nWith values greater than 2, the shadows are grayer and the highlights become more washed out. TP_LOCALLAB_LOGCATAD_TOOLTIP;Chromatic adaptation allows us to interpret a color according to its spatio-temporal environment.\nUseful when the white balance deviates significantly from the D50 reference.\nAdapts colors to the illuminant of the output device. -TP_LOCALLAB_LOGCIE;Log encoding instead of Sigmoid -TP_LOCALLAB_LOGCIE_TOOLTIP;Allows you tu use Black Ev, White Ev, Scene Mean luminance(Yb%) and Viewing Mean luminance(Yb%) for tone-mapping using Log encoding Q. +TP_LOCALLAB_LOGCIE;Log encoding +TP_LOCALLAB_LOGCIE_TOOLTIP;Allows you tu use Black Ev, White Ev, White and Black distribution, Scene Mean luminance(Yb%) and Viewing Mean luminance(Yb%) for tone-mapping using 'Log encoding' with Brightness compression. +TP_LOCALLAB_LOGCIEQ;Log Encoding Q (with Ciecam) +TP_LOCALLAB_LOGCIEQ_TOOLTIP;Activating the checkbox allows you to switch between log encoding based on the 3 RGB channels, and log encoding based solely on Ciecam’s brightness (Q) channel.\nUsing the Q channel instead of the RGB channels helps avoid undesirable edge effects such as hue and saturation shifts.\nHowever, the settings are more difficult to optimise because Q is unbounded and Ciecam alters the data to take into account the surround conditions, simultaneous contrast etc.:\nThe user may have to adjust the following:\n Scene conditions: Mean luminance (Yb), Whites & Blacks distribution, Black Ev, White Ev.\n Source Data Adjustments : Brightness compression, Strength.\n\nNote: when using Log Encoding (Q), be careful not to activate the Disable Ciecam option in the Scene Conditions, Surround menu. + TP_LOCALLAB_LOGCOLORFL;Colorfulness (M) TP_LOCALLAB_LOGCOLORF_TOOLTIP;Perceived amount of hue in relation to gray.\nIndicator that a stimulus appears more or less colored. TP_LOCALLAB_LOGCONQL;Contrast (Q) @@ -3143,7 +3230,7 @@ TP_LOCALLAB_LOGCONTHRES;Contrast threshold (J & Q) TP_LOCALLAB_LOGCONTL;Contrast (J) TP_LOCALLAB_LOGCONTL_TOOLTIP;Contrast (J) in CIECAM16 takes into account the increase in perceived coloration with luminance. TP_LOCALLAB_LOGCONTQ_TOOLTIP;Contrast (Q) in CIECAM16 takes into account the increase in perceived coloration with brightness. -TP_LOCALLAB_LOGCONTTHRES_TOOLTIP;Adjusts the mid-tone contrast range (J & Q).\nPositive values progressively reduce the effect of the Contrast sliders (J & Q). Negative values progressively increase the effect of the Contrast sliders. +TP_LOCALLAB_LOGCONTTHRES_TOOLTIP;Adjusts the mid-tone contrast range (J & Q).\nPositive values progressively reduce the effect of the Contrast sliders (J & Q). Negative values progressively increase the effect of the Contrast sliders. TP_LOCALLAB_LOGDETAIL_TOOLTIP;Acts mainly on high frequencies. TP_LOCALLAB_LOGENCOD_TOOLTIP;Tone Mapping with Logarithmic encoding (ACES).\nUseful for underexposed images or images with high dynamic range.\n\nTwo-step process: 1) Dynamic Range calculation 2) Manual adjustment. TP_LOCALLAB_LOGEXP;All tools @@ -3156,6 +3243,7 @@ TP_LOCALLAB_LOGLIGHTQ;Brightness (Q) TP_LOCALLAB_LOGLIGHTQ_TOOLTIP;Perceived amount of light emanating from a stimulus.\nIndicator that a stimulus appears to be more or less bright, clear. TP_LOCALLAB_LOGLIN;Logarithm mode TP_LOCALLAB_LOGPFRA;Relative Exposure Levels +TP_LOCALLAB_LOGPFRA2;Log Encoding settings TP_LOCALLAB_LOGREPART;Overall strength TP_LOCALLAB_LOGREPART_TOOLTIP;Allows you to adjust the relative strength of the log-encoded image with respect to the original image.\nDoes not affect the Ciecam component. TP_LOCALLAB_LOGSATURL_TOOLTIP;Saturation (s) in CIECAM16 corresponds to the color of a stimulus in relation to its own brightness.\nActs mainly on medium tones and on the highlights. @@ -3225,7 +3313,7 @@ TP_LOCALLAB_MASKRESRETI_TOOLTIP;Used to modulate the effect of the Retinex (Lumi TP_LOCALLAB_MASKRESTM_TOOLTIP;Used to modulate the effect of the Tone Mapping settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The 'dark' and 'light' areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the Tone Mapping settings \n In between these two areas, the full value of the Tone Mapping settings will be applied. TP_LOCALLAB_MASKRESVIB_TOOLTIP;Used to modulate the effect of the Vibrance and Warm Cool settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The 'dark' and 'light' areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the Vibrance and Warm Cool settings \n In between these two areas, the full value of the Vibrance and Warm Cool settings will be applied. TP_LOCALLAB_MASKRESWAV_TOOLTIP;Used to modulate the effect of the Local contrast and Wavelet settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The 'dark' and 'light' areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the Local contrast and Wavelet settings \n In between these two areas, the full value of the Local contrast and Wavelet settings will be applied. -TP_LOCALLAB_MASKUNUSABLE;Mask disabled (Mask & modifications) +TP_LOCALLAB_MASKUNUSABLE;Mask disabled (Enable in Mask & modifications) TP_LOCALLAB_MASKUSABLE;Mask enabled (Mask & modifications) TP_LOCALLAB_MASK_TOOLTIP;You can enable multiple masks for a tool by activating another tool and using only the mask (set the tool sliders to 0 ).\n\nYou can also duplicate the spot and place it close to the first spot. The small variations in the spot references allow you to make fine adjustments. TP_LOCALLAB_MEDIAN;Median Low @@ -3261,6 +3349,7 @@ TP_LOCALLAB_MERTHR;Difference TP_LOCALLAB_MERTWE;Exclusion TP_LOCALLAB_MERTWO;Subtract TP_LOCALLAB_METHOD_TOOLTIP;'Enhanced + chroma denoise' significantly increases processing times.\nBut reduce artifacts. +TP_LOCALLAB_MIDTCIE;Midtones TP_LOCALLAB_MLABEL;Restored data Min=%1 Max=%2 TP_LOCALLAB_MLABEL_TOOLTIP;The values should be close to Min=0 Max=32768 (log mode) but other values are possible.You can adjust 'Clip restored data (gain)' and 'Offset' to normalize.\nRecovers image data without blending. TP_LOCALLAB_MODE_EXPERT;Advanced @@ -3307,11 +3396,19 @@ TP_LOCALLAB_ORRETILAP_TOOLTIP;Modifies ΔE prior to any changes made by 'Scope'. TP_LOCALLAB_ORRETISTREN_TOOLTIP;Acts on the Laplacian threshold, the greater the action, the more the differences in contrast will be reduced. TP_LOCALLAB_PASTELS2;Vibrance TP_LOCALLAB_PDE;Contrast Attenuator - Dynamic Range compression +TP_LOCALLAB_PRECAM_TOOLTIP;This 'Source Data Adjustments' modifies: a)the Dynamic Range using Log encoding; b) the tones of the image and primaries(simplified Abstract Profile) and also midtones, just before the Ciecam process. The values are changed:\n-Gamma acts mainly on light tones -Slope acts mainly on dark tones.\nYou can choose any pair of 'gamma and slope' (values >1) and the algorithm will ensure that there is continuity between the linear and parabolic parts of the curve.\n\n\n-Destination primaries: which allows you to change the destination primaries to restore or change image color (saturation), the color balance is 'significantly' preserved when the 'Working Profile' and the 'Destination primaries' are not too different (be careful), 'Working Profiles' are not modified.\nYou can also finely adapt the primaries and the illuminant (white-point).\nMoving a primary away from the white point reduces saturation and vice versa. Pay attention to the gamut. +TP_LOCALLAB_PRECAMGAMUT_TOOLTIP;If checked ensures a gamut control just after primary conversion to XYZ matrix. +TP_LOCALLAB_PRECAMREFI_TOOLTIP;Allows you to move the white-point in such a way that it approaches the dominant color. This action modifies the purity. +TP_LOCALLAB_PRECAMREFIMAIN_TOOLTIP;Allows you to move the white-point in such a way that it approaches the dominant color. This action modifies the purity. In combination with "Shift x" and "Shift y" allows you to carry out moderate Color Toning. TP_LOCALLAB_PDEFRA;Contrast Attenuator ƒ TP_LOCALLAB_PDEFRAME_TOOLTIP;PDE IPOL algorithm adapted for Rawtherapee : gives different results and requires different settings compared to main-menu 'Exposure'.\nMay be useful for under-exposed or high dynamic range images. TP_LOCALLAB_PREVHIDE;Hide additional settings TP_LOCALLAB_PREVIEW;Preview ΔE TP_LOCALLAB_PREVSHOW;Show additional settings +TC_LOCALLAB_PRIM_SHIFTX;Shift x +TC_LOCALLAB_PRIM_SHIFTY;Shift y +TC_LOCALLAB_PRIM_SHIFTX_TOOLTIP;In combination with "Refine colors" allows you:\n 1) for low values adjust the image purity.\n 2) for higher values, carry out moderate Color Toning.\n 3) Be careful not to go outside the CIE xy diagram. +TP_LOCALLAB_PRIMILLFRAME;Primaries & Illuminant TP_LOCALLAB_PROXI;ΔE decay TP_LOCALLAB_QUAAGRES;Aggressive TP_LOCALLAB_QUACONSER;Conservative @@ -3356,10 +3453,11 @@ TP_LOCALLAB_RETI_SCALE_TOOLTIP;If Scale=1, Retinex behaves like local contrast w TP_LOCALLAB_RET_TOOLNAME;Dehaze & Retinex TP_LOCALLAB_REWEI;Reweighting iterates TP_LOCALLAB_RGB;RGB Tone Curve -TP_LOCALLAB_RGBCURVE_TOOLTIP;In RGB mode you have 4 choices : Standard, Weighted standard, Luminance & Film-like. +TP_LOCALLAB_RGBCURVE_TOOLTIP;In RGB mode you have 4 choices : Standard, Weighted standard, Luminance & Film-like. TP_LOCALLAB_ROW_NVIS;Not visible TP_LOCALLAB_ROW_VIS;Visible TP_LOCALLAB_RSTPROTECT_TOOLTIP;Red and skin-tone protection affects the Saturation, Chroma and Colorfulness sliders. +TP_LOCALLAB_SATCIE;Saturation control TP_LOCALLAB_SATUR;Saturation TP_LOCALLAB_SATURV;Saturation (s) TP_LOCALLAB_SCALEGR;Scale @@ -3380,7 +3478,7 @@ TP_LOCALLAB_SHADEXCOMP;Shadow compression TP_LOCALLAB_SHADHIGH;Shadows/Highlights & Tone Equalizer TP_LOCALLAB_SHADHMASK_TOOLTIP;Lowers the highlights of the mask in the same way as the shadows/highlights algorithm. TP_LOCALLAB_SHADMASK_TOOLTIP;Lifts the shadows of the mask in the same way as the shadows/highlights algorithm. -TP_LOCALLAB_SHADOWHIGHLIGHT_TOOLTIP;Adjust shadows and highlights either with shadows & highlights sliders or with a tone equalizer.\nCan be used instead of, or in conjunction with the Exposure module.\nCan also be used as a graduated filter. +TP_LOCALLAB_SHADOWHIGHLIGHT_TOOLTIP;Adjust shadows and highlights either with shadows & highlights sliders or with a tone equalizer.\nCan be used instead of, or in conjunction with the Exposure module.\nCan also be used as a graduated filter. TP_LOCALLAB_SHAMASKCOL;Shadows TP_LOCALLAB_SHAPETYPE;Spot shape TP_LOCALLAB_SHAPE_TOOLTIP;'Ellipse' is the normal mode.\n 'Rectangle' can be used in certain cases, for example to work in full-image mode by placing the delimiters outside the preview area. In this case, set transition = 100.\n\nFuture developments will include polygon shapes and Bezier curves. @@ -3426,17 +3524,36 @@ TP_LOCALLAB_SHOWVI;Mask and modifications TP_LOCALLAB_SHRESFRA;Shadows/Highlights & TRC TP_LOCALLAB_SHTRC_TOOLTIP;Based on 'working profile' (only those provided), modifies the tones of the image by acting on a TRC (Tone Response Curve).\nGamma acts mainly on light tones.\nSlope acts mainly on dark tones.\nIt is recommended that the TRC of both devices (monitor and output profile) be sRGB (default). TP_LOCALLAB_SH_TOOLNAME;Shadows/Highlights & Tone Equalizer -TP_LOCALLAB_SIGFRA;Sigmoid Q & Log encoding Q +TP_LOCALLAB_SIGCIE;Sigmoid +TP_LOCALLAB_SIGFRA;Sigmoid Q +TP_LOCALLAB_SIGGAMJCIE;Gamma TP_LOCALLAB_SIGJZFRA;Sigmoid Jz TP_LOCALLAB_SIGMAWAV;Attenuation response TP_LOCALLAB_SIGMOIDBL;Blend TP_LOCALLAB_SIGMOIDLAMBDA;Contrast -TP_LOCALLAB_SIGMOIDQJ;Uses Black Ev & White Ev +TP_LOCALLAB_SIGMOIDLOGAUTO;Auto threshold +TP_LOCALLAB_SIGMOIDQJ;Black Ev & White Ev +TP_LOCALLAB_SIGMOIDSENSI;Adaptability TP_LOCALLAB_SIGMOIDTH;Threshold (Gray point) -TP_LOCALLAB_SIGMOID_TOOLTIP;Allows you to simulate a Tone-mapping appearance using both the'Ciecam' (or 'Jz') and 'Sigmoid' function.\nThree sliders: a) Contrast acts on the shape of the sigmoid curve and consequently on the strength; b) Threshold (Gray point) distributes the action according to the luminance; c)Blend acts on the final aspect of the image, contrast and luminance. +TP_LOCALLAB_SIGMOID_TOOLTIP;Allows you to simulate a Tone-mapping appearance using both the 'Jz' and 'Sigmoid' function.\nThree sliders: a) Contrast acts on the shape of the sigmoid curve and consequently on the strength; b) Threshold (Gray point) distributes the action according to the luminance; c)Blend acts on the final aspect of the image, contrast and luminance. +TP_LOCALLAB_SIGMOID16_TOOLTIP;Allows you to simulate a Tone-mapping appearance using both the'Ciecam' and 'Sigmoid Q'.\nSigmoid Q: three sliders: a) Contrast acts on the shape of the sigmoid curve and consequently on the strength; b) Threshold (Gray point) distributes the action according to the luminance; c)Adaptability weights the action of the sigmoid by action on the internal exponential function. +TP_LOCALLAB_SIGMOIDLOGEV_TOOLTIP;If the comboxbox selection 'Black Ev and White Ev' is 'Sigmoid and Log encoding' instead of 'Sigmoid only', the two algorithms 'Log encoding' and 'Sigmoid' are used together. +TP_LOCALLAB_SIGMOIDNORMCIE;Normalize Luminance +TP_LOCALLAB_SIGMOIDNORMCIE_TOOLTIP;Reconstruct luminance so that the mean and variance of the output image take into account those of the original.\nAll the adjustments acting on J or Q are taken into account, including those which are not relative to Sigmoid Q. +TP_LOCALLAB_SIGMOIDNORMCIEBLEND_TOOLTIP;Blend acts on the final aspect of the image, contrast and luminance : ratio between original and output image. +TP_LOCALLAB_SIGMOIDQJCOMPRCIE_TOOLTIP;When the comboxbox selection'Uses Black Ev and White Ev' is 'Sigmoid and Log encoding Q' or 'Log encoding instead of Sigmoid' checked. This algorithm compress the data above the threshold slider value. This last value stands for brightness (Q) should be a near the possible value 'Compression treshold' (calculate when 'Auto threshold" checked, often > 1). +TP_LOCALLAB_SIGSLOPJCIE;Slope +TP_LOCALLAB_SIGTRCCIE;Source Data Adjustments +TP_LOCALLAB_SIGBLACKSSCIE;Blacks distribution +TP_LOCALLAB_SIGWHITESCIE;Whites distribution +TP_LOCALLAB_SIGMOIDWHITESCIE_TOOLTIP;Allows you, in Automatic, when the dynamic range of the image is high, to change the distribution of lights in whites and deep blacks.\nCan be used with Log encoding or Sigmoid with Black Ev and White Ev enabled.\n\nThe algorithm does not change the basic data, but acts on the components necessary to calculate the Dynamic range, Black Ev, White Ev and the Gray point. TP_LOCALLAB_SLOMASKCOL;Slope TP_LOCALLAB_SLOMASK_TOOLTIP;Adjusting Gamma and Slope can provide a soft and artifact-free transformation of the mask by progressively modifying 'L' to avoid any discontinuities. +TP_LOCALLAB_SLOPESMOOTH;Gray balance (Slope) TP_LOCALLAB_SLOSH;Slope +TP_LOCALLAB_SMOOTHCIE;Smooth & Tone-Mapping +TP_LOCALLAB_SMOOTHCIE_SCA;Scale Yb Scene +TP_LOCALLAB_SMOOTHCIE_TOOLTIP;Completes the processing carried out by gamma, slope and midtones by causing a slight lowering of lights. Please note this does not replace Highlight reconstruction.\n\nGamma - Slope - based: choice (Standard and Advanced) allows you to simulate a "Tone mapping" using: a) Scene conditions: Black-Ev, White-Ev, Mean luminance (Yb%); b) Viewing conditions: Mean luminance (Yb%).\nScale Yb Scene is function of White-Ev. TP_LOCALLAB_SOFT;Soft Light & Original Retinex TP_LOCALLAB_SOFTM;Soft Light TP_LOCALLAB_SOFTMETHOD_TOOLTIP;Apply a Soft-light blend (identical to the global adjustment). Carry out dodge and burn using the original Retinex algorithm. @@ -3458,13 +3575,14 @@ TP_LOCALLAB_STRENG;Strength TP_LOCALLAB_STRENGR;Strength TP_LOCALLAB_STRENGRID_TOOLTIP;You can adjust the desired effect with 'strength', but you can also use the 'scope' function which allows you to delimit the action (e.g. to isolate a particular color). TP_LOCALLAB_STRENGTH;Noise +TP_LOCALLAB_STRENGTHCIELOG;Strength TP_LOCALLAB_STRGRID;Strength TP_LOCALLAB_STRUC;Structure TP_LOCALLAB_STRUCCOL;Spot structure TP_LOCALLAB_STRUCCOL1;Spot structure TP_LOCALLAB_STRUCT_TOOLTIP;Uses the Sobel algorithm to take into account structure for shape detection.\nActivate 'Mask and modifications' > 'Show spot structure' (Advanced mode) to see a preview of the mask (without modifications).\n\nCan be used in conjunction with the Structure Mask, Blur Mask and 'Local contrast' (by wavelet level) to improve edge detection.\n\nEffects of adjustments using Lightness, Contrast, Chrominance, Exposure or other non-mask-related tools visible using either 'Show modified image' or 'Show modified areas with mask'. TP_LOCALLAB_STRUMASKCOL;Structure mask strength -TP_LOCALLAB_STRUMASK_TOOLTIP;Structure mask (slider) with the checkbox 'Structure mask as tool' unchecked: In this case a mask showing the structure will be generated even if none of the 3 curves is activated. Structure masks are available for mask (Blur and denoise') and mask(Color & Light). +TP_LOCALLAB_STRUMASK_TOOLTIP;Structure mask (slider) with the checkbox 'Structure mask as tool' unchecked: In this case a mask showing the structure will be generated even if none of the 3 curves is activated. Structure masks are available for mask (Blur and denoise') and mask(Color & Light). TP_LOCALLAB_STRUSTRMASK_TOOLTIP;Moderate use of this slider is recommended! TP_LOCALLAB_STYPE;Shape method TP_LOCALLAB_STYPE_TOOLTIP;You can choose between:\nSymmetrical - left handle linked to right, top handle linked to bottom.\nIndependent - all handles are independent. @@ -3496,11 +3614,12 @@ TP_LOCALLAB_TRANSITGRAD;Transition differentiation XY TP_LOCALLAB_TRANSITGRAD_TOOLTIP;Allows you to vary the y-axis transition. TP_LOCALLAB_TRANSITVALUE;Transition value TP_LOCALLAB_TRANSITWEAK;Transition decay (linear-log) -TP_LOCALLAB_TRANSITWEAK_TOOLTIP;Adjust transition decay function: 1 linear , 2 parabolic, 3 cubic up to ^25.\nCan be used in conjunction with very low transition values to reduce defects (CBDL, Wavelets, Color & Light). +TP_LOCALLAB_TRANSITWEAK_TOOLTIP;Adjust transition decay function: 1 linear , 2 parabolic, 3 cubic up to ^25.\nCan be used in conjunction with very low transition values to reduce defects (CBDL, Wavelets, Color & Light). TP_LOCALLAB_TRANSIT_TOOLTIP;Adjust smoothness of transition between affected and unaffected areas as a percentage of the 'radius'. TP_LOCALLAB_TRANSMISSIONGAIN;Transmission gain TP_LOCALLAB_TRANSMISSIONMAP;Transmission map TP_LOCALLAB_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positive values (max).\nOrdinate: amplification or reduction.\nYou can adjust this curve to change the Transmission and reduce artifacts. +TP_LOCALLAB_TRCFRAME;Tone Response Curve & Midtones TP_LOCALLAB_USEMASK;Laplacian TP_LOCALLAB_VART;Variance (contrast) TP_LOCALLAB_VIBRANCE;Vibrance & Warm/Cool @@ -4154,7 +4273,7 @@ TP_WAVELET_WAVOFFSET;Offset TP_WBALANCE_AUTO;Auto TP_WBALANCE_AUTOITCGREEN;Temperature correlation TP_WBALANCE_AUTOOLD;RGB grey -TP_WBALANCE_AUTO_HEADER;Automatic & Refinement +TP_WBALANCE_AUTO_HEADER;Automatic & Refinement TP_WBALANCE_CAMERA;Camera TP_WBALANCE_CLOUDY;Cloudy TP_WBALANCE_CUSTOM;Custom diff --git a/rtengine/ciecam02.cc b/rtengine/ciecam02.cc index 25f0c852d..264fd5ab7 100644 --- a/rtengine/ciecam02.cc +++ b/rtengine/ciecam02.cc @@ -229,7 +229,7 @@ float Ciecam02::achromatic_response_to_whitefloat ( float x, float y, float z, f gpa = nonlinear_adaptationfloat ( gp, fl ); bpa = nonlinear_adaptationfloat ( bp, fl ); - return ((2.0f * rpa) + gpa + ((1.0f / 20.0f) * bpa) - 0.305f) * nbb; + return ((2.0f * rpa) + gpa + (0.05f * bpa) - 0.305f) * nbb; } void Ciecam02::xyz_to_cat02float ( float &r, float &g, float &b, float x, float y, float z, int c16, float plum) diff --git a/rtengine/color.cc b/rtengine/color.cc index 4e139a868..16104ae86 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -25,11 +25,67 @@ #include "opthelper.h" #include "iccstore.h" #include +#include "linalgebra.h" using namespace std; -namespace rtengine +namespace rtengine { +namespace { + +typedef Vec3f A3; + +// D50 <-> D65 adapted from darktable, thanks to Alberto Griggio + +void XYZ_D50_to_D65(float &X, float &Y, float &Z) { + // Bradford adaptation matrix from http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html + constexpr float M[3][3] = { + { 0.9555766f, -0.0230393f, 0.0631636f }, + { -0.0282895f, 1.0099416f, 0.0210077f }, + { 0.0122982f, -0.0204830f, 1.3299098f } + }; + A3 res = dot_product(M, A3(X, Y, Z)); + X = res[0]; + Y = res[1]; + Z = res[2]; +} + + +void XYZ_D65_to_D50(float &X, float &Y, float &Z) +{ + // Bradford adaptation matrix from http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html + constexpr float M[3][3] = { + { 1.0478112f, 0.0228866f, -0.0501270f }, + { 0.0295424f, 0.9904844f, -0.0170491f }, + { -0.0092345f, 0.0150436f, 0.7521316f } + }; + A3 res = dot_product(M, A3(X, Y, Z)); + X = res[0]; + Y = res[1]; + Z = res[2]; +} + +/* +float PQ(float X) +{ + X = std::max(X, 1e-10f); + const float XX = std::pow(X*1e-4f, 0.1593017578125f); + return std::pow( + (0.8359375f + 18.8515625f*XX) / (1 + 18.6875f*XX), + 134.034375f); +} + + +float PQ_inv(float X) +{ + X = std::max(X, 1e-10f); + const auto XX = std::pow(X, 7.460772656268214e-03f); + return 1e4f * std::pow( + (0.8359375f - XX) / (18.6875f*XX - 18.8515625f), + 6.277394636015326f); +} +*/ +} // namespace cmsToneCurve* Color::linearGammaTRC; LUTf Color::cachef; @@ -1911,7 +1967,146 @@ void Color::Lch2Luv(float c, float h, float &u, float &v) v = c * sincosval.y; } -void Color::primaries_to_xyz(double p[6], double Wx, double Wz, double *pxyz) +// code take in ART thanks to Alberto Griggio +//----------------------------------------------------------------------------- +// oklab color space from https://bottosson.github.io/posts/oklab/ +//----------------------------------------------------------------------------- + +void Color::xyz2oklab(float X, float Y, float Z, float &L, float &a, float &b) +{ + XYZ_D50_to_D65(X, Y, Z); + + constexpr float M1[3][3] = { + {0.8189330101f, 0.3618667424f, -0.1288597137f}, + {0.0329845436f, 0.9293118715f, 0.0361456387f}, + {0.0482003018f, 0.2643662691f, 0.6338517070f} + }; + + A3 lms = dot_product(M1, A3(X, Y, Z)); + for (int i = 0; i < 3; ++i) { + lms[i] = xcbrtf(lms[i]); + } + + constexpr float M2[3][3] = { + {0.2104542553f, 0.7936177850f, -0.0040720468f}, + {1.9779984951f, -2.4285922050f, 0.4505937099f}, + {0.0259040371f, 0.7827717662f, -0.8086757660f} + }; + + lms = dot_product(M2, lms); + + L = lms[0]; + a = lms[1]; + b = lms[2]; +} + + +void Color::oklab2xyz(float L, float a, float b, float &X, float &Y, float &Z) +{ + constexpr float M2_inv[3][3] = { + {1.f, 0.39633779f, 0.21580376f}, + {1.00000001f, -0.10556134f, -0.06385417f}, + {1.00000005f, -0.08948418f, -1.29148554f} + }; + + A3 lms = dot_product(M2_inv, A3(L, a, b)); + for (int i = 0; i < 3; ++i) { + lms[i] = SQR(lms[i])*lms[i]; + } + + constexpr float M1_inv[3][3] = { + {1.22701385f, -0.55779998f, 0.28125615f}, + {-0.04058018f, 1.11225687f, -0.07167668f}, + {-0.07638128f, -0.42148198f, 1.58616322} + }; + + lms = dot_product(M1_inv, lms); + X = lms[0]; + Y = lms[1]; + Z = lms[2]; + + XYZ_D65_to_D50(X, Y, Z); +} + + +// https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2100-2-201807-I!!PDF-F.pdf +// Perceptual Quantization / SMPTE standard ST.2084 +float Color::eval_PQ_curve(float x, bool oetf) +{ + constexpr float M1 = 2610.0 / 16384.0; + constexpr float M2 = (2523.0 / 4096.0) * 128.0; + constexpr float C1 = 3424.0 / 4096.0; + constexpr float C2 = (2413.0 / 4096.0) * 32.0; + constexpr float C3 = (2392.0 / 4096.0) * 32.0; + + if (x == 0.f) { + return 0.f; + } + + float res = 0.f; + if (oetf) { + // assume 1.0 is 100 nits, normalise so that 1.0 is 10000 nits + float p = std::pow(std::max(x, 0.f) / 100.f, M1); + float num = C1 + C2 * p; + float den = 1.f + C3 * p; + res = std::pow(num / den, M2); + } else { + float p = std::pow(x, 1.f / M2); + float num = std::max(p - C1, 0.f); + float den = C2 - C3 * p; + res = std::pow(num / den, 1.f / M1) * 100.f; + } + return res; +} + + +// https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2100-2-201807-I!!PDF-F.pdf +// Hybrid Log-Gamma +float Color::eval_HLG_curve(float x, bool oetf) +{ + constexpr float A = 0.17883277f; + constexpr float B = 0.28466892f; // 1.f - 4.f * A + constexpr float C = 0.55991072953f; // 0.5f - A * std::log(4.f * A) + + if (x == 0.f) { + return 0.f; + } + + float res = 0.f; + if (oetf) { + // assume 1.0 is 100 nits, normalise so that 1.0 is 1000 nits + float e = LIM01(x / 10.f); + res = (e <= 1.f/12.f) ? std::sqrt(3.f * e) : A * std::log(12.f * e - B) + C; + } else { + res = (x <= 0.5f) ? SQR(x) / 3.f : (std::exp((x - C) / A) + B) / 12.f; + res *= 10.f; + } + + return res; +} + + +float Color::eval_ACEScct_curve(float x, bool forward) +{ + if (forward) { + if (x <= 0.078125f) { + return 10.5402377416545f * x + 0.0729055341958355f; + } else { + return (std::log2(x) + 9.72f) / 17.52f; + } + } else { + if (x <= 0.155251141552511f) { + return (x - 0.0729055341958355f) / 10.5402377416545f; + } else { + return std::exp2(x * 17.52f - 9.72f); + } + } +} + +// end code take in ART thanks to Alberto Griggio + + +void Color::primaries_to_xyz(double p[6], double Wx, double Wz, double *pxyz, int cat) { //calculate Xr, Xg, Xb, Yr, Yb, Tg, Zr,Zg Zb double Wy = 1.0; @@ -1967,29 +2162,112 @@ void Color::primaries_to_xyz(double p[6], double Wx, double Wz, double *pxyz) mat_xyz[2][1] = Sb * Yb; mat_xyz[2][2] = Sb * Zb; - //chromatic adaptation Bradford + //chromatic adaptation Matrix MaBradford = {}; - MaBradford[0][0] = 0.8951; - MaBradford[0][1] = -0.7502; - MaBradford[0][2] = 0.0389; - MaBradford[1][0] = 0.2664; - MaBradford[1][1] = 1.7135; - MaBradford[1][2] = -0.0685; - MaBradford[2][0] = -0.1614; - MaBradford[2][1] = 0.0367; - MaBradford[2][2] = 1.0296; + if( cat == 0 ) {//i bradford + MaBradford[0][0] = 0.8951; + MaBradford[0][1] = -0.7502; + MaBradford[0][2] = 0.0389; + MaBradford[1][0] = 0.2664; + MaBradford[1][1] = 1.7135; + MaBradford[1][2] = -0.0685; + MaBradford[2][0] = -0.1614; + MaBradford[2][1] = 0.0367; + MaBradford[2][2] = 1.0296; + } else if ( cat == 1 ) {// icat16 + MaBradford[0][0] = 1.86206786; + MaBradford[0][1] = -1.01125463; + MaBradford[0][2] = 0.14918677; + MaBradford[1][0] = 0.38752654; + MaBradford[1][1] = 0.62144744; + MaBradford[1][2] = -0.00897398; + MaBradford[2][0] = -0.0158415; + MaBradford[2][1] = -0.03412294; + MaBradford[2][2] = 1.04996444; + } else if ( cat == 2 ) {// icat02 + MaBradford[0][0] = 0.99015849; + MaBradford[0][1] = -0.00838772; + MaBradford[0][2] = 0.018229217; + MaBradford[1][0] = 0.239565979; + MaBradford[1][1] = 0.758664642; + MaBradford[1][2] = 0.001770137; + MaBradford[2][0] = 0.0; + MaBradford[2][1] = 0.0; + MaBradford[2][2] = 1.0; + } else if ( cat == 3 ) {//Von Kries + MaBradford[0][0] = 0.40024; + MaBradford[0][1] = -0.2263; + MaBradford[0][2] = 0.0; + MaBradford[1][0] = 0.7076; + MaBradford[1][1] = 1.16532; + MaBradford[1][2] = 0.0; + MaBradford[2][0] = -0.08081; + MaBradford[2][1] = 0.0457; + MaBradford[2][2] = 0.91822; + } else if ( cat == 4 ) {//None XYZ + MaBradford[0][0] = 1.0; + MaBradford[0][1] = 0.0; + MaBradford[0][2] = 0.0; + MaBradford[1][0] = 0.0; + MaBradford[1][1] = 1.0; + MaBradford[1][2] = 0.0; + MaBradford[2][0] = 0.0; + MaBradford[2][1] = 0.0; + MaBradford[2][2] = 1.0; + } Matrix Ma_oneBradford = {}; - Ma_oneBradford[0][0] = 0.9869929; - Ma_oneBradford[0][1] = 0.4323053; - Ma_oneBradford[0][2] = -0.0085287; - Ma_oneBradford[1][0] = -0.1470543; - Ma_oneBradford[1][1] = 0.5183603; - Ma_oneBradford[1][2] = 0.0400428; - Ma_oneBradford[2][0] = 0.1599627; - Ma_oneBradford[2][1] = 0.0492912; - Ma_oneBradford[2][2] = 0.9684867; - + if( cat == 0 ) {//Bradford + Ma_oneBradford[0][0] = 0.9869929; + Ma_oneBradford[0][1] = 0.4323053; + Ma_oneBradford[0][2] = -0.0085287; + Ma_oneBradford[1][0] = -0.1470543; + Ma_oneBradford[1][1] = 0.5183603; + Ma_oneBradford[1][2] = 0.0400428; + Ma_oneBradford[2][0] = 0.1599627; + Ma_oneBradford[2][1] = 0.0492912; + Ma_oneBradford[2][2] = 0.9684867; + } else if ( cat == 1 ) { //cat16 + Ma_oneBradford[0][0] = 0.401288; + Ma_oneBradford[0][1] = 0.650173; + Ma_oneBradford[0][2] = -0.051461; + Ma_oneBradford[1][0] = -0.250268; + Ma_oneBradford[1][1] = 1.204414; + Ma_oneBradford[1][2] = 0.045854; + Ma_oneBradford[2][0] = -0.002079; + Ma_oneBradford[2][1] = 0.048952; + Ma_oneBradford[2][2] = 0.953127; + } else if ( cat == 2 ) { //cat02 + Ma_oneBradford[0][0] = 1.007245; + Ma_oneBradford[0][1] = 0.011136; + Ma_oneBradford[0][2] = -0.018381; + Ma_oneBradford[1][0] = -0.318061; + Ma_oneBradford[1][1] = 1.314589; + Ma_oneBradford[1][2] = 0.003471; + Ma_oneBradford[2][0] = 0.0; + Ma_oneBradford[2][1] = 0.0; + Ma_oneBradford[2][2] = 1.0; + } else if ( cat == 3 ) { //Von Kries + Ma_oneBradford[0][0] = 1.8599364; + Ma_oneBradford[0][1] = 0.3611914; + Ma_oneBradford[0][2] = 0.0; + Ma_oneBradford[1][0] = -1.1293816; + Ma_oneBradford[1][1] = 0.6388125; + Ma_oneBradford[1][2] = 0.0; + Ma_oneBradford[2][0] = 0.2198974; + Ma_oneBradford[2][1] = -0.0000064; + Ma_oneBradford[2][2] = 1.0890636; + } else if ( cat == 4 ) { //none XYZ + Ma_oneBradford[0][0] = 1.0; + Ma_oneBradford[0][1] = 0.0; + Ma_oneBradford[0][2] = 0.0; + Ma_oneBradford[1][0] = 0.0; + Ma_oneBradford[1][1] = 1.0; + Ma_oneBradford[1][2] = 0.0; + Ma_oneBradford[2][0] = 0.0; + Ma_oneBradford[2][1] = 0.0; + Ma_oneBradford[2][2] = 1.0; + } //R G B source double Rs = Wx * MaBradford[0][0] + Wy * MaBradford[1][0] + Wz * MaBradford[2][0]; double Gs = Wx * MaBradford[0][1] + Wy * MaBradford[1][1] + Wz * MaBradford[2][1]; @@ -2078,16 +2356,15 @@ void Color::primaries_to_xyz(double p[6], double Wx, double Wz, double *pxyz) * columns of the matrix p=xyz_rgb are RGB tristimulus primaries in XYZ * c is the color fixed on the boundary; and m=0 for c=0, m=1 for c=255 */ - void Color::gamutmap(float &X, float Y, float &Z, const double p[3][3]) { - float epsil = 0.0001f; - float intermXYZ = X + 15 * Y + 3 * Z; - if(intermXYZ <= 0.f) { - intermXYZ = epsil; - } - - float u = 4 * X / (intermXYZ) - u0; + float epsil = 0.0001f; + float intermXYZ = X + 15 * Y + 3 * Z; + if(intermXYZ <= 0.f) { + intermXYZ = epsil; + } + + float u = 4 * X / (intermXYZ) - u0; float v = 9 * Y / (intermXYZ) - v0; float lam[3][2]; float lam_min = 1.0f; @@ -2118,14 +2395,12 @@ void Color::gamutmap(float &X, float Y, float &Z, const double p[3][3]) v = v * (double) lam_min + v0; X = (9 * u * Y) / (4 * v); - float intermuv = 12 - 3 * u - 20 * v; - if(intermuv < 0.f) { - intermuv = 0.f; - } + float intermuv = 12 - 3 * u - 20 * v; + if(intermuv < 0.f) { + intermuv = 0.f; + } Z = (intermuv) * Y / (4 * v); - - } void Color::skinredfloat ( float J, float h, float sres, float Sp, float dred, float protect_red, int sk, float rstprotection, float ko, float &s) diff --git a/rtengine/color.h b/rtengine/color.h index 3622a9e36..c20ac97ee 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -127,8 +127,8 @@ public: constexpr static float D50x = 0.9642f; //0.96422; constexpr static float D50z = 0.8249f; //0.82521; - constexpr static double u0 = 4.0 * static_cast(D50x) / (static_cast(D50x) + 15 + 3 * static_cast(D50z)); - constexpr static double v0 = 9.0 / (static_cast(D50x) + 15 + 3 * static_cast(D50z)); + constexpr static double u0 = 4.0 * static_cast(D50x) / (static_cast(D50x) + 15.0 + 3.0 * static_cast(D50z)); + constexpr static double v0 = 9.0 / (static_cast(D50x) + 15.0 + 3.0 * static_cast(D50z)); constexpr static double epskap = 8.0; constexpr static float epskapf = epskap; @@ -1399,7 +1399,36 @@ static inline void Lab2XYZ(vfloat L, vfloat a, vfloat b, vfloat &x, vfloat &y, v //static inline float gamma (double x) { return gammatab[x]; } //static inline float igamma_srgb (double x) { return igammatab_srgb[x]; } + // code take in ART thanks to Alberto Griggio + // Rec.2100 PQ curve + // https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2100-2-201807-I!!PDF-F.pdf + // Perceptual Quantization / SMPTE standard ST.2084 + static float eval_PQ_curve(float x, bool oetf); + // Hybrid-log gamma curve + // https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2100-2-201807-I!!PDF-F.pdf + static float eval_HLG_curve(float x, bool oetf); + + static float eval_ACEScct_curve(float x, bool inverse); + + static void xyz2oklab(float X, float Y, float Z, float &L, float &a, float &b); + static void oklab2xyz(float L, float a, float b, float &X, float &Y, float &Z); + + template + static void rgb2oklab(float R, float G, float B, float &L, float &a, float &b, const T ws[3][3]) + { + float X, Y, Z; + rgbxyz(R, G, B, X, Y, Z, ws); + xyz2oklab(X, Y, Z, L, a, b); + } + + template + static void oklab2rgb(float L, float a, float b, float &R, float &G, float &B, const T iws[3][3]) + { + float X, Y, Z; + oklab2xyz(L, a, b, X, Y, Z); + xyz2rgb(X, Y, Z, R, G, B, iws); + } // -------------------------------- Jacques's Munsell correction @@ -1847,13 +1876,13 @@ static inline void Lab2XYZ(vfloat L, vfloat a, vfloat b, vfloat &x, vfloat &y, v */ static void gamutmap(float &X, float Y, float &Z, const double p[3][3]); - /** - * @brief Convert primaries in XYZ values in function of illuminant - * @param p primaries red, gree, blue - * @param Wx Wy white for illuminant - * @param pxyz return matrix XYZ - */ - static void primaries_to_xyz (double p[6], double Wx, double Wz, double *pxyz); + /** + * @brief Convert primaries in XYZ values in function of illuminant + * @param p primaries red, gree, blue + * @param Wx Wy white for illuminant + * @param pxyz return matrix XYZ + */ + static void primaries_to_xyz (double p[6], double Wx, double Wz, double *pxyz, int cat); /** * @brief Get HSV's hue from the Lab's hue diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 85661edd3..a489bd681 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -896,6 +896,7 @@ void Crop::update(int todo) auto& locllmasCurve = parent->locllmasCurve; auto& lochhmasCurve = parent->lochhmasCurve; auto& lochhhmasCurve = parent->lochhhmasCurve; + auto& lochhhmascieCurve = parent->lochhhmascieCurve; auto& locccmasexpCurve = parent->locccmasexpCurve; auto& locllmasexpCurve = parent->locllmasexpCurve; auto& lochhmasexpCurve = parent->lochhmasexpCurve; @@ -935,6 +936,7 @@ void Crop::update(int todo) auto& locwavCurvejz = parent->locwavCurvejz; auto& loclmasCurveblwav = parent->loclmasCurveblwav; auto& loclmasCurvecolwav = parent->loclmasCurvecolwav; + auto& loclmasCurveciewav = parent->loclmasCurveciewav; auto& loclevwavCurve = parent->loclevwavCurve; auto& locconwavCurve = parent->locconwavCurve; auto& loccompwavCurve = parent->loccompwavCurve; @@ -958,6 +960,7 @@ void Crop::update(int todo) const bool llmasutili = locllmasCurve.Set(params.locallab.spots.at(sp).LLmaskcurve); const bool lhmasutili = lochhmasCurve.Set(params.locallab.spots.at(sp).HHmaskcurve); const bool lhhmasutili = lochhhmasCurve.Set(params.locallab.spots.at(sp).HHhmaskcurve); + const bool lhhmascieutili = lochhhmascieCurve.Set(params.locallab.spots.at(sp).HHhmaskciecurve); const bool lcmasexputili = locccmasexpCurve.Set(params.locallab.spots.at(sp).CCmaskexpcurve); const bool llmasexputili = locllmasexpCurve.Set(params.locallab.spots.at(sp).LLmaskexpcurve); const bool lhmasexputili = lochhmasexpCurve.Set(params.locallab.spots.at(sp).HHmaskexpcurve); @@ -993,6 +996,7 @@ void Crop::update(int todo) const bool lmasutili_wav = loclmasCurve_wav.Set(params.locallab.spots.at(sp).LLmask_curvewav); const bool lmasutiliblwav = loclmasCurveblwav.Set(params.locallab.spots.at(sp).LLmaskblcurvewav); const bool lmasutilicolwav = loclmasCurvecolwav.Set(params.locallab.spots.at(sp).LLmaskcolcurvewav); + const bool lmasutiliciewav = loclmasCurveciewav.Set(params.locallab.spots.at(sp).LLmaskciecurvewav); const bool lcmaslcutili = locccmaslcCurve.Set(params.locallab.spots.at(sp).CCmasklccurve); const bool llmaslcutili = locllmaslcCurve.Set(params.locallab.spots.at(sp).LLmasklccurve); const bool lhmaslcutili = lochhmaslcCurve.Set(params.locallab.spots.at(sp).HHmasklccurve); @@ -1056,6 +1060,10 @@ void Crop::update(int todo) float stdretie = parent->stdretis[sp]; float fab = 1.f; + float maxicam = -1000.f; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + int ill = 2; float minCD; float maxCD; float mini; @@ -1073,6 +1081,9 @@ void Crop::update(int todo) float Lnresi = 0.f; float Lhighresi46 = 0.f; float Lnresi46 = 0.f; + float contsig = params.locallab.spots.at(sp).contsigqcie; + + float lightsig = params.locallab.spots.at(sp).lightsigqcie; /* huerefp[sp] = huere; chromarefp[sp] = chromare; lumarefp[sp] = lumare; @@ -1111,7 +1122,7 @@ void Crop::update(int todo) czlocalcurve2,localczutili, czjzlocalcurve2,localczjzutili, - locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, lochhhmasCurve, lhhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, + locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, lochhhmasCurve, lhhmasutili, lochhhmascieCurve, lhhmascieutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili, locccmasvibCurve, lcmasvibutili, locllmasvibCurve, llmasvibutili, lochhmasvibCurve, lhmasvibutili, locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, @@ -1127,6 +1138,7 @@ void Crop::update(int todo) lochhhmas_Curve, lhhmas_utili, loclmasCurveblwav,lmasutiliblwav, loclmasCurvecolwav,lmasutilicolwav, + loclmasCurveciewav,lmasutiliciewav, locwavCurve, locwavutili, locwavCurvejz, locwavutilijz, loclevwavCurve, loclevwavutili, @@ -1141,7 +1153,7 @@ void Crop::update(int todo) huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, parent->previewDeltaE, parent->locallColorMask, parent->locallColorMaskinv, parent->locallExpMask, parent->locallExpMaskinv, parent->locallSHMask, parent->locallSHMaskinv, parent->locallvibMask, parent->localllcMask, parent->locallsharMask, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask, parent->localltmMask, parent->locallblMask, parent->localllogMask, parent->locall_Mask, parent->locallcieMask, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, - meantme, stdtme, meanretie, stdretie, fab, + meantme, stdtme, meanretie, stdretie, fab, maxicam,rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye,ill, contsig, lightsig, highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46); LocallabListener::locallabDenoiseLC denoiselc; @@ -1224,7 +1236,7 @@ void Crop::update(int todo) czlocalcurve2,localczutili, czjzlocalcurve2,localczjzutili, - locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili,lochhhmasCurve, lhhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, + locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili,lochhhmasCurve, lhhmasutili, lochhhmascieCurve, lhhmascieutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili, locccmasvibCurve, lcmasvibutili, locllmasvibCurve, llmasvibutili, lochhmasvibCurve, lhmasvibutili, locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, @@ -1240,6 +1252,7 @@ void Crop::update(int todo) loclmasCurveblwav,lmasutiliblwav, loclmasCurvecolwav,lmasutilicolwav, + loclmasCurveciewav,lmasutiliciewav, locwavCurve, locwavutili, locwavCurvejz, locwavutilijz, loclevwavCurve, loclevwavutili, @@ -1253,7 +1266,7 @@ void Crop::update(int todo) LHutili, HHutili, CHutili, HHutilijz, CHutilijz, LHutilijz, cclocalcurve2, localcutili, rgblocalcurve2, localrgbutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, - meantme, stdtme, meanretie, stdretie, fab, + meantme, stdtme, meanretie, stdretie, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, ill, contsig, lightsig, highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46); } @@ -1599,7 +1612,7 @@ void Crop::update(int todo) parent->ipf.softLight(labnCrop, params.softlight); - if (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE) { + if (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE && params.icm.trcExp) { const int GW = labnCrop->W; const int GH = labnCrop->H; std::unique_ptr provis; @@ -1623,8 +1636,52 @@ void Crop::update(int todo) cmsHTRANSFORM cmsDummy = nullptr; int ill = 0; - parent->ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, ill, 0, cmsDummy, true, false, false); - parent->ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, illum, prim, cmsDummy, false, true, true); + int locprim = 0; + bool gamutcontrol = params.icm.gamut; + int catc = rtengine::toUnderlying(params.icm.wcat); + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + parent->ipf.workingtrc(0, tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, 0, ill, 0, 0, rdx, rdy, grx, gry, blx, bly,meanx, meany, meanxe, meanye, cmsDummy, true, false, false, false); + parent->ipf.workingtrc(0, tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, catc, illum, prim, locprim, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, cmsDummy, false, true, true, gamutcontrol); + const int midton = params.icm.wmidtcie; + + if(midton != 0) { + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[2] = midton; + params.bands[4] = 0; + params.bands[5] = 0; + int mid = abs(midton); + int threshmid = 50; + if(mid > threshmid) { + params.bands[1] = sign(midton) * (mid - threshmid); + params.bands[3] = sign(midton) * (mid - threshmid); + } + parent->ipf.toneEqualizer(tmpImage1.get(), params, prof, skip, false); + } + + const bool smoothi = params.icm.wsmoothcie; + if(smoothi) { + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[1] = 0; + params.bands[2] = 0; + params.bands[3] = 0; + params.bands[4] = -40;//arbitrary value to adapt with WhiteEvjz - here White Ev # 10 + params.bands[5] = -80;//8 Ev and above + bool Evsix = true; + if(Evsix) {//EV = 6 majority of images + params.bands[4] = -15; + } + + parent->ipf.toneEqualizer(tmpImage1.get(), params, prof, skip, false); + } parent->ipf.rgb2lab(*tmpImage1, *labnCrop, params.icm.workingProfile); //labnCrop and provis diff --git a/rtengine/iccmatrices.h b/rtengine/iccmatrices.h index be685b676..6c5203744 100644 --- a/rtengine/iccmatrices.h +++ b/rtengine/iccmatrices.h @@ -94,12 +94,50 @@ constexpr double xyz_jdcmax[3][3] = {//prim red 0.734702 0.265302 gr 0.021908 0. {0.8394088, 0.0163780, 0.1084133}, {0.3031122, 0.6954651, 0.0014227}, {-0.000048, 0.0357376, 0.7891671} + +/* + {0.878152, -0.035991, 0.122039},//stdA + {0.293869, 0.682893, 0.023238}, + {0.020725, 0.025411, 0.778763} +*/ +/* + {0.831816, 0.041363, 0.091021},//D80 + {0.307370, 0.714525, -0.021895}, + {-0.004335, 0.039442, 0.789793} + */ +}; + +constexpr double xyz_jdcmaxstdA[3][3] = {//prim red 0.734702 0.265302 gr 0.021908 0.930288 bl 0.120593 0.001583 + + {0.878152, -0.035991, 0.122039},//stdA + {0.293869, 0.682893, 0.023238}, + {0.020725, 0.025411, 0.778763} +}; + +constexpr double jdcmaxstdA_xyz[3][3] = { + + {1.1209647, 0.06568858, -0.177625},//stdA + {-0.481904, 1.437746, 0.03261678}, + {-0.0141074, -0.0486617, 1.28775} + }; constexpr double jdcmax_xyz[3][3] = { {1.1984508, -0.0197646, -0.1646037}, {-0.5223824, 1.4466349, 0.0691553}, {0.0236634, -0.0655113, 1.2640260} + + /* + {1.1209647, 0.06568858, -0.177625},//stdA + {-0.481904, 1.437746, 0.03261678}, + {-0.0141074, -0.0486617, 1.28775} + */ + /* + {1.2247276, -0.0630103, -0.142892},//D80 + {-0.525835, 1.424446, 0.100089}, + {0.032982, -0.0714782, 1.260371} + */ + }; diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index af1b94fbe..86a9c214b 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -197,9 +197,9 @@ cmsHPROFILE createXYZProfile() return rtengine::ICCStore::createFromMatrix(mat, false, "XYZ"); } -const double(*wprofiles[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_jdcmax, xyz_beta, xyz_best, xyz_rec2020, xyz_ACESp0, xyz_ACESp1, xyz_bruce};// -const double(*iwprofiles[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, jdcmax_xyz, beta_xyz, best_xyz, rec2020_xyz, ACESp0_xyz, ACESp1_xyz, bruce_xyz};// -const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "JDCmax", "Beta RGB", "BestRGB", "Rec2020", "ACESp0", "ACESp1", "BruceRGB"};// +const double(*wprofiles[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_jdcmax, xyz_jdcmaxstdA, xyz_beta, xyz_best, xyz_rec2020, xyz_ACESp0, xyz_ACESp1, xyz_bruce};// +const double(*iwprofiles[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, jdcmax_xyz, jdcmaxstdA_xyz, beta_xyz, best_xyz, rec2020_xyz, ACESp0_xyz, ACESp1_xyz, bruce_xyz};// +const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "JDCmax", "JDCmax stdA", "Beta RGB", "BestRGB", "Rec2020", "ACESp0", "ACESp1", "BruceRGB"};// //default = gamma inside profile //BT709 g=2.22 s=4.5 sRGB g=2.4 s=12.92310 //linear g=1.0 diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 5358f2880..604d353c4 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -875,8 +875,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } for (int sp = 0; sp < (int)params->locallab.spots.size(); sp++) { - if (params->locallab.spots.at(sp).expsharp && params->dirpyrequalizer.cbdlMethod == "bef") { - if (params->locallab.spots.at(sp).shardamping < 1) { + if(params->locallab.spots.at(sp).expsharp && params->dirpyrequalizer.cbdlMethod == "bef") { + if(params->locallab.spots.at(sp).shardamping < 1) { params->locallab.spots.at(sp).shardamping = 1; } } @@ -904,9 +904,15 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) params->toneCurve.black, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, params->toneCurve.hrenabled); } - if (params->toneCurve.histmatching) { + if (params->toneCurve.histmatching ) { + bool exectrcexp = false;//store if Abstract profile enabled + exectrcexp = params->icm.trcExp; if (!params->toneCurve.fromHistMatching) { + if(params->icm.trcExp) { + params->icm.trcExp = false;//disabled Abstract profile, if hismatching + } imgsrc->getAutoMatchedToneCurve(params->icm, params->raw, params->wb.observer, params->toneCurve.curve); + params->icm.trcExp = exectrcexp;//restore Abstract profile } if (params->toneCurve.autoexp) { @@ -930,6 +936,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (params->locallab.enabled && !params->locallab.spots.empty()) { const int sizespot = (int)params->locallab.spots.size(); const LocallabParams::LocallabSpot defSpot; + std::vector locallciebef; float *sourceg = nullptr; sourceg = new float[sizespot]; @@ -951,6 +958,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) Autogr = new bool[sizespot]; bool *autocie = nullptr; autocie = new bool[sizespot]; + int *whits = nullptr; + whits = new int[sizespot]; + int *blacks = nullptr; + blacks = new int[sizespot]; + int *whitslog = nullptr; + whitslog = new int[sizespot]; + int *blackslog = nullptr; + blackslog = new int[sizespot]; float *locx = nullptr; @@ -975,6 +990,10 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) whiteev[sp] = params->locallab.spots.at(sp).whiteEv; sourceg[sp] = params->locallab.spots.at(sp).sourceGray; sourceab[sp] = params->locallab.spots.at(sp).sourceabs; + whits[sp] = params->locallab.spots.at(sp).whitescie; + blacks[sp] = params->locallab.spots.at(sp).blackscie; + whitslog[sp] = params->locallab.spots.at(sp).whiteslog; + blackslog[sp] = params->locallab.spots.at(sp).blackslog; Autogr[sp] = params->locallab.spots.at(sp).Autogray; targetg[sp] = params->locallab.spots.at(sp).targetGray; locx[sp] = params->locallab.spots.at(sp).loc.at(0) / 2000.0; @@ -1011,9 +1030,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) xsta = 0.f; xend = 1.f; } - - ipf.getAutoLogloc(sp, imgsrc, sourceg, blackev, whiteev, Autogr, sourceab, fw, fh, xsta, xend, ysta, yend, SCALE); - // printf("sp=%i sg=%f sab=%f\n", sp, sourceg[sp], sourceab[sp]); + ipf.getAutoLogloc(sp, imgsrc, sourceg, blackev, whiteev, Autogr, sourceab, whits, blacks, whitslog, blackslog, fw, fh, xsta, xend, ysta, yend, SCALE); params->locallab.spots.at(sp).blackEv = blackev[sp]; params->locallab.spots.at(sp).whiteEv = whiteev[sp]; params->locallab.spots.at(sp).blackEvjz = blackev[sp]; @@ -1022,10 +1039,25 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) params->locallab.spots.at(sp).sourceabs = sourceab[sp]; params->locallab.spots.at(sp).sourceGraycie = sourceg[sp]; params->locallab.spots.at(sp).sourceabscie = sourceab[sp]; + params->locallab.spots.at(sp).whitescie = whits[sp]; + params->locallab.spots.at(sp).blackscie = blacks[sp]; + params->locallab.spots.at(sp).whiteslog = whitslog[sp]; + params->locallab.spots.at(sp).blackslog = blackslog[sp]; float jz1 = defSpot.jz100; + + LocallabListener::locallabcieBEF locciebef; + locciebef.blackevbef = blackev[sp]; + locciebef.whiteevbef = whiteev[sp]; + locciebef.sourcegbef = sourceg[sp]; + locciebef.sourceabbef = sourceab[sp]; + locciebef.targetgbef = targetg[sp]; + locciebef.autocomputbef = autocomput[sp]; + locciebef.autociebef = autocie[sp]; + locciebef.jz1bef = jz1; + locallciebef.push_back(locciebef); if (locallListener) { - locallListener->logencodChanged(blackev[sp], whiteev[sp], sourceg[sp], sourceab[sp], targetg[sp], autocomput[sp], autocie[sp], jz1); + locallListener->ciebefChanged(locallciebef,params->locallab.selspot); } } } @@ -1043,6 +1075,10 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) delete [] blackev; delete [] targetg; delete [] sourceab; + delete [] whits; + delete [] blacks; + delete [] whitslog; + delete [] blackslog; delete [] sourceg; delete [] cie; delete [] log; @@ -1092,6 +1128,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) float avge, meantme, stdtme, meanretie, stdretie; //std::vector locallref; std::vector locallretiminmax; + std::vector locallcielc; + std::vector locallciesig; huerefs.resize(params->locallab.spots.size()); huerefblurs.resize(params->locallab.spots.size()); chromarefblurs.resize(params->locallab.spots.size()); @@ -1124,7 +1162,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (params->locallab.spots.at(sp).equilret && params->locallab.spots.at(sp).expreti) { savenormreti.reset(new LabImage(*oprevl, true)); } - + // Set local curves of current spot to LUT locRETgainCurve.Set(params->locallab.spots.at(sp).localTgaincurve); locRETtransCurve.Set(params->locallab.spots.at(sp).localTtranscurve); @@ -1138,6 +1176,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) const bool llmasutili = locllmasCurve.Set(params->locallab.spots.at(sp).LLmaskcurve); const bool lhmasutili = lochhmasCurve.Set(params->locallab.spots.at(sp).HHmaskcurve); const bool lhhmasutili = lochhhmasCurve.Set(params->locallab.spots.at(sp).HHhmaskcurve); + const bool lhhmascieutili = lochhhmascieCurve.Set(params->locallab.spots.at(sp).HHhmaskciecurve); const bool llmasexputili = locllmasexpCurve.Set(params->locallab.spots.at(sp).LLmaskexpcurve); const bool lcmasexputili = locccmasexpCurve.Set(params->locallab.spots.at(sp).CCmaskexpcurve); const bool lhmasexputili = lochhmasexpCurve.Set(params->locallab.spots.at(sp).HHmaskexpcurve); @@ -1168,13 +1207,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) const bool llmascieutili = locllmascieCurve.Set(params->locallab.spots.at(sp).LLmaskciecurve); const bool lcmascieutili = locccmascieCurve.Set(params->locallab.spots.at(sp).CCmaskciecurve); const bool lhmascieutili = lochhmascieCurve.Set(params->locallab.spots.at(sp).HHmaskciecurve); - const bool lcmas_utili = locccmas_Curve.Set(params->locallab.spots.at(sp).CCmask_curve); const bool llmas_utili = locllmas_Curve.Set(params->locallab.spots.at(sp).LLmask_curve); const bool lhmas_utili = lochhmas_Curve.Set(params->locallab.spots.at(sp).HHmask_curve); const bool lhhmas_utili = lochhhmas_Curve.Set(params->locallab.spots.at(sp).HHhmask_curve); const bool lmasutiliblwav = loclmasCurveblwav.Set(params->locallab.spots.at(sp).LLmaskblcurvewav); const bool lmasutilicolwav = loclmasCurvecolwav.Set(params->locallab.spots.at(sp).LLmaskcolcurvewav); + const bool lmasutiliciewav = loclmasCurveciewav.Set(params->locallab.spots.at(sp).LLmaskciecurvewav); const bool locwavutili = locwavCurve.Set(params->locallab.spots.at(sp).locwavcurve); const bool locwavutilijz = locwavCurvejz.Set(params->locallab.spots.at(sp).locwavcurvejz); const bool loclevwavutili = loclevwavCurve.Set(params->locallab.spots.at(sp).loclevwavcurve); @@ -1215,7 +1254,10 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) double shcompr = params->locallab.spots.at(sp).shcompr; double br = params->locallab.spots.at(sp).lightness; double cont = params->locallab.spots.at(sp).contrast; - + float contsig = params->locallab.spots.at(sp).contsigqcie; + + float lightsig = params->locallab.spots.at(sp).lightsigqcie; + if (black < 0. && params->locallab.spots.at(sp).expMethod == "pde") { black *= 1.5; } @@ -1232,6 +1274,10 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) meanretie = 0.f; stdretie = 0.f; float fab = 1.f; + float maxicam = -1000.f; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + int ill = 2; bool istm = params->locallab.spots.at(sp).equiltm && params->locallab.spots.at(sp).exptonemap; bool isreti = params->locallab.spots.at(sp).equilret && params->locallab.spots.at(sp).expreti; //preparation for mean and sigma on current RT-spot @@ -1257,7 +1303,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) yend = std::min(static_cast(centy + locy), 1.f); xsta = std::max(static_cast(centx - locxl), 0.f); xend = std::min(static_cast(centx + locx), 1.f); - // printf("xsta=%f xend=%f ysta=%f yend=%f \n", xsta, xend, ysta, yend); } int ww = nprevl->W; @@ -1296,14 +1341,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) sca); // Save Locallab mask curve references for current spot - /* - LocallabListener::locallabRef spotref; - spotref.huer = huer; - spotref.lumar = lumar; - spotref.chromar = chromar; - spotref.fab = 1.f; - locallref.push_back(spotref); - */ // Locallab tools computation /* Notes: * - shbuffer is used as nullptr @@ -1328,7 +1365,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) float Lnresi = 0.f; float Lhighresi46 = 0.f; float Lnresi46 = 0.f; - + Glib::ustring prof = params->icm.workingProfile; + if(params->locallab.spots.at(sp).complexcie == 2) { + params->locallab.spots.at(sp).primMethod = prof;//in Basic mode set to Working profile + } + ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv.get(), savenormtm.get(), savenormreti.get(), lastorigimp.get(), fw, fh, 0, 0, pW, pH, scale, locRETgainCurve, locRETtransCurve, lllocalcurve, locallutili, cllocalcurve, localclutili, @@ -1353,7 +1394,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, - locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, lochhhmasCurve, lhhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, + locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, lochhhmasCurve, lhhmasutili, lochhhmascieCurve, lhhmascieutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili, locccmasvibCurve, lcmasvibutili, locllmasvibCurve, llmasvibutili, lochhmasvibCurve, lhmasvibutili, locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, @@ -1369,6 +1410,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) lochhhmas_Curve, lhhmas_utili, loclmasCurveblwav, lmasutiliblwav, loclmasCurvecolwav, lmasutilicolwav, + loclmasCurveciewav, lmasutiliciewav, locwavCurve, locwavutili, locwavCurvejz, locwavutilijz, loclevwavCurve, loclevwavutili, @@ -1382,12 +1424,59 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) LHutili, HHutili, CHutili, HHutilijz, CHutilijz, LHutilijz, cclocalcurve, localcutili, rgblocalcurve, localrgbutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, lastsav, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, - meantm, stdtm, meanreti, stdreti, fab, + meantm, stdtm, meanreti, stdreti, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, ill, contsig, lightsig, highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46); fabrefp[sp] = fab; + //Illuminant + float w_x = 0.3f; + float w_y = 0.3f; + if(ill == 2) { + w_x = 0.3457f; + w_y = 0.3585f; + } else if(ill == 4) { + w_x = 0.3217f; + w_y = 0.3377f; + } else if(ill == 5) { + w_x = 0.3127f; + w_y = 0.3290f; + } else if(ill == 1) { + w_x = 0.376137f; + w_y = 0.374021f; + } else if(ill == 3) { + w_x = 0.332424f; + w_y = 0.347426f; + } else if(ill == 6) { + w_x = 0.293756f; + w_y = 0.309185f; + } else if(ill == 7) {//D120 + w_x = 0.269669f; + w_y = 0.28078f; + } else if(ill == 8) {//stdA + w_x = 0.447573f; + w_y = 0.407440f; + } else if(ill == 9) {//2000K + w_x = 0.526591f; + w_y = 0.41331f; + } else if(ill == 10) {//1500K + w_x = 0.585703f; + w_y = 0.393157f; + } else if(ill == 20) { + w_x = 0.333333f; + w_y = 0.333333f; + } + //move white-point in GUI + double refin = params->locallab.spots.at(sp).refi; + double arefi = (w_y - meany) / (w_x - meanx); + double brefi = w_y - arefi * w_x; + double scalrefi = meanx - w_x; + w_x = w_x + scalrefi * refin; + w_y = w_x * arefi + brefi; + + + if (istm) { //calculate mean and sigma on full image for use by normalize_mean_dt float meanf = 0.f; float stdf = 0.f; @@ -1425,6 +1514,27 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) retiMinMax.Tmax = Tmax; locallretiminmax.push_back(retiMinMax); + //save Locallab CIE primaries and white for current spot + LocallabListener::locallabcieLC loccielc; + loccielc.redxlc = rdx; + loccielc.redylc = rdy; + loccielc.grexlc = grx; + loccielc.greylc = gry; + loccielc.bluxlc = blx; + loccielc.bluylc = bly; + loccielc.wxlc = w_x; + loccielc.wylc = w_y; + loccielc.meanxlc = meanx; + loccielc.meanylc = meany; + loccielc.meanxelc = meanxe; + loccielc.meanyelc = meanye; + locallcielc.push_back(loccielc); + + LocallabListener::locallabcieSIG locciesig; + locciesig.contsigq = contsig; + locciesig.lightsigq = lightsig; + locallciesig.push_back(locciesig); + // Recalculate references after if (params->locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reserv.get(), reserv.get(), 0, 0, pW, pH, scale, huerefblu, chromarefblu, lumarefblu, huer, chromar, lumar, sobeler, avg, locwavCurveden, locwavdenutili); @@ -1434,46 +1544,30 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // Update Locallab reference values according to recurs parameter if (params->locallab.spots.at(sp).recurs) { - /* - spotref.huer = huer; - spotref.lumar = lumar; - spotref.chromar = chromar; - spotref.fab = fab; - locallref.at(sp).chromar = chromar; - locallref.at(sp).lumar = lumar; - locallref.at(sp).huer = huer; - locallref.at(sp).fab = fab; - */ huerefp[sp] = huer; chromarefp[sp] = chromar; lumarefp[sp] = lumar; fabrefp[sp] = fab; } + - // spotref.fab = fab; - // locallref.at(sp).fab = fab; - - // locallref.push_back(spotref); if (locallListener) { - // locallListener->refChanged(locallref, params->locallab.selspot); locallListener->refChanged2(huerefp, chromarefp, lumarefp, fabrefp, params->locallab.selspot); locallListener->minmaxChanged(locallretiminmax, params->locallab.selspot); + if (params->locallab.spots.at(sp).expprecam) { + locallListener->cieChanged(locallcielc,params->locallab.selspot); + } + locallListener->sigChanged(locallciesig,params->locallab.selspot); } - + } delete [] huerefp; delete [] chromarefp; delete [] lumarefp; delete [] fabrefp; - // Transmit Locallab reference values and Locallab Retinex min/max to LocallabListener - /* - if (locallListener) { - locallListener->refChanged(locallref, params->locallab.selspot); - locallListener->minmaxChanged(locallretiminmax, params->locallab.selspot); - } - */ + ipf.lab2rgb(*nprevl, *oprevi, params->icm.workingProfile); //************************************************************* // end locallab @@ -1886,7 +1980,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) ipf.softLight(nprevl, params->softlight); - if (params->icm.workingTRC != ColorManagementParams::WorkingTrc::NONE) { + if (params->icm.workingTRC != ColorManagementParams::WorkingTrc::NONE && params->icm.trcExp) { const int GW = nprevl->W; const int GH = nprevl->H; std::unique_ptr provis; @@ -1903,15 +1997,58 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) const float gamtone = params->icm.workingTRCGamma; const float slotone = params->icm.workingTRCSlope; - int illum = toUnderlying(params->icm.will); const int prim = toUnderlying(params->icm.wprim); Glib::ustring prof = params->icm.workingProfile; + cmsHTRANSFORM dummy = nullptr; int ill = 0; - ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, ill, 0, dummy, true, false, false); - ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, illum, prim, dummy, false, true, true); + bool gamutcontrol = params->icm.gamut; + int catc = toUnderlying(params->icm.wcat); + int locprim = 0; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + + ipf.workingtrc(0, tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, 0, ill, 0, 0, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, dummy, true, false, false, false); + ipf.workingtrc(0, tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, catc, illum, prim, locprim, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, dummy, false, true, true, gamutcontrol); + const int midton = params->icm.wmidtcie; + if(midton != 0) { + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[2] = midton; + params.bands[4] = 0; + params.bands[5] = 0; + int mid = abs(midton); + int threshmid = 50; + if(mid > threshmid) { + params.bands[1] = sign(midton) * (mid - threshmid); + params.bands[3] = sign(midton) * (mid - threshmid); + } + ipf.toneEqualizer(tmpImage1.get(), params, prof, scale, false); + } + const bool smoothi = params->icm.wsmoothcie; + if(smoothi) { + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[1] = 0; + params.bands[2] = 0; + params.bands[3] = 0; + params.bands[4] = -40;//arbitrary value to adapt with WhiteEvjz - here White Ev # 10 + params.bands[5] = -80;//8 Ev and above + bool Evsix = true; + if(Evsix) {//EV = 6 majority of images + params.bands[4] = -15; + } + + ipf.toneEqualizer(tmpImage1.get(), params, prof, scale, false); + } ipf.rgb2lab(*tmpImage1, *nprevl, params->icm.workingProfile); @@ -1934,7 +2071,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) tmpImage1.reset(); - if (prim == 13) {//pass red gre blue xy in function of area dats Ciexy + if (prim == 14) {//pass red gre blue xy in function of area dats Ciexy float redgraphx = params->icm.labgridcieALow; float redgraphy = params->icm.labgridcieBLow; float blugraphx = params->icm.labgridcieAHigh; @@ -2020,9 +2157,18 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) wy = 0.3932f; break; } + + + //move white point in GUI + double refin = params->icm.refi; + double arefi = (wy - meany) / (wx - meanx); + double brefi = wy - arefi * wx; + double scalrefi = meanx - wx; + wx = wx + scalrefi * refin; + wy = wx * arefi + brefi; if (primListener) { - primListener->iprimChanged(r_x, r_y, b_x, b_y, g_x, g_y, wx, wy); + primListener->iprimChanged(r_x, r_y, b_x, b_y, g_x, g_y, wx, wy, meanx, meany); } } } @@ -2116,6 +2262,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } double tempsym = 5003.; + double greensym = 1.; int wmodel = 0;//wmodel allows - arbitrary - choice of illuminant and temp with choice if (params->colorappearance.wbmodel == "RawT") { @@ -2128,28 +2275,37 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (params->colorappearance.catmethod == "symg" && wmodel == 2) { tempsym = params->wb.temperature;//force white balance in symmetric - } else { + } else if(params->colorappearance.autotempout) { if (params->colorappearance.illum == "iA") {//otherwise force illuminant source tempsym = 2856.; + greensym = 1.; } else if (params->colorappearance.illum == "i41") { tempsym = 4100.; + greensym = 1.; } else if (params->colorappearance.illum == "i50") { tempsym = 5003.; + greensym = 1.; } else if (params->colorappearance.illum == "i55") { tempsym = 5503.; } else if (params->colorappearance.illum == "i60") { tempsym = 6000. ; + greensym = 1.; } else if (params->colorappearance.illum == "i65") { tempsym = 6504.; + greensym = 1.; } else if (params->colorappearance.illum == "i75") { tempsym = 7504.; + greensym = 1.; } else if (params->colorappearance.illum == "ifree") { tempsym = params->wb.temperature;//force white balance in symmetric + greensym = 1.; } + } else { + tempsym = params->colorappearance.tempout; + greensym = params->colorappearance.greenout; } - - if (params->colorappearance.enabled && params->colorappearance.autotempout) { - acListener->wbCamChanged(tempsym, 1.f); //real temp and tint = 1. + if (params->colorappearance.enabled) { + acListener->wbCamChanged(tempsym, greensym); //real temp and tint. } } else { diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index e236aed17..f276bc30a 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -305,6 +305,7 @@ protected: LocLLmaskCurve locllmasCurve; LocHHmaskCurve lochhmasCurve; LocHHmaskCurve lochhhmasCurve; + LocHHmaskCurve lochhhmascieCurve; LocCCmaskCurve locccmasexpCurve; LocLLmaskCurve locllmasexpCurve; LocHHmaskCurve lochhmasexpCurve; @@ -343,6 +344,7 @@ protected: LocwavCurve locwavCurve; LocwavCurve loclmasCurveblwav; LocwavCurve loclmasCurvecolwav; + LocwavCurve loclmasCurveciewav; LocwavCurve loclevwavCurve; LocwavCurve locconwavCurve; LocwavCurve loccompwavCurve; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 58e597dce..3283c8b64 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -193,7 +193,8 @@ enum class BlurType { void moyeqt(Imagefloat* working, float &moyS, float &eqty); void luminanceCurve(LabImage* lold, LabImage* lnew, const LUTf &curve); - void ciecamloc_02float(const struct local_params& lp, int sp, LabImage* lab, int bfw, int bfh, int call, int sk, const LUTf& cielocalcurve, bool localcieutili, const LUTf& cielocalcurve2, bool localcieutili2, const LUTf& jzlocalcurve, bool localjzutili, const LUTf& czlocalcurve, bool localczutili, const LUTf& czjzlocalcurve, bool localczjzutili, const LocCHCurve& locchCurvejz, const LocHHCurve& lochhCurve, const LocLHCurve& loclhCurve, bool HHcurvejz, bool CHcurvejz, bool LHcurvejz, const LocwavCurve& locwavCurvejz, bool locwavutilijz); + void ciecamloc_02float(struct local_params& lp, int sp, LabImage* lab, int bfw, int bfh, int call, int sk, const LUTf& cielocalcurve, bool localcieutili, const LUTf& cielocalcurve2, bool localcieutili2, const LUTf& jzlocalcurve, bool localjzutili, const LUTf& czlocalcurve, bool localczutili, const LUTf& czjzlocalcurve, bool localczjzutili, const LocCHCurve& locchCurvejz, const LocHHCurve& lochhCurve, const LocLHCurve& loclhCurve, bool HHcurvejz, bool CHcurvejz, bool LHcurvejz, + const LocwavCurve& locwavCurvejz, bool locwavutilijz, float &maxicam, float &comtsig, float &lightsig); void ciecam_02float(CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const procparams::ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, @@ -252,7 +253,7 @@ enum class BlurType { float strumask, bool astool, const LocCCmaskCurve & locccmasCurve, bool lcmasutili, const LocLLmaskCurve & locllmasCurve, bool llmasutili, - const LocHHmaskCurve & lochhmasCurve, bool lhmasutili, const LocHHmaskCurve & lochhhmasCurve, bool lhhmasutili, + const LocHHmaskCurve & lochhmasCurve, bool lhmasutili, const LocHHmaskCurve & lochhhmasCurve, bool lhhmasutili, bool multiThread, bool enaMask, bool showmaske, bool deltaE, bool modmask, bool zero, bool modif, float chrom, float rad, float lap, float gamma, float slope, float blendm, float blendmab, int shado, int highl, float amountcd, float anchorcd, const LUTf& lmasklocalcurve, bool localmaskutili, const LocwavCurve & loclmasCurvecolwav, bool lmasutilicolwav, int level_bl, int level_hl, int level_br, int level_hr, @@ -270,10 +271,10 @@ enum class BlurType { void loccont(int bfw, int bfh, LabImage* tmp1, float rad, float stren, int sk); void rex_poisson_dct(float * data, size_t nx, size_t ny, double m); - void mean_dt(const float * data, size_t size, double& mean_p, double& dt_p); + void mean_dt(const float * data, int size, double& mean_p, double& dt_p, double nbstd); float *cos_table(size_t size); - void normalize_mean_dt(float *data, const float *ref, size_t size, float mod, float sigm, float mdef, float sdef, float mdef2, float sdef2); + void normalize_mean_dt(float *data, const float *ref, int size, float mod, float sigm, float mdef, float sdef, float mdef2, float sdef2, double nbstd); void retinex_pde(const float *datain, float * dataout, int bfw, int bfh, float thresh, float multy, float *dE, int show, int dEenable, int normalize); void exposure_pde(float *dataor, float *datain, float * dataout, int bfw, int bfh, float thresh, float mod); void fftw_convol_blur(float *input, float *output, int bfw, int bfh, float radius, int fftkern, int algo); @@ -291,7 +292,7 @@ enum class BlurType { //3 functions from Alberto Griggio, adapted J.Desmis 2019 void filmGrain(Imagefloat *rgb, int isogr, int strengr, int scalegr,float divgr, int bfw, int bfh, int call, int fw, int fh); void log_encode(Imagefloat *rgb, struct local_params & lp, bool multiThread, int bfw, int bfh); - void getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, float *blackev, float *whiteev, bool *Autogr, float *sourceab, int fw, int fh, float xsta, float xend, float ysta, float yend, int SCALE); + void getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, float *blackev, float *whiteev, bool *Autogr, float *sourceab, int *whits, int *blacks, int *whitslog, int *blackslog, int fw, int fh, float xsta, float xend, float ysta, float yend, int SCALE); void MSRLocal(int call, int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, LabImage * bufmaskorigreti, float** luminance, const float* const *originalLuminance, const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve, @@ -331,7 +332,7 @@ enum class BlurType { const LUTf& czlocalcurve, bool localczutili, const LUTf& czjzlocalcurve, bool localczjzutili, - const LocCCmaskCurve& locccmasCurve, bool lcmasutili, const LocLLmaskCurve& locllmasCurve, bool llmasutili, const LocHHmaskCurve& lochhmasCurve, bool lhmasutili, const LocHHmaskCurve& llochhhmasCurve, bool lhhmasutili, + const LocCCmaskCurve& locccmasCurve, bool lcmasutili, const LocLLmaskCurve& locllmasCurve, bool llmasutili, const LocHHmaskCurve& lochhmasCurve, bool lhmasutili, const LocHHmaskCurve& llochhhmasCurve, bool lhhmasutili, const LocHHmaskCurve& llochhhmascieCurve, bool lhhmascieutili, const LocCCmaskCurve& locccmasexpCurve, bool lcmasexputili, const LocLLmaskCurve& locllmasexpCurve, bool llmasexputili, const LocHHmaskCurve& lochhmasexpCurve, bool lhmasexputili, const LocCCmaskCurve& locccmasSHCurve, bool lcmasSHutili, const LocLLmaskCurve& locllmasSHCurve, bool llmasSHutili, const LocHHmaskCurve& lochhmasSHCurve, bool lhmasSHutili, const LocCCmaskCurve& locccmasvibCurve, bool lcmasvibutili, const LocLLmaskCurve& locllmasvibCurve, bool llmasvibutili, const LocHHmaskCurve& lochhmasvibCurve, bool lhmasvibutili, @@ -348,6 +349,7 @@ enum class BlurType { const LocwavCurve& loclmasCurveblwav, bool lmasutiliblwav, const LocwavCurve& loclmasCurvecolwav, bool lmasutilicolwav, + const LocwavCurve& loclmasCurveciewav, bool lmasutiliciewav, const LocwavCurve& locwavCurve, bool locwavutili, const LocwavCurve& locwavCurvejz, bool locwavutilijz, const LocwavCurve& loclevwavCurve, bool loclevwavutili, @@ -362,10 +364,12 @@ enum class BlurType { double& huerefblur, double &chromarefblur, double& lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, int &lastsav, bool prevDeltaE, int llColorMask, int llColorMaskinv, int llExpMask, int llExpMaskinv, int llSHMask, int llSHMaskinv, int llvibMask, int lllcMask, int llsharMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask, int lllogMask, int ll_Mask, int llcieMask, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, - float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab, + float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab, float &maxicam, float &rdx, float &rdy, float &grx, float &gry, float &blx, float &bly, float &meanx, float &meany, float &meanxe, float &meanye, int &ill, float &contsig, float &lightsig, float &highresi, float &nresi, float &highresi46, float &nresi46, float &Lhighresi, float &Lnresi, float &Lhighresi46, float &Lnresi46); - - void tone_eqdehaz(ImProcFunctions *ipf, Imagefloat *rgb, int whits, int blacks, const Glib::ustring &workingProfile, double scale, bool multithread); + + void tone_eqcam2(ImProcFunctions *ipf, Imagefloat *rgb, int whits, int blacks, const Glib::ustring &workingProfile, double scale, bool multithread); + void tone_eqdehaz(ImProcFunctions *ipf, Imagefloat *rgb, int whits, int blacks, const Glib::ustring &workingProfile, double scale, bool multithread); + void tone_eqcam(ImProcFunctions *ipf, Imagefloat *rgb, int midtone, const Glib::ustring &workingProfile, double scale, bool multithread); void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk); void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); @@ -507,7 +511,9 @@ enum class BlurType { static void rgb2lab(std::uint8_t red, std::uint8_t green, std::uint8_t blue, float &L, float &a, float &b, const procparams::ColorManagementParams &icm, bool consider_histogram_settings = true); Imagefloat* lab2rgbOut(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm); // CieImage *ciec; - void workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, int ch, int mul, Glib::ustring &profile, double gampos, double slpos, int &illum, int prim, cmsHTRANSFORM &transform, bool normalizeIn = true, bool normalizeOut = true, bool keepTransForm = false) const; + void workingtrc(int sp, Imagefloat* src, Imagefloat* dst, int cw, int ch, int mul, Glib::ustring &profile, double gampos, double slpos, int cat, int &illum, int prim, int locprim, + float &rdx, float &rdy, float &grx, float &gry, float &blx, float &bly, float &meanx, float &meany, float &meanxe, float &meanye, + cmsHTRANSFORM &transform, bool normalizeIn = true, bool normalizeOut = true, bool keepTransForm = false, bool gamutcontrol = false) const; void preserv(LabImage *nprevl, LabImage *provis, int cw, int ch); bool transCoord(int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr) const; diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index ffa6ea8c0..d2b2c9f2c 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -34,7 +34,8 @@ namespace rtengine { -namespace { +namespace +{ inline void copyAndClampLine(const float *src, unsigned char *dst, const int W) { @@ -65,10 +66,12 @@ inline void copyAndClamp(const LabImage *src, unsigned char *dst, const double r rgb_xyzv[i][j] = F2V(rgb_xyzf[i][j]); } } + #endif #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int i = 0; i < H; ++i) { float* rL = src->L[i]; float* ra = src->a[i]; @@ -80,19 +83,21 @@ inline void copyAndClamp(const LabImage *src, unsigned char *dst, const double r float gbuffer[W] ALIGNED16; float bbuffer[W] ALIGNED16; int j = 0; + for (; j < W - 3; j += 4) { vfloat R, G, B; vfloat x_, y_, z_; - Color::Lab2XYZ(LVFU(rL[j]), LVFU(ra[j]), LVFU(rb[j]), x_, y_, z_ ); + Color::Lab2XYZ(LVFU(rL[j]), LVFU(ra[j]), LVFU(rb[j]), x_, y_, z_); Color::xyz2rgb(x_, y_, z_, R, G, B, rgb_xyzv); STVF(rbuffer[j], Color::gamma2curve[R]); STVF(gbuffer[j], Color::gamma2curve[G]); STVF(bbuffer[j], Color::gamma2curve[B]); } + for (; j < W; ++j) { float R, G, B; float x_, y_, z_; - Color::Lab2XYZ(rL[j], ra[j], rb[j], x_, y_, z_ ); + Color::Lab2XYZ(rL[j], ra[j], rb[j], x_, y_, z_); Color::xyz2rgb(x_, y_, z_, R, G, B, rgb_xyzf); rbuffer[j] = Color::gamma2curve[R]; gbuffer[j] = Color::gamma2curve[G]; @@ -106,16 +111,18 @@ inline void copyAndClamp(const LabImage *src, unsigned char *dst, const double r } #else + for (int j = 0; j < W; ++j) { float R, G, B; float x_, y_, z_; - Color::Lab2XYZ(rL[j], ra[j], rb[j], x_, y_, z_ ); + Color::Lab2XYZ(rL[j], ra[j], rb[j], x_, y_, z_); Color::xyz2rgb(x_, y_, z_, R, G, B, rgb_xyzf); dst[ix++] = uint16ToUint8Rounded(Color::gamma2curve[R]); dst[ix++] = uint16ToUint8Rounded(Color::gamma2curve[G]); dst[ix++] = uint16ToUint8Rounded(Color::gamma2curve[B]); } + #endif } } @@ -250,7 +257,7 @@ Image8* ImProcFunctions::lab2rgb(LabImage* lab, int cx, int cy, int cw, int ch, lcmsMutex->lock(); cmsHPROFILE LabIProf = cmsCreateLab4Profile(nullptr); - cmsHTRANSFORM hTransform = cmsCreateTransform (LabIProf, TYPE_Lab_DBL, oprof, TYPE_RGB_FLT, icm.outputIntent, flags); + cmsHTRANSFORM hTransform = cmsCreateTransform(LabIProf, TYPE_Lab_DBL, oprof, TYPE_RGB_FLT, icm.outputIntent, flags); cmsCloseProfile(LabIProf); lcmsMutex->unlock(); @@ -284,7 +291,7 @@ Image8* ImProcFunctions::lab2rgb(LabImage* lab, int cx, int cy, int cw, int ch, buffer[iy++] = rb[j] / 327.68f; } - cmsDoTransform (hTransform, buffer, outbuffer, cw); + cmsDoTransform(hTransform, buffer, outbuffer, cw); copyAndClampLine(outbuffer, data + ix, cw); } } // End of parallelization @@ -354,7 +361,7 @@ Imagefloat* ImProcFunctions::lab2rgbOut(LabImage* lab, int cx, int cy, int cw, i cmsCloseProfile(iprof); image->normalizeFloatTo65535(); } else { - + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif @@ -390,35 +397,133 @@ Imagefloat* ImProcFunctions::lab2rgbOut(LabImage* lab, int cx, int cy, int cw, i } void ImProcFunctions::preserv(LabImage *nprevl, LabImage *provis, int cw, int ch) -{//avoid too strong in middle values chroma when changing primaries - float pres = 0.01f * params->icm.preser; - float neutral = 2000000000.f;//if a2 + b2 < 200000000 scale 0..100 a and b about : 140 > a & b > -140 decrease effect - float medneutral = 10000000.f;//plein effect 10 > a & b > -10 - float aaneu = 1.f / (medneutral - neutral); - float bbneu = - aaneu * neutral; +{ + //avoid too strong in middle values chroma when changing primaries + float pres = 0.01f * params->icm.preser; + float neutral = 2000000000.f;//if a2 + b2 < 200000000 scale 0..100 a and b about : 140 > a & b > -140 decrease effect + float medneutral = 10000000.f;//plein effect 10 > a & b > -10 + float aaneu = 1.f / (medneutral - neutral); + float bbneu = - aaneu * neutral; #ifdef _OPENMP - #pragma omp for schedule(dynamic, 16) nowait + #pragma omp for schedule(dynamic, 16) nowait #endif - for (int i = 0; i < ch; ++i) + + for (int i = 0; i < ch; ++i) for (int j = 0; j < cw; ++j) { float neu = SQR(provis->a[i][j]) + SQR(provis->b[i][j]); + if (neu < medneutral) {//plein effect - nprevl->a[i][j] = intp(pres, provis->a[i][j], nprevl->a[i][j]); - nprevl->b[i][j] = intp(pres, provis->b[i][j], nprevl->b[i][j]); + nprevl->a[i][j] = intp(pres, provis->a[i][j], nprevl->a[i][j]); + nprevl->b[i][j] = intp(pres, provis->b[i][j], nprevl->b[i][j]); } else if (neu < neutral) {//decrease effect float presred = aaneu * neu + bbneu; - nprevl->a[i][j] = intp(pres * presred, provis->a[i][j], nprevl->a[i][j]); - nprevl->b[i][j] = intp(pres * presred, provis->b[i][j], nprevl->b[i][j]); - } + nprevl->a[i][j] = intp(pres * presred, provis->a[i][j], nprevl->a[i][j]); + nprevl->b[i][j] = intp(pres * presred, provis->b[i][j], nprevl->b[i][j]); + } } } -void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, int ch, int mul, Glib::ustring &profile, double gampos, double slpos, int &illum, int prim, cmsHTRANSFORM &transform, bool normalizeIn, bool normalizeOut, bool keepTransForm) const +void ImProcFunctions::workingtrc(int sp, Imagefloat* src, Imagefloat* dst, int cw, int ch, int mul, Glib::ustring &profile, double gampos, double slpos, int cat, int &illum, int prim, int locprim, + float &rdx, float &rdy, float &grx, float &gry, float &blx, float &bly, float &meanx, float &meany, float &meanxe, float &meanye, + cmsHTRANSFORM &transform, bool normalizeIn, bool normalizeOut, bool keepTransForm, bool gamutcontrol) const { const TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); + double wb2[3][3]; + float epsilon = 0.000001f; + + // if(gamutcontrol) { +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = 0; i < ch; ++i) + for (int j = 0; j < cw; ++j) { + src->r(i, j) = (float) rtengine::max(src->r(i, j), epsilon); + src->g(i, j) = (float) rtengine::max(src->g(i, j), epsilon); + src->b(i, j) = (float) rtengine::max(src->b(i, j), epsilon); + } + // } + + + + if (mul == 5) {//only second pass workingtrc - avoid this code first pass + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 3; ++c) { + wb2[r][c] = wprof[r][c]; + } + } + + //provis - samme approach as in WB itcwb + //we can add others function on colors ...others than mean (actually) + int precision = 3; + const int bfw = cw / precision + ((cw % precision) > 0 ? 1 : 0); + const int bfh = ch / precision + ((ch % precision) > 0 ? 1 : 0); + + Imagefloat *provis = nullptr; + provis = new Imagefloat(bfw, bfh);//cw, ch + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int i = 0; i < bfh ; ++i) { + const int ii = i * precision; + + if (ii < ch) { + for (int j = 0, jj = 0; j < bfw ; ++j, jj += precision) { + provis->r(i, j) = src->r(ii, jj); + provis->g(i, j) = src->g(ii, jj); + provis->b(i, j) = src->b(ii, jj); + } + } + } + + +// I try to find the dominant color by a simple way (average of x and y) +// It is probably intellectually more relevant to place this algorithm at the end, but it is complex at the GUI level (at least for me). +// The errors made are relatively minimal and result seems good enough + meanx = 0.f; + meany = 0.f; + +#ifdef _OPENMP + #pragma omp parallel for reduction(+:meanx, meany) if(multiThread) +#endif + + for (int y = 0; y < bfh ; ++y) { + for (int x = 0; x < bfw ; ++x) { + const float RR = provis->r(y, x); + const float GG = provis->g(y, x); + const float BB = provis->b(y, x); + float xcb, ycb, zcb; + Color::rgbxyz(RR, GG, BB, xcb, ycb, zcb, wb2); + float X_r = xcb; + float Y_r = ycb; + float Z_r = zcb; + if(gamutcontrol) { + Color::gamutmap(X_r, Y_r, Z_r, wb2);//gamut control + } + const float som = X_r + Y_r + Z_r; + X_r = X_r / som; + Y_r = Y_r / som; + meanx += X_r; + meany += Y_r; + } + } + + meanx /= (bfh * bfw); + meany /= (bfh * bfw); + meanx += 0.005f; + meany += 0.005f; //ampirical mean delta with value end in process + + if (settings->verbose) { + printf("Estimation dominant color : x=%f y=%f\n", (double) meanx, (double) meany); + } + + delete provis; + } + double wprofprim[3][3];//store primaries to XYZ - bool gamutcontrol = params->icm.gamut; + const float toxyz[3][3] = { { static_cast(wprof[0][0] / ((normalizeIn ? 65535.0 : 1.0))), //I have suppressed / Color::D50x @@ -435,7 +540,7 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, } }; - if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1" || profile == "JDCmax") { + if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1" || profile == "JDCmax" || profile == "JDCmax stdA") { if (settings->verbose) { printf("Profile=%s\n", profile.c_str()); } @@ -455,22 +560,22 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, for (int i = 0; i < ch; ++i) for (int j = 0; j < cw; ++j) { - float r = src->r(i, j); - float g = src->g(i, j); - float b = src->b(i, j); - r = (Color::igammatab_srgb[r]) / 65535.f; - g = (Color::igammatab_srgb[g]) / 65535.f; - b = (Color::igammatab_srgb[b]) / 65535.f; - dst->r(i, j) = r; - dst->g(i, j) = g; - dst->b(i, j) = b; + double r = (double) src->r(i, j); + double g = (double) src->g(i, j); + double b = (double) src->b(i, j); + r = (Color::igammatab_srgb[r]) / 65535.; + g = (Color::igammatab_srgb[g]) / 65535.; + b = (Color::igammatab_srgb[b]) / 65535.; + dst->r(i, j) = r; + dst->g(i, j) = g; + dst->b(i, j) = b; } return; } - if (mul == 1 || (params->icm.wprim == ColorManagementParams::Primaries::DEFAULT && params->icm.will == ColorManagementParams::Illuminant::DEFAULT)) { //shortcut and speedup when no call primaries and illuminant - no gamut control...in this case be careful + if (mul == 1) { // || (params->icm.wprim == ColorManagementParams::Primaries::DEFAULT && params->icm.will == ColorManagementParams::Illuminant::DEFAULT)) { //shortcut and speedup when no call primaries and illuminant - no gamut control...in this case be careful GammaValues g_a; //gamma parameters double pwr = 1.0 / static_cast(gampos); Color::calcGamma(pwr, slpos, g_a); // call to calcGamma with selected gamma and slope @@ -510,7 +615,78 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, float greyy = params->icm.grey; float epsil = 0.0001f; - if (prim == 13) {//convert datas area to xy + double Wx = 1.0; + double Wz = 1.0; + cmsCIExyY xyD; + + if (locprim == 1 && mul == 5) { + rdx = params->locallab.spots.at(sp).redxl; + rdy = params->locallab.spots.at(sp).redyl; + grx = params->locallab.spots.at(sp).grexl; + gry = params->locallab.spots.at(sp).greyl; + blx = params->locallab.spots.at(sp).bluxl; + bly = params->locallab.spots.at(sp).bluyl; + + if (params->locallab.spots.at(sp).illMethod == "d50") { + illum = 2; + xyD = {0.3457, 0.3585, 1.0}; // near LCMS values but not perfect... it's a compromise!! + Wx = 0.964295676; + Wz = 0.825104603; + } else if (params->locallab.spots.at(sp).illMethod == "d60") { + illum = 4; + Wx = 0.952646075; + Wz = 1.008825184; + xyD = {0.32168, 0.33767, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "d65") { + illum = 5; + Wx = 0.95045471; + Wz = 1.08905029; + xyD = {0.312700492, 0.329000939, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "d41") { + illum = 1; + Wx = 0.991488263; + Wz = 0.631604625; + xyD = {0.376137, 0.374021, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "d55") { + illum = 3; + Wx = 0.956565934; + Wz = 0.920253249; + xyD = {0.332424, 0.347426, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "d80") { + illum = 6; + Wx = 0.950095542; + Wz = 1.284213976; + xyD = {0.293756, 0.309185, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "d120") { + illum = 7; + Wx = 0.979182; + Wz = 1.623623; + xyD = {0.269669, 0.28078, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "stda") { + illum = 8; + Wx = 1.098500393; + Wz = 0.355848714; + xyD = {0.447573, 0.407440, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "T2000") { + illum = 9; + Wx = 1.274335; + Wz = 0.145233; + xyD = {0.526591, 0.41331, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "T1500") { + illum = 10; + Wx = 1.489921; + Wz = 0.053826; + xyD = {0.585703, 0.393157, 1.0}; + } else if (params->locallab.spots.at(sp).illMethod == "iE") { + illum = 20; + Wx = 1.; + Wz = 1.; + xyD = {0.333333, 0.333333, 1.0}; + } + + } + + if (prim == 14 && locprim == 0 && mul == 5) {//convert datas area to xy float redgraphx = params->icm.labgridcieALow; float redgraphy = params->icm.labgridcieBLow; float blugraphx = params->icm.labgridcieAHigh; @@ -561,76 +737,307 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, return; } + enum class ColorTemp { + D50 = 5003, // for Widegamut, ProPhoto Best, Beta -> D50 + D65 = 6504, // for sRGB, AdobeRGB, Bruce Rec2020 -> D65 + D60 = 6005 // for ACES AP0 and AP1 + }; + double tempv4 = 5003.; + double p[6]; //primaries - switch (ColorManagementParams::Primaries(prim)) { - case ColorManagementParams::Primaries::DEFAULT: { - break; + if (locprim == 0 && mul == 5) { + switch (ColorManagementParams::Primaries(prim)) { + case ColorManagementParams::Primaries::DEFAULT: { + break; + } + + case ColorManagementParams::Primaries::SRGB: { + profile = "sRGB"; + break; + } + + case ColorManagementParams::Primaries::ADOBE_RGB: { + profile = "Adobe RGB"; + break; + } + + case ColorManagementParams::Primaries::PRO_PHOTO: { + profile = "ProPhoto"; + break; + } + + case ColorManagementParams::Primaries::REC2020: { + profile = "Rec2020"; + break; + } + + case ColorManagementParams::Primaries::ACES_P1: { + profile = "ACESp1"; + break; + } + + case ColorManagementParams::Primaries::WIDE_GAMUT: { + profile = "WideGamut"; + break; + } + + case ColorManagementParams::Primaries::ACES_P0: { + profile = "ACESp0"; + break; + } + + case ColorManagementParams::Primaries::JDC_MAX: { + profile = "JDCmax"; + break; + } + + case ColorManagementParams::Primaries::JDC_MAXSTDA: { + profile = "JDCmax stdA"; + break; + } + + case ColorManagementParams::Primaries::BRUCE_RGB: { + profile = "BruceRGB"; + break; + } + + case ColorManagementParams::Primaries::BETA_RGB: { + profile = "Beta RGB"; + break; + } + + case ColorManagementParams::Primaries::BEST_RGB: { + profile = "BestRGB"; + break; + } + + case ColorManagementParams::Primaries::CUSTOM: { + profile = "Custom"; + break; + } + + case ColorManagementParams::Primaries::CUSTOM_GRID: { + profile = "Custom"; + break; + } + } + } else if (locprim == 1 && mul == 5) { + //local primaries + if (prim == 1) { + p[0] = 0.6400; // sRGB primaries + p[1] = 0.3300; + p[2] = 0.3000; + p[3] = 0.6000; + p[4] = 0.1500; + p[5] = 0.0600; + tempv4 = 6504.; + Wx = 0.95045471; + Wz = 1.08905029; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + + } else if (prim == 2) { + p[0] = 0.6400; //Adobe primaries + p[1] = 0.3300; + p[2] = 0.2100; + p[3] = 0.7100; + p[4] = 0.1500; + p[5] = 0.0600; + tempv4 = 6504.; + Wx = 0.95045471; + Wz = 1.08905029; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + + } else if (prim == 3) { + p[0] = 0.7347; //ProPhoto and default primaries + p[1] = 0.2653; + p[2] = 0.1596; + p[3] = 0.8404; + p[4] = 0.0366; + p[5] = 0.0001; + Wx = 0.964295676; + Wz = 0.825104603; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + + } else if (prim == 4) { + p[0] = 0.7080; // Rec2020 primaries + p[1] = 0.2920; + p[2] = 0.1700; + p[3] = 0.7970; + p[4] = 0.1310; + p[5] = 0.0460; + tempv4 = 6504.; + Wx = 0.95045471; + Wz = 1.08905029; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + + } else if (prim == 5) { + p[0] = 0.713; // ACES P1 primaries + p[1] = 0.293; + p[2] = 0.165; + p[3] = 0.830; + p[4] = 0.128; + p[5] = 0.044; + tempv4 = 6004.; + Wx = 0.952646075; + Wz = 1.008825184; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + + } else if (prim == 6) { + p[0] = 0.7350; //Widegamut primaries + p[1] = 0.2650; + p[2] = 0.1150; + p[3] = 0.8260; + p[4] = 0.1570; + p[5] = 0.0180; + Wx = 0.964295676; + Wz = 0.825104603; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + } else if (prim == 7) { + p[0] = 0.7347; //ACESp0 primaries + p[1] = 0.2653; + p[2] = 0.; + p[3] = 1.0; + p[4] = 0.0001; + p[5] = -0.0770; + tempv4 = 6004.; + Wx = 0.952646075; + Wz = 1.008825184; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + } else if (prim == 8) { + p[0] = 0.734702; // JDC max primaries + p[1] = 0.265302; + p[2] = 0.021908; + p[3] = 0.930288; + p[4] = 0.120593; + p[5] = 0.001583; + Wx = 0.964295676; + Wz = 0.825104603; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + } else if (prim == 9) { + p[0] = 0.734702; // JDC max primaries + p[1] = 0.265302; + p[2] = 0.021908; + p[3] = 0.930288; + p[4] = 0.120593; + p[5] = 0.001583; + Wx = 1.098500393; + Wz = 0.355848714; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + } else if (prim == 10) { + p[0] = 0.64; // Bruce primaries + p[1] = 0.33; + p[2] = 0.28; + p[3] = 0.65; + p[4] = 0.15; + p[5] = 0.06; + Wx = 0.95045471; + Wz = 1.08905029; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + } else if (prim == 11) { + p[0] = 0.6888; // Beta primaries + p[1] = 0.3112; + p[2] = 0.1986; + p[3] = 0.7551; + p[4] = 0.1265; + p[5] = 0.0352; + Wx = 0.964295676; + Wz = 0.825104603; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + } else if (prim == 12) { + p[0] = 0.7347; // Best primaries + p[1] = 0.2653; + p[2] = 0.2150; + p[3] = 0.7750; + p[4] = 0.13; + p[5] = 0.0350; + Wx = 0.964295676; + Wz = 0.825104603; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; + } else if (prim == 15) { + p[0] = rdx; + p[1] = rdy; + p[2] = grx; + p[3] = gry; + p[4] = blx; + p[5] = bly; + } else { + p[0] = 0.7347; //ProPhoto and default primaries + p[1] = 0.2653; + p[2] = 0.1596; + p[3] = 0.8404; + p[4] = 0.0366; + p[5] = 0.0001; + Wx = 0.964295676; + Wz = 0.825104603; + rdx = p[0]; + rdy = p[1]; + grx = p[2]; + gry = p[3]; + blx = p[4]; + bly = p[5]; } - case ColorManagementParams::Primaries::SRGB: { - profile = "sRGB"; - break; - } - case ColorManagementParams::Primaries::ADOBE_RGB: { - profile = "Adobe RGB"; - break; - } - - case ColorManagementParams::Primaries::PRO_PHOTO: { - profile = "ProPhoto"; - break; - } - - case ColorManagementParams::Primaries::REC2020: { - profile = "Rec2020"; - break; - } - - case ColorManagementParams::Primaries::ACES_P1: { - profile = "ACESp1"; - break; - } - - case ColorManagementParams::Primaries::WIDE_GAMUT: { - profile = "WideGamut"; - break; - } - - case ColorManagementParams::Primaries::ACES_P0: { - profile = "ACESp0"; - break; - } - - case ColorManagementParams::Primaries::JDC_MAX: { - profile = "JDCmax"; - break; - } - - case ColorManagementParams::Primaries::BRUCE_RGB: { - profile = "BruceRGB"; - break; - } - - case ColorManagementParams::Primaries::BETA_RGB: { - profile = "Beta RGB"; - break; - } - - case ColorManagementParams::Primaries::BEST_RGB: { - profile = "BestRGB"; - break; - } - - case ColorManagementParams::Primaries::CUSTOM: { - profile = "Custom"; - break; - } - - case ColorManagementParams::Primaries::CUSTOM_GRID: { - profile = "Custom"; - break; - } } if (settings->verbose && prim != 0) { @@ -656,161 +1063,165 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, // int select_temp = 1; //5003K constexpr double eps = 0.000000001; // not divide by zero - enum class ColorTemp { - D50 = 5003, // for Widegamut, ProPhoto Best, Beta -> D50 - D65 = 6504, // for sRGB, AdobeRGB, Bruce Rec2020 -> D65 - D60 = 6005 // for ACES AP0 and AP1 - - }; - double tempv4 = 5003.; - double p[6]; //primaries - double Wx = 1.0; - double Wz = 1.0; - //primaries for 10 working profiles ==> output profiles - if (profile == "WideGamut") { - p[0] = 0.7350; //Widegamut primaries - p[1] = 0.2650; - p[2] = 0.1150; - p[3] = 0.8260; - p[4] = 0.1570; - p[5] = 0.0180; - illum = toUnderlying(ColorManagementParams::Illuminant::D50); - Wx = 0.964295676; - Wz = 0.825104603; + if (locprim == 0 && mul ==5) { + if (profile == "WideGamut") { + p[0] = 0.7350; //Widegamut primaries + p[1] = 0.2650; + p[2] = 0.1150; + p[3] = 0.8260; + p[4] = 0.1570; + p[5] = 0.0180; + illum = toUnderlying(ColorManagementParams::Illuminant::D50); + Wx = 0.964295676; + Wz = 0.825104603; - } else if (profile == "Adobe RGB") { - p[0] = 0.6400; //Adobe primaries - p[1] = 0.3300; - p[2] = 0.2100; - p[3] = 0.7100; - p[4] = 0.1500; - p[5] = 0.0600; - tempv4 = 6504.; - illum = toUnderlying(ColorManagementParams::Illuminant::D65); - Wx = 0.95045471; - Wz = 1.08905029; + } else if (profile == "Adobe RGB") { + p[0] = 0.6400; //Adobe primaries + p[1] = 0.3300; + p[2] = 0.2100; + p[3] = 0.7100; + p[4] = 0.1500; + p[5] = 0.0600; + tempv4 = 6504.; + illum = toUnderlying(ColorManagementParams::Illuminant::D65); + Wx = 0.95045471; + Wz = 1.08905029; - } else if (profile == "sRGB") { - p[0] = 0.6400; // sRGB primaries - p[1] = 0.3300; - p[2] = 0.3000; - p[3] = 0.6000; - p[4] = 0.1500; - p[5] = 0.0600; - tempv4 = 6504.; - illum = toUnderlying(ColorManagementParams::Illuminant::D65); - Wx = 0.95045471; - Wz = 1.08905029; + } else if (profile == "sRGB") { + p[0] = 0.6400; // sRGB primaries + p[1] = 0.3300; + p[2] = 0.3000; + p[3] = 0.6000; + p[4] = 0.1500; + p[5] = 0.0600; + tempv4 = 6504.; + illum = toUnderlying(ColorManagementParams::Illuminant::D65); + Wx = 0.95045471; + Wz = 1.08905029; - } else if (profile == "BruceRGB") { - p[0] = 0.6400; // Bruce primaries - p[1] = 0.3300; - p[2] = 0.2800; - p[3] = 0.6500; - p[4] = 0.1500; - p[5] = 0.0600; - tempv4 = 6504.; - illum = toUnderlying(ColorManagementParams::Illuminant::D65); - Wx = 0.95045471; - Wz = 1.08905029; + } else if (profile == "BruceRGB") { + p[0] = 0.6400; // Bruce primaries + p[1] = 0.3300; + p[2] = 0.2800; + p[3] = 0.6500; + p[4] = 0.1500; + p[5] = 0.0600; + tempv4 = 6504.; + illum = toUnderlying(ColorManagementParams::Illuminant::D65); + Wx = 0.95045471; + Wz = 1.08905029; - } else if (profile == "Beta RGB") { - p[0] = 0.6888; // Beta primaries - p[1] = 0.3112; - p[2] = 0.1986; - p[3] = 0.7551; - p[4] = 0.1265; - p[5] = 0.0352; - illum = toUnderlying(ColorManagementParams::Illuminant::D50); - Wx = 0.964295676; - Wz = 0.825104603; + } else if (profile == "Beta RGB") { + p[0] = 0.6888; // Beta primaries + p[1] = 0.3112; + p[2] = 0.1986; + p[3] = 0.7551; + p[4] = 0.1265; + p[5] = 0.0352; + illum = toUnderlying(ColorManagementParams::Illuminant::D50); + Wx = 0.964295676; + Wz = 0.825104603; - } else if (profile == "BestRGB") { - p[0] = 0.7347; // Best primaries - p[1] = 0.2653; - p[2] = 0.2150; - p[3] = 0.7750; - p[4] = 0.1300; - p[5] = 0.0350; - illum = toUnderlying(ColorManagementParams::Illuminant::D50); - Wx = 0.964295676; - Wz = 0.825104603; + } else if (profile == "BestRGB") { + p[0] = 0.7347; // Best primaries + p[1] = 0.2653; + p[2] = 0.2150; + p[3] = 0.7750; + p[4] = 0.1300; + p[5] = 0.0350; + illum = toUnderlying(ColorManagementParams::Illuminant::D50); + Wx = 0.964295676; + Wz = 0.825104603; - } else if (profile == "Rec2020") { - p[0] = 0.7080; // Rec2020 primaries - p[1] = 0.2920; - p[2] = 0.1700; - p[3] = 0.7970; - p[4] = 0.1310; - p[5] = 0.0460; - tempv4 = 6504.; - illum = toUnderlying(ColorManagementParams::Illuminant::D65); - Wx = 0.95045471; - Wz = 1.08905029; + } else if (profile == "Rec2020") { + p[0] = 0.7080; // Rec2020 primaries + p[1] = 0.2920; + p[2] = 0.1700; + p[3] = 0.7970; + p[4] = 0.1310; + p[5] = 0.0460; + tempv4 = 6504.; + illum = toUnderlying(ColorManagementParams::Illuminant::D65); + Wx = 0.95045471; + Wz = 1.08905029; - } else if (profile == "ACESp0") { - p[0] = 0.7347; // ACES P0 primaries - p[1] = 0.2653; - p[2] = 0.0000; - p[3] = 1.0; - p[4] = 0.0001; - p[5] = -0.0770; - tempv4 = 6004.; - illum = toUnderlying(ColorManagementParams::Illuminant::D60); - Wx = 0.952646075; - Wz = 1.008825184; + } else if (profile == "ACESp0") { + p[0] = 0.7347; // ACES P0 primaries + p[1] = 0.2653; + p[2] = 0.0000; + p[3] = 1.0; + p[4] = 0.0001; + p[5] = -0.0770; + tempv4 = 6004.; + illum = toUnderlying(ColorManagementParams::Illuminant::D60); + Wx = 0.952646075; + Wz = 1.008825184; - } else if (profile == "JDCmax") { - p[0] = 0.734702; // JDC max primaries - p[1] = 0.265302; - p[2] = 0.021908; - p[3] = 0.930288; - p[4] = 0.120593; - p[5] = 0.001583; - illum = toUnderlying(ColorManagementParams::Illuminant::D50); - Wx = 0.964295676; - Wz = 0.825104603; + } else if (profile == "JDCmax") { + p[0] = 0.734702; // JDC max primaries + p[1] = 0.265302; + p[2] = 0.021908; + p[3] = 0.930288; + p[4] = 0.120593; + p[5] = 0.001583; + illum = toUnderlying(ColorManagementParams::Illuminant::D50); + Wx = 0.964295676; + Wz = 0.825104603; - } else if (profile == "ACESp1") { - p[0] = 0.713; // ACES P1 primaries - p[1] = 0.293; - p[2] = 0.165; - p[3] = 0.830; - p[4] = 0.128; - p[5] = 0.044; - tempv4 = 6004.; - illum = toUnderlying(ColorManagementParams::Illuminant::D60); - Wx = 0.952646075; - Wz = 1.008825184; + } else if (profile == "JDCmax stdA") { + p[0] = 0.734702; // JDC max primaries and stdA + p[1] = 0.265302; + p[2] = 0.021908; + p[3] = 0.930288; + p[4] = 0.120593; + p[5] = 0.001583; + illum = toUnderlying(ColorManagementParams::Illuminant::STDA); + Wx = 1.098500393; + Wz = 0.355848714; - } else if (profile == "ProPhoto") { - p[0] = 0.7347; //ProPhoto and default primaries - p[1] = 0.2653; - p[2] = 0.1596; - p[3] = 0.8404; - p[4] = 0.0366; - p[5] = 0.0001; - illum = toUnderlying(ColorManagementParams::Illuminant::D50); - Wx = 0.964295676; - Wz = 0.825104603; + } else if (profile == "ACESp1") { + p[0] = 0.713; // ACES P1 primaries + p[1] = 0.293; + p[2] = 0.165; + p[3] = 0.830; + p[4] = 0.128; + p[5] = 0.044; + tempv4 = 6004.; + illum = toUnderlying(ColorManagementParams::Illuminant::D60); + Wx = 0.952646075; + Wz = 1.008825184; - } else if (profile == "Custom") { - p[0] = redxx; - p[1] = redyy; - p[2] = grexx; - p[3] = greyy; - p[4] = bluxx; - p[5] = bluyy; - } else { - p[0] = 0.7347; //default primaries always unused - p[1] = 0.2653; - p[2] = 0.1596; - p[3] = 0.8404; - p[4] = 0.0366; - p[5] = 0.0001; + } else if (profile == "ProPhoto") { + p[0] = 0.7347; //ProPhoto and default primaries + p[1] = 0.2653; + p[2] = 0.1596; + p[3] = 0.8404; + p[4] = 0.0366; + p[5] = 0.0001; + illum = toUnderlying(ColorManagementParams::Illuminant::D50); + Wx = 0.964295676; + Wz = 0.825104603; + + } else if (profile == "Custom") { + p[0] = redxx; + p[1] = redyy; + p[2] = grexx; + p[3] = greyy; + p[4] = bluxx; + p[5] = bluyy; + + } else { + p[0] = 0.7347; //default primaries always unused + p[1] = 0.2653; + p[2] = 0.1596; + p[3] = 0.8404; + p[4] = 0.0366; + p[5] = 0.0001; + } } + if (slpos == 0) { slpos = eps; } @@ -827,153 +1238,192 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, gammaParams[3] = 1. / slpos; gammaParams[5] = 0.0; gammaParams[6] = 0.0; - // printf("ga0=%f ga1=%f ga2=%f ga3=%f ga4=%f\n", ga0, ga1, ga2, ga3, ga4); + if(rtengine::settings->verbose) { + printf("ga0=%f ga1=%f ga2=%f ga3=%f ga4=%f\n", gammaParams[0], gammaParams[1], gammaParams[2], gammaParams[3], gammaParams[4]); + } // 7 parameters for smoother curves - cmsCIExyY xyD; +// cmsCIExyY xyD; Glib::ustring ills = "D50"; - switch (ColorManagementParams::Illuminant(illum)) { - case ColorManagementParams::Illuminant::DEFAULT: - case ColorManagementParams::Illuminant::STDA: - case ColorManagementParams::Illuminant::TUNGSTEN_2000K: - case ColorManagementParams::Illuminant::TUNGSTEN_1500K: { - break; + if (locprim == 0 && mul == 5) { + + switch (ColorManagementParams::Illuminant(illum)) { + case ColorManagementParams::Illuminant::DEFAULT: + case ColorManagementParams::Illuminant::STDA: + case ColorManagementParams::Illuminant::TUNGSTEN_2000K: + case ColorManagementParams::Illuminant::TUNGSTEN_1500K: + case ColorManagementParams::Illuminant::E:{ + break; + } + + case ColorManagementParams::Illuminant::D41: { + tempv4 = 4100.; + ills = "D41"; + break; + } + + case ColorManagementParams::Illuminant::D50: { + tempv4 = 5003.; + ills = "D50"; + break; + } + + case ColorManagementParams::Illuminant::D55: { + tempv4 = 5500.; + ills = "D55"; + break; + } + + case ColorManagementParams::Illuminant::D60: { + tempv4 = 6004.; + ills = "D60"; + break; + } + + case ColorManagementParams::Illuminant::D65: { + tempv4 = 6504.; + ills = "D65"; + break; + } + + case ColorManagementParams::Illuminant::D80: { + tempv4 = 8000.; + ills = "D80"; + break; + } + + case ColorManagementParams::Illuminant::D120: { + tempv4 = 12000.; + ills = "D120"; + break; + } } - case ColorManagementParams::Illuminant::D41: { - tempv4 = 4100.; - ills = "D41"; - break; - } + cmsWhitePointFromTemp(&xyD, tempv4); - case ColorManagementParams::Illuminant::D50: { - tempv4 = 5003.; - ills = "D50"; - break; - } + switch (ColorManagementParams::Illuminant(illum)) { + case ColorManagementParams::Illuminant::DEFAULT: { + break; + } - case ColorManagementParams::Illuminant::D55: { - tempv4 = 5500.; - ills = "D55"; - break; - } + case ColorManagementParams::Illuminant::D55: { + Wx = 0.956565934; + Wz = 0.920253249; + break; + } - case ColorManagementParams::Illuminant::D60: { - tempv4 = 6004.; - ills = "D60"; - break; - } + case ColorManagementParams::Illuminant::D80: { + Wx = 0.950095542; + Wz = 1.284213976; + break; + } - case ColorManagementParams::Illuminant::D65: { - tempv4 = 6504.; - ills = "D65"; - break; - } + case ColorManagementParams::Illuminant::D41: { + Wx = 0.991488263; + Wz = 0.631604625; + break; + } - case ColorManagementParams::Illuminant::D80: { - tempv4 = 8000.; - ills = "D80"; - break; - } + case ColorManagementParams::Illuminant::D50: { + xyD = {0.3457, 0.3585, 1.0}; // near LCMS values but not perfect... it's a compromise!! + Wx = 0.964295676; + Wz = 0.825104603; + break; + } - case ColorManagementParams::Illuminant::D120: { - tempv4 = 12000.; - ills = "D120"; - break; + case ColorManagementParams::Illuminant::D60: { + Wx = 0.952646075; + Wz = 1.008825184; + xyD = {0.32168, 0.33767, 1.0}; + break; + } + + case ColorManagementParams::Illuminant::D65: { + Wx = 0.95045471; + Wz = 1.08905029; + xyD = {0.312700492, 0.329000939, 1.0}; + break; + } + + case ColorManagementParams::Illuminant::D120: { + Wx = 0.979182; + Wz = 1.623623; + xyD = {0.269669, 0.28078, 1.0}; + break; + } + + case ColorManagementParams::Illuminant::STDA: { + Wx = 1.098500393; + Wz = 0.355848714; + xyD = {0.447573, 0.407440, 1.0}; + ills = "stdA 2875K"; + break; + } + + case ColorManagementParams::Illuminant::TUNGSTEN_2000K: { + Wx = 1.274335; + Wz = 0.145233; + xyD = {0.526591, 0.41331, 1.0}; + ills = "Tungsten 2000K"; + break; + } + + case ColorManagementParams::Illuminant::TUNGSTEN_1500K: { + Wx = 1.489921; + Wz = 0.053826; + xyD = {0.585703, 0.393157, 1.0}; + ills = "Tungsten 1500K"; + break; + } + + case ColorManagementParams::Illuminant::E: { + Wx = 1.; + Wz = 1.; + xyD = {0.33333, 0.33333, 1.0}; + ills = "E"; + break; + } + } } - cmsWhitePointFromTemp(&xyD, tempv4); + //xyD + //meanx, meany + // adjust refinement (purity) with a simple algorithm + if (mul == 5) { + double refin = 0.; - switch (ColorManagementParams::Illuminant(illum)) { - case ColorManagementParams::Illuminant::DEFAULT: { - break; + if (locprim == 1) { + refin = params->locallab.spots.at(sp).refi; + meanx += params->locallab.spots.at(sp).shiftxl; + meany += params->locallab.spots.at(sp).shiftyl; + } else if (locprim == 0) { + refin = params->icm.refi; + meanx += params->icm.shiftx; + meany += params->icm.shifty; } - case ColorManagementParams::Illuminant::D55: { - Wx = 0.956565934; - Wz = 0.920253249; - break; - } - - case ColorManagementParams::Illuminant::D80: { - Wx = 0.950095542; - Wz = 1.284213976; - break; - } - - case ColorManagementParams::Illuminant::D41: { - Wx = 0.991488263; - Wz = 0.631604625; - break; - } - - case ColorManagementParams::Illuminant::D50: { - xyD = {0.3457, 0.3585, 1.0}; // near LCMS values but not perfect... it's a compromise!! - Wx = 0.964295676; - Wz = 0.825104603; - break; - } - - case ColorManagementParams::Illuminant::D60: { - Wx = 0.952646075; - Wz = 1.008825184; - xyD = {0.32168, 0.33767, 1.0}; - break; - } - - case ColorManagementParams::Illuminant::D65: { - Wx = 0.95045471; - Wz = 1.08905029; - xyD = {0.312700492, 0.329000939, 1.0}; - break; - } - - case ColorManagementParams::Illuminant::D120: { - Wx = 0.979182; - Wz = 1.623623; - xyD = {0.269669, 0.28078, 1.0}; - break; - } - - case ColorManagementParams::Illuminant::STDA: { - Wx = 1.098500393; - Wz = 0.355848714; - xyD = {0.447573, 0.407440, 1.0}; - ills = "stdA 2875K"; - break; - } - - case ColorManagementParams::Illuminant::TUNGSTEN_2000K: { - Wx = 1.274335; - Wz = 0.145233; - xyD = {0.526591, 0.41331, 1.0}; - ills = "Tungsten 2000K"; - break; - } - - case ColorManagementParams::Illuminant::TUNGSTEN_1500K: { - Wx = 1.489921; - Wz = 0.053826; - xyD = {0.585703, 0.393157, 1.0}; - ills = "Tungsten 1500K"; - break; - } + double arefi = (xyD.y - meany) / (xyD.x - meanx); + double brefi = xyD.y - arefi * xyD.x; + double scalrefi = 0.98 * (meanx - xyD.x); + xyD.x = xyD.x + scalrefi * refin; + xyD.y = xyD.x * arefi + brefi; + // recalculate Wx Wy + Wx = xyD.x / xyD.y; + Wz = (1. - xyD.x - xyD.y) / xyD.y; } double wprofpri[9]; - if (gamutcontrol) { - //xyz in functiuon primaries and illuminant - Color::primaries_to_xyz(p, Wx, Wz, wprofpri); + //xyz in function primaries and illuminant + Color::primaries_to_xyz(p, Wx, Wz, wprofpri, cat); - for (int i = 0; i < 3; ++i) { - for (int j = 0; j < 3; ++j) { - wprofprim[i][j] = (double) wprofpri[j * 3 + i]; - //xyz in TMatrix format - } + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { + wprofprim[i][j] = (double) wprofpri[j * 3 + i]; + //xyz in TMatrix format } } @@ -996,11 +1446,17 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, cmsWriteTag(oprofdef, cmsSigBlueTRCTag, GammaTRC[2]); //to read XYZ values and illuminant - if (rtengine::settings->verbose) { + if (rtengine::settings->verbose && mul == 5) { cmsCIEXYZ *redT = static_cast(cmsReadTag(oprofdef, cmsSigRedMatrixColumnTag)); cmsCIEXYZ *greenT = static_cast(cmsReadTag(oprofdef, cmsSigGreenMatrixColumnTag)); cmsCIEXYZ *blueT = static_cast(cmsReadTag(oprofdef, cmsSigBlueMatrixColumnTag)); - printf("Illuminant=%s\n", ills.c_str()); + + if (locprim == 0) { + printf("Illuminant=%s\n", ills.c_str()); + } else { + printf("Illuminant=%s\n", params->locallab.spots.at(sp).illMethod.c_str()); + } + printf("rX=%f gX=%f bX=%f\n", redT->X, greenT->X, blueT->X); printf("rY=%f gY=%f bY=%f\n", redT->Y, greenT->Y, blueT->Y); printf("rZ=%f gZ=%f bZ=%f\n", redT->Z, greenT->Z, blueT->Z); @@ -1063,6 +1519,42 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, } } +// alternative to find dominant color xy +// Not use : +// 1) GUI complex at least for mean +// 2) small difference for meanxe, meanye with meanx , meany above in most cases + /* + if (locprim == 1) { + meanxe = 0.f; + meanye = 0.f; + + #ifdef _OPENMP + #pragma omp parallel for reduction(+:meanxe, meanye) if(multiThread) + #endif + for (int y = 0; y < ch ; ++y) { + for (int x = 0; x < cw ; ++x) { + const float RR = dst->r(y,x); + const float GG = dst->g(y,x); + const float BB = dst->b(y,x); + float xcb, ycb, zcb; + Color::rgbxyz(RR, GG, BB, xcb, ycb, zcb, wb2);//use sRGB Adobe Rec2020 ACESp0 + + float X_r = xcb; + float Y_r = ycb; + float Z_r = zcb; + Color::gamutmap(X_r, Y_r, Z_r, wb2);//gamut control + const float som = X_r + Y_r + Z_r; + X_r = X_r / som; + Y_r = Y_r / som; + meanxe += X_r; + meanye += Y_r; + } + } + meanxe /= (ch*cw); + meanye /= (ch*cw); + printf("DiffmeanxE=%f DiffmeanyE=%f \n", (double) (meanxe - meanx), (double) (meanye - meany)); + } + */ if (!keepTransForm) { cmsDeleteTransform(hTransform); hTransform = nullptr; diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index a3e9dee22..37ef276df 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - * 2016 - 2020 Jacques Desmis + * 2016 - 2024 Jacques Desmis * 2016 - 2020 Ingo Weyrich */ @@ -173,7 +173,8 @@ constexpr float exclusion(float a, float b) } void calcdif(float lmr, float &lmrc) -{ //approximative change between gamma sRGB g=2.4 s=12.92 and gamma LAB g=3.0 s=9.03 +{ + //approximative change between gamma sRGB g=2.4 s=12.92 and gamma LAB g=3.0 s=9.03 //useful to calculate action with dark and light area mask //differences in 3 parts linear...very small differences with real... float a0 = 7.6f / 11.6f;//11.6 sRGB - 7.6 Lab...11.6 max difference @@ -183,8 +184,9 @@ void calcdif(float lmr, float &lmrc) float b1 = 62.f - a1 * 60.f; float a2 = (100.f - 62.f) / (100.f - 60.f); float b2 = 100.f - a2 * 100.f; - if(lmr < 11.6f) { - lmrc = a0 * lmr; + + if (lmr < 11.6f) { + lmrc = a0 * lmr; } else if (lmr < 60.f) { lmrc = a1 * lmr + b1; } else { @@ -213,6 +215,7 @@ void calcGammaLut(double gamma, double ts, LUTf &gammaLut) #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 1024) #endif + for (int i = 0; i < 65536; i++) { const double x = rtengine::Color::igammareti(i / 65535.0, gamm, start, ts, mul, add); gammaLut[i] = 0.5 * rtengine::CLIP(x * 65535.0); // CLIP avoid in some case extra values @@ -221,6 +224,7 @@ void calcGammaLut(double gamma, double ts, LUTf &gammaLut) #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 1024) #endif + for (int i = 0; i < 65536; i++) { const double x = rtengine::Color::gammareti(i / 65535.0, gamm, start, ts, mul, add); gammaLut[i] = 0.5 * rtengine::CLIP(x * 65535.0); // CLIP avoid in some case extra values @@ -253,6 +257,7 @@ float calcLocalFactorrect(const float lox, const float loy, const float lcx, con const float ky = loy - lcy; float ref; + //gradient allows differentiation between transition x and y if (std::fabs(kx / (ky + eps)) < krap) { ref = std::sqrt(rtengine::SQR(dy) * (1.f + rtengine::SQR(kx / (ky + eps)))); @@ -307,6 +312,7 @@ void deltaEforLaplace(float *dE, const float lap, int bfw, int bfh, rtengine::La #ifdef _OPENMP #pragma omp parallel for reduction(max:maxC) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { const float val = std::sqrt((rtengine::SQR(refa - bufexporig->a[y][x]) + rtengine::SQR(refb - bufexporig->b[y][x])) + rtengine::SQR(refL - bufexporig->L[y][x])) / 327.68f; @@ -320,14 +326,15 @@ void deltaEforLaplace(float *dE, const float lap, int bfw, int bfh, rtengine::La } const float ade = 1.f / (maxdE - maxC); - // const float bde = -ade * maxC; + // const float bde = -ade * maxC; #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { - // dE[y * bfw + x] = dE[y * bfw + x] >= maxdE ? ade * dE[y * bfw + x] + bde : 1.f; + // dE[y * bfw + x] = dE[y * bfw + x] >= maxdE ? ade * dE[y * bfw + x] + bde : 1.f; dE[y * bfw + x] = dE[y * bfw + x] >= maxdE ? ade * (dE[y * bfw + x] - maxC) : 1.f; } @@ -391,23 +398,29 @@ void SobelCannyLuma(float **sobelL, float **luma, int bfw, int bfh, float radius for (int x = 0; x < bfw; x++) { sobelL[0][x] = 0.f; } + for (int y = 1; y < bfh - 1; y++) { sobelL[y][0] = 0.f; + for (int x = 1; x < bfw - 1; x++) { float sumXL = 0.f; float sumYL = 0.f; + for (int i = -1; i < 2; i += 2) { for (int j = -1; j < 2; j += 1) { sumXL += GX[j + 1][i + 1] * tmL[y + i][x + j]; sumYL += GY[j + 1][i + 1] * tmL[y + i][x + j]; } } + //Edge strength //we can add if need teta = atan2 (sumYr, sumXr) sobelL[y][x] = rtengine::min(std::sqrt(rtengine::SQR(sumXL) + rtengine::SQR(sumYL)), 32767.f); } + sobelL[y][bfw - 1] = 0.f; } + for (int x = 0; x < bfw; x++) { sobelL[bfh - 1][x] = 0.f; } @@ -422,7 +435,7 @@ float igammalog(float x, float p, float s, float g2, float g4) #ifdef __SSE2__ vfloat igammalog(vfloat x, vfloat p, vfloat s, vfloat g2, vfloat g4) { - // return x <= g2 ? x / s : pow_F((x + g4) / (1.f + g4), p);//continuous + // return x <= g2 ? x / s : pow_F((x + g4) / (1.f + g4), p);//continuous return vself(vmaskf_le(x, g2), x / s, pow_F((x + g4) / (F2V(1.f) + g4), p)); } #endif @@ -435,9 +448,9 @@ float gammalog(float x, float p, float s, float g3, float g4) #ifdef __SSE2__ vfloat gammalog(vfloat x, vfloat p, vfloat s, vfloat g3, vfloat g4) { - // return x <= g3 ? x * s : (1.f + g4) * xexpf(xlogf(x) / p) - g4;//continuous + // return x <= g3 ? x * s : (1.f + g4) * xexpf(xlogf(x) / p) - g4;//continuous return vself(vmaskf_le(x, g3), x * s, (F2V(1.f) + g4) * xexpf(xlogf(x) / p) - g4);//improve by Ingo - used by Nlmeans - + } #endif } @@ -459,7 +472,7 @@ struct local_params { float balance; float balanceh; int colorde; - int cir; + float cir; bool recur; float thr; float stru; @@ -685,7 +698,10 @@ struct local_params { float lowthrcie; float higthrcie; float decaycie; - + float blurciemask; + float contciemask; + bool islogcie; + bool issmoothcie; int noiselequal; float noisechrodetail; float bilat; @@ -702,8 +718,10 @@ struct local_params { float noisecf; float noisecc; float mulloc[6]; - int mullocsh[5]; + int mullocsh[6]; int detailsh; + int whitescie; + int midtcie; double tePivot; float threshol; float chromacb; @@ -778,7 +796,16 @@ struct local_params { float targetgray; float blackev; float whiteev; + float sourcegraycie; + float targetgraycie; + float blackevjz; + float whiteevjz; float detail; + float detailcie; + float strgradcie; + float anggradcie; + bool satcie; + bool satlog; int sensilog; int sensicie; int sensimas; @@ -816,6 +843,12 @@ struct local_params { float mLjz; float mCjz; float softrjz; + bool fftcieMask; + float comprlo; + float comprlocie; + int moka; + int sursouci; + int smoothciem; }; @@ -823,7 +856,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall { int w = oW; int h = oH; - int circr = locallab.spots.at(sp).circrad; + float circr = locallab.spots.at(sp).circrad; bool recur = locallab.spots.at(sp).recurs; float streng = ((float)locallab.spots.at(sp).stren); float gam = ((float)locallab.spots.at(sp).gamma); @@ -839,7 +872,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall // if (thre > 8.f || thre < 0.f) {//to avoid artifacts if user does not clear cache with new settings. Can be suppressed after // thre = 2.f; // } - thre = LIM(thre, 0.f, 10.0f); + thre = LIM(thre, 0.f, 15.0f); double local_x = locallab.spots.at(sp).loc.at(0) / 2000.0; double local_y = locallab.spots.at(sp).loc.at(2) / 2000.0; @@ -880,13 +913,14 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall } else if (locallab.spots.at(sp).gridMethod == "two") { lp.gridmet = 1; } -/* - if (locallab.spots.at(sp).expMethod == "std") { - lp.expmet = 0; - } else if (locallab.spots.at(sp).expMethod == "pde") { - lp.expmet = 1; - } -*/ + + /* + if (locallab.spots.at(sp).expMethod == "std") { + lp.expmet = 0; + } else if (locallab.spots.at(sp).expMethod == "pde") { + lp.expmet = 1; + } + */ lp.expmet = 1; if (locallab.spots.at(sp).localcontMethod == "loc") { @@ -898,15 +932,25 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.laplacexp = locallab.spots.at(sp).laplacexp; lp.balanexp = locallab.spots.at(sp).balanexp; lp.linear = locallab.spots.at(sp).linear; - if (locallab.spots.at(sp).spotMethod == "norm") { + + if (locallab.spots.at(sp).smoothciemet == "norm") { + lp.smoothciem = 1; + } else if (locallab.spots.at(sp).smoothciemet == "Ev") { + lp.smoothciem = 1; + } else if (locallab.spots.at(sp).smoothciemet == "gam") { + lp.smoothciem = 2; + } else if (locallab.spots.at(sp).smoothciemet == "gamnorol") { + lp.smoothciem = 3; + } + + if (locallab.spots.at(sp).smoothciemet == "none") { lp.fullim = 0; - } else if(locallab.spots.at(sp).spotMethod == "exc"){ + } else if (locallab.spots.at(sp).spotMethod == "exc") { lp.fullim = 1; - } else if (locallab.spots.at(sp).spotMethod == "full"){ + } else if (locallab.spots.at(sp).spotMethod == "full") { lp.fullim = 2; } - // printf("Lpfullim=%i\n", lp.fullim); - + lp.fftColorMask = locallab.spots.at(sp).fftColorMask; lp.prevdE = prevDeltaE; lp.showmaskcolmet = llColorMask; @@ -921,13 +965,15 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.showmaskcbmet = llcbMask; lp.showmaskretimet = llretiMask; lp.showmasksoftmet = llsoftMask; - + lp.showmasktmmet = lltmMask; lp.showmaskblmet = llblMask; lp.showmasklogmet = lllogMask; lp.showmask_met = ll_Mask; lp.showmaskciemet = llcieMask; -//printf("CIEmask=%i\n", lp.showmaskciemet); + lp.fftcieMask = locallab.spots.at(sp).fftcieMask; + lp.islogcie = locallab.spots.at(sp).logcie && locallab.spots.at(sp).expprecam; + lp.issmoothcie = locallab.spots.at(sp).smoothcie; lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llsoftMask == 0 && llColorMaskinv == 0 && llSHMaskinv == 0 && llColorMask == 0 && llExpMaskinv == 0 && lllcMask == 0 && llsharMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0;// Exposure mask is deactivated if Color & Light mask is visible lp.enaColorMaskinv = locallab.spots.at(sp).enaColorMask && llColorMaskinv == 0 && llSHMaskinv == 0 && llsoftMask == 0 && lllcMask == 0 && llsharMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0;// Exposure mask is deactivated if Color & Light mask is visible lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && llColorMask == 0 && llColorMaskinv == 0 && llsoftMask == 0 && lllcMask == 0 && llsharMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0;// Exposure mask is deactivated if Color & Light mask is visible @@ -936,7 +982,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.enaSHMaskinv = locallab.spots.at(sp).enaSHMask && llColorMaskinv == 0 && llSHMaskinv == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && lllcMask == 0 && llsoftMask == 0 && llsharMask == 0 && llColorMask == 0 && llExpMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0; lp.enacbMask = locallab.spots.at(sp).enacbMask && llColorMaskinv == 0 && llcbMask == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && lllcMask == 0 && llsoftMask == 0 && llsharMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0; lp.enaretiMask = locallab.spots.at(sp).enaretiMask && llColorMaskinv == 0 && lllcMask == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && llsharMask == 0 && llsoftMask == 0 && llretiMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0; - lp.enatmMask = locallab.spots.at(sp).enatmMask && llColorMaskinv == 0 && lltmMask == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && lllcMask == 0 && llsoftMask == 0 && llsharMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && llblMask == 0 && llvibMask == 0&& lllogMask == 0 && ll_Mask == 0 && llcieMask == 0; + lp.enatmMask = locallab.spots.at(sp).enatmMask && llColorMaskinv == 0 && lltmMask == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && lllcMask == 0 && llsoftMask == 0 && llsharMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0; lp.enablMask = locallab.spots.at(sp).enablMask && llColorMaskinv == 0 && llblMask == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && lllcMask == 0 && llsoftMask == 0 && llsharMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0; lp.enavibMask = locallab.spots.at(sp).enavibMask && llvibMask == 0 && llColorMaskinv == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && lllcMask == 0 && llsoftMask == 0 && llsharMask == 0 && llColorMask == 0 && llExpMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llSHMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0; lp.enalcMask = locallab.spots.at(sp).enalcMask && lllcMask == 0 && llColorMaskinv == 0 && llExpMaskinv == 0 && llSHMaskinv == 0 && llcbMask == 0 && llsoftMask == 0 && llsharMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && lllogMask == 0 && ll_Mask == 0 && llcieMask == 0; @@ -986,7 +1032,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall } else if (locallab.spots.at(sp).quamethod == "none") { lp.quamet = 3; } -// printf("lpqualmet=%i\n", lp.quamet); + if (locallab.spots.at(sp).shMethod == "std") { lp.shmeth = 0; @@ -1006,13 +1052,14 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall } else if (locallab.spots.at(sp).medMethod == "99") { lp.medmet = 3; } -/* - if (locallab.spots.at(sp).blurMethod == "norm") { - lp.blurmet = 0; - } else if (locallab.spots.at(sp).blurMethod == "inv") { - lp.blurmet = 1; - } -*/ + + /* + if (locallab.spots.at(sp).blurMethod == "norm") { + lp.blurmet = 0; + } else if (locallab.spots.at(sp).blurMethod == "inv") { + lp.blurmet = 1; + } + */ if (locallab.spots.at(sp).invbl == false) { lp.blurmet = 0; } else if (locallab.spots.at(sp).invbl == true) { @@ -1144,7 +1191,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall if (locallab.spots.at(sp).shape == "ELI") { lp.shapmet = 0; - } else /*if (locallab.spots.at(sp).shape == "RECT")*/ { + } else { /*if (locallab.spots.at(sp).shape == "RECT")*/ lp.shapmet = 1; } @@ -1178,8 +1225,9 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lnoiselc4 = 250.f * locwavCurveden[333]; lnoiselc5 = 250.f * locwavCurveden[416]; lnoiselc6 = 250.f * locwavCurveden[500]; - } + } } + lp.wavcurvedenoi = wavcurveden; float local_noiseldetail = (float)locallab.spots.at(sp).noiselumdetail; int local_noiselequal = locallab.spots.at(sp).noiselequal; @@ -1255,9 +1303,9 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall multi[y] = ((float) locallab.spots.at(sp).mult[y]); } - float multish[5]; + float multish[6]; - for (int y = 0; y < 5; y++) { + for (int y = 0; y < 6; y++) { multish[y] = ((float) locallab.spots.at(sp).multsh[y]); } @@ -1420,7 +1468,33 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.targetgray = (float) locallab.spots.at(sp).targetGray; lp.blackev = (float) locallab.spots.at(sp).blackEv; lp.whiteev = (float) locallab.spots.at(sp).whiteEv; + lp.sourcegraycie = (float) locallab.spots.at(sp).sourceGraycie; + lp.targetgraycie = (float) locallab.spots.at(sp).targetGraycie; + + if (locallab.spots.at(sp).modecam == "cam16") { + lp.moka = 1; + } else if (locallab.spots.at(sp).modecam == "jz") { + lp.moka = 2; + } + + if (locallab.spots.at(sp).sursourcie == "Average") { + lp.sursouci = 0; + } else if (locallab.spots.at(sp).sursourcie == "Dim") { + lp.sursouci = 1; + } else if (locallab.spots.at(sp).sursourcie == "Dark") { + lp.sursouci = 2; + } else if (locallab.spots.at(sp).sursourcie == "exDark") { + lp.sursouci = 3; + } else if (locallab.spots.at(sp).sursourcie == "disacie") { + lp.sursouci = 4; + } + + lp.satcie = (float) locallab.spots.at(sp).satcie; + lp.satlog = (float) locallab.spots.at(sp).satlog; + lp.blackevjz = (float) locallab.spots.at(sp).blackEvjz; + lp.whiteevjz = (float) locallab.spots.at(sp).whiteEvjz; lp.detail = locallab.spots.at(sp).detail; + lp.detailcie = 0.01 * locallab.spots.at(sp).detailcie; lp.sensilog = locallab.spots.at(sp).sensilog; lp.Autogray = locallab.spots.at(sp).Autogray; lp.autocompute = locallab.spots.at(sp).autocompute; @@ -1430,6 +1504,15 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float blendmaskcie = ((float) locallab.spots.at(sp).blendmaskcie) / 100.f ; float radmaskcie = ((float) locallab.spots.at(sp).radmaskcie); float chromaskcie = ((float) locallab.spots.at(sp).chromaskcie); + float blurciemask = (float) locallab.spots.at(sp).blurcie; + float contciemask = (float) locallab.spots.at(sp).contcie; + float strgradcie = ((float) locallab.spots.at(sp).strgradcie); + float anggradcie = ((float) locallab.spots.at(sp).anggradcie); + + lp.comprlo = locallab.spots.at(sp).comprlog; + lp.comprlocie = locallab.spots.at(sp).comprcie; + + lp.deltaem = locallab.spots.at(sp).deltae; lp.scalereti = scaleret; lp.cir = circr; @@ -1460,7 +1543,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.angmaexp = angmaskexpo; lp.str_mas = strmask; lp.ang_mas = angmask; - + lp.strexp = strexpo; lp.angexp = angexpo; lp.strSH = strSH; @@ -1650,7 +1733,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.lowthrr = local_lowthrr; lp.higthrr = local_higthrr; lp.decayr = local_decayr; - + lp.recothrl = local_recothrl; lp.lowthrl = local_lowthrl; lp.higthrl = local_higthrl; @@ -1661,7 +1744,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.noiselc4 = lnoiselc4; lp.noiselc5 = lnoiselc5; lp.noiselc6 = lnoiselc6; - + lp.noisecf = local_noisecf; lp.noisecc = local_noisecc; lp.sensden = local_sensiden; @@ -1685,6 +1768,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.blurma = (float) locallab.spots.at(sp).blurmask; lp.fftma = locallab.spots.at(sp).fftmask; lp.contma = (float) locallab.spots.at(sp).contmask; + lp.blurciemask = blurciemask; + lp.contciemask = 0.01f * contciemask; + lp.strgradcie = strgradcie; + lp.anggradcie = anggradcie; lp.blendmacie = blendmaskcie; lp.radmacie = radmaskcie; @@ -1695,14 +1782,16 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.mulloc[y] = LIM(multi[y], 0.f, 4.f);//to prevent crash with old pp3 integer } - for (int y = 0; y < 5; y++) { + for (int y = 0; y < 6; y++) { lp.mullocsh[y] = multish[y]; } - lp.activspot = locallab.spots.at(sp).activ; - + lp.activspot = locallab.spots.at(sp).activ; lp.detailsh = locallab.spots.at(sp).detailSH; lp.tePivot = locallab.spots.at(sp).tePivot; + lp.whitescie = locallab.spots.at(sp).whitescie; + lp.midtcie = locallab.spots.at(sp).midtcie; + lp.threshol = thresho; lp.chromacb = chromcbdl; lp.expvib = locallab.spots.at(sp).expvibrance && lp.activspot ; @@ -1823,6 +1912,7 @@ static void calcTransition(const float lox, const float loy, const float ach, co if (!zone) { zone = (zoneVal > 1.f && ((SQR((lox - lp.xc) / (lp.lx)) + SQR((loy - lp.yc) / (lp.ly))) < 1.f)) ? 1 : 0; + if (zone == 1) { localFactor = pow_F(calcLocalFactor(lox, loy, lp.xc, lp.lx, lp.yc, lp.ly, ach, lp.transgrad), lp.transweak); } @@ -1833,6 +1923,7 @@ static void calcTransition(const float lox, const float loy, const float ach, co if (!zone) { zone = (zoneVal > 1.f && ((SQR((lox - lp.xc) / (lp.lx)) + SQR((loy - lp.yc) / (lp.lyT))) < 1.f)) ? 1 : 0; + if (zone == 1) { localFactor = pow_F(calcLocalFactor(lox, loy, lp.xc, lp.lx, lp.yc, lp.lyT, ach, lp.transgrad), lp.transweak); } @@ -1845,6 +1936,7 @@ static void calcTransition(const float lox, const float loy, const float ach, co if (!zone) { zone = (zoneVal > 1.f && ((SQR((lox - lp.xc) / (lp.lxL)) + SQR((loy - lp.yc) / (lp.lyT))) < 1.f)) ? 1 : 0; + if (zone == 1) { localFactor = pow_F(calcLocalFactor(lox, loy, lp.xc, lp.lxL, lp.yc, lp.lyT, ach, lp.transgrad), lp.transweak); } @@ -1855,6 +1947,7 @@ static void calcTransition(const float lox, const float loy, const float ach, co if (!zone) { zone = (zoneVal > 1.f && ((SQR((lox - lp.xc) / (lp.lxL)) + SQR((loy - lp.yc) / (lp.ly))) < 1.f)) ? 1 : 0; + if (zone == 1) { localFactor = pow_F(calcLocalFactor(lox, loy, lp.xc, lp.lxL, lp.yc, lp.ly, ach, lp.transgrad), lp.transweak); } @@ -1922,7 +2015,8 @@ float find_gray(float source_gray, float target_gray) return 0.f; // not found } -void ImProcFunctions::mean_sig (const float* const * const savenormL, float &meanf, float &stdf, int xStart, int xEnd, int yStart, int yEnd) const { +void ImProcFunctions::mean_sig(const float* const * const savenormL, float &meanf, float &stdf, int xStart, int xEnd, int yStart, int yEnd) const +{ const int size = (yEnd - yStart) * (xEnd - xStart); // use double precision for large accumulations double meand = 0.0; @@ -1930,18 +2024,21 @@ void ImProcFunctions::mean_sig (const float* const * const savenormL, float &mea #ifdef _OPENMP #pragma omp parallel for reduction(+:meand, stdd) if(multiThread) #endif + for (int y = yStart; y < yEnd; ++y) { for (int x = xStart; x < xEnd; ++x) { meand += static_cast(savenormL[y][x]); stdd += SQR(static_cast(savenormL[y][x])); } } + meand /= size; stdd /= size; stdd -= SQR(meand); stdf = std::sqrt(stdd); meanf = meand; } + // taken from darktable inline float power_norm(float r, float g, float b) { @@ -1953,7 +2050,7 @@ inline float power_norm(float r, float g, float b) float g2 = SQR(g); float b2 = SQR(b); float d = r2 + g2 + b2; - float n = r*r2 + g*g2 + b*b2; + float n = r * r2 + g * g2 + b * b2; return n / std::max(d, 1e-12f); } @@ -1969,12 +2066,15 @@ inline float gray2ev(float gray) return std::log2(0.18f / gray); } +// copyright 2018 Alberto Griggio inline float norm2(float r, float g, float b, TMatrix ws) { - return (power_norm(r, g, b) + Color::rgbLuminance(r, g, b, ws)) / 2.f; + constexpr float hi = std::numeric_limits::max() / 100.f; + return std::min(hi, power_norm(r, g, b) / 2.f + Color::rgbLuminance(r, g, b, ws) / 2.f); } + inline float norm(float r, float g, float b, TMatrix ws) { return (Color::rgbLuminance(r, g, b, ws)); @@ -1984,18 +2084,52 @@ inline float norm(float r, float g, float b, TMatrix ws) // basic log encoding taken from ACESutil.Lin_to_Log2, from // https://github.com/ampas/aces-dev // (as seen on pixls.us) +// copyright 2018 Alberto Griggio void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool multiThread, int bfw, int bfh) { - // BENCHFUN - const float gray = 0.01f * lp.sourcegray; - const float shadows_range = lp.blackev; + // BENCHFUN + float gray = 0.1f; + float shadows_range = 0.f; + bool comprlog = 0.f; + float comprfactorlog = 0.f; + float dynamic_range = 1.f; + float targray = 0.1f; + + bool satcontrol = false; + + if(lp.logena) { + gray = 0.01f * lp.sourcegray; + shadows_range = lp.blackev; + comprlog = lp.comprlo > 0.f; + comprfactorlog = lp.comprlo; + dynamic_range = max(lp.whiteev - lp.blackev, 0.5f); + targray = lp.targetgray; + satcontrol = lp.satlog; + + } else if (lp.cieena) { + gray = 0.01f * lp.sourcegraycie; + shadows_range = lp.blackevjz; + comprlog = lp.comprlocie > 0.f; + comprfactorlog = lp.comprlocie; + dynamic_range = max(lp.whiteevjz - lp.blackevjz, 0.5f); + targray = lp.targetgraycie; + satcontrol = lp.satcie; + } + float comprthlog = 1.f; - float dynamic_range = max(lp.whiteev - lp.blackev, 0.5f); const float noise = pow_F(2.f, -16.f); const float log2 = xlogf(2.f); - const float base = lp.targetgray > 1 && lp.targetgray < 100 && dynamic_range > 0 ? find_gray(std::abs(lp.blackev) / dynamic_range, 0.01f * lp.targetgray) : 0.f; + const float base = targray > 1 && targray < 100 && dynamic_range > 0 ? find_gray(std::abs(shadows_range) / dynamic_range, 0.01f * targray) : 0.f; const float linbase = rtengine::max(base, 2.f);//2 to avoid bad behavior TMatrix ws = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); + float ac = -5.f;//max 4 + float bc = 4.f; + if(comprlog < 0.6f) { + comprthlog = ac * comprlog + bc; + } else { + comprthlog = 1.f; + } + if (settings->verbose) { printf("Base Log encoding std=%5.1f\n", (double) linbase); } @@ -2009,9 +2143,16 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool x = rtengine::max(x, noise); x = rtengine::max(x / gray, noise); + if (comprlog && x >= comprthlog) + { + x = intp(comprfactorlog, (std::tanh((x - comprthlog) / comprthlog) + 1.f) * comprthlog, x); + } + + x = rtengine::max((xlogf(x) / log2 - shadows_range) / dynamic_range, noise); assert(x == x); + if (linbase > 0.f) { x = xlog2lin(x, linbase); @@ -2020,18 +2161,47 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool if (scale) { return x * 65535.f; - } else { + } else + { return x; } }; - const float detail = lp.detail; + const auto sf = + [=](float s, float c) -> float + { + if (c > noise) { + return 1.f - min(std::abs(s) / c, 1.f); + } else { + return 0.f; + } + }; +//added 2024 02 + const auto apply_sat = + [&](float &r, float &g, float &b, float f) -> void + { + float ll = Color::rgbLuminance(r, g, b, ws); + float rl = r - ll; + float gl = g - ll; + float bl = b - ll; + float s = intp(max(sf(rl, r), sf(gl, g), sf(bl, b)), pow_F(f, 0.3f) * 0.6f + 0.4f, 1.f); + r = ll + s * rl; + g = ll + s * gl; + b = ll + s * bl; + }; + + + float detail = lp.detail;//Log encoding + if(lp.cieena) {//Cam16 + detail = lp.detailcie; + } const int W = rgb->getWidth(), H = rgb->getHeight(); if (detail == 0.f) {//no local contrast #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < H; ++y) { for (int x = 0; x < W; ++x) { float r = rgb->r(y, x); @@ -2043,10 +2213,15 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool float mm = apply(m); float f = mm / m; f = min(f, 1000000.f); - + r *= f; b *= f; g *= f; + + if (satcontrol && f < 1.f) { + apply_sat(r, g, b, f); + } + r = CLIP(r); g = CLIP(g); b = CLIP(b); @@ -2071,6 +2246,7 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < H; ++y) { for (int x = 0; x < W; ++x) { Y2[y][x] = norm2(rgb->r(y, x), rgb->g(y, x), rgb->b(y, x), ws) / 65535.f; @@ -2080,6 +2256,7 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool assert(std::isfinite(Y[y][x])); } } + const float radius = rtengine::max(rtengine::max(bfw, W), rtengine::max(bfh, H)) / 30.f; const float epsilon = 0.005f; rtengine::guidedFilter(Y2, Y, Y, radius, epsilon, multiThread); @@ -2089,6 +2266,7 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < H; ++y) { for (int x = 0; x < W; ++x) { float &r = rgb->r(y, x); @@ -2104,28 +2282,36 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool float f2 = apply(t2) / t2; f = intp(blend, f, f2); f = min(f, 1000000.f); - - // assert(std::isfinite(f)); + + // assert(std::isfinite(f)); r *= f; g *= f; b *= f; r = CLIP(r); g = CLIP(g); b = CLIP(b); - // assert(std::isfinite(r)); - // assert(std::isfinite(g)); - // assert(std::isfinite(b)); + assert(std::isfinite(r)); + assert(std::isfinite(g)); + assert(std::isfinite(b)); + + if (satcontrol && f < 1.f) { + apply_sat(r, g, b, f); + } + + } } } } } - -void ImProcFunctions::getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, float *blackev, float *whiteev, bool *Autogr, float *sourceab, int fw, int fh, float xsta, float xend, float ysta, float yend, int SCALE) + +// Copyright 2018 Alberto Griggio +void ImProcFunctions::getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, float *blackev, float *whiteev, bool *Autogr, float *sourceab, int *whits, int *blacks, int *whitslog, int *blackslog, int fw, int fh, float xsta, float xend, float ysta, float yend, int SCALE) { //BENCHFUN //adpatation to local adjustments Jacques Desmis 12 2019 and 11 2021 (from ART) +// improvment white aand black toen_eqcam 9 2023 const PreviewProps pp(0, 0, fw, fh, SCALE); Imagefloat img(int(fw / SCALE + 0.5), int(fh / SCALE + 0.5)); @@ -2149,13 +2335,27 @@ void ImProcFunctions::getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, int www = int(fw / SCALE + 0.5); int hhh = int(fh / SCALE + 0.5); array2D YY(www, hhh); - double mean = 0.0; - int nc = 0; + int nc = 0; + + int whit = -whits[sp]; + int blac = -blacks[sp]; + + if(params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).Autograycie) { + ImProcFunctions::tone_eqcam2(this, &img, whit, blac, params->icm.workingProfile, SCALE, multiThread); + } + + int whitlog = -whitslog[sp]; + int blaclog = -blackslog[sp]; + + if(params->locallab.spots.at(sp).explog && params->locallab.spots.at(sp).autocompute) { + ImProcFunctions::tone_eqcam2(this, &img, whitlog, blaclog, params->icm.workingProfile, SCALE, multiThread); + } + for (int y = hsta; y < hend; ++y) { for (int x = wsta; x < wend; ++x) { const float r = img.r(y, x), g = img.g(y, x), b = img.b(y, x); - YY[y][x] = norm2(r, g, b, ws) / 65535.f;//norm2 to find a best color luminance response in RGB + YY[y][x] = norm2(r, g, b, ws) / 65535.f;//norm2 to find a best color luminance response in RGB mean += static_cast((float) ws[1][0] * Color::gamma_srgb(r) + (float) ws[1][1] * Color::gamma_srgb(g) + (float) ws[1][2] * Color::gamma_srgb(b)); //alternative to fing gray in case of above process does not works nc++; @@ -2165,15 +2365,18 @@ void ImProcFunctions::getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, for (int y = hsta; y < hend; ++y) { for (int x = wsta; x < wend; ++x) { float l = YY[y][x]; + if (l > noise) { minVal = min(minVal, l); maxVal = max(maxVal, l); } } } - - maxVal *= 1.45f; //(or 1.5f...) slightly increase max to take into account illuminance incident light - minVal *= 0.55f; //(or 0.5f...) slightly decrease min to take into account illuminance incident light + + + maxVal *= 1.5f; + minVal *= 0.5f; + //E = 2.5*2^EV => e=2.5 depends on the sensor type C=250 e=2.5 to C=330 e=3.3 //repartition with 2.5 between 1.45 Light and shadows 0.58 => a little more 0.55... // https://www.pixelsham.com/2020/12/26/exposure-value-measurements/ @@ -2200,7 +2403,7 @@ void ImProcFunctions::getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, for (int y = hsta; y < hend; ++y) { for (int x = wsta; x < wend; ++x) { - const float l = img.g(y, x) / 65535.f; + const float l = YY[y][x]; if (l >= gmin && l <= gmax) { tot += static_cast(l); @@ -2221,12 +2424,13 @@ void ImProcFunctions::getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, yb = 1.5f + 100.f * pow_F(mean, 1.8f);//empirical formula for Jz and log encode for low exposure images sourceg[sp] = yb; + if (settings->verbose) { std::cout << " no samples found in range, resorting to Yb gray point value " << sourceg[sp] << std::endl; } } } - + constexpr float MIN_WHITE = 2.f; constexpr float MAX_BLACK = -3.5f; @@ -2238,7 +2442,6 @@ void ImProcFunctions::getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, //calculate La - Absolute luminance shooting const FramesMetaData* metaData = imgsrc->getMetaData(); - float fnum = metaData->getFNumber(); // F number float fiso = metaData->getISOSpeed() ; // ISO float fspeed = metaData->getShutterSpeed() ; // Speed @@ -2252,17 +2455,19 @@ void ImProcFunctions::getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, double kexp = 0.; E_V += kexp * params->toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV E_V += 0.5 * std::log2(params->raw.expos); // exposure raw white point ; log2 ==> linear to EV - adap = pow(2.0, E_V - 3.0); // cd / m2 ==> 3.0 = log2(8) =>fnum*fnum/speed = Luminance (average scene) * fiso / K (K is the reflected-light meter calibration constant according to the sensors about 12.5 or 14 + adap = pow(2.0, E_V - 3.0); // cd / m2 ==> 3.0 = log2(8) =>fnum*fnum/speed = Luminance (average scene) * fiso / K (K is the reflected-light meter calibration constant according to the sensors about 12.5 or 14 // end calculation adaptation scene luminosity } - + sourceab[sp] = adap; } } + void tone_eq(ImProcFunctions *ipf, Imagefloat *rgb, const struct local_params &lp, const Glib::ustring &workingProfile, double scale, bool multithread) { + ToneEqualizerParams params; params.enabled = true; params.regularization = lp.detailsh; @@ -2270,6 +2475,181 @@ void tone_eq(ImProcFunctions *ipf, Imagefloat *rgb, const struct local_params &l std::copy(lp.mullocsh, lp.mullocsh + params.bands.size(), params.bands.begin()); ipf->toneEqualizer(rgb, params, workingProfile, scale, multithread); } + +void ImProcFunctions::tone_eqcam(ImProcFunctions *ipf, Imagefloat *rgb, int midtone, const Glib::ustring &workingProfile, double scale, bool multithread) +{ + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[2] = midtone; + params.bands[4] = 0; + params.bands[5] = 0; + int mid = abs(midtone); + int threshmid = 50; + if(mid > threshmid) { + params.bands[1] = sign(midtone) * (mid - threshmid); + params.bands[3] = sign(midtone) * (mid - threshmid); + } + + ipf->toneEqualizer(rgb, params, workingProfile, scale, multithread); +} + +void tone_eqsmooth(ImProcFunctions *ipf, Imagefloat *rgb, const struct local_params &lp, const Glib::ustring &workingProfile, double scale, bool multithread) +{ + //smooth highlights after TRC + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[1] = 0; + params.bands[2] = 0; + params.bands[3] = 0; + params.bands[4] = -30;//arbitrary value to adapt with WhiteEvjz - here White Ev # 10 + params.bands[5] = -100;//8 Ev and above + if(lp.whiteevjz < 6) {//EV = 6 majority of images + params.bands[4] = -15; + } + if(lp.islogcie) {//with log encoding Cie + params.bands[4] = -15; + params.bands[5] = -50; + if(lp.whiteevjz < 6) { + params.bands[4] = -10; + } + } + + ipf->toneEqualizer(rgb, params, workingProfile, scale, multithread); +} + +void ImProcFunctions::tone_eqcam2(ImProcFunctions *ipf, Imagefloat *rgb, int whits, int blacks, const Glib::ustring &workingProfile, double scale, bool multithread) +{ + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = blacks; + int bla = abs(blacks); + int threshblawhi = 50; + int threshblawhi2 = 70; + int threshblawhi3 = 40; + if(bla > threshblawhi) { + params.bands[1] = sign(blacks) * (bla - threshblawhi); + } + if(bla > threshblawhi2) { + params.bands[2] = sign(blacks) * (bla - threshblawhi2); + } + + params.bands[4] = whits; + int whi = abs(whits); + if(whi > threshblawhi) { + params.bands[3] = sign(whits) * (whi - threshblawhi); + } + if(whi > threshblawhi3) { + params.bands[5] = sign(whits) * (whi - threshblawhi3); + } + + ipf->toneEqualizer(rgb, params, workingProfile, scale, multithread); +} + + +// tone mapping from +// https://github.com/thatcherfreeman/utility-dctls/ +// Copyright of the original code +/* +MIT License + +Copyright (c) 2023 Thatcher Freeman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +/* +// I also took some code from Alberto Grigio +*/ +//Copyright (c) 2023 Thatcher Freeman +// Adapted to Rawtherapee Jacques Desmis mars 2024 jdesmis@gmail.com + +float rolloff_function(float x, float dr, float b, float c, float kmid) +{ + return (dr * (x / (x + b)) + c) * kmid;//Simple sigmoid (rather a polynomial asymptotic power function) ponderate with kmid - take into account if need Mean Yb scene and Mean Yb viewing and slope value +} +//Copyright (c) 2023 Thatcher Freeman +// Adapted to Rawtherapee Jacques Desmis mars 2024 jdesmis@gmail.com +float scene_contrast(float x, float mid_gray_scene, float gamma) +{ + return mid_gray_scene * std::pow(x / mid_gray_scene, gamma);//apply gamma +} +//Copyright (c) 2023 Thatcher Freeman +// Adapted to Rawtherapee Jacques Desmis mars 2024 jdesmis@gmail.com +float do_get(float x, bool rolloff_, float mid_gray_scene, float gamma, float dr, float b, float c, float kmid) +{ + if (rolloff_ && x <= mid_gray_scene) {//general smooth - till Yb scene + return x; + } else { + return rolloff_function(scene_contrast(x, mid_gray_scene, gamma), dr, b, c, kmid);//simulate polynomial power function with a slope to begin + } +} + +//Copyright (c) 2023 Thatcher Freeman +// Adapted to Rawtherapee Jacques Desmis 25 mars 2024 +void tonemapFreeman(float target_slope, float white_point, float black_point, float mid_gray_scene, float mid_gray_view, bool rolloff, LUTf& lut, int mode, bool scale) +{ + float dr;//Dynamic Range + float b; + float c;//black point + float gamma; + float mid_gray_scene_;//Mean luminance - Scene conditions + // mid_gray_view //Mean luminance - Viewing conditions + + c = black_point; + dr = white_point - c; + + if(scale) {//scale Yb mean luminance scene with white : dr and black + mid_gray_scene_ = mid_gray_scene * dr + c; + } else { + mid_gray_scene_ = mid_gray_scene; + } + + b = (dr / (mid_gray_scene_ - c)) * (1.f - ((mid_gray_scene_ - c) / dr)) * mid_gray_scene_;//b - ponderate mid_gray_scene taking into account the total DR, and the dark part below the mid_gray_scene + gamma = target_slope * (float) std::pow((mid_gray_scene_ + b), 2.0) / (dr * b);//Caculate gamma with slope and mid_gray_scene + float kmid = 1.f;//general case + if(mode == 3 && target_slope != 1.f) {//case tone-mapping + float midutil = mid_gray_view / mid_gray_scene;//take into account ratio between Yb source and Yb viewing + float midk = 1.f; + float k_slope = 2.2f; + if(target_slope >= 1.f) { + midk = pow_F(midutil, k_slope * (target_slope - 1.f));//ponderation in function target_slope when "slope user" < 1.f + } + kmid = midk; + } + if (settings->verbose) { + printf("b=%f gamma=%f slope=%f DynRange=%f kmid=%f black=%f Yb-scale=%f\n", (double) b, (double) gamma, (double) target_slope, (double) dr, (double) kmid, (double) c, (double) mid_gray_scene_); + } + //lut - take from Alberto Griggio + for (int i = 0; i < 65536; ++i) {// i - value image RGB + lut[i] = do_get(float(i) / 65535.f, rolloff, mid_gray_scene_, gamma, dr, b, c, kmid);//call main function + } +} + + void ImProcFunctions::loccont(int bfw, int bfh, LabImage* tmp1, float rad, float stren, int sk) { if (rad > 0.f) { @@ -2278,6 +2658,7 @@ void ImProcFunctions::loccont(int bfw, int bfh, LabImage* tmp1, float rad, float #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { LL[y][x] = tmp1->L[y][x]; @@ -2285,19 +2666,21 @@ void ImProcFunctions::loccont(int bfw, int bfh, LabImage* tmp1, float rad, float guide[y][x] = xlin2log(rtengine::max(ll, 0.f), 10.f); } } + array2D iL(bfw, bfh, LL, 0); float gu = stren * rad; int r = rtengine::max(int(gu / sk), 1); const double epsil = 0.001 * std::pow(2.f, -10); float st = 0.01f * rad; rtengine::guidedFilterLog(guide, 10.f, LL, r, epsil, false); - + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { - LL[y][x] = intp(st, LL[y][x] , iL[y][x]); + LL[y][x] = intp(st, LL[y][x], iL[y][x]); tmp1->L[y][x] = LL[y][x]; } } @@ -2332,80 +2715,101 @@ void ImProcFunctions::tone_eqdehaz(ImProcFunctions *ipf, Imagefloat *rgb, int wh } -void sigmoidla (float &valj, float thresj, float lambda) +void sigmoidla(float &valj, float thresj, float lambda) { //thres : shifts the action of sigmoid to darker tones or lights //lambda : changes the "slope" of the sigmoid. Low values give a flat curve, high values a "rectangular / orthogonal" curve - valj = 1.f / (1.f + xexpf(lambda - (lambda / thresj) * valj)); + valj = 1.f / (1.f + xexpf(lambda - (lambda / thresj) * valj)); } -void gamutjz (double &Jz, double &az, double &bz, double pl, const double wip[3][3], const float higherCoef, const float lowerCoef) -{//Not used...bad results - constexpr float ClipLevel = 65535.0f; - bool inGamut; - // int nb = 0; - do { - inGamut = true; - double L_, M_, S_; - double xx, yy, zz; - bool zcam = false; - Ciecam02::jzczhzxyz (xx, yy, zz, Jz, az, bz, pl, L_, M_, S_, zcam); - double x, y, z; - x = 65535. * (d65_d50[0][0] * xx + d65_d50[0][1] * yy + d65_d50[0][2] * zz); - y = 65535. * (d65_d50[1][0] * xx + d65_d50[1][1] * yy + d65_d50[1][2] * zz); - z = 65535. * (d65_d50[2][0] * xx + d65_d50[2][1] * yy + d65_d50[2][2] * zz); - float R,G,B; - Color:: xyz2rgb(x, y, z, R, G, B, wip); - if (rtengine::min(R, G, B) < 0.f || rtengine::max(R, G, B) > ClipLevel) { +void gamutjz(double &Jz, double &az, double &bz, double pl, const double wip[3][3], const float higherCoef, const float lowerCoef) +{ + //Not used...bad results + constexpr float ClipLevel = 65535.0f; + bool inGamut; + + // int nb = 0; + do { + inGamut = true; + double L_, M_, S_; + double xx, yy, zz; + bool zcam = false; + Ciecam02::jzczhzxyz(xx, yy, zz, Jz, az, bz, pl, L_, M_, S_, zcam); + double x, y, z; + x = 65535. * (d65_d50[0][0] * xx + d65_d50[0][1] * yy + d65_d50[0][2] * zz); + y = 65535. * (d65_d50[1][0] * xx + d65_d50[1][1] * yy + d65_d50[1][2] * zz); + z = 65535. * (d65_d50[2][0] * xx + d65_d50[2][1] * yy + d65_d50[2][2] * zz); + float R, G, B; + Color:: xyz2rgb(x, y, z, R, G, B, wip); + + if (rtengine::min(R, G, B) < 0.f || rtengine::max(R, G, B) > ClipLevel) { // nb++; - double hz = xatan2f(bz, az); - float2 sincosval = xsincosf(hz); - double Cz = sqrt(az * az + bz * bz); - // printf("cz=%f jz=%f" , (double) Cz, (double) Jz); - Cz *= (double) higherCoef; - if(Cz < 0.01 && Jz > 0.05) {//empirical values - Jz -= (double) lowerCoef; - } - az = clipazbz(Cz * (double) sincosval.y); - bz = clipazbz(Cz * (double) sincosval.x); - - inGamut = false; + double hz = xatan2f(bz, az); + float2 sincosval = xsincosf(hz); + double Cz = sqrt(az * az + bz * bz); + // printf("cz=%f jz=%f" , (double) Cz, (double) Jz); + Cz *= (double) higherCoef; + + if (Cz < 0.01 && Jz > 0.05) { //empirical values + Jz -= (double) lowerCoef; } - } while (!inGamut); + + az = clipazbz(Cz * (double) sincosval.y); + bz = clipazbz(Cz * (double) sincosval.x); + + inGamut = false; + } + } while (!inGamut); } -void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, LabImage* lab, int bfw, int bfh, int call, int sk, const LUTf& cielocalcurve, bool localcieutili, const LUTf& cielocalcurve2, bool localcieutili2, const LUTf& jzlocalcurve, bool localjzutili, const LUTf& czlocalcurve, bool localczutili, const LUTf& czjzlocalcurve, bool localczjzutili, const LocCHCurve& locchCurvejz, const LocHHCurve& lochhCurvejz, const LocLHCurve& loclhCurvejz, bool HHcurvejz, bool CHcurvejz, bool LHcurvejz, const LocwavCurve& locwavCurvejz, bool locwavutilijz -) +void ImProcFunctions::ciecamloc_02float(struct local_params& lp, int sp, LabImage* lab, int bfw, int bfh, int call, int sk, const LUTf& cielocalcurve, bool localcieutili, const LUTf& cielocalcurve2, bool localcieutili2, + const LUTf& jzlocalcurve, bool localjzutili, const LUTf& czlocalcurve, bool localczutili, const LUTf& czjzlocalcurve, bool localczjzutili, const LocCHCurve& locchCurvejz, const LocHHCurve& lochhCurvejz, const LocLHCurve& loclhCurvejz, bool HHcurvejz, bool CHcurvejz, bool LHcurvejz, + const LocwavCurve& locwavCurvejz, bool locwavutilijz, float &maxicam, float &contsig, float &lightsig + ) { // BENCHFUN -//possibility to reenable Zcam - if(!params->locallab.spots.at(sp).activ) {//disable all ciecam functions + if (!params->locallab.spots.at(sp).activ) { //disable all ciecam functions return; } + bool ciec = false; bool iscie = false; + if (params->locallab.spots.at(sp).ciecam && params->locallab.spots.at(sp).explog && call == 1) { ciec = true; iscie = false; - } - else if (params->locallab.spots.at(sp).expcie && call == 0) { + } else if (params->locallab.spots.at(sp).expcie && call == 0) { ciec = true; iscie = true; } + bool z_cam = false; //params->locallab.spots.at(sp).jabcie; //alaways use normal algorithm, Zcam giev often bad results bool jabcie = false;//always disabled bool islogjz = params->locallab.spots.at(sp).forcebw; bool issigjz = params->locallab.spots.at(sp).sigjz; bool issigq = params->locallab.spots.at(sp).sigq; - bool islogq = params->locallab.spots.at(sp).logcie; + // bool islogq = params->locallab.spots.at(sp).logcie; + // bool istrc = params->locallab.spots.at(sp).trccie; + bool issig = true; //params->locallab.spots.at(sp).sigcie; //sigmoid J Q variables - const float sigmoidlambda = params->locallab.spots.at(sp).sigmoidldacie; - const float sigmoidth = params->locallab.spots.at(sp).sigmoidthcie; - const float sigmoidbl = params->locallab.spots.at(sp).sigmoidblcie; - const bool sigmoidqj = params->locallab.spots.at(sp).sigmoidqjcie; + const float sigmoidlambda = params->locallab.spots.at(sp).sigmoidldacie; + const float sigmoidth = params->locallab.spots.at(sp).sigmoidthcie; + const float sigmoidbl = params->locallab.spots.at(sp).sigmoidblcie; + const bool sigmoidnorm = params->locallab.spots.at(sp).normcie; + int mobwev = 0; + float sumcamq01 = 0.5f; + if (params->locallab.spots.at(sp).bwevMethod == "none") { + mobwev = 0; + } else if (params->locallab.spots.at(sp).bwevMethod == "sig") { + mobwev = 1; + } else if (params->locallab.spots.at(sp).bwevMethod == "logsig") { + mobwev = 2; + } + + float senssig = (float) params->locallab.spots.at(sp).sigmoidsenscie; TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.workingProfile); const double wip[3][3] = {//improve precision with double {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, @@ -2415,41 +2819,45 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L float plum = (float) params->locallab.spots.at(sp).pqremapcam16; int mocam = 1; - if(params->locallab.spots.at(sp).modecam == "all") { - mocam = 10;//à remettre à 0 si modecam = "all" - } else if(params->locallab.spots.at(sp).modecam == "cam16") { + + if(lp.moka == 1) { mocam = 1; - } else if(params->locallab.spots.at(sp).modecam == "jz") { + } else if (lp.moka == 2) { mocam = 2; -// } else if(params->locallab.spots.at(sp).modecam == "zcam") { -// mocam = 3; } int mecamcurve = 0; - if(params->locallab.spots.at(sp).toneMethodcie == "one") { + + if (params->locallab.spots.at(sp).toneMethodcie == "one") { mecamcurve = 0; - } else if(params->locallab.spots.at(sp).toneMethodcie == "two") { + } else if (params->locallab.spots.at(sp).toneMethodcie == "two") { mecamcurve = 1; } int mecamcurve2 = 0; - if(params->locallab.spots.at(sp).toneMethodcie2 == "onec") { + + if (params->locallab.spots.at(sp).toneMethodcie2 == "onec") { mecamcurve2 = 0; - } else if(params->locallab.spots.at(sp).toneMethodcie2 == "twoc") { + } else if (params->locallab.spots.at(sp).toneMethodcie2 == "twoc") { mecamcurve2 = 1; - } else if(params->locallab.spots.at(sp).toneMethodcie2 == "thrc") { + } else if (params->locallab.spots.at(sp).toneMethodcie2 == "thrc") { mecamcurve2 = 2; } float th = 1.f; - const float at = 1.f - sigmoidth; - const float bt = sigmoidth; +// const float at = 1.f - sigmoidth; +// const float bt = sigmoidth; - const float ath = sigmoidth - 1.f; - const float bth = 1; - float sila = pow_F(sigmoidlambda, 0.5f); - const float sigm = 3.3f + 7.1f *(1.f - sila);//e^10.4 = 32860 => sigm vary from 3.3 to 10.4 - const float bl = sigmoidbl; + // const float ath = sigmoidth - 1.f; + // const float bth = 1; + float sila = pow_F(sigmoidlambda, senssig); + sila = LIM01(sila); + const float sigm = 3.3f + 7.1f * (1.f - sila); //e^10.4 = 32860 => sigm vary from 3.3 to 10.4 + float bl = std::min(sigmoidbl, 1.f);//reused old slider + if(params->locallab.spots.at(sp).logcieq) { + bl = 0.01f * (float) params->locallab.spots.at(sp).strcielog; + bl = std::min(bl, 1.f); + } //end sigmoid int width = lab->W, height = lab->H; @@ -2468,63 +2876,63 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L //for J light and contrast LUTf CAMBrightCurveJ(32768, LUT_CLIP_BELOW | LUT_CLIP_ABOVE); LUTf CAMBrightCurveQ(32768, LUT_CLIP_BELOW | LUT_CLIP_ABOVE); - + LUTf CAMBrightCurveQsig(32768, LUT_CLIP_BELOW | LUT_CLIP_ABOVE); #ifdef _OPENMP const int numThreads = min(max(width * height / 65536, 1), omp_get_max_threads()); #pragma omp parallel num_threads(numThreads) if(numThreads>1) #endif { - LUTu hist16Jthr(hist16J.getSize(), LUT_CLIP_BELOW | LUT_CLIP_ABOVE, true); - LUTu hist16Qthr(hist16Q.getSize(), LUT_CLIP_BELOW | LUT_CLIP_ABOVE, true); + LUTu hist16Jthr(hist16J.getSize(), LUT_CLIP_BELOW | LUT_CLIP_ABOVE, true); + LUTu hist16Qthr(hist16Q.getSize(), LUT_CLIP_BELOW | LUT_CLIP_ABOVE, true); #ifdef _OPENMP - #pragma omp for + #pragma omp for #endif - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { //rough correspondence between L and J - float currL = lab->L[i][j] / 327.68f; - float koef; //rough correspondence between L and J + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { //rough correspondence between L and J + float currL = lab->L[i][j] / 327.68f; + float koef; //rough correspondence between L and J - if (currL > 50.f) { - if (currL > 70.f) { - if (currL > 80.f) { - if (currL > 85.f) { - koef = 0.97f; + if (currL > 50.f) { + if (currL > 70.f) { + if (currL > 80.f) { + if (currL > 85.f) { + koef = 0.97f; + } else { + koef = 0.93f; + } } else { - koef = 0.93f; + koef = 0.87f; } } else { - koef = 0.87f; + if (currL > 60.f) { + koef = 0.85f; + } else { + koef = 0.8f; + } } } else { - if (currL > 60.f) { - koef = 0.85f; - } else { - koef = 0.8f; - } - } - } else { - if (currL > 10.f) { - if (currL > 20.f) { - if (currL > 40.f) { - koef = 0.75f; + if (currL > 10.f) { + if (currL > 20.f) { + if (currL > 40.f) { + koef = 0.75f; + } else { + koef = 0.7f; + } } else { - koef = 0.7f; + koef = 0.9f; } } else { - koef = 0.9f; + koef = 1.0; } - } else { - koef = 1.0; } + + hist16Jthr[(int)((koef * lab->L[i][j]))]++; //evaluate histogram luminance L # J + hist16Qthr[CLIP((int)(32768.f * sqrt((koef * (lab->L[i][j])) / 32768.f)))]++; //for brightness Q : approximation for Q=wh*sqrt(J/100) J not equal L } - - hist16Jthr[(int)((koef * lab->L[i][j]))]++; //evaluate histogram luminance L # J - hist16Qthr[CLIP((int)(32768.f * sqrt((koef * (lab->L[i][j])) / 32768.f)))]++; //for brightness Q : approximation for Q=wh*sqrt(J/100) J not equal L } - } #ifdef _OPENMP #pragma omp critical @@ -2545,7 +2953,8 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L float lightL = 0.f; float contQ = 0.f; float lightQ = 0.f; - if(iscie) { + + if (iscie) { contL = 0.6 * params->locallab.spots.at(sp).contlcie; //0.6 less effect, no need 1. lightL = 0.4 * params->locallab.spots.at(sp).lightlcie; //0.4 less effect, no need 1. contQ = 0.5 * params->locallab.spots.at(sp).contqcie; //0.5 less effect, no need 1. @@ -2555,55 +2964,86 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L lightL = 0.4 * params->locallab.spots.at(sp).lightl; //0.4 less effect, no need 1. contQ = 0.5 * params->locallab.spots.at(sp).contq; //0.5 less effect, no need 1. lightQ = 0.4 * params->locallab.spots.at(sp).lightq; //0.4 less effect, no need 1. - + } + float contthresL = 0.f; - - if(iscie) { + + if (iscie) { contthresL = params->locallab.spots.at(sp).contthrescie; } else { contthresL = params->locallab.spots.at(sp).contthres; } + float contthresQ = contthresL; - if(contL < 0.f) { + + if (contL < 0.f) { contthresL *= -1; - } + } + float thL = 0.6f; thL = 0.3f * contthresL + 0.6f; - - if(contQ < 0.f) { + + if (contQ < 0.f) { contthresQ *= -1; - } + } + float thQ = 0.6f; thQ = 0.3f * contthresQ + 0.6f; + float thQsig = 0.6f; Ciecam02::curveJfloat(lightL, contL, thL, hist16J, CAMBrightCurveJ); //lightness J and contrast J CAMBrightCurveJ /= 327.68f; + double podcont = 40.;//50 + double podcont0 = 40.;//50 + double podcont1 = 30.;//35. + double ka = -(podcont0 - podcont1) / 0.5; + double kb = podcont1 - ka; + + double podlight = 35.; + double podlight0 = 35.; + double podlight1 = 40.;//45 + double kal = -(podlight0 - podlight1) / 0.5; + double kbl = podlight1 - kal; + double contbase = params->locallab.spots.at(sp).sigmoidldacie; + + if(contbase <= 0.5) { + podcont = podcont0; + podlight = podlight0; + + } else { + podcont = ka * contbase + kb; + podlight = kal * contbase + kbl; + } Ciecam02::curveJfloat(lightQ, contQ, thQ, hist16Q, CAMBrightCurveQ); //brightness Q and contrast Q + lightsig = -podlight * contbase; + contsig = podcont * contbase; + Ciecam02::curveJfloat(lightsig, contsig, thQsig, hist16Q, CAMBrightCurveQsig); //brightness Q and contrast Q bypass. } - - + + int tempo = 5000; - if(params->locallab.spots.at(sp).expvibrance && call == 2) { + + if (params->locallab.spots.at(sp).expvibrance && call == 2) { if (params->locallab.spots.at(sp).warm > 0) { tempo = 5000 - 30 * params->locallab.spots.at(sp).warm; - } else if (params->locallab.spots.at(sp).warm < 0){ + } else if (params->locallab.spots.at(sp).warm < 0) { tempo = 5000 - 70 * params->locallab.spots.at(sp).warm; } } - if(ciec) { - if(iscie) { + if (ciec) { + if (iscie) { if (params->locallab.spots.at(sp).catadcie > 0) { tempo = 5000 - 30 * params->locallab.spots.at(sp).catadcie; - } else if (params->locallab.spots.at(sp).catadcie < 0){ + } else if (params->locallab.spots.at(sp).catadcie < 0) { tempo = 5000 - 70 * params->locallab.spots.at(sp).catadcie; } } else { if (params->locallab.spots.at(sp).catad > 0) { tempo = 5000 - 30 * params->locallab.spots.at(sp).catad; - } else if (params->locallab.spots.at(sp).catad < 0){ + } else if (params->locallab.spots.at(sp).catad < 0) { tempo = 5000 - 70 * params->locallab.spots.at(sp).catad; } } @@ -2619,19 +3059,26 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L nc = 1.00f; //viewing condition for surround f2 = 1.0f, c2 = 0.69f, nc2 = 1.0f; - if(ciec) { - if(iscie) { - //surround source with only 2 choices (because Log encoding before) - if (params->locallab.spots.at(sp).sursourcie == "Average") { + + if (ciec) { + if (iscie) { + //surround source with only 2 choices (because Log encoding before) + if(lp.sursouci == 0) { f = 1.0f, c = 0.69f, nc = 1.0f; - } else if (params->locallab.spots.at(sp).sursourcie == "Dim") { + } else if (lp.sursouci == 1){ f = 0.9f; c = 0.59f; nc = 0.9f; - } else if (params->locallab.spots.at(sp).sursourcie == "Dark") { + } else if (lp.sursouci == 2) { f = 0.8f; c = 0.525f; nc = 0.8f; + } else if (lp.sursouci == 3) { + f = 0.8f; + c = 0.41f; + nc = 0.8f; + } else if (lp.sursouci == 4) { + f = 1.0f, c = 0.702f, nc = 1.0f;//very small surround effect for Jz - Also disable Ciecam further } } else { if (params->locallab.spots.at(sp).sursour == "Average") { @@ -2644,11 +3091,15 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L f = 0.8f; c = 0.525f; nc = 0.8f; + } else if (params->locallab.spots.at(sp).sursour == "exDark") { + f = 0.8f; + c = 0.41f; + nc = 0.8f; } } //viewing condition for surround - if(iscie) { + if (iscie) { if (params->locallab.spots.at(sp).surroundcie == "Average") { f2 = 1.0f, c2 = 0.69f, nc2 = 1.0f; } else if (params->locallab.spots.at(sp).surroundcie == "Dim") { @@ -2680,7 +3131,7 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L c2 = 0.41f; nc2 = 0.8f; } - + } } @@ -2696,8 +3147,9 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L //La and la2 = ambiant luminosity scene and viewing la = 400.f; float la2 = 400.f; - if(ciec) { - if(iscie) { + + if (ciec) { + if (iscie) { la = params->locallab.spots.at(sp).sourceabscie; la2 = params->locallab.spots.at(sp).targabscie; } else { @@ -2712,8 +3164,9 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L //algoritm's params float yb = 18.f; yb2 = 18; - if(ciec) { - if(iscie) { + + if (ciec) { + if (iscie) { yb = params->locallab.spots.at(sp).sourceGraycie;// avgm = (double) pow_F(0.01f * (yb - 1.f), 0.45f);; yb2 = params->locallab.spots.at(sp).targetGraycie; @@ -2722,47 +3175,51 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L yb2 = params->locallab.spots.at(sp).targetGray; } } - if(params->locallab.spots.at(sp).expcie && call == 10 && params->locallab.spots.at(sp).modecam == "jz") { - yb = params->locallab.spots.at(sp).sourceGraycie;//for Jz calculate Yb and surround in Lab and cam16 before process Jz - la = params->locallab.spots.at(sp).sourceabscie; - if (params->locallab.spots.at(sp).sursourcie == "Average") { + if (params->locallab.spots.at(sp).expcie && call == 10 && params->locallab.spots.at(sp).modecam == "jz") { + yb = params->locallab.spots.at(sp).sourceGraycie;//for Jz calculate Yb and surround in Lab and cam16 before process Jz + la = params->locallab.spots.at(sp).sourceabscie; + if(lp.sursouci == 0) { f = 1.0f, c = 0.69f, nc = 1.0f; - } else if (params->locallab.spots.at(sp).sursourcie == "Dim") { + } else if (lp.sursouci == 1){ f = 0.9f; c = 0.59f; nc = 0.9f; - } else if (params->locallab.spots.at(sp).sursourcie == "Dark") { + } else if (lp.sursouci == 2) { f = 0.8f; c = 0.525f; nc = 0.8f; + } else if (lp.sursouci == 3) { + f = 0.8f; + c = 0.41f; + nc = 0.8f; + } else if (lp.sursouci == 4) { + f = 1.0f, c = 0.702f, nc = 1.0f;//very small surround effect for Jz } + } - + float schr = 0.f; float mchr = 0.f; float cchr = 0.f; float rstprotection = 0.f; float hue = 0.f; -/* - float mchrz = 0.f; - float schrz = 0.f; - float cchrz = 0.f; -*/ + if (ciec) { - if(iscie) { + if (iscie) { rstprotection = params->locallab.spots.at(sp).rstprotectcie; hue = params->locallab.spots.at(sp).huecie; cchr = params->locallab.spots.at(sp).chromlcie; + if (cchr == -100.0f) { - cchr = -99.8f; + cchr = -99.8f; } schr = params->locallab.spots.at(sp).saturlcie; if (schr > 0.f) { - schr = schr / 2.f; //divide sensibility for saturation + schr = schr / 2.f; //divide sensibility for saturation } if (schr == -100.f) { @@ -2774,24 +3231,22 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L if (mchr == -100.0f) { mchr = -99.8f ; } + if (mchr == 100.0f) { mchr = 99.9f; } -/* - mchrz = 0.5f * (float) params->locallab.spots.at(sp).colorflzcam; - schrz = 0.5f * (float) params->locallab.spots.at(sp).saturzcam; - cchrz = 0.5f * (float) params->locallab.spots.at(sp).chromzcam; -*/ + } else { cchr = params->locallab.spots.at(sp).chroml; + if (cchr == -100.0f) { - cchr = -99.8f; + cchr = -99.8f; } schr = params->locallab.spots.at(sp).saturl; if (schr > 0.f) { - schr = schr / 2.f; //divide sensibility for saturation + schr = schr / 2.f; //divide sensibility for saturation } if (schr == -100.f) { @@ -2803,6 +3258,7 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L if (mchr == -100.0f) { mchr = -99.8f ; } + if (mchr == 100.0f) { mchr = 99.9f; } @@ -2819,9 +3275,11 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L float cz, wh, pfl; int c16 = 16;//always cat16 bool c20 = true; - if(c20 && plum > 100.f) { + + if (c20 && plum > 100.f) { c16 = 21;//I define 21...for 2021 :) } + int level_bljz = params->locallab.spots.at(sp).csthresholdjz.getBottomLeft(); int level_hljz = params->locallab.spots.at(sp).csthresholdjz.getTopLeft(); int level_brjz = params->locallab.spots.at(sp).csthresholdjz.getBottomRight(); @@ -2842,17 +3300,20 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L ahighjz = 1.f / (level_hrjz - level_brjz); bhighjz = -ahighjz * level_brjz; } + float sigmalcjz = params->locallab.spots.at(sp).sigmalcjz; float jzamountchr = 0.01 * params->locallab.spots.at(sp).thrhjzcie; bool jzch = params->locallab.spots.at(sp).chjzcie; double jzamountchroma = 0.01 * settings->amchromajz; - if(jzamountchroma < 0.05) { + + if (jzamountchroma < 0.05) { jzamountchroma = 0.05; } - if(jzamountchroma > 2.) { + + if (jzamountchroma > 2.) { jzamountchroma = 2.; } - + Ciecam02::initcam1float(yb, pilot, f, la, xw, yw, zw, n, d, nbb, ncb, cz, aw, wh, pfl, fl, c, c16, plum); const float pow1 = pow_F(1.64f - pow_F(0.29f, n), 0.73f); float nj, nbbj, ncbj, czj, awj, flj; @@ -2862,7 +3323,8 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L #endif const float epsil = 0.0001f; const float coefQ = 32767.f / wh; - const float coefq = 1 / wh; + const float coefq = 1.f / wh; + const float pow1n = pow_F(1.64f - pow_F(0.29f, nj), 0.73f); const float coe = pow_F(fl, 0.25f); const float QproFactor = (0.4f / c) * (aw + 4.0f) ; @@ -2874,7 +3336,7 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L const double log2 = xlog(2.); const float log2f = xlogf(2.f); - if((mocam == 0 || mocam ==2) && call == 0) {//Jz az bz ==> Jz Cz Hz before Ciecam16 + if ((mocam == 2) && call == 0) { //Jz az bz ==> Jz Cz Hz before Ciecam16 double mini = 1000.; double maxi = -1000.; double sum = 0.; @@ -2890,13 +3352,13 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L bool Qtoj = params->locallab.spots.at(sp).qtoj;//betwwen lightness to brightness const bool logjz = params->locallab.spots.at(sp).logjz;//log encoding - //calculate min, max, mean for Jz #ifdef _OPENMP - #pragma omp parallel for reduction(min:mini) reduction(max:maxi) reduction(+:sum) if(multiThread) + #pragma omp parallel for reduction(min:mini) reduction(max:maxi) reduction(+:sum) if(multiThread) #endif - for (int i = 0; i < height; i+=1) { - for (int k = 0; k < width; k+=1) { + + for (int i = 0; i < height; i += 1) { + for (int k = 0; k < width; k += 1) { float L = lab->L[i][k]; float a = lab->a[i][k]; float b = lab->b[i][k]; @@ -2916,51 +3378,59 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L double L_p, M_p, S_p; bool zcam = z_cam; - Ciecam02::xyz2jzczhz (Jz, az, bz, xx, yy, zz, pl, L_p, M_p, S_p, zcam); - if(Jz > maxi) { + Ciecam02::xyz2jzczhz(Jz, az, bz, xx, yy, zz, pl, L_p, M_p, S_p, zcam); + + if (Jz > maxi) { maxi = Jz; } - if(Jz < mini) { + + if (Jz < mini) { mini = Jz; } + sum += Jz; - // I read bz, az values and Hz ==> with low chroma values Hz are very different from lab always around 1.4 radians ???? for blue... + // I read bz, az values and Hz ==> with low chroma values Hz are very different from lab always around 1.4 radians ???? for blue... } } + nc = height * width; sum = sum / nc; maxi += epsiljz; sum += epsiljz; - //remapping Jz - double ijz100 = 1./jz100; - double ajz = (ijz100 - 1.)/9.;//9 = sqrt(100) - 1 with a parabolic curve after jz100 - we can change for others curve ..log...(you must change also in locallabtool2) + //remapping Jz + double ijz100 = 1. / jz100; + double ajz = (ijz100 - 1.) / 9.; //9 = sqrt(100) - 1 with a parabolic curve after jz100 - we can change for others curve ..log...(you must change also in locallabtool2) double bjz = 1. - ajz; - //relation between adapjz and Absolute luminance source (La), adapjz =sqrt(La) - see locallabtool2 adapjzcie + //relation between adapjz and Absolute luminance source (La), adapjz =sqrt(La) - see locallabtool2 adapjzcie double interm = jz100 * (adapjz * ajz + bjz); double bj = (10. - maxi) / 9.; - double aj = maxi -bj; + double aj = maxi - bj; double to_screen = (aj * interm + bj) / maxi; //to screen - remapping of Jz in function real scene absolute luminance -// if (settings->verbose) { +// if (settings->verbose) { // printf("ajz=%f bjz=%f adapjz=%f jz100=%f interm=%f to-scrp=%f to_screen=%f\n", ajz, bjz, adapjz, jz100, interm ,to_screenp, to_screen); // } double to_one = 1.;//only for calculation in range 0..1 or 0..32768 to_one = 1 / (maxi * to_screen); - if(adapjz == 10.) {//force original algorithm if La > 10000 + + if (adapjz == 10.) { //force original algorithm if La > 10000 to_screen = 1.; } - if(Qtoj) { - double xxw = (d50_d65[0][0] * (double) Xw + d50_d65[0][1] * (double) Yw + d50_d65[0][2] * (double) Zw); - double yyw = (d50_d65[1][0] * (double) Xw + d50_d65[1][1] * (double) Yw + d50_d65[1][2] * (double) Zw); - double zzw = (d50_d65[2][0] * (double) Xw + d50_d65[2][1] * (double) Yw + d50_d65[2][2] * (double) Zw); - double L_pa, M_pa, S_pa; - Ciecam02::xyz2jzczhz (jzw, azw, bzw, xxw, yyw, zzw, pl, L_pa, M_pa, S_pa, z_cam); - if (settings->verbose) { //calculate Jz white for use of lightness instead brightness - printf("Jzwhite=%f \n", jzw); - } + + if (Qtoj) { + double xxw = (d50_d65[0][0] * (double) Xw + d50_d65[0][1] * (double) Yw + d50_d65[0][2] * (double) Zw); + double yyw = (d50_d65[1][0] * (double) Xw + d50_d65[1][1] * (double) Yw + d50_d65[1][2] * (double) Zw); + double zzw = (d50_d65[2][0] * (double) Xw + d50_d65[2][1] * (double) Yw + d50_d65[2][2] * (double) Zw); + double L_pa, M_pa, S_pa; + Ciecam02::xyz2jzczhz(jzw, azw, bzw, xxw, yyw, zzw, pl, L_pa, M_pa, S_pa, z_cam); + + if (settings->verbose) { //calculate Jz white for use of lightness instead brightness + printf("Jzwhite=%f \n", jzw); + } } + const std::unique_ptr temp(new LabImage(width, height)); const std::unique_ptr tempresid(new LabImage(width, height)); const std::unique_ptr tempres(new LabImage(width, height)); @@ -2973,20 +3443,21 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L int shtonals = params->locallab.spots.at(sp).shthjzcie; int radhs = params->locallab.spots.at(sp).radjzcie; float softjz = (float) params->locallab.spots.at(sp).softjzcie; - + avgm = 0.5 * (sum * to_screen * to_one + avgm);//empirical formula double miny = 0.1; double delta = 0.015 * (double) sqrt(std::max(100.f, la) / 100.f);//small adaptation in function La scene double maxy = 0.65;//empirical value - double maxreal = maxi*to_screen; - double maxjzw = jzw*to_screen; - if (settings->verbose) { + double maxreal = maxi * to_screen; + double maxjzw = jzw * to_screen; + + if (settings->verbose) { printf("La=%4.1f PU_adap=%2.1f maxi=%f mini=%f mean=%f, avgm=%f to_screen=%f Max_real=%f to_one=%f\n", (double) la, adapjz, maxi, mini, sum, avgm, to_screen, maxreal, to_one); } - const float sigmoidlambdajz = params->locallab.spots.at(sp).sigmoidldajzcie; - const float sigmoidthjz = params->locallab.spots.at(sp).sigmoidthjzcie; - const float sigmoidbljz = params->locallab.spots.at(sp).sigmoidbljzcie; + const float sigmoidlambdajz = params->locallab.spots.at(sp).sigmoidldajzcie; + const float sigmoidthjz = params->locallab.spots.at(sp).sigmoidthjzcie; + const float sigmoidbljz = params->locallab.spots.at(sp).sigmoidbljzcie; float thjz = 1.f; const float atjz = 1.f - sigmoidthjz; @@ -2995,9 +3466,9 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L const float athjz = sigmoidthjz - 1.f; const float bthjz = 1.f; float powsig = pow_F(sigmoidlambdajz, 0.5f); - const float sigmjz = 3.3f + 7.1f *(1.f - powsig);// e^10.4 = 32860 + const float sigmjz = 3.3f + 7.1f * (1.f - powsig); // e^10.4 = 32860 const float bljz = sigmoidbljz; - + double contreal = 0.2 * params->locallab.spots.at(sp).contjzcie; DiagonalCurve jz_contrast({ DCT_NURBS, @@ -3015,17 +3486,18 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L DCT_NURBS, 0, 0, miny, miny + lightreal / 150., - maxy, min (1.0, maxy + delta + lightreal / 300.0), + maxy, min(1.0, maxy + delta + lightreal / 300.0), 1, 1 }); DiagonalCurve jz_lightn({ DCT_NURBS, 0, 0, - max(0.0, miny - lightreal / 150.), miny , + max(0.0, miny - lightreal / 150.), miny, maxy + delta - lightreal / 300.0, maxy + delta, 1, 1 }); bool wavcurvejz = false; + if (locwavCurvejz && locwavutilijz) { for (int i = 0; i < 500; i++) { if (locwavCurvejz[i] != 0.5f) { @@ -3034,52 +3506,58 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L } } } + float mjjz = lp.mLjz; - if(wavcurvejz && lp.mLjz == 0.f) { + + if (wavcurvejz && lp.mLjz == 0.f) { mjjz = 0.0f;//to enable clarity if need in some cases mjjz = 0.0001f } - //log encoding Jz - double gray = 0.15; - /* - const double shadows_range = params->locallab.spots.at(sp).blackEvjz; - const double targetgray = params->locallab.spots.at(sp).targetjz; - double targetgraycor = 0.15; - double dynamic_range = std::max(params->locallab.spots.at(sp).whiteEvjz - shadows_range, 0.5); - const double noise = pow(2., -16.6);//16.6 instead of 16 a little less than others, but we work in double - const double log2 = xlog(2.); - */ - double base = 10.; - double linbase = 10.; - if(logjz) {//with brightness Jz - gray = 0.01 * params->locallab.spots.at(sp).sourceGraycie;//acts as amplifier (gain) : needs same type of modifications than targetgraycor with pow - gray = pow(gray, 1.2);//or 1.15 => modification to increase sensitivity gain, only on defaults, of course we can change this value manually...take into account suuround and Yb Cam16 - targetgraycor = pow(0.01 * targetgray, 1.15);//or 1.2 small reduce effect -> take into account a part of surround (before it was at 1.2) - base = targetgray > 1. && targetgray < 100. && dynamic_range > 0. ? (double) find_gray(std::abs((float) shadows_range) / (float) dynamic_range, (float) (targetgraycor)) : 0.; - linbase = std::max(base, 2.);//2. minimal base log to avoid very bad results - if (settings->verbose) { - printf("Base logarithm encoding Jz=%5.1f\n", linbase); + //log encoding Jz + double gray = 0.15; + /* + const double shadows_range = params->locallab.spots.at(sp).blackEvjz; + const double targetgray = params->locallab.spots.at(sp).targetjz; + double targetgraycor = 0.15; + double dynamic_range = std::max(params->locallab.spots.at(sp).whiteEvjz - shadows_range, 0.5); + const double noise = pow(2., -16.6);//16.6 instead of 16 a little less than others, but we work in double + const double log2 = xlog(2.); + */ + double base = 10.; + double linbase = 10.; + + if (logjz) { //with brightness Jz + gray = 0.01 * params->locallab.spots.at(sp).sourceGraycie;//acts as amplifier (gain) : needs same type of modifications than targetgraycor with pow + gray = pow(gray, 1.2);//or 1.15 => modification to increase sensitivity gain, only on defaults, of course we can change this value manually...take into account suuround and Yb Cam16 + targetgraycor = pow(0.01 * targetgray, 1.15);//or 1.2 small reduce effect -> take into account a part of surround (before it was at 1.2) + base = targetgray > 1. && targetgray < 100. && dynamic_range > 0. ? (double) find_gray(std::abs((float) shadows_range) / (float) dynamic_range, (float)(targetgraycor)) : 0.; + linbase = std::max(base, 2.);//2. minimal base log to avoid very bad results + + if (settings->verbose) { + printf("Base logarithm encoding Jz=%5.1f\n", linbase); + } } - } - const auto applytojz = - [ = ](double x) -> double { + const auto applytojz = + [ = ](double x) -> double { - x = std::max(x, noise); - x = std::max(x / gray, noise);//gray = gain - before log conversion - x = std::max((xlog(x) / log2 - shadows_range) / dynamic_range, noise);//x in range EV - assert(x == x); + x = std::max(x, noise); + x = std::max(x / gray, noise);//gray = gain - before log conversion + x = std::max((xlog(x) / log2 - shadows_range) / dynamic_range, noise);//x in range EV + assert(x == x); - if (linbase > 0.)//apply log base in function of targetgray blackEvjz and Dynamic Range - { - x = xlog2lin(x, linbase); - } - return x; - }; + if (linbase > 0.)//apply log base in function of targetgray blackEvjz and Dynamic Range + { + x = xlog2lin(x, linbase); + } + + return x; + }; #ifdef _OPENMP - #pragma omp parallel for if(multiThread) + #pragma omp parallel for if(multiThread) #endif + for (int i = 0; i < height; i++) { for (int k = 0; k < width; k++) { float L = lab->L[i][k]; @@ -3100,7 +3578,7 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L double L_p, M_p, S_p; bool zcam = z_cam; - Ciecam02::xyz2jzczhz (Jz, az, bz, xx, yy, zz, pl, L_p, M_p, S_p, zcam); + Ciecam02::xyz2jzczhz(Jz, az, bz, xx, yy, zz, pl, L_p, M_p, S_p, zcam); //remapping Jz Jz = Jz * to_screen; az = az * to_screen; @@ -3108,7 +3586,8 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L JJz[i][k] = Jz; Aaz[i][k] = az; Bbz[i][k] = bz; - if(highhs > 0 || shadhs > 0 || wavcurvejz || mjjz != 0.f || lp.mCjz != 0.f || LHcurvejz || HHcurvejz || CHcurvejz) { + + if (highhs > 0 || shadhs > 0 || wavcurvejz || mjjz != 0.f || lp.mCjz != 0.f || LHcurvejz || HHcurvejz || CHcurvejz) { //here we work in float with usual functions SH / wavelets / curves H temp->L[i][k] = tempresid->L[i][k] = tempres->L[i][k] = (float) to_one * 32768.f * (float) JJz[i][k]; temp->a[i][k] = tempresid->a[i][k] = tempres->a[i][k] = (float) to_one * 32768.f * (float) Aaz[i][k]; @@ -3117,11 +3596,12 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L } } - if(highhs > 0 || shadhs > 0) { + if (highhs > 0 || shadhs > 0) { ImProcFunctions::shadowsHighlights(temp.get(), true, 1, highhs, shadhs, radhs, sk, hltonahs * maxi * to_screen * to_one, shtonals * maxi * to_screen * to_one); #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int i = 0; i < height; i++) { for (int k = 0; k < width; k++) {//reinitialize datas after SH...: guide, etc. tempresid->L[i][k] = tempres->L[i][k] = temp->L[i][k]; @@ -3130,21 +3610,22 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L } } } + //others "Lab" treatment...to adapt - - if(wavcurvejz || mjjz != 0.f || lp.mCjz != 0.f) {//local contrast wavelet and clarity + + if (wavcurvejz || mjjz != 0.f || lp.mCjz != 0.f) { //local contrast wavelet and clarity #ifdef _OPENMP const int numThreads = omp_get_max_threads(); #else const int numThreads = 1; #endif - // adap maximum level wavelet to size of RT-spot + // adap maximum level wavelet to size of RT-spot int wavelet_level = 1 + params->locallab.spots.at(sp).csthresholdjz.getBottomRight();//retrieve with +1 maximum wavelet_level int minwin = rtengine::min(width, height); int maxlevelspot = 10;//maximum possible - // adapt maximum level wavelet to size of crop + // adapt maximum level wavelet to size of crop while ((1 << maxlevelspot) >= (minwin * sk) && maxlevelspot > 1) { --maxlevelspot ; } @@ -3152,23 +3633,27 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L wavelet_level = rtengine::min(wavelet_level, maxlevelspot); int maxlvl = wavelet_level; + //simple local contrast in function luminance if (locwavCurvejz && locwavutilijz && wavcurvejz) { float strengthjz = 1.2; std::unique_ptr wdspot(new wavelet_decomposition(temp->L[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen));//lp.daubLen + if (wdspot->memory_allocation_failed()) { return; } + maxlvl = wdspot->maxlevel(); wavlc(*wdspot, level_bljz, level_hljz, maxlvl, level_hrjz, level_brjz, ahighjz, bhighjz, alowjz, blowjz, sigmalcjz, strengthjz, locwavCurvejz, numThreads); wdspot->reconstruct(temp->L[0], 1.f); } + float thr = 0.001f; int flag = 2; - + // begin clarity wavelet jz - if(mjjz != 0.f || lp.mCjz != 0.f) { + if (mjjz != 0.f || lp.mCjz != 0.f) { float mL0 = 0.f; float mC0 = 0.f; bool exec = false; @@ -3190,18 +3675,20 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L thr = 1.f; flag = 2; } + LabImage *mergfile = temp.get(); #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int x = 0; x < height; x++) for (int y = 0; y < width; y++) { temp->L[x][y] = clipLoc((1.f + mL0) * mergfile->L[x][y] - mL * tempresid->L[x][y]); temp->a[x][y] = clipC((1.f + mC0) * mergfile->a[x][y] - mC * tempresid->a[x][y]); temp->b[x][y] = clipC((1.f + mC0) * mergfile->b[x][y] - mC * tempresid->b[x][y]); - } + } } - + if (lp.softrjz >= 0.5f && (wavcurvejz || std::fabs(mjjz) > 0.001f)) {//guidedfilter softproc(tempres.get(), temp.get(), lp.softrjz, height, width, 0.001, 0.00001, thr, sk, multiThread, flag); } @@ -3209,55 +3696,62 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L //new curves Hz #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < height; i++) { for (int k = 0; k < width; k++) { float j_z = temp->L[i][k]; float C_z = sqrt(SQR(temp->a[i][k]) + SQR(temp->b[i][k])); float c_z = C_z / 32768.f; + if (loclhCurvejz && LHcurvejz) {//Jz=f(Hz) curve float kcz = (float) jzamountchr; - float Hz = xatan2f (temp->b[i][k], temp->a[i][k]); + float Hz = xatan2f(temp->b[i][k], temp->a[i][k]); float l_r = j_z / 32768.f; float kcc = SQR(c_z / kcz); jzch = true; - if(jzch == false) { + + if (jzch == false) { kcc = 1.f; - } else if(kcc > 1.f) { + } else if (kcc > 1.f) { kcc = 1.f; //cbrt(kcc); } - float valparam = loclhCurvejz[500.f *static_cast(Color::huejz_to_huehsv2((float) Hz))] - 0.5f; + + float valparam = loclhCurvejz[500.f * static_cast(Color::huejz_to_huehsv2((float) Hz))] - 0.5f; float valparamneg; valparamneg = valparam; valparam *= 2.f * kcc; valparamneg *= kcc; - if (valparam > 0.f) { - l_r = (1.f - valparam) * l_r + valparam * (1.f - SQR(((SQR(1.f - min(l_r, 1.0f)))))); - } else - //for negative - { - float khue = 1.9f; //in reserve in case of! - l_r *= (1.f + khue * valparamneg); - } + + if (valparam > 0.f) { + l_r = (1.f - valparam) * l_r + valparam * (1.f - SQR(((SQR(1.f - min(l_r, 1.0f)))))); + } else + //for negative + { + float khue = 1.9f; //in reserve in case of! + l_r *= (1.f + khue * valparamneg); + } + temp->L[i][k] = l_r * 32768.f; } - + if (locchCurvejz && CHcurvejz) {//Cz=f(Hz) curve - float Hz = xatan2f (temp->b[i][k], temp->a[i][k]); - const float valparam = 1.5f * (locchCurvejz[500.f * static_cast(Color::huejz_to_huehsv2((float)Hz))] - 0.5f); //get valp=f(H) - float chromaCzfactor = 1.0f + valparam; - temp->a[i][k] *= chromaCzfactor; - temp->b[i][k] *= chromaCzfactor; + float Hz = xatan2f(temp->b[i][k], temp->a[i][k]); + const float valparam = 1.5f * (locchCurvejz[500.f * static_cast(Color::huejz_to_huehsv2((float)Hz))] - 0.5f); //get valp=f(H) + float chromaCzfactor = 1.0f + valparam; + temp->a[i][k] *= chromaCzfactor; + temp->b[i][k] *= chromaCzfactor; } - - - if (lochhCurvejz && HHcurvejz) { // Hz=f(Hz) - float Hz = xatan2f (temp->b[i][k], temp->a[i][k]); + + + if (lochhCurvejz && HHcurvejz) { // Hz=f(Hz) + float Hz = xatan2f(temp->b[i][k], temp->a[i][k]); const float valparam = 1.4f * (lochhCurvejz[500.f * static_cast(Color::huejz_to_huehsv2((float)Hz))] - 0.5f) + static_cast(Hz); Hz = valparam; - if ( Hz < 0.0f ) { + + if (Hz < 0.0f) { Hz += (2.f * rtengine::RT_PI_F); } @@ -3268,80 +3762,88 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L } } - if (loclhCurvejz && LHcurvejz && softjz > 0.f) {//Guidedilter for artifacts curve J(H) - float thr = 0.00001f; - int flag = 2; - float softjzr = 0.05f * softjz; - softproc(tempres.get(), temp.get(), softjzr, height, width, 0.000001, 0.00000001, thr, sk, multiThread, flag); - } + if (loclhCurvejz && LHcurvejz && softjz > 0.f) {//Guidedilter for artifacts curve J(H) + float thr = 0.00001f; + int flag = 2; + float softjzr = 0.05f * softjz; + softproc(tempres.get(), temp.get(), softjzr, height, width, 0.000001, 0.00000001, thr, sk, multiThread, flag); + } - if ((lochhCurvejz && HHcurvejz) || (locchCurvejz && CHcurvejz)) { //for artifacts curve H(H) - if(softjz > 0.f) { - array2D chro(width, height); - array2D hue(width, height); - array2D guid(width, height); - -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) -#endif - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - hue[y][x] = xatan2f(temp->b[y][x], temp->a[y][x]); - chro[y][x] = sqrt(SQR(temp->b[y][x]) + SQR(temp->a[y][x]))/32768.f; - if ( hue[y][x] < 0.0f ) { - hue[y][x] += (2.f * rtengine::RT_PI_F); - } - hue[y][x] /= (2.f * rtengine::RT_PI_F); - guid[y][x] = tempres->L[y][x] / 32768.f; - } - } - float softr = softjz; - const float tmpblur = softr < 0.f ? -1.f / softr : 1.f + softr; - const int r2 = rtengine::max(10 / sk * tmpblur + 0.2f, 1); - const int r1 = rtengine::max(4 / sk * tmpblur + 0.5f, 1); - constexpr float epsilmax = 0.0005f; - constexpr float epsilmin = 0.0000001f; - constexpr float aepsil = (epsilmax - epsilmin) / 100.f; - constexpr float bepsil = epsilmin; - const float epsil = softr < 0.f ? 0.001f : aepsil * softr + bepsil; - if (lochhCurvejz && HHcurvejz) { - rtengine::guidedFilter(guid, hue, hue, r2, 0.5f * epsil, multiThread); - } - if (locchCurvejz && CHcurvejz) { - rtengine::guidedFilter(guid, chro, chro, r1, 0.4f * epsil, multiThread); - } + if ((lochhCurvejz && HHcurvejz) || (locchCurvejz && CHcurvejz)) { //for artifacts curve H(H) + if (softjz > 0.f) { + array2D chro(width, height); + array2D hue(width, height); + array2D guid(width, height); #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - hue[y][x] *= (2.f * rtengine::RT_PI_F); - chro[y][x] *= 32768.f; - float2 sincosval = xsincosf(hue[y][x]); - temp->a[y][x] = chro[y][x] * sincosval.y; - temp->b[y][x] = chro[y][x] * sincosval.x; - } + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + hue[y][x] = xatan2f(temp->b[y][x], temp->a[y][x]); + chro[y][x] = sqrt(SQR(temp->b[y][x]) + SQR(temp->a[y][x])) / 32768.f; + + if (hue[y][x] < 0.0f) { + hue[y][x] += (2.f * rtengine::RT_PI_F); } + + hue[y][x] /= (2.f * rtengine::RT_PI_F); + guid[y][x] = tempres->L[y][x] / 32768.f; } - } + } + + float softr = softjz; + const float tmpblur = softr < 0.f ? -1.f / softr : 1.f + softr; + const int r2 = rtengine::max(10 / sk * tmpblur + 0.2f, 1); + const int r1 = rtengine::max(4 / sk * tmpblur + 0.5f, 1); + constexpr float epsilmax = 0.0005f; + constexpr float epsilmin = 0.0000001f; + constexpr float aepsil = (epsilmax - epsilmin) / 100.f; + constexpr float bepsil = epsilmin; + const float epsil = softr < 0.f ? 0.001f : aepsil * softr + bepsil; + + if (lochhCurvejz && HHcurvejz) { + rtengine::guidedFilter(guid, hue, hue, r2, 0.5f * epsil, multiThread); + } + + if (locchCurvejz && CHcurvejz) { + rtengine::guidedFilter(guid, chro, chro, r1, 0.4f * epsil, multiThread); + } + +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + hue[y][x] *= (2.f * rtengine::RT_PI_F); + chro[y][x] *= 32768.f; + float2 sincosval = xsincosf(hue[y][x]); + temp->a[y][x] = chro[y][x] * sincosval.y; + temp->b[y][x] = chro[y][x] * sincosval.x; + } + } + } + } /////////////////// - + #ifdef _OPENMP - #pragma omp parallel for if(multiThread) -#endif + #pragma omp parallel for if(multiThread) +#endif + for (int i = 0; i < height; i++) { for (int k = 0; k < width; k++) { //reconvert to double - if(highhs > 0 || shadhs > 0 || wavcurvejz || mjjz != 0.f || lp.mCjz != 0.f || LHcurvejz || HHcurvejz || CHcurvejz) { + if (highhs > 0 || shadhs > 0 || wavcurvejz || mjjz != 0.f || lp.mCjz != 0.f || LHcurvejz || HHcurvejz || CHcurvejz) { //now we work in double necessary for matrix conversion and when in range 0..1 with use of PQ - JJz[i][k] = (double) (temp->L[i][k] / (32768.f * (float) to_one)); - Aaz[i][k] = (double) (temp->a[i][k] / (32768.f * (float) to_one)); - Bbz[i][k] = (double) (temp->b[i][k] / (32768.f * (float) to_one)); + JJz[i][k] = (double)(temp->L[i][k] / (32768.f * (float) to_one)); + Aaz[i][k] = (double)(temp->a[i][k] / (32768.f * (float) to_one)); + Bbz[i][k] = (double)(temp->b[i][k] / (32768.f * (float) to_one)); } double az = Aaz[i][k]; @@ -3349,57 +3851,67 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L double Jz = LIM01(JJz[i][k]); Jz *= to_one; double Cz = sqrt(az * az + bz * bz); + //log encoding - if(logjz) { + if (logjz) { double jmz = Jz; + if (jmz > noise) { double mm = applytojz(jmz); double f = mm / jmz; Jz *= f; - //Cz *= f; Jz = LIM01(Jz);//clip values - //Cz = clipcz(Cz); } } + //sigmoid - if(issigjz && iscie) {//sigmoid Jz + if (issigjz && iscie) { //sigmoid Jz float val = Jz; - if(islogjz) { + + if (islogjz) { val = std::max((xlog(Jz) / log2 - shadows_range) / (dynamic_range + 1.5), noise);//in range EV } - if(sigmoidthjz >= 1.f) { + + if (sigmoidthjz >= 1.f) { thjz = athjz * val + bthjz;//threshold } else { thjz = atjz * val + btjz; } - sigmoidla (val, thjz, sigmjz);//sigmz "slope" of sigmoid - + + sigmoidla(val, thjz, sigmjz); //sigmz "slope" of sigmoid + Jz = LIM01((double) bljz * Jz + (double) val); } - if(Qtoj == true) {//lightness instead of brightness + if (Qtoj == true) { //lightness instead of brightness Jz /= to_one; Jz /= maxjzw;//Jz white Jz = SQR(Jz); } - //contrast - Jz= LIM01(jz_contrast.getVal(LIM01(Jz))); + + //contrast + Jz = LIM01(jz_contrast.getVal(LIM01(Jz))); + //brightness and lightness - if(lightreal > 0) { + if (lightreal > 0) { Jz = LIM01(jz_light.getVal(Jz)); } - if(lightreal < 0) { + + if (lightreal < 0) { Jz = LIM01(jz_lightn.getVal(Jz)); } + //Jz (Jz) curve double Jzold = Jz; - if(jzlocalcurve && localjzutili) { - Jz = (double) (jzlocalcurve[(float) Jz * 65535.f] / 65535.f); + + if (jzlocalcurve && localjzutili) { + Jz = (double)(jzlocalcurve[(float) Jz * 65535.f] / 65535.f); Jz = 0.3 * (Jz - Jzold) + Jzold; } + //reconvert from lightness or Brightness - if(Qtoj == false) { + if (Qtoj == false) { Jz /= to_one; } else { Jz = sqrt(Jz); @@ -3407,54 +3919,65 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L } double Hz; - //remapping Cz - Hz = xatan2 ( bz, az ); + //remapping Cz + Hz = xatan2(bz, az); double Czold = Cz; + //Cz(Cz) curve - if(czlocalcurve && localczutili) { - Cz = (double) (czlocalcurve[(float) Cz * 92666.f * (float) to_one] / (92666.f * (float) to_one)); + if (czlocalcurve && localczutili) { + Cz = (double)(czlocalcurve[(float) Cz * 92666.f * (float) to_one] / (92666.f * (float) to_one)); Cz = 0.5 * (Cz - Czold) + Czold; } + //Cz(Jz) curve - if(czjzlocalcurve && localczjzutili) { - double chromaCfactor = (double) (czjzlocalcurve[(float) Jz * 65535.f * (float) to_one]) / (Jz * 65535. * to_one); + if (czjzlocalcurve && localczjzutili) { + double chromaCfactor = (double)(czjzlocalcurve[(float) Jz * 65535.f * (float) to_one]) / (Jz * 65535. * to_one); Cz *= chromaCfactor; } + //Hz in 0 2*PI - if ( Hz < 0.0 ) { - Hz += (2. * rtengine::RT_PI); + if (Hz < 0.0) { + Hz += (2. * rtengine::RT_PI); } + //Chroma slider - if(chromz < 0.) { + if (chromz < 0.) { Cz = Cz * (1. + 0.01 * chromz); } else { double maxcz = czlim / to_one; double fcz = Cz / maxcz; - double pocz = pow(fcz , 1. - 0.0024 * chromz);//increase value - before 0.0017 + double pocz = pow(fcz, 1. - 0.0024 * chromz); //increase value - before 0.0017 Cz = maxcz * pocz; - // Cz = Cz * (1. + 0.005 * chromz);//linear + // Cz = Cz * (1. + 0.005 * chromz);//linear } + //saturation slider - if(saturz != 0.) { - double js = Jz/ maxjzw;//divide by Jz white + if (saturz != 0.) { + double js = Jz / maxjzw; //divide by Jz white js = SQR(js); - if(js <= 0.) { + + if (js <= 0.) { js = 0.0000001; } + double Sz = Cz / (js); - if(saturz < 0.) { + + if (saturz < 0.) { Sz = Sz * (1. + 0.01 * saturz); } else { Sz = Sz * (1. + 0.003 * saturz);//not pow function because Sz is "open" - 0.003 empirical value to have results comparable to Cz } + Cz = Sz * js; } - + //rotation hue Hz += dhue; - if ( Hz < 0.0 ) { - Hz += (2. * rtengine::RT_PI); + + if (Hz < 0.0) { + Hz += (2. * rtengine::RT_PI); } + Cz = clipcz(Cz); double2 sincosval = xsincos(Hz); az = clipazbz(Cz * sincosval.y); @@ -3466,16 +3989,17 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L az = az / (to_screen); Jz = LIM01(Jz / (to_screen)); - if(jabcie) {//Not used does not work at all + + if (jabcie) { //Not used does not work at all Jz = clipjz05(Jz); - gamutjz (Jz, az, bz, pl, wip, 0.94, 0.004); + gamutjz(Jz, az, bz, pl, wip, 0.94, 0.004); } double L_, M_, S_; double xx, yy, zz; bool zcam = z_cam; //reconvert to XYZ in double - Ciecam02::jzczhzxyz (xx, yy, zz, Jz, az, bz, pl, L_, M_, S_, zcam); + Ciecam02::jzczhzxyz(xx, yy, zz, Jz, az, bz, pl, L_, M_, S_, zcam); //re enable D50 double x, y, z; x = 65535. * (d65_d50[0][0] * xx + d65_d50[0][1] * yy + d65_d50[0][2] * zz); @@ -3490,35 +4014,36 @@ void ImProcFunctions::ciecamloc_02float(const struct local_params& lp, int sp, L } } } - -if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 vibrance warm-cool - call = 10 take into account "mean luminance Yb for Jz + //lp.sursouci==4 disable ciecam + if ((mocam == 1 && lp.sursouci!= 4)|| mocam ==2 || call == 1 || call == 2 || call == 10) { //CAM16 call=2 vibrance warm-cool - call = 10 take into account "mean luminance Yb for Jz //begin ciecam - if (settings->verbose && (mocam == 0 || mocam == 1 || call == 1)) {//display only if choice cam16 - //information on Cam16 scene conditions - allows user to see choices's incidences - float maxicam = -1000.f; - float maxicamq = -1000.f; - float maxisat = -1000.f; - float maxiM = -1000.f; - float minicam = 1000000.f; - float minicamq = 1000000.f; - float minisat = 1000000.f; - float miniM = 1000000.f; - int nccam = 0; - float sumcam = 0.f; - float sumcamq = 0.f; - float sumsat = 0.f; - float sumM = 0.f; - if(lp.logena && !(params->locallab.spots.at(sp).expcie && mocam == 1)) {//Log encoding only, but enable for log encoding if we use Cam16 module both with log encoding - plum = 100.f; - } + if (settings->verbose && (mocam == 1 || call == 1)) {//display only if choice cam16 + //information on Cam16 scene conditions - allows user to see choices's incidences + float maxicamq = -1000.f; + float maxicamj = -1000.f; + float maxisat = -1000.f; + float maxiM = -1000.f; + float minicam = 1000000.f; + float minicamq = 1000000.f; + float minisat = 1000000.f; + float miniM = 1000000.f; + int nccam = 0; + float sumcam = 0.f; + float sumcamq = 0.f; + float sumsat = 0.f; + float sumM = 0.f; + if (lp.logena && !(params->locallab.spots.at(sp).expcie && mocam == 1)) { //Log encoding only, but enable for log encoding if we use Cam16 module both with log encoding + plum = 100.f; + } - + //find main values Cam16 #ifdef _OPENMP - #pragma omp parallel for reduction(min:minicam) reduction(max:maxicam) reduction(min:minicamq) reduction(max:maxicamq) reduction(min:minisat) reduction(max:maxisat) reduction(min:miniM) reduction(max:maxiM) reduction(+:sumcam) reduction(+:sumcamq) reduction(+:sumsat) reduction(+:sumM)if(multiThread) + #pragma omp parallel for reduction(min:minicam) reduction(max:maxicamj) reduction(min:minicamq) reduction(max:maxicamq) reduction(min:minisat) reduction(max:maxisat) reduction(min:miniM) reduction(max:maxiM) reduction(+:sumcam) reduction(+:sumcamq) reduction(+:sumsat) reduction(+:sumM)if(multiThread) #endif - for (int i = 0; i < height; i+=1) { - for (int k = 0; k < width; k+=1) { + + for (int i = 0; i < height; i += 1) { + for (int k = 0; k < width; k += 1) { float L = lab->L[i][k]; float a = lab->a[i][k]; float b = lab->b[i][k]; @@ -3530,87 +4055,156 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 z = z / 655.35f; float J, C, h, Q, M, s; Ciecam02::xyz2jchqms_ciecam02float(J, C, h, - Q, M, s, aw, fl, wh, - x, y, z, - xw1, yw1, zw1, - c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); - if(J > maxicam) { - maxicam = J; + Q, M, s, aw, fl, wh, + x, y, z, + xw1, yw1, zw1, + c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); + + if (J > maxicamj) { + maxicamj = J; } - if(J < minicam) { + + if (J < minicam) { minicam = J; } + sumcam += J; - if(Q > maxicamq) { + if (Q > maxicamq) { maxicamq = Q; } - if(Q < minicamq) { + + if (Q < minicamq) { minicamq = Q; } + sumcamq += Q; - if(s > maxisat) { + if (s > maxisat) { maxisat = s; } - if(s < minisat) { + + if (s < minisat) { minisat = s; } + sumsat += s; - if(M > maxiM) { + if (M > maxiM) { maxiM = M; } - if(M < miniM) { + + if (M < miniM) { miniM = M; } - sumM += M; + sumM += M; + } + } + + nccam = height * width; + sumcam = sumcam / nccam; + sumcamq /= nccam; + sumsat /= nccam; + sumM /= nccam; + + if (settings->verbose) { + printf("Cam16 Scene Lighness_J Brightness_Q- HDR-PQ=%5.1f minJ=%3.1f maxJ=%3.1f meanJ=%3.1f minQ=%3.1f maxQ=%4.1f meanQ=%4.1f meanQ1=%2.3f\n", (double) plum, (double) minicam, (double) maxicamj, (double) sumcam, (double) minicamq, (double) maxicamq, (double) sumcamq, (double) (sumcamq * coefq)); + printf("Cam16 Scene Saturati-s Colorfulln_M- minSat=%3.1f maxSat=%3.1f meanSat=%3.1f minM=%3.1f maxM=%3.1f meanM=%3.1f\n", (double) minisat, (double) maxisat, (double) sumsat, (double) miniM, (double) maxiM, (double) sumM); + } + // maxicam = maxicamq;//maximum Brightness + if(sumcamq < maxicamq) { + // maxicam = sumcamq + 0.2f * minicamq;//maximum Brightness take into account + maxicam = sumcamq;//maximum Brightness take into account + //ponderate maxicam with mean and mini + } else { + maxicam = 0.4f * sumcamq + 0.6f * maxicamq; + } + sumcamq01 = sumcamq * coefq; + + } + + float base = 10.f; + float linbaseor = 10.f; + float linbase = 10.f; + float gray = 15.f; + + const bool compr = params->locallab.spots.at(sp).comprcie > 0.; + float comprfactor = params->locallab.spots.at(sp).comprcie; + float comprth = 1.f; //0.1 + params->locallab.spots.at(sp).comprcieth; + + double drref = 8.5; //Dynamic Range standard + + double drd = ((double) dynamic_range - drref) / drref; + + double dratt = (double) dynamic_range / drref; + comprfactor = 0.4f * comprfactor * (float) dratt;//adapt comprfactor to Dynamic Range + float newgray = 0.18f; + + if ((params->locallab.spots.at(sp).logcie && params->locallab.spots.at(sp).logcieq) || mobwev != 0) {//increase Dyn Range when log encoding + dynamic_range += 0.2;//empirical value + gray = 0.01f * (float) params->locallab.spots.at(sp).sourceGraycie; + const float targetgraycie = params->locallab.spots.at(sp).targetGraycie; + float targetgraycor = 0.01f * targetgraycie; + base = targetgraycie > 1.f && targetgraycie < 100.f && (float) dynamic_range > 0.f ? find_gray(std::abs((float) shadows_range) / (float) dynamic_range, (targetgraycor)) : 0.f; + linbaseor = std::max(base, 2.f);//2. minimal base log to avoid very bad results + + float maxQgray = coefq * maxicam / gray; + maxicam = maxQgray;//setting threshold comprcieth + const float log2 = xlogf(2.f); + + float corlog = xlogf(maxicam)/log2;//correction base logarithme + linbase = linbaseor / corlog; + newgray = gray; //gray - 0.022f * (6.f - maxicam);//empirical formula to take into account Q in DR. 6.f =>approach to mean overall images + + if (settings->verbose) { + printf("Gray=%1.3f newgray=%1.3f MaxicamQ=%3.2f Base log encode corrected Q=%5.1f Base log encode origig Q=%5.1f\n", (double) gray, (double) newgray, (double) maxicam, (double) linbase, (double) linbaseor); + } + + } + + const auto applytoq = + [ = ](float x) -> float { + + x = rtengine::max(x, (float) noise); + x = rtengine::max(x / newgray, (float) noise);//gray = gain - before log conversion + + if (compr && x >= comprth)//comprth = maxicam + { + x = intp(comprfactor, (std::tanh((x - comprth) / comprth) + 1.f) * comprth, x); //as sigmoid... but tanh (tg hyperbolic), inspired by the work of alberto Grigio + } + + x = rtengine::max((xlogf(x) / log2f - (float) shadows_range) / (float) dynamic_range, (float) noise);//x in range EV + assert(x == x); + + if (linbase > 0.f)//apply log base in function of targetgray blackEvjz and Dynamic Range + { + x = xlog2lin(x, linbase); + } + + return x; + }; + + //prepare Normalize luminance + float *datain = nullptr; + float *data = nullptr; + float *datanorm = nullptr; + + if ((sigmoidnorm && issigq) || params->locallab.spots.at(sp).logcieq) { + datain = new float[width* height]; + data = new float[width * height]; + datanorm = new float[width * height]; +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic, 16) +#endif + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + datain[(y) * width + (x)] = lab->L[y][x]; + } } } - nccam = height * width; - sumcam = sumcam / nccam; - sumcamq /= nccam; - sumsat /= nccam; - sumM /= nccam; - printf("Cam16 Scene Lighness_J Brightness_Q- HDR-PQ=%5.1f minJ=%3.1f maxJ=%3.1f meanJ=%3.1f minQ=%3.1f maxQ=%4.1f meanQ=%4.1f\n", (double) plum, (double) minicam, (double) maxicam, (double) sumcam, (double) minicamq, (double) maxicamq, (double) sumcamq); - printf("Cam16 Scene Saturati-s Colorfulln_M- minSat=%3.1f maxSat=%3.1f meanSat=%3.1f minM=%3.1f maxM=%3.1f meanM=%3.1f\n", (double) minisat, (double) maxisat, (double) sumsat, (double) miniM, (double) maxiM, (double) sumM); -} - - float base = 10.; - float linbase = 10.; - float gray = 15.; - if(islogq) {//with brightness Jz - gray = 0.01f * (float) params->locallab.spots.at(sp).sourceGraycie; - gray = pow_F(gray, 1.2f);//or 1.15 => modification to increase sensitivity gain, only on defaults, of course we can change this value manually...take into account suuround and Yb Cam16 - const float targetgraycie = params->locallab.spots.at(sp).targetGraycie; - float targetgraycor = pow_F(0.01f * targetgraycie, 1.15f); - base = targetgraycie > 1.f && targetgraycie < 100.f && (float) dynamic_range > 0.f ? find_gray(std::abs((float) shadows_range) / (float) dynamic_range,(targetgraycor)) : 0.f; - linbase = std::max(base, 2.f);//2. minimal base log to avoid very bad results - if (settings->verbose) { - printf("Base logarithm encoding Q=%5.1f\n", (double) linbase); - } - } - - const auto applytoq = - [ = ](float x) -> float { - - x = rtengine::max(x, (float) noise); - x = rtengine::max(x / gray, (float) noise);//gray = gain - before log conversion - x = rtengine::max((xlogf(x) / log2f - (float) shadows_range) / (float) dynamic_range, (float) noise);//x in range EV - assert(x == x); - - if (linbase > 0.f)//apply log base in function of targetgray blackEvjz and Dynamic Range - { - x = xlog2lin(x, linbase); - } - return x; - }; - - - -//Ciecam "old" code not change except sigmoid added #ifdef __SSE2__ int bufferLength = ((width + 3) / 4) * 4; // bufferLength has to be a multiple of 4 #endif @@ -3628,11 +4222,12 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 float sbuffer[bufferLength] ALIGNED16; #endif #ifdef _OPENMP - #pragma omp for schedule(dynamic, 16) + #pragma omp for schedule(dynamic, 16) #endif + for (int i = 0; i < height; i++) { #ifdef __SSE2__ - // vectorized conversion from Lab to jchqms + // vectorized conversion from Lab to jchqms int k; vfloat c655d35 = F2V(655.35f); @@ -3644,10 +4239,10 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 z = z / c655d35; vfloat J, C, h, Q, M, s; Ciecam02::xyz2jchqms_ciecam02float(J, C, h, - Q, M, s, F2V(aw), F2V(fl), F2V(wh), - x, y, z, - F2V(xw1), F2V(yw1), F2V(zw1), - F2V(c), F2V(nc), F2V(pow1), F2V(nbb), F2V(ncb), F2V(pfl), F2V(cz), F2V(d), c16, F2V(plum)); + Q, M, s, F2V(aw), F2V(fl), F2V(wh), + x, y, z, + F2V(xw1), F2V(yw1), F2V(zw1), + F2V(c), F2V(nc), F2V(pow1), F2V(nbb), F2V(ncb), F2V(pfl), F2V(cz), F2V(d), c16, F2V(plum)); STVF(Jbuffer[k], J); STVF(Cbuffer[k], C); STVF(hbuffer[k], h); @@ -3668,10 +4263,10 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 z = z / 655.35f; float J, C, h, Q, M, s; Ciecam02::xyz2jchqms_ciecam02float(J, C, h, - Q, M, s, aw, fl, wh, - x, y, z, - xw1, yw1, zw1, - c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); + Q, M, s, aw, fl, wh, + x, y, z, + xw1, yw1, zw1, + c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); Jbuffer[k] = J; Cbuffer[k] = C; hbuffer[k] = h; @@ -3686,7 +4281,7 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 float J, C, h, Q, M, s; #ifdef __SSE2__ - // use precomputed values from above + // use precomputed values from above J = Jbuffer[j]; C = Cbuffer[j]; h = hbuffer[j]; @@ -3706,10 +4301,10 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 z = z1 / 655.35f; //process source==> normal Ciecam02::xyz2jchqms_ciecam02float(J, C, h, - Q, M, s, aw, fl, wh, - x, y, z, - xw1, yw1, zw1, - c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); + Q, M, s, aw, fl, wh, + x, y, z, + xw1, yw1, zw1, + c, nc, pow1, nbb, ncb, pfl, cz, d, c16, plum); #endif float Jpro, Cpro, hpro, Qpro, Mpro, spro; Jpro = J; @@ -3718,50 +4313,58 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 Qpro = Q; Mpro = M; spro = s; - /* - */ - if(ciec) { + + if (ciec && mocam == 1) {//only Cam16 bool jp = false; - if ((cielocalcurve && localcieutili) && mecamcurve == 1) { + + if (params->locallab.spots.at(sp).logcie && params->locallab.spots.at(sp).logcieq && iscie) {//log encoding Q + float val = Qpro * coefq; + + if (val > (float) noise) { + float mm = applytoq(val); + float f = mm / val; + Qpro *= f; + } + } + // if (issig && issigq && iscie && !islogq && mobwev != 2) { //sigmoid Q only and black Ev & white Ev + if (issig && issigq && iscie && mobwev != 2) { //sigmoid Q only and black Ev & white Ev + float val = Qpro * coefq; + + if (mobwev == 1) { + val = std::max((xlog(val) / log2 - shadows_range) / (dynamic_range + 1.5), noise);//in range EV + } + + float sigreal = sigmoidth * sumcamq01;//correction for sigmoid Q take into account mean Q + + if (sigreal >= 1.f) { + th = (sigreal - 1.f) * val + 1.f; + } else { + th = (1.f - sigreal) * val + sigreal; + } + + sigmoidla(val, th, sigm); + Qpro = std::max(Qpro + val / coefq, 0.f); + Qpro = CAMBrightCurveQsig[(float)(Qpro * coefQ)] / coefQ; //brightness and contrast + + Jpro = SQR((10.f * Qpro) / wh); + + } + + if ((cielocalcurve && localcieutili) && mecamcurve == 1) {//curve Q jp = true; float Qq = Qpro * coefQ; float Qold = Qpro; Qq = 0.5f * cielocalcurve[Qq * 2.f]; Qq = Qq / coefQ; Qpro = 0.2f * (Qq - Qold) + Qold; - if(jp) { + + if (jp) { Jpro = SQR((10.f * Qpro) / wh); } } Qpro = CAMBrightCurveQ[(float)(Qpro * coefQ)] / coefQ; //brightness and contrast - if(islogq && issigq) { - float val = Qpro * coefq;; - if (val > (float) noise) { - float mm = applytoq(val); - float f = mm / val; - Qpro *= f; - } - } - - - if(issigq && iscie && !islogq) {//sigmoid Q only with ciecam module - float val = Qpro * coefq; - if(sigmoidqj == true) { - val = std::max((xlog(val) / log2 - shadows_range) / (dynamic_range + 1.5), noise);//in range EV - } - if(sigmoidth >= 1.f) { - th = ath * val + bth; - } else { - th = at * val + bt; - } - sigmoidla (val, th, sigm); - float bl2 = 1.f; - Qpro = std::max(bl * Qpro + bl2 * val / coefq, 0.f); - } - - float Mp, sres; Mp = Mpro / 100.0f; Ciecam02::curvecolorfloat(mchr, Mp, sres, 2.5f); @@ -3775,7 +4378,7 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 spro = 100.0f * sqrtf(Mpro / Qpro); if (Jpro > 99.9f) { - Jpro = 99.9f; + Jpro = 99.9f; } Jpro = CAMBrightCurveJ[(float)(Jpro * 327.68f)]; //lightness CIECAM02 + contrast @@ -3791,14 +4394,14 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 Cpro = Cp * 100.f; Ciecam02::curvecolorfloat(cchr, Cp, sres, 1.8f); Color::skinredfloat(Jpro, hpro, sres, Cp, 55.f, 30.f, 1, rstprotection, 100.f, Cpro); - + hpro = hpro + hue; if (hpro < 0.0f) { hpro += 360.0f; //hue } - - if ((cielocalcurve && localcieutili) && mecamcurve == 0) { + + if ((cielocalcurve && localcieutili) && mecamcurve == 0) {//curve J float Jj = (float) Jpro * 327.68f; float Jold = Jj; Jj = 0.5f * cielocalcurve[Jj * 2.f]; @@ -3809,8 +4412,9 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 Jpro = 1.f; } } - if (cielocalcurve2 && localcieutili2) { - if(mecamcurve2 == 0) { + + if (cielocalcurve2 && localcieutili2) {//chroma saturation colorfullness + if (mecamcurve2 == 0) {//chroma float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Cc = (float) Cpro * coef; @@ -3821,7 +4425,7 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 int sk1 = 1; float ko = 1.f / coef; Color::skinredfloat(Jpro, hpro, Cc, Ccold, dred, protect_red, sk1, rstprotection, ko, Cpro); - } else if (mecamcurve2 == 1) { + } else if (mecamcurve2 == 1) {//saturation float parsat = 0.8f; //0.6 float coef = 327.68f / parsat; float Ss = (float) spro * coef; @@ -3836,7 +4440,7 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 Color::skinredfloat(Jpro, hpro, Ss, Sold, dred, protect_red, 0, rstprotection, ko, spro); Qpro = (4.0f / c) * sqrtf(Jpro / 100.0f) * (aw + 4.0f) ; Cpro = (spro * spro * Qpro) / (10000.0f); - } else if (mecamcurve2 == 2) { + } else if (mecamcurve2 == 2) {//colorfullness float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Mm = (float) Mpro * coef; @@ -3851,7 +4455,6 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 Cpro = Mpro / coe; } } - } //retrieve values C,J...s @@ -3872,9 +4475,9 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 //process normal==> viewing Ciecam02::jch2xyz_ciecam02float(xx, yy, zz, - J, C, h, - xw2, yw2, zw2, - c2, nc2, pow1n, nbbj, ncbj, flj, czj, dj, awj, c16, plum); + J, C, h, + xw2, yw2, zw2, + c2, nc2, pow1n, nbbj, ncbj, flj, czj, dj, awj, c16, plum); x = CLIP(xx * 655.35f); y = CLIP(yy * 655.35f); z = CLIP(zz * 655.35f); @@ -3896,9 +4499,9 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 for (k = 0; k < bufferLength; k += 4) { vfloat x, y, z; Ciecam02::jch2xyz_ciecam02float(x, y, z, - LVF(Jbuffer[k]), LVF(Cbuffer[k]), LVF(hbuffer[k]), - F2V(xw2), F2V(yw2), F2V(zw2), - F2V(nc2), F2V(pow1n), F2V(nbbj), F2V(ncbj), F2V(flj), F2V(dj), F2V(awj), F2V(reccmcz), c16, F2V(plum)); + LVF(Jbuffer[k]), LVF(Cbuffer[k]), LVF(hbuffer[k]), + F2V(xw2), F2V(yw2), F2V(zw2), + F2V(nc2), F2V(pow1n), F2V(nbbj), F2V(ncbj), F2V(flj), F2V(dj), F2V(awj), F2V(reccmcz), c16, F2V(plum)); STVF(xbuffer[k], x * c655d35); STVF(ybuffer[k], y * c655d35); STVF(zbuffer[k], z * c655d35); @@ -3912,7 +4515,7 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 xbuffer[j] = CLIP(xbuffer[j]); ybuffer[j] = CLIP(ybuffer[j]); zbuffer[j] = CLIP(zbuffer[j]); - + Color::XYZ2Lab(xbuffer[j], ybuffer[j], zbuffer[j], Ll, aa, bb); lab->L[i][j] = Ll; @@ -3922,303 +4525,54 @@ if(mocam == 0 || mocam == 1 || call == 1 || call == 2 || call == 10) {//call=2 #endif } - } - } - -if(mocam == 3) {//Zcam not use but keep in case off -/* - double miniiz = 1000.; - double maxiiz = -1000.; - double sumiz = 0.; - int nciz = 0; - double epsilzcam = 0.0001; - double atten = 2700.; - double epsilzcam2 = 1.; - if(mocam == 3) {//Zcam - double pl = params->locallab.spots.at(sp).pqremap; -//calculate min, max, mean for Jz + + if ((mocam == 1 && (sigmoidnorm && issigq)) || params->locallab.spots.at(sp).logcieq) { //Normalize luminance + #ifdef _OPENMP - #pragma omp parallel for reduction(min:miniiz) reduction(max:maxiiz) reduction(+:sumiz) if(multiThread) + #pragma omp parallel for schedule(dynamic, 16) #endif - for (int i = 0; i < height; i+=1) { - for (int k = 0; k < width; k+=1) { - float L = lab->L[i][k]; - float a = lab->a[i][k]; - float b = lab->b[i][k]; - float x, y, z; - //convert Lab => XYZ - Color::Lab2XYZ(L, a, b, x, y, z); - x = x / 65535.f; - y = y / 65535.f; - z = z / 65535.f; - double Jz, az, bz; - double xx, yy, zz; - //D50 ==> D65 - xx = (d50_d65[0][0] * (double) x + d50_d65[0][1] * (double) y + d50_d65[0][2] * (double) z); - yy = (d50_d65[1][0] * (double) x + d50_d65[1][1] * (double) y + d50_d65[1][2] * (double) z); - zz = (d50_d65[2][0] * (double) x + d50_d65[2][1] * (double) y + d50_d65[2][2] * (double) z); - xx = LIM01(xx); - yy = LIM01(yy); - zz = LIM01(zz); - - double L_p, M_p, S_p; - bool zcam = true; - Ciecam02::xyz2jzczhz (Jz, az, bz, xx, yy, zz, pl, L_p, M_p, S_p, zcam); - if(Jz > maxiiz) { - maxiiz = Jz; - } - if(Jz < miniiz) { - miniiz = Jz; - } - sumiz += Jz; + for (int y = 0; y < height; y++) { //data after ciecam + for (int x = 0; x < width; x++) { + data[(y) * width + (x)] = lab->L[y][x]; + datanorm[(y) * width + (x)] = lab->L[y][x]; + } } - } - nciz = height * width; - sumiz = sumiz / nciz; - sumiz += epsilzcam; - maxiiz += epsilzcam; - if (settings->verbose) { - printf("Zcam miniiz=%f maxiiz=%f meaniz=%f\n", miniiz, maxiiz, sumiz); - } - } - double avgmz = sumiz; - //calculate various parameter for Zcam - those with ** come from documentation Zcam - // ZCAM, a colour appearance model based on a high dynamic range uniform colour space - //Muhammad Safdar, Jon Yngve Hardeberg, and Ming Ronnier Luo - // https://www.osapublishing.org/oe/fulltext.cfm?uri=oe-29-4-6036&id=447640#e12 - double L_p, M_p, S_p; - double jzw, azw, bzw; - bool zcam = true; - double plz = params->locallab.spots.at(sp).pqremap;// to test or change to 10000 -// double po = 0.1 + params->locallab.spots.at(sp).contthreszcam; - float fb_source = sqrt(yb / 100.f); - float fb_dest = sqrt(yb2 / 100.f); - double flz = 0.171 * pow(la, 0.3333333)*(1. - exp(-(48. * (double) la / 9.))); - double fljz = 0.171 * pow(la2, 0.3333333)*(1. - exp(-(48. * (double) la2 / 9.))); - double cpow = 2.2;//empirical - double cpp = pow( (double) c, 0.5);//empirical - double cpp2 = pow( (double) c2, 0.5);//empirical - double pfl = pow(flz, 0.25); - double cmul_source = 1.26;//empirical - double cmul_source_ch = 1.1;//empirical - double achro_source = pow((double) c, cpow)*(pow((double) flz, - 0.004)* (double) sqrt(fb_source));//I think there is an error in formula documentation step 5 - all parameters are inversed or wrong - double achro_dest = pow((double) c2, cpow)*(pow((double) fljz, - 0.004) * (double) sqrt(fb_dest)); - double kk_source = (1.6 * (double) cpp) / pow((double) fb_source, 0.12); - double ikk_dest = pow((double) fb_dest, 0.12) /(1.6 * (double) cpp2); - Ciecam02::xyz2jzczhz (jzw, azw, bzw, Xw, Yw, Zw, plz, L_p, M_p, S_p, zcam); - double eff = 1.; - double kap = 2.7; - if(maxiiz > (kap * sumiz)) { - kap = 1.7; - } - double qzw = cmul_source * atten * pow(jzw, (double) kk_source) / achro_source;//I think there is an error in formula documentation step 5 - all parameters are inversed - double maxforq = kap * sumiz * eff + epsilzcam2; - if(maxforq > maxiiz) { - maxforq = maxiiz; - } else { - maxforq = 0.9 * maxforq + 0.1 * maxiiz; - } - double qzmax = cmul_source * atten * pow(maxforq, (double) kk_source) / achro_source; - double izw = jzw; - double coefm = pow(flz, 0.2) / (pow((double) fb_source, 0.1) * pow(izw, 0.78)); - if (settings->verbose) { - printf("qzw=%f PL=%f qzmax=%f\n", qzw, plz, qzmax);//huge change with PQ peak luminance - } - array2D Iiz(width, height); - array2D Aaz(width, height); - array2D Bbz(width, height); -//curve to replace LUT , LUT leads to crash... - double contqz = 0.5 * params->locallab.spots.at(sp).contqzcam; - DiagonalCurve qz_contrast({ - DCT_NURBS, - 0, 0, - avgmz - avgmz * (0.6 - contqz / 250.0), avgmz - avgmz * (0.6 + contqz / 250.0), - avgmz + (1. - avgmz) * (0.6 - contqz / 250.0), avgmz + (1. - avgmz) * (0.6 + contqz / 250.0), - 1, 1 - }); - double contlz = 0.6 * params->locallab.spots.at(sp).contlzcam; - DiagonalCurve ljz_contrast({ - DCT_NURBS, - 0, 0, - avgmz - avgmz * (0.6 - contlz / 250.0), avgmz - avgmz * (0.6 + contlz / 250.0), - avgmz + (1. - avgmz) * (0.6 - contlz / 250.0), avgmz + (1. - avgmz) * (0.6 + contlz / 250.0), - 1, 1 - }); - - //all calculations in double for best results...but slow - double lqz = 0.4 * params->locallab.spots.at(sp).lightqzcam; - if(params->locallab.spots.at(sp).lightqzcam < 0) { - lqz = 0.2 * params->locallab.spots.at(sp).lightqzcam; //0.4 less effect, no need 1. - } - DiagonalCurve qz_light({ - DCT_NURBS, - 0, 0, - 0.1, 0.1 + lqz / 150., - 0.7, min (1.0, 0.7 + lqz / 300.0), - 1, 1 - }); - DiagonalCurve qz_lightn({ - DCT_NURBS, - 0, 0, - max(0.0, 0.1 - lqz / 150.), 0.1 , - 0.7 - lqz / 300.0, 0.7, - 1, 1 - }); - double ljz = 0.4 * params->locallab.spots.at(sp).lightlzcam; - if(params->locallab.spots.at(sp).lightlzcam < 0) { - ljz = 0.2 * params->locallab.spots.at(sp).lightlzcam; - } - DiagonalCurve ljz_light({ - DCT_NURBS, - 0, 0, - 0.1, 0.1 + ljz / 150., - 0.7, min (1.0, 0.7 + ljz / 300.0), - 1, 1 - }); - DiagonalCurve ljz_lightn({ - DCT_NURBS, - 0, 0, - max(0.0, 0.1 - ljz / 150.), 0.1 , - 0.7 - ljz / 300.0, 0.7, - 1, 1 - }); + double nbs = 1.; + drd = std::max(drd, 1.); + if (bl > 0.5f) { + nbs = (1.7 * (double) bl * drd);//take into account DR to increase variance in image source + } + if(!params->locallab.spots.at(sp).logcieq) {// not with log encoding Q + normalize_mean_dt(datanorm, datain, height * width, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f, nbs);//normalize luminance + } #ifdef _OPENMP - #pragma omp parallel for if(multiThread) + #pragma omp parallel for schedule(dynamic, 16) #endif - for (int i = 0; i < height; i++) { - for (int k = 0; k < width; k++) { - float L = lab->L[i][k]; - float a = lab->a[i][k]; - float b = lab->b[i][k]; - float x, y, z; - //convert Lab => XYZ - Color::Lab2XYZ(L, a, b, x, y, z); - x = x / 65535.f; - y = y / 65535.f; - z = z / 65535.f; - double iz, az, bz; - double xx, yy, zz; - //change WP to D65 - xx = (d50_d65[0][0] * (double) x + d50_d65[0][1] * (double) y + d50_d65[0][2] * (double) z); - yy = (d50_d65[1][0] * (double) x + d50_d65[1][1] * (double) y + d50_d65[1][2] * (double) z); - zz = (d50_d65[2][0] * (double) x + d50_d65[2][1] * (double) y + d50_d65[2][2] * (double) z); - double L_p, M_p, S_p; - bool zcam = true; - Ciecam02::xyz2jzczhz (iz, az, bz, xx, yy, zz, plz, L_p, M_p, S_p, zcam); - Iiz[i][k] = LIM01(iz); - Aaz[i][k] = clipazbz(az); - Bbz[i][k] = clipazbz(bz); + + for (int ir = 0; ir < height; ir++) { + for (int jr = 0; jr < width; jr++) { + if(!params->locallab.spots.at(sp).logcieq) {// if not Log encoding ciecam + data[ir * width + jr] = intp(bl, data[ir * width + jr], datanorm[ir * width + jr]);//blend with original + } else { + data[ir * width + jr] = intp(bl, data[ir * width + jr], datain[ir * width + jr]);//blend with original + } + lab->L[ir][jr] = data[ir * width + jr]; + } } } -#ifdef _OPENMP - #pragma omp parallel for if(multiThread) -#endif - for (int i = 0; i < height; i++) { - for (int k = 0; k < width; k++) { - double az = Aaz[i][k]; - double bz = Bbz[i][k]; - double iz = Iiz[i][k]; - if(iz > kap * sumiz) { - iz = kap * sumiz * eff; - } - float coefqz = (float) qzmax; - float coefjz = 100.f ; - double qz = cmul_source * atten * pow(iz, (double) kk_source) / achro_source;//partial - az *= cmul_source_ch; - bz *= cmul_source_ch; - - qz= (double) coefqz * LIM01(qz_contrast.getVal((float)qz / coefqz)); + delete [] datain; + delete [] data; + delete [] datanorm; + } - if(lqz > 0) { - qz = (double) coefqz * LIM01(qz_light.getVal((float)qz / coefqz)); - } - if(lqz < 0) { - qz = (double) coefqz * LIM01(qz_lightn.getVal((float)qz / coefqz)); - } - // double jz = 100. * (qz / qzw); - double jz = SQR((10. * qz) / qzw);//formula CAM16 - jz= (double) coefjz * LIM01(ljz_contrast.getVal((float)jz / coefjz)); - if(ljz > 0) { - jz = (double) coefjz * LIM01(ljz_light.getVal((float)jz / coefjz)); - } - if(ljz < 0) { - jz = (double) coefjz * LIM01(ljz_lightn.getVal((float)jz / coefjz)); - } - if(jz > 100.) jz = 99.; - - - //qzpro = 0.01 * jzpro * qzw; - double qzpro = 0.1 * sqrt(jz) * qzw; - iz = LIM01(pow(qzpro / (atten / achro_dest), ikk_dest)); - double h = atan2(bz, az); - if ( h < 0.0 ) { - h += (double) (2.f * rtengine::RT_PI_F); - } - double hp = h * (360 / (double) (2.f * rtengine::RT_PI_F)); - double ez = 1.015 + cos(89.038 + hp); - if(mchrz != 0.f || schrz != 0.f || cchrz != 0.f){ - //colorfullness - double Mpz = 100. * pow(az * az + bz * bz, 0.37)* pow(ez, 0.068) * coefm; - Mpz *= (double) (1.f + 0.01f * mchrz); - float ccz = sqrt(pow((float) (Mpz / (100. * pow(ez, 0.068) * coefm)), (1.f / 0.37f))); - float2 sincosval = xsincosf(h); - az = (double)(ccz * sincosval.y); - bz = (double)(ccz * sincosval.x); - if(schrz != 0.f){ - //saturation - double Spz = 100. * pow(flz, 0.6) * (Mpz / qz); - Spz *= (double) (1.f + 0.01f * schrz); - Mpz = (Spz * qz) / (100.* pow(flz, 0.6)); - ccz = sqrt(pow((float) (Mpz / (100. * pow(ez, 0.068) * coefm)), (1.f / 0.37f))); - az = (double)(ccz * sincosval.y); - bz = (double)(ccz * sincosval.x); - } - if(cchrz != 0.f){ - // double Cpz = 100. * (Mpz / qzw); - double Cpz = 100. * (Mpz / pfl);//Cam16 formula - Cpz *= (double) (1.f + 0.01f * cchrz); - Mpz = (Cpz * pfl) / 100.; - // double Vpz = sqrt(SQR(jz - 58.) + 3.4 * SQR(Cpz));//vividness not working - // Vpz *= (double) (1.f + 0.01f * cchrz); - //Mpz = (Cpz * qzw) / 100.; - // Mpz = 0.01 * qzw * sqrt((SQR(Vpz) - SQR(jz - 58.)) / 3.4); - ccz = sqrt(pow((float) (Mpz / (100. * pow(ez, 0.068) * coefm)), (1.f / 0.37f))); - az = (double)(ccz * sincosval.y); - bz = (double)(ccz * sincosval.x); - } - - } - double L_, M_, S_; - double xx, yy, zz; - bool zcam = true; - iz=LIM01(iz); - az=clipazbz(az); - bz=clipazbz(bz); - - Ciecam02::jzczhzxyz (xx, yy, zz, iz, az, bz, plz, L_, M_, S_, zcam); - //re enable D50 - double x, y, z; - x = 65535. * (d65_d50[0][0] * xx + d65_d50[0][1] * yy + d65_d50[0][2] * zz); - y = 65535. * (d65_d50[1][0] * xx + d65_d50[1][1] * yy + d65_d50[1][2] * zz); - z = 65535. * (d65_d50[2][0] * xx + d65_d50[2][1] * yy + d65_d50[2][2] * zz); - float Ll, aa, bb; - Color::XYZ2Lab(x, y, z, Ll, aa, bb); - lab->L[i][k] = Ll; - lab->a[i][k] = aa; - lab->b[i][k] = bb; - } - } -*/ -} - } void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufcolfin, float rad, int bfh, int bfw, float epsilmax, float epsilmin, float thres, int sk, bool multiThread, int flag) @@ -4226,11 +4580,13 @@ void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufco if (rad != 0.f) { array2D ble(bfw, bfh); array2D guid(bfw, bfh); + if (flag == 0) { #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { guid[ir][jr] = Color::L2Y(bufcolorig->L[ir][jr]) / 32768.f; @@ -4240,7 +4596,7 @@ void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufco const float aepsil = (epsilmax - epsilmin) / 100.f; const float bepsil = epsilmin; //epsilmax - 100.f * aepsil; - // const float epsil = aepsil * 0.1f * rad + bepsil; + // const float epsil = aepsil * 0.1f * rad + bepsil; const float epsil = aepsil * rad + bepsil; const float blur = 10.f / sk * (thres + 0.f * rad); @@ -4249,6 +4605,7 @@ void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufco #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufcolfin->L[ir][jr] = Color::computeXYZ2LabY(32768.f * ble[ir][jr]); @@ -4259,6 +4616,7 @@ void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufco #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { ble[ir][jr] = bufcolfin->L[ir][jr] / 32768.f; @@ -4276,6 +4634,7 @@ void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufco #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufcolfin->L[ir][jr] = 32768.f * ble[ir][jr]; @@ -4286,6 +4645,7 @@ void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufco #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { ble[ir][jr] = bufcolfin->L[ir][jr] / 32768.f; @@ -4295,7 +4655,7 @@ void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufco const float aepsil = (epsilmax - epsilmin) / 1000.f; const float bepsil = epsilmin; //epsilmax - 100.f * aepsil; const float epsil = rad < 0.f ? 0.0001f : aepsil * 10.f * rad + bepsil; - // const float epsil = bepsil; + // const float epsil = bepsil; const float blur = rad < 0.f ? -1.f / rad : 0.00001f + rad; const int r2 = rtengine::max(int(20.f / sk * blur + 0.000001f), 1); @@ -4304,6 +4664,7 @@ void ImProcFunctions::softproc(const LabImage* bufcolorig, const LabImage* bufco #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufcolfin->L[ir][jr] = 32768.f * ble[ir][jr]; @@ -4321,6 +4682,7 @@ void ImProcFunctions::softprocess(const LabImage* bufcolorig, array2D &bu #ifdef _OPENMP #pragma omp parallel for reduction(min:minlig) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { minlig = rtengine::min(buflight[ir][jr], minlig); @@ -4332,6 +4694,7 @@ void ImProcFunctions::softprocess(const LabImage* bufcolorig, array2D &bu #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { buflight[ir][jr] = LIM01((buflight[ir][jr] - minlig) / (100.f - minlig)); @@ -4349,6 +4712,7 @@ void ImProcFunctions::softprocess(const LabImage* bufcolorig, array2D &bu #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { buflight[ir][jr] = (100.f - minlig) * buflight[ir][jr] + minlig; @@ -4362,26 +4726,30 @@ void ImProcFunctions::exlabLocal(local_params& lp, float strlap, int bfh, int bf //exposure local constexpr float maxran = 65536.f; - if(lp.laplacexp == 0.f) { + + if (lp.laplacexp == 0.f) { lp.linear = 0.f; } const float linear = lp.linear; int bw = bfw; int bh = bfh; + if (linear > 0.f && lp.expcomp == 0.f) { lp.expcomp = 0.001f; } + const bool exec = (lp.expmet == 1 && linear > 0.f && lp.laplacexp > 0.1f); - if(!exec) {//for standard exposure - + if (!exec) { //for standard exposure + const float cexp_scale = std::pow(2.f, lp.expcomp); const float ccomp = (rtengine::max(0.f, lp.expcomp) + 1.f) * lp.hlcomp / 100.f; const float cshoulder = ((maxran / rtengine::max(1.0f, cexp_scale)) * (lp.hlcompthr / 200.f)) + 0.1f; const float chlrange = maxran - cshoulder; const float diffde = 100.f - lp.sensex;//the more scope, the less take into account dE for Laplace - if(!lp.invex) {// Laplacian not in inverse + + if (!lp.invex) { // Laplacian not in inverse bw = bfwr; bh = bfhr; @@ -4398,6 +4766,7 @@ void ImProcFunctions::exlabLocal(local_params& lp, float strlap, int bfh, int bf float bb = blap - 30.f * aa; float lap; + if (diffde > 80.f) { lap = alap; } else if (diffde < 30.f) { @@ -4407,8 +4776,9 @@ void ImProcFunctions::exlabLocal(local_params& lp, float strlap, int bfh, int bf } #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { datain[y * bfwr + x] = bufexporig->L[y][x]; @@ -4418,20 +4788,22 @@ void ImProcFunctions::exlabLocal(local_params& lp, float strlap, int bfh, int bf MyMutex::MyLock lock(*fftwMutex); ImProcFunctions::retinex_pde(datain.get(), dataout.get(), bfwr, bfhr, lap, 1.f, dE.get(), 0, 1, 1);//350 arbitrary value about 45% strength Laplacian #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { bufexporig->L[y][x] = dataout[y * bfwr + x]; } } - + } - + #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif - for (int ir = 0; ir < bh; ir++) {//for standard with Laplacian in normal and without in inverse + + for (int ir = 0; ir < bh; ir++) {//for standard with Laplacian in normal and without in inverse for (int jr = 0; jr < bw; jr++) { float L = bufexporig->L[ir][jr]; //highlight @@ -4443,7 +4815,7 @@ void ImProcFunctions::exlabLocal(local_params& lp, float strlap, int bfh, int bf lab->L[ir][jr] = 0.5f * tonecurve[2 * L]; } } - } else if(!lp.invex) {//for PDE algorithms + } else if (!lp.invex) { //for PDE algorithms constexpr float kl = 1.f; const float hlcompthr = lp.hlcompthr / 200.f; const float hlcomp = lp.hlcomp / 100.f; @@ -4451,6 +4823,7 @@ void ImProcFunctions::exlabLocal(local_params& lp, float strlap, int bfh, int bf #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { float L = bufexporig->L[ir][jr]; @@ -4493,6 +4866,7 @@ void ImProcFunctions::addGaNoise(LabImage *lab, LabImage *dst, const float mean, #ifdef _OPENMP #pragma omp for schedule(static) // static scheduling is important to avoid artefacts #endif + for (int y = 0; y < lab->H; y++) { for (int x = 0; x < lab->W; x++) { generate = !generate; @@ -4605,6 +4979,7 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < transformed->H; y++) { const int loy = cy + y; const bool isZone0 = loy > lp.yc + lp.ly || loy < lp.yc - lp.lyT; // whole line is zone 0 => we can skip a lot of processing @@ -4619,7 +4994,7 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -4639,6 +5014,7 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab reducdEa = SQR(calcreducdE(dEa, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensden)); reducdEb = SQR(calcreducdE(dEb, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensden)); } + float difL, difa, difb; if (call == 2 /*|| call == 1 || call == 3 */) { //simpleprocess @@ -4697,8 +5073,8 @@ void ImProcFunctions::DeNoise_Local2(const struct local_params& lp, LabImage* or const int yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, original->H); const int xstart = rtengine::max(static_cast(lp.xc - lp.lxL) - cx, 0); const int xend = rtengine::min(static_cast(lp.xc + lp.lx) - cx, original->W); - - + + lumaref *= 327.68f; const float ach = lp.trans / 100.f; @@ -4742,8 +5118,8 @@ void ImProcFunctions::DeNoise_Local2(const struct local_params& lp, LabImage* or } } - // const int begx = lp.xc - lp.lxL; - // const int begy = lp.yc - lp.lyT; +// const int begx = lp.xc - lp.lxL; +// const int begy = lp.yc - lp.lyT; constexpr float r327d68 = 1.f / 327.68f; #ifdef _OPENMP @@ -4766,7 +5142,7 @@ void ImProcFunctions::DeNoise_Local2(const struct local_params& lp, LabImage* or // if (isZone0) { // outside selection and outside transition zone => no effect, keep original values // continue; - // } +// } for (int x = xstart, lox = cx + x; x < xend; x++, lox++) { int zone; @@ -4798,13 +5174,13 @@ void ImProcFunctions::DeNoise_Local2(const struct local_params& lp, LabImage* or float difL, difa, difb; const float repart = 1.0f - 0.01f * lp.reparden; - tmp1.L[y-ystart][x-xstart] = intp(repart, original->L[y][x], tmp1.L[y-ystart][x-xstart]); - tmp1.a[y-ystart][x-xstart] = intp(repart, original->a[y][x], tmp1.a[y-ystart][x-xstart]); - tmp1.b[y-ystart][x-xstart] = intp(repart, original->b[y][x], tmp1.b[y-ystart][x-xstart]); - - difL = tmp1.L[y-ystart][x-xstart] - original->L[y][x]; - difa = tmp1.a[y-ystart][x-xstart] - original->a[y][x]; - difb = tmp1.b[y-ystart][x-xstart] - original->b[y][x]; + tmp1.L[y - ystart][x - xstart] = intp(repart, original->L[y][x], tmp1.L[y - ystart][x - xstart]); + tmp1.a[y - ystart][x - xstart] = intp(repart, original->a[y][x], tmp1.a[y - ystart][x - xstart]); + tmp1.b[y - ystart][x - xstart] = intp(repart, original->b[y][x], tmp1.b[y - ystart][x - xstart]); + + difL = tmp1.L[y - ystart][x - xstart] - original->L[y][x]; + difa = tmp1.a[y - ystart][x - xstart] - original->a[y][x]; + difb = tmp1.b[y - ystart][x - xstart] - original->b[y][x]; difL *= localFactor * reducdEL; difa *= localFactor * reducdEa; @@ -4876,6 +5252,7 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < transformed->H; y++) { int loy = cy + y; @@ -4887,7 +5264,7 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -4909,6 +5286,7 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl transformed->a[y][x] = clipC(original->a[y][x] + difa * reducdE); transformed->b[y][x] = clipC(original->b[y][x] + difb * reducdE); } + break; } @@ -4931,6 +5309,7 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl transformed->a[y][x] = clipC(original->a[y][x] + difa * reducdE); transformed->b[y][x] = clipC(original->b[y][x] + difb * reducdE); } + break; } @@ -5016,6 +5395,7 @@ void ImProcFunctions::InverseBlurNoise_Local(LabImage * originalmask, const stru #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < transformed->H; y++) { int loy = cy + y; @@ -5030,7 +5410,9 @@ void ImProcFunctions::InverseBlurNoise_Local(LabImage * originalmask, const stru } else { calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } - float reducdE; + + float reducdE; + if (zone != 2) { float abdelta2 = SQR(refa - maskptr->a[y][x]) + SQR(refb - maskptr->b[y][x]); float chrodelta2 = SQR(std::sqrt(SQR(maskptr->a[y][x]) + SQR(maskptr->b[y][x])) - (chromaref * 327.68f)); @@ -5042,12 +5424,12 @@ void ImProcFunctions::InverseBlurNoise_Local(LabImage * originalmask, const stru switch (zone) { case 0: { // outside selection and outside transition zone => full effect, no transition - const float diflc = (tmp1->L[y][x] - original->L[y][x]) * reducdE; - const float difa = (tmp1->a[y][x] - original->a[y][x]) * reducdE; - const float difb = (tmp1->b[y][x] - original->b[y][x]) * reducdE; - transformed->L[y][x] = CLIP(original->L[y][x] + diflc); - transformed->a[y][x] = clipC(original->a[y][x] + difa) ; - transformed->b[y][x] = clipC(original->b[y][x] + difb); + const float diflc = (tmp1->L[y][x] - original->L[y][x]) * reducdE; + const float difa = (tmp1->a[y][x] - original->a[y][x]) * reducdE; + const float difb = (tmp1->b[y][x] - original->b[y][x]) * reducdE; + transformed->L[y][x] = CLIP(original->L[y][x] + diflc); + transformed->a[y][x] = clipC(original->a[y][x] + difa) ; + transformed->b[y][x] = clipC(original->b[y][x] + difb); if (blshow) { transformed->L[y][x] = CLIP(12000.f + diflc); @@ -5105,24 +5487,26 @@ static void mean_fab(int xstart, int ystart, int bfw, int bfh, LabImage* bufexpo if (nbfab > 0) { double sumab = 0.0; -#ifdef _OPENMP +#ifdef _OPENMP #pragma omp parallel for reduction(+:sumab) if(multiThread) #else static_cast(multiThread); #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { - if(flag == 0) { + if (flag == 0) { bufexporig->a[y][x] = original->a[y + ystart][x + xstart]; bufexporig->b[y][x] = original->b[y + ystart][x + xstart]; } else { bufexporig->a[y][x] = original->a[y][x]; bufexporig->b[y][x] = original->b[y][x]; } + sumab += static_cast(SQR(std::fabs(bufexporig->a[y][x])) + SQR(std::fabs(bufexporig->b[y][x]))); - - // sumab += static_cast(std::fabs(bufexporig->a[y][x])); - // sumab += static_cast(std::fabs(bufexporig->b[y][x])); + + // sumab += static_cast(std::fabs(bufexporig->a[y][x])); + // sumab += static_cast(std::fabs(bufexporig->b[y][x])); } } @@ -5133,12 +5517,14 @@ static void mean_fab(int xstart, int ystart, int bfw, int bfh, LabImage* bufexpo #ifdef _OPENMP #pragma omp parallel for reduction(+:som) reduction(max:maxfab)if(multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { som += static_cast(SQR(std::fabs(bufexporig->a[y][x]) - meanfab) + SQR(std::fabs(bufexporig->b[y][x]) - meanfab)); maxm = static_cast(SQR(std::fabs(bufexporig->a[y][x])) + SQR(std::fabs(bufexporig->b[y][x]))); maxm = sqrt(maxm); - if(maxm > (double) maxfab) { + + if (maxm > (double) maxfab) { maxfab = (float) maxm; } @@ -5151,10 +5537,12 @@ static void mean_fab(int xstart, int ystart, int bfw, int bfh, LabImage* bufexpo const float stddv = std::sqrt(som / nbfab); float fabprov = meanfab + multsigma * stddv * multchrom;//with 3 sigma about 99% cases - if(fabprov > maxfab) { + + if (fabprov > maxfab) { fabprov = maxfab; } - fab = max(fabprov, 0.90f* maxfab);//Find maxi between mean + 3 sigma and 90% max (90 arbitrary empirical value) + + fab = max(fabprov, 0.90f * maxfab); //Find maxi between mean + 3 sigma and 90% max (90 arbitrary empirical value) if (fab <= 0.f) { fab = 50.f; @@ -5233,6 +5621,9 @@ void calclocalGradientParams(const struct local_params& lp, struct grad_params& } else if (indic == 12) { stops = -lp.str_mas; angs = lp.ang_mas; + } else if (indic == 15) { + stops = lp.strgradcie; + angs = lp.anggradcie; } @@ -5331,6 +5722,7 @@ void ImProcFunctions::blendstruc(int bfw, int bfh, LabImage* bufcolorig, float r #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { float X, Y, Z; @@ -5352,6 +5744,7 @@ void ImProcFunctions::blendstruc(int bfw, int bfh, LabImage* bufcolorig, float r #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { blend2[ir][jr] = 32768.f * ble[ir][jr]; @@ -5366,6 +5759,7 @@ static void blendmask(const local_params& lp, int xstart, int ystart, int cx, in #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < bfh ; y++) { const int loy = y + ystart + cy; @@ -5378,7 +5772,7 @@ static void blendmask(const local_params& lp, int xstart, int ystart, int cx, in if (lp.shapmet == 0) { calcTransition(lox, loy, achm, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, achm, lp, zone, localFactor); } @@ -5463,6 +5857,7 @@ void ImProcFunctions::deltaEforMask(float **rdE, int bfw, int bfh, LabImage* buf #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { const float abdelta2 = SQR(refa - bufcolorig->a[y][x] / 327.68f) + SQR(refb - bufcolorig->b[y][x] / 327.68f); @@ -5471,6 +5866,7 @@ void ImProcFunctions::deltaEforMask(float **rdE, int bfw, int bfh, LabImage* buf const float tempdE = std::sqrt(kab * (kch * chrodelta2 + kH * huedelta2) + kL * SQR(refL - bufcolorig->L[y][x] / 327.68f)); float reducdE; + if (tempdE > maxdE) { reducdE = 0.f; } else if (tempdE > mindE && tempdE <= maxdE) { @@ -5505,7 +5901,8 @@ static void showmask(int lumask, const local_params& lp, int xstart, int ystart, { float lum = fabs(lumask * 400.f); float colo = 0.f; - if(lumask < 0.f) { + + if (lumask < 0.f) { lum *= 1.4f; colo = 30000.f + 12.f * lum; } @@ -5513,6 +5910,7 @@ static void showmask(int lumask, const local_params& lp, int xstart, int ystart, #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < bfh; y++) { const int loy = y + ystart + cy; @@ -5524,7 +5922,7 @@ static void showmask(int lumask, const local_params& lp, int xstart, int ystart, if (lp.shapmet == 0) { calcTransition(lox, loy, achm, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, achm, lp, zone, localFactor); } @@ -5552,33 +5950,32 @@ void ImProcFunctions::laplacian(const array2D &src, array2D &dst, const int H = bfh; const auto X = - [W](int x) -> int - { - return x < 0 ? x+2 : (x >= W ? x-2 : x); - }; + [W](int x) -> int { + return x < 0 ? x + 2 : (x >= W ? x - 2 : x); + }; const auto Y = - [H](int y) -> int - { - return y < 0 ? y+2 : (y >= H ? y-2 : y); - }; + [H](int y) -> int { + return y < 0 ? y + 2 : (y >= H ? y - 2 : y); + }; const auto get = - [&src](int y, int x) -> float - { - return std::max(src[y][x], 0.f); - }; + [&src](int y, int x) -> float { + return std::max(src[y][x], 0.f); + }; dst(W, H); const float f = factor / ceiling; #ifdef _OPENMP -# pragma omp parallel for if (multiThread) + # pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < H; ++y) { - int n = Y(y-1), s = Y(y+1); + int n = Y(y - 1), s = Y(y + 1); + for (int x = 0; x < W; ++x) { - int w = X(x-1), e = X(x+1); + int w = X(x - 1), e = X(x + 1); float v = -8.f * get(y, x) + get(n, x) + get(s, x) + get(y, w) + get(y, e) + get(n, w) + get(n, e) + get(s, w) + get(s, e); dst[y][x] = LIM(std::abs(v) - threshold, 0.f, ceiling) * f; } @@ -5590,7 +5987,7 @@ void ImProcFunctions::laplacian(const array2D &src, array2D &dst, void ImProcFunctions::discrete_laplacian_threshold(float * data_out, const float * data_in, size_t nx, size_t ny, float t) { - // BENCHFUN + // BENCHFUN if (!data_in || !data_out) { fprintf(stderr, "a pointer is NULL and should not be so\n"); @@ -5608,11 +6005,14 @@ void ImProcFunctions::discrete_laplacian_threshold(float * data_out, const float #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (size_t j = 0; j < ny; j++) { const float* ptr_in = &data_in[j * nx]; float* ptr_out = &data_out[j * nx]; + for (size_t i = 0; i < nx; i++) { float val = 0.f; + /* row differences */ if (0 < i) { const float diff = ptr_in[i] - ptr_in[i - 1]; @@ -5677,7 +6077,7 @@ void ImProcFunctions::rex_poisson_dct(float * data, size_t nx, size_t ny, double * @author Nicolas Limare * some adaptations for Rawtherapee */ - // BENCHFUN + // BENCHFUN /* * get the cosinus tables @@ -5702,11 +6102,13 @@ void ImProcFunctions::rex_poisson_dct(float * data, size_t nx, size_t ny, double #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (size_t i = 0; i < ny; ++i) { for (size_t j = 0; j < nx; ++j) { data[i * nx + j] *= m2 / (cosx[j] + cosy[i]); } } + // handle the first value, data[0, 0] = 0 data[0] = 0.f; @@ -5715,7 +6117,7 @@ void ImProcFunctions::rex_poisson_dct(float * data, size_t nx, size_t ny, double } -void ImProcFunctions::mean_dt(const float* data, size_t size, double& mean_p, double& dt_p) +void ImProcFunctions::mean_dt(const float* data, int size, double& mean_p, double& dt_p, double nbstd) { double mean = 0.; @@ -5724,7 +6126,8 @@ void ImProcFunctions::mean_dt(const float* data, size_t size, double& mean_p, do #ifdef _OPENMP #pragma omp parallel for reduction(+:mean,dt) if(multiThread) #endif - for (size_t i = 0; i < size; i++) { + + for (int i = 0; i < size; i++) { mean += static_cast(data[i]); dt += static_cast(SQR(data[i])); } @@ -5733,10 +6136,10 @@ void ImProcFunctions::mean_dt(const float* data, size_t size, double& mean_p, do dt /= size; dt -= SQR(mean); mean_p = mean; - dt_p = std::sqrt(dt); + dt_p = nbstd * std::sqrt(dt); } -void ImProcFunctions::normalize_mean_dt(float * data, const float * ref, size_t size, float mod, float sigm, float mdef, float sdef, float mdef2, float sdef2) +void ImProcFunctions::normalize_mean_dt(float * data, const float * ref, int size, float mod, float sigm, float mdef, float sdef, float mdef2, float sdef2, double nbstd) { /* * Copyright 2009-2011 IPOL Image Processing On Line http://www.ipol.im/ @@ -5757,18 +6160,18 @@ void ImProcFunctions::normalize_mean_dt(float * data, const float * ref, size_t double mean_ref, mean_data, dt_ref, dt_data; /* compute mean and variance of the two arrays */ - if(mdef!= 0.f && sdef != 0.f) { + if (mdef != 0.f && sdef != 0.f) { mean_ref = mdef; dt_ref = sdef; } else { - mean_dt(ref, size, mean_ref, dt_ref); + mean_dt(ref, size, mean_ref, dt_ref, nbstd); } - if(mdef2!= 0.f && sdef2 != 0.f) { - // printf("OK shortcut\n"); + + if (mdef2 != 0.f && sdef2 != 0.f) { mean_data = mdef2; dt_data = sdef2; } else { - mean_dt(data, size, mean_data, dt_data); + mean_dt(data, size, mean_data, dt_data, 1.0); } /* compute the normalization coefficients */ @@ -5783,7 +6186,8 @@ void ImProcFunctions::normalize_mean_dt(float * data, const float * ref, size_t #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif - for (size_t i = 0; i < size; i++) { + + for (int i = 0; i < size; i++) { data[i] = (modma * data[i] + sigmmmodmb) + onesmod * ref[i];//normalize mean and stdv and balance PDE } @@ -5802,18 +6206,21 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw * adapted for Rawtherapee by Jacques Desmis 6-2019 */ - // BENCHFUN - + // BENCHFUN + #ifdef RT_FFTW3F_OMP if (multiThread) { fftwf_init_threads(); fftwf_plan_with_nthreads(omp_get_max_threads()); } + #endif float *datashow = nullptr; + if (show != 0) { datashow = (float *) fftwf_malloc(sizeof(float) * bfw * bfh); + if (!datashow) { fprintf(stderr, "allocation error\n"); abort(); @@ -5821,6 +6228,7 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw } float *data_tmp = (float *) fftwf_malloc(sizeof(float) * bfw * bfh); + if (!data_tmp) { fprintf(stderr, "allocation error\n"); abort(); @@ -5830,6 +6238,7 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw discrete_laplacian_threshold(data_tmp, datain, bfw, bfh, thresh); float *data_fft = (float *) fftwf_malloc(sizeof(float) * bfw * bfh); + if (!data_fft) { fprintf(stderr, "allocation error\n"); abort(); @@ -5852,10 +6261,12 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw if (dEenable == 1) { float* data_fft04 = (float *)fftwf_malloc(sizeof(float) * bfw * bfh); float* data_tmp04 = (float *)fftwf_malloc(sizeof(float) * bfw * bfh); + if (!data_fft04 || !data_tmp04) { fprintf(stderr, "allocation error\n"); abort(); } + //second call to laplacian with 40% strength ==> reduce effect if we are far from ref (deltaE) discrete_laplacian_threshold(data_tmp04, datain, bfw, bfh, 0.4f * thresh); const auto dct_fw04 = fftwf_plan_r2r_2d(bfh, bfw, data_tmp04, data_fft04, FFTW_REDFT10, FFTW_REDFT10, FFTW_ESTIMATE | FFTW_DESTROY_INPUT); @@ -5873,13 +6284,17 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw #ifdef _OPENMP #pragma omp for #endif + for (int y = 0; y < bfh ; y++) {//mix two fftw Laplacian : plein if dE near ref int x = 0; #ifdef __SSE2__ + for (; x < bfw - 3; x += 4) { STVFU(data_fft[y * bfw + x], intp(pow_F(LVFU(dE[y * bfw + x]), exponentv), LVFU(data_fft[y * bfw + x]), LVFU(data_fft04[y * bfw + x]))); } + #endif + for (; x < bfw; x++) { data_fft[y * bfw + x] = intp(pow_F(dE[y * bfw + x], exponent), data_fft[y * bfw + x], data_fft04[y * bfw + x]); } @@ -5888,6 +6303,7 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw fftwf_free(data_fft04); fftwf_free(data_tmp04); } + if (show == 2) { for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { @@ -5914,7 +6330,7 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw fftwf_free(data_fft); if (show != 4 && normalize == 1) { - normalize_mean_dt(data_tmp, datain, bfw * bfh, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f); + normalize_mean_dt(data_tmp, datain, bfw * bfh, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.); } if (show == 0 || show == 4) { @@ -5922,6 +6338,7 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { dataout[y * bfw + x] = clipLoc(multy * data_tmp[y * bfw + x]); @@ -5936,15 +6353,19 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw } fftwf_free(data_tmp); + if (datashow) { fftwf_free(datashow); } + fftwf_cleanup(); #ifdef RT_FFTW3F_OMP + if (multiThread) { fftwf_cleanup_threads(); } + #endif } @@ -5974,14 +6395,16 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int mean_fab(xstart, ystart, bfw, bfh, bufcolorig, 0, original, fab, meanfab, maxfab, chrom, multiThread); corfab = 0.7f * (65535.f) / (fab + epsi);//empirical values 0.7 link to chromult - // printf("Fab=%f corfab=%f maxfab=%f\n", (double) fab, (double) corfab, (double) maxfab); + // printf("Fab=%f corfab=%f maxfab=%f\n", (double) fab, (double) corfab, (double) maxfab); float chromult = 1.f; - if(chrom > 0.f){ + + if (chrom > 0.f) { chromult = 1.f + 0.003f * chrom; } else { chromult = 1.f + 0.01f * chrom; } - // chromult * corfab * kmaskC + + // chromult * corfab * kmaskC float kinv = 1.f; float kneg = 1.f; @@ -5994,6 +6417,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { bufmaskblurcol->L[y][x] = original->L[y + ystart][x + xstart]; @@ -6050,7 +6474,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int if (rm > 0) { float **mb = blendblur; #ifdef _OPENMP - #pragma omp parallel if (multiThread) + #pragma omp parallel if (multiThread) #endif { gaussianBlur(mb, mb, bfw, bfh, rm); @@ -6060,7 +6484,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int if (blu_ma >= 0.25f) { if (!fftt) { // || (lp.fftColorMask && call != 2)) { #ifdef _OPENMP - #pragma omp parallel if (multiThread) + #pragma omp parallel if (multiThread) #endif { gaussianBlur(bufcolorig->L, blur, bfw, bfh, blu_ma / sk); @@ -6095,16 +6519,19 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int tmpab.clear(true); #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { tmpab.L[ir][jr] = bufcolorig->L[ir][jr]; tmpab.a[ir][jr] = bufcolorig->a[ir][jr]; tmpab.b[ir][jr] = bufcolorig->b[ir][jr]; - } + } + float noisevarab_r = SQR(lp.denoichmask / 10.f); - if(noisevarab_r > 0.f) { + + if (noisevarab_r > 0.f) { int wavelet_leve = 6; int minwin1 = rtengine::min(bfw, bfh); @@ -6123,11 +6550,11 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #endif - wavelet_decomposition Ldecomp(tmpab.L[0],tmpab.W, tmpab.H, maxlvl1, 1, sk, numThreads, lp.daubLen); - wavelet_decomposition adecomp(tmpab.a[0],tmpab.W, tmpab.H, maxlvl1, 1, sk, numThreads, lp.daubLen); - wavelet_decomposition bdecomp(tmpab.b[0],tmpab.W, tmpab.H, maxlvl1, 1, sk, numThreads, lp.daubLen); + wavelet_decomposition Ldecomp(tmpab.L[0], tmpab.W, tmpab.H, maxlvl1, 1, sk, numThreads, lp.daubLen); + wavelet_decomposition adecomp(tmpab.a[0], tmpab.W, tmpab.H, maxlvl1, 1, sk, numThreads, lp.daubLen); + wavelet_decomposition bdecomp(tmpab.b[0], tmpab.W, tmpab.H, maxlvl1, 1, sk, numThreads, lp.daubLen); float* noisevarchrom; - noisevarchrom = new float[bfw*bfh]; + noisevarchrom = new float[bfw * bfh]; float nvch = 0.6f;//high value float nvcl = 0.1f;//low value float seuil = 4000.f;//low @@ -6136,10 +6563,11 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int float ac = (nvch - nvcl) / (seuil - seuil2); float bc = nvch - seuil * ac; int bfw2 = (bfw + 1) / 2; - + #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float cN = std::sqrt(SQR(tmpab.a[ir][jr]) + SQR(tmpab.b[ir][jr])); @@ -6152,13 +6580,15 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int noisevarchrom[(ir >> 1)*bfw2 + (jr >> 1)] = nvcl; } } - + float madL[8][3]; int levred = maxlvl1; + if (!Ldecomp.memory_allocation_failed()) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic) collapse(2) if (multiThread) #endif + for (int lvl = 0; lvl < levred; lvl++) { for (int dir = 1; dir < 4; dir++) { int Wlvl_L = Ldecomp.level_W(lvl); @@ -6169,34 +6599,37 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int } } } - - if (!adecomp.memory_allocation_failed() && !bdecomp.memory_allocation_failed()) { - WaveletDenoiseAll_BiShrinkAB(Ldecomp, adecomp, noisevarchrom, madL, nullptr, 0, noisevarab_r, true, false, false, numThreads); - WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, nullptr, 0, noisevarab_r, true, false, false, numThreads); - WaveletDenoiseAll_BiShrinkAB(Ldecomp, bdecomp, noisevarchrom, madL, nullptr, 0, noisevarab_r, false, false, false, numThreads); - WaveletDenoiseAllAB(Ldecomp, bdecomp, noisevarchrom, madL, nullptr, 0, noisevarab_r, false, false, false, numThreads); + if (!adecomp.memory_allocation_failed() && !bdecomp.memory_allocation_failed()) { + WaveletDenoiseAll_BiShrinkAB(Ldecomp, adecomp, noisevarchrom, madL, nullptr, 0, noisevarab_r, true, false, false, numThreads); + WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, nullptr, 0, noisevarab_r, true, false, false, numThreads); + + WaveletDenoiseAll_BiShrinkAB(Ldecomp, bdecomp, noisevarchrom, madL, nullptr, 0, noisevarab_r, false, false, false, numThreads); + WaveletDenoiseAllAB(Ldecomp, bdecomp, noisevarchrom, madL, nullptr, 0, noisevarab_r, false, false, false, numThreads); } - + delete[] noisevarchrom; if (!Ldecomp.memory_allocation_failed()) { Ldecomp.reconstruct(tmpab.L[0]); } + if (!adecomp.memory_allocation_failed()) { adecomp.reconstruct(tmpab.a[0]); } + if (!bdecomp.memory_allocation_failed()) { bdecomp.reconstruct(tmpab.b[0]); } - + float meanfab1, fab1, maxfab1; std::unique_ptr buforig; buforig.reset(new LabImage(bfw, bfh)); #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { buforig->L[ir][jr] = tmpab.L[ir][jr]; @@ -6204,12 +6637,13 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int buforig->b[ir][jr] = tmpab.b[ir][jr]; } - + mean_fab(xstart, ystart, bfw, bfh, buforig.get(), 1, buforig.get(), fab1, meanfab1, maxfab1, chrom, multiThread); - // printf("Fab den=%f \n", (double) fab1); + // printf("Fab den=%f \n", (double) fab1); fab = fab1;//fab denoise - + } + // end code denoise mask chroma @@ -6226,6 +6660,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #ifdef _OPENMP #pragma omp for schedule(dynamic, 16) #endif + for (int ir = 0; ir < bfh; ir++) { #ifdef __SSE2__ @@ -6233,12 +6668,12 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int int i = 0; for (; i < bfw - 3; i += 4) { - // STVF(atan2Buffer[i], xatan2f(LVFU(bufcolorig->b[ir][i]), LVFU(bufcolorig->a[ir][i]))); + // STVF(atan2Buffer[i], xatan2f(LVFU(bufcolorig->b[ir][i]), LVFU(bufcolorig->a[ir][i]))); STVF(atan2Buffer[i], xatan2f(LVFU(tmpab.b[ir][i]), LVFU(tmpab.a[ir][i]))); } for (; i < bfw; i++) { - // atan2Buffer[i] = xatan2f(bufcolorig->b[ir][i], bufcolorig->a[ir][i]); + // atan2Buffer[i] = xatan2f(bufcolorig->b[ir][i], bufcolorig->a[ir][i]); atan2Buffer[i] = xatan2f(tmpab.b[ir][i], tmpab.a[ir][i]); } } @@ -6268,13 +6703,13 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int } if (locllmasCurve && llmasutili) { - // printf("s"); + // printf("s"); kmaskL = 32768.f * LIM01(kinv - kneg * locllmasCurve[(500.f / 32768.f) * bufcolorig->L[ir][jr]]); } if (!deltaE && locccmasCurve && lcmasutili) { - // kmaskC = LIM01(kinv - kneg * locccmasCurve[500.f * (0.0001f + std::sqrt(SQR(bufcolorig->a[ir][jr]) + SQR(bufcolorig->b[ir][jr])) / (fab))]); + // kmaskC = LIM01(kinv - kneg * locccmasCurve[500.f * (0.0001f + std::sqrt(SQR(bufcolorig->a[ir][jr]) + SQR(bufcolorig->b[ir][jr])) / (fab))]); kmaskC = LIM01(kinv - kneg * locccmasCurve[500.f * (0.0001f + std::sqrt(SQR(tmpab.a[ir][jr]) + SQR(tmpab.b[ir][jr])) / fab)]); } @@ -6282,7 +6717,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #ifdef __SSE2__ const float huema = atan2Buffer[jr]; #else - // const float huema = xatan2f(bufcolorig->b[ir][jr], bufcolorig->a[ir][jr]); + // const float huema = xatan2f(bufcolorig->b[ir][jr], bufcolorig->a[ir][jr]); const float huema = xatan2f(tmpab.b[ir][jr], tmpab.a[ir][jr]); #endif float h = Color::huelab_to_huehsv2(huema); @@ -6319,27 +6754,31 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int } } } - + if (lap > 0.f && pde) { array2D mask; mask(bfw, bfh); - float amount = LIM01(float(lap)/100.f); + float amount = LIM01(float(lap) / 100.f); array2D LL(bfw, bfh, bufcolorig->L, ARRAY2D_BYREFERENCE); laplacian(LL, mask, bfw, bfh, 25.f, 20000.f, amount, false); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int i = 0; i < bfh; ++i) { for (int j = 0; j < bfw; ++j) { mask[i][j] = LIM01(mask[i][j]); } } + for (int i = 0; i < 3; ++i) { boxblur(static_cast(mask), static_cast(mask), 5 / sk, bfw, bfh, false); } + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int i = 0; i < bfh; ++i) { for (int j = 0; j < bfw; ++j) { bufmaskblurcol->L[i][j] += clipLoc(100000.f * (mask[i][j]));//increase strongly result @@ -6348,6 +6787,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int } std::unique_ptr bufprov; + if (delt) { bufprov.reset(new LabImage(bfw, bfh)); bufprov->CopyFrom(bufmaskblurcol, multiThread); @@ -6375,6 +6815,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { float2 sincosval = xsincosf(hue[ir][jr]); @@ -6389,6 +6830,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufmaskblurcol->L[ir][jr] *= (1.f + blendstru[ir][jr]); @@ -6400,6 +6842,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { bufmaskblurcol->L[ir][jr] = 0.5f * lmasklocalcurve[2.f * bufmaskblurcol->L[ir][jr]]; @@ -6445,9 +6888,11 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #endif wavelet_decomposition *wdspot = new wavelet_decomposition(bufmaskblurcol->L[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen); + if (wdspot->memory_allocation_failed()) { return; } + float mean[10]; float meanN[10]; float sigma[10]; @@ -6457,6 +6902,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int Evaluate2(*wdspot, mean, meanN, sigma, sigmaN, MaxP, MaxN, numThreads); float alow = 1.f; float blow = 0.f; + if (level_hl != level_bl) { alow = 1.f / (level_hl - level_bl); blow = -alow * level_bl; @@ -6469,13 +6915,13 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int ahigh = 1.f / (level_hr - level_br); bhigh = -ahigh * level_br; } - + for (int dir = 1; dir < 4; dir++) { for (int level = level_bl; level < maxlvl; ++level) { int W_L = wdspot->level_W(level); int H_L = wdspot->level_H(level); float* const* wav_L = wdspot->level_coeffs(level); - + if (MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f) { float insigma = 0.666f; //SD float logmax = log(MaxP[level]); //log Max @@ -6486,12 +6932,13 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int float asig = 0.166f / (sigma[level]); float bsig = 0.5f - asig * mean[level]; float amean = 0.5f / mean[level]; - + #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < W_L * H_L; i++) { - if(loclmasCurvecolwav && lmasutilicolwav) { + if (loclmasCurvecolwav && lmasutilicolwav) { float absciss; float &val = wav_L[dir][i]; @@ -6507,6 +6954,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int } float klev = 1.f; + if (level >= level_hl && level <= level_hr) { klev = 1.f; } @@ -6522,7 +6970,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int klev = ahigh * level + bhigh; } } - + float kc = klev * (loclmasCurvecolwav[absciss * 500.f] - 0.5f); float amplieffect = kc <= 0.f ? 1.f : 4.f; @@ -6530,14 +6978,14 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int kinterm = kinterm <= 0.f ? 0.01f : kinterm; val *= kinterm; - + } } } - + } } - + wdspot->reconstruct(bufmaskblurcol->L[0], 1.f); delete wdspot; @@ -6547,6 +6995,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float huemah = xatan2f(bufmaskblurcol->b[ir][jr], bufmaskblurcol->a[ir][jr]); @@ -6604,6 +7053,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { const float rdEval = rdE[ir][jr]; @@ -6616,38 +7066,40 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int struct grad_params gp; - if ((indic == 0 && lp.strmaexp != 0.f) || (indic ==12 && lp.str_mas != 0.f)) { + if ((indic == 0 && lp.strmaexp != 0.f) || (indic == 12 && lp.str_mas != 0.f)) { calclocalGradientParams(lp, gp, ystart, xstart, bfw, bfh, indic); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufmaskblurcol->L[ir][jr] *= ImProcFunctions::calcGradientFactor(gp, jr, ir); } } } -/* - if (lap > 0.f) { - const float *datain = bufmaskblurcol->L[0]; - const std::unique_ptr data_tmp(new float[bfh * bfw]); - if (!pde) { - ImProcFunctions::discrete_laplacian_threshold(data_tmp.get(), datain, bfw, bfh, 200.f * lap); - } else { - ImProcFunctions::retinex_pde(datain, data_tmp.get(), bfw, bfh, 12.f * lap, 1.f, nullptr, 0, 0, 1); - } + /* + if (lap > 0.f) { + const float *datain = bufmaskblurcol->L[0]; + const std::unique_ptr data_tmp(new float[bfh * bfw]); -#ifdef _OPENMP - #pragma omp parallel for if (multiThread) -#endif - for (int y = 0; y < bfh; y++) { - for (int x = 0; x < bfw; x++) { - bufmaskblurcol->L[y][x] = data_tmp[y * bfw + x]; + if (!pde) { + ImProcFunctions::discrete_laplacian_threshold(data_tmp.get(), datain, bfw, bfh, 200.f * lap); + } else { + ImProcFunctions::retinex_pde(datain, data_tmp.get(), bfw, bfh, 12.f * lap, 1.f, nullptr, 0, 0, 1); + } + + #ifdef _OPENMP + #pragma omp parallel for if (multiThread) + #endif + for (int y = 0; y < bfh; y++) { + for (int x = 0; x < bfw; x++) { + bufmaskblurcol->L[y][x] = data_tmp[y * bfw + x]; + } + } } - } - } - */ + */ } const float radiusb = 1.f / sk; @@ -6721,6 +7173,7 @@ void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, co #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < transformed->H; y++) { int loy = cy + y; @@ -6731,7 +7184,7 @@ void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, co if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -6794,6 +7247,7 @@ void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, co transformed->b[y][x] = 0.f; } } + break; } @@ -6862,6 +7316,7 @@ void ImProcFunctions::Sharp_Local(int call, float **loctemp, int senstype, const #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < transformed->H; y++) { const int loy = cy + y; const bool isZone0 = loy > lp.yc + lp.ly || loy < lp.yc - lp.lyT; // whole line is zone 0 => we can skip a lot of processing @@ -6877,7 +7332,7 @@ void ImProcFunctions::Sharp_Local(int call, float **loctemp, int senstype, const if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -6931,7 +7386,7 @@ void ImProcFunctions::Sharp_Local(int call, float **loctemp, int senstype, const void ImProcFunctions::Exclude_Local(float **deltaso, float hueref, float chromaref, float lumaref, float sobelref, float meansobel, const struct local_params & lp, const LabImage * original, LabImage * transformed, const LabImage * rsv, const LabImage * reserv, int cx, int cy, int sk) { - // BENCHFUN + // BENCHFUN { const float ach = lp.trans / 100.f; const float varsens = lp.sensexclu; @@ -6976,8 +7431,8 @@ void ImProcFunctions::Exclude_Local(float **deltaso, float hueref, float chromar #pragma omp barrier #pragma omp for schedule(dynamic,16) #endif - for (int y = 0; y < transformed->H; y++) - { + + for (int y = 0; y < transformed->H; y++) { const int loy = cy + y; const bool isZone0 = loy > (lp.yc + lp.ly - 1) || loy < lp.yc - lp.lyT; // // -1 fix issue 5554 @@ -7006,7 +7461,7 @@ void ImProcFunctions::Exclude_Local(float **deltaso, float hueref, float chromar if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -7067,13 +7522,13 @@ void ImProcFunctions::Exclude_Local(float **deltaso, float hueref, float chromar } - - + + void ImProcFunctions::transit_shapedetect_retinex(int call, int senstype, LabImage * bufexporig, LabImage * bufexpfin, LabImage * bufmask, LabImage * buforigmas, float **buflight, float **bufchro, const float hueref, const float chromaref, const float lumaref, struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk) { - //BENCHFUN + //BENCHFUN { const int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); const int yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, original->H); @@ -7101,17 +7556,19 @@ void ImProcFunctions::transit_shapedetect_retinex(int call, int senstype, LabIma const float kab = balancedeltaE(lp.balance) / SQR(327.68f); const float kH = lp.balanceh; const float kch = balancedeltaE(kH); + if (lp.colorde == 0) { lp.colorde = -1;//to avoid black } -/* - float ampli = 1.f + std::fabs(lp.colorde); - ampli = 2.f + 0.5f * (ampli - 2.f); - float darklim = 5000.f; - float aadark = -1.f; - float bbdark = darklim; -*/ + /* + float ampli = 1.f + std::fabs(lp.colorde); + ampli = 2.f + 0.5f * (ampli - 2.f); + + float darklim = 5000.f; + float aadark = -1.f; + float bbdark = darklim; + */ const bool showmas = lp.showmaskretimet == 3 ; const std::unique_ptr origblur(new LabImage(GW, GH)); @@ -7146,8 +7603,8 @@ void ImProcFunctions::transit_shapedetect_retinex(int call, int senstype, LabIma #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif - for (int y = ystart; y < yend; y++) - { + + for (int y = ystart; y < yend; y++) { const int loy = cy + y; for (int x = xstart; x < xend; x++) { @@ -7157,7 +7614,7 @@ void ImProcFunctions::transit_shapedetect_retinex(int call, int senstype, LabIma if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -7201,8 +7658,8 @@ void ImProcFunctions::transit_shapedetect_retinex(int call, int senstype, LabIma clc = previewreti ? settings->previewselection * 100.f : bufchro[y - ystart][x - xstart]; } else { cli = buflight[y][x]; - // clc = previewreti ? settings->previewselection * 100.f : bufchro[y][x]; - clc = previewreti ? reducdE * 10000.f * lp.colorde: bufchro[y][x]; + // clc = previewreti ? settings->previewselection * 100.f : bufchro[y][x]; + clc = previewreti ? reducdE * 10000.f * lp.colorde : bufchro[y][x]; } @@ -7289,8 +7746,7 @@ void ImProcFunctions::transit_shapedetect_retinex(int call, int senstype, LabIma } } - if (showmas || retishow || previewreti) - { + if (showmas || retishow || previewreti) { return; } @@ -7301,7 +7757,7 @@ void ImProcFunctions::transit_shapedetect_retinex(int call, int senstype, LabIma void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexporig, LabImage * originalmask, float **bufchro, bool HHutili, const float hueref, const float chromaref, const float lumaref, float sobelref, float meansobel, float ** blend2, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk) { - // BENCHFUN + // BENCHFUN const int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); const int yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, original->H); const int xstart = rtengine::max(static_cast(lp.xc - lp.lxL) - cx, 0); @@ -7313,14 +7769,11 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexpo const float ach = lp.trans / 100.f; float varsens = lp.sensex; - if (senstype == 6 || senstype == 7) //cbdl - { + if (senstype == 6 || senstype == 7) { //cbdl varsens = lp.senscb; - } else if (senstype == 8) //TM - { + } else if (senstype == 8) { //TM varsens = lp.senstm; - } else if (senstype == 10) //local contrast - { + } else if (senstype == 10) { //local contrast varsens = lp.senslc; } @@ -7355,8 +7808,7 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexpo const bool usemasktm = (lp.showmasktmmet == 2 || lp.enatmMask || lp.showmasktmmet == 4) && senstype == 8; const bool usemaskall = (usemaskcb || usemasktm); - if (usemaskall) - { + if (usemaskall) { origblurmask.reset(new LabImage(bfw, bfh)); #ifdef _OPENMP @@ -7368,24 +7820,26 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexpo gaussianBlur(originalmask->b, origblurmask->b, bfw, bfh, radius); } } - if (lp.equtm && senstype == 8) //normalize luminance for Tone mapping , at this place we can use for others senstype! - { + + if (lp.equtm && senstype == 8) { //normalize luminance for Tone mapping , at this place we can use for others senstype! float *datain = new float[bfh * bfw]; float *data = new float[bfh * bfw]; #ifdef _OPENMP #pragma omp parallel if (multiThread) #endif + for (int y = ystart; y < yend; y++) for (int x = xstart; x < xend; x++) { datain[(y - ystart) * bfw + (x - xstart)] = original->L[y][x]; data[(y - ystart)* bfw + (x - xstart)] = bufexporig->L[y - ystart][x - xstart]; } - normalize_mean_dt(data, datain, bfh * bfw, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f); + normalize_mean_dt(data, datain, bfh * bfw, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.); #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = ystart; y < yend; y++) for (int x = xstart; x < xend; x++) { bufexporig->L[y - ystart][x - xstart] = data[(y - ystart) * bfw + x - xstart]; @@ -7402,8 +7856,8 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexpo #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif - for (int y = 0; y < bfh; y++) - { + + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { origblur->L[y][x] = original->L[y + ystart][x + xstart]; origblur->a[y][x] = original->a[y + ystart][x + xstart]; @@ -7434,8 +7888,8 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexpo #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif - for (int y = ystart; y < yend; y++) - { + + for (int y = ystart; y < yend; y++) { const int loy = cy + y; #ifdef __SSE2__ @@ -7464,7 +7918,7 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexpo if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -7593,6 +8047,7 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H; y++) { for (int x = 0; x < transformed->W; x++) { temp->L[y][x] = original->L[y][x]; @@ -7609,19 +8064,24 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp lab2rgb(*temp, *tmpImage, params->icm.workingProfile); Glib::ustring prof = params->icm.workingProfile; + if (tonecurv) { //Tone response curve : does nothing if gamma=2.4 and slope=12.92 ==> gamma sRGB const float gamtone = params->locallab.spots.at(sp).gamSH; const float slotone = params->locallab.spots.at(sp).sloSH; int ill = 0; cmsHTRANSFORM dummy = nullptr; - workingtrc(tmpImage.get(), tmpImage.get(), GW, GH, -5, prof, 2.4, 12.92310, ill, 0, dummy, true, false, false); - // workingtrc(tmpImage.get(), tmpImage.get(), GW, GH, 5, prof, gamtone, slotone, illum, 0, dummy, false, true, true);//to keep if we want improve with illuminant and primaries - workingtrc(tmpImage.get(), tmpImage.get(), GW, GH, 1, prof, gamtone, slotone, ill, 0, dummy, false, true, true);//be careful no gamut control + int locprim = 0; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + workingtrc(0, tmpImage.get(), tmpImage.get(), GW, GH, -5, prof, 2.4, 12.92310, 0, ill, 0, 0, rdx, rdy, grx, gry, blx, bly , meanx, meany, meanxe, meanye, dummy, true, false, false, false); + // workingtrc(tmpImage.get(), tmpImage.get(), GW, GH, 5, prof, gamtone, slotone, illum, 0, dummy, false, true, true);//to keep if we want improve with illuminant and primaries + workingtrc(0, tmpImage.get(), tmpImage.get(), GW, GH, 1, prof, gamtone, slotone, 0, ill, 0, locprim, rdx, rdy, grx, gry, blx, bly , meanx, meany, meanxe, meanye, dummy, false, true, true, false);//be careful no gamut control } if (tonequ) { tone_eq(this, tmpImage.get(), lp, params->icm.workingProfile, sk, multiThread); + // tone_eq(tmpImage.get(), lp, params->icm.workingProfile, sk, multiThread); } rgb2lab(*tmpImage, *temp, params->icm.workingProfile); @@ -7634,6 +8094,7 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < temp->H; y++) { for (int x = 0; x < temp->W; x++) { const float lh = 0.5f * exlocalcurve[2.f * temp->L[y][x]]; // / ((lighn) / 1.9f) / 3.61f; //lh between 0 and 0 50 or more @@ -7662,6 +8123,7 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H; y++) { for (int x = 0; x < transformed->W; x++) { const float epsi = original->L[y][x] == 0.f ? 0.001f : 0.f; @@ -7676,6 +8138,7 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H; y++) { for (int x = 0; x < transformed->W; x++) { //same as in "normal" @@ -7694,6 +8157,7 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H; y++) { for (int x = 0; x < transformed->W; x++) { temp->L[y][x] = 0.5f * lllocalcurve[2.f * original->L[y][x]]; @@ -7760,6 +8224,7 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < transformed->H; y++) { const int loy = cy + y; @@ -7779,12 +8244,13 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor);//rect not good } //deltaE float reducdE; + if (zone != 2) { const float abdelta2 = SQR(refa - maskptr->a[y][x]) + SQR(refb - maskptr->b[y][x]); const float chrodelta2 = SQR(std::sqrt(SQR(maskptr->a[y][x]) + SQR(maskptr->b[y][x])) - (chromaref * 327.68f)); @@ -7940,7 +8406,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform int nsb = 0; // single precision for the result float avA, avB, avL; - int spotSize = 0.88623f * rtengine::max(1, lp.cir / sk); //18 + int spotSize = 0.88623f * rtengine::max(1.f, lp.cir / sk); //18 //O.88623 = std::sqrt(PI / 4) ==> square equal to circle int spotSise2; // = 0.88623f * max (1, lp.cir / sk); //18 @@ -7951,7 +8417,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform LabImage *origblur = nullptr; LabImage *blurorig = nullptr; - int spotSi = 1 + 2 * rtengine::max(1, lp.cir / sk); + int spotSi = 1 + 2 * rtengine::max(1.f, lp.cir / sk); if (spotSi < 5) { spotSi = 5; @@ -7970,7 +8436,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform isdenoise = true; } - if (isdenoise) { + if (isdenoise) { origblur = new LabImage(spotSi, spotSi); blurorig = new LabImage(spotSi, spotSi); @@ -8134,11 +8600,12 @@ void optfft(int N_fftwsize, int &bfh, int &bfw, int &bfhr, int &bfwr, struct loc int ftsizeW = 1; int deltaw = 150; int deltah = 150; - - if(W < 4000) { + + if (W < 4000) { deltaw = 80; } - if(H < 4000) { + + if (H < 4000) { deltah = 80; } @@ -8156,14 +8623,15 @@ void optfft(int N_fftwsize, int &bfh, int &bfw, int &bfhr, int &bfwr, struct loc break; } } - - if(fulima == 2) {// if full image, the ftsizeH and ftsizeW is a bit larger (about 10 to 200 pixels) than the image dimensions so that it is fully processed (consumes a bit more resources) + + if (fulima == 2) { // if full image, the ftsizeH and ftsizeW is a bit larger (about 10 to 200 pixels) than the image dimensions so that it is fully processed (consumes a bit more resources) for (int ftfu = 0; ftfu < N_fftwsize; ftfu++) { //find best values if (fftw_size[ftfu] <= (H + deltah)) { ftsizeH = fftw_size[ftfu]; break; } } + for (int ftfu = 0; ftfu < N_fftwsize; ftfu++) { //find best values if (fftw_size[ftfu] <= (W + deltaw)) { ftsizeW = fftw_size[ftfu]; @@ -8173,7 +8641,7 @@ void optfft(int N_fftwsize, int &bfh, int &bfw, int &bfhr, int &bfwr, struct loc } if (settings->verbose) { - if(fulima == 2) { + if (fulima == 2) { printf("Full image: ftsizeWF=%i ftsizeH=%i\n", ftsizeW, ftsizeH); } else { @@ -8186,6 +8654,7 @@ void optfft(int N_fftwsize, int &bfh, int &bfw, int &bfhr, int &bfwr, struct loc bool reduW = false; bool reduH = false; bool exec = true; + if (ystart == 0 && yend < H) { lp.ly -= (bfh - ftsizeH); } else if (ystart != 0 && yend == H) { @@ -8197,7 +8666,7 @@ void optfft(int N_fftwsize, int &bfh, int &bfw, int &bfhr, int &bfwr, struct loc lp.ly -= (bfh - ftsizeH); } } else if (ystart == 0 && yend == H) { - // bfhr = ftsizeH; + // bfhr = ftsizeH; bfhr = bfh; reduH = true; exec = false; @@ -8214,11 +8683,12 @@ void optfft(int N_fftwsize, int &bfh, int &bfw, int &bfhr, int &bfwr, struct loc lp.lx -= (bfw - ftsizeW); } } else if (xstart == 0 && xend == W) { - // bfwr = ftsizeW; + // bfwr = ftsizeW; bfwr = bfw; reduW = true; exec = false; } + //new values optimized ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, H); @@ -8316,6 +8786,7 @@ void ImProcFunctions::BlurNoise_Local(LabImage *tmp1, LabImage * originalmask, c #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = ystart; y < yend; y++) { const int loy = cy + y; @@ -8325,7 +8796,7 @@ void ImProcFunctions::BlurNoise_Local(LabImage *tmp1, LabImage * originalmask, c if (lp.shapmet == 0) { calcTransition(lox, loy, ach, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } @@ -8394,14 +8865,6 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in int bfw = xend - xstart; int bfh = yend - ystart; - int bfhr = bfh; - int bfwr = bfw; - if (lp.blurcolmask >= 0.25f && lp.fftColorMask && call == 2) { - optfft(N_fftwsize, bfh, bfw, bfhr, bfwr, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy, lp.fullim); - } - - bfh = bfhr; - bfw = bfwr; //initialize scope float varsens = lp.sensex;//exposure @@ -8424,9 +8887,24 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in varsens = lp.sensilog; } else if (senstype == 20) { //common mask varsens = lp.sensimas; - } else if (senstype == 31) { //ciecam + } else if (senstype == 31) { //ciecam varsens = lp.sensicie; - } + } + int bfhr = bfh; + int bfwr = bfw; + + if (lp.blurcolmask >= 0.25f && lp.fftColorMask && call == 2 && senstype == 0) { + optfft(N_fftwsize, bfh, bfw, bfhr, bfwr, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy, lp.fullim); + } + + if (lp.blurciemask >= 0.25f && lp.fftcieMask && call == 2 && senstype == 31) { + optfft(N_fftwsize, bfh, bfw, bfhr, bfwr, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy, lp.fullim); + } + + bfh = bfhr; + bfw = bfwr; + + bool delt = lp.deltaem; //sobel sobelref /= 100.f; @@ -8453,7 +8931,7 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in const bool origshow = ((lp.showmasksoftmet == 5) && senstype == 3 && lp.softmet == 1); const bool logshow = ((lp.showmasklogmet == 1 || lp.showmasklogmet == 2) && senstype == 11); const bool cieshow = ((lp.showmaskciemet == 1 || lp.showmaskciemet == 2) && senstype == 31); - + const bool masshow = ((lp.showmask_met == 1) && senstype == 20); const bool previewvib = ((lp.showmaskvibmet == 4) && senstype == 2); @@ -8497,9 +8975,11 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in float aadark = -1.f; float bbdark = darklim; bool usemask = true; - if(originalmask == nullptr) { + + if (originalmask == nullptr) { usemask = false; } + const bool usemaskvib = (lp.showmaskvibmet == 2 || lp.enavibMask || lp.showmaskvibmet == 4) && senstype == 2; const bool usemaskexp = (lp.showmaskexpmet == 2 || lp.enaExpMask || lp.showmaskexpmet == 5) && senstype == 1; const bool usemaskcol = (lp.showmaskcolmet == 2 || lp.enaColorMask || lp.showmaskcolmet == 5) && senstype == 0; @@ -8510,6 +8990,7 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in const bool usemasklog = (lp.showmasklogmet == 2 || lp.enaLMask || lp.showmasklogmet == 4) && senstype == 11; const bool usemaskcie = (lp.showmaskciemet == 2 || lp.enacieMask || lp.showmaskciemet == 4) && senstype == 31; const bool usemaskall = usemask && (usemaskexp || usemaskvib || usemaskcol || usemaskSH || usemasktm || usemasklc || usemasklog || usemaskcie || usemaskmas); + //blur a little mask if (usemaskall) { origblurmask.reset(new LabImage(bfw, bfh)); @@ -8533,29 +9014,32 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in #ifdef _OPENMP #pragma omp parallel for #endif + for (int y = ystart; y < yend; y++) for (int x = xstart; x < xend; x++) { datain[(y - ystart) * bfw + (x - xstart)] = original->L[y][x]; data[(y - ystart)* bfw + (x - xstart)] = bufexpfin->L[y - ystart][x - xstart]; } - if(call == 3 || call == 2) {//improccoordinator and simpleprocess - normalize_mean_dt(data, datain, bfw * bfh, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f); - } else if(call == 1) {//dcrop + + if (call == 3 || call == 2) { //improccoordinator and simpleprocess + normalize_mean_dt(data, datain, bfw * bfh, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.); + } else if (call == 1) { //dcrop float ma = meantm; float sa = stdtm; - float ma2 = (float) params->locallab.spots.at(sp).noiselumc; + float ma2 = (float) params->locallab.spots.at(sp).noiselumc; float sa2 = (float) params->locallab.spots.at(sp).softradiustm; //printf("ma=%f sa=%f ma2=%f sa2=%f\n", (double) ma, (double) sa, (double) ma2, (double) sa2); //use normalize with mean and stdv - normalize_mean_dt(data, datain, bfw * bfh, 1.f, 1.f, ma, sa, ma2, sa2); + normalize_mean_dt(data, datain, bfw * bfh, 1.f, 1.f, ma, sa, ma2, sa2, 1.); } - - - - + + + + #ifdef _OPENMP #pragma omp parallel for #endif + for (int y = ystart; y < yend; y++) for (int x = xstart; x < xend; x++) { bufexpfin->L[y - ystart][x - xstart] = data[(y - ystart) * bfw + x - xstart]; @@ -8570,14 +9054,14 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in const float repart = 1.0f - 0.01f * lp.repartm; #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if(multiThread) + #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif - for (int y = ystart; y < yend; y++){ + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { - bufexpfin->L[y - ystart][x - xstart]= intp(repart, original->L[y][x], bufexpfin->L[y - ystart][x - xstart]); - bufexpfin->a[y - ystart][x - xstart]= intp(repart, original->a[y][x], bufexpfin->a[y - ystart][x - xstart]); - bufexpfin->b[y - ystart][x - xstart]= intp(repart, original->b[y][x], bufexpfin->b[y - ystart][x - xstart]); + bufexpfin->L[y - ystart][x - xstart] = intp(repart, original->L[y][x], bufexpfin->L[y - ystart][x - xstart]); + bufexpfin->a[y - ystart][x - xstart] = intp(repart, original->a[y][x], bufexpfin->a[y - ystart][x - xstart]); + bufexpfin->b[y - ystart][x - xstart] = intp(repart, original->b[y][x], bufexpfin->b[y - ystart][x - xstart]); } } } @@ -8590,6 +9074,7 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { origblur->L[y][x] = original->L[y + ystart][x + xstart]; @@ -8603,19 +9088,26 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in gaussianBlur(origblur->b, origblur->b, bfw, bfh, radius); } - - + + //choice between original and mask const LabImage *maskptr = usemaskall ? origblurmask.get() : origblur.get(); //parameters deltaE - //increase a bit lp.thr and lp.iterat and kL if HDR only with log encoding and CAM16 Jz - if(senstype == 11 || senstype == 31) { + int limvarsens = 50;//begin change calculation reduction deltaE + if ((senstype == 11 || (senstype == 31 && lp.islogcie)) && (varsens < limvarsens)) { + //increase a bit lp.thr and lp.iterat and kL if HDR only with log encoding and CAM16 Jz lp.thr *= 1.2f; lp.iterat *= 1.2f; - kL *= 1.2f; + kL /= 1.2f; + } else if ((senstype == 11 || (senstype == 31 && lp.islogcie)) && (varsens >= limvarsens)) {//for log encoding and cam16 is log encode used + lp.thr += 10.f;//increase threshold deltaE + lp.thr = LIM(lp.thr, 0.f, 15.0f); + lp.balance -= 2.3f; + lp.balance = LIM(lp.balance, 0.05f, 2.5f); // down balance ab-L + kL = lp.balance / SQR(327.68f); } - + const float mindE = 2.f + MINSCOPE * varsens * lp.thr; const float maxdE = 5.f + MAXSCOPE * varsens * (1 + 0.1f * lp.thr); const float mindElim = 2.f + MINSCOPE * limscope * lp.thr; @@ -8632,6 +9124,7 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < bfh; y++) { const int loy = y + ystart + cy; @@ -8660,7 +9153,7 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in //calculate transition if (lp.shapmet == 0) { calcTransition(lox, loy, achm, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, achm, lp, zone, localFactor); } @@ -8701,6 +9194,13 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in const float dE = rsob + std::sqrt(kab * (kch * chrodelta2 + kH * huedelta2) + kL * SQR(refL - maskptr->L[y][x])); //reduction action with deltaE float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, varsens); + if ((senstype == 11 || ( senstype == 31 && lp.islogcie)) && (varsens >= limvarsens)) { + int maxvarsens = 90;//arbitrary value to get maximum incidence + float ared = (1.f - reducdE) / (maxvarsens - limvarsens); + float bred = 1.f - ared * maxvarsens; + reducdE = ared * varsens + bred; + reducdE = LIM(reducdE, 0.1f, 1.f); + } if(varsens == 100.f) { reducdE = 1.f; } @@ -8713,7 +9213,8 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in cla = bufexpfin->a[y][x] - original->a[y + ystart][x + xstart]; clb = bufexpfin->b[y][x] - original->b[y + ystart][x + xstart]; } - if(lp.blwh) { + + if (lp.blwh) { cla = 0.f; clb = 0.f; } @@ -8728,7 +9229,7 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in if (zone > 0) { //simplified transformed with deltaE and transition - transformed->L[y + ystart][x + xstart] = clipLoc(original->L[y + ystart][x + xstart] + factorx * realstrdE); + transformed->L[y + ystart][x + xstart] = clipLoc(original->L[y + ystart][x + xstart] + factorx * realstrdE);//clipLoc now do nothing...just keep in ace off float diflc = factorx * realstrdE; transformed->a[y + ystart][x + xstart] = clipC(original->a[y + ystart][x + xstart] + factorx * realstradE); const float difa = factorx * realstradE; @@ -8825,17 +9326,20 @@ void ImProcFunctions::exposure_pde(float * dataor, float * datain, float * datao fftwf_cleanup(); #ifdef RT_FFTW3F_OMP + if (multiThread) { fftwf_cleanup_threads(); } + #endif - normalize_mean_dt(data, dataor, bfw * bfh, mod, 1.f, 0.f, 0.f, 0.f, 0.f); + normalize_mean_dt(data, dataor, bfw * bfh, mod, 1.f, 0.f, 0.f, 0.f, 0.f, 1.); { #ifdef _OPENMP #pragma omp parallel for #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { dataout[y * bfw + x] = clipLoc(data[y * bfw + x]); @@ -8873,6 +9377,7 @@ void ImProcFunctions::fftw_convol_blur(float * input, float * output, int bfw, i fftwf_init_threads(); fftwf_plan_with_nthreads(omp_get_max_threads()); } + #endif @@ -8921,6 +9426,7 @@ void ImProcFunctions::fftw_convol_blur(float * input, float * output, int bfw, i #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int j = 0; j < bfh; j++) { int index = j * bfw; @@ -8940,6 +9446,7 @@ void ImProcFunctions::fftw_convol_blur(float * input, float * output, int bfw, i #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int j = 0; j < bfh; j++) { int index = j * bfw; @@ -8958,6 +9465,7 @@ void ImProcFunctions::fftw_convol_blur(float * input, float * output, int bfw, i #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int j = 0; j < bfh; j++) { int index = j * bfw; @@ -8969,6 +9477,7 @@ void ImProcFunctions::fftw_convol_blur(float * input, float * output, int bfw, i #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int j = 0; j < bfh; j++) { int index = j * bfw; @@ -8985,6 +9494,7 @@ void ImProcFunctions::fftw_convol_blur(float * input, float * output, int bfw, i #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int index = 0; index < image_size; index++) { //restore data output[index] /= image_sizechange; } @@ -8993,9 +9503,11 @@ void ImProcFunctions::fftw_convol_blur(float * input, float * output, int bfw, i fftwf_free(out); #ifdef RT_FFTW3F_OMP + if (multiThread) { fftwf_cleanup_threads(); } + #endif } @@ -9020,6 +9532,7 @@ void ImProcFunctions::fftw_convol_blur2(float **input2, float **output2, int bfw #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { input[y * bfw + x] = input2[y][x]; @@ -9031,6 +9544,7 @@ void ImProcFunctions::fftw_convol_blur2(float **input2, float **output2, int bfw #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { output2[y][x] = output[y * bfw + x]; @@ -9115,6 +9629,7 @@ void ImProcFunctions::fftw_tile_blur(int GW, int GH, int tilssize, int max_numbl #ifdef _OPENMP #pragma omp for #endif + for (int vblk = 0; vblk < numblox_H; ++vblk) { int top = (vblk - 1) * offset; @@ -9227,6 +9742,7 @@ void ImProcFunctions::fftw_tile_blur(int GW, int GH, int tilssize, int max_numbl #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < GH; ++i) { for (int j = 0; j < GW; ++j) { tmp1[i][j] = Lresult[i][j] / totwt[i][j]; @@ -9267,6 +9783,7 @@ void ImProcFunctions::wavcbd(wavelet_decomposition &wdspot, int level_bl, int ma #ifdef _OPENMP #pragma omp parallel for schedule(dynamic) collapse(2) if (multiThread) #endif + for (int dir = 1; dir < 4; dir++) { for (int level = level_bl; level < maxlvl; ++level) { const int W_L = wdspot.level_W(level); @@ -9406,9 +9923,11 @@ void ImProcFunctions::Compresslevels(float **Source, int W_L, int H_L, float com #ifdef _OPENMP #pragma omp for schedule(dynamic,16) #endif + for (int y = 0; y < H_L; y++) { int x = 0; #ifdef __SSE2__ + for (; x < W_L - 3; x += 4) { vfloat exponev = onev; vfloat valv = LVFU(Source[y][x]); @@ -9422,7 +9941,9 @@ void ImProcFunctions::Compresslevels(float **Source, int W_L, int H_L, float com const vfloat resultv = multv * xexpf(xlogf(valv + madLv) * exponev); STVFU(Source[y][x], resultv); } + #endif + for (; x < W_L; x++) { float expone = 1.f; @@ -9450,78 +9971,82 @@ void ImProcFunctions::Compresslevels(float **Source, int W_L, int H_L, float com void ImProcFunctions::wavlc(wavelet_decomposition& wdspot, int level_bl, int level_hl, int maxlvl, int level_hr, int level_br, float ahigh, float bhigh, float alow, float blow, float sigmalc, float strength, const LocwavCurve & locwavCurve, int numThreads) { - float mean[10]; - float meanN[10]; - float sigma[10]; - float sigmaN[10]; - float MaxP[10]; - float MaxN[10]; - - Evaluate2(wdspot, mean, meanN, sigma, sigmaN, MaxP, MaxN, numThreads); - for (int dir = 1; dir < 4; dir++) { - for (int level = level_bl; level < maxlvl; ++level) { - int W_L = wdspot.level_W(level); - int H_L = wdspot.level_H(level); - float klev = 1.f; + float mean[10]; + float meanN[10]; + float sigma[10]; + float sigmaN[10]; + float MaxP[10]; + float MaxN[10]; - if (level >= level_hl && level <= level_hr) { - klev = 1.f; + Evaluate2(wdspot, mean, meanN, sigma, sigmaN, MaxP, MaxN, numThreads); + + for (int dir = 1; dir < 4; dir++) { + for (int level = level_bl; level < maxlvl; ++level) { + int W_L = wdspot.level_W(level); + int H_L = wdspot.level_H(level); + float klev = 1.f; + + if (level >= level_hl && level <= level_hr) { + klev = 1.f; + } + + if (level_hl != level_bl) { + if (level >= level_bl && level < level_hl) { + klev = alow * level + blow; } + } - if (level_hl != level_bl) { - if (level >= level_bl && level < level_hl) { - klev = alow * level + blow; - } + if (level_hr != level_br) { + if (level > level_hr && level <= level_br) { + klev = ahigh * level + bhigh; } + } - if (level_hr != level_br) { - if (level > level_hr && level <= level_br) { - klev = ahigh * level + bhigh; - } - } - float* const* wav_L = wdspot.level_coeffs(level); + float* const* wav_L = wdspot.level_coeffs(level); - if (MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f) { - constexpr float insigma = 0.666f; //SD - const float logmax = log(MaxP[level]); //log Max - const float rapX = (mean[level] + sigmalc * sigma[level]) / MaxP[level]; //rapport between sD / max - const float inx = log(insigma); - const float iny = log(rapX); - const float rap = inx / iny; //koef - const float asig = 0.166f / (sigma[level] * sigmalc); - const float bsig = 0.5f - asig * mean[level]; - const float amean = 0.5f / mean[level]; - const float limit1 = mean[level] + sigmalc * sigma[level]; - const float limit2 = mean[level]; + if (MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f) { + constexpr float insigma = 0.666f; //SD + const float logmax = log(MaxP[level]); //log Max + const float rapX = (mean[level] + sigmalc * sigma[level]) / MaxP[level]; //rapport between sD / max + const float inx = log(insigma); + const float iny = log(rapX); + const float rap = inx / iny; //koef + const float asig = 0.166f / (sigma[level] * sigmalc); + const float bsig = 0.5f - asig * mean[level]; + const float amean = 0.5f / mean[level]; + const float limit1 = mean[level] + sigmalc * sigma[level]; + const float limit2 = mean[level]; #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic, 16 * W_L) if (multiThread) + #pragma omp parallel for schedule(dynamic, 16 * W_L) if (multiThread) #endif - for (int i = 0; i < W_L * H_L; i++) { - const float val = std::fabs(wav_L[dir][i]); - float absciss; - if (val >= limit1) { //for max - const float valcour = xlogf(val); - absciss = xexpf((valcour - logmax) * rap); - } else if (val >= limit2) { - absciss = asig * val + bsig; - } else { - absciss = amean * val; - } + for (int i = 0; i < W_L * H_L; i++) { + const float val = std::fabs(wav_L[dir][i]); - const float kc = klev * (locwavCurve[absciss * 500.f] - 0.5f); - const float reduceeffect = kc <= 0.f ? 1.f : strength; + float absciss; - float kinterm = 1.f + reduceeffect * kc; - kinterm = kinterm <= 0.f ? 0.01f : kinterm; - - wav_L[dir][i] *= kinterm <= 0.f ? 0.01f : kinterm; + if (val >= limit1) { //for max + const float valcour = xlogf(val); + absciss = xexpf((valcour - logmax) * rap); + } else if (val >= limit2) { + absciss = asig * val + bsig; + } else { + absciss = amean * val; } + + const float kc = klev * (locwavCurve[absciss * 500.f] - 0.5f); + const float reduceeffect = kc <= 0.f ? 1.f : strength; + + float kinterm = 1.f + reduceeffect * kc; + kinterm = kinterm <= 0.f ? 0.01f : kinterm; + + wav_L[dir][i] *= kinterm <= 0.f ? 0.01f : kinterm; } } } - -} + } + +} void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavelet_decomposition& wdspot, int level_bl, int maxlvl, const LocwavCurve & loclevwavCurve, bool loclevwavutili, @@ -9548,6 +10073,7 @@ void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavel if (process == 1 && loclevwavCurve && loclevwavutili) { //blur array2D templevel(W_L, H_L); + for (int dir = 1; dir < 4; ++dir) { for (int level = level_bl; level < maxlvl; ++level) { const auto WavL = wdspot.level_coeffs(level)[dir]; @@ -9561,9 +10087,11 @@ void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavel const float klev = 0.25f * loclevwavCurve[level * 55.5f]; float* src[H_L]; + for (int i = 0; i < H_L; ++i) { src[i] = &wdspot.level_coeffs(level)[dir][i * W_L]; } + #ifdef _OPENMP #pragma omp parallel if (multiThread) #endif @@ -9580,15 +10108,19 @@ void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavel #ifdef _OPENMP #pragma omp for #endif + for (int y = 0; y < H_L; y++) { int x = 0; int j = y * W_L; #ifdef __SSE2__ + for (; x < W_L - 3; x += 4, j += 4) { const vfloat valv = LVFU(WavL[j]); STVFU(WavL[j], intp((*meaLut)[vabsf(valv) * lutFactorv], LVFU(templevel[y][x]), valv)); } + #endif + for (; x < W_L; x++, j++) { WavL[j] = intp((*meaLut)[std::fabs(WavL[j]) * lutFactor], templevel[y][x], WavL[j]); } @@ -9639,16 +10171,20 @@ void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavel #ifdef _OPENMP #pragma omp for #endif + for (int i = 0; i < H_L; ++i) { int j = 0; #ifdef __SSE2__ + for (; j < W_L - 3; j += 4) { const vfloat LL100v = LC2VFU(tmp[i * 2][j * 2]) / c327d68v; const vfloat kbav = factorv * (loccompwavCurve[sixv * LL100v] - zd5v); //k1 between 0 and 0.5 0.5==> 1/6=0.16 const vfloat valv = LVFU(WavL[i * W_L + j]); STVFU(WavL[i * W_L + j], valv * pow_F(onev + kbav * (*meaLut)[vabsf(valv) * lutFactorv], itfv)); } + #endif + for (; j < W_L; ++j) { const float LL100 = tmp[i * 2][j * 2] / 327.68f; const float kba = factor * (loccompwavCurve[6.f * LL100] - 0.5f); //k1 between 0 and 0.5 0.5==> 1/6=0.16 @@ -9664,6 +10200,7 @@ void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavel #ifdef _OPENMP #pragma omp parallel for schedule(dynamic) collapse(2) if (multiThread) #endif + for (int dir = 1; dir < 4; dir++) { for (int level = level_bl; level < maxlvl; ++level) { madL[level][dir - 1] = Mad(wdspot.level_coeffs(level)[dir], wdspot.level_W(level) * wdspot.level_H(level)); //evaluate noise by level @@ -9684,6 +10221,7 @@ void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavel #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < H_L; y++) { for (int x = 0; x < W_L; x++) { int j = y * W_L + x; @@ -9692,11 +10230,13 @@ void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavel } float klev = (loccomprewavCurve[level * 55.5f] - 0.75f); + if (klev < 0.f) { klev *= 2.6666f;//compression increase contraste } else { klev *= 4.f;//dilatation reduce contraste - detailattenuator } + const float compression = expf(-klev); const float detailattenuator = std::max(klev, 0.f); @@ -9711,15 +10251,19 @@ void ImProcFunctions::wavcont(const struct local_params& lp, float ** tmp, wavel #ifdef _OPENMP #pragma omp for #endif + for (int y = 0; y < H_L; y++) { int x = 0; int j = y * W_L; #ifdef __SSE2__ + for (; x < W_L - 3; x += 4, j += 4) { const vfloat valv = LVFU(wav_L[j]); STVFU(wav_L[j], intp((*meaLut)[vabsf(valv) * lutFactorv], LVFU(templevel[y][x]), valv)); } + #endif + for (; x < W_L; x++, j++) { wav_L[j] = intp((*meaLut)[std::fabs(wav_L[j]) * lutFactor], templevel[y][x], wav_L[j]); } @@ -9762,11 +10306,13 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < H_Lm; y++) { for (int x = 0; x < W_Lm; x++) { factorwav[y][x] = mult * (1.f - ImProcFunctions::calcGradientFactor(gpwav, x, y)); } } + float mean[10]; float meanN[10]; float sigma[10]; @@ -9822,6 +10368,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float klev = ahighg * level + bhighg; } } + klev *= 0.8f; const float threshold = mean[level] + lp.sigmalc2 * sigma[level]; float lutFactor; @@ -9837,6 +10384,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float const float WavCL = std::fabs(wav_L[y * W_L + x]); float absciss; + if (WavCL >= threshold) { //for max absciss = pow_F(WavCL - logmax, rap); } else if (WavCL >= mean[level]) { @@ -9864,6 +10412,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float if (radblur > 0.f && blurena) { float* src[H_Level]; + for (int i = 0; i < H_Level; ++i) { src[i] = &wav_L0[i * W_Level]; } @@ -9889,6 +10438,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float if (lp.residshathr > (100.f - tran)) { tran = 100.f - lp.residshathr; } + constexpr float alp = 3.f; const float aalp = (1.f - alp) / lp.residshathr; const float ath = -lp.residsha / tran; @@ -9902,6 +10452,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < W_Level * H_Level; i++) { const float LL100 = wav_L0[i] / 327.68f; @@ -9932,7 +10483,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float } } - ImProcFunctions::shadowsHighlights(temp.get(), true, 1, lp.residhi, lp.residsha , 40, sk, lp.residhithr, lp.residshathr); + ImProcFunctions::shadowsHighlights(temp.get(), true, 1, lp.residhi, lp.residsha, 40, sk, lp.residhithr, lp.residshathr); #ifdef _OPENMP #pragma omp parallel for if (multiThread) @@ -9951,6 +10502,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float #ifdef _OPENMP #pragma omp parallel for reduction(+:avedbl) if (multiThread) #endif + for (int i = 0; i < W_Level * H_Level; i++) { avedbl += static_cast(wav_L0[i]); } @@ -9967,6 +10519,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < W_Level * H_Level; i++) { wav_L0[i] = resid_contrast.getVal(LIM01(wav_L0[i] / 32768.f)) * 32768.0; } @@ -10033,6 +10586,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float float gradw = lp.gradw; float tloww = lp.tloww; + for (int lvl = 0; lvl < 4; lvl++) { for (int dir = 1; dir < 4; dir++) { const int W_L = wdspot->level_W(lvl); @@ -10042,7 +10596,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float // return convolution KoeLi and maxkoeLi of level 0 1 2 3 and Dir Horiz, Vert, Diag } } - + tmC.free(); float aamp = 1.f + lp.thigw / 100.f; @@ -10053,6 +10607,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int i = 1; i < H_Level - 1; i++) { for (int j = 1; j < W_Level - 1; j++) { //treatment of koeLi and maxkoeLi @@ -10064,12 +10619,13 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float for (int dir = 1; dir < 4; dir++) { //neighbors proxi koeLi[lvl * 3 + dir - 1][i * W_Level + j] = (kneigh * koeLi[lvl * 3 + dir - 1][i * W_Level + j] + - 2.f * koeLi[lvl * 3 + dir - 1][(i - 1) * W_Level + j] + 2.f * koeLi[lvl * 3 + dir - 1][(i + 1) * W_Level + j] + 2.f * koeLi[lvl * 3 + dir - 1][i * W_Level + j + 1] + 2.f * koeLi[lvl * 3 + dir - 1][i * W_Level + j - 1] - + koeLi[lvl * 3 + dir - 1][(i - 1) * W_Level + j - 1] + koeLi[lvl * 3 + dir - 1][(i - 1) * W_Level + j + 1] + koeLi[lvl * 3 + dir - 1][(i + 1) * W_Level + j - 1] + koeLi[lvl * 3 + dir - 1][(i + 1) * W_Level + j + 1]) / somm; + 2.f * koeLi[lvl * 3 + dir - 1][(i - 1) * W_Level + j] + 2.f * koeLi[lvl * 3 + dir - 1][(i + 1) * W_Level + j] + 2.f * koeLi[lvl * 3 + dir - 1][i * W_Level + j + 1] + 2.f * koeLi[lvl * 3 + dir - 1][i * W_Level + j - 1] + + koeLi[lvl * 3 + dir - 1][(i - 1) * W_Level + j - 1] + koeLi[lvl * 3 + dir - 1][(i - 1) * W_Level + j + 1] + koeLi[lvl * 3 + dir - 1][(i + 1) * W_Level + j - 1] + koeLi[lvl * 3 + dir - 1][(i + 1) * W_Level + j + 1]) / somm; } } float interm = 0.f; + for (int dir = 1; dir < 4; dir++) { //here I evaluate combination of vert / diag / horiz...we are with multiplicators of the signal interm += SQR(koeLi[lvl * 3 + dir - 1][i * W_Level + j]); @@ -10108,6 +10664,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float } float kampli; + if (alph > eddlipinfl) { kampli = alipinfl * alph + blipinfl; //If beta low reduce kampli kampli = SQR(bet) * kampli * aamp; @@ -10150,11 +10707,13 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float if (lp.edgwmet != 1) { float brepart; + if (lp.edgwmet == 0) { brepart = 3.f; - } else /*if (lp.edgwmet == 2)*/ { + } else { /*if (lp.edgwmet == 2)*/ brepart = 0.5f; //arbitrary value to increase / decrease repart, between 1 and 0 } + if (rad < lim0 / 60.f) { const float arepart = - (brepart - 1.f) / (lim0 / 60.f); repart *= arepart * rad + brepart; //linear repartition of repart @@ -10172,6 +10731,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float float* const* wav_L = wdspot->level_coeffs(lvl); const float koef = ak * lvl + bk; //modulate for levels : more levels high, more koef low ==> concentrated action on low levels, without or near for high levels float expkoef = -pow_F(std::fabs(rad - lvl), koef); //reduce effect for high levels + if (lp.edgwmet == 2) { if (rad < lim0 / 60.f && lvl == 0) { expkoef *= abs(repart); //reduce effect for low values of rad and level=0==> quasi only level 1 is effective @@ -10181,6 +10741,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float expkoef /= repart; //increase effect for low values of rad and level=1==> quasi only level 0 is effective } } + //take into account local contrast const float refin = value * xexpf(expkoef); const float edgePrecalc = 1.f + refin; //estimate edge "pseudo variance" @@ -10215,11 +10776,13 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 16) if(multiThread) #endif + for (int i = borderL; i < H_L - borderL; i++) { for (int j = borderL; j < W_L - borderL; j++) { const int k = i * W_L + j; float edge; + if (lvl < 4) { edge = 1.f + (edgePrecalc - 1.f) * (koeLi[lvl * 3][k]) / (1.f + 0.9f * maxkoeLi[lvl * 3 + dir - 1]); } else { @@ -10227,11 +10790,12 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float } float absciss = 0.f; + if (std::fabs(wav_L[dir][k]) >= mean[lvl] + sigma[lvl]) { //for max absciss = xexpf((xlogf(std::fabs(wav_L[dir][k])) - logmax) * rap); } else if (std::fabs(wav_L[dir][k]) >= mean[lvl]) { absciss = asig * std::fabs(wav_L[dir][k]) + bsig; - } else /*if (std::fabs(wav_L[dir][k]) < mean[lvl])*/ { + } else { /*if (std::fabs(wav_L[dir][k]) < mean[lvl])*/ absciss = amean * std::fabs(wav_L[dir][k]); } @@ -10255,6 +10819,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float const float kc = kmul * (locedgwavCurve[absciss * 500.f] - 0.5f); float kinterm; + if (kc >= 0.f) { constexpr float reduceeffect = 0.6f; kinterm = 1.f + reduceeffect * kc; //about 1 to 3 general and big amplification for max (under 0) @@ -10286,41 +10851,52 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float float strengthlc = 1.5f; wavlc(*wdspot, level_bl, level_hl, maxlvl, level_hr, level_br, ahigh, bhigh, alow, blow, lp.sigmalc, strengthlc, locwavCurve, numThreads); } + //reconstruct all for L wdspot->reconstruct(tmp[0], 1.f); bool reconstruct = false; + if (wavcurvecon && (chromalev != 1.f) && levelena) { // a if need ) {//contrast by levels for chroma a // a wdspot.reset(new wavelet_decomposition(tmpa[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen)); + if (wdspot->memory_allocation_failed()) { return; } + wavcbd(*wdspot, level_bl, maxlvl, locconwavCurve, locconwavutili, sigm, offs, chromalev, sk); reconstruct = true; } + if (wavcurvelev && radlevblur > 0.f && blurena && chromablu > 0.f && !blurlc) {//chroma blur if need // a if (!reconstruct) { wdspot.reset(new wavelet_decomposition(tmpa[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen)); + if (wdspot->memory_allocation_failed()) { return; } } + wavcont(lp, tmp, *wdspot, level_bl, maxlvl, loclevwavCurve, loclevwavutili, loccompwavCurve, loccompwavutili, loccomprewavCurve, loccomprewavutili, radlevblur, 1, chromablu, 0.f, 0.f, 0.f); reconstruct = true; } + if (reconstruct) { wdspot->reconstruct(tmpa[0], 1.f); } reconstruct = false; + if (wavcurvecon && (chromalev != 1.f) && levelena) { // b if need ) {//contrast by levels for chroma b //b wdspot.reset(new wavelet_decomposition(tmpb[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen)); + if (wdspot->memory_allocation_failed()) { return; } + //b wavcbd(*wdspot, level_bl, maxlvl, locconwavCurve, locconwavutili, sigm, offs, chromalev, sk); reconstruct = true; @@ -10330,18 +10906,21 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float //b if (!reconstruct) { wdspot.reset(new wavelet_decomposition(tmpb[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen)); + if (wdspot->memory_allocation_failed()) { return; } } + wavcont(lp, tmp, *wdspot, level_bl, maxlvl, loclevwavCurve, loclevwavutili, loccompwavCurve, loccompwavutili, loccomprewavCurve, loccomprewavutili, radlevblur, 1, chromablu, 0.f, 0.f, 0.f); reconstruct = true; } + if (reconstruct) { wdspot->reconstruct(tmpb[0], 1.f); } - - + + //gamma and slope residual image - be careful memory bool tonecur = false; const Glib::ustring profile = params->icm.workingProfile; @@ -10350,20 +10929,26 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float if (isworking && (lp.residgam != 2.4f || lp.residslop != 12.92f)) { tonecur = true; } - - if(tonecur) { + + if (tonecur) { std::unique_ptr wdspotL(new wavelet_decomposition(tmp[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen)); + if (wdspotL->memory_allocation_failed()) { return; } + std::unique_ptr wdspota(new wavelet_decomposition(tmpa[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen)); + if (wdspota->memory_allocation_failed()) { return; } + std::unique_ptr wdspotb(new wavelet_decomposition(tmpb[0], bfw, bfh, maxlvl, 1, sk, numThreads, lp.daubLen)); + if (wdspotb->memory_allocation_failed()) { return; } + int W_Level = wdspotL->level_W(0); int H_Level = wdspotL->level_H(0); float *wav_L0 = wdspotL->get_coeff0(); @@ -10374,6 +10959,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < H_Level; y++) { for (int x = 0; x < W_Level; x++) { labresid->L[y][x] = wav_L0[y * W_Level + x]; @@ -10387,15 +10973,19 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float lab2rgb(*labresid, *tmpImage, params->icm.workingProfile); Glib::ustring prof = params->icm.workingProfile; cmsHTRANSFORM dummy = nullptr; - int ill =0; - workingtrc(tmpImage, tmpImage, W_Level, H_Level, -5, prof, 2.4, 12.92310, ill, 0, dummy, true, false, false); - workingtrc(tmpImage, tmpImage, W_Level, H_Level, 1, prof, lp.residgam, lp.residslop, ill, 0, dummy, false, true, true);//be careful no gamut control + int ill = 0; + int locprim = 0; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + workingtrc(0, tmpImage, tmpImage, W_Level, H_Level, -5, prof, 2.4, 12.92310, 0, ill, 0, 0, rdx, rdy, grx, gry, blx, bly ,meanx, meany, meanxe, meanye, dummy, true, false, false, false); + workingtrc(0, tmpImage, tmpImage, W_Level, H_Level, 1, prof, lp.residgam, lp.residslop, 0, ill, 0, locprim, rdx, rdy, grx, gry, blx, bly , meanx, meany, meanxe, meanye, dummy, false, true, true, false);//be careful no gamut control rgb2lab(*tmpImage, *labresid, params->icm.workingProfile); delete tmpImage; #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < H_Level; y++) { for (int x = 0; x < W_Level; x++) { wav_L0[y * W_Level + x] = labresid->L[y][x]; @@ -10413,7 +11003,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float void ImProcFunctions::fftw_denoise(int sk, int GW, int GH, int max_numblox_W, int min_numblox_W, float **tmp1, array2D *Lin, int numThreads, const struct local_params & lp, int chrom) { - // BENCHFUN + // BENCHFUN fftwf_plan plan_forward_blox[2]; fftwf_plan plan_backward_blox[2]; @@ -10491,6 +11081,7 @@ void ImProcFunctions::fftw_denoise(int sk, int GW, int GH, int max_numblox_W, in #ifdef _OPENMP #pragma omp for #endif + for (int vblk = 0; vblk < numblox_H; ++vblk) { int top = (vblk - 1) * offset; @@ -10589,27 +11180,31 @@ void ImProcFunctions::fftw_denoise(int sk, int GW, int GH, int max_numblox_W, in }//end of vertical block loop } - //Threshold DCT from Alberto Grigio, adapted to Rawtherapee + //Threshold DCT from Alberto Grigio, adapted to Rawtherapee const int detail_thresh = lp.detailthr; array2D mask; if (detail_thresh > 0) { mask(GW, GH); + if (lp.usemask) {//with Laplacian - float amount = LIM01(float(detail_thresh)/100.f); + float amount = LIM01(float(detail_thresh) / 100.f); float thr = (1.f - amount); float alph = params_Ldetail / 100.f; array2D LL(GW, GH, prov, ARRAY2D_BYREFERENCE); laplacian(LL, mask, GW, GH, 25.f, 20000.f, amount, false); + for (int i = 0; i < GH; ++i) { for (int j = 0; j < GW; ++j) { - mask[i][j] = LIM01(mask[i][j]+ thr); + mask[i][j] = LIM01(mask[i][j] + thr); } } + for (int i = 0; i < 3; ++i) { boxblur(static_cast(mask), static_cast(mask), 10 / sk, GW, GH, false); - + } + for (int i = 0; i < GH; ++i) { for (int j = 0; j < GW; ++j) { float k = 1.f - mask[i][j] * alph; @@ -10620,7 +11215,7 @@ void ImProcFunctions::fftw_denoise(int sk, int GW, int GH, int max_numblox_W, in float thr = log2lin(float(detail_thresh) / 200.f, 100.f); buildBlendMask(prov, mask, GW, GH, thr); #ifdef _OPENMP - #pragma omp parallel if (multiThread) + #pragma omp parallel if (multiThread) #endif { gaussianBlur(mask, mask, GW, GH, 20.0 / sk); @@ -10629,18 +11224,20 @@ void ImProcFunctions::fftw_denoise(int sk, int GW, int GH, int max_numblox_W, in constexpr float alfa = 0.856f; const float beta = 1.f + std::sqrt(log2lin(thr, 100.f)); buildGradientsMask(GW, GH, prov, m2, params_Ldetail / 100.f, 7, 3, alfa, beta, multiThread); + for (int i = 0; i < GH; ++i) { for (int j = 0; j < GW; ++j) { mask[i][j] *= m2[i][j]; } } - } + } } #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < GH; ++i) { for (int j = 0; j < GW; ++j) { float d = Ldetail[i][j] / totwt[i][j]; @@ -10678,7 +11275,7 @@ void ImProcFunctions::fftw_denoise(int sk, int GW, int GH, int max_numblox_W, in void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct local_params & lp, LabImage * originalmaskbl, LabImage * bufmaskblurbl, int levred, float huerefblur, float lumarefblur, float chromarefblur, LabImage * original, LabImage * transformed, int cx, int cy, int sk, const LocwavCurve& locwavCurvehue, bool locwavhueutili, float& highresi, float& nresi, float& highresi46, float& nresi46, float& Lhighresi, float& Lnresi, float& Lhighresi46, float& Lnresi46) { - BENCHFUN + // BENCHFUN //local denoise //all these variables are to prevent use of denoise when non necessary // but with qualmet = 2 (default for best quality) we must denoise chroma with little values to prevent artifacts due to variations of Hue @@ -10698,7 +11295,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct if (((lp.noiself > 0.f || lp.noiself0 > 0.f || lp.noiself2 > 0.f || lp.nlstr > 0 || lp.wavcurvedenoi || lp.noiselc > 0.f || lp.noisecf > 0.f || lp.noisecc > 0.f || execmaskden || aut == 1 || aut == 2) && lp.denoiena && lp.quamet != 3) || execdenoi) { // sk == 1 ?? - StopWatch Stop1("locallab Denoise called"); + //StopWatch Stop1("locallab Denoise called"); if (aut == 0) { MyMutex::MyLock lock(*fftwMutex); @@ -10731,21 +11328,24 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct const int numThreads = 1; #endif - int minwin = rtengine::min(GW, GH); - int maxlevelspot = 10;//maximum possible - bool isnois = true; - // adap maximum level wavelet to size of crop - while ((1 << maxlevelspot) >= (minwin * sk) && maxlevelspot > 1) { - --maxlevelspot ; - } + int minwin = rtengine::min(GW, GH); + int maxlevelspot = 10;//maximum possible + bool isnois = true; - levred = rtengine::min(levred, maxlevelspot); - if(levred < 7) {//If windows preview or detail window too small exit to avoid artifacts - isnois = false; - if(lp.quamet == 2) { - isnois = true; - } + // adap maximum level wavelet to size of crop + while ((1 << maxlevelspot) >= (minwin * sk) && maxlevelspot > 1) { + --maxlevelspot ; + } + + levred = rtengine::min(levred, maxlevelspot); + + if (levred < 7) { //If windows preview or detail window too small exit to avoid artifacts + isnois = false; + + if (lp.quamet == 2) { + isnois = true; } + } if (call == 1 && ((GW >= mDEN && GH >= mDEN && isnois) || lp.quamet == 2)) { @@ -10778,18 +11378,22 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope - if(gamma > 1.f) { + if (gamma > 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < GH; ++y) { int x = 0; #ifdef __SSE2__ + for (; x < GW - 3; x += 4) { STVFU(tmp1.L[y][x], F2V(32768.f) * igammalog(LVFU(tmp1.L[y][x]) / F2V(32768.f), F2V(gamma), F2V(ts), F2V(g_a[2]), F2V(g_a[4]))); } + #endif - for (;x < GW; ++x) { + + for (; x < GW; ++x) { tmp1.L[y][x] = 32768.f * igammalog(tmp1.L[y][x] / 32768.f, gamma, ts, g_a[2], g_a[4]); } } @@ -10811,6 +11415,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP // #pragma omp parallel for schedule(dynamic) collapse(2) if (multiThread) #endif + for (int lvl = 0; lvl < levred; lvl++) { for (int dir = 1; dir < 4; dir++) { int Wlvl_L = Ldecomp.level_W(lvl); @@ -10871,6 +11476,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < GH; ir++) for (int jr = 0; jr < GW; jr++) { float lN = tmp1.L[ir][jr]; @@ -10884,7 +11490,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct } } - if(lp.enablMask && lp.lnoiselow !=1.f && lp.smasktyp != 0) { + if (lp.enablMask && lp.lnoiselow != 1.f && lp.smasktyp != 0) { //this code has been reviewed by Ingo in september 2020 PR5903 float higc; float hig = lp.thrhigh; @@ -10892,8 +11498,8 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct float low = lp.thrlow; float lowc; calcdif(low, lowc); - - if(higc < lowc) { + + if (higc < lowc) { higc = lowc + 0.01f; } @@ -10901,10 +11507,11 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct float blow = lp.lnoiselow; float ahigh = 0.9999f / (higc - 100.f); float bhigh = 1.f - higc * ahigh; - + #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < GH; ir++) for (int jr = 0; jr < GW; jr++) { const float lM = bufmaskblurbl->L[ir][jr]; @@ -10917,22 +11524,23 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct } else { noisevarlum[(ir >> 1) * GW2 + (jr >> 1)] *= ahigh * lmr + bhigh; } - } + } } - if(HHhuecurve) { - //same code as in wavelet levels - + if (HHhuecurve) { + //same code as in wavelet levels + #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif + for (int ir = 0; ir < GH; ir++) for (int jr = 0; jr < GW; jr++) { float hueG = xatan2f(tmp1.b[ir][jr], tmp1.a[ir][jr]); float valparam = 2.f * (locwavCurvehue[500.f * static_cast(Color::huelab_to_huehsv2(hueG))] - 0.5f); //get H=f(H) noisevarhue[(ir >> 1)*GW2 + (jr >> 1)] = 1.f + valparam; - noisevarlum[(ir >> 1)*GW2 + (jr >> 1)] *= noisevarhue[(ir >> 1)*GW2 + (jr >> 1)]; + noisevarlum[(ir >> 1)*GW2 + (jr >> 1)] *= noisevarhue[(ir >> 1) * GW2 + (jr >> 1)]; } } @@ -10940,7 +11548,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct if ((lp.quamet == 0 && aut == 0) || (mxsl < 1.f && (aut == 1 || aut == 2))) { WaveletDenoiseAllL(Ldecomp, noisevarlum, madL, vari, edge, numThreads); - } else if (lp.quamet == 1){ + } else if (lp.quamet == 1) { WaveletDenoiseAll_BiShrinkL(Ldecomp, noisevarlum, madL, vari, edge, numThreads); @@ -11153,6 +11761,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < GH; ir++) for (int jr = 0; jr < GW; jr++) { float cN = std::sqrt(SQR(tmp1.a[ir][jr]) + SQR(tmp1.b[ir][jr])); @@ -11172,7 +11781,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct if ((lp.quamet == 0 && aut == 0) || (maxccoarse < 0.1f && (aut == 1 || aut == 2))) { WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, numThreads); WaveletDenoiseAllAB(Ldecomp, bdecomp, noisevarchrom, madL, variCb, edge, noisevarab_r, true, false, false, numThreads); - } else if (lp.quamet == 1){ + } else if (lp.quamet == 1) { WaveletDenoiseAll_BiShrinkAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, numThreads); WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, numThreads); @@ -11190,6 +11799,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < GH; ++i) { for (int j = 0; j < GW; ++j) { (*Lin)[i][j] = tmp1.L[i][j]; @@ -11210,6 +11820,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < GH; ++i) { for (int j = 0; j < GW; ++j) { (*Ain)[i][j] = tmp1.a[i][j]; @@ -11233,6 +11844,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < GH; ++i) { for (int j = 0; j < GW; ++j) { (*Bin)[i][j] = tmp1.b[i][j]; @@ -11251,26 +11863,38 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct } if(gamma > 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < GH; ++y) {//apply inverse gamma 3.f and put result in range 32768.f int x = 0; #ifdef __SSE2__ + for (; x < GW - 3; x += 4) { STVFU(tmp1.L[y][x], F2V(32768.f) * gammalog(LVFU(tmp1.L[y][x]) / F2V(32768.f), F2V(gamma), F2V(ts), F2V(g_a[3]), F2V(g_a[4]))); } + #endif + for (; x < GW; ++x) { tmp1.L[y][x] = 32768.f * gammalog(tmp1.L[y][x] / 32768.f, gamma, ts, g_a[3], g_a[4]); } } } +//<<<<<<< HEAD +// if (lp.nlstr > 0) { +// NLMeans(tmp1.L, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, GW, GH, float (sk), multiThread); +// } + +// if (lp.smasktyp != 0) { +// if (lp.enablMask && lp.recothrd != 1.f) { +//======= if(lp.smasktyp != 0) { if(lp.enablMask && lp.recothrd != 1.f) { LabImage tmp3(GW, GH); - for (int ir = 0; ir < GH; ir++){ + for (int ir = 0; ir < GH; ir++) { for (int jr = 0; jr < GW; jr++) { tmp3.L[ir][jr] = original->L[ir][jr]; tmp3.a[ir][jr] = original->a[ir][jr]; @@ -11290,23 +11914,26 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct float mid = 0.01f * lp.midthrd; float midch = 0.01f * lp.midthrdch; - if(higc < lowc) { + if (higc < lowc) { higc = lowc + 0.01f; } + float th = (lp.recothrd - 1.f); float ahigh = th / (higc - 100.f); float bhigh = 1.f - higc * ahigh; - float alow = th / lowc; + float alow = th / lowc; float blow = 1.f - th; #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < GH; ir++) { for (int jr = 0; jr < GW; jr++) { const float lmr = bufmaskblurbl->L[ir][jr] / 327.68f; float k; float kch; + if (lmr < lowc) { k = alow * lmr + blow; kch = alow * lmr + blow; @@ -11317,7 +11944,8 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct k = ahigh * lmr + bhigh; kch = ahigh * lmr + bhigh; } - if(lp.invmaskd) { + + if (lp.invmaskd) { masklum[ir][jr] = 1.f - pow_F(k, lp.decayd); masklumch[ir][jr] = 1.f - pow_F(kch, lp.decayd); } else { @@ -11331,16 +11959,19 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct boxblur(static_cast(masklum), static_cast(masklum), 10 / sk, GW, GH, multiThread); boxblur(static_cast(masklumch), static_cast(masklumch), 10 / sk, GW, GH, multiThread); } + #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < GH; ++i) { - for (int j = 0; j < GW; ++j) { + for (int j = 0; j < GW; ++j) { tmp1.L[i][j] = (tmp3.L[i][j] - tmp1.L[i][j]) * LIM01(masklum[i][j]) + tmp1.L[i][j]; tmp1.a[i][j] = (tmp3.a[i][j] - tmp1.a[i][j]) * LIM01(masklumch[i][j]) + tmp1.a[i][j]; tmp1.b[i][j] = (tmp3.b[i][j] - tmp1.b[i][j]) * LIM01(masklumch[i][j]) + tmp1.b[i][j]; } } + masklum.free(); masklumch.free(); } @@ -11453,6 +12084,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H ; y++) //{ for (int x = 0; x < transformed->W; x++) { int lox = cx + x; @@ -11471,20 +12103,25 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct double pwr = 1.0 / (double) lp.noisegam;//default 3.0 - gamma Lab double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope - if(gamma > 1.f) { + + if (gamma > 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; ++y) { int x = 0; - + #ifdef __SSE2__ + for (; x < bfw - 3; x += 4) { STVFU(bufwv.L[y][x], F2V(32768.f) * igammalog(LVFU(bufwv.L[y][x]) / F2V(32768.f), F2V(gamma), F2V(ts), F2V(g_a[2]), F2V(g_a[4]))); } + #endif - for (;x < bfw; ++x) { - bufwv.L[y][x] = 32768.f * igammalog(bufwv.L[y][x] / 32768.f, gamma, ts, g_a[2], g_a[4]); + + for (; x < bfw; ++x) { + bufwv.L[y][x] = 32768.f * igammalog(bufwv.L[y][x] / 32768.f, gamma, ts, g_a[2], g_a[4]); } } } @@ -11503,6 +12140,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for schedule(dynamic) collapse(2) if (multiThread) #endif + for (int lvl = 0; lvl < levred; lvl++) { for (int dir = 1; dir < 4; dir++) { int Wlvl_L = Ldecomp.level_W(lvl); @@ -11568,6 +12206,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float lN = bufwv.L[ir][jr]; @@ -11580,56 +12219,59 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct noisevarlum[(ir >> 1)*bfw2 + (jr >> 1)] = nvll[i]; } } - - if(lp.enablMask && lp.lnoiselow != 1.f && lp.smasktyp != 0) { - //this code has been reviewed by Ingo in september 2020 PR5903 - //i just change parameters to better progressivity - float higc; - float hig = lp.thrhigh; - calcdif(hig, higc); - float low = lp.thrlow; - float lowc; - calcdif(low, lowc); - - if(higc < lowc) { - higc = lowc + 0.01f; - } - float alow = -(lp.lnoiselow - 1.f) / lowc; - float blow = lp.lnoiselow; - float ahigh = 0.9999f / (higc - 100.f); - float bhigh = 1.f - higc * ahigh; + if (lp.enablMask && lp.lnoiselow != 1.f && lp.smasktyp != 0) { + //this code has been reviewed by Ingo in september 2020 PR5903 + //i just change parameters to better progressivity + float higc; + float hig = lp.thrhigh; + calcdif(hig, higc); + float low = lp.thrlow; + float lowc; + calcdif(low, lowc); + + if (higc < lowc) { + higc = lowc + 0.01f; + } + + float alow = -(lp.lnoiselow - 1.f) / lowc; + float blow = lp.lnoiselow; + float ahigh = 0.9999f / (higc - 100.f); + float bhigh = 1.f - higc * ahigh; #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - const float lM = bufmaskblurbl->L[ir + ystart][jr + xstart]; - const float lmr = lM / 327.68f; - if (lM < 327.68f * lowc) { - noisevarlum[(ir >> 1) * bfw2 + (jr >> 1)] *= alow * lmr + blow; - } else if (lM < 327.68f * higc) { - // do nothing - } else { - noisevarlum[(ir >> 1) * bfw2 + (jr >> 1)] *= ahigh * lmr + bhigh; + + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + const float lM = bufmaskblurbl->L[ir + ystart][jr + xstart]; + const float lmr = lM / 327.68f; + + if (lM < 327.68f * lowc) { + noisevarlum[(ir >> 1) * bfw2 + (jr >> 1)] *= alow * lmr + blow; + } else if (lM < 327.68f * higc) { + // do nothing + } else { + noisevarlum[(ir >> 1) * bfw2 + (jr >> 1)] *= ahigh * lmr + bhigh; + } } } - } - if(HHhuecurve) { + if (HHhuecurve) { //same code as in wavelet levels #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float hueG = xatan2f(bufwv.b[ir][jr], bufwv.a[ir][jr]); float valparam = 2.f * (locwavCurvehue[500.f * static_cast(Color::huelab_to_huehsv2(hueG))] - 0.5f); //get H=f(H) noisevarhue[(ir >> 1)* bfw2 + (jr >> 1)] = 1.f + valparam; - noisevarlum[(ir >> 1)* bfw2 + (jr >> 1)] *= noisevarhue[(ir >> 1)* bfw2 + (jr >> 1)]; + noisevarlum[(ir >> 1)* bfw2 + (jr >> 1)] *= noisevarhue[(ir >> 1) * bfw2 + (jr >> 1)]; } } @@ -11851,6 +12493,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float cN = std::sqrt(SQR(bufwv.a[ir][jr]) + SQR(bufwv.b[ir][jr])); @@ -11869,7 +12512,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct if ((lp.quamet == 0 && aut == 0) || (maxccoarse < 0.1f && (aut == 1 || aut == 2))) { WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, numThreads); WaveletDenoiseAllAB(Ldecomp, bdecomp, noisevarchrom, madL, variCb, edge, noisevarab_r, true, false, false, numThreads); - } else if (lp.quamet == 1){ + } else if (lp.quamet == 1) { WaveletDenoiseAll_BiShrinkAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, numThreads); WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, numThreads); @@ -11887,6 +12530,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < bfh; ++i) { for (int j = 0; j < bfw; ++j) { (*Lin)[i][j] = bufwv.L[i][j]; @@ -11911,6 +12555,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < bfh; ++i) { for (int j = 0; j < bfw; ++j) { (*Ain)[i][j] = bufwv.a[i][j]; @@ -11932,6 +12577,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < bfh; ++i) { for (int j = 0; j < bfw; ++j) { (*Bin)[i][j] = bufwv.b[i][j]; @@ -11947,19 +12593,23 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct } } - if(gamma > 1.f) { + if (gamma > 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; ++y) {//apply inverse gamma 3.f and put result in range 32768.f int x = 0; - + #ifdef __SSE2__ + for (; x < bfw - 3; x += 4) { STVFU(bufwv.L[y][x], F2V(32768.f) * gammalog(LVFU(bufwv.L[y][x]) / F2V(32768.f), F2V(gamma), F2V(ts), F2V(g_a[3]), F2V(g_a[4]))); } + #endif + for (; x < bfw ; ++x) { bufwv.L[y][x] = 32768.f * gammalog(bufwv.L[y][x] / 32768.f, gamma, ts, g_a[3], g_a[4]); @@ -11967,17 +12617,18 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct } } - if(lp.nlstr > 0) { + if (lp.nlstr > 0) { NLMeans(bufwv.L, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, bfw, bfh, 1.f, multiThread); } if (lp.smasktyp != 0) { - if(lp.enablMask && lp.recothrd != 1.f) { + if (lp.enablMask && lp.recothrd != 1.f) { LabImage tmp3(bfw, bfh); #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H ; y++) { for (int x = 0; x < transformed->W; x++) { int lox = cx + x; @@ -11987,7 +12638,7 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct tmp3.L[loy - begy][lox - begx] = original->L[y][x]; tmp3.a[loy - begy][lox - begx] = original->a[y][x]; tmp3.b[loy - begy][lox - begx] = original->b[y][x]; - } + } } } @@ -11996,7 +12647,8 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct array2D masklumch; masklum(bfw, bfh); masklumch(bfw, bfh); - for (int ir = 0; ir < bfh; ir++){ + + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { masklum[ir][jr] = 1.f; masklumch[ir][jr] = 1.f; @@ -12012,54 +12664,61 @@ void ImProcFunctions::DeNoise(int call, int aut, bool noiscfactiv, const struct float mid = 0.01f * lp.midthrd; float midch = 0.01f * lp.midthrdch; - if(higc < lowc) { + if (higc < lowc) { higc = lowc + 0.01f; } + float th = (lp.recothrd - 1.f); float ahigh = th / (higc - 100.f); float bhigh = 1.f - higc * ahigh; - float alow = th / lowc; + float alow = th / lowc; float blow = 1.f - th; #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart, lox = cx + x; x < xend; x++, lox++) { - const float lM = bufmaskblurbl->L[y][x]; + const float lM = bufmaskblurbl->L[y][x]; const float lmr = lM / 327.68f; + if (lM < 327.68f * lowc) { - masklum[y-ystart][x-xstart] = alow * lmr + blow; - masklumch[y-ystart][x-xstart] = alow * lmr + blow; + masklum[y - ystart][x - xstart] = alow * lmr + blow; + masklumch[y - ystart][x - xstart] = alow * lmr + blow; } else if (lM < 327.68f * higc) { - masklum[y-ystart][x-xstart] = 1.f - mid; - masklumch[y-ystart][x-xstart] = 1.f - midch; + masklum[y - ystart][x - xstart] = 1.f - mid; + masklumch[y - ystart][x - xstart] = 1.f - midch; } else { - masklum[y-ystart][x-xstart] = ahigh * lmr + bhigh; - masklumch[y-ystart][x-xstart] = ahigh * lmr + bhigh; + masklum[y - ystart][x - xstart] = ahigh * lmr + bhigh; + masklumch[y - ystart][x - xstart] = ahigh * lmr + bhigh; } - float k = masklum[y-ystart][x-xstart]; - float kch = masklumch[y-ystart][x-xstart]; - if(lp.invmaskd == true) { - masklum[y-ystart][x-xstart] = 1.f - pow(k, lp.decayd); - masklumch[y-ystart][x-xstart] = 1.f - pow(kch, lp.decayd); + + float k = masklum[y - ystart][x - xstart]; + float kch = masklumch[y - ystart][x - xstart]; + + if (lp.invmaskd == true) { + masklum[y - ystart][x - xstart] = 1.f - pow(k, lp.decayd); + masklumch[y - ystart][x - xstart] = 1.f - pow(kch, lp.decayd); } else { - masklum[y-ystart][x-xstart] = pow(k, lp.decayd); - masklumch[y-ystart][x-xstart] = pow(kch, lp.decayd); + masklum[y - ystart][x - xstart] = pow(k, lp.decayd); + masklumch[y - ystart][x - xstart] = pow(kch, lp.decayd); } } } + for (int i = 0; i < 3; ++i) { boxblur(static_cast(masklum), static_cast(masklum), 10 / sk, bfw, bfh, false); boxblur(static_cast(masklumch), static_cast(masklumch), 10 / sk, bfw, bfh, false); } - + #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { bufwv.L[y][x] = (tmp3.L[y][x] - bufwv.L[y][x]) * LIM01(masklum[y][x]) + bufwv.L[y][x]; @@ -12140,6 +12799,7 @@ void ImProcFunctions::clarimerge(const struct local_params& lp, float &mL, float #ifdef _OPENMP #pragma omp parallel for schedule(dynamic) collapse(2) #endif + for (int dir = 1; dir < 4; dir++) { for (int level = 0; level < maxlvlresid; ++level) { int W_L = wdspotresid->level_W(level); @@ -12180,6 +12840,7 @@ void ImProcFunctions::clarimerge(const struct local_params& lp, float &mL, float #ifdef _OPENMP #pragma omp parallel for schedule(dynamic) collapse(2) #endif + for (int dir = 1; dir < 4; dir++) { for (int level = 0; level < maxlvlresid; ++level) { int W_L = wdspotresida->level_W(level); @@ -12216,6 +12877,7 @@ void ImProcFunctions::clarimerge(const struct local_params& lp, float &mL, float #ifdef _OPENMP #pragma omp parallel for schedule(dynamic) collapse(2) #endif + for (int dir = 1; dir < 4; dir++) { for (int level = 0; level < maxlvlresid; ++level) { int W_L = wdspotresidb->level_W(level); @@ -12266,7 +12928,7 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag const float ach = lp.trans / 100.f; bool execmunsell = true; - if (params->locallab.spots.at(sp).expcie && (params->locallab.spots.at(sp).modecam == "all" || params->locallab.spots.at(sp).modecam == "jz" || params->locallab.spots.at(sp).modecam == "cam16")) { + if (params->locallab.spots.at(sp).expcie && (params->locallab.spots.at(sp).modecam == "jz" || params->locallab.spots.at(sp).modecam == "cam16")) { execmunsell = false; } @@ -12439,12 +13101,13 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag Color::gamutmap(xg, yg, zg, wp); - if (avoidgamut == 3) {//0.5f arbitrary coeff - xg = xg + 0.5f * (x0 - xg); - yg = yg + 0.5f * (y0 - yg); - zg = zg + 0.5f * (z0 - zg); + if (avoidgamut == 3) {//-0.3f arbitrary coeff, 04-2024 change mistake where 0.5f => -0.3f + xg = rtengine::LIM(xg - 0.3f * (x0 - xg), 0.f, 65535.f); + yg = rtengine::LIM(yg - 0.3f * (y0 - yg), 0.f, 65535.f); + zg = rtengine::LIM(zg - 0.3f * (z0 - zg), 0.f, 65535.f); } + //Color::gamutmap(xg, yg, zg, wp);//Put XYZ in gamut wp float aag2, bbg2; Color::XYZ2Lab(xg, yg, zg, Lag, aag2, bbg2); @@ -12477,6 +13140,7 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag float correctlum = 0.f; const float memChprov = std::sqrt(SQR(reserved->a[y][x]) + SQR(reserved->b[y][x])) / 327.68f; + if (execmunsell) { Color::AllMunsellLch(true, Lprov1, Lprov2, HH, Chprov, memChprov, correctionHue, correctlum); } @@ -12580,15 +13244,18 @@ void ImProcFunctions::avoidcolshi(const struct local_params& lp, int sp, LabImag void maskrecov(const LabImage * bufcolfin, LabImage * original, LabImage * bufmaskblurcol, int bfh, int bfw, int ystart, int xstart, float hig, float low, float recoth, float decay, bool invmask, int sk, bool multiThread) { LabImage tmp3(bfw, bfh); - for (int y = 0; y < bfh; y++){ + + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { tmp3.L[y][x] = original->L[y + ystart][x + xstart]; tmp3.a[y][x] = original->a[y + ystart][x + xstart]; tmp3.b[y][x] = original->b[y + ystart][x + xstart]; } } + array2D masklum; masklum(bfw, bfh); + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { masklum[ir][jr] = 1.f; @@ -12599,22 +13266,25 @@ void maskrecov(const LabImage * bufcolfin, LabImage * original, LabImage * bufma float lowc; calcdif(low, lowc); - if(higc < lowc) { + if (higc < lowc) { higc = lowc + 0.01f; } + float th = (recoth - 1.f); float ahigh = th / (higc - 100.f); float bhigh = 1.f - higc * ahigh; - float alow = th / lowc; + float alow = th / lowc; float blow = 1.f - th; #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { const float lM = bufmaskblurcol->L[ir][jr]; const float lmr = lM / 327.68f; + if (lM < 327.68f * lowc) { masklum[ir][jr] = alow * lmr + blow; } else if (lM < 327.68f * higc) { @@ -12622,8 +13292,10 @@ void maskrecov(const LabImage * bufcolfin, LabImage * original, LabImage * bufma } else { masklum[ir][jr] = ahigh * lmr + bhigh; } + float k = masklum[ir][jr]; - if(invmask == false) { + + if (invmask == false) { masklum[ir][jr] = 1 - pow(k, decay); } else { masklum[ir][jr] = pow(k, decay); @@ -12632,21 +13304,23 @@ void maskrecov(const LabImage * bufcolfin, LabImage * original, LabImage * bufma } } - for (int i = 0; i < 3; ++i) { - boxblur(static_cast(masklum), static_cast(masklum), 10 / sk, bfw, bfh, false); - } + for (int i = 0; i < 3; ++i) { + boxblur(static_cast(masklum), static_cast(masklum), 10 / sk, bfw, bfh, false); + } #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif - for (int i = 0; i < bfh; ++i) { - for (int j = 0; j < bfw; ++j) { - bufcolfin->L[i][j] = (tmp3.L[i][j] - bufcolfin->L[i][j]) * LIM01(masklum[i][j]) + bufcolfin->L[i][j]; - bufcolfin->a[i][j] = (tmp3.a[i][j] - bufcolfin->a[i][j]) * LIM01(masklum[i][j]) + bufcolfin->a[i][j]; - bufcolfin->b[i][j] = (tmp3.b[i][j] - bufcolfin->b[i][j]) * LIM01(masklum[i][j]) + bufcolfin->b[i][j]; - } + + for (int i = 0; i < bfh; ++i) { + for (int j = 0; j < bfw; ++j) { + bufcolfin->L[i][j] = (tmp3.L[i][j] - bufcolfin->L[i][j]) * LIM01(masklum[i][j]) + bufcolfin->L[i][j]; + bufcolfin->a[i][j] = (tmp3.a[i][j] - bufcolfin->a[i][j]) * LIM01(masklum[i][j]) + bufcolfin->a[i][j]; + bufcolfin->b[i][j] = (tmp3.b[i][j] - bufcolfin->b[i][j]) * LIM01(masklum[i][j]) + bufcolfin->b[i][j]; } - masklum.free(); + } + + masklum.free(); } //thanks to Alberto Griggio @@ -12656,33 +13330,33 @@ void ImProcFunctions::detail_mask(const array2D &src, array2D &mas const int H = bfh; mask(W, H); - array2D L2(W/4, H/4);//ARRAY2D_ALIGNED); - array2D m2(W/4, H/4);//ARRAY2D_ALIGNED) + array2D L2(W / 4, H / 4); //ARRAY2D_ALIGNED); + array2D m2(W / 4, H / 4); //ARRAY2D_ALIGNED) rescaleBilinear(src, L2, multithread); #ifdef _OPENMP -# pragma omp parallel for if (multithread) + # pragma omp parallel for if (multithread) #endif - for (int y = 0; y < H/4; ++y) { - for (int x = 0; x < W/4; ++x) { - L2[y][x] = xlin2log(L2[y][x]/scaling, 50.f); + + for (int y = 0; y < H / 4; ++y) { + for (int x = 0; x < W / 4; ++x) { + L2[y][x] = xlin2log(L2[y][x] / scaling, 50.f); } } - - laplacian(L2, m2, W / 4, H / 4, threshold/scaling, ceiling/scaling, factor, multithread); + + laplacian(L2, m2, W / 4, H / 4, threshold / scaling, ceiling / scaling, factor, multithread); rescaleBilinear(m2, mask, multithread); const auto scurve = - [](float x) -> float - { - constexpr float b = 101.f; - constexpr float a = 2.23f; - return xlin2log(pow_F(x, a), b); - }; + [](float x) -> float { + constexpr float b = 101.f; + constexpr float a = 2.23f; + return xlin2log(pow_F(x, a), b); + }; const float thr = 1.f - factor; #ifdef _OPENMP -# pragma omp parallel for if (multithread) + # pragma omp parallel for if (multithread) #endif for (int y = 0; y < H; ++y) { @@ -12692,9 +13366,9 @@ void ImProcFunctions::detail_mask(const array2D &src, array2D &mas } if (blur_type == BlurType::GAUSS) { - + #ifdef _OPENMP -# pragma omp parallel if (multithread) + # pragma omp parallel if (multithread) #endif { gaussianBlur(mask, mask, W, H, blur); @@ -12706,7 +13380,7 @@ void ImProcFunctions::detail_mask(const array2D &src, array2D &mas } } } - + } // basic idea taken from Algorithm 3 in the paper: @@ -12723,11 +13397,12 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int if (!strength) { return; } - // printf("Scale=%f\n", scale); - if(scale > 5.f) {//avoid to small values - leads to crash - but enough to evaluate noise + + // printf("Scale=%f\n", scale); + if (scale > 5.f) { //avoid to small values - leads to crash - but enough to evaluate noise return; } - BENCHFUN + // BENCHFUN const int W = bfw; const int H = bfh; // printf("W=%i H=%i\n", W, H); @@ -12740,19 +13415,24 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int //first change Lab L to pseudo linear with gamma = 3.f slope 9.032...and in range 0...65536, or with gamma slope Lab #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multithread) + # pragma omp parallel for schedule(dynamic,16) if (multithread) #endif + for (int y = 0; y < H; ++y) { int x = 0; #ifdef __SSE2__ + for (; x < W - 3; x += 4) { STVFU(img[y][x], F2V(65536.f) * igammalog(LVFU(img[y][x]) / F2V(32768.f), F2V(gamma), F2V(ts), F2V(g_a[2]), F2V(g_a[4]))); } + #endif - for (;x < W; ++x) { + + for (; x < W; ++x) { img[y][x] = 65536.f * igammalog(img[y][x] / 32768.f, gamma, ts, g_a[2], g_a[4]); } } + // these two can be changed if needed. increasing max_patch_radius doesn't // affect performance, whereas max_search_radius *really* does // (the complexity is O(max_search_radius^2 * W * H)) @@ -12780,44 +13460,49 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int // modified by compression and offsetting depending on the detail_thresh // parameter, i.e. mask[y][x] = mask[y][x] * (1 - f) + f, // where f = detail_thresh / 100 - float amount = LIM(float(detail_thresh)/100.f, 0.f, 0.99f); + float amount = LIM(float(detail_thresh) / 100.f, 0.f, 0.99f); array2D mask(W, H);// ARRAY2D_ALIGNED); - + { array2D LL(W, H, img, ARRAY2D_BYREFERENCE); ImProcFunctions::detail_mask(LL, mask, W, H, 1.f, 1e-3f, 1.f, amount, BlurType::GAUSS, 2.f / scale, multithread); } - + //allocate dst - same type of datas as img float** dst; int wid = W; int hei = H; dst = new float*[hei]; + for (int i = 0; i < hei; ++i) { - dst[i] = new float[wid]; + dst[i] = new float[wid]; } + const int border = search_radius + patch_radius; const int WW = W + border * 2; const int HH = H + border * 2; array2D src(WW, HH);//, ARRAY2D_ALIGNED); - + #ifdef _OPENMP -# pragma omp parallel for if (multithread) + # pragma omp parallel for if (multithread) #endif + for (int y = 0; y < HH; ++y) { - int yy = y <= border ? 0 : y - border >= H ? H-1 : y - border; + int yy = y <= border ? 0 : y - border >= H ? H - 1 : y - border; + for (int x = 0; x < WW; ++x) { - int xx = x <= border ? 0 : x - border >= W ? W-1 : x - border; + int xx = x <= border ? 0 : x - border >= W ? W - 1 : x - border; float Y = img[yy][xx] / 65536.f; src[y][x] = Y; } } #ifdef _OPENMP -# pragma omp parallel for if (multithread) + # pragma omp parallel for if (multithread) #endif + for (int y = 0; y < H; ++y) { for (int x = 0; x < W; ++x) { dst[y][x] = 0.f; @@ -12825,27 +13510,29 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int } constexpr int lutsz = 8192; - constexpr float lutfactor = 100.f / float(lutsz-1); + constexpr float lutfactor = 100.f / float(lutsz - 1); LUTf explut(lutsz); + for (int i = 0; i < lutsz; ++i) { float x = float(i) * lutfactor; explut[i] = xexpf(-x); } #ifdef _OPENMP -# pragma omp parallel for if (multithread) + # pragma omp parallel for if (multithread) #endif + for (int y = 0; y < H; ++y) { for (int x = 0; x < W; ++x) { mask[y][x] = (1.f / (mask[y][x] * h2)) / lutfactor; } } - + // process by tiles to avoid numerical accuracy errors in the computation // of the integral image const int tile_size = 150; - const int ntiles_x = int(std::ceil(float(WW) / (tile_size-2*border))); - const int ntiles_y = int(std::ceil(float(HH) / (tile_size-2*border))); + const int ntiles_x = int(std::ceil(float(WW) / (tile_size - 2 * border))); + const int ntiles_y = int(std::ceil(float(HH) / (tile_size - 2 * border))); const int ntiles = ntiles_x * ntiles_y; #ifdef __SSE2__ @@ -12855,147 +13542,162 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int #endif #ifdef _OPENMP - #pragma omp parallel if (multithread) + #pragma omp parallel if (multithread) #endif { #ifdef __SSE2__ - // flush denormals to zero to avoid performance penalty - const auto oldMode = _MM_GET_FLUSH_ZERO_MODE(); - _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); + // flush denormals to zero to avoid performance penalty + const auto oldMode = _MM_GET_FLUSH_ZERO_MODE(); + _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); #endif - + #ifdef _OPENMP - #pragma omp for schedule(dynamic, 2) + #pragma omp for schedule(dynamic, 2) #endif - for (int tile = 0; tile < ntiles; ++tile) { - const int tile_y = tile / ntiles_x; - const int tile_x = tile % ntiles_x; - const int start_y = tile_y * (tile_size - 2*border); - const int end_y = std::min(start_y + tile_size, HH); - const int TH = end_y - start_y; + for (int tile = 0; tile < ntiles; ++tile) { + const int tile_y = tile / ntiles_x; + const int tile_x = tile % ntiles_x; - const int start_x = tile_x * (tile_size - 2*border); - const int end_x = std::min(start_x + tile_size, WW); - const int TW = end_x - start_x; + const int start_y = tile_y * (tile_size - 2 * border); + const int end_y = std::min(start_y + tile_size, HH); + const int TH = end_y - start_y; - const auto Yf = [=](int y) -> int { return LIM(y+start_y, 0, HH-1); }; - const auto Xf = [=](int x) -> int { return LIM(x+start_x, 0, WW-1); }; + const int start_x = tile_x * (tile_size - 2 * border); + const int end_x = std::min(start_x + tile_size, WW); + const int TW = end_x - start_x; - const auto score = - [&](int tx, int ty, int zx, int zy) -> float - { + const auto Yf = [ = ](int y) -> int { return LIM(y + start_y, 0, HH - 1); }; + const auto Xf = [ = ](int x) -> int { return LIM(x + start_x, 0, WW - 1); }; + + const auto score = + [&](int tx, int ty, int zx, int zy) -> float { return SQR(src[Yf(zy)][Xf(zx)] - src[Yf(zy + ty)][Xf(zx + tx)]); }; - array2D St(TW, TH);//, ARRAY2D_ALIGNED); - array2D SW(TW, TH, ARRAY2D_CLEAR_DATA);//, ARRAY2D_ALIGNED|ARRAY2D_CLEAR_DATA); + array2D St(TW, TH);//, ARRAY2D_ALIGNED); + array2D SW(TW, TH, ARRAY2D_CLEAR_DATA);//, ARRAY2D_ALIGNED|ARRAY2D_CLEAR_DATA); + + for (int ty = -search_radius; ty <= search_radius; ++ty) { + for (int tx = -search_radius; tx <= search_radius; ++tx) { + // Step 1 — Compute the integral image St + St[0][0] = 0.f; - for (int ty = -search_radius; ty <= search_radius; ++ty) { - for (int tx = -search_radius; tx <= search_radius; ++tx) { - // Step 1 — Compute the integral image St - St[0][0] = 0.f; - for (int xx = 1; xx < TW; ++xx) { - St[0][xx] = St[0][xx-1] + score(tx, ty, xx, 0); - } - for (int yy = 1; yy < TH; ++yy) { - St[yy][0] = St[yy-1][0] + score(tx, ty, 0, yy); - } - for (int yy = 1; yy < TH; ++yy) { for (int xx = 1; xx < TW; ++xx) { - // operation grouping tuned for performance (empirically) - St[yy][xx] = (St[yy][xx-1] + St[yy-1][xx]) - (St[yy-1][xx-1] - score(tx, ty, xx, yy)); + St[0][xx] = St[0][xx - 1] + score(tx, ty, xx, 0); } - } - // Step 2 — Compute weight and estimate for patches - // V(x), V(y) with y = x + t - for (int yy = start_y+border; yy < end_y-border; ++yy) { - int y = yy - border; - int xx = start_x+border; + + for (int yy = 1; yy < TH; ++yy) { + St[yy][0] = St[yy - 1][0] + score(tx, ty, 0, yy); + } + + for (int yy = 1; yy < TH; ++yy) { + for (int xx = 1; xx < TW; ++xx) { + // operation grouping tuned for performance (empirically) + St[yy][xx] = (St[yy][xx - 1] + St[yy - 1][xx]) - (St[yy - 1][xx - 1] - score(tx, ty, xx, yy)); + } + } + + // Step 2 — Compute weight and estimate for patches + // V(x), V(y) with y = x + t + for (int yy = start_y + border; yy < end_y - border; ++yy) { + int y = yy - border; + int xx = start_x + border; #ifdef __SSE2__ - for (; xx < end_x-border-3; xx += 4) { - int x = xx - border; - int sx = xx + tx; - int sy = yy + ty; - int sty = yy - start_y; - int stx = xx - start_x; - - vfloat dist2 = LVFU(St[sty + patch_radius][stx + patch_radius]) + LVFU(St[sty - patch_radius][stx - patch_radius]) - LVFU(St[sty + patch_radius][stx - patch_radius]) - LVFU(St[sty - patch_radius][stx + patch_radius]); - dist2 = vmaxf(dist2, zerov); - vfloat d = dist2 * LVFU(mask[y][x]); - vfloat weight = explut[d]; - STVFU(SW[y-start_y][x-start_x], LVFU(SW[y-start_y][x-start_x]) + weight); - vfloat Y = weight * LVFU(src[sy][sx]); - STVFU(dst[y][x], LVFU(dst[y][x]) + Y); - } + for (; xx < end_x - border - 3; xx += 4) { + int x = xx - border; + int sx = xx + tx; + int sy = yy + ty; + + int sty = yy - start_y; + int stx = xx - start_x; + + vfloat dist2 = LVFU(St[sty + patch_radius][stx + patch_radius]) + LVFU(St[sty - patch_radius][stx - patch_radius]) - LVFU(St[sty + patch_radius][stx - patch_radius]) - LVFU(St[sty - patch_radius][stx + patch_radius]); + dist2 = vmaxf(dist2, zerov); + vfloat d = dist2 * LVFU(mask[y][x]); + vfloat weight = explut[d]; + STVFU(SW[y - start_y][x - start_x], LVFU(SW[y - start_y][x - start_x]) + weight); + vfloat Y = weight * LVFU(src[sy][sx]); + STVFU(dst[y][x], LVFU(dst[y][x]) + Y); + } + #endif - for (; xx < end_x-border; ++xx) { - int x = xx - border; - int sx = xx + tx; - int sy = yy + ty; - int sty = yy - start_y; - int stx = xx - start_x; - - float dist2 = St[sty + patch_radius][stx + patch_radius] + St[sty - patch_radius][stx - patch_radius] - St[sty + patch_radius][stx - patch_radius] - St[sty - patch_radius][stx + patch_radius]; - dist2 = std::max(dist2, 0.f); - float d = dist2 * mask[y][x]; - float weight = explut[d]; - SW[y-start_y][x-start_x] += weight; - float Y = weight * src[sy][sx]; - dst[y][x] += Y; + for (; xx < end_x - border; ++xx) { + int x = xx - border; + int sx = xx + tx; + int sy = yy + ty; - assert(!xisinff(dst[y][x])); - assert(!xisnanf(dst[y][x])); + int sty = yy - start_y; + int stx = xx - start_x; + + float dist2 = St[sty + patch_radius][stx + patch_radius] + St[sty - patch_radius][stx - patch_radius] - St[sty + patch_radius][stx - patch_radius] - St[sty - patch_radius][stx + patch_radius]; + dist2 = std::max(dist2, 0.f); + float d = dist2 * mask[y][x]; + float weight = explut[d]; + SW[y - start_y][x - start_x] += weight; + float Y = weight * src[sy][sx]; + dst[y][x] += Y; + + assert(!xisinff(dst[y][x])); + assert(!xisnanf(dst[y][x])); + } } } } - } + // printf("E\n"); - - // Compute final estimate at pixel x = (x1, x2) - for (int yy = start_y+border; yy < end_y-border; ++yy) { - int y = yy - border; - int xx = start_x+border; -#ifdef __SSE2__ - for (; xx < end_x-border-3; xx += 4) { - int x = xx - border; - - const vfloat Y = LVFU(dst[y][x]); - const vfloat f = (v1e_5f + LVFU(SW[y-start_y][x-start_x])); - STVFU(dst[y][x], (Y / f) * v65536f); - } -#endif - for (; xx < end_x-border; ++xx) { - int x = xx - border; - - const float Y = dst[y][x]; - const float f = (1e-5f + SW[y-start_y][x-start_x]); - dst[y][x] = (Y / f) * 65536.f; - assert(!xisnanf(dst[y][x])); + // Compute final estimate at pixel x = (x1, x2) + for (int yy = start_y + border; yy < end_y - border; ++yy) { + int y = yy - border; + int xx = start_x + border; +#ifdef __SSE2__ + + for (; xx < end_x - border - 3; xx += 4) { + int x = xx - border; + + const vfloat Y = LVFU(dst[y][x]); + const vfloat f = (v1e_5f + LVFU(SW[y - start_y][x - start_x])); + STVFU(dst[y][x], (Y / f) * v65536f); + } + +#endif + + for (; xx < end_x - border; ++xx) { + int x = xx - border; + + const float Y = dst[y][x]; + const float f = (1e-5f + SW[y - start_y][x - start_x]); + dst[y][x] = (Y / f) * 65536.f; + + assert(!xisnanf(dst[y][x])); + } } } - } #ifdef __SSE2__ - _MM_SET_FLUSH_ZERO_MODE(oldMode); + _MM_SET_FLUSH_ZERO_MODE(oldMode); #endif } // omp parallel #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multithread) + # pragma omp parallel for schedule(dynamic,16) if (multithread) #endif + for (int y = 0; y < H; ++y) {//apply inverse gamma 3.f and put result in range 32768.f int x = 0; #ifdef __SSE2__ + for (; x < W - 3; x += 4) { STVFU(img[y][x], F2V(32768.f) * gammalog(LVFU(dst[y][x]) / F2V(65536.f), F2V(gamma), F2V(ts), F2V(g_a[3]), F2V(g_a[4]))); } + #endif + for (; x < W; ++x) { img[y][x] = 32768.f * gammalog(dst[y][x] / 65536.f, gamma, ts, g_a[3], g_a[4]); } @@ -13004,8 +13706,9 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int for (int i = 0; i < hei; ++i) { delete[] dst[i]; } + delete[] dst; - + } void ImProcFunctions::Lab_Local( @@ -13034,7 +13737,7 @@ void ImProcFunctions::Lab_Local( const LUTf& czlocalcurve, bool localczutili, const LUTf& czjzlocalcurve, bool localczjzutili, - const LocCCmaskCurve& locccmasCurve, bool lcmasutili, const LocLLmaskCurve& locllmasCurve, bool llmasutili, const LocHHmaskCurve& lochhmasCurve, bool lhmasutili, const LocHHmaskCurve& llochhhmasCurve, bool lhhmasutili, + const LocCCmaskCurve& locccmasCurve, bool lcmasutili, const LocLLmaskCurve& locllmasCurve, bool llmasutili, const LocHHmaskCurve& lochhmasCurve, bool lhmasutili, const LocHHmaskCurve& llochhhmasCurve, bool lhhmasutili, const LocHHmaskCurve& llochhhmascieCurve, bool lhhmascieutili, const LocCCmaskCurve& locccmasexpCurve, bool lcmasexputili, const LocLLmaskCurve& locllmasexpCurve, bool llmasexputili, const LocHHmaskCurve& lochhmasexpCurve, bool lhmasexputili, const LocCCmaskCurve& locccmasSHCurve, bool lcmasSHutili, const LocLLmaskCurve& locllmasSHCurve, bool llmasSHutili, const LocHHmaskCurve& lochhmasSHCurve, bool lhmasSHutili, const LocCCmaskCurve& locccmasvibCurve, bool lcmasvibutili, const LocLLmaskCurve& locllmasvibCurve, bool llmasvibutili, const LocHHmaskCurve& lochhmasvibCurve, bool lhmasvibutili, @@ -13050,6 +13753,7 @@ void ImProcFunctions::Lab_Local( const LocHHmaskCurve& lochhhmas_Curve, bool lhhmas_utili, const LocwavCurve& loclmasCurveblwav, bool lmasutiliblwav, const LocwavCurve& loclmasCurvecolwav, bool lmasutilicolwav, + const LocwavCurve& loclmasCurveciewav, bool lmasutiliciewav, const LocwavCurve& locwavCurve, bool locwavutili, const LocwavCurve& locwavCurvejz, bool locwavutilijz, const LocwavCurve& loclevwavCurve, bool loclevwavutili, @@ -13060,12 +13764,12 @@ void ImProcFunctions::Lab_Local( const LocwavCurve& locwavCurveden, bool locwavdenutili, const LocwavCurve& locedgwavCurve, bool locedgwavutili, const LocwavCurve& loclmasCurve_wav, bool lmasutili_wav, - + bool LHutili, bool HHutili, bool CHutili, bool HHutilijz, bool CHutilijz, bool LHutilijz, const LUTf& cclocalcurve, bool localcutili, const LUTf& rgblocalcurve, bool localrgbutili, bool localexutili, const LUTf& exlocalcurve, const LUTf& hltonecurveloc, const LUTf& shtonecurveloc, const LUTf& tonecurveloc, const LUTf& lightCurveloc, double& huerefblur, double& chromarefblur, double& lumarefblur, double& hueref, double& chromaref, double& lumaref, double& sobelref, int &lastsav, - bool prevDeltaE, int llColorMask, int llColorMaskinv, int llExpMask, int llExpMaskinv, int llSHMask, int llSHMaskinv, int llvibMask, int lllcMask, int llsharMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask, int lllogMask, int ll_Mask, int llcieMask, + bool prevDeltaE, int llColorMask, int llColorMaskinv, int llExpMask, int llExpMaskinv, int llSHMask, int llSHMaskinv, int llvibMask, int lllcMask, int llsharMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask, int lllogMask, int ll_Mask, int llcieMask, float& minCD, float& maxCD, float& mini, float& maxi, float& Tmean, float& Tsigma, float& Tmin, float& Tmax, - float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab, + float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab,float &maxicam, float &rdx, float &rdy, float &grx, float &gry, float &blx, float &bly, float &meanx, float &meany, float &meanxe, float &meanye, int &ill, float &contsig, float &lightsig, float& highresi, float& nresi, float& highresi46, float& nresi46, float& Lhighresi, float& Lnresi, float& Lhighresi46, float& Lnresi46 ) @@ -13111,6 +13815,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif + for (int y = rtengine::max(begy - cy, 0); y < rtengine::min(yEn - cy, original->H); y++) { const int loy = cy + y; @@ -13131,6 +13836,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { ble[ir][jr] /= 32768.f; @@ -13154,6 +13860,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(+:sombel) if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { const float val = ble[ir][jr] * 32768.f; @@ -13167,8 +13874,8 @@ void ImProcFunctions::Lab_Local( } //encoding lab at the beginning - if (lp.logena && (call <=3 || lp.prevdE || lp.showmasklogmet == 2 || lp.enaLMask || lp.showmasklogmet == 3 || lp.showmasklogmet == 4)) { - + if (lp.logena && (call <= 3 || lp.prevdE || lp.showmasklogmet == 2 || lp.enaLMask || lp.showmasklogmet == 3 || lp.showmasklogmet == 4)) { + const int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); const int yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, original->H); const int xstart = rtengine::max(static_cast(lp.xc - lp.lxL) - cx, 0); @@ -13193,6 +13900,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { bufexporig->L[y - ystart][x - xstart] = original->L[y][x]; @@ -13232,6 +13940,7 @@ void ImProcFunctions::Lab_Local( if (lp.showmasklogmet == 0) { zero = true; } + float chrom = lp.chromaL; float rad = lp.radmaL; float blendm = lp.blendmaL; @@ -13266,6 +13975,7 @@ void ImProcFunctions::Lab_Local( return; } + if (lp.showmasklogmet == 0 || lp.showmasklogmet == 1 || lp.showmasklogmet == 2 || lp.showmasklogmet == 4 || lp.enaLMask) { bufexpfin->CopyFrom(bufexporig.get(), multiThread); @@ -13275,35 +13985,40 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif - for (int y = 0; y < bfh; y++) { - for (int x = 0; x < bfw; x++) { - tmpImageorig->r(y, x) = tmpImage->r(y, x); - tmpImageorig->g(y, x) = tmpImage->g(y, x); - tmpImageorig->b(y, x) = tmpImage->b(y, x); - } + + for (int y = 0; y < bfh; y++) { + for (int x = 0; x < bfw; x++) { + tmpImageorig->r(y, x) = tmpImage->r(y, x); + tmpImageorig->g(y, x) = tmpImage->g(y, x); + tmpImageorig->b(y, x) = tmpImage->b(y, x); } - + } + log_encode(tmpImage.get(), lp, multiThread, bfw, bfh); + + const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).repar; - + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif - for (int y = 0; y < bfh; y++) { - for (int x = 0; x < bfw; x++) { - tmpImage->r(y, x) = intp(repart, tmpImageorig->r(y, x), tmpImage->r(y, x)); - tmpImage->g(y, x) = intp(repart, tmpImageorig->g(y, x), tmpImage->g(y, x)); - tmpImage->b(y, x) = intp(repart, tmpImageorig->b(y, x), tmpImage->b(y, x)); - } + + for (int y = 0; y < bfh; y++) { + for (int x = 0; x < bfw; x++) { + tmpImage->r(y, x) = intp(repart, tmpImageorig->r(y, x), tmpImage->r(y, x)); + tmpImage->g(y, x) = intp(repart, tmpImageorig->g(y, x), tmpImage->g(y, x)); + tmpImage->b(y, x) = intp(repart, tmpImageorig->b(y, x), tmpImage->b(y, x)); } - + } + rgb2lab(*tmpImage, *bufexpfin, params->icm.workingProfile); - + tmpImageorig.reset(); tmpImage.reset(); + if (params->locallab.spots.at(sp).ciecam) { - bool HHcurvejz = false, CHcurvejz = false, LHcurvejz = false;; - ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 1, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + bool HHcurvejz = false, CHcurvejz = false, LHcurvejz = false; + ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 1, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); } @@ -13311,11 +14026,12 @@ void ImProcFunctions::Lab_Local( bool HHcurvejz = false; bool CHcurvejz = false; bool LHcurvejz = false; + if (params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecam == "jz") {//some cam16 elementsfor Jz - ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); } - ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(),bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); float rad = params->locallab.spots.at(sp).detailcie; loccont(bfw, bfh, bufexpfin.get(), rad, 15.f, sk); @@ -13327,37 +14043,40 @@ void ImProcFunctions::Lab_Local( struct grad_params gplog; calclocalGradientParams(lp, gplog, ystart, xstart, bfw, bfh, 11); #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if(multiThread) + #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufexpfin->L[ir][jr] *= ImProcFunctions::calcGradientFactor(gplog, jr, ir); } } } - //end graduated - float recoth = lp.recothrl; + //end graduated - if(lp.recothrl < 1.f) { - recoth = -1.f * recoth + 2.f; - } + float recoth = lp.recothrl; - if(lp.enaLMask && lp.recothrl != 1.f) { - float hig = lp.higthrl; - float low = lp.lowthrl; - // float recoth = lp.recothrl; - float decay = lp.decayl; - bool invmask = false; - maskrecov(bufexpfin.get(), original, bufmaskoriglog.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); - } - if(lp.recothrl >= 1.f) { - transit_shapedetect2(sp, 0.f, 0.f, call, 11, bufexporig.get(), bufexpfin.get(), originalmasklog.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); - } else { - transit_shapedetect2(sp, 0.f, 0.f, call, 11, bufexporig.get(), bufexpfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); - } + if (lp.recothrl < 1.f) { + recoth = -1.f * recoth + 2.f; + } + + if (lp.enaLMask && lp.recothrl != 1.f) { + float hig = lp.higthrl; + float low = lp.lowthrl; + // float recoth = lp.recothrl; + float decay = lp.decayl; + bool invmask = false; + maskrecov(bufexpfin.get(), original, bufmaskoriglog.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); + } + + if (lp.recothrl >= 1.f) { + transit_shapedetect2(sp, 0.f, 0.f, call, 11, bufexporig.get(), bufexpfin.get(), originalmasklog.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); + } else { + transit_shapedetect2(sp, 0.f, 0.f, call, 11, bufexporig.get(), bufexpfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); + } } - + if (lp.recur) { original->CopyFrom(transformed, multiThread); float avge; @@ -13393,12 +14112,13 @@ void ImProcFunctions::Lab_Local( if (lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) { bufmaskorigbl.reset(new LabImage(TW, TH)); bufmaskblurbl.reset(new LabImage(TW, TH, true)); - originalmaskbl.reset (new LabImage(TW, TH)); + originalmaskbl.reset(new LabImage(TW, TH)); } #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < TH; y++) { for (int x = 0; x < TW; x++) { bufblorig->L[y][x] = original->L[y][x]; @@ -13516,6 +14236,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend ; y++) { for (int x = xstart; x < xend; x++) { tmp1->L[y - ystart][x - xstart] = original->L[y][x]; @@ -13566,12 +14287,15 @@ void ImProcFunctions::Lab_Local( #pragma omp parallel if (multiThread) #endif { - if (lp.chromet == 0) { + if (lp.chromet == 0) + { gaussianBlur(tmp1->L, tmp1->L, bfw, bfh, radius); - } else if (lp.chromet == 1) { + } else if (lp.chromet == 1) + { gaussianBlur(tmp1->a, tmp1->a, bfw, bfh, radius); gaussianBlur(tmp1->b, tmp1->b, bfw, bfh, radius); - } else if (lp.chromet == 2) { + } else if (lp.chromet == 2) + { gaussianBlur(tmp1->L, tmp1->L, bfw, bfh, radius); gaussianBlur(tmp1->a, tmp1->a, bfw, bfh, radius); gaussianBlur(tmp1->b, tmp1->b, bfw, bfh, radius); @@ -13596,12 +14320,15 @@ void ImProcFunctions::Lab_Local( #pragma omp parallel if (multiThread) #endif { - if (lp.chromet == 0) { + if (lp.chromet == 0) + { gaussianBlur(original->L, tmp1->L, TW, TH, radius); - } else if (lp.chromet == 1) { + } else if (lp.chromet == 1) + { gaussianBlur(original->a, tmp1->a, TW, TH, radius); gaussianBlur(original->b, tmp1->b, TW, TH, radius); - } else if (lp.chromet == 2) { + } else if (lp.chromet == 2) + { gaussianBlur(original->L, tmp1->L, TW, TH, radius); gaussianBlur(original->a, tmp1->a, TW, TH, radius); gaussianBlur(original->b, tmp1->b, TW, TH, radius); @@ -13730,6 +14457,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend ; y++) { for (int x = xstart; x < xend; x++) { tmp1->L[y - ystart][x - xstart] = original->L[y][x]; @@ -13749,11 +14477,12 @@ void ImProcFunctions::Lab_Local( array2D gg(bfw, bfh); array2D bb(bfw, bfh); array2D guide(bfw, bfh); - - + + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { LL[y][x] = tmp1->L[y][x]; @@ -13765,6 +14494,7 @@ void ImProcFunctions::Lab_Local( } } + array2D iR(bfw, bfh, rr, 0); array2D iG(bfw, bfh, gg, 0); array2D iB(bfw, bfh, bb, 0); @@ -13788,11 +14518,12 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { - rr[y][x] = intp(lp.strbl, rr[y][x] , iR[y][x]); - gg[y][x] = intp(lp.strbl, gg[y][x] , iG[y][x]); - bb[y][x] = intp(lp.strbl, bb[y][x] , iB[y][x]); + rr[y][x] = intp(lp.strbl, rr[y][x], iR[y][x]); + gg[y][x] = intp(lp.strbl, gg[y][x], iG[y][x]); + bb[y][x] = intp(lp.strbl, bb[y][x], iB[y][x]); tmpImage->r(y, x) = rr[y][x]; tmpImage->g(y, x) = gg[y][x]; tmpImage->b(y, x) = bb[y][x]; @@ -13806,16 +14537,19 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { - LL[y][x] = intp(lp.strbl, LL[y][x] , iL[y][x]); + LL[y][x] = intp(lp.strbl, LL[y][x], iL[y][x]); tmp1->L[y][x] = LL[y][x]; } } } - if(lp.enablMask && lp.recothr != 1.f && lp.smasktyp != 1) { + + if (lp.enablMask && lp.recothr != 1.f && lp.smasktyp != 1) { array2D masklum; masklum(bfw, bfh); + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { masklum[ir][jr] = 1.f; @@ -13828,33 +14562,37 @@ void ImProcFunctions::Lab_Local( float lowc; calcdif(low, lowc); - if(higc < lowc) { + if (higc < lowc) { higc = lowc + 0.01f; } + float th = (lp.recothr - 1.f); float ahigh = th / (higc - 100.f); float bhigh = 1.f - higc * ahigh; - float alow = th / lowc; + float alow = th / lowc; float blow = 1.f - th; - + #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { const float lM = bufmaskblurbl->L[ir + ystart][jr + xstart]; const float lmr = lM / 327.68f; + if (lM < 327.68f * lowc) { masklum[ir][jr] = alow * lmr + blow; } else if (lM < 327.68f * higc) { - + } else { masklum[ir][jr] = ahigh * lmr + bhigh; } - if(lp.invmask == true) { + + if (lp.invmask == true) { float k = masklum[ir][jr]; - masklum[ir][jr] = 1 - k*k; + masklum[ir][jr] = 1 - k * k; } } @@ -13863,8 +14601,9 @@ void ImProcFunctions::Lab_Local( } #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < bfh; ++i) { for (int j = 0; j < bfw; ++j) { tmp1->L[i][j] = (tmp3->L[i][j] - tmp1->L[i][j]) * LIM01(masklum[i][j]) + tmp1->L[i][j]; @@ -13872,6 +14611,7 @@ void ImProcFunctions::Lab_Local( tmp1->b[i][j] = (tmp3->b[i][j] - tmp1->b[i][j]) * LIM01(masklum[i][j]) + tmp1->b[i][j]; } } + masklum.free(); } @@ -13884,6 +14624,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < TH ; y++) { for (int x = 0; x < TW; x++) { tmp1->L[y][x] = original->L[y][x]; @@ -13908,6 +14649,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < TH ; y++) { for (int x = 0; x < TW; x++) { LL[y][x] = tmp1->L[y][x]; @@ -13943,11 +14685,12 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < TH ; y++) { for (int x = 0; x < TW; x++) { - rr[y][x] = intp(lp.strbl, rr[y][x] , iR[y][x]); - gg[y][x] = intp(lp.strbl, gg[y][x] , iG[y][x]); - bb[y][x] = intp(lp.strbl, bb[y][x] , iB[y][x]); + rr[y][x] = intp(lp.strbl, rr[y][x], iR[y][x]); + gg[y][x] = intp(lp.strbl, gg[y][x], iG[y][x]); + bb[y][x] = intp(lp.strbl, bb[y][x], iB[y][x]); tmpImage->r(y, x) = rr[y][x]; tmpImage->g(y, x) = gg[y][x]; tmpImage->b(y, x) = bb[y][x]; @@ -13961,16 +14704,19 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < TH ; y++) { for (int x = 0; x < TW; x++) { - LL[y][x] = intp(lp.strbl, LL[y][x] , iL[y][x]); + LL[y][x] = intp(lp.strbl, LL[y][x], iL[y][x]); tmp1->L[y][x] = LL[y][x]; } } } - if(lp.enablMask && lp.recothr != 1.f && lp.smasktyp != 1) { + + if (lp.enablMask && lp.recothr != 1.f && lp.smasktyp != 1) { array2D masklum; masklum(TW, TH); + for (int ir = 0; ir < TH; ir++) for (int jr = 0; jr < TW; jr++) { masklum[ir][jr] = 1.f; @@ -13983,27 +14729,30 @@ void ImProcFunctions::Lab_Local( float lowc; calcdif(low, lowc); - if(higc < lowc) { + if (higc < lowc) { higc = lowc + 0.01f; } + float th = (lp.recothr - 1.f); float ahigh = th / (higc - 100.f); float bhigh = 1.f - higc * ahigh; - float alow = th / lowc; + float alow = th / lowc; float blow = 1.f - th; - + #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < TH; ir++) for (int jr = 0; jr < TW; jr++) { const float lM = bufmaskblurbl->L[ir][jr]; const float lmr = lM / 327.68f; + if (lM < 327.68f * lowc) { masklum[ir][jr] = alow * lmr + blow; } else if (lM < 327.68f * higc) { - + } else { masklum[ir][jr] = (ahigh * lmr + bhigh); } @@ -14014,8 +14763,9 @@ void ImProcFunctions::Lab_Local( } #ifdef _OPENMP - #pragma omp parallel for if (multiThread) + #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < TH; ++i) { for (int j = 0; j < TW; ++j) { tmp1->L[i][j] = (tmp3->L[i][j] - tmp1->L[i][j]) * LIM01(masklum[i][j]) + tmp1->L[i][j]; @@ -14023,6 +14773,7 @@ void ImProcFunctions::Lab_Local( tmp1->b[i][j] = (tmp3->b[i][j] - tmp1->b[i][j]) * LIM01(masklum[i][j]) + tmp1->b[i][j]; } } + masklum.free(); } @@ -14033,8 +14784,8 @@ void ImProcFunctions::Lab_Local( if (tmp1.get()) { if (lp.blurmet == 0) { //blur and noise (center) - - if(lp.smasktyp != 1) { + + if (lp.smasktyp != 1) { BlurNoise_Local(tmp1.get(), originalmaskbl.get(), hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); } else { BlurNoise_Local(tmp1.get(), original, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); @@ -14046,8 +14797,8 @@ void ImProcFunctions::Lab_Local( calc_ref(sp, original, transformed, 0, 0, original->W, original->H, sk, huerefblur, chromarefblur, lumarefblur, hueref, chromaref, lumaref, sobelref, avge, locwavCurveden, locwavdenutili); } } else if (lp.blurmet == 1) { - // InverseBlurNoise_Local(originalmaskbl, bufchro, lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); - if(lp.smasktyp != 1) { +// InverseBlurNoise_Local(originalmaskbl, bufchro, lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); + if (lp.smasktyp != 1) { InverseBlurNoise_Local(originalmaskbl.get(), lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); } else { InverseBlurNoise_Local(original, lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); @@ -14082,6 +14833,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = rtengine::max(0, begy - cy); y < rtengine::min(transformed->H, yEn - cy); y++) { const int loy = cy + y; @@ -14136,7 +14888,7 @@ void ImProcFunctions::Lab_Local( const int bfw = xend - xstart; if (bfw >= mDEN && bfh >= mDEN) { - // printf("OK TM\n"); + // printf("OK TM\n"); array2D buflight(bfw, bfh); JaggedArray bufchro(bfw, bfh); std::unique_ptr bufgb(new LabImage(bfw, bfh)); @@ -14158,31 +14910,35 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel if (multiThread) { - #pragma omp for schedule(dynamic,16) nowait + #pragma omp for schedule(dynamic,16) nowait #endif - for (int y = ystart; y < yend; y++) { - for (int x = xstart; x < xend; x++) { - bufgbm->L[y - ystart][x - xstart] = bufgb->L[y - ystart][x - xstart] = original->L[y][x]; + + for (int y = ystart; y < yend; y++) { + for (int x = xstart; x < xend; x++) { + bufgbm->L[y - ystart][x - xstart] = bufgb->L[y - ystart][x - xstart] = original->L[y][x]; + } } - } #ifdef _OPENMP - #pragma omp for schedule(dynamic,16) nowait + #pragma omp for schedule(dynamic,16) nowait #endif - for (int y = ystart; y < yend; y++) { - for (int x = xstart; x < xend; x++) { - bufgbm->a[y - ystart][x - xstart] = bufgb->a[y - ystart][x - xstart] = original->a[y][x]; + + for (int y = ystart; y < yend; y++) { + for (int x = xstart; x < xend; x++) { + bufgbm->a[y - ystart][x - xstart] = bufgb->a[y - ystart][x - xstart] = original->a[y][x]; + } } - } #ifdef _OPENMP - #pragma omp for schedule(dynamic,16) + #pragma omp for schedule(dynamic,16) #endif - for (int y = ystart; y < yend; y++) { - for (int x = xstart; x < xend; x++) { - bufgbm->b[y - ystart][x - xstart] = bufgb->b[y - ystart][x - xstart] = original->b[y][x]; + + for (int y = ystart; y < yend; y++) { + for (int x = xstart; x < xend; x++) { + bufgbm->b[y - ystart][x - xstart] = bufgb->b[y - ystart][x - xstart] = original->b[y][x]; + } } - } + #ifdef _OPENMP } #endif @@ -14261,29 +15017,32 @@ void ImProcFunctions::Lab_Local( constexpr int itera = 0; ImProcFunctions::EPDToneMaplocal(sp, bufgb.get(), tmp1.get(), itera, sk);//iterate to 0 calculate with edgstopping, improve result, call=1 dcrop we can put iterate to 5 - if (params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecie == "tm") { - bool HHcurvejz = false; - bool CHcurvejz = false; - bool LHcurvejz = false; - if (params->locallab.spots.at(sp).modecam == "jz") {//some cam16 elementsfor Jz - ImProcFunctions::ciecamloc_02float(lp, sp, tmp1.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + if (params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecie == "tm") { + bool HHcurvejz = false; + bool CHcurvejz = false; + bool LHcurvejz = false; + + if (params->locallab.spots.at(sp).modecam == "jz") {//some cam16 elementsfor Jz + ImProcFunctions::ciecamloc_02float(lp, sp, tmp1.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); + } + + ImProcFunctions::ciecamloc_02float(lp, sp, tmp1.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); + + float rad = params->locallab.spots.at(sp).detailcie; + loccont(bfw, bfh, tmp1.get(), rad, 15.f, sk); } - ImProcFunctions::ciecamloc_02float(lp, sp, tmp1.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); - - float rad = params->locallab.spots.at(sp).detailcie; - loccont(bfw, bfh, tmp1.get(), rad, 15.f, sk); - } - tmp1m->CopyFrom(tmp1.get(), multiThread); //save current result7 - if(params->locallab.spots.at(sp).equiltm && params->locallab.spots.at(sp).exptonemap) { - if(call == 3) { + + if (params->locallab.spots.at(sp).equiltm && params->locallab.spots.at(sp).exptonemap) { + if (call == 3) { #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { savenormtm->L[y][x] = tmp1->L[y - ystart][x - xstart]; @@ -14293,6 +15052,7 @@ void ImProcFunctions::Lab_Local( } } } + bool enatmMasktmap = params->locallab.spots.at(sp).enatmMaskaft; if (enatmMasktmap) { @@ -14336,6 +15096,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(max:maxL) reduction(min:minL) reduction(max:maxC) reduction(min:minC) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { buflight[ir][jr] = tmp1->L[ir][jr] - bufgb->L[ir][jr]; @@ -14365,6 +15126,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { buflight[y][x] *= coef; @@ -14372,15 +15134,16 @@ void ImProcFunctions::Lab_Local( } } - if(lp.enatmMask && lp.recothrt != 1.f) { + if (lp.enatmMask && lp.recothrt != 1.f) { float recoth = lp.recothrt; - if(lp.recothrt < 1.f) { + if (lp.recothrt < 1.f) { recoth = -1.f * recoth + 2.f; } + float hig = lp.higthrt; float low = lp.lowthrt; - // float recoth = lp.recothrt; + // float recoth = lp.recothrt; float decay = lp.decayt; bool invmask = false; maskrecov(tmp1.get(), original, bufmaskorigtm.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); @@ -14388,11 +15151,12 @@ void ImProcFunctions::Lab_Local( // transit_shapedetect_retinex(call, 4, bufgb.get(),bufmaskorigtm.get(), originalmasktm.get(), buflight, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); - if(lp.recothrt >= 1.f) { + if (lp.recothrt >= 1.f) { transit_shapedetect2(sp, meantm, stdtm, call, 8, bufgb.get(), tmp1.get(), originalmasktm.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } else { transit_shapedetect2(sp, meantm, stdtm, call, 8, bufgb.get(), tmp1.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } + // transit_shapedetect(8, tmp1.get(), originalmasktm.get(), bufchro, false, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); bufgb.reset(); @@ -14409,7 +15173,7 @@ void ImProcFunctions::Lab_Local( //end TM - if ((lp.dehaze != 0 || lp.prevdE) && lp.retiena ) { + if ((lp.dehaze != 0 || lp.prevdE) && lp.retiena) { int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); int yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, original->H); int xstart = rtengine::max(static_cast(lp.xc - lp.lxL) - cx, 0); @@ -14424,6 +15188,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { bufexporig->L[y - ystart][x - xstart] = original->L[y][x]; @@ -14476,17 +15241,18 @@ void ImProcFunctions::Lab_Local( bufreti = new LabImage(TW, TH); bufmask = new LabImage(TW, TH); - bufmaskorigreti = new LabImage(TW, TH); + bufmaskorigreti = new LabImage(TW, TH); if (!lp.enaretiMasktmap && lp.enaretiMask) { buforig = new LabImage(TW, TH); buforigmas = new LabImage(TW, TH); - // bufmaskorigreti = new LabImage(GW, GH); + // bufmaskorigreti = new LabImage(GW, GH); } #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < TH; ir++) //fill with 0 for (int jr = 0; jr < TW; jr++) { bufreti->L[ir][jr] = 0.f; @@ -14499,6 +15265,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H ; y++) //{ for (int x = 0; x < transformed->W; x++) { bufreti->L[y][x] = original->L[y][x]; @@ -14508,21 +15275,22 @@ void ImProcFunctions::Lab_Local( bufmask->a[y][x] = original->a[y][x]; bufmask->b[y][x] = original->b[y][x]; - + if (!lp.enaretiMasktmap && lp.enaretiMask) { buforig->L[y][x] = original->L[y][x]; buforig->a[y][x] = original->a[y][x]; buforig->b[y][x] = original->b[y][x]; - // bufmaskorigreti->L[y][x] = original->L[y][x]; - // bufmaskorigreti->a[y][x] = original->a[y][x]; - // bufmaskorigreti->b[y][x] = original->b[y][x]; - - + // bufmaskorigreti->L[y][x] = original->L[y][x]; + // bufmaskorigreti->a[y][x] = original->a[y][x]; + // bufmaskorigreti->b[y][x] = original->b[y][x]; + + } } + float raddE = params->locallab.spots.at(sp).softradiusret; //calc dE and reduction to use in MSR to reduce artifacts @@ -14542,6 +15310,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H ; y++) for (int x = 0; x < transformed->W; x++) { float dE = std::sqrt(SQR(refa - bufreti->a[y][x] / 327.68f) + SQR(refb - bufreti->b[y][x] / 327.68f) + SQR(static_cast(lumaref) - bufreti->b[y][x] / 327.68f)); @@ -14558,6 +15327,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) for (int jr = 0; jr < Wd; jr += 1) { orig[ir][jr] = bufreti->L[ir][jr]; @@ -14585,11 +15355,13 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) { for (int jr = 0; jr < Wd; jr += 1) { tmpl->L[ir][jr] = orig[ir][jr]; - if(params->locallab.spots.at(sp).equilret && params->locallab.spots.at(sp).expreti) { - if(call == 3) { + + if (params->locallab.spots.at(sp).equilret && params->locallab.spots.at(sp).expreti) { + if (call == 3) { savenormreti->L[ir][jr] = tmpl->L[ir][jr]; } } @@ -14602,23 +15374,24 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) for (int jr = 0; jr < Wd; jr += 1) { datain[ir * Wd + jr] = orig1[ir][jr]; data[ir * Wd + jr] = orig[ir][jr]; } - if(params->locallab.spots.at(sp).equilret){ - if(call == 3) {//improccoordinator - normalize_mean_dt(data, datain, Hd * Wd, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f); - } else if(call == 1) {//dcrop + if (params->locallab.spots.at(sp).equilret) { + if (call == 3) { //improccoordinator + normalize_mean_dt(data, datain, Hd * Wd, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.); + } else if (call == 1) { //dcrop float ma = meanreti; float sa = stdreti; - float ma2 = (float) params->locallab.spots.at(sp).sensihs; + float ma2 = (float) params->locallab.spots.at(sp).sensihs; float sa2 = (float) params->locallab.spots.at(sp).sensiv; //printf("ma=%f sa=%f ma2=%f sa2=%f\n", (double) ma, (double) sa, (double) ma2, (double) sa2); //use normalize with mean and stdv - normalize_mean_dt(data, datain, Hd * Wd, 1.f, 1.f, ma, sa, ma2, sa2); + normalize_mean_dt(data, datain, Hd * Wd, 1.f, 1.f, ma, sa, ma2, sa2, 1.); } } @@ -14626,6 +15399,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) for (int jr = 0; jr < Wd; jr += 1) { tmpl->L[ir][jr] = data[ir * Wd + jr]; @@ -14635,7 +15409,7 @@ void ImProcFunctions::Lab_Local( delete [] data; } - if(lp.enaretiMask && lp.recothrr != 1.f) { + if (lp.enaretiMask && lp.recothrr != 1.f) { float hig = lp.higthrr; float low = lp.lowthrr; float recoth = lp.recothrr; @@ -14649,6 +15423,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(min:minL) reduction(max:maxL) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { buflight[ir][jr] = tmpl->L[ir][jr] - bufreti->L[ir][jr]; @@ -14680,6 +15455,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) for (int jr = 0; jr < Wd; jr += 1) { @@ -14693,6 +15469,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(max:maxChro) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { maxChro = rtengine::max(maxChro, orig1[ir][jr]); @@ -14721,6 +15498,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) for (int jr = 0; jr < Wd; jr += 1) { const float Chprov = orig1[ir][jr]; @@ -14744,6 +15522,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(min:minC) reduction(max:maxC) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { bufchro[ir][jr] = std::sqrt(SQR(tmpl->a[ir][jr]) + SQR(tmpl->b[ir][jr])) - orig1[ir][jr]; @@ -14759,6 +15538,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { bufchro[ir][jr] *= coefC; @@ -14789,6 +15569,7 @@ void ImProcFunctions::Lab_Local( delete buforigmas; } } + delete bufreti; } } @@ -14839,6 +15620,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) //fill with 0 for (int jr = 0; jr < bfw; jr++) { bufreti->L[ir][jr] = 0.f; @@ -14852,6 +15634,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { bufreti->L[y - ystart][x - xstart] = original->L[y][x]; @@ -14888,6 +15671,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend ; y++) { for (int x = xstart; x < xend; x++) { const float dE = std::sqrt(SQR(refa - bufreti->a[y - ystart][x - xstart] / 327.68f) + SQR(refb - bufreti->b[y - ystart][x - xstart] / 327.68f) + SQR(static_cast(lumaref) - bufreti->b[y - ystart][x - xstart] / 327.68f)); @@ -14908,6 +15692,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) { for (int jr = 0; jr < Wd; jr += 1) { orig[ir][jr] = bufreti->L[ir][jr]; @@ -14940,6 +15725,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) for (int jr = 0; jr < Wd; jr += 1) { tmpl->L[ir][jr] = orig[ir][jr]; @@ -14952,6 +15738,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) { for (int jr = 0; jr < Wd; jr += 1) { datain[ir * Wd + jr] = orig1[ir][jr]; @@ -14959,17 +15746,19 @@ void ImProcFunctions::Lab_Local( } } - normalize_mean_dt(data.get(), datain.get(), Hd * Wd, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f); + normalize_mean_dt(data.get(), datain.get(), Hd * Wd, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.); #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) { for (int jr = 0; jr < Wd; jr += 1) { tmpl->L[ir][jr] = data[ir * Wd + jr]; } } } - if(lp.enaretiMask && lp.recothrr != 1.f) { + + if (lp.enaretiMask && lp.recothrr != 1.f) { float hig = lp.higthrr; float low = lp.lowthrr; float recoth = lp.recothrr; @@ -14984,6 +15773,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(min:minL) reduction(max:maxL) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { buflight[ir][jr] = tmpl->L[ir][jr] - bufreti->L[ir][jr]; @@ -14999,6 +15789,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { buflight[ir][jr] *= coef; @@ -15020,6 +15811,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) { for (int jr = 0; jr < Wd; jr += 1) { orig[ir][jr] = std::sqrt(SQR(bufreti->a[ir][jr]) + SQR(bufreti->b[ir][jr])); @@ -15032,6 +15824,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(max:maxChro) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { maxChro = rtengine::max(maxChro, orig1[ir][jr]); @@ -15058,6 +15851,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir += 1) { for (int jr = 0; jr < Wd; jr += 1) { const float Chprov = orig1[ir][jr]; @@ -15079,6 +15873,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(min:minC) reduction(max:maxC) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { bufchro[ir][jr] = std::sqrt(SQR(tmpl->a[ir][jr]) + SQR(tmpl->b[ir][jr])) - orig1[ir][jr]; @@ -15094,6 +15889,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int ir = 0; ir < Hd; ir++) { for (int jr = 0; jr < Wd; jr++) { bufchro[ir][jr] *= coefC; @@ -15116,7 +15912,7 @@ void ImProcFunctions::Lab_Local( delete tmpl; delete bufmask; delete bufmaskorigreti; - + if (!lp.enaretiMasktmap && lp.enaretiMask) { if (buforig) { delete buforig; @@ -15126,6 +15922,7 @@ void ImProcFunctions::Lab_Local( delete buforigmas; } } + delete bufreti; } } @@ -15140,6 +15937,7 @@ void ImProcFunctions::Lab_Local( const int xend = rtengine::min(static_cast(lp.xc + lp.lx) - cx, original->W); int bfh = yend - ystart; int bfw = xend - xstart; + if (bfw > 65 && bfh > 65) { array2D bufsh(bfw, bfh); JaggedArray bufchrom(bfw, bfh, true); @@ -15158,6 +15956,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { loctemp->L[y - ystart][x - xstart] = original->L[y][x]; @@ -15242,6 +16041,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { bufsh[y - ystart][x - xstart] = origcbdl->L[y - ystart][x - xstart] = original->L[y][x]; @@ -15261,12 +16061,12 @@ void ImProcFunctions::Lab_Local( ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, lp.mulloc, 1.f, lp.threshol, lp.clarityml, lp.contresid, skinprot, false, b_l, t_l, t_r, b_r, choice, sk, multiThread); - + if (lp.softradiuscb > 0.f) { softproc(origcbdl.get(), loctemp.get(), lp.softradiuscb, bfh, bfw, 0.001, 0.00001, 0.5f, sk, multiThread, 1); } - - if(lp.enacbMask && lp.recothrcb != 1.f) { + + if (lp.enacbMask && lp.recothrcb != 1.f) { float hig = lp.higthrcb; float low = lp.lowthrcb; float recoth = lp.recothrcb; @@ -15274,7 +16074,7 @@ void ImProcFunctions::Lab_Local( bool invmask = false; maskrecov(loctemp.get(), original, bufmaskorigcb.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); } - + } transit_shapedetect(6, loctemp.get(), originalmaskcb.get(), bufchrom, false, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); @@ -15287,6 +16087,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufsh[ir][jr] = std::sqrt(SQR(loctemp->a[ir][jr]) + SQR(loctemp->b[ir][jr])); @@ -15316,6 +16117,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for reduction(max:maxC) reduction(min:minC) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufchrom[ir][jr] = (loctemp->L[ir][jr] - std::sqrt(SQR(loctemp->a[ir][jr]) + SQR(loctemp->b[ir][jr]))); @@ -15331,6 +16133,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufchrom[ir][jr] *= coefC; @@ -15340,14 +16143,15 @@ void ImProcFunctions::Lab_Local( transit_shapedetect(7, loctemp.get(), nullptr, bufchrom, false, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } + bufsh.free(); - + if (lp.recur) { original->CopyFrom(transformed, multiThread); float avge; calc_ref(sp, original, transformed, 0, 0, original->W, original->H, sk, huerefblur, chromarefblur, lumarefblur, hueref, chromaref, lumaref, sobelref, avge, locwavCurveden, locwavdenutili); } - + } } } @@ -15357,6 +16161,7 @@ void ImProcFunctions::Lab_Local( //vibrance float vibg = params->locallab.spots.at(sp).vibgam; + if (lp.expvib && (lp.past != 0.f || lp.satur != 0.f || lp.strvib != 0.f || vibg != 1.f || lp.war != 0 || lp.strvibab != 0.f || lp.strvibh != 0.f || lp.showmaskvibmet == 2 || lp.enavibMask || lp.showmaskvibmet == 3 || lp.showmaskvibmet == 4 || lp.prevdE) && lp.vibena) { //interior ellipse reinforced lightness and chroma //locallutili if (call <= 3) { //simpleprocess, dcrop, improccoordinator const int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); @@ -15382,6 +16187,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { bufexporig->L[y][x] = original->L[y + ystart][x + xstart]; @@ -15460,6 +16266,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + /* for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { @@ -15469,13 +16276,13 @@ void ImProcFunctions::Lab_Local( } } */ - for (int y = 0; y < bfh; y++) { - for (int x = 0; x < bfw; x++) { - // bufexporig->L[y][x] = original->L[y + ystart][x + xstart]; - bufexporig->a[y][x] = original->a[y + ystart][x + xstart]; - bufexporig->b[y][x] = original->b[y + ystart][x + xstart]; + for (int y = 0; y < bfh; y++) { + for (int x = 0; x < bfw; x++) { + // bufexporig->L[y][x] = original->L[y + ystart][x + xstart]; + bufexporig->a[y][x] = original->a[y + ystart][x + xstart]; + bufexporig->b[y][x] = original->b[y + ystart][x + xstart]; + } } - } VibranceParams vibranceParams; vibranceParams.enabled = params->locallab.spots.at(sp).expvibrance; @@ -15488,14 +16295,14 @@ void ImProcFunctions::Lab_Local( vibranceParams.skintonescurve = params->locallab.spots.at(sp).skintonescurve; - // bufexpfin->CopyFrom(bufexporig.get(), multiThread); - for (int y = 0; y < bfh; y++) { - for (int x = 0; x < bfw; x++) { - bufexpfin->L[y][x] = bufexporig->L[y][x]; - bufexpfin->a[y][x] = bufexporig->a[y][x]; - bufexpfin->b[y][x] = bufexporig->b[y][x]; - } - } + // bufexpfin->CopyFrom(bufexporig.get(), multiThread); + for (int y = 0; y < bfh; y++) { + for (int x = 0; x < bfw; x++) { + bufexpfin->L[y][x] = bufexporig->L[y][x]; + bufexpfin->a[y][x] = bufexporig->a[y][x]; + bufexpfin->b[y][x] = bufexporig->b[y][x]; + } + } if (lp.strvibh != 0.f) { printf("a\n"); @@ -15504,6 +16311,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float factor = ImProcFunctions::calcGradientFactor(gph, jr, ir); @@ -15536,13 +16344,13 @@ void ImProcFunctions::Lab_Local( } if (lp.strvib != 0.f) { - printf("b\n"); - + struct grad_params gp; calclocalGradientParams(lp, gp, ystart, xstart, bfw, bfh, 7); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufexpfin->L[ir][jr] *= ImProcFunctions::calcGradientFactor(gp, jr, ir); @@ -15552,12 +16360,13 @@ void ImProcFunctions::Lab_Local( if (lp.strvibab != 0.f) { printf("c\n"); - + struct grad_params gpab; calclocalGradientParams(lp, gpab, ystart, xstart, bfw, bfh, 8); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { const float factor = ImProcFunctions::calcGradientFactor(gpab, jr, ir); @@ -15565,23 +16374,29 @@ void ImProcFunctions::Lab_Local( bufexpfin->b[ir][jr] *= factor; } } + float gamma1 = params->locallab.spots.at(sp).vibgam; rtengine::GammaValues g_a; //gamma parameters double pwr1 = 1.0 / (double) gamma1;//default 3.0 - gamma Lab double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope - if(gamma1 != 1.f) { + + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; ++y) { - int x = 0; + int x = 0; #ifdef __SSE2__ + for (; x < bfw - 3; x += 4) { STVFU(bufexpfin->L[y][x], F2V(32768.f) * igammalog(LVFU(bufexpfin->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[2]), F2V(g_a[4]))); } + #endif - for (;x < bfw; ++x) { + + for (; x < bfw; ++x) { bufexpfin->L[y][x] = 32768.f * igammalog(bufexpfin->L[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); } } @@ -15594,19 +16409,23 @@ void ImProcFunctions::Lab_Local( // rtengine::GammaValues g_a; //gamma parameters // double pwr = 1.0 / (double) gamma;//default 3.0 - gamma Lab // double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab - // rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope + // rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope - if(gamma1 != 1.f) { + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) -#endif + # pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + for (int y = 0; y < bfh; ++y) {//apply inverse gamma 3.f and put result in range 32768.f int x = 0; #ifdef __SSE2__ + for (; x < bfw - 3; x += 4) { STVFU(bufexpfin->L[y][x], F2V(32768.f) * gammalog(LVFU(bufexpfin->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); } + #endif + for (; x < bfw; ++x) { bufexpfin->L[y][x] = 32768.f * gammalog(bufexpfin->L[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); } @@ -15616,30 +16435,30 @@ void ImProcFunctions::Lab_Local( if (params->locallab.spots.at(sp).warm != 0) { bool HHcurvejz = false, CHcurvejz = false, LHcurvejz = false; - - ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 2, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + + ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 2, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); } - if(lp.enavibMask && lp.recothrv != 1.f) { + if (lp.enavibMask && lp.recothrv != 1.f) { float recoth = lp.recothrv; - if(lp.recothrv < 1.f) { + if (lp.recothrv < 1.f) { recoth = -1.f * recoth + 2.f; } float hig = lp.higthrv; float low = lp.lowthrv; - // float recoth = lp.recothrv; + // float recoth = lp.recothrv; float decay = lp.decayv; bool invmask = false; maskrecov(bufexpfin.get(), original, bufmaskorigvib.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); } - if(lp.recothrv >= 1.f) { + if (lp.recothrv >= 1.f) { transit_shapedetect2(sp, 0.f, 0.f, call, 2, bufexporig.get(), bufexpfin.get(), originalmaskvib.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } else { transit_shapedetect2(sp, 0.f, 0.f, call, 2, bufexporig.get(), bufexpfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); - + } } @@ -15658,7 +16477,7 @@ void ImProcFunctions::Lab_Local( //shadow highlight bool tonequ = false; - if (lp.mullocsh[0] != 0 || lp.mullocsh[1] != 0 || lp.mullocsh[2] != 0 || lp.mullocsh[3] != 0 || lp.mullocsh[4] != 0) { + if (lp.mullocsh[0] != 0 || lp.mullocsh[1] != 0 || lp.mullocsh[2] != 0 || lp.mullocsh[3] != 0 || lp.mullocsh[4] != 0 || lp.mullocsh[5] != 0) { tonequ = true; } @@ -15696,6 +16515,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { bufexporig->L[y][x] = original->L[y + ystart][x + xstart]; @@ -15774,6 +16594,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufexporig->L[y][x] = original->L[y + ystart][x + xstart]; @@ -15797,6 +16618,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufexpfin->L[ir][jr] *= ImProcFunctions::calcGradientFactor(gp, jr, ir); @@ -15815,10 +16637,12 @@ void ImProcFunctions::Lab_Local( float gamtone = params->locallab.spots.at(sp).gamSH; float slotone = params->locallab.spots.at(sp).sloSH; cmsHTRANSFORM dummy = nullptr; - int ill =0; - workingtrc(tmpImage, tmpImage, bfw, bfh, -5, prof, 2.4, 12.92310, ill, 0, dummy, true, false, false); - // workingtrc(tmpImage, tmpImage, bfw, bfh, 5, prof, gamtone, slotone, 0, 0, dummy, false, true, true); //to keep if we want improve with illuminant and primaries - workingtrc(tmpImage, tmpImage, bfw, bfh, 1, prof, gamtone, slotone, ill, 0, dummy, false, true, true);//be careful no gamut control + int ill = 0; + int locprim = 0; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + workingtrc(0, tmpImage, tmpImage, bfw, bfh, -5, prof, 2.4, 12.92310, 0, ill, 0, 0, rdx, rdy, grx, gry, blx, bly , meanx, meany, meanxe, meanye, dummy, true, false, false, false); + workingtrc(0, tmpImage, tmpImage, bfw, bfh, 1, prof, gamtone, slotone, 0, ill, 0, locprim, rdx, rdy, grx, gry, blx, bly , meanx, meany, meanxe, meanye, dummy, false, true, true, false);//be careful no gamut control } if (tonequ) { @@ -15831,16 +16655,16 @@ void ImProcFunctions::Lab_Local( } } - if(lp.enaSHMask && lp.recothrs != 1.f) { + if (lp.enaSHMask && lp.recothrs != 1.f) { float recoth = lp.recothrs; - if(lp.recothrs < 1.f) { + if (lp.recothrs < 1.f) { recoth = -1.f * recoth + 2.f; } float hig = lp.higthrs; float low = lp.lowthrs; - // float recoth = lp.recothrs; + // float recoth = lp.recothrs; float decay = lp.decays; bool invmask = false; maskrecov(bufexpfin.get(), original, bufmaskorigSH.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); @@ -15851,8 +16675,9 @@ void ImProcFunctions::Lab_Local( int bh = bufexporig->H; #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if(multiThread) + #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif + for (int x = 0; x < bh; x++) { for (int y = 0; y < bw; y++) { bufexpfin->L[x][y] = intp(repart, bufexporig->L[x][y], bufexpfin->L[x][y]); @@ -15861,11 +16686,12 @@ void ImProcFunctions::Lab_Local( } } - if(lp.recothrs >= 1.f) { + if (lp.recothrs >= 1.f) { transit_shapedetect2(sp, 0.f, 0.f, call, 9, bufexporig.get(), bufexpfin.get(), originalmaskSH.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } else { transit_shapedetect2(sp, 0.f, 0.f, call, 9, bufexporig.get(), bufexpfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } + if (lp.recur) { original->CopyFrom(transformed, multiThread); float avge; @@ -15885,6 +16711,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < TH ; y++) { for (int x = 0; x < TW; x++) { bufcolorig->L[y][x] = original->L[y][x]; @@ -15981,6 +16808,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { bufexporig->L[y - ystart][x - xstart] = original->L[y][x]; @@ -16006,6 +16834,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { datain[y * bfwr + x] = bufexpfin->L[y][x]; @@ -16018,6 +16847,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { bufexpfin->L[y][x] = dataout[y * bfwr + x]; @@ -16051,6 +16881,7 @@ void ImProcFunctions::Lab_Local( } } } + if (loclevwavCurve && loclevwavutili) { for (int i = 0; i < 500; i++) { if (loclevwavCurve[i] != 0.f) { @@ -16059,6 +16890,7 @@ void ImProcFunctions::Lab_Local( } } } + if (locconwavCurve && locconwavutili) { for (int i = 0; i < 500; i++) { if (locconwavCurve[i] != 0.5f) { @@ -16067,6 +16899,7 @@ void ImProcFunctions::Lab_Local( } } } + if (loccompwavCurve && loccompwavutili) { for (int i = 0; i < 500; i++) { if (loccompwavCurve[i] != 0.f) { @@ -16075,6 +16908,7 @@ void ImProcFunctions::Lab_Local( } } } + if (loccomprewavCurve && loccomprewavutili) { for (int i = 0; i < 500; i++) { if (loccomprewavCurve[i] != 0.75f) { @@ -16121,6 +16955,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend; y++) { for (int x = xstart; x < xend; x++) { bufgb->L[y - ystart][x - xstart] = original->L[y][x]; @@ -16141,6 +16976,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { bufgb->L[y][x] = original->L[y + ystart][x + xstart]; @@ -16233,6 +17069,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { tmpfftw->L[y][x] = tmp1->L[y][x]; @@ -16246,6 +17083,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { tmp1->L[y][x] = tmpfftw->L[y][x]; @@ -16301,7 +17139,7 @@ void ImProcFunctions::Lab_Local( const float offs = params->locallab.spots.at(sp).offset; const float sigmadc = params->locallab.spots.at(sp).sigmadc; const float deltad = params->locallab.spots.at(sp).deltad; - // const float fatres = params->locallab.spots.at(sp).fatres; + // const float fatres = params->locallab.spots.at(sp).fatres; const float chrol = params->locallab.spots.at(sp).chromalev; const float chrobl = params->locallab.spots.at(sp).chromablu; const bool blurena = params->locallab.spots.at(sp).wavblur; @@ -16317,18 +17155,22 @@ void ImProcFunctions::Lab_Local( double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope - if(gamma != 1.f) { + if (gamma != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < tmp1->H; ++y) { - int x = 0; + int x = 0; #ifdef __SSE2__ + for (; x < tmp1->W - 3; x += 4) { - STVFU(tmp1->L[y][x], F2V(32768.f) * igammalog(LVFU(tmp1->L[y][x]) / F2V(32768.f), F2V(gamma), F2V(ts), F2V(g_a[2]), F2V(g_a[4]))); + STVFU(tmp1->L[y][x], F2V(32768.f) * igammalog(LVFU(tmp1->L[y][x]) / F2V(32768.f), F2V(gamma), F2V(ts), F2V(g_a[2]), F2V(g_a[4]))); } + #endif - for (;x < tmp1->W; ++x) { + + for (; x < tmp1->W; ++x) { tmp1->L[y][x] = 32768.f * igammalog(tmp1->L[y][x] / 32768.f, gamma, ts, g_a[2], g_a[4]); } } @@ -16338,11 +17180,12 @@ void ImProcFunctions::Lab_Local( if (params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecie == "wav") { bool HHcurvejz = false, CHcurvejz = false, LHcurvejz = false; + if (params->locallab.spots.at(sp).modecam == "jz") {//some cam16 elementsfor Jz - ImProcFunctions::ciecamloc_02float(lp, sp, tmp1.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + ImProcFunctions::ciecamloc_02float(lp, sp, tmp1.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); } - ImProcFunctions::ciecamloc_02float(lp, sp, tmp1.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + ImProcFunctions::ciecamloc_02float(lp, sp, tmp1.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); float rad = params->locallab.spots.at(sp).detailcie; loccont(bfw, bfh, tmp1.get(), rad, 5.f, sk); @@ -16350,17 +17193,21 @@ void ImProcFunctions::Lab_Local( - if(gamma != 1.f) { + if (gamma != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < tmp1->H; ++y) {//apply inverse gamma 3.f and put result in range 32768.f int x = 0; #ifdef __SSE2__ + for (; x < tmp1->W - 3; x += 4) { STVFU(tmp1->L[y][x], F2V(32768.f) * gammalog(LVFU(tmp1->L[y][x]) / F2V(32768.f), F2V(gamma), F2V(ts), F2V(g_a[3]), F2V(g_a[4]))); } + #endif + for (; x < tmp1->W; ++x) { tmp1->L[y][x] = 32768.f * gammalog(tmp1->L[y][x] / 32768.f, gamma, ts, g_a[3], g_a[4]); } @@ -16388,6 +17235,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < H_La; y++) { for (int x = 0; x < W_La; x++) { bufa[y][x] = wav_ab0a [y * W_La + x]; @@ -16404,6 +17252,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < H_La; y++) { for (int x = 0; x < W_La; x++) { wav_ab0a[y * W_La + x] = bufa[y][x]; @@ -16416,6 +17265,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < W_La * H_La; i++) { wav_ab0a[i] *= (1.f + xsinf(rtengine::RT_PI_F * (satur / 200.f)));//more progressive than linear wav_ab0a[i] = clipC(wav_ab0a[i]); @@ -16440,6 +17290,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < H_Lb; y++) { for (int x = 0; x < W_Lb; x++) { bufb[y][x] = wav_ab0b [y * W_Lb + x]; @@ -16457,6 +17308,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < H_Lb; y++) { for (int x = 0; x < W_Lb; x++) { wav_ab0b[y * W_Lb + x] = bufb[y][x]; @@ -16470,6 +17322,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < W_Lb * H_Lb; i++) { wav_ab0b[i] *= (1.f + xsinf(rtengine::RT_PI_F * (satur / 200.f))); wav_ab0b[i] = clipC(wav_ab0b[i]); @@ -16486,6 +17339,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { tmpresid->L[y][x] = tmp1->L[y][x]; @@ -16493,6 +17347,7 @@ void ImProcFunctions::Lab_Local( tmpresid->b[y][x] = tmp1->b[y][x]; } } + clarimerge(lp, mL, mC, exec, tmpresid.get(), wavelet_level, sk, numThreads); } @@ -16520,6 +17375,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int x = 0; x < bfh; x++) for (int y = 0; y < bfw; y++) { tmp1->L[x][y] = clipLoc((1.f + mL0) * mergfile->L[x][y] - mL * tmpresid->L[x][y]); @@ -16533,20 +17389,21 @@ void ImProcFunctions::Lab_Local( } } - if(lp.enalcMask && lp.recothrw != 1.f) { - float recoth = lp.recothrw; + if (lp.enalcMask && lp.recothrw != 1.f) { + float recoth = lp.recothrw; - if(lp.recothrw < 1.f) { - recoth = -1.f * recoth + 2.f; - } - - float hig = lp.higthrw; - float low = lp.lowthrw; - //float recoth = lp.recothrw; - float decay = lp.decayw; - bool invmask = false; - maskrecov(tmp1.get(), original, bufmaskoriglc.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); + if (lp.recothrw < 1.f) { + recoth = -1.f * recoth + 2.f; } + + float hig = lp.higthrw; + float low = lp.lowthrw; + //float recoth = lp.recothrw; + float decay = lp.decayw; + bool invmask = false; + maskrecov(tmp1.get(), original, bufmaskoriglc.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); + } + const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).reparw; int bw = bufgb->W; int bh = bufgb->H; @@ -16554,18 +17411,21 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif - for (int x = 0; x < bh; x++) { - for (int y = 0; y < bw; y++) { - tmp1->L[x][y] = intp(repart, bufgb->L[x][y], tmp1->L[x][y]); - tmp1->a[x][y] = intp(repart, bufgb->a[x][y], tmp1->a[x][y]); - tmp1->b[x][y] = intp(repart, bufgb->b[x][y], tmp1->b[x][y]); - } + + for (int x = 0; x < bh; x++) { + for (int y = 0; y < bw; y++) { + tmp1->L[x][y] = intp(repart, bufgb->L[x][y], tmp1->L[x][y]); + tmp1->a[x][y] = intp(repart, bufgb->a[x][y], tmp1->a[x][y]); + tmp1->b[x][y] = intp(repart, bufgb->b[x][y], tmp1->b[x][y]); } - if(lp.recothrw >= 1.f) { + } + + if (lp.recothrw >= 1.f) { transit_shapedetect2(sp, 0.f, 0.f, call, 10, bufgb.get(), tmp1.get(), originalmasklc.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } else { transit_shapedetect2(sp, 0.f, 0.f, call, 10, bufgb.get(), tmp1.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } + tmp1.reset(); } @@ -16593,26 +17453,28 @@ void ImProcFunctions::Lab_Local( int yEn = lp.yc + lp.ly; int xEn = lp.xc + lp.lx; - if(lp.fullim == 2) {//limit sharpening to image dimension...no more...to avoid a long treatment - begy = 0; - begx = 0; - yEn = original->H; - xEn = original->W; - lp.lxL = lp.xc; - lp.lyT = lp.yc; - lp.ly = yEn - lp.yc; - lp.lx = xEn - lp.xc; - bfh= yEn; - bfw = xEn; - } + if (lp.fullim == 2) { //limit sharpening to image dimension...no more...to avoid a long treatment + begy = 0; + begx = 0; + yEn = original->H; + xEn = original->W; + lp.lxL = lp.xc; + lp.lyT = lp.yc; + lp.ly = yEn - lp.yc; + lp.lx = xEn - lp.xc; + bfh = yEn; + bfw = xEn; + } + //printf("begy=%i begx=%i yen=%i xen=%i\n", begy, begx, yEn, xEn); - JaggedArray bufsh(bfw, bfh, true); - JaggedArray hbuffer(bfw, bfh); - JaggedArray loctemp2(bfw, bfh); + JaggedArray bufsh(bfw, bfh, true); + JaggedArray hbuffer(bfw, bfh); + JaggedArray loctemp2(bfw, bfh); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < transformed->H ; y++) { for (int x = 0; x < transformed->W; x++) { int lox = cx + x; @@ -16623,113 +17485,136 @@ void ImProcFunctions::Lab_Local( } } } - float gamma1 = params->locallab.spots.at(sp).shargam; - rtengine::GammaValues g_a; //gamma parameters - double pwr1 = 1.0 / (double) gamma1;//default 3.0 - gamma Lab - double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab - rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope - if(gamma1 != 1.f) { + + float gamma1 = params->locallab.spots.at(sp).shargam; + rtengine::GammaValues g_a; //gamma parameters + double pwr1 = 1.0 / (double) gamma1;//default 3.0 - gamma Lab + double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab + rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope + + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif - for (int y = 0; y < bfh; ++y) { - int x = 0; + + for (int y = 0; y < bfh; ++y) { + int x = 0; #ifdef __SSE2__ - for (; x < bfw - 3; x += 4) { - STVFU(bufsh[y][x], F2V(32768.f) * igammalog(LVFU(bufsh[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[2]), F2V(g_a[4]))); - } -#endif - for (;x < bfw; ++x) { - bufsh[y][x] = 32768.f * igammalog(bufsh[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); - } - } + + for (; x < bfw - 3; x += 4) { + STVFU(bufsh[y][x], F2V(32768.f) * igammalog(LVFU(bufsh[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[2]), F2V(g_a[4]))); } - - //sharpen only square area instead of all image, but limited to image dimensions (full image) - ImProcFunctions::deconvsharpeningloc(bufsh, hbuffer, bfw, bfh, loctemp2, params->locallab.spots.at(sp).shardamping, (double)params->locallab.spots.at(sp).sharradius, params->locallab.spots.at(sp).shariter, params->locallab.spots.at(sp).sharamount, params->locallab.spots.at(sp).sharcontrast, (double)params->locallab.spots.at(sp).sharblur, 1); - /* - float gamma = params->locallab.spots.at(sp).shargam; - double pwr = 1.0 / (double) gamma;//default 3.0 - gamma Lab - double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab - rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope - */ - if(gamma1 != 1.f) { -#ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) -#endif - for (int y = 0; y < bfh; ++y) {//apply inverse gamma 3.f and put result in range 32768.f - int x = 0; -#ifdef __SSE2__ - for (; x < bfw - 3; x += 4) { - STVFU(bufsh[y][x], F2V(32768.f) * gammalog(LVFU(bufsh[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); - STVFU(loctemp2[y][x], F2V(32768.f) * gammalog(LVFU(loctemp2[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); - } #endif - for (; x < bfw; ++x) { - bufsh[y][x] = 32768.f * gammalog(bufsh[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); - loctemp2[y][x] = 32768.f * gammalog(loctemp2[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); - } - } + + for (; x < bfw; ++x) { + bufsh[y][x] = 32768.f * igammalog(bufsh[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); } - //sharpen simpleprocess - Sharp_Local(call, loctemp2, 0, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); + } + } + + + //sharpen only square area instead of all image, but limited to image dimensions (full image) + ImProcFunctions::deconvsharpeningloc(bufsh, hbuffer, bfw, bfh, loctemp2, params->locallab.spots.at(sp).shardamping, (double)params->locallab.spots.at(sp).sharradius, params->locallab.spots.at(sp).shariter, params->locallab.spots.at(sp).sharamount, params->locallab.spots.at(sp).sharcontrast, (double)params->locallab.spots.at(sp).sharblur, 1); + + /* + float gamma = params->locallab.spots.at(sp).shargam; + double pwr = 1.0 / (double) gamma;//default 3.0 - gamma Lab + double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab + rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope + */ + if (gamma1 != 1.f) { +#ifdef _OPENMP + # pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + + for (int y = 0; y < bfh; ++y) {//apply inverse gamma 3.f and put result in range 32768.f + int x = 0; +#ifdef __SSE2__ + + for (; x < bfw - 3; x += 4) { + STVFU(bufsh[y][x], F2V(32768.f) * gammalog(LVFU(bufsh[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); + STVFU(loctemp2[y][x], F2V(32768.f) * gammalog(LVFU(loctemp2[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); + } + +#endif + + for (; x < bfw; ++x) { + bufsh[y][x] = 32768.f * gammalog(bufsh[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); + loctemp2[y][x] = 32768.f * gammalog(loctemp2[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); + } + } + } + + //sharpen simpleprocess + Sharp_Local(call, loctemp2, 0, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); } else { //call from dcrop.cc - JaggedArray loctemp(bfw, bfh); - - float gamma1 = params->locallab.spots.at(sp).shargam; - rtengine::GammaValues g_a; //gamma parameters - double pwr1 = 1.0 / (double) gamma1;//default 3.0 - gamma Lab - double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab - rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope - if(gamma1 != 1.f) { + JaggedArray loctemp(bfw, bfh); + + float gamma1 = params->locallab.spots.at(sp).shargam; + rtengine::GammaValues g_a; //gamma parameters + double pwr1 = 1.0 / (double) gamma1;//default 3.0 - gamma Lab + double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab + rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope + + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif - for (int y = 0; y < bfh; ++y) { - int x = 0; + + for (int y = 0; y < bfh; ++y) { + int x = 0; #ifdef __SSE2__ - for (; x < bfw - 3; x += 4) { - STVFU(original->L[y][x], F2V(32768.f) * igammalog(LVFU(original->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[2]), F2V(g_a[4]))); - } -#endif - for (;x < bfw; ++x) { - original->L[y][x] = 32768.f * igammalog(original->L[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); - } - } + + for (; x < bfw - 3; x += 4) { + STVFU(original->L[y][x], F2V(32768.f) * igammalog(LVFU(original->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[2]), F2V(g_a[4]))); } - - - ImProcFunctions::deconvsharpeningloc(original->L, shbuffer, bfw, bfh, loctemp, params->locallab.spots.at(sp).shardamping, (double)params->locallab.spots.at(sp).sharradius, params->locallab.spots.at(sp).shariter, params->locallab.spots.at(sp).sharamount, params->locallab.spots.at(sp).sharcontrast, (double)params->locallab.spots.at(sp).sharblur, sk); - /* - float gamma = params->locallab.spots.at(sp).shargam; - double pwr = 1.0 / (double) gamma;//default 3.0 - gamma Lab - double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab - rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope - */ - if(gamma1 != 1.f) { + +#endif + + for (; x < bfw; ++x) { + original->L[y][x] = 32768.f * igammalog(original->L[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); + } + } + } + + + ImProcFunctions::deconvsharpeningloc(original->L, shbuffer, bfw, bfh, loctemp, params->locallab.spots.at(sp).shardamping, (double)params->locallab.spots.at(sp).sharradius, params->locallab.spots.at(sp).shariter, params->locallab.spots.at(sp).sharamount, params->locallab.spots.at(sp).sharcontrast, (double)params->locallab.spots.at(sp).sharblur, sk); + + /* + float gamma = params->locallab.spots.at(sp).shargam; + double pwr = 1.0 / (double) gamma;//default 3.0 - gamma Lab + double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab + rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope + */ + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) -#endif - for (int y = 0; y < bfh; ++y) {//apply inverse gamma 3.f and put result in range 32768.f - int x = 0; -#ifdef __SSE2__ - for (; x < bfw - 3; x += 4) { - STVFU(original->L[y][x], F2V(32768.f) * gammalog(LVFU(original->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); - STVFU(loctemp[y][x], F2V(32768.f) * gammalog(LVFU(loctemp[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); - } + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif - for (; x < bfw; ++x) { - original->L[y][x] = 32768.f * gammalog(original->L[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); - loctemp[y][x] = 32768.f * gammalog(loctemp[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); - } - } + + for (int y = 0; y < bfh; ++y) {//apply inverse gamma 3.f and put result in range 32768.f + int x = 0; +#ifdef __SSE2__ + + for (; x < bfw - 3; x += 4) { + STVFU(original->L[y][x], F2V(32768.f) * gammalog(LVFU(original->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); + STVFU(loctemp[y][x], F2V(32768.f) * gammalog(LVFU(loctemp[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); } - //sharpen dcrop - Sharp_Local(call, loctemp, 0, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); + +#endif + + for (; x < bfw; ++x) { + original->L[y][x] = 32768.f * gammalog(original->L[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); + loctemp[y][x] = 32768.f * gammalog(loctemp[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); + } + } + } + + //sharpen dcrop + Sharp_Local(call, loctemp, 0, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); } - + if (lp.recur) { original->CopyFrom(transformed, multiThread); float avge; @@ -16746,18 +17631,23 @@ void ImProcFunctions::Lab_Local( double pwr1 = 1.0 / (double) gamma1;//default 3.0 - gamma Lab double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope - if(gamma1 != 1.f) { + + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < GH; ++y) { int x = 0; #ifdef __SSE2__ + for (; x < GW - 3; x += 4) { STVFU(original->L[y][x], F2V(32768.f) * igammalog(LVFU(original->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[2]), F2V(g_a[4]))); } + #endif - for (;x < GW; ++x) { + + for (; x < GW; ++x) { original->L[y][x] = 32768.f * igammalog(original->L[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); } } @@ -16765,24 +17655,29 @@ void ImProcFunctions::Lab_Local( ImProcFunctions::deconvsharpeningloc(original->L, shbuffer, GW, GH, loctemp, params->locallab.spots.at(sp).shardamping, (double)params->locallab.spots.at(sp).sharradius, params->locallab.spots.at(sp).shariter, params->locallab.spots.at(sp).sharamount, params->locallab.spots.at(sp).sharcontrast, (double)params->locallab.spots.at(sp).sharblur, sk); + /* float gamma = params->locallab.spots.at(sp).shargam; double pwr = 1.0 / (double) gamma;//default 3.0 - gamma Lab double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope */ - if(gamma1 != 1.f) { + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) -#endif + # pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + for (int y = 0; y < GH; ++y) {//apply inverse gamma 3.f and put result in range 32768.f int x = 0; #ifdef __SSE2__ + for (; x < GW - 3; x += 4) { STVFU(original->L[y][x], F2V(32768.f) * gammalog(LVFU(original->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); STVFU(loctemp[y][x], F2V(32768.f) * igammalog(LVFU(loctemp[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); } + #endif + for (; x < GW; ++x) { original->L[y][x] = 32768.f * gammalog(original->L[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); loctemp[y][x] = 32768.f * igammalog(loctemp[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); @@ -16844,6 +17739,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufexporig->L[y][x] = original->L[y + ystart][x + xstart]; @@ -16857,24 +17753,28 @@ void ImProcFunctions::Lab_Local( double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope - if(gamma1 != 1.f) { + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif - for (int y = 0; y < bfh; ++y) { + + for (int y = 0; y < bfh; ++y) { int x = 0; #ifdef __SSE2__ - for (; x < bfw - 3; x += 4) { + + for (; x < bfw - 3; x += 4) { STVFU(bufexporig->L[y][x], F2V(32768.f) * igammalog(LVFU(bufexporig->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[2]), F2V(g_a[4]))); - } + } + #endif - for (;x < bfw; ++x) { - bufexporig->L[y][x] = 32768.f * igammalog(bufexporig->L[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); - } + + for (; x < bfw; ++x) { + bufexporig->L[y][x] = 32768.f * igammalog(bufexporig->L[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); } } + } - const int spotSi = rtengine::max(1 + 2 * rtengine::max(1, lp.cir / sk), 5); + const int spotSi = rtengine::max(1 + 2 * rtengine::max(1.f, lp.cir / sk), 5.f); if (bfw > 2 * spotSi && bfh > 2 * spotSi && lp.struexp > 0.f) { blend2(bfw, bfh); @@ -16884,6 +17784,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend ; y++) { for (int x = xstart; x < xend; x++) { const int lox = cx + x; @@ -16894,7 +17795,7 @@ void ImProcFunctions::Lab_Local( if (lp.shapmet == 0) { calcTransition(lox, loy, achm, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, achm, lp, zone, localFactor); } @@ -16973,6 +17874,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { bufexpfin->L[y][x] = original->L[y + ystart][x + xstart]; @@ -16988,11 +17890,12 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { bufexpfin->L[ir][jr] = 0.6f * bufexporig->L[ir][jr] + 0.2f * exlocalcurve[2.f * bufexporig->L[ir][jr]]; } - + if (lp.expcomp == 0.f) { lp.expcomp = 0.001f;// to enabled } @@ -17004,12 +17907,13 @@ void ImProcFunctions::Lab_Local( } else { if (lp.expcomp == 0.f && (lp.linear > 0.01f && lp.laplacexp > 0.1f)) { lp.expcomp = 0.001f;// to enabled - } + } - if (lp.expcomp != 0.f ) { // || lp.laplacexp > 0.1f - if(lp.laplacexp <= 0.1f) { + if (lp.expcomp != 0.f) { // || lp.laplacexp > 0.1f + if (lp.laplacexp <= 0.1f) { lp.laplacexp = 0.2f; //force to use Laplacian with very small values } + ImProcFunctions::exlabLocal(lp, 1.f, bfh, bfw, bfhr, bfwr, bufexporig.get(), bufexpfin.get(), hltonecurveloc, shtonecurveloc, tonecurveloc, hueref, lumaref, chromaref); } } @@ -17023,6 +17927,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { bufexpfin->L[ir][jr] *= ImProcFunctions::calcGradientFactor(gp, jr, ir); @@ -17039,11 +17944,13 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { datain[y * bfwr + x] = bufexpfin->L[y][x]; } } + FattalToneMappingParams fatParams; fatParams.enabled = true; fatParams.threshold = params->locallab.spots.at(sp).fatdetail; @@ -17054,7 +17961,8 @@ void ImProcFunctions::Lab_Local( const std::unique_ptr tmpImagefat(new Imagefloat(bfwr, bfhr)); lab2rgb(*bufexpfin, *tmpImagefat, params->icm.workingProfile); int alg = 0; - if(fatParams.anchor == 50.f) { + + if (fatParams.anchor == 50.f) { alg = 1; } bool satu = false; @@ -17063,13 +17971,15 @@ void ImProcFunctions::Lab_Local( } ToneMapFattal02(tmpImagefat.get(), fatParams, 3, 0, nullptr, 0, 0, alg, satu);//last parameter alg = 1 ==>ART algorithm rgb2lab(*tmpImagefat, *bufexpfin, params->icm.workingProfile); + if (params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecie == "dr") { bool HHcurvejz = false, CHcurvejz = false, LHcurvejz = false; + if (params->locallab.spots.at(sp).modecam == "jz") {//some cam16 elementsfor Jz - ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); } - ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); + ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); float rad = params->locallab.spots.at(sp).detailcie; loccont(bfw, bfh, bufexpfin.get(), rad, 15.f, sk); @@ -17088,12 +17998,14 @@ void ImProcFunctions::Lab_Local( if (params->locallab.spots.at(sp).exnoiseMethod == "med" || params->locallab.spots.at(sp).exnoiseMethod == "medhi") { if (lp.blac < -100.f && lp.linear > 0.01f) { float evnoise = lp.blac - lp.linear * 2000.f; + if (params->locallab.spots.at(sp).exnoiseMethod == "med") { evnoise *= 0.4f; } //soft denoise, user must use Local Denoise for best result Median med; + if (evnoise < -18000.f) { med = Median::TYPE_5X5_STRONG; } else if (evnoise < -15000.f) { @@ -17113,6 +18025,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { float L = LIM01(bufexpfin->L[y][x] / 32768.f);//change gamma for Laplacian @@ -17125,6 +18038,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfhr; y++) { for (int x = 0; x < bfwr; x++) { const float Y = dataout[y * bfwr + x] / 32768.f;//inverse Laplacian gamma @@ -17133,6 +18047,7 @@ void ImProcFunctions::Lab_Local( } } } + if (lp.shadex > 0) { if (lp.expcomp == 0.f) { @@ -17146,7 +18061,7 @@ void ImProcFunctions::Lab_Local( lp.expcomp = 0.001f; // to enabled } } - + //shadows with ipshadowshighlight if ((lp.expcomp != 0.f) || (exlocalcurve && localexutili)) { if (lp.shadex > 0) { @@ -17164,6 +18079,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { const float epsi = bufexporig->L[ir][jr] == 0.f ? 0.001f : 0.f; @@ -17174,6 +18090,7 @@ void ImProcFunctions::Lab_Local( } } } + /* float gamma = lp.gamex; rtengine::GammaValues g_a; //gamma parameters @@ -17181,17 +18098,21 @@ void ImProcFunctions::Lab_Local( double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope */ - if(gamma1 != 1.f) { + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) -#endif + # pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + for (int y = 0; y < bfh; ++y) {//apply inverse gamma 3.f and put result in range 32768.f int x = 0; #ifdef __SSE2__ + for (; x < bfw - 3; x += 4) { STVFU(bufexpfin->L[y][x], F2V(32768.f) * gammalog(LVFU(bufexpfin->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); } + #endif + for (; x < bfw; ++x) { bufexpfin->L[y][x] = 32768.f * gammalog(bufexpfin->L[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); } @@ -17201,22 +18122,22 @@ void ImProcFunctions::Lab_Local( if (lp.softradiusexp > 0.f && lp.expmet == 0) { softproc(buforig.get(), bufexpfin.get(), lp.softradiusexp, bfh, bfw, 0.1, 0.001, 0.5f, sk, multiThread, 1); } - - if(lp.enaExpMask && lp.recothre != 1.f) { + + if (lp.enaExpMask && lp.recothre != 1.f) { float recoth = lp.recothre; - if(lp.recothre < 1.f) { + if (lp.recothre < 1.f) { recoth = -1.f * recoth + 2.f; } float hig = lp.higthre; float low = lp.lowthre; - // float recoth = lp.recothre; + // float recoth = lp.recothre; float decay = lp.decaye; bool invmask = false; maskrecov(bufexpfin.get(), original, bufmaskblurexp.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); } - + float meansob = 0.f; const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).reparexp; @@ -17224,8 +18145,9 @@ void ImProcFunctions::Lab_Local( int bh = bufexporig->H; #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if(multiThread) + #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif + for (int x = 0; x < bh; x++) { for (int y = 0; y < bw; y++) { bufexpfin->L[x][y] = intp(repart, bufexporig->L[x][y], bufexpfin->L[x][y]); @@ -17234,7 +18156,7 @@ void ImProcFunctions::Lab_Local( } } - if(lp.recothre >= 1.f) { + if (lp.recothre >= 1.f) { transit_shapedetect2(sp, 0.f, 0.f, call, 1, bufexporig.get(), bufexpfin.get(), originalmaskexp.get(), hueref, chromaref, lumaref, sobelref, meansob, blend2, lp, original, transformed, cx, cy, sk); } else { transit_shapedetect2(sp, 0.f, 0.f, call, 1, bufexporig.get(), bufexpfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, meansob, blend2, lp, original, transformed, cx, cy, sk); @@ -17265,6 +18187,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < TH ; y++) { for (int x = 0; x < TW; x++) { bufexporig->L[y][x] = original->L[y][x]; @@ -17400,6 +18323,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufcolorig->L[y][x] = original->L[y + ystart][x + xstart]; @@ -17414,30 +18338,34 @@ void ImProcFunctions::Lab_Local( } } - float gamma1 = lp.gamc; - rtengine::GammaValues g_a; //gamma parameters - double pwr1 = 1.0 / (double) lp.gamc;//default 3.0 - gamma Lab - double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab - rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope + float gamma1 = lp.gamc; + rtengine::GammaValues g_a; //gamma parameters + double pwr1 = 1.0 / (double) lp.gamc;//default 3.0 - gamma Lab + double ts1 = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab + rtengine::Color::calcGamma(pwr1, ts1, g_a); // call to calcGamma with selected gamma and slope - if(gamma1 != 1.f) { + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) + # pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif - for (int y = 0; y < bufcolorig->H; ++y) { + + for (int y = 0; y < bufcolorig->H; ++y) { int x = 0; #ifdef __SSE2__ - for (; x < bufcolorig->W - 3; x += 4) { + + for (; x < bufcolorig->W - 3; x += 4) { STVFU(bufcolorig->L[y][x], F2V(32768.f) * igammalog(LVFU(bufcolorig->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[2]), F2V(g_a[4]))); - } + } + #endif - for (;x < bufcolorig->W; ++x) { - bufcolorig->L[y][x] = 32768.f * igammalog(bufcolorig->L[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); - } + + for (; x < bufcolorig->W; ++x) { + bufcolorig->L[y][x] = 32768.f * igammalog(bufcolorig->L[y][x] / 32768.f, gamma1, ts1, g_a[2], g_a[4]); } } + } - const int spotSi = rtengine::max(1 + 2 * rtengine::max(1, lp.cir / sk), 5); + const int spotSi = rtengine::max(1 + 2 * rtengine::max(1.f, lp.cir / sk), 5.f); const bool blends = bfw > 2 * spotSi && bfh > 2 * spotSi && lp.struco > 0.f; if (blends) { @@ -17448,6 +18376,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = ystart; y < yend ; y++) { for (int x = xstart; x < xend; x++) { const int lox = cx + x; @@ -17458,7 +18387,7 @@ void ImProcFunctions::Lab_Local( if (lp.shapmet == 0) { calcTransition(lox, loy, achm, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, achm, lp, zone, localFactor); } @@ -17469,6 +18398,7 @@ void ImProcFunctions::Lab_Local( } } } + return; } } @@ -17501,6 +18431,7 @@ void ImProcFunctions::Lab_Local( const float merlucol = params->locallab.spots.at(sp).merlucol; int tonemod = 0; + if (params->locallab.spots.at(sp).toneMethod == "one") { tonemod = 0; } else if (params->locallab.spots.at(sp).toneMethod == "two") { @@ -17547,6 +18478,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) for (int x = 0; x < bfw; x++) { @@ -17620,6 +18552,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { const int loy = y + ystart + cy; @@ -17630,7 +18563,7 @@ void ImProcFunctions::Lab_Local( if (lp.shapmet == 0) { calcTransition(lox, loy, achm, lp, zone, localFactor); - } else /*if (lp.shapmet == 1)*/ { + } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, achm, lp, zone, localFactor); } @@ -17654,6 +18587,7 @@ void ImProcFunctions::Lab_Local( } bool HHcurve = false; + if (lochhCurve && HHutili) { for (int i = 0; i < 500; i++) { if (lochhCurve[i] != 0.5f) { @@ -17684,6 +18618,7 @@ void ImProcFunctions::Lab_Local( 1, 1 }); bool LHcurve = false; + if (loclhCurve && LHutili) { for (int i = 0; i < 500; i++) { if (loclhCurve[i] != 0.5f) { @@ -17692,7 +18627,9 @@ void ImProcFunctions::Lab_Local( } } } + bool CHcurve = false; + if (locchCurve && CHutili) { for (int i = 0; i < 500; i++) { if (locchCurve[i] != 0.5f) { @@ -17701,17 +18638,21 @@ void ImProcFunctions::Lab_Local( } } } + double amountchrom = 0.01 * settings->amchroma; - if(amountchrom < 0.05) { + + if (amountchrom < 0.05) { amountchrom = 0.05; } - if(amountchrom > 2.) { + + if (amountchrom > 2.) { amountchrom = 2.; } #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { float bufcolcalca = origptr->a[ir][jr]; @@ -17786,16 +18727,16 @@ void ImProcFunctions::Lab_Local( if (loclhCurve && LHcurve && lp.qualcurvemet != 0) {//L=f(H) curve const float rhue = xatan2f(bufcolcalcb, bufcolcalca); //printf("rhu=%f", (double) rhue); - const float chromat = (std::sqrt(SQR(bufcolcalca) + SQR(bufcolcalcb)))/32768.f; + const float chromat = (std::sqrt(SQR(bufcolcalca) + SQR(bufcolcalcb))) / 32768.f; float l_r = LIM01(bufcolcalcL / 32768.f); //Luminance Lab in 0..1 - float valparam = loclhCurve[500.f *static_cast(Color::huelab_to_huehsv2(rhue))] - 0.5f; //get l_r=f(H) - // printf("rh=%f V=%f", (double) rhue, (double) valparam); - // float kc = 0.05f + 0.02f * params->locallab.spots.at(sp).lightjzcie; + float valparam = loclhCurve[500.f * static_cast(Color::huelab_to_huehsv2(rhue))] - 0.5f; //get l_r=f(H) + // printf("rh=%f V=%f", (double) rhue, (double) valparam); + // float kc = 0.05f + 0.02f * params->locallab.spots.at(sp).lightjzcie; float kc = amountchrom; float valparamneg; valparamneg = valparam; float kcc = SQR(chromat / kc); //take Chroma into account...40 "middle low" of chromaticity (arbitrary and simple), one can imagine other algorithme - // printf("KC=%f", (double) kcc); + // printf("KC=%f", (double) kcc); //reduce action for low chroma and increase action for high chroma valparam *= 2.f * kcc; valparamneg *= kcc; //slightly different for negative @@ -17803,7 +18744,7 @@ void ImProcFunctions::Lab_Local( if (valparam > 0.f) { l_r = (1.f - valparam) * l_r + valparam * (1.f - SQR(((SQR(1.f - min(l_r, 1.0f)))))); } else - //for negative + //for negative { float khue = 1.9f; //in reserve in case of! l_r *= (1.f + khue * valparamneg); @@ -17812,6 +18753,7 @@ void ImProcFunctions::Lab_Local( bufcolcalcL = l_r * 32768.f; } + if (locchCurve && CHcurve && lp.qualcurvemet != 0) {//C=f(H) curve const float rhue = xatan2f(bufcolcalcb, bufcolcalca); const float valparam = locchCurve[500.f * static_cast(Color::huelab_to_huehsv2(rhue))] - 0.5f; //get valp=f(H) @@ -17844,6 +18786,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { bufcolfin->L[ir][jr] = origptr->L[ir][jr]; @@ -17853,6 +18796,7 @@ void ImProcFunctions::Lab_Local( } bool nottransit = false; + if (lp.mergemet >= 2) { //merge result with original nottransit = true; bufcolreserv.reset(new LabImage(bfw, bfh)); @@ -17862,6 +18806,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { lumreserv[y][x] = 32768.f - reserved->L[y + ystart][x + xstart]; @@ -17878,9 +18823,9 @@ void ImProcFunctions::Lab_Local( bufcolreserv->a[y][x] = lastorig->a[y + ystart][x + xstart]; bufcolreserv->b[y][x] = lastorig->b[y + ystart][x + xstart]; } else if (lp.mergemet == 4) { - bufcolreserv->L[y][x] = merlucol * 327.68f; - bufcolreserv->a[y][x] = 9.f * scaledirect * a_scalemerg; - bufcolreserv->b[y][x] = 9.f * scaledirect * b_scalemerg; + bufcolreserv->L[y][x] = merlucol * 327.68f; + bufcolreserv->a[y][x] = 9.f * scaledirect * a_scalemerg; + bufcolreserv->b[y][x] = 9.f * scaledirect * b_scalemerg; } } } @@ -17891,6 +18836,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { const float corrFactor = ImProcFunctions::calcGradientFactor(gp, jr, ir); @@ -17905,6 +18851,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { const float corrFactor = ImProcFunctions::calcGradientFactor(gpab, jr, ir); @@ -17920,6 +18867,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { const float corrFactor = ImProcFunctions::calcGradientFactor(gph, jr, ir); @@ -17929,6 +18877,7 @@ void ImProcFunctions::Lab_Local( const float HH = xatan2f(bb, aa); float cor = 0.f; + if (corrFactor < 1.f) { cor = - 2.5f * (1.f - corrFactor); } else if (corrFactor > 1.f) { @@ -17936,6 +18885,7 @@ void ImProcFunctions::Lab_Local( } float newhr = HH + cor; + if (newhr > rtengine::RT_PI_F) { newhr -= 2 * rtengine::RT_PI_F; } else if (newhr < -rtengine::RT_PI_F) { @@ -17976,6 +18926,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { rdE[y][x] *= SQR(rdE[y][x]); @@ -17994,6 +18945,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufprov->L[y][x] = intp(rdE[y][x], bufcolfin->L[y][x], bufcolreserv->L[y][x]); @@ -18011,6 +18963,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufcolfin->L[y][x] = intp(blend[y][x], bufcolfin->L[y][x], bufreser->L[y][x]); @@ -18028,6 +18981,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { rdE[y][x] *= SQR(rdE[y][x]); @@ -18040,6 +18994,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufprov->L[y][x] = intp(rdE[y][x], bufcolfin->L[y][x], bufcolreserv->L[y][x]); @@ -18052,6 +19007,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { if (lp.mergecolMethod == 17) { @@ -18100,6 +19056,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufcolfin->L[y][x] = intp(blend[y][x], bufcolfin->L[y][x], bufcolreserv->L[y][x]); @@ -18116,6 +19073,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufcolfin->L[y][x] = intp(rdE[y][x], bufcolfin->L[y][x], bufcolreserv->L[y][x]); @@ -18139,10 +19097,12 @@ void ImProcFunctions::Lab_Local( float maxG = minG; float minB = tmpImagereserv->b(0, 0); float maxB = minB; + if (lp.mergecolMethod == 6 || lp.mergecolMethod == 9 || lp.mergecolMethod == 10 || lp.mergecolMethod == 11) { #ifdef _OPENMP #pragma omp parallel for reduction(max:maxR,maxG,maxB) reduction(min:minR,minG,minB) schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) { for (int jr = 0; jr < bfw; jr++) { minR = rtengine::min(minR, tmpImagereserv->r(ir, jr)); @@ -18160,6 +19120,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) {//LIM(x 0 2) 2 arbitrary value but limit... for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, tmpImageorig->r(y, x) - tmpImagereserv->r(y, x), tmpImageorig->r(y, x)); @@ -18171,6 +19132,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, std::fabs(tmpImageorig->r(y, x) - tmpImagereserv->r(y, x)), tmpImageorig->r(y, x)); @@ -18182,6 +19144,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, tmpImageorig->r(y, x) * tmpImagereserv->r(y, x), tmpImageorig->r(y, x)); @@ -18193,6 +19156,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, tmpImageorig->r(y, x) + tmpImagereserv->r(y, x), tmpImageorig->r(y, x)); @@ -18204,6 +19168,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, tmpImageorig->r(y, x) / (tmpImagereserv->r(y, x) + 0.00001f), tmpImageorig->r(y, x)); @@ -18215,6 +19180,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, softlig(tmpImageorig->r(y, x), tmpImagereserv->r(y, x), minR, maxR), tmpImageorig->r(y, x)); @@ -18226,6 +19192,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, softlig2(LIM01(tmpImageorig->r(y, x)), LIM01(tmpImageorig->r(y, x))), tmpImageorig->r(y, x)); @@ -18237,6 +19204,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, softlig3(LIM01(tmpImageorig->r(y, x)), tmpImagereserv->r(y, x)), tmpImageorig->r(y, x)); @@ -18248,6 +19216,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, overlay(tmpImagereserv->r(y, x), tmpImageorig->r(y, x), minR, maxR), tmpImageorig->r(y, x)); @@ -18259,6 +19228,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, overlay(tmpImageorig->r(y, x), tmpImagereserv->r(y, x), minR, maxR), tmpImageorig->r(y, x)); @@ -18270,6 +19240,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, screen(tmpImageorig->r(y, x), tmpImagereserv->r(y, x), 1.f), tmpImageorig->r(y, x)); @@ -18281,6 +19252,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, rtengine::min(tmpImageorig->r(y, x), tmpImagereserv->r(y, x)), tmpImageorig->r(y, x)); @@ -18292,6 +19264,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, rtengine::max(tmpImageorig->r(y, x), tmpImagereserv->r(y, x)), tmpImageorig->r(y, x)); @@ -18303,6 +19276,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, exclusion(tmpImageorig->r(y, x), tmpImagereserv->r(y, x)), tmpImageorig->r(y, x)); @@ -18315,6 +19289,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, colburn(LIM01(tmpImageorig->r(y, x)), LIM01(tmpImagereserv->r(y, x))), tmpImageorig->r(y, x)); @@ -18326,6 +19301,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmpImageorig->r(y, x) = intp(lp.opacol, coldodge(LIM01(tmpImageorig->r(y, x)), LIM01(tmpImagereserv->r(y, x))), tmpImageorig->r(y, x)); @@ -18342,6 +19318,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufcolfin->L[y][x] = intp(blend[y][x], bufcolfin->L[y][x], bufcolreserv->L[y][x]); @@ -18355,22 +19332,24 @@ void ImProcFunctions::Lab_Local( if (lp.softradiuscol > 0.f) { softproc(bufcolreserv.get(), bufcolfin.get(), lp.softradiuscol, bfh, bfw, 0.001, 0.00001, 0.5f, sk, multiThread, 1); } + float meansob = 0.f; const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).reparcol; int bw = bufcolreserv->W; int bh = bufcolreserv->H; #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if(multiThread) + #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif - for (int x = 0; x < bh; x++) { - for (int y = 0; y < bw; y++) { - bufcolfin->L[x][y] = intp(repart, bufcolreserv->L[x][y], bufcolfin->L[x][y]); - bufcolfin->a[x][y] = intp(repart, bufcolreserv->a[x][y], bufcolfin->a[x][y]); - bufcolfin->b[x][y] = intp(repart, bufcolreserv->b[x][y], bufcolfin->b[x][y]); + + for (int x = 0; x < bh; x++) { + for (int y = 0; y < bw; y++) { + bufcolfin->L[x][y] = intp(repart, bufcolreserv->L[x][y], bufcolfin->L[x][y]); + bufcolfin->a[x][y] = intp(repart, bufcolreserv->a[x][y], bufcolfin->a[x][y]); + bufcolfin->b[x][y] = intp(repart, bufcolreserv->b[x][y], bufcolfin->b[x][y]); + } } - } - + transit_shapedetect2(sp, 0.f, 0.f, call, 0, bufcolreserv.get(), bufcolfin.get(), originalmaskcol.get(), hueref, chromaref, lumaref, sobelref, meansob, blend2, lp, original, transformed, cx, cy, sk); } @@ -18382,6 +19361,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { const float corrFactor = ImProcFunctions::calcGradientFactor(gp, jr, ir); @@ -18395,6 +19375,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { const float corrFactor = ImProcFunctions::calcGradientFactor(gpab, jr, ir); @@ -18409,6 +19390,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { const float corrFactor = ImProcFunctions::calcGradientFactor(gph, jr, ir); @@ -18441,24 +19423,28 @@ void ImProcFunctions::Lab_Local( -/* - float gamma = lp.gamc; - rtengine::GammaValues g_a; //gamma parameters - double pwr = 1.0 / (double) lp.gamc;//default 3.0 - gamma Lab - double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab - rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope -*/ - if(gamma1 != 1.f) { + /* + float gamma = lp.gamc; + rtengine::GammaValues g_a; //gamma parameters + double pwr = 1.0 / (double) lp.gamc;//default 3.0 - gamma Lab + double ts = 9.03296;//always the same 'slope' in the extreme shadows - slope Lab + rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope + */ + if (gamma1 != 1.f) { #ifdef _OPENMP -# pragma omp parallel for schedule(dynamic,16) if (multiThread) -#endif + # pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + for (int y = 0; y < bfh; ++y) {//apply inverse gamma 3.f and put result in range 32768.f int x = 0; #ifdef __SSE2__ + for (; x < bfw - 3; x += 4) { - STVFU(bufcolfin->L[y][x], F2V(32768.f) * gammalog(LVFU(bufcolfin->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); + STVFU(bufcolfin->L[y][x], F2V(32768.f) * gammalog(LVFU(bufcolfin->L[y][x]) / F2V(32768.f), F2V(gamma1), F2V(ts1), F2V(g_a[3]), F2V(g_a[4]))); } + #endif + for (; x < bfw; ++x) { bufcolfin->L[y][x] = 32768.f * gammalog(bufcolfin->L[y][x] / 32768.f, gamma1, ts1, g_a[3], g_a[4]); } @@ -18469,39 +19455,43 @@ void ImProcFunctions::Lab_Local( if (lp.softradiuscol > 0.f) { softproc(bufcolorig.get(), bufcolfin.get(), lp.softradiuscol, bfh, bfw, 0.001, 0.00001, 0.5f, sk, multiThread, 1); } - //mask recovery - if(lp.enaColorMask && lp.recothrc != 1.f) { - float recoth = lp.recothrc; + //mask recovery - if(lp.recothrc < 1.f) { - recoth = -1.f * recoth + 2.f; + if (lp.enaColorMask && lp.recothrc != 1.f) { + float recoth = lp.recothrc; + + if (lp.recothrc < 1.f) { + recoth = -1.f * recoth + 2.f; + } + + float hig = lp.higthrc; + float low = lp.lowthrc; + // float recoth = lp.recothrc; + float decay = lp.decayc; + bool invmask = false; + maskrecov(bufcolfin.get(), original, bufmaskblurcol.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); } - float hig = lp.higthrc; - float low = lp.lowthrc; - // float recoth = lp.recothrc; - float decay = lp.decayc; - bool invmask = false; - maskrecov(bufcolfin.get(), original, bufmaskblurcol.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); - } - const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).reparcol; - int bw = bufcolorig->W; - int bh = bufcolorig->H; + const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).reparcol; + int bw = bufcolorig->W; + int bh = bufcolorig->H; #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if(multiThread) + #pragma omp parallel for schedule(dynamic,16) if(multiThread) #endif - for (int x = 0; x < bh; x++) { - for (int y = 0; y < bw; y++) { - bufcolfin->L[x][y] = intp(repart, bufcolorig->L[x][y], bufcolfin->L[x][y]); - bufcolfin->a[x][y] = intp(repart, bufcolorig->a[x][y], bufcolfin->a[x][y]); - bufcolfin->b[x][y] = intp(repart, bufcolorig->b[x][y], bufcolfin->b[x][y]); + + for (int x = 0; x < bh; x++) { + for (int y = 0; y < bw; y++) { + bufcolfin->L[x][y] = intp(repart, bufcolorig->L[x][y], bufcolfin->L[x][y]); + bufcolfin->a[x][y] = intp(repart, bufcolorig->a[x][y], bufcolfin->a[x][y]); + bufcolfin->b[x][y] = intp(repart, bufcolorig->b[x][y], bufcolfin->b[x][y]); + } } - } - + float meansob = 0.f; - if(lp.recothrc >= 1.f) { + + if (lp.recothrc >= 1.f) { transit_shapedetect2(sp, 0.f, 0.f, call, 0, bufcolorig.get(), bufcolfin.get(), originalmaskcol.get(), hueref, chromaref, lumaref, sobelref, meansob, blend2, lp, original, transformed, cx, cy, sk); } else { transit_shapedetect2(sp, 0.f, 0.f, call, 0, bufcolorig.get(), bufcolfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, meansob, blend2, lp, original, transformed, cx, cy, sk); @@ -18553,6 +19543,7 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < TH ; y++) { for (int x = 0; x < TW; x++) { bufcolorig->L[y][x] = original->L[y][x]; @@ -18615,20 +19606,22 @@ void ImProcFunctions::Lab_Local( } } } - + //begin common mask - if(lp.maskena) { + if (lp.maskena) { int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); int yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, original->H); int xstart = rtengine::max(static_cast(lp.xc - lp.lxL) - cx, 0); int xend = rtengine::min(static_cast(lp.xc + lp.lx) - cx, original->W); int bfh = yend - ystart; int bfw = xend - xstart; + if (bfw >= mSP && bfh >= mSP) { if (lp.blurma >= 0.25f && lp.fftma && call == 2) { optfft(N_fftwsize, bfh, bfw, bfh, bfw, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy, lp.fullim); } + array2D blechro(bfw, bfh); array2D ble(bfw, bfh); array2D hue(bfw, bfh); @@ -18640,7 +19633,7 @@ void ImProcFunctions::Lab_Local( std::unique_ptr bufmaskblurcol; std::unique_ptr originalmaskcol; std::unique_ptr bufcolreserv; - + int wo = original->W; int ho = original->H; LabImage *origsav = nullptr; @@ -18656,9 +19649,11 @@ void ImProcFunctions::Lab_Local( bufmaskblurcol.reset(new LabImage(bfw, bfh, true)); originalmaskcol.reset(new LabImage(bfw, bfh)); } + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufcolorig->L[y][x] = original->L[y + ystart][x + xstart]; @@ -18674,6 +19669,7 @@ void ImProcFunctions::Lab_Local( bufcolfin->b[y][x] = original->b[y + ystart][x + xstart]; } } + const int inv = 0; const bool showmaske = lp.showmask_met == 2; const bool enaMask = lp.ena_Mask; @@ -18682,15 +19678,17 @@ void ImProcFunctions::Lab_Local( const bool zero = lp.showmask_met == 0; const bool modif = lp.showmask_met == 1; const float chrom = params->locallab.spots.at(sp).chromask; - const float rad = params->locallab.spots.at(sp).radmask; - const float gamma = params->locallab.spots.at(sp).gammask; + const float rad = params->locallab.spots.at(sp).radmask; + const float gamma = params->locallab.spots.at(sp).gammask; const float slope = params->locallab.spots.at(sp).slopmask; float blendm = 0.1 * params->locallab.spots.at(sp).blendmask; float blendmab = params->locallab.spots.at(sp).blendmaskab; + if (lp.showmask_met == 2) { blendm = 0.f;//normalize behavior mask with others no action of blend blendmab = 0.f; } + const float lap = params->locallab.spots.at(sp).lapmask; const bool pde = params->locallab.spots.at(sp).laplac; const int shado = params->locallab.spots.at(sp).shadmask; @@ -18720,15 +19718,17 @@ void ImProcFunctions::Lab_Local( shortcu, delt, hueref, chromaref, lumaref, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sco, lp.fftma, lp.blurma, lp.contma, 12, fab ); - - + + if (lp.showmask_met == 2) { showmask(lumask, lp, xstart, ystart, cx, cy, bfw, bfh, bufcolorig.get(), transformed, bufmaskblurcol.get(), 0); return; } + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { bufcolfin->L[y][x] = bufcolorig->L[y][x]; @@ -18741,6 +19741,7 @@ void ImProcFunctions::Lab_Local( guid[y][x] = bufcolorigsav->L[y][x] / 32768.f; } } + if (softr != 0.f) {//soft for L a b because we change color... const float tmpblur = softr < 0.f ? -1.f / softr : 1.f + softr; const int r1 = rtengine::max(4 / sk * tmpblur + 0.5f, 1); @@ -18757,8 +19758,9 @@ void ImProcFunctions::Lab_Local( rtengine::guidedFilter(guid, ble, ble, r2, 0.2f * epsil, multiThread); #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif + for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { float2 sincosval = xsincosf(hue[y][x]); @@ -18768,39 +19770,52 @@ void ImProcFunctions::Lab_Local( } } } - + float meansob = 0.f; transit_shapedetect2(sp, 0.f, 0.f, call, 20, bufcolorigsav.get(), bufcolfin.get(), originalmaskcol.get(), hueref, chromaref, lumaref, sobelref, meansob, nullptr, lp, origsav, transformed, cx, cy, sk); delete origsav; origsav = NULL; - + if (lp.recur) { original->CopyFrom(transformed, multiThread); float avge; calc_ref(sp, original, transformed, 0, 0, original->W, original->H, sk, huerefblur, chromarefblur, lumarefblur, hueref, chromaref, lumaref, sobelref, avge, locwavCurveden, locwavdenutili); } - + } } } -//end common mask - - if(params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecie == "com" && lp.activspot) {//ciecam - int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); - int yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, original->H); - int xstart = rtengine::max(static_cast(lp.xc - lp.lxL) - cx, 0); - int xend = rtengine::min(static_cast(lp.xc + lp.lx) - cx, original->W); - int bfh = yend - ystart; - int bfw = xend - xstart; - if (bfh >= mSP && bfw >= mSP) { - const std::unique_ptr bufexporig(new LabImage(bfw, bfh)); //buffer for data in zone limit - const std::unique_ptr bufexpfin(new LabImage(bfw, bfh)); //buffer for data in zone limit - std::unique_ptr bufmaskorigcie; - std::unique_ptr bufmaskblurcie; - std::unique_ptr originalmaskcie; +//end common mask + //Cie + rdx = params->locallab.spots.at(sp).redxl; + rdy = params->locallab.spots.at(sp).redyl; + grx = params->locallab.spots.at(sp).grexl; + gry = params->locallab.spots.at(sp).greyl; + blx = params->locallab.spots.at(sp).bluxl; + bly = params->locallab.spots.at(sp).bluyl; + + if (params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecie == "com" && lp.activspot) { //ciecam + int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); + int yend = rtengine::min(static_cast(lp.yc + lp.ly) - cy, original->H); + int xstart = rtengine::max(static_cast(lp.xc - lp.lxL) - cx, 0); + int xend = rtengine::min(static_cast(lp.xc + lp.lx) - cx, original->W); + int bfh = yend - ystart; + int bfw = xend - xstart; + + if (bfh >= mSP && bfw >= mSP) { + + if (lp.blurciemask >= 0.25f && lp.fftcieMask && call == 2) { + optfft(N_fftwsize, bfh, bfw, bfh, bfw, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy, lp.fullim); + } + + const std::unique_ptr bufexporig(new LabImage(bfw, bfh)); //buffer for data in zone limit + const std::unique_ptr bufexpfin(new LabImage(bfw, bfh)); //buffer for data in zone limit + std::unique_ptr bufmaskorigcie; + std::unique_ptr bufmaskblurcie; + std::unique_ptr originalmaskcie; if (lp.showmaskciemet == 2 || lp.enacieMask || lp.showmaskciemet == 3 || lp.showmaskciemet == 4) { bufmaskorigcie.reset(new LabImage(bfw, bfh)); @@ -18811,172 +19826,430 @@ void ImProcFunctions::Lab_Local( #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + #pragma omp parallel for schedule(dynamic,16) if (multiThread) #endif - for (int y = 0; y < bfh; y++) { - for (int x = 0; x < bfw; x++) { - bufexporig->L[y][x] = original->L[y + ystart][x + xstart]; - bufexporig->a[y][x] = original->a[y + ystart][x + xstart]; - bufexporig->b[y][x] = original->b[y + ystart][x + xstart]; - } - } - - bool HHcurvejz = false, CHcurvejz = false, LHcurvejz = false; - if (params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecam == "jz") {//some cam16 elementsfor Jz - ImProcFunctions::ciecamloc_02float(lp, sp, bufexporig.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); - } - if (lochhCurvejz && HHutilijz) { - for (int i = 0; i < 500; i++) { - if (lochhCurvejz[i] != 0.5f) { - HHcurvejz = true; - break; - } - } - } - - if (locchCurvejz && CHutilijz) { - for (int i = 0; i < 500; i++) { - if (locchCurvejz[i] != 0.5f) { - CHcurvejz = true; - break; - } - } - } - - if (loclhCurvejz && LHutilijz) { - for (int i = 0; i < 500; i++) { - if (loclhCurvejz[i] != 0.5f) { - LHcurvejz = true; - break; - } - } - } - - int inv = 0; - bool showmaske = false; - bool enaMask = false; - bool deltaE = false; - bool modmask = false; - bool zero = false; - bool modif = false; - - if (lp.showmaskciemet == 3) { - showmaske = true; - } - - if (lp.enacieMask) { - enaMask = true; - } - - if (lp.showmaskciemet == 4) { - deltaE = true; - } - - if (lp.showmaskciemet == 2) { - modmask = true; - } - - if (lp.showmaskciemet == 1) { - modif = true; - } - - if (lp.showmaskciemet == 0) { - zero = true; - } - - float chrom = lp.chromacie; - float rad = lp.radmacie; - float gamma = params->locallab.spots.at(sp).gammaskcie; - float slope = params->locallab.spots.at(sp).slomaskcie; - float blendm = lp.blendmacie; - float lap = params->locallab.spots.at(sp).lapmaskcie; - bool pde = params->locallab.spots.at(sp).laplac; - LocwavCurve dummy; - bool delt = params->locallab.spots.at(sp).deltae; - int sco = params->locallab.spots.at(sp).scopemask; - int shortcu = 0;//lp.mergemet; //params->locallab.spots.at(sp).shortc; - int shado = 0; - const int highl = 0; - - const float mindE = 2.f + MINSCOPE * sco * lp.thr; - const float maxdE = 5.f + MAXSCOPE * sco * (1 + 0.1f * lp.thr); - const float mindElim = 2.f + MINSCOPE * limscope * lp.thr; - const float maxdElim = 5.f + MAXSCOPE * limscope * (1 + 0.1f * lp.thr); - int lumask = params->locallab.spots.at(sp).lumask; - float amountcd = 0.f; - float anchorcd = 50.f; - LocHHmaskCurve lochhhmasCurve; - maskcalccol(false, pde, bfw, bfh, xstart, ystart, sk, cx, cy, bufexporig.get(), bufmaskorigcie.get(), originalmaskcie.get(), original, reserved, inv, lp, - 0.f, false, - locccmascieCurve, lcmascieutili, locllmascieCurve, llmascieutili, lochhmascieCurve, lhmascieutili, lochhhmasCurve, false, multiThread, - enaMask, showmaske, deltaE, modmask, zero, modif, chrom, rad, lap, gamma, slope, blendm, blendm, shado, highl, amountcd, anchorcd, lmaskcielocalcurve, localmaskcieutili, dummy, false, 1, 1, 5, 5, - shortcu, delt, hueref, chromaref, lumaref, - maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sco, false, 0.f, 0.f, -1, fab - ); - - if (lp.showmaskciemet == 3) { - showmask(lumask, lp, xstart, ystart, cx, cy, bfw, bfh, bufexporig.get(), transformed, bufmaskorigcie.get(), 0); - - return; - } - - - - if (lp.showmaskciemet == 0 || lp.showmaskciemet == 1 || lp.showmaskciemet == 2 || lp.showmaskciemet == 4 || lp.enacieMask) { - - bufexpfin->CopyFrom(bufexporig.get(), multiThread); - if (params->locallab.spots.at(sp).expcie) { - ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz); - } - } - - if(lp.enacieMask && lp.recothrcie != 1.f) { - float recoth = lp.recothrcie; - - if(lp.recothrcie < 1.f) { - recoth = -1.f * recoth + 2.f; - } - float hig = lp.higthrcie; - float low = lp.lowthrcie; - //float recoth = lp.recothrcie; - float decay = lp.decaycie; - bool invmask = false; - maskrecov(bufexpfin.get(), original, bufmaskorigcie.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); - } - - - float radcie = params->locallab.spots.at(sp).detailcie; - loccont(bfw, bfh, bufexpfin.get(), radcie, 15.f, sk); - - const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).reparcie; - int bw = bufexporig->W; - int bh = bufexporig->H; - -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) if(multiThread) -#endif - for (int x = 0; x < bh; x++) { - for (int y = 0; y < bw; y++) { - bufexpfin->L[x][y] = intp(repart, bufexporig->L[x][y], bufexpfin->L[x][y]); - bufexpfin->a[x][y] = intp(repart, bufexporig->a[x][y], bufexpfin->a[x][y]); - bufexpfin->b[x][y] = intp(repart, bufexporig->b[x][y], bufexpfin->b[x][y]); - } - } - - if(lp.recothrcie >= 1.f) { - transit_shapedetect2(sp, 0.f, 0.f, call, 31, bufexporig.get(), bufexpfin.get(), originalmaskcie.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); - } else { - transit_shapedetect2(sp, 0.f, 0.f, call, 31, bufexporig.get(), bufexpfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); - } - if (lp.recur) { - original->CopyFrom(transformed, multiThread); - float avge; - calc_ref(sp, original, transformed, 0, 0, original->W, original->H, sk, huerefblur, chromarefblur, lumarefblur, hueref, chromaref, lumaref, sobelref, avge, locwavCurveden, locwavdenutili); + for (int y = 0; y < bfh; y++) { + for (int x = 0; x < bfw; x++) { + bufexporig->L[y][x] = original->L[y + ystart][x + xstart]; + bufexporig->a[y][x] = original->a[y + ystart][x + xstart]; + bufexporig->b[y][x] = original->b[y + ystart][x + xstart]; } } + bool HHcurvejz = false, CHcurvejz = false, LHcurvejz = false; + + if (params->locallab.spots.at(sp).expcie && params->locallab.spots.at(sp).modecam == "jz") {//some cam16 elements for Jz + ImProcFunctions::ciecamloc_02float(lp, sp, bufexporig.get(), bfw, bfh, 10, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); + } + + if (lochhCurvejz && HHutilijz) { + for (int i = 0; i < 500; i++) { + if (lochhCurvejz[i] != 0.5f) { + HHcurvejz = true; + break; + } + } + } + + if (locchCurvejz && CHutilijz) { + for (int i = 0; i < 500; i++) { + if (locchCurvejz[i] != 0.5f) { + CHcurvejz = true; + break; + } + } + } + + if (loclhCurvejz && LHutilijz) { + for (int i = 0; i < 500; i++) { + if (loclhCurvejz[i] != 0.5f) { + LHcurvejz = true; + break; + } + } + } + + int inv = 0; + bool showmaske = false; + bool enaMask = false; + bool deltaE = false; + bool modmask = false; + bool zero = false; + bool modif = false; + + if (lp.showmaskciemet == 3) { + showmaske = true; + } + + if (lp.enacieMask) { + enaMask = true; + } + + if (lp.showmaskciemet == 4) { + deltaE = true; + } + + if (lp.showmaskciemet == 2) { + modmask = true; + } + + if (lp.showmaskciemet == 1) { + modif = true; + } + + if (lp.showmaskciemet == 0) { + zero = true; + } + + float chrom = lp.chromacie; + float rad = lp.radmacie; + float gamma = params->locallab.spots.at(sp).gammaskcie; + float slope = params->locallab.spots.at(sp).slomaskcie; + float blendm = lp.blendmacie; + float lap = params->locallab.spots.at(sp).lapmaskcie; + bool pde = params->locallab.spots.at(sp).laplac; + LocwavCurve dummy; + bool delt = params->locallab.spots.at(sp).deltae; + int sco = params->locallab.spots.at(sp).scopemask; + int shortcu = 0;//lp.mergemet; //params->locallab.spots.at(sp).shortc; + const int level_bl = params->locallab.spots.at(sp).csthresholdcie.getBottomLeft(); + const int level_hl = params->locallab.spots.at(sp).csthresholdcie.getTopLeft(); + const int level_br = params->locallab.spots.at(sp).csthresholdcie.getBottomRight(); + const int level_hr = params->locallab.spots.at(sp).csthresholdcie.getTopRight(); + + const float mindE = 2.f + MINSCOPE * sco * lp.thr; + const float maxdE = 5.f + MAXSCOPE * sco * (1 + 0.1f * lp.thr); + const float mindElim = 2.f + MINSCOPE * limscope * lp.thr; + const float maxdElim = 5.f + MAXSCOPE * limscope * (1 + 0.1f * lp.thr); + int lumask = params->locallab.spots.at(sp).lumask; + float amountcd = 0.f; + float anchorcd = 50.f; + LocHHmaskCurve lochhhmasCurve; + bool astool = params->locallab.spots.at(sp).toolcie; + const float strumask = 0.02 * params->locallab.spots.at(sp).strumaskcie; + const int shado = params->locallab.spots.at(sp).shadmaskcie; + const int highl = params->locallab.spots.at(sp).highmaskcie; + + maskcalccol(false, pde, bfw, bfh, xstart, ystart, sk, cx, cy, bufexporig.get(), bufmaskorigcie.get(), originalmaskcie.get(), original, reserved, inv, lp, + strumask, astool, + locccmascieCurve, lcmascieutili, locllmascieCurve, llmascieutili, lochhmascieCurve, lhmascieutili, llochhhmascieCurve, lhhmascieutili, multiThread, + enaMask, showmaske, deltaE, modmask, zero, modif, chrom, rad, lap, gamma, slope, blendm, blendm, shado, highl, amountcd, anchorcd, lmaskcielocalcurve, localmaskcieutili, loclmasCurveciewav, lmasutiliciewav, + level_bl, level_hl, level_br, level_hr, + shortcu, delt, hueref, chromaref, lumaref, + maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sco, lp.fftcieMask, lp.blurciemask, lp.contciemask, -1, fab + ); + + if (lp.showmaskciemet == 3) { + showmask(lumask, lp, xstart, ystart, cx, cy, bfw, bfh, bufexporig.get(), transformed, bufmaskorigcie.get(), 0); + + return; + } + + + + if (lp.showmaskciemet == 0 || lp.showmaskciemet == 1 || lp.showmaskciemet == 2 || lp.showmaskciemet == 4 || lp.enacieMask) { +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + for (int y = 0; y < bfh ; y++) { + for (int x = 0; x < bfw; x++) { + bufexpfin->L[y][x] = original->L[y + ystart][x + xstart]; + bufexpfin->a[y][x] = original->a[y + ystart][x + xstart]; + bufexpfin->b[y][x] = original->b[y + ystart][x + xstart]; + } + } + + if (params->locallab.spots.at(sp).expprecam && params->locallab.spots.at(sp).modecam == "cam16") { + Imagefloat *tmpImage = nullptr; + tmpImage = new Imagefloat(bfw, bfh); + Imagefloat *tmpImagelog = nullptr; + tmpImagelog = new Imagefloat(bfw, bfh); + + lab2rgb(*bufexpfin, *tmpImage, params->icm.workingProfile); + Glib::ustring prof = params->icm.workingProfile; + + float gamtone = params->locallab.spots.at(sp).gamjcie; + float slotone = params->locallab.spots.at(sp).slopjcie; + cmsHTRANSFORM dummy = nullptr; + int prim = 3; + int typ = 1; + rdx = params->locallab.spots.at(sp).redxl; + rdy = params->locallab.spots.at(sp).redyl; + grx = params->locallab.spots.at(sp).grexl; + gry = params->locallab.spots.at(sp).greyl; + blx = params->locallab.spots.at(sp).bluxl; + bly = params->locallab.spots.at(sp).bluyl; + /* + if (params->locallab.spots.at(sp).complexcie == 2) { + printf("Mode complexity=%i Prov=%s\n", params->locallab.spots.at(sp).complexcie, prof.c_str()); + printf("prim=%s \n", params->locallab.spots.at(sp).primMethod.c_str()); + } + */ + if (params->locallab.spots.at(sp).primMethod == "beta") { + typ = 5; + ill = 2; + prim = 11; + } else if (params->locallab.spots.at(sp).primMethod == "srgb") { + prim = 1; + ill = 5; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "ado") { + prim = 2; + ill = 5; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "pro") { + prim = 3; + ill = 2; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "rec") { + prim = 4; + ill = 5; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "ac1") { + prim = 5; + ill = 4; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "wid") { + prim = 6; + ill = 2; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "jdcmax") { + prim = 8; + ill = 2; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "jdcmaxstdA") { + prim = 9; + ill = 8; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "ac0") { + prim = 7; + ill = 4; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "best") { + prim = 12; + ill = 2; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "bru") { + prim = 10; + ill = 5; + typ = 5; + } else if (params->locallab.spots.at(sp).primMethod == "free") { + prim = 15; + typ = 5; + + rdx = params->locallab.spots.at(sp).redxl; + rdy = params->locallab.spots.at(sp).redyl; + grx = params->locallab.spots.at(sp).grexl; + gry = params->locallab.spots.at(sp).greyl; + blx = params->locallab.spots.at(sp).bluxl; + bly = params->locallab.spots.at(sp).bluyl; + + } + int catx = 0; + if (params->locallab.spots.at(sp).catMethod == "brad") { + catx = 0; + } else if (params->locallab.spots.at(sp).catMethod == "cat16") { + catx = 1; + } else if (params->locallab.spots.at(sp).catMethod == "cat02") { + catx = 2; + } else if (params->locallab.spots.at(sp).catMethod == "vky") { + catx = 3; + } else if (params->locallab.spots.at(sp).catMethod == "xyz") { + catx = 4; + } + + params->locallab.spots.at(sp).catMethod; + int locprim = 1; + bool gamcie = params->locallab.spots.at(sp).gamutcie; + float rx, ry, gx, gy, bx, by = 0.f; + float mx, my, mxe, mye = 0.f; + + workingtrc(sp, tmpImage, tmpImage, bfw, bfh, -5, prof, 2.4, 12.92310, 0, ill, 0, 0, rx, ry, gx, gy, bx, by, mx, my, mxe, mye, dummy, true, false, false, false); + workingtrc(sp, tmpImage, tmpImage, bfw, bfh, typ, prof, gamtone, slotone, catx, ill, prim, locprim, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, dummy, false, true, true, gamcie);//with gamut control + + if(lp.midtcie != 0) { + ImProcFunctions::tone_eqcam(this, tmpImage, lp.midtcie, params->icm.workingProfile, sk, multiThread); + } + + tmpImage->copyData(tmpImagelog); + + if(params->locallab.spots.at(sp).logcie && !params->locallab.spots.at(sp).logcieq) { + log_encode(tmpImagelog, lp, multiThread, bfw, bfh); + float strlog = 0.01f * (float) params->locallab.spots.at(sp).strcielog; + + +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic, 16) +#endif + + for (int y = 0; y < bfh; ++y) { + for (int x = 0; x < bfw; ++x) { + tmpImage->r(y, x) = intp(strlog, tmpImagelog->r(y, x), tmpImage->r(y, x)); + tmpImage->g(y, x) = intp(strlog, tmpImagelog->g(y, x), tmpImage->g(y, x)); + tmpImage->b(y, x) = intp(strlog, tmpImagelog->b(y, x), tmpImage->b(y, x)); + + } + } + } + + if(lp.smoothciem == 1) { + tone_eqsmooth(this, tmpImage, lp, params->icm.workingProfile, sk, multiThread);//reduce Ev > 0 < 12 + } else if(lp.smoothciem == 2 || lp.smoothciem == 3) {// 2 - only smmoth highlightd - 3 - Tone mapping with slope and mid_grey + + //TonemapFreeman - Copyright (c) 2023 Thatcher Freeman + float mid_gray = 0.01f * lp.sourcegraycie;//Mean luminance Yb Scene + float mid_gray_view = 0.01f * lp.targetgraycie;//Mean luminance Yb Viewing + lp.whiteevjz = LIM(lp.whiteevjz, 0.1f, 31.5f);//limit whiteEv to avoid crash + float white_point = xexpf(lp.whiteevjz * std::log(2.f) + xlogf(mid_gray));//lp.whiteevjz White_Ev + lp.blackevjz = LIM(lp.blackevjz, -15.5f, -0.2f);//limit BlackEv to avoid crash + float black_point = xexpf(lp.blackevjz * std::log(2.f) + xlogf(mid_gray));//lp.blackevjz Black_Ev + bool rolloff = true;//only soften highlights + float slopegray = 1.f;//slopegray between 0.8 and 1.6 - lineary light the shadows by the user - the gamma is calculated according to slope and the characteristics of the image DR, White, Black + int mode = 1; + float slopsmoot = 1.f - ((float) params->locallab.spots.at(sp).slopesmo - 1.f);//modify response so when increase slope the grays are becoming lighter + if(lp.smoothciem == 3) {//slope activ, only with choice gamma - slope - based + rolloff = false;//allows tone-mapping slope + slopegray = slopsmoot; + mode = 3; + } + LUTf lut(65536, LUT_CLIP_OFF);//take from Alberto Griggio + bool scale = lp.issmoothcie;//scale Yb mid_gray - WhiteEv and BlavkEv + tonemapFreeman(slopegray, white_point, black_point, mid_gray, mid_gray_view, rolloff, lut, mode, scale); + + #ifdef _OPENMP + #pragma omp parallel for +#endif + for (int y = 0; y < bfh ; ++ y) {//apply Lut tone-mapping or smooth: thanks to Alberto - gain time. + for (int x = 0; x < bfw ; ++x) { + tmpImage->r(y, x) = 65535.f * lut[tmpImage->r(y, x)]; + tmpImage->g(y, x) = 65535.f * lut[tmpImage->g(y, x)]; + tmpImage->b(y, x) = 65535.f * lut[tmpImage->b(y, x)]; + } + } + + } + + + rgb2lab(*tmpImage, *bufexpfin, params->icm.workingProfile); + + delete tmpImage; + delete tmpImagelog; + } + + if (params->locallab.spots.at(sp).expcie) { + ImProcFunctions::ciecamloc_02float(lp, sp, bufexpfin.get(), bfw, bfh, 0, sk, cielocalcurve, localcieutili, cielocalcurve2, localcieutili2, jzlocalcurve, localjzutili, czlocalcurve, localczutili, czjzlocalcurve, localczjzutili, locchCurvejz, lochhCurvejz, loclhCurvejz, HHcurvejz, CHcurvejz, LHcurvejz, locwavCurvejz, locwavutilijz, maxicam, contsig, lightsig); + } + } + + if (lp.strgradcie != 0.f) { + + struct grad_params gp; + calclocalGradientParams(lp, gp, ystart, xstart, bfw, bfh, 15); +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + + for (int ir = 0; ir < bfh; ir++) { + for (int jr = 0; jr < bfw; jr++) { + bufexpfin->L[ir][jr] *= ImProcFunctions::calcGradientFactor(gp, jr, ir); + } + } + } + + if (lp.enacieMask && lp.recothrcie != 1.f) { + float recoth = lp.recothrcie; + + if (lp.recothrcie < 1.f) { + recoth = -1.f * recoth + 2.f; + } + + float hig = lp.higthrcie; + float low = lp.lowthrcie; + float decay = lp.decaycie; + bool invmask = false; + maskrecov(bufexpfin.get(), original, bufmaskorigcie.get(), bfh, bfw, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); + } + + + float radcie = 0.30f; + bool exec_lc = true; + if(lp.moka == 1 && lp.sursouci == 4) {//disable local contrast if user do not want to use ciecam and Cam16 (I make this choice) + exec_lc = false; + } + if(lp.moka == 1) { //cam16 + radcie = 0.01 * params->locallab.spots.at(sp).detailcie; + } else if(lp.moka == 2) { //Jz + radcie = 0.01 * params->locallab.spots.at(sp).detailciejz; + } + if(radcie > 0.f && exec_lc) { + //local contrast + //ampirical ponderation, to verify + float surrsour_ampl_str = 1.f;//amount + float surrsour_ampl_dark = 1.f;//dark + float surrsour_ampl_radius = 1.f;//radius + if(lp.sursouci == 0) {//Average + surrsour_ampl_str = 0.9f; + surrsour_ampl_dark = 1.f; + surrsour_ampl_radius = 1.f; + } else if(lp.sursouci == 1) {//Dim + surrsour_ampl_str = 1.f; + surrsour_ampl_dark = 1.1f; + surrsour_ampl_radius = 1.05f; + } else if(lp.sursouci == 2) {//Dark + surrsour_ampl_str = 1.2f; + surrsour_ampl_dark = 1.2f; + surrsour_ampl_radius = 1.1f; + } else if(lp.sursouci == 3) {//Ex Dark + surrsour_ampl_str = 1.4f; + surrsour_ampl_radius = 1.2f; + surrsour_ampl_dark = 1.5f; + } else if(lp.sursouci == 4 && lp.moka == 2) {//less than average for Jz + surrsour_ampl_str = 0.9f; + surrsour_ampl_radius = 0.9f; + surrsour_ampl_dark = 1.f; + } + LocalContrastParams localContrastParams; + LocallabParams locallabparams; + localContrastParams.enabled = true; + localContrastParams.radius = rtengine::min((double) surrsour_ampl_radius * 80., 100.); + localContrastParams.amount = rtengine::min(radcie * surrsour_ampl_str, 1.f); + localContrastParams.darkness = rtengine::min((double) surrsour_ampl_dark * 1., 3.); + localContrastParams.lightness = 1.; + bool fftwlc = false; + + ImProcFunctions::localContrast(bufexpfin.get(), bufexpfin->L, localContrastParams, fftwlc, sk); + } + + const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).reparcie; + int bw = bufexporig->W; + int bh = bufexporig->H; + +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) if(multiThread) +#endif + + for (int x = 0; x < bh; x++) { + for (int y = 0; y < bw; y++) { + bufexpfin->L[x][y] = intp(repart, bufexporig->L[x][y], bufexpfin->L[x][y]); + bufexpfin->a[x][y] = intp(repart, bufexporig->a[x][y], bufexpfin->a[x][y]); + bufexpfin->b[x][y] = intp(repart, bufexporig->b[x][y], bufexpfin->b[x][y]); + } + } + + if (lp.recothrcie >= 1.f) { + transit_shapedetect2(sp, 0.f, 0.f, call, 31, bufexporig.get(), bufexpfin.get(), originalmaskcie.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); + } else { + transit_shapedetect2(sp, 0.f, 0.f, call, 31, bufexporig.get(), bufexpfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); + } + + if (lp.recur) { + original->CopyFrom(transformed, multiThread); + float avge; + calc_ref(sp, original, transformed, 0, 0, original->W, original->H, sk, huerefblur, chromarefblur, lumarefblur, hueref, chromaref, lumaref, sobelref, avge, locwavCurveden, locwavdenutili); + } } + } // Gamut and Munsell control - very important do not deactivated to avoid crash diff --git a/rtengine/iptoneequalizer.cc b/rtengine/iptoneequalizer.cc index 7fb6c791f..350260a92 100644 --- a/rtengine/iptoneequalizer.cc +++ b/rtengine/iptoneequalizer.cc @@ -22,7 +22,11 @@ const std::vector> colormap = { {1.f, 0.f, 0.f}, // whites {1.f, 0.f, 0.f}, {1.f, 0.f, 0.f}, + {1.f, 0.f, 0.f}, + {1.f, 0.f, 0.f}, + {1.f, 0.f, 0.f}, {1.f, 0.f, 0.f} + }; @@ -72,16 +76,16 @@ void toneEqualizer( }; // Build the luma channels: band-pass filters with gaussian windows of // std 2 EV, spaced by 2 EV - const float centers[12] = { + const float centers[15] = { -16.0f, -14.0f, -12.0f, -10.0f, -8.0f, -6.0f, - -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f + -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f }; const auto conv = [&](int v, float lo, float hi) -> float { const float f = v < 0 ? lo : hi; return exp2(float(v) / 100.f * f); }; - const float factors[12] = { + const float factors[15] = { conv(params.bands[0], 2.f, 3.f), // -16 EV conv(params.bands[0], 2.f, 3.f), // -14 EV conv(params.bands[0], 2.f, 3.f), // -12 EV @@ -93,7 +97,12 @@ void toneEqualizer( conv(params.bands[4], 3.f, 2.f), // 0 EV conv(params.bands[4], 3.f, 2.f), // 2 EV conv(params.bands[4], 3.f, 2.f), // 4 EV - conv(params.bands[4], 3.f, 2.f) // 6 EV + conv(params.bands[4], 3.f, 2.f), // 6 EV + // this settings under are very rarely used...images with very high DR - I add a slider, but it's not the goal: the goal is white distribution (in very rare case) + // I have not change "main" Tone Equalizer. + conv(params.bands[5], 3.f, 2.f), // 8 EV Added for white distribution (Cam16 and Log encode) and images with very high DR + conv(params.bands[5], 3.f, 2.f), // 10 EV Added for white distribution(Cam16 and Log encode) and images with very high DR + conv(params.bands[5], 3.f, 2.f) // 12 EV Added for white distribution(Cam16 and Log encode) and images with very high DR }; rtengine::TMatrix ws = rtengine::ICCStore::getInstance()->workingSpaceMatrix(workingProfile); @@ -125,7 +134,7 @@ void toneEqualizer( #endif for (int y = 0; y < H; ++y) { for (int x = 0; x < W; ++x) { - float l = rtengine::LIM(log2(rtengine::max(Y[y][x], 1e-9f)), centers[0], centers[11]); + float l = rtengine::LIM(log2(rtengine::max(Y[y][x], 1e-9f)), centers[0], centers[13]); float ll = round(l * base_posterization) / base_posterization; Y2[y][x] = Y[y][x]; Y[y][x] = exp2(ll); @@ -145,12 +154,12 @@ void toneEqualizer( // For every pixel luminance, the sum of the gaussian masks float w_sum = 0.f; - for (int i = 0; i < 12; ++i) { + for (int i = 0; i < 15; ++i) { w_sum += gauss(centers[i], 0.f); } constexpr float luma_lo = -14.f; - constexpr float luma_hi = 4.f; + constexpr float luma_hi = 6.f; const auto process_pixel = [&](float y) -> float { @@ -161,7 +170,7 @@ void toneEqualizer( // luminance channel to current pixel float correction = 0.0f; - for (int c = 0; c < 12; ++c) + for (int c = 0; c < 15; ++c) { correction += gauss(centers[c], luma) * factors[c]; } @@ -198,7 +207,7 @@ void toneEqualizer( // build the correction as the sum of the contribution of each // luminance channel to current pixel - for (int c = 0; c < 12; ++c) { + for (int c = 0; c < 15; ++c) { float w = gauss(centers[c], luma); for (int i = 0; i < 3; ++i) { ret[i] += w * cur_colormap[c][i]; @@ -213,10 +222,10 @@ void toneEqualizer( #ifdef __SSE2__ - vfloat vfactors[12]; - vfloat vcenters[12]; + vfloat vfactors[15]; + vfloat vcenters[15]; - for (int i = 0; i < 12; ++i) { + for (int i = 0; i < 15; ++i) { vfactors[i] = F2V(factors[i]); vcenters[i] = F2V(centers[i]); } @@ -240,7 +249,7 @@ void toneEqualizer( vfloat correction = zerov; - for (int c = 0; c < 12; ++c) + for (int c = 0; c < 15; ++c) { correction += vgauss(vcenters[c], luma) * vfactors[c]; } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 13df614dc..a1408e405 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -1108,7 +1108,7 @@ enum ProcEventCode { Evlocallabsigmoidldacie = 1078, Evlocallabsigmoidthcie = 1079, Evlocallabsigmoidblcie = 1080, - Evlocallabsigmoidqjcie = 1081, + Evlocallabcomprcieauto = 1081, Evlocallabhuecie = 1082, Evlocallabjabcie = 1083, Evlocallablightjzcie = 1084, @@ -1177,6 +1177,7 @@ enum ProcEventCode { Evlocallabsigjz = 1147, Evlocallabsigq = 1148, Evlocallablogcie = 1149, + NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 1b8269a2f..cd80a8980 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1886,7 +1886,7 @@ bool SHParams::operator !=(const SHParams& other) const ToneEqualizerParams::ToneEqualizerParams() : enabled(false), - bands{0, 0, 0, 0, 0}, + bands{0, 0, 0, 0, 0, 0}, regularization(0), show_colormap(false), pivot(0) @@ -2390,17 +2390,24 @@ ColorManagementParams::ColorManagementParams() : workingTRC(WorkingTrc::NONE), will(Illuminant::DEFAULT), wprim(Primaries::DEFAULT), + wcat(Cat::BRAD), workingTRCGamma(2.4),//gamma sRGB workingTRCSlope(12.92), + wmidtcie(0.), + wsmoothcie(false), redx(0.7347), redy(0.2653), grex(0.1596), grey(0.8404), blux(0.0366), bluy(0.0001), + refi(0.), + shiftx(0.), + shifty(0.), preser(0.), fbw(false), - gamut(false), + trcExp(false), + gamut(true), labgridcieALow(0.51763),//Prophoto red = (0.7347+0.1) * 1.81818 - 1 labgridcieBLow(-0.33582), labgridcieAHigh(-0.75163),//Prophoto blue @@ -2409,6 +2416,8 @@ ColorManagementParams::ColorManagementParams() : labgridcieGy(-0.70909),//0.84 labgridcieWx(-0.18964),//D50 0.3457, 0.3585, labgridcieWy(-0.16636),// + labgridcieMx(0.),// + labgridcieMy(0.),// aRendIntent(RI_RELATIVE), outputProfile(options.rtSettings.srgb), outputIntent(RI_RELATIVE), @@ -2429,14 +2438,20 @@ bool ColorManagementParams::operator ==(const ColorManagementParams& other) cons && workingTRC == other.workingTRC && will == other.will && wprim == other.wprim + && wcat == other.wcat && workingTRCGamma == other.workingTRCGamma && workingTRCSlope == other.workingTRCSlope + && wmidtcie == other.wmidtcie + && wsmoothcie == other.wsmoothcie && redx == other.redx && redy == other.redy && grex == other.grex && grey == other.grey && blux == other.blux && bluy == other.bluy + && refi == other.refi + && shiftx == other.shiftx + && shifty == other.shifty && labgridcieALow == other.labgridcieALow && labgridcieBLow == other.labgridcieBLow && labgridcieAHigh == other.labgridcieAHigh @@ -2445,8 +2460,11 @@ bool ColorManagementParams::operator ==(const ColorManagementParams& other) cons && labgridcieGy == other.labgridcieGy && labgridcieWx == other.labgridcieWx && labgridcieWy == other.labgridcieWy + && labgridcieMx == other.labgridcieMx + && labgridcieMy == other.labgridcieMy && preser == other.preser && fbw == other.fbw + && trcExp == other.trcExp && gamut == other.gamut && aRendIntent == other.aRendIntent && outputProfile == other.outputProfile @@ -2976,7 +2994,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : loc{150, 150, 150, 150}, centerX(0), centerY(0), - circrad(18), + circrad(18.), qualityMethod("enh"), complexMethod("mod"), transit(60.), @@ -3360,7 +3378,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : expshadhigh(false), complexshadhigh(0), shMethod("tone"), - multsh{0, 0, 0, 0, 0}, + multsh{0, 0, 0, 0, 0, 0}, highlights(0), h_tonalwidth(70), shadows(0), @@ -4227,8 +4245,13 @@ LocallabParams::LocallabSpot::LocallabSpot() : fullimage(true), repar(100.0), ciecam(false), - blackEv(-5.0), - whiteEv(10.0), + satlog(false), + blackEv(-5.00), + whiteEv(10.00), + whiteslog(0), + blackslog(0), + comprlog(0.4), + strelog(100.), detail(0.6), sensilog(60), sursour("Average"), @@ -4400,6 +4423,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : // ciecam visicie(false), expcie(false), + expprecam(false), complexcie(0), reparcie(100.), sensicie(60), @@ -4408,8 +4432,14 @@ LocallabParams::LocallabSpot::LocallabSpot() : forcebw(true), qtoj(false), jabcie(true), - sigmoidqjcie(false), + comprcieauto(false), + normcie(true), + gamutcie(true), + sigcie(true), logcie(false), + satcie(true), + logcieq(false), + smoothcie(false), logjz(false), sigjz(false), sigq(false), @@ -4419,6 +4449,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : sursourcie("Average"), modecie("com"), modecam("cam16"), + bwevMethod("sig"), saturlcie(0.), rstprotectcie(0.), chromlcie(0.), @@ -4550,8 +4581,10 @@ LocallabParams::LocallabSpot::LocallabSpot() : lightlcie(0.), lightjzcie(0.), lightqcie(0.), + lightsigqcie(0.), contlcie(0.), contjzcie(0.), + detailciejz(30.), adapjzcie(4.0), jz100(0.25), pqremap(120.), @@ -4578,33 +4611,60 @@ LocallabParams::LocallabSpot::LocallabSpot() : }, csthresholdjz(0, 0, 7, 4, false), contthrescie(0.), - blackEvjz(-5.0), - whiteEvjz(10.0), + blackEvjz(-5.00), + whiteEvjz(10.00), targetjz(18.0), sigmoidldacie(0.5), - sigmoidthcie(1.), - sigmoidblcie(1.), + sigmoidthcie(1.2), + sigmoidsenscie(0.9), + sigmoidblcie(0.75), + comprcie(0.4), + strcielog(80.), + comprcieth(6.), + gamjcie(2.4), + slopjcie(12.923), + slopesmo(1.), + midtcie(0), + grexl(0.1596), + greyl(0.8404), + bluxl(0.0366), + bluyl(0.0001), + redxl(0.7347), + redyl(0.2653), + refi(0.), + shiftxl(0.), + shiftyl(0.), + labgridcieALow(0.51763),//Prophoto red = (0.7347+0.1) * 1.81818 - 1 + labgridcieBLow(-0.33582), + labgridcieAHigh(-0.75163),//Prophoto blue + labgridcieBHigh(-0.8180), + labgridcieGx(-0.528),//Prophoto green 0.1596 + labgridcieGy(0.7096),//0.84 + labgridcieWx(-0.18964),//D50 0.3457, 0.3585, + labgridcieWy(-0.16636),// + labgridcieMx(0.), + labgridcieMy(0.),// + whitescie(0), + blackscie(0), + illMethod("d50"), + smoothciemet("none"), + primMethod("pro"), + catMethod("brad"), sigmoidldajzcie(0.5), sigmoidthjzcie(1.), sigmoidbljzcie(1.), contqcie(0.), + contsigqcie(0.), colorflcie(0.), -/* - lightlzcam(0.), - lightqzcam(0.), - contlzcam(0.), - contqzcam(0.), - contthreszcam(0.), - colorflzcam(0.), - saturzcam(0.), - chromzcam(0.), -*/ targabscie(16.), targetGraycie(18.), catadcie(0.), - detailcie(0.), + detailcie(30.), surroundcie("Average"), + strgradcie(0.), + anggradcie(0.), enacieMask(false), + enacieMaskall(false), CCmaskciecurve{ static_cast(FCT_MinMaxCPoints), 0.0, @@ -4650,6 +4710,22 @@ LocallabParams::LocallabSpot::LocallabSpot() : 0.35, 0.35 }, + HHhmaskciecurve{ + static_cast(FCT_MinMaxCPoints), + 0.0, + 0.5, + 0.35, + 0.35, + 0.50, + 0.5, + 0.35, + 0.35, + 1.00, + 0.5, + 0.35, + 0.35 + }, + blendmaskcie(0), radmaskcie(0.0), chromaskcie(0.0), @@ -4666,8 +4742,27 @@ LocallabParams::LocallabSpot::LocallabSpot() : recothrescie(1.), lowthrescie(12.), higthrescie(85.), - decaycie(2.) - + decaycie(2.), + strumaskcie(0.), + toolcie(false), + fftcieMask(true), + contcie(0.), + blurcie(0.2), + highmaskcie(0.), + shadmaskcie(0.), + LLmaskciecurvewav{ + static_cast(FCT_MinMaxCPoints), + 0.0, + 0.5, + 0.35, + 0.35, + 1., + 0.5, + 0.35, + 0.35 + }, + csthresholdcie(0, 0, 6, 5, false) + { } @@ -4843,7 +4938,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && shMethod == other.shMethod && [this, &other]() -> bool { - for (int i = 0; i < 5; ++i) { + for (int i = 0; i < 6; ++i) { if (multsh[i] != other.multsh[i]) { return false; } @@ -5226,8 +5321,13 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && fullimage == other.fullimage && repar == other.repar && ciecam == other.ciecam + && satlog == other.satlog && blackEv == other.blackEv && whiteEv == other.whiteEv + && whiteslog == other.whiteslog + && blackslog == other.blackslog + && comprlog == other.comprlog + && strelog == other.strelog && detail == other.detail && sensilog == other.sensilog && baselog == other.baselog @@ -5280,6 +5380,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const //ciecam && visicie == other.visicie && expcie == other.expcie + && expprecam == other.expprecam && complexcie == other.complexcie && reparcie == other.reparcie && sensicie == other.sensicie @@ -5288,8 +5389,14 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && forcebw == other.forcebw && qtoj == other.qtoj && jabcie == other.jabcie - && sigmoidqjcie == other.sigmoidqjcie + && comprcieauto == other.comprcieauto + && normcie == other.normcie + && gamutcie == other.gamutcie + && sigcie == other.sigcie && logcie == other.logcie + && satcie == other.satcie + && logcieq == other.logcieq + && smoothcie == other.smoothcie && logjz == other.logjz && sigjz == other.sigjz && sigq == other.sigq @@ -5299,6 +5406,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sursourcie == other.sursourcie && modecie == other.modecie && modecam == other.modecam + && bwevMethod == other.bwevMethod && saturlcie == other.saturlcie && rstprotectcie == other.rstprotectcie && chromlcie == other.chromlcie @@ -5322,8 +5430,10 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && lightlcie == other.lightlcie && lightjzcie == other.lightjzcie && lightqcie == other.lightqcie + && lightsigqcie == other.lightsigqcie && contlcie == other.contlcie && contjzcie == other.contjzcie + && detailciejz == other.detailciejz && adapjzcie == other.adapjzcie && jz100 == other.jz100 && pqremap == other.pqremap @@ -5345,30 +5455,59 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && targetjz == other.targetjz && sigmoidldacie == other.sigmoidldacie && sigmoidthcie == other.sigmoidthcie + && sigmoidsenscie == other.sigmoidsenscie && sigmoidblcie == other.sigmoidblcie + && comprcie == other.comprcie + && strcielog == other.strcielog + && comprcieth == other.comprcieth + && gamjcie == other.gamjcie + && slopjcie == other.slopjcie + && slopesmo == other.slopesmo + && midtcie == other.midtcie + && redxl == other.redxl + && redyl == other.redyl + && grexl == other.grexl + && greyl == other.greyl + && bluxl == other.bluxl + && bluyl == other.bluyl + && refi == other.refi + && shiftxl == other.shiftxl + && shiftyl == other.shiftyl + && labgridcieALow == other.labgridcieALow + && labgridcieBLow == other.labgridcieBLow + && labgridcieAHigh == other.labgridcieAHigh + && labgridcieBHigh == other.labgridcieBHigh + && labgridcieGx == other.labgridcieGx + && labgridcieGy == other.labgridcieGy + && labgridcieWx == other.labgridcieWx + && labgridcieWy == other.labgridcieWy + && labgridcieMx == other.labgridcieMx + && labgridcieMy == other.labgridcieMy + && whitescie == other.whitescie + && blackscie == other.blackscie + && illMethod == other.illMethod + && smoothciemet == other.smoothciemet + && primMethod == other.primMethod + && catMethod == other.catMethod && sigmoidldajzcie == other.sigmoidldajzcie && sigmoidthjzcie == other.sigmoidthjzcie && sigmoidbljzcie == other.sigmoidbljzcie && contqcie == other.contqcie + && contsigqcie == other.contsigqcie && colorflcie == other.colorflcie -/* && lightlzcam == other.lightlzcam - && lightqzcam == other.lightqzcam - && contlzcam == other.contlzcam - && contqzcam == other.contqzcam - && contthreszcam == other.contthreszcam - && colorflzcam == other.colorflzcam - && saturzcam == other.saturzcam - && chromzcam == other.chromzcam -*/ && targabscie == other.targabscie && targetGraycie == other.targetGraycie && catadcie == other.catadcie && detailcie == other.detailcie + && strgradcie == other.strgradcie + && anggradcie == other.anggradcie && surroundcie == other.surroundcie && enacieMask == other.enacieMask + && enacieMaskall == other.enacieMaskall && CCmaskciecurve == other.CCmaskciecurve && LLmaskciecurve == other.LLmaskciecurve && HHmaskciecurve == other.HHmaskciecurve + && HHhmaskciecurve == other.HHhmaskcurve && blendmaskcie == other.blendmaskcie && radmaskcie == other.radmaskcie && chromaskcie == other.chromaskcie @@ -5379,8 +5518,16 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && recothrescie == other.recothrescie && lowthrescie == other.lowthrescie && higthrescie == other.higthrescie - && decaycie == other.decaycie; - + && decaycie == other.decaycie + && strumaskcie == other.strumaskcie + && toolcie == other.toolcie + && blurcie == other.blurcie + && contcie == other.contcie + && highmaskcie == other.highmaskcie + && shadmaskcie == other.shadmaskcie + && fftcieMask == other.fftcieMask + && LLmaskciecurvewav == other.LLmaskciecurvewav + && csthresholdcie == other.csthresholdcie; } @@ -6730,7 +6877,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->complexshadhigh, "Locallab", "Complexshadhigh_" + index_str, spot.complexshadhigh, keyFile); saveToKeyfile(!pedited || spot_edited->shMethod, "Locallab", "ShMethod_" + index_str, spot.shMethod, keyFile); - for (int j = 0; j < 5; j++) { + for (int j = 0; j < 6; j++) { saveToKeyfile(!pedited || spot_edited->multsh[j], "Locallab", "Multsh" + std::to_string(j) + "_" + index_str, spot.multsh[j], keyFile); } @@ -7114,8 +7261,13 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->fullimage, "Locallab", "Fullimage_" + index_str, spot.fullimage, keyFile); saveToKeyfile(!pedited || spot_edited->repar, "Locallab", "Repart_" + index_str, spot.repar, keyFile); saveToKeyfile(!pedited || spot_edited->ciecam, "Locallab", "Ciecam_" + index_str, spot.ciecam, keyFile); + saveToKeyfile(!pedited || spot_edited->satlog, "Locallab", "Satlog_" + index_str, spot.satlog, keyFile); saveToKeyfile(!pedited || spot_edited->blackEv, "Locallab", "BlackEv_" + index_str, spot.blackEv, keyFile); saveToKeyfile(!pedited || spot_edited->whiteEv, "Locallab", "WhiteEv_" + index_str, spot.whiteEv, keyFile); + saveToKeyfile(!pedited || spot_edited->whiteslog, "Locallab", "Whiteslog_" + index_str, spot.whiteslog, keyFile); + saveToKeyfile(!pedited || spot_edited->blackslog, "Locallab", "Blackslog_" + index_str, spot.blackslog, keyFile); + saveToKeyfile(!pedited || spot_edited->comprlog, "Locallab", "Comprlog_" + index_str, spot.comprlog, keyFile); + saveToKeyfile(!pedited || spot_edited->strelog, "Locallab", "Strelog_" + index_str, spot.strelog, keyFile); saveToKeyfile(!pedited || spot_edited->detail, "Locallab", "Detail_" + index_str, spot.detail, keyFile); saveToKeyfile(!pedited || spot_edited->sensilog, "Locallab", "Sensilog_" + index_str, spot.sensilog, keyFile); saveToKeyfile(!pedited || spot_edited->baselog, "Locallab", "Baselog_" + index_str, spot.baselog, keyFile); @@ -7170,6 +7322,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo //ciecam if ((!pedited || spot_edited->visicie) && spot.visicie) { saveToKeyfile(!pedited || spot_edited->expcie, "Locallab", "Expcie_" + index_str, spot.expcie, keyFile); + saveToKeyfile(!pedited || spot_edited->expprecam, "Locallab", "Expprecam_" + index_str, spot.expprecam, keyFile); saveToKeyfile(!pedited || spot_edited->complexcie, "Locallab", "Complexcie_" + index_str, spot.complexcie, keyFile); saveToKeyfile(!pedited || spot_edited->reparcie, "Locallab", "Reparcie_" + index_str, spot.reparcie, keyFile); saveToKeyfile(!pedited || spot_edited->sensicie, "Locallab", "Sensicie_" + index_str, spot.sensicie, keyFile); @@ -7178,8 +7331,14 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->forcebw, "Locallab", "Forcebw_" + index_str, spot.forcebw, keyFile); saveToKeyfile(!pedited || spot_edited->qtoj, "Locallab", "Qtoj_" + index_str, spot.qtoj, keyFile); saveToKeyfile(!pedited || spot_edited->jabcie, "Locallab", "jabcie_" + index_str, spot.jabcie, keyFile); - saveToKeyfile(!pedited || spot_edited->sigmoidqjcie, "Locallab", "sigmoidqjcie_" + index_str, spot.sigmoidqjcie, keyFile); + saveToKeyfile(!pedited || spot_edited->comprcieauto, "Locallab", "comprcieauto_" + index_str, spot.comprcieauto, keyFile); + saveToKeyfile(!pedited || spot_edited->normcie, "Locallab", "normcie_" + index_str, spot.normcie, keyFile); + saveToKeyfile(!pedited || spot_edited->gamutcie, "Locallab", "gamutcie_" + index_str, spot.gamutcie, keyFile); + saveToKeyfile(!pedited || spot_edited->sigcie, "Locallab", "sigcie_" + index_str, spot.sigcie, keyFile); saveToKeyfile(!pedited || spot_edited->logcie, "Locallab", "logcie_" + index_str, spot.logcie, keyFile); + saveToKeyfile(!pedited || spot_edited->satcie, "Locallab", "satcie_" + index_str, spot.satcie, keyFile); + saveToKeyfile(!pedited || spot_edited->logcieq, "Locallab", "logcieq_" + index_str, spot.logcieq, keyFile); + saveToKeyfile(!pedited || spot_edited->smoothcie, "Locallab", "smoothcie_" + index_str, spot.smoothcie, keyFile); saveToKeyfile(!pedited || spot_edited->logjz, "Locallab", "Logjz_" + index_str, spot.logjz, keyFile); saveToKeyfile(!pedited || spot_edited->sigjz, "Locallab", "Sigjz_" + index_str, spot.sigjz, keyFile); saveToKeyfile(!pedited || spot_edited->sigq, "Locallab", "Sigq_" + index_str, spot.sigq, keyFile); @@ -7189,6 +7348,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->sursourcie, "Locallab", "Sursourcie_" + index_str, spot.sursourcie, keyFile); saveToKeyfile(!pedited || spot_edited->modecie, "Locallab", "Modecie_" + index_str, spot.modecie, keyFile); saveToKeyfile(!pedited || spot_edited->modecam, "Locallab", "Modecam_" + index_str, spot.modecam, keyFile); + saveToKeyfile(!pedited || spot_edited->bwevMethod, "Locallab", "bwevMethod_" + index_str, spot.bwevMethod, keyFile); saveToKeyfile(!pedited || spot_edited->saturlcie, "Locallab", "Saturlcie_" + index_str, spot.saturlcie, keyFile); saveToKeyfile(!pedited || spot_edited->rstprotectcie, "Locallab", "Rstprotectcie_" + index_str, spot.rstprotectcie, keyFile); saveToKeyfile(!pedited || spot_edited->chromlcie, "Locallab", "Chromlcie_" + index_str, spot.chromlcie, keyFile); @@ -7212,8 +7372,10 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->lightlcie, "Locallab", "Lightlcie_" + index_str, spot.lightlcie, keyFile); saveToKeyfile(!pedited || spot_edited->lightjzcie, "Locallab", "Lightjzcie_" + index_str, spot.lightjzcie, keyFile); saveToKeyfile(!pedited || spot_edited->lightqcie, "Locallab", "Brightqcie_" + index_str, spot.lightqcie, keyFile); + saveToKeyfile(!pedited || spot_edited->lightsigqcie, "Locallab", "Brightsigqcie_" + index_str, spot.lightsigqcie, keyFile); saveToKeyfile(!pedited || spot_edited->contlcie, "Locallab", "Contlcie_" + index_str, spot.contlcie, keyFile); saveToKeyfile(!pedited || spot_edited->contjzcie, "Locallab", "Contjzcie_" + index_str, spot.contjzcie, keyFile); + saveToKeyfile(!pedited || spot_edited->detailciejz, "Locallab", "Detailciejz_" + index_str, spot.detailciejz, keyFile); saveToKeyfile(!pedited || spot_edited->adapjzcie, "Locallab", "Adapjzcie_" + index_str, spot.adapjzcie, keyFile); saveToKeyfile(!pedited || spot_edited->jz100, "Locallab", "Jz100_" + index_str, spot.jz100, keyFile); saveToKeyfile(!pedited || spot_edited->pqremap, "Locallab", "PQremap_" + index_str, spot.pqremap, keyFile); @@ -7235,31 +7397,61 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->targetjz, "Locallab", "Targetjz_" + index_str, spot.targetjz, keyFile); saveToKeyfile(!pedited || spot_edited->sigmoidldacie, "Locallab", "Sigmoidldacie_" + index_str, spot.sigmoidldacie, keyFile); saveToKeyfile(!pedited || spot_edited->sigmoidthcie, "Locallab", "Sigmoidthcie_" + index_str, spot.sigmoidthcie, keyFile); + saveToKeyfile(!pedited || spot_edited->sigmoidsenscie, "Locallab", "Sigmoidsenscie_" + index_str, spot.sigmoidsenscie, keyFile); saveToKeyfile(!pedited || spot_edited->sigmoidblcie, "Locallab", "Sigmoidblcie_" + index_str, spot.sigmoidblcie, keyFile); + saveToKeyfile(!pedited || spot_edited->comprcie, "Locallab", "comprcie_" + index_str, spot.comprcie, keyFile); + saveToKeyfile(!pedited || spot_edited->strcielog, "Locallab", "strcielog_" + index_str, spot.strcielog, keyFile); + saveToKeyfile(!pedited || spot_edited->comprcieth, "Locallab", "comprcieth_" + index_str, spot.comprcieth, keyFile); + saveToKeyfile(!pedited || spot_edited->gamjcie, "Locallab", "gamjcie_" + index_str, spot.gamjcie, keyFile); + saveToKeyfile(!pedited || spot_edited->slopjcie, "Locallab", "slopjcie_" + index_str, spot.slopjcie, keyFile); + saveToKeyfile(!pedited || spot_edited->slopesmo, "Locallab", "slopesmo_" + index_str, spot.slopesmo, keyFile); + saveToKeyfile(!pedited || spot_edited->midtcie, "Locallab", "midtcie_" + index_str, spot.midtcie, keyFile); + saveToKeyfile(!pedited || spot_edited->redxl, "Locallab", "redxl_" + index_str, spot.redxl, keyFile); + saveToKeyfile(!pedited || spot_edited->redyl, "Locallab", "redyl_" + index_str, spot.redyl, keyFile); + saveToKeyfile(!pedited || spot_edited->grexl, "Locallab", "grexl_" + index_str, spot.grexl, keyFile); + saveToKeyfile(!pedited || spot_edited->greyl, "Locallab", "greyl_" + index_str, spot.greyl, keyFile); + saveToKeyfile(!pedited || spot_edited->bluxl, "Locallab", "bluxl_" + index_str, spot.bluxl, keyFile); + saveToKeyfile(!pedited || spot_edited->bluyl, "Locallab", "bluyl_" + index_str, spot.bluyl, keyFile); + saveToKeyfile(!pedited || spot_edited->refi, "Locallab", "refi_" + index_str, spot.refi, keyFile); + saveToKeyfile(!pedited || spot_edited->shiftxl, "Locallab", "shiftxl_" + index_str, spot.shiftxl, keyFile); + saveToKeyfile(!pedited || spot_edited->shiftyl, "Locallab", "shiftyl_" + index_str, spot.shiftyl, keyFile); + + saveToKeyfile(!pedited || spot_edited->labgridcieALow, "Locallab", "labgridcieALow_" + index_str, spot.labgridcieALow, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieBLow, "Locallab", "labgridcieBLow_" + index_str, spot.labgridcieBLow, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieAHigh, "Locallab", "labgridcieAHigh_" + index_str, spot.labgridcieAHigh, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieBHigh, "Locallab", "labgridcieBHigh_" + index_str, spot.labgridcieBHigh, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieGx, "Locallab", "labgridcieGx_" + index_str, spot.labgridcieGx, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieGy, "Locallab", "labgridcieGy_" + index_str, spot.labgridcieGy, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieWx, "Locallab", "labgridcieWx_" + index_str, spot.labgridcieWx, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieWy, "Locallab", "labgridcieWy_" + index_str, spot.labgridcieWy, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieMx, "Locallab", "labgridcieMx_" + index_str, spot.labgridcieMx, keyFile); + saveToKeyfile(!pedited || spot_edited->labgridcieMy, "Locallab", "labgridcieMy_" + index_str, spot.labgridcieMy, keyFile); + + saveToKeyfile(!pedited || spot_edited->whitescie, "Locallab", "whitescie_" + index_str, spot.whitescie, keyFile); + saveToKeyfile(!pedited || spot_edited->blackscie, "Locallab", "blackscie_" + index_str, spot.blackscie, keyFile); + saveToKeyfile(!pedited || spot_edited->illMethod, "Locallab", "illMethod_" + index_str, spot.illMethod, keyFile); + saveToKeyfile(!pedited || spot_edited->smoothciemet, "Locallab", "smoothciemet_" + index_str, spot.smoothciemet, keyFile); + saveToKeyfile(!pedited || spot_edited->primMethod, "Locallab", "primMethod_" + index_str, spot.primMethod, keyFile); + saveToKeyfile(!pedited || spot_edited->catMethod, "Locallab", "catMethod_" + index_str, spot.catMethod, keyFile); saveToKeyfile(!pedited || spot_edited->sigmoidldajzcie, "Locallab", "Sigmoidldajzcie_" + index_str, spot.sigmoidldajzcie, keyFile); saveToKeyfile(!pedited || spot_edited->sigmoidthjzcie, "Locallab", "Sigmoidthjzcie_" + index_str, spot.sigmoidthjzcie, keyFile); saveToKeyfile(!pedited || spot_edited->sigmoidbljzcie, "Locallab", "Sigmoidbljzcie_" + index_str, spot.sigmoidbljzcie, keyFile); saveToKeyfile(!pedited || spot_edited->contqcie, "Locallab", "Contqcie_" + index_str, spot.contqcie, keyFile); + saveToKeyfile(!pedited || spot_edited->contsigqcie, "Locallab", "Contsigqcie_" + index_str, spot.contsigqcie, keyFile); saveToKeyfile(!pedited || spot_edited->colorflcie, "Locallab", "Colorflcie_" + index_str, spot.colorflcie, keyFile); -/* - saveToKeyfile(!pedited || spot_edited->lightlzcam, "Locallab", "Lightlzcam_" + index_str, spot.lightlzcam, keyFile); - saveToKeyfile(!pedited || spot_edited->lightqzcam, "Locallab", "Lightqzcam_" + index_str, spot.lightqzcam, keyFile); - saveToKeyfile(!pedited || spot_edited->contlzcam, "Locallab", "Contlzcam_" + index_str, spot.contlzcam, keyFile); - saveToKeyfile(!pedited || spot_edited->contqzcam, "Locallab", "Contqzcam_" + index_str, spot.contqzcam, keyFile); - saveToKeyfile(!pedited || spot_edited->contthreszcam, "Locallab", "Contthreszcam_" + index_str, spot.contthreszcam, keyFile); - saveToKeyfile(!pedited || spot_edited->colorflzcam, "Locallab", "Colorflzcam_" + index_str, spot.colorflzcam, keyFile); - saveToKeyfile(!pedited || spot_edited->saturzcam, "Locallab", "Saturzcam_" + index_str, spot.saturzcam, keyFile); - saveToKeyfile(!pedited || spot_edited->chromzcam, "Locallab", "Chromzcam_" + index_str, spot.chromzcam, keyFile); -*/ saveToKeyfile(!pedited || spot_edited->targabscie, "Locallab", "Targabscie_" + index_str, spot.targabscie, keyFile); saveToKeyfile(!pedited || spot_edited->targetGraycie, "Locallab", "TargetGraycie_" + index_str, spot.targetGraycie, keyFile); saveToKeyfile(!pedited || spot_edited->catadcie, "Locallab", "Catadcie_" + index_str, spot.catadcie, keyFile); saveToKeyfile(!pedited || spot_edited->detailcie, "Locallab", "Detailcie_" + index_str, spot.detailcie, keyFile); + saveToKeyfile(!pedited || spot_edited->strgradcie, "Locallab", "Strgradcie_" + index_str, spot.strgradcie, keyFile); + saveToKeyfile(!pedited || spot_edited->anggradcie, "Locallab", "Anggradcie_" + index_str, spot.anggradcie, keyFile); saveToKeyfile(!pedited || spot_edited->surroundcie, "Locallab", "Surroundcie_" + index_str, spot.surroundcie, keyFile); saveToKeyfile(!pedited || spot_edited->enacieMask, "Locallab", "EnacieMask_" + index_str, spot.enacieMask, keyFile); + saveToKeyfile(!pedited || spot_edited->enacieMaskall, "Locallab", "EnacieMaskall_" + index_str, spot.enacieMaskall, keyFile); saveToKeyfile(!pedited || spot_edited->CCmaskciecurve, "Locallab", "CCmaskcieCurve_" + index_str, spot.CCmaskciecurve, keyFile); saveToKeyfile(!pedited || spot_edited->LLmaskciecurve, "Locallab", "LLmaskcieCurve_" + index_str, spot.LLmaskciecurve, keyFile); saveToKeyfile(!pedited || spot_edited->HHmaskciecurve, "Locallab", "HHmaskcieCurve_" + index_str, spot.HHmaskciecurve, keyFile); + saveToKeyfile(!pedited || spot_edited->HHhmaskciecurve, "Locallab", "HHhmaskcieCurve_" + index_str, spot.HHhmaskciecurve, keyFile); saveToKeyfile(!pedited || spot_edited->blendmaskcie, "Locallab", "Blendmaskcie_" + index_str, spot.blendmaskcie, keyFile); saveToKeyfile(!pedited || spot_edited->radmaskcie, "Locallab", "Radmaskcie_" + index_str, spot.radmaskcie, keyFile); saveToKeyfile(!pedited || spot_edited->chromaskcie, "Locallab", "Chromaskcie_" + index_str, spot.chromaskcie, keyFile); @@ -7271,11 +7463,19 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->lowthrescie, "Locallab", "Lowthrescie_" + index_str, spot.lowthrescie, keyFile); saveToKeyfile(!pedited || spot_edited->higthrescie, "Locallab", "Higthrescie_" + index_str, spot.higthrescie, keyFile); saveToKeyfile(!pedited || spot_edited->decaycie, "Locallab", "Decaycie_" + index_str, spot.decaycie, keyFile); + saveToKeyfile(!pedited || spot_edited->strumaskcie, "Locallab", "strumaskcie_" + index_str, spot.strumaskcie, keyFile); + saveToKeyfile(!pedited || spot_edited->toolcie, "Locallab", "toolcie_" + index_str, spot.toolcie, keyFile); + saveToKeyfile(!pedited || spot_edited->fftcieMask, "Locallab", "FftcieMask_" + index_str, spot.fftcieMask, keyFile); + saveToKeyfile(!pedited || spot_edited->contcie, "Locallab", "contcie_" + index_str, spot.contcie, keyFile); + saveToKeyfile(!pedited || spot_edited->blurcie, "Locallab", "blurcie_" + index_str, spot.blurcie, keyFile); + saveToKeyfile(!pedited || spot_edited->blurcie, "Locallab", "highmaskcie_" + index_str, spot.highmaskcie, keyFile); + saveToKeyfile(!pedited || spot_edited->blurcie, "Locallab", "shadmaskcie_" + index_str, spot.shadmaskcie, keyFile); + saveToKeyfile(!pedited || spot_edited->LLmaskciecurvewav, "Locallab", "LLmaskcieCurvewav_" + index_str, spot.LLmaskciecurvewav, keyFile); + saveToKeyfile(!pedited || spot_edited->csthresholdcie, "Locallab", "CSThresholdcie_" + index_str, spot.csthresholdcie.toVector(), keyFile); } - } } @@ -7374,7 +7574,8 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo {ColorManagementParams::Illuminant::D120, "D120"}, {ColorManagementParams::Illuminant::STDA, "stda"}, {ColorManagementParams::Illuminant::TUNGSTEN_2000K, "2000"}, - {ColorManagementParams::Illuminant::TUNGSTEN_1500K, "1500"} + {ColorManagementParams::Illuminant::TUNGSTEN_1500K, "1500"}, + {ColorManagementParams::Illuminant::E, "E"} }, icm.will, keyFile @@ -7393,6 +7594,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo {ColorManagementParams::Primaries::WIDE_GAMUT, "wid"}, {ColorManagementParams::Primaries::ACES_P0, "ac0"}, {ColorManagementParams::Primaries::JDC_MAX, "jdcmax"}, + {ColorManagementParams::Primaries::JDC_MAXSTDA, "jdcmaxstdA"}, {ColorManagementParams::Primaries::BRUCE_RGB, "bru"}, {ColorManagementParams::Primaries::BETA_RGB, "bet"}, {ColorManagementParams::Primaries::BEST_RGB, "bst"}, @@ -7402,14 +7604,34 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo icm.wprim, keyFile ); + saveToKeyfile( + !pedited || pedited->icm.wcat, + "Color Management", + "Wcat", + { + {ColorManagementParams::Cat::BRAD, "brad"}, + {ColorManagementParams::Cat::CAT16, "cat16"}, + {ColorManagementParams::Cat::CAT02, "cat02"}, + {ColorManagementParams::Cat::CAT_VK, "cat_vk"}, + {ColorManagementParams::Cat::CAT_XYZ, "cat_xyz"} + }, + icm.wcat, + keyFile + ); + saveToKeyfile(!pedited || pedited->icm.workingTRCGamma, "Color Management", "WorkingTRCGamma", icm.workingTRCGamma, keyFile); saveToKeyfile(!pedited || pedited->icm.workingTRCSlope, "Color Management", "WorkingTRCSlope", icm.workingTRCSlope, keyFile); + saveToKeyfile(!pedited || pedited->icm.wmidtcie, "Color Management", "Wmidtcie", icm.wmidtcie, keyFile); + saveToKeyfile(!pedited || pedited->icm.wsmoothcie, "Color Management", "Wsmoothcie", icm.wsmoothcie, keyFile); saveToKeyfile(!pedited || pedited->icm.redx, "Color Management", "Redx", icm.redx, keyFile); saveToKeyfile(!pedited || pedited->icm.redy, "Color Management", "Redy", icm.redy, keyFile); saveToKeyfile(!pedited || pedited->icm.grex, "Color Management", "Grex", icm.grex, keyFile); saveToKeyfile(!pedited || pedited->icm.grey, "Color Management", "Grey", icm.grey, keyFile); saveToKeyfile(!pedited || pedited->icm.blux, "Color Management", "Blux", icm.blux, keyFile); saveToKeyfile(!pedited || pedited->icm.bluy, "Color Management", "Bluy", icm.bluy, keyFile); + saveToKeyfile(!pedited || pedited->icm.refi, "Color Management", "Refi", icm.refi, keyFile); + saveToKeyfile(!pedited || pedited->icm.shiftx, "Color Management", "Shiftx", icm.shiftx, keyFile); + saveToKeyfile(!pedited || pedited->icm.shifty, "Color Management", "Shifty", icm.shifty, keyFile); saveToKeyfile(!pedited || pedited->icm.labgridcieALow, "Color Management", "LabGridcieALow", icm.labgridcieALow, keyFile); saveToKeyfile(!pedited || pedited->icm.labgridcieBLow, "Color Management", "LabGridcieBLow", icm.labgridcieBLow, keyFile); saveToKeyfile(!pedited || pedited->icm.labgridcieAHigh, "Color Management", "LabGridcieAHigh", icm.labgridcieAHigh, keyFile); @@ -7418,8 +7640,11 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->icm.labgridcieGy, "Color Management", "LabGridcieGy", icm.labgridcieGy, keyFile); saveToKeyfile(!pedited || pedited->icm.labgridcieWx, "Color Management", "LabGridcieWx", icm.labgridcieWx, keyFile); saveToKeyfile(!pedited || pedited->icm.labgridcieWy, "Color Management", "LabGridcieWy", icm.labgridcieWy, keyFile); + saveToKeyfile(!pedited || pedited->icm.labgridcieMx, "Color Management", "LabGridcieMx", icm.labgridcieMx, keyFile); + saveToKeyfile(!pedited || pedited->icm.labgridcieMy, "Color Management", "LabGridcieMy", icm.labgridcieMy, keyFile); saveToKeyfile(!pedited || pedited->icm.preser, "Color Management", "Preser", icm.preser, keyFile); saveToKeyfile(!pedited || pedited->icm.fbw, "Color Management", "Fbw", icm.fbw, keyFile); + saveToKeyfile(!pedited || pedited->icm.trcExp, "Color Management", "TrcExp", icm.trcExp, keyFile); saveToKeyfile(!pedited || pedited->icm.gamut, "Color Management", "Gamut", icm.gamut, keyFile); saveToKeyfile(!pedited || pedited->icm.outputProfile, "Color Management", "OutputProfile", icm.outputProfile, keyFile); saveToKeyfile( @@ -8742,6 +8967,11 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "ShapeMethod_" + index_str, spot.shapeMethod, spotEdited.shapeMethod); if (keyFile.has_key("Locallab", "AvoidgamutMethod_" + index_str)) { assignFromKeyfile(keyFile, "Locallab", "AvoidgamutMethod_" + index_str, spot.avoidgamutMethod, spotEdited.avoidgamutMethod); + /* if (ppVersion < 351) { + if(spot.avoidgamutMethod == "XYZ") {//5.10 default value + spot.avoidgamutMethod = "MUNS";//set to Munsell only + } + } */ } else if (keyFile.has_key("Locallab", "Avoid_" + index_str)) { const bool avoid = keyFile.get_boolean("Locallab", "Avoid_" + index_str); const bool munsell = keyFile.has_key("Locallab", "Avoidmun_" + index_str) && keyFile.get_boolean("Locallab", "Avoidmun_" + index_str); @@ -8927,7 +9157,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Complexshadhigh_" + index_str, spot.complexshadhigh, spotEdited.complexshadhigh); assignFromKeyfile(keyFile, "Locallab", "ShMethod_" + index_str, spot.shMethod, spotEdited.shMethod); - for (int j = 0; j < 5; j ++) { + for (int j = 0; j < 6; j ++) { assignFromKeyfile(keyFile, "Locallab", "Multsh" + std::to_string(j) + "_" + index_str, spot.multsh[j], spotEdited.multsh[j]); } @@ -9370,8 +9600,13 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Fullimage_" + index_str, spot.fullimage, spotEdited.fullimage); assignFromKeyfile(keyFile, "Locallab", "Repart_" + index_str, spot.repar, spotEdited.repar); assignFromKeyfile(keyFile, "Locallab", "Ciecam_" + index_str, spot.ciecam, spotEdited.ciecam); + assignFromKeyfile(keyFile, "Locallab", "Satlog_" + index_str, spot.satlog, spotEdited.satlog); assignFromKeyfile(keyFile, "Locallab", "BlackEv_" + index_str, spot.blackEv, spotEdited.blackEv); assignFromKeyfile(keyFile, "Locallab", "WhiteEv_" + index_str, spot.whiteEv, spotEdited.whiteEv); + assignFromKeyfile(keyFile, "Locallab", "Whiteslog_" + index_str, spot.whiteslog, spotEdited.whiteslog); + assignFromKeyfile(keyFile, "Locallab", "Blackslog_" + index_str, spot.blackslog, spotEdited.blackslog); + assignFromKeyfile(keyFile, "Locallab", "Comprlog_" + index_str, spot.comprlog, spotEdited.comprlog); + assignFromKeyfile(keyFile, "Locallab", "Strelog_" + index_str, spot.strelog, spotEdited.strelog); assignFromKeyfile(keyFile, "Locallab", "Detail_" + index_str, spot.detail, spotEdited.detail); assignFromKeyfile(keyFile, "Locallab", "Sensilog_" + index_str, spot.sensilog, spotEdited.sensilog); assignFromKeyfile(keyFile, "Locallab", "Baselog_" + index_str, spot.baselog, spotEdited.baselog); @@ -9440,6 +9675,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) if (spot.visicie) { spotEdited.visicie = true; } + assignFromKeyfile(keyFile, "Locallab", "Expprecam_" + index_str, spot.expprecam, spotEdited.expprecam); assignFromKeyfile(keyFile, "Locallab", "Complexcie_" + index_str, spot.complexcie, spotEdited.complexcie); assignFromKeyfile(keyFile, "Locallab", "Reparcie_" + index_str, spot.reparcie, spotEdited.reparcie); assignFromKeyfile(keyFile, "Locallab", "Sensicie_" + index_str, spot.sensicie, spotEdited.sensicie); @@ -9448,8 +9684,14 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Forcebw_" + index_str, spot.forcebw, spotEdited.forcebw); assignFromKeyfile(keyFile, "Locallab", "Qtoj_" + index_str, spot.qtoj, spotEdited.qtoj); assignFromKeyfile(keyFile, "Locallab", "jabcie_" + index_str, spot.jabcie, spotEdited.jabcie); - assignFromKeyfile(keyFile, "Locallab", "sigmoidqjcie_" + index_str, spot.sigmoidqjcie, spotEdited.sigmoidqjcie); + assignFromKeyfile(keyFile, "Locallab", "comprcieauto_" + index_str, spot.comprcieauto, spotEdited.comprcieauto); + assignFromKeyfile(keyFile, "Locallab", "normcie_" + index_str, spot.normcie, spotEdited.normcie); + assignFromKeyfile(keyFile, "Locallab", "gamutcie_" + index_str, spot.gamutcie, spotEdited.gamutcie); + assignFromKeyfile(keyFile, "Locallab", "sigcie_" + index_str, spot.sigcie, spotEdited.sigcie); assignFromKeyfile(keyFile, "Locallab", "logcie_" + index_str, spot.logcie, spotEdited.logcie); + assignFromKeyfile(keyFile, "Locallab", "satcie_" + index_str, spot.satcie, spotEdited.satcie); + assignFromKeyfile(keyFile, "Locallab", "logcieq_" + index_str, spot.logcieq, spotEdited.logcieq); + assignFromKeyfile(keyFile, "Locallab", "smoothcie_" + index_str, spot.smoothcie, spotEdited.smoothcie); assignFromKeyfile(keyFile, "Locallab", "Logjz_" + index_str, spot.logjz, spotEdited.logjz); assignFromKeyfile(keyFile, "Locallab", "Sigjz_" + index_str, spot.sigjz, spotEdited.sigjz); assignFromKeyfile(keyFile, "Locallab", "Sigq_" + index_str, spot.sigq, spotEdited.sigq); @@ -9459,8 +9701,9 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Sursourcie_" + index_str, spot.sursourcie, spotEdited.sursourcie); assignFromKeyfile(keyFile, "Locallab", "Modecie_" + index_str, spot.modecie, spotEdited.modecie); assignFromKeyfile(keyFile, "Locallab", "Modecam_" + index_str, spot.modecam, spotEdited.modecam); + assignFromKeyfile(keyFile, "Locallab", "bwevMethod_" + index_str, spot.bwevMethod, spotEdited.bwevMethod); assignFromKeyfile(keyFile, "Locallab", "Saturlcie_" + index_str, spot.saturlcie, spotEdited.saturlcie); - assignFromKeyfile(keyFile, "Locallab", "Rstprotectcie_" + index_str, spot.rstprotectcie, spotEdited.rstprotectcie); + assignFromKeyfile(keyFile, "Locallab", "Rstprotectcie_" + index_str, spot.rstprotectcie, spotEdited.rstprotectcie); assignFromKeyfile(keyFile, "Locallab", "Chromlcie_" + index_str, spot.chromlcie, spotEdited.chromlcie); assignFromKeyfile(keyFile, "Locallab", "Huecie_" + index_str, spot.huecie, spotEdited.huecie); assignFromKeyfile(keyFile, "Locallab", "ToneMethodcie_" + index_str, spot.toneMethodcie, spotEdited.toneMethodcie); @@ -9471,7 +9714,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Saturjzcie_" + index_str, spot.saturjzcie, spotEdited.saturjzcie); assignFromKeyfile(keyFile, "Locallab", "Huejzcie_" + index_str, spot.huejzcie, spotEdited.huejzcie); assignFromKeyfile(keyFile, "Locallab", "Softjzcie_" + index_str, spot.softjzcie, spotEdited.softjzcie); - assignFromKeyfile(keyFile, "Locallab", "strSoftjzcie_" + index_str, spot.strsoftjzcie, spotEdited.strsoftjzcie); + assignFromKeyfile(keyFile, "Locallab", "strSoftjzcie_" + index_str, spot.strsoftjzcie, spotEdited.strsoftjzcie); assignFromKeyfile(keyFile, "Locallab", "Thrhjzcie_" + index_str, spot.thrhjzcie, spotEdited.thrhjzcie); assignFromKeyfile(keyFile, "Locallab", "JzCurve_" + index_str, spot.jzcurve, spotEdited.jzcurve); assignFromKeyfile(keyFile, "Locallab", "CzCurve_" + index_str, spot.czcurve, spotEdited.czcurve); @@ -9482,14 +9725,16 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Lightlcie_" + index_str, spot.lightlcie, spotEdited.lightlcie); assignFromKeyfile(keyFile, "Locallab", "Lightjzcie_" + index_str, spot.lightjzcie, spotEdited.lightjzcie); assignFromKeyfile(keyFile, "Locallab", "Brightqcie_" + index_str, spot.lightqcie, spotEdited.lightqcie); + assignFromKeyfile(keyFile, "Locallab", "Brightsigqcie_" + index_str, spot.lightsigqcie, spotEdited.lightsigqcie); assignFromKeyfile(keyFile, "Locallab", "Contlcie_" + index_str, spot.contlcie, spotEdited.contlcie); assignFromKeyfile(keyFile, "Locallab", "Contjzcie_" + index_str, spot.contjzcie, spotEdited.contjzcie); - assignFromKeyfile(keyFile, "Locallab", "Adapjzcie_" + index_str, spot.adapjzcie, spotEdited.adapjzcie); + assignFromKeyfile(keyFile, "Locallab", "Detailciejz_" + index_str, spot.detailciejz, spotEdited.detailciejz); + assignFromKeyfile(keyFile, "Locallab", "Adapjzcie_" + index_str, spot.adapjzcie, spotEdited.adapjzcie); assignFromKeyfile(keyFile, "Locallab", "Jz100_" + index_str, spot.jz100, spotEdited.jz100); assignFromKeyfile(keyFile, "Locallab", "PQremap_" + index_str, spot.pqremap, spotEdited.pqremap); - assignFromKeyfile(keyFile, "Locallab", "PQremapcam16_" + index_str, spot.pqremapcam16, spotEdited.pqremapcam16); + assignFromKeyfile(keyFile, "Locallab", "PQremapcam16_" + index_str, spot.pqremapcam16, spotEdited.pqremapcam16); assignFromKeyfile(keyFile, "Locallab", "Hljzcie_" + index_str, spot.hljzcie, spotEdited.hljzcie); - assignFromKeyfile(keyFile, "Locallab", "Hlthjzcie_" + index_str, spot.hlthjzcie, spotEdited.hlthjzcie); + assignFromKeyfile(keyFile, "Locallab", "Hlthjzcie_" + index_str, spot.hlthjzcie, spotEdited.hlthjzcie); assignFromKeyfile(keyFile, "Locallab", "Shjzcie_" + index_str, spot.shjzcie, spotEdited.shjzcie); assignFromKeyfile(keyFile, "Locallab", "Shthjzcie_" + index_str, spot.shthjzcie, spotEdited.shthjzcie); assignFromKeyfile(keyFile, "Locallab", "Radjzcie_" + index_str, spot.radjzcie, spotEdited.radjzcie); @@ -9514,32 +9759,61 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "WhiteEvjz_" + index_str, spot.whiteEvjz, spotEdited.whiteEvjz); assignFromKeyfile(keyFile, "Locallab", "Targetjz_" + index_str, spot.targetjz, spotEdited.targetjz); assignFromKeyfile(keyFile, "Locallab", "Sigmoidthcie_" + index_str, spot.sigmoidthcie, spotEdited.sigmoidthcie); + assignFromKeyfile(keyFile, "Locallab", "Sigmoidsenscie_" + index_str, spot.sigmoidsenscie, spotEdited.sigmoidsenscie); assignFromKeyfile(keyFile, "Locallab", "Sigmoidblcie_" + index_str, spot.sigmoidblcie, spotEdited.sigmoidblcie); + assignFromKeyfile(keyFile, "Locallab", "comprcie_" + index_str, spot.comprcie, spotEdited.comprcie); + assignFromKeyfile(keyFile, "Locallab", "strcielog_" + index_str, spot.strcielog, spotEdited.strcielog); + assignFromKeyfile(keyFile, "Locallab", "comprcieth_" + index_str, spot.comprcieth, spotEdited.comprcieth); + assignFromKeyfile(keyFile, "Locallab", "gamjcie_" + index_str, spot.gamjcie, spotEdited.gamjcie); + assignFromKeyfile(keyFile, "Locallab", "slopjcie_" + index_str, spot.slopjcie, spotEdited.slopjcie); + assignFromKeyfile(keyFile, "Locallab", "slopesmo_" + index_str, spot.slopesmo, spotEdited.slopesmo); + assignFromKeyfile(keyFile, "Locallab", "midtcie_" + index_str, spot.midtcie, spotEdited.midtcie); + assignFromKeyfile(keyFile, "Locallab", "grexl_" + index_str, spot.grexl, spotEdited.grexl); + assignFromKeyfile(keyFile, "Locallab", "greyl_" + index_str, spot.greyl, spotEdited.greyl); + assignFromKeyfile(keyFile, "Locallab", "bluxl_" + index_str, spot.bluxl, spotEdited.bluxl); + assignFromKeyfile(keyFile, "Locallab", "bluyl_" + index_str, spot.bluyl, spotEdited.bluyl); + assignFromKeyfile(keyFile, "Locallab", "redxl_" + index_str, spot.redxl, spotEdited.redxl); + assignFromKeyfile(keyFile, "Locallab", "redyl_" + index_str, spot.redyl, spotEdited.redyl); + assignFromKeyfile(keyFile, "Locallab", "refi_" + index_str, spot.refi, spotEdited.refi); + assignFromKeyfile(keyFile, "Locallab", "shiftxl_" + index_str, spot.shiftxl, spotEdited.shiftxl); + assignFromKeyfile(keyFile, "Locallab", "shiftyl_" + index_str, spot.shiftyl, spotEdited.shiftyl); + assignFromKeyfile(keyFile, "Locallab", "labgridcieALow_" + index_str, spot.labgridcieALow, spotEdited.labgridcieALow); + assignFromKeyfile(keyFile, "Locallab", "labgridcieBLow_" + index_str, spot.labgridcieBLow, spotEdited.labgridcieBLow); + assignFromKeyfile(keyFile, "Locallab", "labgridcieAHigh_" + index_str, spot.labgridcieAHigh, spotEdited.labgridcieAHigh); + assignFromKeyfile(keyFile, "Locallab", "labgridcieBHigh_" + index_str, spot.labgridcieBHigh, spotEdited.labgridcieBHigh); + assignFromKeyfile(keyFile, "Locallab", "labgridcieGx_" + index_str, spot.labgridcieGx, spotEdited.labgridcieGx); + assignFromKeyfile(keyFile, "Locallab", "labgridcieGy_" + index_str, spot.labgridcieGy, spotEdited.labgridcieGy); + assignFromKeyfile(keyFile, "Locallab", "labgridcieWx_" + index_str, spot.labgridcieWx, spotEdited.labgridcieWx); + assignFromKeyfile(keyFile, "Locallab", "labgridcieWy_" + index_str, spot.labgridcieWy, spotEdited.labgridcieWy); + assignFromKeyfile(keyFile, "Locallab", "labgridcieMx_" + index_str, spot.labgridcieMx, spotEdited.labgridcieMx); + assignFromKeyfile(keyFile, "Locallab", "labgridcieMy_" + index_str, spot.labgridcieMy, spotEdited.labgridcieMy); + + assignFromKeyfile(keyFile, "Locallab", "whitescie_" + index_str, spot.whitescie, spotEdited.whitescie); + assignFromKeyfile(keyFile, "Locallab", "blackscie_" + index_str, spot.blackscie, spotEdited.blackscie); + assignFromKeyfile(keyFile, "Locallab", "illMethod_" + index_str, spot.illMethod, spotEdited.illMethod); + assignFromKeyfile(keyFile, "Locallab", "smoothciemet_" + index_str, spot.smoothciemet, spotEdited.smoothciemet); + assignFromKeyfile(keyFile, "Locallab", "primMethod_" + index_str, spot.primMethod, spotEdited.primMethod); + assignFromKeyfile(keyFile, "Locallab", "catMethod_" + index_str, spot.catMethod, spotEdited.catMethod); assignFromKeyfile(keyFile, "Locallab", "Sigmoidldajzcie_" + index_str, spot.sigmoidldajzcie, spotEdited.sigmoidldajzcie); assignFromKeyfile(keyFile, "Locallab", "Sigmoidthjzcie_" + index_str, spot.sigmoidthjzcie, spotEdited.sigmoidthjzcie); assignFromKeyfile(keyFile, "Locallab", "Sigmoidbljzcie_" + index_str, spot.sigmoidbljzcie, spotEdited.sigmoidbljzcie); assignFromKeyfile(keyFile, "Locallab", "Contqcie_" + index_str, spot.contqcie, spotEdited.contqcie); + assignFromKeyfile(keyFile, "Locallab", "Contsigqcie_" + index_str, spot.contsigqcie, spotEdited.contsigqcie); assignFromKeyfile(keyFile, "Locallab", "Colorflcie_" + index_str, spot.colorflcie, spotEdited.colorflcie); -/* - assignFromKeyfile(keyFile, "Locallab", "Lightlzcam_" + index_str, spot.lightlzcam, spotEdited.lightlzcam); - assignFromKeyfile(keyFile, "Locallab", "Lightqzcam_" + index_str, spot.lightqzcam, spotEdited.lightqzcam); - assignFromKeyfile(keyFile, "Locallab", "Contlzcam_" + index_str, spot.contlzcam, spotEdited.contlzcam); - assignFromKeyfile(keyFile, "Locallab", "Contqzcam_" + index_str, spot.contqzcam, spotEdited.contqzcam); - assignFromKeyfile(keyFile, "Locallab", "Contthreszcam_" + index_str, spot.contthreszcam, spotEdited.contthreszcam); -*/ assignFromKeyfile(keyFile, "Locallab", "Targabscie_" + index_str, spot.targabscie, spotEdited.targabscie); assignFromKeyfile(keyFile, "Locallab", "TargetGraycie_" + index_str, spot.targetGraycie, spotEdited.targetGraycie); assignFromKeyfile(keyFile, "Locallab", "Catadcie_" + index_str, spot.catadcie, spotEdited.catadcie); assignFromKeyfile(keyFile, "Locallab", "Detailcie_" + index_str, spot.detailcie, spotEdited.detailcie); -/* - assignFromKeyfile(keyFile, "Locallab", "Colorflzcam_" + index_str, spot.colorflzcam, spotEdited.colorflzcam); - assignFromKeyfile(keyFile, "Locallab", "Saturzcam_" + index_str, spot.saturzcam, spotEdited.saturzcam); - assignFromKeyfile(keyFile, "Locallab", "Chromzcam_" + index_str, spot.chromzcam, spotEdited.chromzcam); -*/ - assignFromKeyfile(keyFile, "Locallab", "EnacieMask_" + index_str, spot.enacieMask, spotEdited.enacieMask); + assignFromKeyfile(keyFile, "Locallab", "Surroundcie_" + index_str, spot.surroundcie, spotEdited.surroundcie); + assignFromKeyfile(keyFile, "Locallab", "Strgradcie_" + index_str, spot.strgradcie, spotEdited.strgradcie); + assignFromKeyfile(keyFile, "Locallab", "Anggradcie_" + index_str, spot.anggradcie, spotEdited.anggradcie); + + assignFromKeyfile(keyFile, "Locallab", "EnacieMask_" + index_str, spot.enacieMask, spotEdited.enacieMask); + assignFromKeyfile(keyFile, "Locallab", "EnacieMaskall_" + index_str, spot.enacieMaskall, spotEdited.enacieMaskall); assignFromKeyfile(keyFile, "Locallab", "CCmaskcieCurve_" + index_str, spot.CCmaskciecurve, spotEdited.CCmaskciecurve); assignFromKeyfile(keyFile, "Locallab", "LLmaskcieCurve_" + index_str, spot.LLmaskciecurve, spotEdited.LLmaskciecurve); - assignFromKeyfile(keyFile, "Locallab", "HHmaskcieCurve_" + index_str, spot.HHmaskciecurve, spotEdited.HHmaskciecurve); + assignFromKeyfile(keyFile, "Locallab", "HHmaskcieCurve_" + index_str, spot.HHmaskciecurve, spotEdited.HHmaskciecurve); + assignFromKeyfile(keyFile, "Locallab", "HHhmaskcieCurve_" + index_str, spot.HHhmaskciecurve, spotEdited.HHhmaskciecurve); assignFromKeyfile(keyFile, "Locallab", "Blendmaskcie_" + index_str, spot.blendmaskcie, spotEdited.blendmaskcie); assignFromKeyfile(keyFile, "Locallab", "Radmaskcie_" + index_str, spot.radmaskcie, spotEdited.radmaskcie); assignFromKeyfile(keyFile, "Locallab", "Chromaskcie_" + index_str, spot.chromaskcie, spotEdited.chromaskcie); @@ -9551,6 +9825,24 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Lowthrescie_" + index_str, spot.lowthrescie, spotEdited.lowthrescie); assignFromKeyfile(keyFile, "Locallab", "Higthrescie_" + index_str, spot.higthrescie, spotEdited.higthrescie); assignFromKeyfile(keyFile, "Locallab", "Decaycie_" + index_str, spot.decaycie, spotEdited.decaycie); + assignFromKeyfile(keyFile, "Locallab", "strumaskcie_" + index_str, spot.strumaskcie, spotEdited.strumaskcie); + assignFromKeyfile(keyFile, "Locallab", "toolcie_" + index_str, spot.toolcie, spotEdited.toolcie); + assignFromKeyfile(keyFile, "Locallab", "FftcieMask_" + index_str, spot.fftcieMask, spotEdited.fftcieMask); + assignFromKeyfile(keyFile, "Locallab", "contcie_" + index_str, spot.contcie, spotEdited.contcie); + assignFromKeyfile(keyFile, "Locallab", "blurcie_" + index_str, spot.blurcie, spotEdited.blurcie); + assignFromKeyfile(keyFile, "Locallab", "highmaskcie_" + index_str, spot.highmaskcie, spotEdited.highmaskcie); + assignFromKeyfile(keyFile, "Locallab", "shadmaskcie_" + index_str, spot.shadmaskcie, spotEdited.shadmaskcie); + assignFromKeyfile(keyFile, "Locallab", "LLmaskcieCurvewav_" + index_str, spot.LLmaskciecurvewav, spotEdited.LLmaskciecurvewav); + + if (keyFile.has_key("Locallab", "CSThresholdcie_" + index_str)) { + const std::vector thresh = keyFile.get_integer_list("Locallab", "CSThresholdcie_" + index_str); + + if (thresh.size() >= 4) { + spot.csthresholdcie.setValues(thresh[0], thresh[1], min(thresh[2], 10), min(thresh[3], 10)); + } + + spotEdited.csthresholdcie = true; + } // Append LocallabSpot and LocallabParamsEdited locallab.spots.push_back(spot); @@ -9731,7 +10023,8 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) {"D120", ColorManagementParams::Illuminant::D120}, {"stda", ColorManagementParams::Illuminant::STDA}, {"2000", ColorManagementParams::Illuminant::TUNGSTEN_2000K}, - {"1500", ColorManagementParams::Illuminant::TUNGSTEN_1500K} + {"1500", ColorManagementParams::Illuminant::TUNGSTEN_1500K}, + {"E", ColorManagementParams::Illuminant::E} }, icm.will, pedited->icm.will @@ -9757,6 +10050,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) {"wid", ColorManagementParams::Primaries::WIDE_GAMUT}, {"ac0", ColorManagementParams::Primaries::ACES_P0}, {"jdcmax", ColorManagementParams::Primaries::JDC_MAX}, + {"jdcmaxstdA", ColorManagementParams::Primaries::JDC_MAXSTDA}, {"bru", ColorManagementParams::Primaries::BRUCE_RGB}, {"bet", ColorManagementParams::Primaries::BETA_RGB}, {"bst", ColorManagementParams::Primaries::BEST_RGB}, @@ -9772,8 +10066,33 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) pedited->icm.wprim = true; } } - assignFromKeyfile(keyFile, "Color Management", "WorkingTRCGamma", icm.workingTRCGamma, pedited->icm.workingTRCGamma); + if ( + !assignFromKeyfile( + keyFile, + "Color Management", + "Wcat", + { + {"brad", ColorManagementParams::Cat::BRAD}, + {"cat16", ColorManagementParams::Cat::CAT16}, + {"cat02", ColorManagementParams::Cat::CAT02}, + {"cat_vk", ColorManagementParams::Cat::CAT_VK}, + {"cat_xyz", ColorManagementParams::Cat::CAT_XYZ} + }, + icm.wcat, + pedited->icm.wcat + ) + ){ + icm.wcat = ColorManagementParams::Cat::BRAD; + if (pedited) { + pedited->icm.wcat = true; + } + } + + assignFromKeyfile(keyFile, "Color Management", "Gamut", icm.gamut, pedited->icm.gamut); assignFromKeyfile(keyFile, "Color Management", "WorkingTRCSlope", icm.workingTRCSlope, pedited->icm.workingTRCSlope); + assignFromKeyfile(keyFile, "Color Management", "WorkingTRCGamma", icm.workingTRCGamma, pedited->icm.workingTRCGamma); + assignFromKeyfile(keyFile, "Color Management", "Wmidtcie", icm.wmidtcie, pedited->icm.wmidtcie); + assignFromKeyfile(keyFile, "Color Management", "Wsmoothcie", icm.wsmoothcie, pedited->icm.wsmoothcie); assignFromKeyfile(keyFile, "Color Management", "Redx", icm.redx, pedited->icm.redx); assignFromKeyfile(keyFile, "Color Management", "Redy", icm.redy, pedited->icm.redy); @@ -9781,9 +10100,12 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color Management", "Grey", icm.grey, pedited->icm.grey); assignFromKeyfile(keyFile, "Color Management", "Blux", icm.blux, pedited->icm.blux); assignFromKeyfile(keyFile, "Color Management", "Bluy", icm.bluy, pedited->icm.bluy); + assignFromKeyfile(keyFile, "Color Management", "Refi", icm.refi, pedited->icm.refi); + assignFromKeyfile(keyFile, "Color Management", "Shiftx", icm.shiftx, pedited->icm.shiftx); + assignFromKeyfile(keyFile, "Color Management", "Shifty", icm.shifty, pedited->icm.shifty); assignFromKeyfile(keyFile, "Color Management", "Preser", icm.preser, pedited->icm.preser); assignFromKeyfile(keyFile, "Color Management", "Fbw", icm.fbw, pedited->icm.fbw); - assignFromKeyfile(keyFile, "Color Management", "Gamut", icm.gamut, pedited->icm.gamut); + assignFromKeyfile(keyFile, "Color Management", "TrcExp", icm.trcExp, pedited->icm.trcExp); assignFromKeyfile(keyFile, "Color Management", "LabGridcieALow", icm.labgridcieALow, pedited->icm.labgridcieALow); assignFromKeyfile(keyFile, "Color Management", "LabGridcieBLow", icm.labgridcieBLow, pedited->icm.labgridcieBLow); assignFromKeyfile(keyFile, "Color Management", "LabGridcieAHigh", icm.labgridcieAHigh, pedited->icm.labgridcieAHigh); @@ -9792,6 +10114,8 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color Management", "LabGridcieGy", icm.labgridcieGy, pedited->icm.labgridcieGy); assignFromKeyfile(keyFile, "Color Management", "LabGridcieWx", icm.labgridcieWx, pedited->icm.labgridcieWx); assignFromKeyfile(keyFile, "Color Management", "LabGridcieWy", icm.labgridcieWy, pedited->icm.labgridcieWy); + assignFromKeyfile(keyFile, "Color Management", "LabGridcieMx", icm.labgridcieMx, pedited->icm.labgridcieMx); + assignFromKeyfile(keyFile, "Color Management", "LabGridcieMy", icm.labgridcieMy, pedited->icm.labgridcieMy); if (keyFile.has_key("Color Management", "aIntent")) { Glib::ustring intent = keyFile.get_string("Color Management", "aIntent"); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 5ffcf9c6f..0eb991933 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -863,7 +863,7 @@ struct SHParams { */ struct ToneEqualizerParams { bool enabled; - std::array bands; + std::array bands; int regularization; bool show_colormap; double pivot; @@ -1223,7 +1223,7 @@ struct LocallabParams { bool expshadhigh; int complexshadhigh; Glib::ustring shMethod; // std, tone - int multsh[5]; + int multsh[6]; int highlights; int h_tonalwidth; int shadows; @@ -1592,8 +1592,13 @@ struct LocallabParams { bool fullimage; double repar; bool ciecam; + bool satlog; double blackEv; double whiteEv; + int whiteslog; + int blackslog; + double comprlog; + double strelog; double detail; int sensilog; Glib::ustring sursour; @@ -1646,6 +1651,7 @@ struct LocallabParams { //ciecam bool visicie; bool expcie; + bool expprecam; int complexcie; double reparcie; int sensicie; @@ -1654,8 +1660,14 @@ struct LocallabParams { bool forcebw; bool qtoj; bool jabcie; - bool sigmoidqjcie; + bool comprcieauto; + bool normcie; + bool gamutcie; + bool sigcie; bool logcie; + bool satcie; + bool logcieq; + bool smoothcie; bool logjz; bool sigjz; bool sigq; @@ -1665,6 +1677,7 @@ struct LocallabParams { Glib::ustring sursourcie; Glib::ustring modecie; Glib::ustring modecam; + Glib::ustring bwevMethod; double saturlcie; double rstprotectcie; double chromlcie; @@ -1688,8 +1701,10 @@ struct LocallabParams { double lightlcie; double lightjzcie; double lightqcie; + double lightsigqcie; double contlcie; double contjzcie; + double detailciejz; double adapjzcie; double jz100; double pqremap; @@ -1711,31 +1726,60 @@ struct LocallabParams { double targetjz; double sigmoidldacie; double sigmoidthcie; + double sigmoidsenscie; double sigmoidblcie; + double comprcie; + double strcielog; + double comprcieth; + double gamjcie; + double slopjcie; + double slopesmo; + int midtcie; + double grexl; + double greyl; + double bluxl; + double bluyl; + double redxl; + double redyl; + double refi; + double shiftxl; + double shiftyl; + double labgridcieALow; + double labgridcieBLow; + double labgridcieAHigh; + double labgridcieBHigh; + double labgridcieGx; + double labgridcieGy; + double labgridcieWx; + double labgridcieWy; + double labgridcieMx; + double labgridcieMy; + + int whitescie; + int blackscie; + Glib::ustring illMethod; + Glib::ustring smoothciemet; + Glib::ustring primMethod; + Glib::ustring catMethod; double sigmoidldajzcie; double sigmoidthjzcie; double sigmoidbljzcie; double contqcie; + double contsigqcie; double colorflcie; -/* - double lightlzcam; - double lightqzcam; - double contlzcam; - double contqzcam; - double contthreszcam; - double colorflzcam; - double saturzcam; - double chromzcam; -*/ double targabscie; double targetGraycie; double catadcie; double detailcie; Glib::ustring surroundcie; + double strgradcie; + double anggradcie; bool enacieMask; + bool enacieMaskall; std::vector CCmaskciecurve; std::vector LLmaskciecurve; std::vector HHmaskciecurve; + std::vector HHhmaskciecurve; int blendmaskcie; double radmaskcie; double chromaskcie; @@ -1747,7 +1791,16 @@ struct LocallabParams { double lowthrescie; double higthrescie; double decaycie; - + double strumaskcie; + bool toolcie; + bool fftcieMask; + double contcie; + double blurcie; + double highmaskcie; + double shadmaskcie; + std::vector LLmaskciecurvewav; + Threshold csthresholdcie; + LocallabSpot(); bool operator ==(const LocallabSpot& other) const; @@ -1947,7 +2000,8 @@ struct ColorManagementParams { D120, STDA, TUNGSTEN_2000K, - TUNGSTEN_1500K + TUNGSTEN_1500K, + E }; enum class Primaries { @@ -1960,6 +2014,7 @@ struct ColorManagementParams { WIDE_GAMUT, ACES_P0, JDC_MAX, + JDC_MAXSTDA, BRUCE_RGB, BETA_RGB, BEST_RGB, @@ -1967,6 +2022,14 @@ struct ColorManagementParams { CUSTOM_GRID }; + enum class Cat { + BRAD, + CAT16, + CAT02, + CAT_VK, + CAT_XYZ + }; + Glib::ustring inputProfile; bool toneCurve; bool applyLookTable; @@ -1978,16 +2041,23 @@ struct ColorManagementParams { WorkingTrc workingTRC; Illuminant will; Primaries wprim; + Cat wcat; double workingTRCGamma; double workingTRCSlope; + double wmidtcie; + bool wsmoothcie; double redx; double redy; double grex; double grey; double blux; double bluy; + double refi; + double shiftx; + double shifty; double preser; bool fbw; + bool trcExp; bool gamut; double labgridcieALow; double labgridcieBLow; @@ -1997,6 +2067,8 @@ struct ColorManagementParams { double labgridcieGy; double labgridcieWx; double labgridcieWy; + double labgridcieMx; + double labgridcieMy; RenderingIntent aRendIntent; Glib::ustring outputProfile; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index c027cd7d4..8308e5e9f 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -5290,7 +5290,7 @@ void RawImageSource::ItcWB(bool extra, double &tempref, double &greenref, double itcwb_nopurple : false default - allow to bypass highlight recovery and inpait opposed when need flowers and not purple due to highlights... itcwb_green - adjust green refinement */ - BENCHFUN + // BENCHFUN MyTime t1, t2, t3, t4, t5, t6, t7, t8; t1.set(); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index c589e8ba4..5147e09ce 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -1108,7 +1108,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { AUTOEXP, //Evlocallabsigmoidldacie AUTOEXP, //Evlocallabsigmoidthcie AUTOEXP, //Evlocallabsigmoidblcie - AUTOEXP, //Evlocallabsigmoidqjcie + HDR, //Evlocallabcomprcieauto AUTOEXP, //Evlocallabhuecie AUTOEXP, //Evlocallabjabcie AUTOEXP, //Evlocallablightjzcie diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index fb669e1c8..fdd6676e6 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -424,12 +424,46 @@ public: double Lnres46; }; + struct locallabcieBEF { + double blackevbef; + double whiteevbef; + double sourcegbef; + double sourceabbef; + double targetgbef; + bool autocomputbef; + bool autociebef; + double jz1bef; + }; + + struct locallabcieLC { + double redxlc; + double redylc; + double grexlc; + double greylc; + double bluxlc; + double bluylc; + double wxlc; + double wylc; + double meanxlc; + double meanylc; + double meanxelc; + double meanyelc; + }; + + struct locallabcieSIG { + double contsigq; + double lightsigq; + }; + virtual ~LocallabListener() = default; // virtual void refChanged(const std::vector &ref, int selspot) = 0; virtual void minmaxChanged(const std::vector &minmax, int selspot) = 0; virtual void denChanged(const std::vector &denlc, int selspot) = 0; - virtual void logencodChanged(const float blackev, const float whiteev, const float sourceg, const float sourceab, const float targetg, const bool autocomput, const bool autocie, const float jz1) = 0; + virtual void cieChanged(const std::vector &cielc, int selspot) = 0; + virtual void sigChanged(const std::vector &ciesig, int selspot) = 0; + virtual void ciebefChanged(const std::vector &ciebef, int selspot) = 0; virtual void refChanged2(float *huerefp, float *chromarefp, float *lumarefp, float *fabrefp, int selspot) = 0; + }; class AutoColorTonListener @@ -444,7 +478,7 @@ class AutoprimListener public: virtual ~AutoprimListener() = default; virtual void primChanged(float rx, float ry, float bx, float by, float gx, float gy) = 0; - virtual void iprimChanged(float r_x, float r_y, float b_x, float b_y, float g_x, float g_y, float w_x, float w_y) = 0; + virtual void iprimChanged(float r_x, float r_y, float b_x, float b_y, float g_x, float g_y, float w_x, float w_y, float m_x, float m_y) = 0; }; diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 1ae5d30a7..1691912a1 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1534,7 +1534,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT ipf.softLight(labView, params.softlight); - if (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE) { + if (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE && params.icm.trcExp) { const int GW = labView->W; const int GH = labView->H; std::unique_ptr provis; @@ -1558,8 +1558,49 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT cmsHTRANSFORM dummy = nullptr; int ill = 0; - ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, ill, 0, dummy, true, false, false); - ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, illum, prim, dummy, false, true, true); + int locprim = 0; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + ipf.workingtrc(0, tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, 0, ill, 0, 0, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, dummy, true, false, false); + ipf.workingtrc(0, tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone,0, illum, prim, locprim, rdx, rdy, grx, gry, blx, bly,meanx, meany, meanxe, meanye, dummy, false, true, true); + const int midton = params.icm.wmidtcie; + if(midton != 0) { + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[2] = midton; + params.bands[4] = 0; + params.bands[5] = 0; + int mid = abs(midton); + int threshmid = 50; + if(mid > threshmid) { + params.bands[1] = sign(midton) * (mid - threshmid); + params.bands[3] = sign(midton) * (mid - threshmid); + } + ipf.toneEqualizer(tmpImage1.get(), params, prof, 1, false); + } + + const bool smoothi = params.icm.wsmoothcie; + if(smoothi) { + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[1] = 0; + params.bands[2] = 0; + params.bands[3] = 0; + params.bands[4] = -40;//arbitrary value to adapt with WhiteEvjz - here White Ev # 10 + params.bands[5] = -80;//8 Ev and above + bool Evsix = true; + if(Evsix) {//EV = 6 majority of images + params.bands[4] = -15; + } + + ipf.toneEqualizer(tmpImage1.get(), params, prof, 1, false); + } ipf.rgb2lab(*tmpImage1, *labView, params.icm.workingProfile); // labView and provis diff --git a/rtengine/settings.h b/rtengine/settings.h index fbbb51bbb..739d6cbb8 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -99,7 +99,7 @@ public: bool itcwb_enable; double itcwb_deltaspec; double itcwb_powponder; - + double basecorlog; //wavelet levels double edghi; double edglo; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 4202ac336..e7d13884c 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -231,7 +231,8 @@ private: bool autoContrast = imgsrc->getSensorType() == ST_BAYER ? params.raw.bayersensor.dualDemosaicAutoContrast : params.raw.xtranssensor.dualDemosaicAutoContrast; double contrastThreshold = imgsrc->getSensorType() == ST_BAYER ? params.raw.bayersensor.dualDemosaicContrast : params.raw.xtranssensor.dualDemosaicContrast; - imgsrc->demosaic (params.raw, autoContrast, contrastThreshold, params.pdsharpening.enabled && pl); + imgsrc->demosaic(params.raw, autoContrast, contrastThreshold, params.pdsharpening.enabled && pl); + if (params.pdsharpening.enabled) { imgsrc->captureSharpening(params.pdsharpening, false, params.pdsharpening.contrast, params.pdsharpening.deconvradius); } @@ -272,6 +273,7 @@ private: // set the color temperature currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method, params.wb.observer); ColorTemp currWBitc; + if (params.wb.method == "autitcgreen" && flush) { imgsrc->getrgbloc(0, 0, fh, fw, 0, 0, fh, fw, params.wb); } @@ -349,6 +351,7 @@ private: params.wb.green = currWB.getGreen(); params.wb.equal = currWB.getEqual(); } + //end WB auto calclum = nullptr ; @@ -867,8 +870,8 @@ private: } // Spot Removal - if (params.spot.enabled && !params.spot.entries.empty ()) { - ipf.removeSpots (baseImg, imgsrc, params.spot.entries, pp, currWB, nullptr, tr); + if (params.spot.enabled && !params.spot.entries.empty()) { + ipf.removeSpots(baseImg, imgsrc, params.spot.entries, pp, currWB, nullptr, tr); } // at this stage, we can flush the raw data to free up quite an important amount of memory @@ -979,7 +982,7 @@ private: } ipf.transform(baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh, - imgsrc->getMetaData(), imgsrc->getRotateDegree(), true, true); + imgsrc->getMetaData(), imgsrc->getRotateDegree(), true, true); if (trImg != baseImg) { delete baseImg; @@ -995,14 +998,29 @@ private: ImProcFunctions &ipf = * (ipf_p.get()); for (int sp = 0; sp < (int)params.locallab.spots.size(); sp++) { - if(params.locallab.spots.at(sp).expsharp && params.dirpyrequalizer.cbdlMethod == "bef") { - if(params.locallab.spots.at(sp).shardamping < 1) { - params.locallab.spots.at(sp).shardamping = 1; - } - } - } + if (params.locallab.spots.at(sp).expsharp && params.dirpyrequalizer.cbdlMethod == "bef") { + if (params.locallab.spots.at(sp).shardamping < 1) { + params.locallab.spots.at(sp).shardamping = 1; + } + } + } - if (params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { + bool execcam = false; + + //execcam => work around for pre-ciecam in LA: about 0.1 second + for (int sp = 0; sp < (int)params.locallab.spots.size(); sp++) { + if (params.locallab.spots.at(sp).expprecam) { + execcam = true; + } + } + if ((params.dirpyrequalizer.cbdlMethod == "bef") && (params.dirpyrequalizer.enabled || execcam) && !params.colorappearance.enabled) { + if (execcam && !params.dirpyrequalizer.enabled) { + params.dirpyrequalizer.enabled = true; + + if (params.dirpyrequalizer.mult[0] == 1.) { + params.dirpyrequalizer.mult[0] = 1.01; + } + } const int W = baseImg->getWidth(); const int H = baseImg->getHeight(); LabImage labcbdl(W, H); @@ -1037,6 +1055,7 @@ private: LocLLmaskCurve locllmasCurve; LocHHmaskCurve lochhmasCurve; LocHHmaskCurve lochhhmasCurve; + LocHHmaskCurve lochhhmascieCurve; LocCCmaskCurve locccmasexpCurve; LocLLmaskCurve locllmasexpCurve; LocHHmaskCurve lochhmasexpCurve; @@ -1075,6 +1094,7 @@ private: LocwavCurve loclmasCurveblwav; LocwavCurve loclmasCurvecolwav; + LocwavCurve loclmasCurveciewav; LocwavCurve loclmasCurve_wav; LocwavCurve locwavCurve; LocwavCurve locwavCurvejz; @@ -1114,6 +1134,7 @@ private: LUTf czjzlocalcurve(65536, LUT_CLIP_OFF); array2D shbuffer; + for (size_t sp = 0; sp < params.locallab.spots.size(); sp++) { if (params.locallab.spots.at(sp).inverssha) { shbuffer(fw, fh); @@ -1136,6 +1157,7 @@ private: const bool llmasutili = locllmasCurve.Set(params.locallab.spots.at(sp).LLmaskcurve); const bool lhmasutili = lochhmasCurve.Set(params.locallab.spots.at(sp).HHmaskcurve); const bool lhhmasutili = lochhhmasCurve.Set(params.locallab.spots.at(sp).HHhmaskcurve); + const bool lhhmascieutili = lochhhmascieCurve.Set(params.locallab.spots.at(sp).HHhmaskciecurve); const bool lcmasexputili = locccmasexpCurve.Set(params.locallab.spots.at(sp).CCmaskexpcurve); const bool llmasexputili = locllmasexpCurve.Set(params.locallab.spots.at(sp).LLmaskexpcurve); const bool lhmasexputili = lochhmasexpCurve.Set(params.locallab.spots.at(sp).HHmaskexpcurve); @@ -1171,6 +1193,7 @@ private: const bool lhhmas_utili = lochhhmas_Curve.Set(params.locallab.spots.at(sp).HHhmask_curve); const bool lmasutiliblwav = loclmasCurveblwav.Set(params.locallab.spots.at(sp).LLmaskblcurvewav); const bool lmasutilicolwav = loclmasCurvecolwav.Set(params.locallab.spots.at(sp).LLmaskcolcurvewav); + const bool lmasutiliciewav = loclmasCurveciewav.Set(params.locallab.spots.at(sp).LLmaskciecurvewav); const bool lcmaslcutili = locccmaslcCurve.Set(params.locallab.spots.at(sp).CCmasklccurve); const bool llmaslcutili = locllmaslcCurve.Set(params.locallab.spots.at(sp).LLmasklccurve); const bool lmasutili_wav = loclmasCurve_wav.Set(params.locallab.spots.at(sp).LLmask_curvewav); @@ -1215,10 +1238,15 @@ private: double shcompr = params.locallab.spots.at(sp).shcompr; double br = params.locallab.spots.at(sp).lightness; double cont = params.locallab.spots.at(sp).contrast; - if (lblack < 0. && params.locallab.spots.at(sp).expMethod == "pde" ) { + + if (lblack < 0. && params.locallab.spots.at(sp).expMethod == "pde") { lblack *= 1.5; } + float contsig = params.locallab.spots.at(sp).contsigqcie; + + float lightsig = params.locallab.spots.at(sp).lightsigqcie; + // Reference parameters computation double huere, chromare, lumare, huerefblu, chromarefblu, lumarefblu, sobelre; int lastsav; @@ -1228,12 +1256,17 @@ private: float meanretie; float stdretie; float fab = 1.f; + float maxicam = -1000.f; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + int ill = 2; if (params.locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reservView.get(), reservView.get(), 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge, locwavCurveden, locwavdenutili); } else { ipf.calc_ref(sp, labView, labView, 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge, locwavCurveden, locwavdenutili); } + CurveFactory::complexCurvelocal(ecomp, lblack / 65535., lhlcompr, lhlcomprthresh, shcompr, br, cont, lumare, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, avge, 1); @@ -1247,7 +1280,7 @@ private: float Tmax; float highresi = 0.f; float nresi = 0.f; - float highresi46 =0.f; + float highresi46 = 0.f; float nresi46 = 0.f; float Lhighresi = 0.f; float Lnresi = 0.f; @@ -1256,60 +1289,61 @@ private: // No Locallab mask is shown in exported picture ipf.Lab_Local(2, sp, shbuffer, labView, labView, reservView.get(), savenormtmView.get(), savenormretiView.get(), lastorigView.get(), fw, fh, 0, 0, fw, fh, 1, locRETgainCurve, locRETtransCurve, - lllocalcurve, locallutili, - cllocalcurve, localclutili, - lclocalcurve, locallcutili, - loclhCurve, lochhCurve, locchCurve, - lochhCurvejz, locchCurvejz,loclhCurvejz, - lmasklocalcurve, localmaskutili, - lmaskexplocalcurve, localmaskexputili, - lmaskSHlocalcurve, localmaskSHutili, - lmaskviblocalcurve, localmaskvibutili, - lmasktmlocalcurve, localmasktmutili, - lmaskretilocalcurve, localmaskretiutili, - lmaskcblocalcurve, localmaskcbutili, - lmaskbllocalcurve, localmaskblutili, - lmasklclocalcurve, localmasklcutili, - lmaskloglocalcurve, localmasklogutili, - lmasklocal_curve, localmask_utili, - lmaskcielocalcurve, localmaskcieutili, - cielocalcurve, localcieutili, - cielocalcurve2, localcieutili2, - jzlocalcurve, localjzutili, - czlocalcurve, localczutili, - czjzlocalcurve, localczjzutili, + lllocalcurve, locallutili, + cllocalcurve, localclutili, + lclocalcurve, locallcutili, + loclhCurve, lochhCurve, locchCurve, + lochhCurvejz, locchCurvejz, loclhCurvejz, + lmasklocalcurve, localmaskutili, + lmaskexplocalcurve, localmaskexputili, + lmaskSHlocalcurve, localmaskSHutili, + lmaskviblocalcurve, localmaskvibutili, + lmasktmlocalcurve, localmasktmutili, + lmaskretilocalcurve, localmaskretiutili, + lmaskcblocalcurve, localmaskcbutili, + lmaskbllocalcurve, localmaskblutili, + lmasklclocalcurve, localmasklcutili, + lmaskloglocalcurve, localmasklogutili, + lmasklocal_curve, localmask_utili, + lmaskcielocalcurve, localmaskcieutili, + cielocalcurve, localcieutili, + cielocalcurve2, localcieutili2, + jzlocalcurve, localjzutili, + czlocalcurve, localczutili, + czjzlocalcurve, localczjzutili, - locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, lochhhmasCurve, lhhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, - locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili, - locccmasvibCurve, lcmasvibutili, locllmasvibCurve, llmasvibutili, lochhmasvibCurve, lhmasvibutili, - locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, - locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, - locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, - locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, - locccmaslcCurve, lcmaslcutili, locllmaslcCurve, llmaslcutili, lochhmaslcCurve, lhmaslcutili, - locccmaslogCurve, lcmaslogutili, locllmaslogCurve, llmaslogutili, lochhmaslogCurve, lhmaslogutili, + locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, lochhhmasCurve, lhhmasutili, lochhhmascieCurve, lhhmascieutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, + locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili, + locccmasvibCurve, lcmasvibutili, locllmasvibCurve, llmasvibutili, lochhmasvibCurve, lhmasvibutili, + locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, + locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, + locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, + locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, + locccmaslcCurve, lcmaslcutili, locllmaslcCurve, llmaslcutili, lochhmaslcCurve, lhmaslcutili, + locccmaslogCurve, lcmaslogutili, locllmaslogCurve, llmaslogutili, lochhmaslogCurve, lhmaslogutili, - locccmas_Curve, lcmas_utili, locllmas_Curve, llmas_utili, lochhmas_Curve, lhmas_utili, - locccmascieCurve, lcmascieutili, locllmascieCurve, llmascieutili, lochhmascieCurve, lhmascieutili, - lochhhmas_Curve, lhhmas_utili, - loclmasCurveblwav,lmasutiliblwav, - loclmasCurvecolwav,lmasutilicolwav, - locwavCurve, locwavutili, - locwavCurvejz, locwavutilijz, - loclevwavCurve, loclevwavutili, - locconwavCurve, locconwavutili, - loccompwavCurve, loccompwavutili, - loccomprewavCurve, loccomprewavutili, - locwavCurvehue, locwavhueutili, - locwavCurveden, locwavdenutili, - locedgwavCurve, locedgwavutili, - loclmasCurve_wav,lmasutili_wav, - LHutili, HHutili, CHutili, HHutilijz, CHutilijz, LHutilijz, cclocalcurve, localcutili, rgblocalcurve, localrgbutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, - huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, - meantme, stdtme, meanretie, stdretie, fab, - highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46 -); + locccmas_Curve, lcmas_utili, locllmas_Curve, llmas_utili, lochhmas_Curve, lhmas_utili, + locccmascieCurve, lcmascieutili, locllmascieCurve, llmascieutili, lochhmascieCurve, lhmascieutili, + lochhhmas_Curve, lhhmas_utili, + loclmasCurveblwav, lmasutiliblwav, + loclmasCurvecolwav, lmasutilicolwav, + loclmasCurveciewav, lmasutiliciewav, + locwavCurve, locwavutili, + locwavCurvejz, locwavutilijz, + loclevwavCurve, loclevwavutili, + locconwavCurve, locconwavutili, + loccompwavCurve, loccompwavutili, + loccomprewavCurve, loccomprewavutili, + locwavCurvehue, locwavhueutili, + locwavCurveden, locwavdenutili, + locedgwavCurve, locedgwavutili, + loclmasCurve_wav, lmasutili_wav, + LHutili, HHutili, CHutili, HHutilijz, CHutilijz, LHutilijz, cclocalcurve, localcutili, rgblocalcurve, localrgbutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, + huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, + meantme, stdtme, meanretie, stdretie, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, ill, contsig, lightsig, + highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46 + ); if (sp + 1u < params.locallab.spots.size()) { // do not copy for last spot as it is not needed anymore @@ -1407,7 +1441,7 @@ private: ipf.rgbProc(baseImg, labView, nullptr, curve1, curve2, curve, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve, options.chunkSizeRGB, options.measure); if (settings->verbose) { - printf ("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", static_cast(autor), static_cast(autog), static_cast(autob)); + printf("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", static_cast(autor), static_cast(autog), static_cast(autob)); } // if clut was used and size of clut cache == 1 we free the memory used by the clutstore (default clut cache size = 1 for 32 bit OS) @@ -1476,21 +1510,21 @@ private: if (params.colorToning.enabled && params.colorToning.method == "LabGrid") { - ipf.colorToningLabGrid(labView, 0,labView->W , 0, labView->H, false); + ipf.colorToningLabGrid(labView, 0, labView->W, 0, labView->H, false); } - ipf.shadowsHighlights(labView, params.sh.enabled, params.sh.lab,params.sh.highlights ,params.sh.shadows, params.sh.radius, 1, params.sh.htonalwidth, params.sh.stonalwidth); + ipf.shadowsHighlights(labView, params.sh.enabled, params.sh.lab, params.sh.highlights, params.sh.shadows, params.sh.radius, 1, params.sh.htonalwidth, params.sh.stonalwidth); if (params.localContrast.enabled) { // Alberto's local contrast - ipf.localContrast(labView, labView->L, params.localContrast, false, 1);//scale); + ipf.localContrast(labView, labView->L, params.localContrast, false, 1);//scale); } ipf.chromiLuminanceCurve(nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { - ipf.EPDToneMap (labView, 0, 1); + ipf.EPDToneMap(labView, 0, 1); } @@ -1500,7 +1534,7 @@ private: // for all treatments Defringe, Sharpening, Contrast detail ,Microcontrast they are activated if "CIECAM" function are disabled if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - ipf.impulsedenoise (labView); + ipf.impulsedenoise(labView); ipf.defringe(labView); } @@ -1528,7 +1562,8 @@ private: } } - if ((params.wavelet.enabled)) { + int savestr = params.wavelet.strength;//work around for abstract profile: time about = 0.1 second + if ((params.wavelet.enabled) || (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE && params.icm.trcExp)) { LabImage *unshar = nullptr; WaveletParams WaveParams = params.wavelet; WavCurve wavCLVCurve; @@ -1548,12 +1583,9 @@ private: bool proton = WaveParams.exptoning; bool pronois = WaveParams.expnoise; -/* - if(WaveParams.showmask) { - WaveParams.showmask = false; - WaveParams.expclari = true; + if(params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE && params.icm.trcExp) { + params.wavelet.strength = 0; } -*/ if (WaveParams.softrad > 0.f) { provradius = new LabImage(*labView, true); } @@ -1614,6 +1646,7 @@ private: tmpImage->b(ir, jr) = Z; ble[ir][jr] = Y / 32768.f; } + double epsilmax = 0.0001; double epsilmin = 0.00001; double aepsil = (epsilmax - epsilmin) / 100.f; @@ -1639,7 +1672,8 @@ private: Color::XYZ2Lab(X, Y, Z, L, a, b); labView->L[ir][jr] = L; } - delete tmpImage; + + delete tmpImage; } } @@ -1685,15 +1719,17 @@ private: wavCLVCurve.Reset(); } + params.wavelet.strength = savestr; ipf.softLight(labView, params.softlight); - if (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE) { + if (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE && params.icm.trcExp) { const int GW = labView->W; const int GH = labView->H; std::unique_ptr provis; const float pres = 0.01f * params.icm.preser; + if (pres > 0.f && params.icm.wprim != ColorManagementParams::Primaries::DEFAULT) { provis.reset(new LabImage(GW, GH)); provis->CopyFrom(labView); @@ -1713,23 +1749,69 @@ private: cmsHTRANSFORM dummy = nullptr; int ill = 0; - ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, ill, 0, dummy, true, false, false); - ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, illum, prim, dummy, false, true, true); + bool gamutcontrol = params.icm.gamut; + int catc = toUnderlying(params.icm.wcat); + int locprim = 0; + float rdx, rdy, grx, gry, blx, bly = 0.f; + float meanx, meany, meanxe, meanye = 0.f; + ipf.workingtrc(0, tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, 0, ill, 0, 0, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, dummy, true, false, false, false); + ipf.workingtrc(0, tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, catc, illum, prim, locprim, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, dummy, false, true, true, gamutcontrol); + const int midton = params.icm.wmidtcie; + if(midton != 0) { + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[2] = midton; + params.bands[4] = 0; + params.bands[5] = 0; + int mid = abs(midton); + int threshmid = 50; + if(mid > threshmid) { + params.bands[1] = sign(midton) * (mid - threshmid); + params.bands[3] = sign(midton) * (mid - threshmid); + } + ipf.toneEqualizer(tmpImage1.get(), params, prof, 1, false); + } + + const bool smoothi = params.icm.wsmoothcie; + if(smoothi) { + ToneEqualizerParams params; + params.enabled = true; + params.regularization = 0.f; + params.pivot = 0.f; + params.bands[0] = 0; + params.bands[1] = 0; + params.bands[2] = 0; + params.bands[3] = 0; + params.bands[4] = -40;//arbitrary value to adapt with WhiteEvjz - here White Ev # 10 + params.bands[5] = -80;//8 Ev and above + bool Evsix = true; + if(Evsix) {//EV = 6 majority of images + params.bands[4] = -15; + } + + ipf.toneEqualizer(tmpImage1.get(), params, prof, 1, false); + } ipf.rgb2lab(*tmpImage1, *labView, params.icm.workingProfile); + // labView and provis - if(provis) { + if (provis) { ipf.preserv(labView, provis.get(), GW, GH); } - if(params.icm.fbw) { + + if (params.icm.fbw) { #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif - for (int x = 0; x < GH; x++) - for (int y = 0; y < GW; y++) { - labView->a[x][y] = 0.f; - labView->b[x][y] = 0.f; - } + + for (int x = 0; x < GH; x++) + for (int y = 0; y < GW; y++) { + labView->a[x][y] = 0.f; + labView->b[x][y] = 0.f; + } } } @@ -1768,7 +1850,7 @@ private: adap = 2000.; }//if no exif data or wrong else { - double E_V = fcomp + log2 ((fnum * fnum) / fspeed / (fiso / 100.f)); + double E_V = fcomp + log2((fnum * fnum) / fspeed / (fiso / 100.f)); double kexp = 0.; E_V += kexp * params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV E_V += 0.5 * log2(params.raw.expos); // exposure raw white point ; log2 ==> linear to EV @@ -1780,7 +1862,7 @@ private: float CAMMean = NAN; float d, dj, yb; - ipf.ciecam_02float (cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 0, 1, true, d, dj, yb, 1); + ipf.ciecam_02float(cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 0, 1, true, d, dj, yb, 1); } delete cieView; @@ -1896,21 +1978,26 @@ private: } Exiv2Metadata info(imgsrc->getFileName()); + switch (params.metadata.mode) { - case MetaDataParams::TUNNEL: - readyImg->setMetadata(std::move(info)); - break; - case MetaDataParams::EDIT: - info.setExif(params.metadata.exif); - info.setIptc(params.metadata.iptc); - if (!(params.metadata.exifKeys.size() == 1 && params.metadata.exifKeys[0] == "*")) { - info.setExifKeys(&(params.metadata.exifKeys)); - } - readyImg->setMetadata(std::move(info)); - break; - default: // case MetaDataParams::STRIP - // nothing to do - break; + case MetaDataParams::TUNNEL: + readyImg->setMetadata(std::move(info)); + break; + + case MetaDataParams::EDIT: + info.setExif(params.metadata.exif); + info.setIptc(params.metadata.iptc); + + if (!(params.metadata.exifKeys.size() == 1 && params.metadata.exifKeys[0] == "*")) { + info.setExifKeys(&(params.metadata.exifKeys)); + } + + readyImg->setMetadata(std::move(info)); + break; + + default: // case MetaDataParams::STRIP + // nothing to do + break; } diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index b563cbd3b..0390ef869 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -888,7 +888,8 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) curveMode3Changed(); // This will set the correct sensitive state of depending Adjusters nexttemp = pp->wb.temperature; - nextgreen = 1.; //pp->wb.green; + //nextgreen = 1.; //pp->wb.green; + nextgreen = pp->wb.green; if (pedited) { degree->setEditedState (pedited->colorappearance.degree ? Edited : UnEdited); @@ -1519,7 +1520,7 @@ void ColorAppearance::catmethodChanged() ybout->resetValue (false); tempout->resetValue (false); tempout->setAutoValue (true); - greenout->resetValue (false); + greenout->resetValue (true); enableListener(); } else if (catmethod->get_active_row_number() == 2) { disableListener(); @@ -1887,8 +1888,10 @@ void ColorAppearance::wbCamChanged (double temp, double tin) { disableListener(); tempout->setValue(temp); - greenout->setValue(tin); + greenout->setValue(tin); enableListener(); + listener->panelChanged (EvCATgreenout, greenout->getTextValue()); + listener->panelChanged (EvCATtempout, tempout->getTextValue()); return false; } ); diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index 3ad1b01e4..d5e570994 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -647,7 +647,7 @@ void ColorToning::read (const ProcParams* pp, const ParamsEdited* pedited) lastLumamode = pp->colorToning.lumamode; - labgrid->setParams(pp->colorToning.labgridALow / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridBLow / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridAHigh / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridBHigh / ColorToningParams::LABGRID_CORR_MAX, 0, 0, 0, 0,false); + labgrid->setParams(pp->colorToning.labgridALow / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridBLow / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridAHigh / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridBHigh / ColorToningParams::LABGRID_CORR_MAX, 0, 0, 0, 0, 0, 0,false); if (pedited && !pedited->colorToning.method) { method->set_active (7); @@ -719,7 +719,7 @@ void ColorToning::write (ProcParams* pp, ParamsEdited* pedited) double zerox = 0.; double zeroy = 0.; - labgrid->getParams(pp->colorToning.labgridALow, pp->colorToning.labgridBLow, pp->colorToning.labgridAHigh, pp->colorToning.labgridBHigh, zerox, zeroy, zerox, zeroy); + labgrid->getParams(pp->colorToning.labgridALow, pp->colorToning.labgridBLow, pp->colorToning.labgridAHigh, pp->colorToning.labgridBHigh, zerox, zeroy, zerox, zeroy, zerox, zeroy); pp->colorToning.labgridALow *= ColorToningParams::LABGRID_CORR_MAX; pp->colorToning.labgridAHigh *= ColorToningParams::LABGRID_CORR_MAX; pp->colorToning.labgridBLow *= ColorToningParams::LABGRID_CORR_MAX; @@ -835,7 +835,7 @@ void ColorToning::setDefaults (const ProcParams* defParams, const ParamsEdited* hlColSat->setDefault (defParams->colorToning.hlColSat); shadowsColSat->setDefault (defParams->colorToning.shadowsColSat); strength->setDefault (defParams->colorToning.strength); - labgrid->setDefault(defParams->colorToning.labgridALow / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridBLow / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridAHigh / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridBHigh / ColorToningParams::LABGRID_CORR_MAX, 0, 0, 0, 0); + labgrid->setDefault(defParams->colorToning.labgridALow / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridBLow / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridAHigh / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridBHigh / ColorToningParams::LABGRID_CORR_MAX, 0, 0, 0, 0, 0, 0); if (pedited) { @@ -1435,7 +1435,7 @@ void ColorToning::labRegionGet(int idx) double la, lb; double zerox = 0.; double zeroy = 0.; - labRegionAB->getParams(la, lb, r.a, r.b, zerox, zeroy, zerox, zeroy); + labRegionAB->getParams(la, lb, r.a, r.b, zerox, zeroy, zerox, zeroy, zerox, zeroy); r.saturation = labRegionSaturation->getValue(); r.slope = labRegionSlope->getValue(); r.offset = labRegionOffset->getValue(); @@ -1573,7 +1573,7 @@ void ColorToning::labRegionShow(int idx, bool list_only) rtengine::procparams::ColorToningParams::LabCorrectionRegion dflt; auto &r = labRegionData[idx]; if (!list_only) { - labRegionAB->setParams(0, 0, r.a, r.b,0, 0, 0, 0, false); + labRegionAB->setParams(0, 0, r.a, r.b,0, 0, 0, 0, 0, 0, false); labRegionSaturation->setValue(r.saturation); labRegionSlope->setValue(r.slope); labRegionOffset->setValue(r.offset); diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 12eea86cc..31510acbc 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -66,15 +66,16 @@ ControlSpotPanel::ControlSpotPanel(): locYT_(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT_T"), 2, 3000, 1, 150))), centerX_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_X"), -1000, 1000, 1, 0))), centerY_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_Y"), -1000, 1000, 1, 0))), - circrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CIRCRADIUS"), 2, 150, 1, 18))), + circrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CIRCRADIUS"), 1.5, 150., 0.5, 18.))), transit_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSITVALUE"), 2., 100., 0.1, 60.))), transitweak_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSITWEAK"), 0.5, 25.0, 0.1, 1.0))), transitgrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSITGRAD"), -1.0, 1.0, 0.01, 0.0))), feather_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FEATVALUE"), 10., 100., 0.1, 25.))), struc_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1.0, 12.0, 0.1, 4.0))), - thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0.0, 10.0, 0.1, 2.0))), + thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0.0, 15.0, 0.1, 2.0))), iter_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0.2, 10.0, 0.1, 2.0))), - balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("circle-multicolor-small")), Gtk::manage(new RTImage("circle-white-small"))))), + // balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.05, 2.5, 0.05, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16")), Gtk::manage(new RTImage("circle-white-small"))))), + balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.05, 2.5, 0.05, 1.0, Gtk::manage(new RTImage("circle-yellow-small")), Gtk::manage(new RTImage("circle-white-small"))))), balanh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALANH"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("circle-multicolor-small")), Gtk::manage(new RTImage("circle-red-green-small"))))), colorde_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORDE"), -15, 15, 2, 5, Gtk::manage(new RTImage("circle-blue-yellow-small")), Gtk::manage(new RTImage("circle-gray-green-small"))))), colorscope_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORSCOPE"), 0., 100.0, 1., 30.))), @@ -1456,7 +1457,7 @@ void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval) } if (a == circrad_) { - row[spots_.circrad] = circrad_->getIntValue(); + row[spots_.circrad] = circrad_->getValue(); updateControlSpotCurve(row); diff --git a/rtgui/iccprofilecreator.cc b/rtgui/iccprofilecreator.cc index 542234db2..eeca55265 100644 --- a/rtgui/iccprofilecreator.cc +++ b/rtgui/iccprofilecreator.cc @@ -32,7 +32,24 @@ #include "rtimage.h" #include "rtwindow.h" -const char* sTRCPreset[] = {"BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linear_g1.0", "standard_g2.2", "standard_g1.8", "High_g1.3_s3.35", "Low_g2.6_s6.9", "Lab_g3.0s9.03296"}; //gamma free +const char* sTRCPreset[] = {"BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linear_g1.0", "standard_g2.2", "standard_g1.8", "High_g1.3_s3.35", "Low_g2.6_s6.9", "Lab_g3.0s9.03296" /*, "PQ", "HLG" */}; //gamma free + + +// code take in ART thanks to Alberto Griggio +cmsToneCurve *make_trc(size_t size, float (*trcFunc)(float, bool)) +{ + std::vector values(size); + + for (size_t i = 0; i < size; ++i) { + float x = float(i) / (size - 1); + float y = trcFunc(x, false); //, 1.0f); + values[i] = y; + } + + cmsToneCurve *result = cmsBuildTabulatedToneCurveFloat(NULL, size, &values[0]); + return result; +} +/// ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow) : Gtk::Dialog(M("MAIN_BUTTON_ICCPROFCREATOR"), *rtwindow, true) @@ -1305,6 +1322,10 @@ void ICCProfileCreator::savePressed() GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildGamma(NULL, 1.0); } else if(gammaPreset == "Custom" && slope == 0.0) { GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildGamma(NULL, gamma); +// } else if(gammaPreset == "PQ") { +// GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = make_trc(4096, &rtengine::Color::eval_PQ_curve); //thanks to Alberto Griggio +// } else if(gammaPreset == "HLG") { +// GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = make_trc(4096, &rtengine::Color::eval_HLG_curve); //thanks to Alberto Griggio } else { GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, ga); } diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 772f8e38e..649978cf9 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -65,12 +65,20 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu EvICMLabGridciexy = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICL_LABGRIDCIEXY"); EvICMfbw = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_FBW"); EvICMgamut = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_GAMUT"); + EvICMcat = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_CAT"); + EvICMrefi = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_REFI"); + EvICMtrcExp = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_TRCEXP"); + EvICMshiftx = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_SHIFTX"); + EvICMshifty = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_SHIFTY"); + EvICMwmidtcie = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_MIDTCIE"); + EvICMwsmoothcie = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_SMOOTHCIE"); + isBatchMode = lastToneCurve = lastApplyLookTable = lastApplyBaselineExposureOffset = lastApplyHueSatMap = false; ipDialog = Gtk::manage(new MyFileChooserButton(M("TP_ICM_INPUTDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN)); ipDialog->set_tooltip_text(M("TP_ICM_INPUTCUSTOM_TOOLTIP")); bindCurrentFolder(*ipDialog, options.lastIccDir); - labgridcie = Gtk::manage(new LabGrid(EvICMLabGridciexy, M("TP_ICM_LABGRID_CIEXY"), true, true)); + labgridcie = Gtk::manage(new LabGrid(EvICMLabGridciexy, M("TP_ICM_LABGRID_CIEXY"), true, true, true)); // ------------------------------- Input profile @@ -205,12 +213,13 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu //-----------------gamma TRC working // Gtk::Frame *trcFrame = Gtk::manage(new Gtk::Frame(M("TP_ICM_TRCFRAME"))); - trcExp = Gtk::manage(new MyExpander(false, M("TP_ICM_TRCFRAME"))); + trcExp = Gtk::manage(new MyExpander(true, M("TP_ICM_TRCFRAME"))); setExpandAlignProperties(trcExp, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); // trcFrame->set_label_align(0.025, 0.5); Gtk::Box *trcProfVBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); trcExp->set_tooltip_text(M("TP_ICM_TRCFRAME_TOOLTIP")); trcExp->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &ICMPanel::foldAllButMe), trcExp) ); + trcExpconn = trcExp->signal_enabled_toggled().connect(sigc::mem_fun(*this, &ICMPanel::trcExpChanged)); wTRCBox = Gtk::manage(new Gtk::Box()); @@ -233,11 +242,19 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu wGamma = Gtk::manage(new Adjuster(M("TP_ICM_WORKING_TRC_GAMMA"), 0.40, 15.0, 0.001, 2.222)); wSlope = Gtk::manage(new Adjuster(M("TP_ICM_WORKING_TRC_SLOPE"), 0., 300., 0.01, 4.5)); + wmidtcie = Gtk::manage(new Adjuster(M("TP_LOCALLAB_MIDTCIE"), -100., 100., 1., 0.)); + wsmoothcie = Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SMOOTHCIE"))); trcProfVBox->pack_start(*wGamma, Gtk::PACK_SHRINK); wGamma->show(); trcProfVBox->pack_start(*wSlope, Gtk::PACK_SHRINK); wSlope->show(); + trcProfVBox->pack_start(*wmidtcie, Gtk::PACK_SHRINK); + wmidtcie->show(); + trcProfVBox->pack_start(*wsmoothcie, Gtk::PACK_SHRINK); + wsmoothcie->show(); + wsmoothcieconn = wsmoothcie->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::wsmoothcieChanged)); + wsmoothcie->set_active(false); willuBox = Gtk::manage(new Gtk::Box()); willulab = Gtk::manage(new Gtk::Label(M("TP_ICM_WORKING_ILLU") + ":")); @@ -257,6 +274,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu will->append(M("TP_ICM_WORKING_ILLU_STDA")); will->append(M("TP_ICM_WORKING_ILLU_2000")); will->append(M("TP_ICM_WORKING_ILLU_1500")); + will->append(M("TP_ICM_WORKING_ILLU_E")); will->set_active(0); will->set_tooltip_text(M("TP_ICM_ILLUMPRIM_TOOLTIP")); @@ -270,11 +288,11 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu fbw = Gtk::manage(new Gtk::CheckButton((M("TP_ICM_FBW")))); fbw->set_active(true); gamut = Gtk::manage(new Gtk::CheckButton((M("TP_ICM_GAMUT")))); - gamut->set_active(false); + gamut->set_active(true); trcProfVBox->pack_start(*wprimBox, Gtk::PACK_EXPAND_WIDGET); trcProfVBox->pack_start(*fbw, Gtk::PACK_EXPAND_WIDGET); - trcProfVBox->pack_start(*gamut, Gtk::PACK_EXPAND_WIDGET); +// trcProfVBox->pack_start(*gamut, Gtk::PACK_EXPAND_WIDGET); neutral = Gtk::manage (new Gtk::Button (M ("TP_ICM_NEUTRAL"))); setExpandAlignProperties (neutral, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); @@ -296,6 +314,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu wprim->append(M("TP_ICM_WORKING_PRIM_WID")); wprim->append(M("TP_ICM_WORKING_PRIM_AC0")); wprim->append(M("TP_ICM_WORKING_PRIM_JDCMAX")); + wprim->append(M("TP_ICM_WORKING_PRIM_JDCMAXSTDA")); wprim->append(M("TP_ICM_WORKING_PRIM_BRU")); wprim->append(M("TP_ICM_WORKING_PRIM_BET")); wprim->append(M("TP_ICM_WORKING_PRIM_BST")); @@ -327,6 +346,10 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu redFrame->set_label_align(0.025, 0.5); redFrame->set_tooltip_text(M("TP_ICM_WORKING_PRIMFRAME_TOOLTIP")); + colorFramecie = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_COLORFRAME"))); + colorFramecie->set_label_align(0.025, 0.5); + colorFramecie->set_tooltip_text(M("TP_LOCALLAB_PRECAMREFIMAIN_TOOLTIP")); + Gtk::Box *redVBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); primCoordGrid = Gtk::manage(new Gtk::Grid()); primCoordGrid->set_column_homogeneous(true); @@ -355,22 +378,53 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu redVBox->pack_start(*cielab, Gtk::PACK_SHRINK); redVBox->pack_start(*labgridcie, Gtk::PACK_EXPAND_WIDGET, 4); + redVBox->pack_start(*gamut, Gtk::PACK_EXPAND_WIDGET); + refi = Gtk::manage(new Adjuster(M("TC_PRIM_REFI"), -0.5, 1., 0.0001, 0.)); + shiftx = Gtk::manage(new Adjuster(M("TC_LOCALLAB_PRIM_SHIFTX"), -0.2, 0.2, 0.0001, 0.)); + shifty = Gtk::manage(new Adjuster(M("TC_LOCALLAB_PRIM_SHIFTY"), -0.2, 0.2, 0.0001, 0.)); + + wcatBox = Gtk::manage(new Gtk::Box()); + wcatlab = Gtk::manage(new Gtk::Label(M("TP_ICM_WORKING_CAT") + ":")); + wcatBox->pack_start(*wcatlab, Gtk::PACK_SHRINK); + wcat = Gtk::manage(new MyComboBoxText()); + wcatBox->pack_start(*wcat, Gtk::PACK_EXPAND_WIDGET); + + wcat->append(M("TP_ICM_WORKING_CAT_BRAD")); + wcat->append(M("TP_ICM_WORKING_CAT_CAT16")); + wcat->append(M("TP_ICM_WORKING_CAT_CAT02")); + wcat->append(M("TP_ICM_WORKING_CAT_VK")); + wcat->append(M("TP_ICM_WORKING_CAT_XYZ")); + wcat->set_active(0); + redVBox->pack_start(*wcatBox, Gtk::PACK_SHRINK); + + ToolParamBlock* const colorBox = Gtk::manage(new ToolParamBlock()); + + colorBox->pack_start(*refi, Gtk::PACK_EXPAND_WIDGET); + colorBox->pack_start(*shiftx, Gtk::PACK_EXPAND_WIDGET); + colorBox->pack_start(*shifty, Gtk::PACK_EXPAND_WIDGET); + colorFramecie->add(*colorBox); + redVBox->pack_start(*colorFramecie); redFrame->add(*redVBox); wGamma->setAdjusterListener(this); wSlope->setLogScale(16, 0); wSlope->setAdjusterListener(this); + wmidtcie->setAdjusterListener(this); redx->setAdjusterListener(this); redy->setAdjusterListener(this); grex->setAdjusterListener(this); grey->setAdjusterListener(this); blux->setAdjusterListener(this); bluy->setAdjusterListener(this); + refi->setAdjusterListener(this); + shiftx->setAdjusterListener(this); + shifty->setAdjusterListener(this); wGamma->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); wSlope->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); + wmidtcie->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); // Rendering intent riaHBox = Gtk::manage(new Gtk::Box()); @@ -479,6 +533,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu wtrcconn = wTRC->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wtrcinChanged)); willconn = will->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::willChanged)); wprimconn = wprim->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wprimChanged)); + wcatconn = wcat->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wcatChanged)); fbwconn = fbw->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::fbwChanged)); gamutconn = gamut->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::gamutChanged)); @@ -525,6 +580,8 @@ void ICMPanel::neutral_pressed () wprim->set_active(toUnderlying(ColorManagementParams::Primaries::ACES_P0)); } else if (wProfNames->get_active_text() == "JDCmax") { wprim->set_active(toUnderlying(ColorManagementParams::Primaries::JDC_MAX)); + } else if (wProfNames->get_active_text() == "JDCmax stdA") { + wprim->set_active(toUnderlying(ColorManagementParams::Primaries::JDC_MAXSTDA)); } else if (wProfNames->get_active_text() == "BruceRGB") { wprim->set_active(toUnderlying(ColorManagementParams::Primaries::BRUCE_RGB)); } else if (wProfNames->get_active_text() == "Beta RGB") { @@ -535,9 +592,11 @@ void ICMPanel::neutral_pressed () const ColorManagementParams defPar; wGamma->setValue(defPar.workingTRCGamma);//2.4 wSlope->setValue(defPar.workingTRCSlope);//12.92 + wmidtcie->setValue(defPar.wmidtcie); preser->setValue(defPar.preser); fbw->set_active(defPar.fbw); gamut->set_active(defPar.gamut); + wsmoothcie->set_active(defPar.wsmoothcie); wTRC->set_active(toUnderlying(ColorManagementParams::WorkingTrc::NONE));//reset to none will->set_active(toUnderlying(ColorManagementParams::Illuminant::DEFAULT));//reset to default - after wprim } @@ -614,7 +673,7 @@ void ICMPanel::primChanged (float rx, float ry, float bx, float by, float gx, fl ); } -void ICMPanel::iprimChanged (float r_x, float r_y, float b_x, float b_y, float g_x, float g_y, float w_x, float w_y) +void ICMPanel::iprimChanged (float r_x, float r_y, float b_x, float b_y, float g_x, float g_y, float w_x, float w_y, float m_x, float m_y) {//update CIE xy graph nextrx = r_x; nextry = r_y; @@ -624,6 +683,8 @@ void ICMPanel::iprimChanged (float r_x, float r_y, float b_x, float b_y, float g nextgy = g_y; nextwx = w_x; nextwy = w_y; + nextmx = m_x; + nextmy = m_y; //convert xy datas in datas for labgrid areas nextrx = 1.81818f * (nextrx + 0.1f) - 1.f; nextry = 1.81818f * (nextry + 0.1f) - 1.f; @@ -633,12 +694,14 @@ void ICMPanel::iprimChanged (float r_x, float r_y, float b_x, float b_y, float g nextgy = 1.81818f * (nextgy + 0.1f) - 1.f; nextwx = 1.81818f * (nextwx + 0.1f) - 1.f; nextwy = 1.81818f * (nextwy + 0.1f) - 1.f; + nextmx = 1.81818f * (nextmx + 0.1f) - 1.f; + nextmy = 1.81818f * (nextmy + 0.1f) - 1.f; idle_register.add( [this]() -> bool { disableListener(); - labgridcie->setParams(nextrx, nextry, nextbx, nextby, nextgx, nextgy, nextwx, nextwy, false); + labgridcie->setParams(nextrx, nextry, nextbx, nextby, nextgx, nextgy, nextwx, nextwy, nextmx, nextmy, false); enableListener(); return false; } @@ -793,6 +856,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) ConnectionBlocker obpcconn_(obpcconn); ConnectionBlocker fbwconn_(fbwconn); ConnectionBlocker gamutconn_(gamutconn); + ConnectionBlocker wsmoothcieconn_(wsmoothcieconn); ConnectionBlocker ipc_(ipc); ConnectionBlocker tcurveconn_(tcurveconn); ConnectionBlocker ltableconn_(ltableconn); @@ -806,6 +870,9 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) ConnectionBlocker wtrcconn_(wtrcconn); ConnectionBlocker willconn_(willconn); ConnectionBlocker wprimconn_(wprimconn); + ConnectionBlocker wcatconn_(wcatconn); + ConnectionBlocker trcExpconn_(trcExpconn); + trcExp->set_expanded(false); if (pp->icm.inputProfile.substr(0, 5) != "file:" && !ipDialog->get_filename().empty()) { @@ -847,10 +914,14 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) will->set_active(rtengine::toUnderlying(pp->icm.will)); wprim->set_active(rtengine::toUnderlying(pp->icm.wprim)); + wcat->set_active(rtengine::toUnderlying(pp->icm.wcat)); wtrcinChanged(); willChanged(); wprimChanged(); + wcatChanged(); + gamutChanged(); + wsmoothcieChanged(); if (pp->icm.outputProfile == ColorManagementParams::NoICMString) { oProfNames->set_active_text(M("TP_ICM_NOICM")); @@ -867,7 +938,9 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) obpc->set_active(pp->icm.outputBPC); fbw->set_active(pp->icm.fbw); + trcExp->setEnabled(pp->icm.trcExp); gamut->set_active(pp->icm.gamut); + wsmoothcie->set_active(pp->icm.wsmoothcie); ckbToneCurve->set_active(pp->icm.toneCurve); lastToneCurve = pp->icm.toneCurve; ckbApplyLookTable->set_active(pp->icm.applyLookTable); @@ -879,20 +952,26 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) wGamma->setValue(pp->icm.workingTRCGamma); wSlope->setValue(pp->icm.workingTRCSlope); + wmidtcie->setValue(pp->icm.wmidtcie); redx->setValue(pp->icm.redx); redy->setValue(pp->icm.redy); grex->setValue(pp->icm.grex); grey->setValue(pp->icm.grey); blux->setValue(pp->icm.blux); bluy->setValue(pp->icm.bluy); + refi->setValue(pp->icm.refi); + shiftx->setValue(pp->icm.shiftx); + shifty->setValue(pp->icm.shifty); preser->setValue(pp->icm.preser); - labgridcie->setParams(pp->icm.labgridcieALow, pp->icm.labgridcieBLow, pp->icm.labgridcieAHigh, pp->icm.labgridcieBHigh, pp->icm.labgridcieGx, pp->icm.labgridcieGy, pp->icm.labgridcieWx, pp->icm.labgridcieWy, false); + labgridcie->setParams(pp->icm.labgridcieALow, pp->icm.labgridcieBLow, pp->icm.labgridcieAHigh, pp->icm.labgridcieBHigh, pp->icm.labgridcieGx, pp->icm.labgridcieGy, pp->icm.labgridcieWx, pp->icm.labgridcieWy, pp->icm.labgridcieMx, pp->icm.labgridcieMy, false); if (pedited) { iunchanged->set_active(!pedited->icm.inputProfile); obpc->set_inconsistent(!pedited->icm.outputBPC); fbw->set_inconsistent(!pedited->icm.fbw); + trcExp->set_inconsistent(!pedited->icm.trcExp); gamut->set_inconsistent(!pedited->icm.gamut); + wsmoothcie->set_inconsistent(!pedited->icm.wsmoothcie); ckbToneCurve->set_inconsistent(!pedited->icm.toneCurve); ckbApplyLookTable->set_inconsistent(!pedited->icm.applyLookTable); ckbApplyBaselineExposureOffset->set_inconsistent(!pedited->icm.applyBaselineExposureOffset); @@ -929,17 +1008,26 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) if (!pedited->icm.wprim) { wprim->set_active_text(M("GENERAL_UNCHANGED")); } - labgridcie->setEdited(pedited->icm.labgridcieALow || pedited->icm.labgridcieBLow || pedited->icm.labgridcieAHigh || pedited->icm.labgridcieBHigh || pedited->icm.labgridcieGx || pedited->icm.labgridcieGy || pedited->icm.labgridcieWx || pedited->icm.labgridcieWy); + + if (!pedited->icm.wcat) { + wcat->set_active_text(M("GENERAL_UNCHANGED")); + } + + labgridcie->setEdited(pedited->icm.labgridcieALow || pedited->icm.labgridcieBLow || pedited->icm.labgridcieAHigh || pedited->icm.labgridcieBHigh || pedited->icm.labgridcieGx || pedited->icm.labgridcieGy || pedited->icm.labgridcieWx || pedited->icm.labgridcieWy || pedited->icm.labgridcieMx || pedited->icm.labgridcieMy); wGamma->setEditedState(pedited->icm.workingTRCGamma ? Edited : UnEdited); wSlope->setEditedState(pedited->icm.workingTRCSlope ? Edited : UnEdited); + wmidtcie->setEditedState(pedited->icm.wmidtcie ? Edited : UnEdited); redx->setEditedState(pedited->icm.redx ? Edited : UnEdited); redy->setEditedState(pedited->icm.redy ? Edited : UnEdited); grex->setEditedState(pedited->icm.grex ? Edited : UnEdited); grey->setEditedState(pedited->icm.grey ? Edited : UnEdited); blux->setEditedState(pedited->icm.blux ? Edited : UnEdited); bluy->setEditedState(pedited->icm.bluy ? Edited : UnEdited); + refi->setEditedState(pedited->icm.refi ? Edited : UnEdited); preser->setEditedState(pedited->icm.preser ? Edited : UnEdited); + shiftx->setEditedState(pedited->icm.shiftx ? Edited : UnEdited); + shifty->setEditedState(pedited->icm.shifty ? Edited : UnEdited); } @@ -947,11 +1035,15 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) case ColorManagementParams::WorkingTrc::NONE: { wSlope->set_sensitive(false); wGamma->set_sensitive(false); + wmidtcie->set_sensitive(false); will->set_sensitive(false); willulab->set_sensitive(false); wprim->set_sensitive(false); + wcat->set_sensitive(false); + wcatlab->set_sensitive(false); fbw->set_sensitive(false); gamut->set_sensitive(false); + wsmoothcie->set_sensitive(false); wprimlab->set_sensitive(false); riaHBox->set_sensitive(false); redFrame->hide(); @@ -962,8 +1054,17 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); + if (gamut->get_active()) { + wcatBox->set_sensitive(true); + } else { + wcatBox->set_sensitive(false); + } + fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) { redFrame->hide(); @@ -992,9 +1093,11 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) if (pp->icm.workingTRCGamma <= 1.) { wGamma->set_sensitive(true); wSlope->set_sensitive(false); + wmidtcie->set_sensitive(true); } else { wGamma->set_sensitive(true); wSlope->set_sensitive(true); + wmidtcie->set_sensitive(true); } break; } @@ -1002,14 +1105,24 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) case ColorManagementParams::WorkingTrc::BT709: wGamma->setValue(2.222); wSlope->setValue(4.5); - will->set_sensitive(true); + will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); + if (gamut->get_active()) { + wcatBox->set_sensitive(true); + } else { + wcatBox->set_sensitive(false); + } + fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); wGamma->set_sensitive(false); wSlope->set_sensitive(false); + wmidtcie->set_sensitive(true); if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) { redFrame->hide(); } else { @@ -1020,14 +1133,23 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) case ColorManagementParams::WorkingTrc::SRGB: wGamma->setValue(2.4); wSlope->setValue(12.92); - will->set_sensitive(true); + will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); + if (gamut->get_active()) { + wcatBox->set_sensitive(true); + } else { + wcatBox->set_sensitive(false); + } fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); wGamma->set_sensitive(false); wSlope->set_sensitive(false); + wmidtcie->set_sensitive(true); riaHBox->set_sensitive(true); if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) { redFrame->hide(); @@ -1038,15 +1160,24 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) case ColorManagementParams::WorkingTrc::GAMMA_2_2: wGamma->setValue(2.2); wSlope->setValue(0.); - will->set_sensitive(true); + will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); + if (gamut->get_active()) { + wcatBox->set_sensitive(true); + } else { + wcatBox->set_sensitive(false); + } fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); redFrame->show(); wGamma->set_sensitive(false); wSlope->set_sensitive(false); + wmidtcie->set_sensitive(true); riaHBox->set_sensitive(true); if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) { redFrame->hide(); @@ -1057,11 +1188,19 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) case ColorManagementParams::WorkingTrc::GAMMA_1_8: wGamma->setValue(1.8); wSlope->setValue(0.); - will->set_sensitive(true); + will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); + if (gamut->get_active()) { + wcatBox->set_sensitive(true); + } else { + wcatBox->set_sensitive(false); + } fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); riaHBox->set_sensitive(true); if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) { @@ -1071,18 +1210,28 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) } wGamma->set_sensitive(false); wSlope->set_sensitive(false); + wmidtcie->set_sensitive(true); break; case ColorManagementParams::WorkingTrc::LINEAR: wGamma->setValue(1.); wSlope->setValue(1.); - will->set_sensitive(true); + will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); + if (gamut->get_active()) { + wcatBox->set_sensitive(true); + } else { + wcatBox->set_sensitive(false); + } fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); wGamma->set_sensitive(false); wSlope->set_sensitive(false); + wmidtcie->set_sensitive(true); riaHBox->set_sensitive(true); if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) { redFrame->hide(); @@ -1102,6 +1251,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited) case ColorManagementParams::Primaries::WIDE_GAMUT: case ColorManagementParams::Primaries::ACES_P0: case ColorManagementParams::Primaries::JDC_MAX: + case ColorManagementParams::Primaries::JDC_MAXSTDA: case ColorManagementParams::Primaries::BRUCE_RGB: case ColorManagementParams::Primaries::BETA_RGB: case ColorManagementParams::Primaries::BEST_RGB: { @@ -1148,7 +1298,7 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited) pp->icm.workingProfile = wProfNames->get_active_text(); pp->icm.dcpIlluminant = rtengine::max(dcpIll->get_active_row_number(), 0); - labgridcie->getParams(pp->icm.labgridcieALow, pp->icm.labgridcieBLow, pp->icm.labgridcieAHigh, pp->icm.labgridcieBHigh, pp->icm.labgridcieGx, pp->icm.labgridcieGy, pp->icm.labgridcieWx, pp->icm.labgridcieWy); + labgridcie->getParams(pp->icm.labgridcieALow, pp->icm.labgridcieBLow, pp->icm.labgridcieAHigh, pp->icm.labgridcieBHigh, pp->icm.labgridcieGx, pp->icm.labgridcieGy, pp->icm.labgridcieWx, pp->icm.labgridcieWy, pp->icm.labgridcieMx, pp->icm.labgridcieMy); if (oProfNames->get_active_text() == M("TP_ICM_NOICM")) { pp->icm.outputProfile = ColorManagementParams::NoICMString; @@ -1175,6 +1325,7 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited) pp->icm.workingTRC = ColorManagementParams::WorkingTrc(wTRC->get_active_row_number()); pp->icm.will = ColorManagementParams::Illuminant(will->get_active_row_number()); pp->icm.wprim = ColorManagementParams::Primaries(wprim->get_active_row_number()); + pp->icm.wcat = ColorManagementParams::Cat(wcat->get_active_row_number()); pp->icm.toneCurve = ckbToneCurve->get_active(); pp->icm.applyLookTable = ckbApplyLookTable->get_active(); @@ -1182,15 +1333,21 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited) pp->icm.applyHueSatMap = ckbApplyHueSatMap->get_active(); pp->icm.outputBPC = obpc->get_active(); pp->icm.fbw = fbw->get_active(); + pp->icm.trcExp = trcExp->getEnabled(); pp->icm.gamut = gamut->get_active(); + pp->icm.wsmoothcie = wsmoothcie->get_active(); pp->icm.workingTRCGamma = wGamma->getValue(); pp->icm.workingTRCSlope = wSlope->getValue(); + pp->icm.wmidtcie = wmidtcie->getValue(); pp->icm.redx = redx->getValue(); pp->icm.redy = redy->getValue(); pp->icm.grex = grex->getValue(); pp->icm.grey = grey->getValue(); pp->icm.blux = blux->getValue(); pp->icm.bluy = bluy->getValue(); + pp->icm.refi = refi->getValue(); + pp->icm.shiftx = shiftx->getValue(); + pp->icm.shifty = shifty->getValue(); pp->toneCurve.fromHistMatching = false; pp->icm.preser = preser->getValue(); @@ -1202,7 +1359,9 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited) pedited->icm.aRendIntent = aRendIntent->getSelected() < 4; pedited->icm.outputBPC = !obpc->get_inconsistent(); pedited->icm.fbw = !fbw->get_inconsistent(); + pedited->icm.trcExp = !trcExp->get_inconsistent(); pedited->icm.gamut = !gamut->get_inconsistent(); + pedited->icm.wsmoothcie = !wsmoothcie->get_inconsistent(); pedited->icm.dcpIlluminant = dcpIll->get_active_text() != M("GENERAL_UNCHANGED"); pedited->icm.toneCurve = !ckbToneCurve->get_inconsistent(); pedited->icm.applyLookTable = !ckbApplyLookTable->get_inconsistent(); @@ -1210,12 +1369,14 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited) pedited->icm.applyHueSatMap = !ckbApplyHueSatMap->get_inconsistent(); pedited->icm.workingTRCGamma = wGamma->getEditedState(); pedited->icm.workingTRCSlope = wSlope->getEditedState(); + pedited->icm.wmidtcie = wmidtcie->getEditedState(); pedited->icm.workingTRC = wTRC->get_active_text() != M("GENERAL_UNCHANGED"); pedited->icm.will = will->get_active_text() != M("GENERAL_UNCHANGED"); pedited->icm.wprim = wprim->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->icm.wcat = wcat->get_active_text() != M("GENERAL_UNCHANGED"); pedited->icm.redx = redx->getEditedState(); pedited->icm.redy = redy->getEditedState(); - pedited->icm.labgridcieALow = pedited->icm.labgridcieBLow = pedited->icm.labgridcieAHigh = pedited->icm.labgridcieBHigh = pedited->icm.labgridcieGx = pedited->icm.labgridcieGy = pedited->icm.labgridcieWx = pedited->icm.labgridcieWy = labgridcie->getEdited(); + pedited->icm.labgridcieALow = pedited->icm.labgridcieBLow = pedited->icm.labgridcieAHigh = pedited->icm.labgridcieBHigh = pedited->icm.labgridcieGx = pedited->icm.labgridcieGy = pedited->icm.labgridcieWx = pedited->icm.labgridcieWy = pedited->icm.labgridcieMx = pedited->icm.labgridcieMy = labgridcie->getEdited(); } } @@ -1223,36 +1384,48 @@ void ICMPanel::setDefaults(const ProcParams* defParams, const ParamsEdited* pedi { wGamma->setDefault(defParams->icm.workingTRCGamma); wSlope->setDefault(defParams->icm.workingTRCSlope); + wmidtcie->setDefault(defParams->icm.wmidtcie); redx->setDefault(defParams->icm.redx); redy->setDefault(defParams->icm.redy); grex->setDefault(defParams->icm.grex); grey->setDefault(defParams->icm.grey); blux->setDefault(defParams->icm.blux); bluy->setDefault(defParams->icm.bluy); + refi->setDefault(defParams->icm.refi); + shiftx->setDefault(defParams->icm.shiftx); + shifty->setDefault(defParams->icm.shifty); preser->setDefault(defParams->icm.preser); - labgridcie->setDefault(defParams->icm.labgridcieALow, defParams->icm.labgridcieBLow , defParams->icm.labgridcieAHigh, defParams->icm.labgridcieBHigh, defParams->icm.labgridcieGx, defParams->icm.labgridcieGy, defParams->icm.labgridcieWx, defParams->icm.labgridcieWy); + labgridcie->setDefault(defParams->icm.labgridcieALow, defParams->icm.labgridcieBLow , defParams->icm.labgridcieAHigh, defParams->icm.labgridcieBHigh, defParams->icm.labgridcieGx, defParams->icm.labgridcieGy, defParams->icm.labgridcieWx, defParams->icm.labgridcieWy, defParams->icm.labgridcieMx, defParams->icm.labgridcieMy); if (pedited) { wGamma->setDefaultEditedState(pedited->icm.workingTRCGamma ? Edited : UnEdited); wSlope->setDefaultEditedState(pedited->icm.workingTRCSlope ? Edited : UnEdited); + wmidtcie->setDefaultEditedState(pedited->icm.wmidtcie ? Edited : UnEdited); redx->setDefaultEditedState(pedited->icm.redx ? Edited : UnEdited); redy->setDefaultEditedState(pedited->icm.redy ? Edited : UnEdited); grex->setDefaultEditedState(pedited->icm.grex ? Edited : UnEdited); grey->setDefaultEditedState(pedited->icm.grey ? Edited : UnEdited); blux->setDefaultEditedState(pedited->icm.blux ? Edited : UnEdited); bluy->setDefaultEditedState(pedited->icm.bluy ? Edited : UnEdited); - labgridcie->setEdited((pedited->icm.labgridcieALow || pedited->icm.labgridcieBLow || pedited->icm.labgridcieAHigh || pedited->icm.labgridcieBHigh || pedited->icm.labgridcieGx || pedited->icm.labgridcieGy || pedited->icm.labgridcieWx || pedited->icm.labgridcieWy) ? Edited : UnEdited); + refi->setDefaultEditedState(pedited->icm.refi ? Edited : UnEdited); + shiftx->setDefaultEditedState(pedited->icm.shiftx ? Edited : UnEdited); + shifty->setDefaultEditedState(pedited->icm.shifty ? Edited : UnEdited); + labgridcie->setEdited((pedited->icm.labgridcieALow || pedited->icm.labgridcieBLow || pedited->icm.labgridcieAHigh || pedited->icm.labgridcieBHigh || pedited->icm.labgridcieGx || pedited->icm.labgridcieGy || pedited->icm.labgridcieWx || pedited->icm.labgridcieWy || pedited->icm.labgridcieMx || pedited->icm.labgridcieMy) ? Edited : UnEdited); preser->setDefaultEditedState(pedited->icm.preser ? Edited : UnEdited); } else { wGamma->setDefaultEditedState(Irrelevant); wSlope->setDefaultEditedState(Irrelevant); + wmidtcie->setDefaultEditedState(Irrelevant); redx->setDefaultEditedState(Irrelevant); redy->setDefaultEditedState(Irrelevant); grex->setDefaultEditedState(Irrelevant); grey->setDefaultEditedState(Irrelevant); blux->setDefaultEditedState(Irrelevant); bluy->setDefaultEditedState(Irrelevant); + refi->setDefaultEditedState(Irrelevant); + shiftx->setDefaultEditedState(Irrelevant); + shifty->setDefaultEditedState(Irrelevant); preser->setDefaultEditedState(Irrelevant); labgridcie->setEdited(Edited); @@ -1273,6 +1446,8 @@ void ICMPanel::adjusterChanged(Adjuster* a, double newval) listener->panelChanged(EvICMgamm, costr2); } else if (a == wSlope) { listener->panelChanged(EvICMslop, costr2); + } else if (a == wmidtcie) { + listener->panelChanged(EvICMwmidtcie, costr2); } else if (a == redx) { listener->panelChanged(EvICMredx, costr2); } else if (a == redy) { @@ -1287,6 +1462,12 @@ void ICMPanel::adjusterChanged(Adjuster* a, double newval) listener->panelChanged(EvICMbluy, costr2); } else if (a == preser) { listener->panelChanged(EvICMpreser, costr2); + } else if (a == refi) { + listener->panelChanged(EvICMrefi, costr2); + } else if (a == shiftx) { + listener->panelChanged(EvICMshiftx, costr2); + } else if (a == shifty) { + listener->panelChanged(EvICMshifty, costr2); } } @@ -1305,11 +1486,13 @@ void ICMPanel::wtrcinChanged() case ColorManagementParams::WorkingTrc::NONE: { wGamma->set_sensitive(false); wSlope->set_sensitive(false); + wmidtcie->set_sensitive(false); will->set_sensitive(false); willulab->set_sensitive(false); wprim->set_sensitive(false); fbw->set_sensitive(false); gamut->set_sensitive(false); + wsmoothcie->set_sensitive(false); wprimlab->set_sensitive(false); redFrame->hide(); riaHBox->set_sensitive(false); @@ -1319,8 +1502,12 @@ void ICMPanel::wtrcinChanged() case ColorManagementParams::WorkingTrc::CUSTOM: { will->set_sensitive(false); wprim->set_sensitive(true); + wmidtcie->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); willulab->set_sensitive(true); if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) { @@ -1350,11 +1537,15 @@ void ICMPanel::wtrcinChanged() case ColorManagementParams::WorkingTrc::BT709: { wGamma->setValue(2.222); wSlope->setValue(4.5); + wmidtcie->set_sensitive(true); will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); wGamma->set_sensitive(false); wSlope->set_sensitive(false); @@ -1376,11 +1567,15 @@ void ICMPanel::wtrcinChanged() case ColorManagementParams::WorkingTrc::SRGB: { wGamma->setValue(2.4); wSlope->setValue(12.92); + wmidtcie->set_sensitive(true); will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wGamma->set_sensitive(false); wSlope->set_sensitive(false); riaHBox->set_sensitive(true); @@ -1403,11 +1598,15 @@ void ICMPanel::wtrcinChanged() case ColorManagementParams::WorkingTrc::GAMMA_2_2: { wGamma->setValue(2.2); wSlope->setValue(0.); + wmidtcie->set_sensitive(true); will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); wGamma->set_sensitive(false); wSlope->set_sensitive(false); @@ -1431,11 +1630,15 @@ void ICMPanel::wtrcinChanged() case ColorManagementParams::WorkingTrc::GAMMA_1_8: { wGamma->setValue(1.8); wSlope->setValue(0.); + wmidtcie->set_sensitive(true); will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); wGamma->set_sensitive(false); wSlope->set_sensitive(false); @@ -1459,11 +1662,15 @@ void ICMPanel::wtrcinChanged() case ColorManagementParams::WorkingTrc::LINEAR: { wGamma->setValue(1.0); wSlope->setValue(1.); + wmidtcie->set_sensitive(true); will->set_sensitive(false); willulab->set_sensitive(true); wprim->set_sensitive(true); + wcat->set_sensitive(true); + wcatlab->set_sensitive(true); fbw->set_sensitive(true); gamut->set_sensitive(true); + wsmoothcie->set_sensitive(true); wprimlab->set_sensitive(true); wGamma->set_sensitive(false); wSlope->set_sensitive(false); @@ -1485,6 +1692,7 @@ void ICMPanel::wtrcinChanged() } } wprimChanged(); + wcatChanged(); switch (ColorManagementParams::Primaries(wprim->get_active_row_number())) { case ColorManagementParams::Primaries::DEFAULT: @@ -1496,6 +1704,7 @@ void ICMPanel::wtrcinChanged() case ColorManagementParams::Primaries::WIDE_GAMUT: case ColorManagementParams::Primaries::ACES_P0: case ColorManagementParams::Primaries::JDC_MAX: + case ColorManagementParams::Primaries::JDC_MAXSTDA: case ColorManagementParams::Primaries::BRUCE_RGB: case ColorManagementParams::Primaries::BETA_RGB: case ColorManagementParams::Primaries::BEST_RGB: { @@ -1519,6 +1728,8 @@ void ICMPanel::wtrcinChanged() if (ColorManagementParams::WorkingTrc(wTRC->get_active_row_number()) == ColorManagementParams::WorkingTrc::NONE) { redFrame->hide(); + will->set_sensitive(false); + } if (listener) { @@ -1538,6 +1749,7 @@ void ICMPanel::willChanged() case ColorManagementParams::Primaries::WIDE_GAMUT: case ColorManagementParams::Primaries::ACES_P0: case ColorManagementParams::Primaries::JDC_MAX: + case ColorManagementParams::Primaries::JDC_MAXSTDA: case ColorManagementParams::Primaries::BRUCE_RGB: case ColorManagementParams::Primaries::BETA_RGB: case ColorManagementParams::Primaries::BEST_RGB: { @@ -1663,6 +1875,17 @@ void ICMPanel::wprimChanged() break; } + case ColorManagementParams::Primaries::JDC_MAXSTDA: { + redx->setValue(0.734702); + redy->setValue(0.265302); + grex->setValue(0.021908); + grey->setValue(0.930288); + blux->setValue(0.120593); + bluy->setValue(0.001583); + will->set_active(toUnderlying(ColorManagementParams::Illuminant::STDA)); + break; + } + case ColorManagementParams::Primaries::BRUCE_RGB: { redx->setValue(0.64); redy->setValue(0.33); @@ -1762,7 +1985,15 @@ void ICMPanel::wprimChanged() grey->setValue(0.930288); blux->setValue(0.120593); bluy->setValue(0.001583); - will->set_active(toUnderlying(ColorManagementParams::Illuminant::D50)); + will->set_active(toUnderlying(ColorManagementParams::Illuminant::D50));//D50 + } else if (wProfNames->get_active_text() == "JDCmax stdA") { + redx->setValue(0.734702); + redy->setValue(0.265302); + grex->setValue(0.021908); + grey->setValue(0.930288); + blux->setValue(0.120593); + bluy->setValue(0.001583); + will->set_active(toUnderlying(ColorManagementParams::Illuminant::STDA)); } else if (wProfNames->get_active_text() == "BruceRGB") { redx->setValue(0.64); redy->setValue(0.33); @@ -1820,6 +2051,14 @@ void ICMPanel::wprimChanged() } } +void ICMPanel::wcatChanged() +{ + if (listener) { + listener->panelChanged(EvICMcat, wcat->get_active_text()); + } + +} + void ICMPanel::dcpIlluminantChanged() { if (listener) { @@ -2066,6 +2305,20 @@ void ICMPanel::oBPCChanged() } } +void ICMPanel::trcExpChanged() +{ + + if (listener) { + if (trcExp->getEnabled()) { + listener->panelChanged(EvICMtrcExp, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(EvICMtrcExp, M("GENERAL_DISABLED")); + } + } +} + + + void ICMPanel::fbwChanged() { if (multiImage) { @@ -2106,11 +2359,17 @@ void ICMPanel::gamutChanged() lastgamut = gamut->get_active(); } - + + if (gamut->get_active()) { + wcatBox->set_sensitive(true); + } else { + wcatBox->set_sensitive(false); + } + if (listener) { if (gamut->get_inconsistent()) { listener->panelChanged(EvICMgamut, M("GENERAL_UNCHANGED")); - } else if (fbw->get_active()) { + } else if (gamut->get_active()) { listener->panelChanged(EvICMgamut, M("GENERAL_ENABLED")); } else { listener->panelChanged(EvICMgamut, M("GENERAL_DISABLED")); @@ -2118,6 +2377,33 @@ void ICMPanel::gamutChanged() } } +void ICMPanel::wsmoothcieChanged() +{ + if (multiImage) { + if (wsmoothcie->get_inconsistent()) { + wsmoothcie->set_inconsistent(false); + wsmoothcieconn.block(true); + wsmoothcie->set_active(false); + wsmoothcieconn.block(false); + } else if (lastwsmoothcie) { + wsmoothcie->set_inconsistent(true); + } + + lastwsmoothcie = wsmoothcie->get_active(); + } + + + if (listener) { + if (wsmoothcie->get_inconsistent()) { + listener->panelChanged(EvICMwsmoothcie, M("GENERAL_UNCHANGED")); + } else if (wsmoothcie->get_active()) { + listener->panelChanged(EvICMwsmoothcie, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(EvICMwsmoothcie, M("GENERAL_DISABLED")); + } + } +} + void ICMPanel::setRawMeta(bool raw, const rtengine::FramesData* pMeta) { @@ -2230,12 +2516,16 @@ void ICMPanel::setBatchMode(bool batchMode) dcpIll->append(M("GENERAL_UNCHANGED")); wGamma->showEditedCB(); wSlope->showEditedCB(); + wmidtcie->showEditedCB(); redx->showEditedCB(); redy->showEditedCB(); grex->showEditedCB(); grey->showEditedCB(); blux->showEditedCB(); bluy->showEditedCB(); + refi->showEditedCB(); + shiftx->showEditedCB(); + shifty->showEditedCB(); preser->showEditedCB(); } diff --git a/rtgui/icmpanel.h b/rtgui/icmpanel.h index b11b9478c..0f05da2bb 100644 --- a/rtgui/icmpanel.h +++ b/rtgui/icmpanel.h @@ -49,10 +49,13 @@ protected: Gtk::Frame* dcpFrame; Gtk::Frame* coipFrame; Gtk::Frame* redFrame; + Gtk::Frame* colorFramecie; MyExpander* trcExp; Adjuster* wGamma; Adjuster* wSlope; + Adjuster* wmidtcie; + Gtk::CheckButton* wsmoothcie; Adjuster* redx; Adjuster* redy; Adjuster* grex; @@ -60,13 +63,19 @@ protected: Adjuster* blux; Adjuster* bluy; Adjuster* preser; - + Adjuster* refi; + Adjuster* shiftx; + Adjuster* shifty; + sigc::connection wsmoothcieconn; + bool lastwsmoothcie; Gtk::Label* labmga; Gtk::Box* gabox; //Gtk::Label* blr; //Gtk::Label* blg; //Gtk::Label* blb; Gtk::Button* neutral; + sigc::connection trcExpconn; + bool lasttrcExp; sigc::connection neutralconn; bool lastToneCurve; @@ -111,6 +120,13 @@ private: rtengine::ProcEvent EvICMLabGridciexy; rtengine::ProcEvent EvICMfbw; rtengine::ProcEvent EvICMgamut; + rtengine::ProcEvent EvICMcat; + rtengine::ProcEvent EvICMrefi; + rtengine::ProcEvent EvICMtrcExp; + rtengine::ProcEvent EvICMshiftx; + rtengine::ProcEvent EvICMshifty; + rtengine::ProcEvent EvICMwmidtcie; + rtengine::ProcEvent EvICMwsmoothcie; LabGrid *labgridcie; IdleRegister idle_register; @@ -127,6 +143,10 @@ private: Gtk::CheckButton* fbw; Gtk::CheckButton* gamut; + Gtk::Box* wcatBox; + Gtk::Label* wcatlab; + + Gtk::CheckButton* obpc; Gtk::RadioButton* inone; @@ -149,6 +169,9 @@ private: sigc::connection willconn; MyComboBoxText* wprim; sigc::connection wprimconn; + MyComboBoxText* wcat; + sigc::connection wcatconn; + std::unique_ptr aRendIntent; sigc::connection arendintentconn; @@ -180,6 +203,8 @@ private: float nextgy; float nextwx; float nextwy; + float nextmx; + float nextmy; public: static const Glib::ustring TOOL_NAME; @@ -193,18 +218,22 @@ public: void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; void primChanged (float rx, float ry, float bx, float by, float gx, float gy) override; - void iprimChanged (float r_x, float r_y, float b_x, float b_y, float g_x, float g_y, float w_x, float w_y) override; + void iprimChanged (float r_x, float r_y, float b_x, float b_y, float g_x, float g_y, float w_x, float w_y, float m_x, float m_y) override; void neutral_pressed(); void wpChanged(); void wtrcinChanged(); void willChanged(); void wprimChanged(); + void wcatChanged(); + void trcExpChanged(); void opChanged(); void oiChanged(int n); void aiChanged(int n); void oBPCChanged(); void fbwChanged(); + void wsmoothcieChanged(); + void gamutChanged(); void ipChanged(); void ipSelectionChanged(); diff --git a/rtgui/labgrid.cc b/rtgui/labgrid.cc index 0773b85c9..9babe17ca 100644 --- a/rtgui/labgrid.cc +++ b/rtgui/labgrid.cc @@ -76,17 +76,19 @@ bool LabGridArea::notifyListener() } -LabGridArea::LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low, bool ciexy): +LabGridArea::LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low, bool ciexy, bool mous): Gtk::DrawingArea(), evt(evt), evtMsg(msg), litPoint(NONE), - low_a(0.f), high_a(0.f), low_b(0.f), high_b(0.f), gre_x(0.f), gre_y(0.f), whi_x(0.f), whi_y(0.f),//these variables are used as xy in Ciexy - no change labels - defaultLow_a(0.f), defaultHigh_a(0.f), defaultLow_b(0.f), defaultHigh_b(0.f), defaultgre_x(0.f), defaultgre_y(0.f), defaultwhi_x(0.f), defaultwhi_y(0.f), + low_a(0.f), high_a(0.f), low_b(0.f), high_b(0.f), gre_x(0.f), gre_y(0.f), whi_x(0.f), whi_y(0.f), me_x(0.f), me_y(0.f),//these variables are used as xy in Ciexy - no change labels + defaultLow_a(0.f), defaultHigh_a(0.f), defaultLow_b(0.f), defaultHigh_b(0.f), defaultgre_x(0.f), defaultgre_y(0.f), defaultwhi_x(0.f), defaultwhi_y(0.f), defaultme_x(0.f), defaultme_y(0.f), listener(nullptr), edited(false), isDragged(false), low_enabled(enable_low), - ciexy_enabled(ciexy) + ciexy_enabled(ciexy), + mous_enabled(mous) + { set_can_focus(false); // prevent moving the grid while you're moving a point @@ -95,7 +97,7 @@ LabGridArea::LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool get_style_context()->add_class("drawingarea"); } -void LabGridArea::getParams(double &la, double &lb, double &ha, double &hb, double &gx, double &gy, double &wx, double &wy) const +void LabGridArea::getParams(double &la, double &lb, double &ha, double &hb, double &gx, double &gy, double &wx, double &wy, double &mx, double &my) const { la = low_a; ha = high_a; @@ -105,11 +107,13 @@ void LabGridArea::getParams(double &la, double &lb, double &ha, double &hb, doub gy = gre_y; wx = whi_x; wy = whi_y; + mx = me_x; + my = me_y; // printf("la=%f ha=%f lb=%f hb=%f gx=%f gy=%f\n", la, ha, lb, hb, gx, gy); } -void LabGridArea::setParams(double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, bool notify) +void LabGridArea::setParams(double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, double mx, double my, bool notify) { const double lo = -1.0; const double hi = 1.0; @@ -121,6 +125,8 @@ void LabGridArea::setParams(double la, double lb, double ha, double hb, double g gre_y = rtengine::LIM(gy, lo, hi); whi_x = rtengine::LIM(wx, lo, hi); whi_y = rtengine::LIM(wy, lo, hi); + me_x = rtengine::LIM(mx, lo, hi); + me_y = rtengine::LIM(my, lo, hi); queue_draw(); if (notify) { @@ -128,7 +134,7 @@ void LabGridArea::setParams(double la, double lb, double ha, double hb, double g } } -void LabGridArea::setDefault (double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy) +void LabGridArea::setDefault (double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, double mx, double my) { defaultLow_a = la; defaultLow_b = lb; @@ -138,16 +144,18 @@ void LabGridArea::setDefault (double la, double lb, double ha, double hb, double defaultgre_y = gy; defaultwhi_x = wx; defaultwhi_y = wy; + defaultme_x = mx; + defaultme_y = my; } void LabGridArea::reset(bool toInitial) { if (toInitial) { - setParams(defaultLow_a, defaultLow_b, defaultHigh_a, defaultHigh_b, defaultgre_x, defaultgre_y, defaultwhi_x, defaultwhi_y, true); + setParams(defaultLow_a, defaultLow_b, defaultHigh_a, defaultHigh_b, defaultgre_x, defaultgre_y, defaultwhi_x, defaultwhi_y, defaultme_x, defaultme_y, true); } else { // printf("RESET \n"); - setParams(0., 0., 0., 0., 0., 0., 0., 0., true); + setParams(0., 0., 0., 0., 0., 0., 0., 0., 0., 0., true); } } @@ -322,6 +330,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &cr) // Drawing the connection line cr->set_antialias(Cairo::ANTIALIAS_DEFAULT); + // float loa, hia, lob, hib, grx, gry, whx, why, mex, mey; const double loa = .5 * (static_cast(width) + static_cast(width) * low_a); const double hia = .5 * (static_cast(width) + static_cast(width) * high_a); const double lob = .5 * (static_cast(height) + static_cast(height) * low_b); @@ -330,7 +339,11 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &cr) const double gry = .5 * (static_cast(height) + static_cast(height) * gre_y); const double whx = .5 * (static_cast(width) + static_cast(width) * whi_x); const double why = .5 * (static_cast(height) + static_cast(height) * whi_y); + double mex = .5 * (static_cast(width) + static_cast(width) * me_x); + double mey = .5 * (static_cast(height) + static_cast(height) * me_y); cr->set_line_width(1.5); + mex = .5 * (width + width * me_x); + mey = .5 * (height + height * me_y); cr->set_source_rgb(0.6, 0.6, 0.6); cr->move_to(loa, lob); cr->line_to(hia, hib); @@ -412,6 +425,12 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &cr) cr->fill(); } + if (ciexy_enabled) {//Dominant + cr->set_source_rgb(0.3, 0.4, 0.3); + cr->arc(mex, mey, 3., 0, 2. * rtengine::RT_PI); + cr->fill(); + } + cr->set_source_rgb(0.9, 0.9, 0.9);//white for blue en Ciexy if (litPoint == HIGH) { cr->arc(hia, hib, 5., 0., 2. * rtengine::RT_PI); @@ -426,7 +445,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &cr) bool LabGridArea::on_button_press_event(GdkEventButton *event) { - if (event->button == 1) { + if (event->button == 1 && mous_enabled) { if (!ciexy_enabled) { if (event->type == GDK_2BUTTON_PRESS) { switch (litPoint) { @@ -450,14 +469,15 @@ bool LabGridArea::on_button_press_event(GdkEventButton *event) isDragged = true; } } else { - if (event->type == GDK_2BUTTON_PRESS) { - edited = true; - notifyListener(); - queue_draw(); - } else if (event->type == GDK_BUTTON_PRESS && litPoint != NONE) { - isDragged = true; + if(mous_enabled) { + if (event->type == GDK_2BUTTON_PRESS) { + edited = true; + notifyListener(); + queue_draw(); + } else if (event->type == GDK_BUTTON_PRESS && litPoint != NONE) { + isDragged = true; + } } - } return false; } @@ -467,7 +487,7 @@ bool LabGridArea::on_button_press_event(GdkEventButton *event) bool LabGridArea::on_button_release_event(GdkEventButton *event) { - if (event->button == 1) { + if (event->button == 1 && mous_enabled) { isDragged = false; return false; } @@ -591,12 +611,21 @@ void LabGridArea::setciexyEnabled(bool yes) } } +void LabGridArea::setmousEnabled(bool yes) +{ + if (mous_enabled != yes) { + mous_enabled = yes; + queue_draw(); + } +} + + //----------------------------------------------------------------------------- // LabGrid //----------------------------------------------------------------------------- -LabGrid::LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low, bool ciexy): - grid(evt, msg, enable_low, ciexy) +LabGrid::LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low, bool ciexy, bool mous): + grid(evt, msg, enable_low, ciexy, mous) { Gtk::Button *reset = Gtk::manage(new Gtk::Button()); reset->set_tooltip_markup(M("ADJUSTER_RESET_TO_DEFAULT")); @@ -611,7 +640,7 @@ LabGrid::LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_ reset->set_can_focus(false); reset->set_size_request(-1, 20); - pack_start(grid, true, true); + pack_start(grid, true, true, true); pack_start(*reset, false, false); show_all_children(); } diff --git a/rtgui/labgrid.h b/rtgui/labgrid.h index d486574b4..9756af626 100644 --- a/rtgui/labgrid.h +++ b/rtgui/labgrid.h @@ -58,7 +58,8 @@ private: double gre_y; double whi_x; double whi_y; - + double me_x; + double me_y; double defaultLow_a; double defaultHigh_a; double defaultLow_b; @@ -67,6 +68,8 @@ private: double defaultgre_y; double defaultwhi_x; double defaultwhi_y; + double defaultme_x; + double defaultme_y; ToolPanelListener *listener; bool edited; @@ -76,16 +79,17 @@ private: bool low_enabled; bool ciexy_enabled; + bool mous_enabled; bool notifyListener(); void getLitPoint(); public: - LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true, bool ciexy=false); + LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true, bool ciexy=false, bool mous=false); - void getParams(double &la, double &lb, double &ha, double &hb, double &gx, double &gy, double &wx, double &wy) const; - void setParams(double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, bool notify); - void setDefault (double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy); + void getParams(double &la, double &lb, double &ha, double &hb, double &gx, double &gy, double &wx, double &wy, double &mx, double &my) const; + void setParams(double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, double mx, double my, bool notify); + void setDefault (double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, double mx, double my); void setEdited(bool yes); bool getEdited() const; void reset(bool toInitial); @@ -95,6 +99,8 @@ public: void setLowEnabled(bool yes); bool ciexyEnabled() const; void setciexyEnabled(bool yes); + bool mousEnabled() const; + void setmousEnabled(bool yes); bool on_draw(const ::Cairo::RefPtr &cr) override; void on_style_updated () override; @@ -114,11 +120,11 @@ private: bool resetPressed(GdkEventButton *event); public: - LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true, bool ciexy=false); + LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true, bool ciexy=false, bool mous=true); - void getParams(double &la, double &lb, double &ha, double &hb, double &gx, double &gy, double &wx, double &wy) const { return grid.getParams(la, lb, ha, hb, gx, gy, wx, wy); } - void setParams(double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, bool notify) { grid.setParams(la, lb, ha, hb, gx, gy, wx, wy, notify); } - void setDefault (double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy) { grid.setDefault(la, lb, ha, hb, gx, gy, wx, wy); } + void getParams(double &la, double &lb, double &ha, double &hb, double &gx, double &gy, double &wx, double &wy, double &mx, double &my) const { return grid.getParams(la, lb, ha, hb, gx, gy, wx, wy, mx, my); } + void setParams(double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, double mx, double my, bool notify) { grid.setParams(la, lb, ha, hb, gx, gy, wx, wy, mx, my, notify); } + void setDefault (double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, double mx, double my) { grid.setDefault(la, lb, ha, hb, gx, gy, wx, wy, mx, my); } void setEdited(bool yes) { grid.setEdited(yes); } bool getEdited() const { return grid.getEdited(); } void reset(bool toInitial) { grid.reset(toInitial); } @@ -127,5 +133,8 @@ public: void setLowEnabled(bool yes) { grid.setLowEnabled(yes); } bool ciexyEnabled() const { return grid.ciexyEnabled(); } void setciexyEnabled(bool yes) { grid.setciexyEnabled(yes); } + bool mousEnabled() const { return grid.mousEnabled(); } + void setmousEnabled(bool yes) { grid.setmousEnabled(yes); } + }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 38e84154e..999653ad7 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -1131,18 +1131,69 @@ void Locallab::denChanged(const std::vector &denlc, int selsp } - -void Locallab::logencodChanged(const float blackev, const float whiteev, const float sourceg, const float sourceab, const float targetg, const bool autocomput, const bool autocie, const float jz1) +void Locallab::sigChanged(const std::vector &ciesig, int selspot) { - // Update Locallab Log Encoding and Ciecam accordingly - if(autocomput) { - explog.updateAutocompute(blackev, whiteev, sourceg, sourceab, targetg, jz1); + cie_sig = ciesig; + + if (selspot < (int) cie_sig.size()) { + const double s1 = cie_sig.at(selspot).contsigq; + const double s2 = cie_sig.at(selspot).lightsigq; + + expcie.updatesigloc(s1, s2); } - if(autocie) { - expcie.updateAutocompute(blackev, whiteev, sourceg, sourceab, targetg, jz1); + +} + +void Locallab::ciebefChanged(const std::vector &ciebef, int selspot) +{ + cie_bef = ciebef; + if (selspot < (int) cie_bef.size()) { + const double blackev = cie_bef.at(selspot).blackevbef; + const double whiteev = cie_bef.at(selspot).whiteevbef; + const double sourceg = cie_bef.at(selspot).sourcegbef; + const double sourceab = cie_bef.at(selspot).sourceabbef; + const double targetg = cie_bef.at(selspot).targetgbef; + const double jz1 = cie_bef.at(selspot).jz1bef; + const bool autocomput = cie_bef.at(selspot).autocomputbef; + const bool autocie = cie_bef.at(selspot).autociebef; + + if(autocomput) { + explog.updateAutocompute(blackev, whiteev, sourceg, sourceab, targetg, jz1); + } + if(autocie) { + expcie.updateAutocompute(blackev, whiteev, sourceg, sourceab, targetg, jz1); + } + } } + +void Locallab::cieChanged(const std::vector &cielc, int selspot) +{ + // Saving transmitted min/max data + cie_lc = cielc; + + //Update Locallab Denoise tool lum chro + if (selspot < (int) cie_lc.size()) { + const double r1 = cie_lc.at(selspot).redxlc; + const double r2 = cie_lc.at(selspot).redylc; + const double g1 = cie_lc.at(selspot).grexlc; + const double g2 = cie_lc.at(selspot).greylc; + const double b1 = cie_lc.at(selspot).bluxlc; + const double b2 = cie_lc.at(selspot).bluylc; + const double w1 = cie_lc.at(selspot).wxlc; + const double w2 = cie_lc.at(selspot).wylc; + const double m1 = cie_lc.at(selspot).meanxlc; + const double m2 = cie_lc.at(selspot).meanylc; + const double me1 = cie_lc.at(selspot).meanxelc; + const double me2 = cie_lc.at(selspot).meanyelc; + + expcie.updateiPrimloc(r1, r2, g1, g2, b1, b2, w1, w2, m1, m2, me1, me2); + } + +} + + void Locallab::refChanged2(float *huerefp, float *chromarefp, float *lumarefp, float *fabrefp, int selspot) { const double huer = huerefp[selspot]; diff --git a/rtgui/locallab.h b/rtgui/locallab.h index e39f213cc..1848e6481 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -126,6 +126,13 @@ private: // Locallab tools mask background management data std::vector denoiselc; + + std::vector cie_bef; + + std::vector cie_lc; + + std::vector cie_sig; + // Locallab tools mask background management data std::vector maskBackRef; @@ -152,8 +159,14 @@ public: // Locallab Retinex tool min/man management function void denChanged(const std::vector &denlc, int selspot) override; - // Locallab Log Encoding autocompute function - void logencodChanged(const float blackev, const float whiteev, const float sourceg, const float sourceab, const float targetg, const bool autocomput, const bool autocie, const float jz1) override; + // Locallab CIE tool primaries function + void cieChanged(const std::vector &cielc, int selspot) override; + + // Locallab Log Encoding and Cam16 autocompute function + void ciebefChanged(const std::vector &ciebef, int selspot) override; + + void sigChanged(const std::vector &ciesig, int selspot) override; + // Locallab tools mask background management function // void refChanged(const std::vector &ref, int selspot) override; diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index 9cdd74c9c..7db035e0b 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -1165,7 +1165,7 @@ void LocallabColor::read(const rtengine::procparams::ProcParams* pp, const Param spot.labgridBLow / LocallabParams::LABGRIDL_CORR_MAX, spot.labgridAHigh / LocallabParams::LABGRIDL_CORR_MAX, spot.labgridBHigh / LocallabParams::LABGRIDL_CORR_MAX, - 0, 0, 0, 0, false); + 0, 0, 0, 0, 0, 0, false); // printf("labgridlow=%f \n", spot.labgridALow); if (spot.gridMethod == "one") { gridMethod->set_active(0); @@ -1278,7 +1278,7 @@ void LocallabColor::read(const rtengine::procparams::ProcParams* pp, const Param labgridmerg->setParams(0, 0, spot.labgridAHighmerg / LocallabParams::LABGRIDL_CORR_MAX, spot.labgridBHighmerg / LocallabParams::LABGRIDL_CORR_MAX, - 0, 0, 0, 0, false); + 0, 0, 0, 0, 0, 0, false); merlucol->setValue(spot.merlucol); enaColorMask->set_active(spot.enaColorMask); CCmaskshape->setCurve(spot.CCmaskcurve); @@ -1342,7 +1342,7 @@ void LocallabColor::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pe labgrid->getParams(spot.labgridALow, spot.labgridBLow, spot.labgridAHigh, - spot.labgridBHigh, zerox, zeroy, zerox, zeroy); + spot.labgridBHigh, zerox, zeroy, zerox, zeroy, zerox, zeroy); spot.labgridALow *= LocallabParams::LABGRIDL_CORR_MAX; spot.labgridAHigh *= LocallabParams::LABGRIDL_CORR_MAX; spot.labgridBLow *= LocallabParams::LABGRIDL_CORR_MAX; @@ -1461,7 +1461,7 @@ void LocallabColor::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pe labgridmerg->getParams(spot.labgridALowmerg, spot.labgridBLowmerg, spot.labgridAHighmerg, - spot.labgridBHighmerg, zerox1, zeroy1, zerox1, zeroy1); + spot.labgridBHighmerg, zerox1, zeroy1, zerox1, zeroy1, zerox1, zeroy1); spot.labgridALowmerg *= LocallabParams::LABGRIDL_CORR_MAX; spot.labgridAHighmerg *= LocallabParams::LABGRIDL_CORR_MAX; spot.labgridBLowmerg *= LocallabParams::LABGRIDL_CORR_MAX; @@ -1508,7 +1508,7 @@ void LocallabColor::setDefaults(const rtengine::procparams::ProcParams* defParam labgrid->setDefault(defSpot.labgridALow / LocallabParams::LABGRIDL_CORR_MAX, defSpot.labgridBLow / LocallabParams::LABGRIDL_CORR_MAX, defSpot.labgridAHigh / LocallabParams::LABGRIDL_CORR_MAX, - defSpot.labgridBHigh / LocallabParams::LABGRIDL_CORR_MAX, 0, 0, 0, 0); + defSpot.labgridBHigh / LocallabParams::LABGRIDL_CORR_MAX, 0, 0, 0, 0, 0, 0); strengthgrid->setDefault((double) defSpot.strengthgrid); sensi->setDefault((double)defSpot.sensi); structcol->setDefault((double)defSpot.structcol); @@ -1524,7 +1524,7 @@ void LocallabColor::setDefaults(const rtengine::procparams::ProcParams* defParam labgridmerg->setDefault(defSpot.labgridALowmerg / LocallabParams::LABGRIDL_CORR_MAX, defSpot.labgridBLowmerg / LocallabParams::LABGRIDL_CORR_MAX, defSpot.labgridAHighmerg / LocallabParams::LABGRIDL_CORR_MAX, - defSpot.labgridBHighmerg / LocallabParams::LABGRIDL_CORR_MAX, 0, 0, 0, 0); + defSpot.labgridBHighmerg / LocallabParams::LABGRIDL_CORR_MAX, 0, 0, 0, 0, 0, 0); merlucol->setDefault(defSpot.merlucol); strumaskcol->setDefault(defSpot.strumaskcol); contcol->setDefault(defSpot.contcol); @@ -2002,7 +2002,7 @@ void LocallabColor::convertParamToNormal() labgridmerg->setParams(0, 0, defSpot.labgridAHighmerg / LocallabParams::LABGRIDL_CORR_MAX, defSpot.labgridBHighmerg / LocallabParams::LABGRIDL_CORR_MAX, - 0, 0, 0, 0, false); + 0, 0, 0, 0, 0, 0, false); merlucol->setValue(defSpot.merlucol); strumaskcol->setValue(defSpot.strumaskcol); toolcol->set_active(defSpot.toolcol); @@ -4014,16 +4014,16 @@ LocallabShadow::LocallabShadow(): // Shadow highlight specific widgets shMethod(Gtk::manage(new MyComboBoxText())), reparsh(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGREPART"), 1.0, 100.0, 1., 100.0))), - multipliersh([]() -> std::array + multipliersh([]() -> std::array { - std::array res = {}; + std::array res = {}; for (unsigned int i = 0; i < res.size(); ++i) { Glib::ustring ss = Glib::ustring::format(i); if (i == 0) { ss += Glib::ustring::compose(" (%1)", M("TP_LOCALLAB_LUMADARKEST")); - } else if (i == 4) { + } else if (i == 5) { ss += Glib::ustring::compose(" (%1)", M("TP_LOCALLAB_LUMAWHITESEST")); } @@ -4416,7 +4416,7 @@ void LocallabShadow::read(const rtengine::procparams::ProcParams* pp, const Para shMethod->set_active(1); } - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 6; i++) { multipliersh[i]->setValue((double)spot.multsh[i]); } recothress->setValue((double)spot.recothress); @@ -4486,7 +4486,7 @@ void LocallabShadow::write(rtengine::procparams::ProcParams* pp, ParamsEdited* p spot.shMethod = "tone"; } - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 6; i++) { spot.multsh[i] = multipliersh[i]->getIntValue(); } @@ -4535,7 +4535,7 @@ void LocallabShadow::setDefaults(const rtengine::procparams::ProcParams* defPara const LocallabParams::LocallabSpot& defSpot = defParams->locallab.spots.at(index); // Set default values for adjuster widgets - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 6; i++) { multipliersh[i]->setDefault(defSpot.multsh[i]); } @@ -4573,15 +4573,16 @@ void LocallabShadow::setDefaults(const rtengine::procparams::ProcParams* defPara void LocallabShadow::adjusterChanged(Adjuster* a, double newval) { if (isLocActivated && exp->getEnabled()) { - if (a == multipliersh[0] || a == multipliersh[1] || a == multipliersh[2] || a == multipliersh[3] || a == multipliersh[4]) { + if (a == multipliersh[0] || a == multipliersh[1] || a == multipliersh[2] || a == multipliersh[3] || a == multipliersh[4] || a == multipliersh[5]) { if (listener) { listener->panelChanged(EvlocallabEqualizersh, - Glib::ustring::compose("%1, %2, %3, %4, %5", + Glib::ustring::compose("%1, %2, %3, %4, %5, %6", Glib::ustring::format(std::fixed, std::setprecision(2), multipliersh[0]->getIntValue()), Glib::ustring::format(std::fixed, std::setprecision(2), multipliersh[1]->getIntValue()), Glib::ustring::format(std::fixed, std::setprecision(2), multipliersh[2]->getIntValue()), Glib::ustring::format(std::fixed, std::setprecision(2), multipliersh[3]->getIntValue()), - Glib::ustring::format(std::fixed, std::setprecision(2), multipliersh[4]->getIntValue())) + " (" + escapeHtmlChars(getSpotName()) + ")"); + Glib::ustring::format(std::fixed, std::setprecision(2), multipliersh[4]->getIntValue()), + Glib::ustring::format(std::fixed, std::setprecision(2), multipliersh[5]->getIntValue())) + " (" + escapeHtmlChars(getSpotName()) + ")"); } } diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index f99b3bc41..4a0e68564 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -55,7 +55,59 @@ protected: Normal = 1, Simple = 2 }; - + rtengine::ProcEvent Evlocallabnormcie; + rtengine::ProcEvent Evlocallabstrumaskcie; + rtengine::ProcEvent EvLocallabtoolcie; + rtengine::ProcEvent EvLocallabfftcieMask; + rtengine::ProcEvent Evlocallabcontcie; + rtengine::ProcEvent Evlocallabblurcie; + rtengine::ProcEvent Evlocallabhighmaskcie; + rtengine::ProcEvent Evlocallabshadmaskcie; + rtengine::ProcEvent Evlocallabsigmoidsenscie; + rtengine::ProcEvent EvlocallabLLmaskcieshapewav; + rtengine::ProcEvent EvlocallabcsThresholdcie; + rtengine::ProcEvent Evlocallabcomprcie; + rtengine::ProcEvent Evlocallabstrcielog; + rtengine::ProcEvent Evlocallabsatcie; + rtengine::ProcEvent Evlocallablogcieq; + rtengine::ProcEvent Evlocallabcomprcieth; + rtengine::ProcEvent EvlocallabHHhmaskcieshape; + rtengine::ProcEvent EvlocallabbwevMethod; + rtengine::ProcEvent Evlocallabgamjcie; + rtengine::ProcEvent Evlocallabslopjcie; + rtengine::ProcEvent Evlocallabmidtcie; + rtengine::ProcEvent Evlocallabslopesmo; + rtengine::ProcEvent Evlocallabsmoothcie; + rtengine::ProcEvent Evlocallabsmoothciemet; + rtengine::ProcEvent Evlocallabsigcie; + rtengine::ProcEvent Evlocallabillcie; + rtengine::ProcEvent Evlocallabprimcie; + rtengine::ProcEvent Evlocallabcatcie; + rtengine::ProcEvent Evlocallabwhitescie; + rtengine::ProcEvent Evlocallabblackscie; + rtengine::ProcEvent Evlocallabwhiteslog; + rtengine::ProcEvent Evlocallabblackslog; + rtengine::ProcEvent Evlocallabcomprlog; + rtengine::ProcEvent Evlocallabsatlog; + rtengine::ProcEvent Evlocallabstrelog; + rtengine::ProcEvent Evlocallabredxl; + rtengine::ProcEvent Evlocallabredyl; + rtengine::ProcEvent Evlocallabgrexl; + rtengine::ProcEvent Evlocallabgreyl; + rtengine::ProcEvent Evlocallabbluxl; + rtengine::ProcEvent Evlocallabbluyl; + rtengine::ProcEvent EvlocallabGridciexy; + rtengine::ProcEvent Evlocallabgamutcie; + rtengine::ProcEvent Evlocallabexpprecam; + rtengine::ProcEvent Evlocallablightsigqcie; + rtengine::ProcEvent Evlocallabcontsigqcie; + rtengine::ProcEvent Evlocallabrefi; + rtengine::ProcEvent Evlocallabshiftxl; + rtengine::ProcEvent Evlocallabshiftyl; + rtengine::ProcEvent Evlocallabanggradcie; + rtengine::ProcEvent Evlocallabstrgradcie; + rtengine::ProcEvent Evlocallabdetailciejz; + rtengine::ProcEvent EvlocallabenacieMaskall; // LocallabTool parameters bool needMode; bool isLocActivated; @@ -452,7 +504,7 @@ private: // Shadow highlight specific widgets MyComboBoxText* const shMethod; Adjuster* const reparsh; - const std::array multipliersh; + const std::array multipliersh; Adjuster* const detailSH; Adjuster* const tePivot; Adjuster* const highlights; @@ -1339,8 +1391,15 @@ private: Gtk::CheckButton* const ciecam; Gtk::ToggleButton* const autocompute; Gtk::Frame* const logPFrame; + Gtk::Frame* const logPFrame2; Adjuster* const blackEv; Adjuster* const whiteEv; + Adjuster* const whiteslog; + Adjuster* const blackslog; + Adjuster* const comprlog; + Adjuster* const strelog; + Gtk::CheckButton* const satlog; + Gtk::CheckButton* const fullimage; Gtk::Frame* const logFrame; Gtk::CheckButton* const Autogray; @@ -1395,7 +1454,7 @@ private: DiagonalCurveEditor* const LmaskshapeL; sigc::connection autoconn, ciecamconn, fullimageConn, AutograyConn; - sigc::connection surroundconn, sursourconn; + sigc::connection surroundconn, sursourconn, satlogconn; sigc::connection showmaskLMethodConn, enaLMaskConn; public: LocallabLog(); @@ -1409,6 +1468,7 @@ public: void surroundChanged(); void sursourChanged(); void setDefaultExpanderVisibility() override; + void satlogChanged(); void disableListener() override; void enableListener() override; @@ -1543,6 +1603,8 @@ private: Gtk::Box* const modeHBoxcam; Gtk::Box* const modeHBoxcie; Gtk::Frame* const cieFrame; + MyExpander* const expcamscene; + Gtk::CheckButton* const Autograycie; Adjuster* const sourceGraycie; Adjuster* const sourceabscie; @@ -1586,10 +1648,13 @@ private: Adjuster* const clarisoftjz; MyExpander* const expcam16; + MyExpander* const expcamviewing; Adjuster* const lightqcie; Adjuster* const contlcie; Adjuster* const contqcie; + Adjuster* const lightsigqcie; + Adjuster* const contsigqcie; Adjuster* const contthrescie; Gtk::Frame* const logjzFrame; Gtk::CheckButton* const logjz; @@ -1598,15 +1663,71 @@ private: Adjuster* const targetjz; Gtk::Frame* const bevwevFrame; Gtk::CheckButton* const forcebw; - + ToolParamBlock* const sigBox; Gtk::Frame* const sigmoidFrame; + Gtk::Frame* const sigmoidnormFrame; Gtk::CheckButton* const sigq; Adjuster* const sigmoidldacie; Adjuster* const sigmoidthcie; + Adjuster* const sigmoidsenscie; Adjuster* const sigmoidblcie; - Gtk::CheckButton* const sigmoidqjcie; + Gtk::Box* autocomprHBox; + Gtk::ToggleButton* const comprcieauto; + Gtk::CheckButton* const normcie; + Gtk::Box* const modeHBoxbwev; + MyComboBoxText* const bwevMethod; + Gtk::Frame* const logcieFrame; Gtk::CheckButton* const logcie; + ToolParamBlock* const comprBox; + Adjuster* const comprcie; + + Adjuster* const strcielog; + Gtk::CheckButton* const satcie; + Gtk::CheckButton* const logcieq; + Adjuster* const comprcieth; + MyExpander* const expprecam; + Adjuster* const gamjcie; + Adjuster* const slopjcie; + Adjuster* const midtcie; + Gtk::CheckButton* const smoothcie; + ToolParamBlock* const ciesmoothBox; + Gtk::Box* smoothBox; + MyComboBoxText* const smoothciemet; + Adjuster* const slopesmo; + + Adjuster* const whitescie; + Adjuster* const blackscie; + Gtk::Box* willBox; + MyComboBoxText* const illMethod; + Gtk::Box* wprimBox; + MyComboBoxText* const primMethod; + Gtk::Grid* primCoordGridl; + Gtk::Frame* trcFrame; + Gtk::Frame* smoothFrame; + Gtk::Frame* primillFrame; + ToolParamBlock* const redBox; + Adjuster* const redxl; + Adjuster* const redyl; + Adjuster* const grexl; + Adjuster* const greyl; + Adjuster* const bluxl; + Adjuster* const bluyl; + Adjuster* const refi; + + Gtk::Frame* const gridFramecie; + LabGrid* const labgridcie; + Gtk::Frame* const colorFramecie; + + Gtk::Box* catBox; + MyComboBoxText* const catMethod; + Gtk::Box* gamutcieBox; + Gtk::CheckButton* const gamutcie; + Adjuster* const shiftxl; + Adjuster* const shiftyl; + Gtk::Frame* const sigmoidjzFrame; + Gtk::Frame* const sigmoid2Frame; + Gtk::CheckButton* const sigcie; Gtk::CheckButton* const sigjz; Adjuster* const sigmoidldajzcie; Adjuster* const sigmoidthjzcie; @@ -1645,26 +1766,20 @@ private: Gtk::CheckButton* const chjzcie; Adjuster* const strsoftjzcie; -/* - Gtk::Frame* const ciezFrame; - Adjuster* const lightlzcam; - Adjuster* const lightqzcam; - Adjuster* const contlzcam; - Adjuster* const contqzcam; - Adjuster* const contthreszcam; - Adjuster* const colorflzcam; - Adjuster* const saturzcam; - Adjuster* const chromzcam; -*/ MyExpander* const expLcie; Gtk::Frame* const cie2Frame; Adjuster* const targetGraycie; Adjuster* const targabscie; Adjuster* const detailcie; + Adjuster* const detailciejz; Adjuster* const catadcie; MyComboBoxText* const surroundcie; Gtk::Box* const surrHBoxcie; + MyExpander* const expgradcie; + Adjuster* const strgradcie; + Adjuster* const anggradcie; + MyExpander* const exprecovcie; Gtk::Label* const maskusablecie; Gtk::Label* const maskunusablecie; @@ -1676,25 +1791,46 @@ private: MyExpander* const expmaskcie; MyComboBoxText* const showmaskcieMethod; Gtk::CheckButton* const enacieMask; + Gtk::CheckButton* const enacieMaskall; CurveEditorGroup* const maskcieCurveEditorG; FlatCurveEditor* const CCmaskcieshape; FlatCurveEditor* const LLmaskcieshape; FlatCurveEditor* const HHmaskcieshape; + Gtk::Frame* const struFramecie; + Adjuster* const strumaskcie; + Gtk::CheckButton* const toolcie; + Gtk::Frame* const blurFramecie; + Gtk::CheckButton* const fftcieMask; + Adjuster* const contcie; + Adjuster* const blurcie; + Adjuster* const blendmaskcie; Adjuster* const radmaskcie; Adjuster* const lapmaskcie; Adjuster* const chromaskcie; Adjuster* const gammaskcie; Adjuster* const slomaskcie; - + Adjuster* const highmaskcie; + Adjuster* const shadmaskcie; + CurveEditorGroup* const maskcieHCurveEditorG; + FlatCurveEditor* const HHhmaskcieshape; + CurveEditorGroup* const mask2cieCurveEditorG; DiagonalCurveEditor* const Lmaskcieshape; - - sigc::connection AutograycieConn, forcejzConn, forcebwConn, qtojConn, showmaskcieMethodConn, enacieMaskConn, jabcieConn, sursourcieconn, surroundcieconn, modecieconn, modecamconn, sigmoidqjcieconn, logcieconn, logjzconn, sigjzconn, sigqconn, chjzcieconn, toneMethodcieConn, toneMethodcieConn2; + Gtk::Frame* const wavFramecie; + CurveEditorGroup* const mask2cieCurveEditorGwav; + FlatCurveEditor* const LLmaskcieshapewav; + Gtk::Box* const quaHcieBox; + ThresholdAdjuster* const csThresholdcie; + int nextcomprciecount = 0; + + sigc::connection AutograycieConn, primMethodconn, illMethodconn, smoothciemetconn, catMethodconn, forcejzConn, forcebwConn, qtojConn, showmaskcieMethodConn, enacieMaskConn, enacieMaskallConn, jabcieConn, sursourcieconn, surroundcieconn, modecieconn, modecamconn, comprcieautoconn, normcieconn, logcieconn, satcieconn, logcieqconn,smoothcieconn, logjzconn, sigjzconn, sigqconn, chjzcieconn, toneMethodcieConn, toneMethodcieConn2, toolcieConn, bwevMethodConn, fftcieMaskConn, gamutcieconn, expprecamconn, sigcieconn; public: Locallabcie(); ~Locallabcie(); - + + void setListener(ToolPanelListener* tpl) override; + bool isMaskViewActive() override; void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; @@ -1721,7 +1857,11 @@ public: void curveChanged(CurveEditor* ce) override; void toneMethodcieChanged(); void toneMethodcie2Changed(); + void bwevMethodChanged(); void updateAutocompute(const float blackev, const float whiteev, const float sourceg, const float sourceab, const float targetg, const float jz1); + void updatePrimloc(const float redx, const float redy, const float grex, const float grey, const float blux, const float bluy); + void updateiPrimloc(const float r_x, const float r_y, const float g_x, const float g_y, const float b_x, const float b_y, const float w_x, const float w_y, const float m_x, const float m_y, const float me_x, const float me_y); + void updatesigloc(const float cont_sig, const float light_sig); private: void enabledChanged() override; @@ -1734,8 +1874,18 @@ private: void forcebwChanged(); void qtojChanged(); void jabcieChanged(); - void sigmoidqjcieChanged(); + void comprcieautoChanged(); + void normcieChanged(); + void gamutcieChanged(); + void illMethodChanged(); + void smoothciemetChanged(); + void primMethodChanged(); + void catMethodChanged(); void logcieChanged(); + void satcieChanged(); + void logcieqChanged(); + void smoothcieChanged(); + void sigcieChanged(); void logjzChanged(); void sigjzChanged(); void sigqChanged(); @@ -1744,6 +1894,23 @@ private: void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer, const double normHuerjz) override; void showmaskcieMethodChanged(); void enacieMaskChanged(); + void enacieMaskallChanged(); + void enacieMaskallChanged2(); + void guijzczhz(); + void toolcieChanged(); + void fftcieMaskChanged(); + void expprecamChanged(); + + float nextrx; + float nextry; + float nextbx; + float nextby; + float nextgx; + float nextgy; + float nextwx; + float nextwy; + float nextmx; + float nextmy; }; diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index b32ef5d6d..5417271ab 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -25,6 +25,8 @@ #include "locallab.h" #include "rtimage.h" #include "../rtengine/color.h" +#include "eventmapper.h" +#include "../rtengine/utils.h" #define MINNEIGH 0.1 #define MAXNEIGH 1500 @@ -141,7 +143,7 @@ LocallabTone::LocallabTone(): showmasktmMethod(Gtk::manage(new MyComboBoxText())), enatmMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), enatmMaskaft(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_AFTER_MASK")))), - // masktmCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), +// masktmCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), masktmCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, "", 1)), CCmasktmshape(static_cast(masktmCurveEditorG->addCurve(CT_Flat, "C", nullptr, false, false))), LLmasktmshape(static_cast(masktmCurveEditorG->addCurve(CT_Flat, "L", nullptr, false, false))), @@ -262,7 +264,7 @@ LocallabTone::LocallabTone(): tmBox3->pack_start(*lowthrest); tmBox3->pack_start(*higthrest); tmBox3->pack_start(*decayt); - // colBox3->pack_start(*invmaskc); + // colBox3->pack_start(*invmaskc); exprecovt->add(*tmBox3, false); pack_start(*exprecovt, false, false); @@ -568,6 +570,7 @@ void LocallabTone::adjusterChanged(Adjuster* a, double newval) } else if (a == decayt) { listener->panelChanged(Evlocallabdecayt, decayt->getTextValue() + spName); } + } } @@ -670,6 +673,7 @@ void LocallabTone::updateGUIToMode(const modeType new_type) expmasktm->show(); exprecovt->show(); decayt->hide(); + if (enatmMask->get_active()) { maskusablet->show(); maskunusablet->hide(); @@ -692,6 +696,7 @@ void LocallabTone::updateGUIToMode(const modeType new_type) slomasktm->show(); exprecovt->show(); decayt->show(); + if (enatmMask->get_active()) { maskusablet->show(); maskunusablet->hide(); @@ -717,7 +722,7 @@ void LocallabTone::updateMaskBackground(const double normChromar, const double n return false; } - ); + ); } void LocallabTone::equiltmChanged() @@ -742,7 +747,7 @@ void LocallabTone::showmasktmMethodChanged() locToolListener->resetOtherMaskView(this); } - if(exp->getEnabled()) { + if (exp->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskMethod, ""); } @@ -834,7 +839,7 @@ LocallabRetinex::LocallabRetinex(): showmaskretiMethod(Gtk::manage(new MyComboBoxText())), enaretiMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), enaretiMasktmap(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TM_MASK")))), - // maskretiCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), +// maskretiCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), maskretiCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, "", 1)), CCmaskretishape(static_cast(maskretiCurveEditorG->addCurve(CT_Flat, "C", nullptr, false, false))), LLmaskretishape(static_cast(maskretiCurveEditorG->addCurve(CT_Flat, "L", nullptr, false, false))), @@ -849,10 +854,10 @@ LocallabRetinex::LocallabRetinex(): Lmaskretishape(static_cast(mask2retiCurveEditorG->addCurve(CT_Diagonal, "L(L)"))), inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))) { - + auto m = ProcEventMapper::getInstance(); Evlocallabdehazeblack = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_DEHAZE_BLACK"); - + set_orientation(Gtk::ORIENTATION_VERTICAL); const LocallabParams::LocallabSpot defSpot; @@ -1005,9 +1010,9 @@ LocallabRetinex::LocallabRetinex(): deharetiBox->pack_start(*loglin); retiFrame->add(*deharetiBox); auxBox->add(*retiFrame); - // ToolParamBlock* const scopeBox = Gtk::manage(new ToolParamBlock()); - // scopeBox->pack_start(*sensih); - // auxBox->add(*scopeBox); +// ToolParamBlock* const scopeBox = Gtk::manage(new ToolParamBlock()); +// scopeBox->pack_start(*sensih); +// auxBox->add(*scopeBox); pack_start(*auxBox); ToolParamBlock* const retiBox = Gtk::manage(new ToolParamBlock()); retiBox->pack_start(*retinexMethod); @@ -1019,7 +1024,7 @@ LocallabRetinex::LocallabRetinex(): retiBox->pack_start(*limd); retiBox->pack_start(*offs); ToolParamBlock* const toolretiBox = Gtk::manage(new ToolParamBlock()); - // toolretiBox->pack_start(*chrrt); + // toolretiBox->pack_start(*chrrt); toolretiBox->pack_start(*darkness); toolretiBox->pack_start(*lightnessreti); toolretiBox->pack_start(*cliptm); @@ -1038,7 +1043,7 @@ LocallabRetinex::LocallabRetinex(): reBox3->pack_start(*lowthresr); reBox3->pack_start(*higthresr); reBox3->pack_start(*decayr); - // colBox3->pack_start(*invmaskc); + // colBox3->pack_start(*invmaskc); exprecovr->add(*reBox3, false); ToolParamBlock* const maskretiBox = Gtk::manage(new ToolParamBlock()); @@ -1095,7 +1100,7 @@ void LocallabRetinex::updateMinMax(const double cdma, const double cdmin, const return false; } - ); + ); } bool LocallabRetinex::isMaskViewActive() @@ -1275,7 +1280,7 @@ void LocallabRetinex::read(const rtengine::procparams::ProcParams* pp, const Par limd->setValue(spot.limd); offs->setValue(spot.offs); chrrt->setValue(0.); - // chrrt->setValue(spot.chrrt); + // chrrt->setValue(spot.chrrt); darkness->setValue(spot.darkness); lightnessreti->setValue(spot.lightnessreti); cliptm->setValue(spot.cliptm); @@ -1792,6 +1797,7 @@ void LocallabRetinex::updateGUIToMode(const modeType new_type) retitoolFrame->show(); exprecovr->show(); decayr->show(); + if (enaretiMask->get_active()) { maskusabler->show(); maskunusabler->hide(); @@ -1817,7 +1823,7 @@ void LocallabRetinex::updateMaskBackground(const double normChromar, const doubl return false; } - ); + ); } void LocallabRetinex::loglinChanged() @@ -1882,7 +1888,7 @@ void LocallabRetinex::showmaskretiMethodChanged() locToolListener->resetOtherMaskView(this); } - if(exp->getEnabled()) { + if (exp->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskMethod, ""); } @@ -2357,7 +2363,7 @@ void LocallabSharp::showmasksharMethodChanged() locToolListener->resetOtherMaskView(this); } - if(exp->getEnabled()) { + if (exp->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskMethod, ""); } @@ -2768,7 +2774,7 @@ LocallabContrast::LocallabContrast(): ToolParamBlock* const coBox = Gtk::manage(new ToolParamBlock()); coBox->pack_start(*sigmalc); coBox->pack_start(*LocalcurveEditorwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - // coBox->pack_start(*csThreshold); + // coBox->pack_start(*csThreshold); contFrame->add(*coBox); pack_start(*contFrame); // pack_start(*levelwav); @@ -2906,7 +2912,7 @@ LocallabContrast::LocallabContrast(): wwBox3->pack_start(*lowthresw); wwBox3->pack_start(*higthresw); wwBox3->pack_start(*decayw); - // colBox3->pack_start(*invmaskc); + // colBox3->pack_start(*invmaskc); exprecovw->add(*wwBox3, false); pack_start(*exprecovw, false, false); @@ -4080,6 +4086,7 @@ void LocallabContrast::updateGUIToMode(const modeType new_type) expmasklc->show(); exprecovw->show(); decayw->hide(); + if (enalcMask->get_active()) { maskusablew->show(); maskunusablew->hide(); @@ -4088,6 +4095,7 @@ void LocallabContrast::updateGUIToMode(const modeType new_type) maskusablew->hide(); maskunusablew->show(); } + gamlc->hide(); break; @@ -4110,6 +4118,7 @@ void LocallabContrast::updateGUIToMode(const modeType new_type) expmasklc->show(); exprecovw->show(); decayw->show(); + if (enalcMask->get_active()) { maskusablew->show(); maskunusablew->hide(); @@ -4136,7 +4145,7 @@ void LocallabContrast::updateMaskBackground(const double normChromar, const doub return false; } - ); + ); } void LocallabContrast::localcontMethodChanged() @@ -4335,7 +4344,7 @@ void LocallabContrast::showmasklcMethodChanged() locToolListener->resetOtherMaskView(this); } - if(exp->getEnabled()) { + if (exp->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskMethod, ""); } @@ -4384,6 +4393,7 @@ void LocallabContrast::updateContrastGUI1() expcontrastpyr->hide(); expcontrastpyr2->hide(); gamlc->hide(); + if (mode == Expert) { // Keep widget hidden in Normal and Simple mode fftwlc->show(); } @@ -4438,7 +4448,7 @@ LocallabCBDL::LocallabCBDL(): // CBDL specific widgets levFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LEVFRA")))), multiplier([]() -> std::array - { +{ std::array res = {}; for (unsigned int i = 0; i < res.size(); ++i) { @@ -4454,41 +4464,41 @@ LocallabCBDL::LocallabCBDL(): } return res; - } - ()), - chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0., 1.5, 0.01, 0.))), - threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 1., 0.01, 0.2))), - clarityml(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARITYML"), 0.1, 100., 0.1, 0.1))), - contresid(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTRESID"), -100, 100, 1, 0))), - softradiuscb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.5, 0.))), - sensicb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), - exprecovcb(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), - maskusablecb(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), - maskunusablecb(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUNUSABLE")))), - recothrescb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKRECOTHRES"), 1., 2., 0.01, 1.))), - lowthrescb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHRLOW"), 1., 80., 0.5, 12.))), - higthrescb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHR"), 20., 99., 0.5, 85.))), - decaycb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKDDECAY"), 0.5, 4., 0.1, 2.))), - expmaskcb(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOWCB")))), - showmaskcbMethod(Gtk::manage(new MyComboBoxText())), - enacbMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), - // maskcbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), - maskcbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, "", 1)), - CCmaskcbshape(static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "C", nullptr, false, false))), - LLmaskcbshape(static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "L", nullptr, false, false))), - HHmaskcbshape(static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "LC(h)", nullptr, false, true))), - blendmaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), - radmaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 0.))), - lapmaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LAPMASKCOL"), 0.0, 100.0, 0.1, 0.))), - chromaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), - gammaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.25, 4.0, 0.01, 1.))), - slomaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), - mask2cbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), - Lmaskcbshape(static_cast(mask2cbCurveEditorG->addCurve(CT_Diagonal, "L(L)"))), +} +()), +chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0., 1.5, 0.01, 0.))), +threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 1., 0.01, 0.2))), +clarityml(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARITYML"), 0.1, 100., 0.1, 0.1))), +contresid(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTRESID"), -100, 100, 1, 0))), +softradiuscb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.5, 0.))), +sensicb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), +exprecovcb(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), +maskusablecb(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), +maskunusablecb(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUNUSABLE")))), +recothrescb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKRECOTHRES"), 1., 2., 0.01, 1.))), +lowthrescb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHRLOW"), 1., 80., 0.5, 12.))), +higthrescb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHR"), 20., 99., 0.5, 85.))), +decaycb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKDDECAY"), 0.5, 4., 0.1, 2.))), +expmaskcb(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOWCB")))), +showmaskcbMethod(Gtk::manage(new MyComboBoxText())), +enacbMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), +// maskcbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), +maskcbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, "", 1)), +CCmaskcbshape(static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "C", nullptr, false, false))), +LLmaskcbshape(static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "L", nullptr, false, false))), +HHmaskcbshape(static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "LC(h)", nullptr, false, true))), +blendmaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), +radmaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 0.))), +lapmaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LAPMASKCOL"), 0.0, 100.0, 0.1, 0.))), +chromaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), +gammaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.25, 4.0, 0.01, 1.))), +slomaskcb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), +mask2cbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), +Lmaskcbshape(static_cast(mask2cbCurveEditorG->addCurve(CT_Diagonal, "L(L)"))), - lumacontrastMinusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_MINUS")))), - lumaneutralButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMANEUTRAL")))), - lumacontrastPlusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_PLUS")))) +lumacontrastMinusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_MINUS")))), +lumaneutralButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMANEUTRAL")))), +lumacontrastPlusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_PLUS")))) { set_orientation(Gtk::ORIENTATION_VERTICAL); @@ -4609,7 +4619,7 @@ LocallabCBDL::LocallabCBDL(): cbBox3->pack_start(*lowthrescb); cbBox3->pack_start(*higthrescb); cbBox3->pack_start(*decaycb); - // colBox3->pack_start(*invmaskc); + // colBox3->pack_start(*invmaskc); exprecovcb->add(*cbBox3, false); pack_start(*exprecovcb, false, false); @@ -5114,6 +5124,7 @@ void LocallabCBDL::updateGUIToMode(const modeType new_type) expmaskcb->show(); exprecovcb->show(); decaycb->hide(); + if (enacbMask->get_active()) { maskusablecb->show(); maskunusablecb->hide(); @@ -5132,6 +5143,7 @@ void LocallabCBDL::updateGUIToMode(const modeType new_type) lapmaskcb->show(); exprecovcb->show(); decaycb->show(); + if (enacbMask->get_active()) { maskusablecb->show(); maskunusablecb->hide(); @@ -5157,7 +5169,7 @@ void LocallabCBDL::updateMaskBackground(const double normChromar, const double n return false; } - ); + ); } void LocallabCBDL::showmaskcbMethodChanged() @@ -5167,7 +5179,7 @@ void LocallabCBDL::showmaskcbMethodChanged() locToolListener->resetOtherMaskView(this); } - if(exp->getEnabled()) { + if (exp->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskMethod, ""); } @@ -5234,18 +5246,25 @@ LocallabLog::LocallabLog(): LocallabTool(this, M("TP_LOCALLAB_LOG_TOOLNAME"), M("TP_LOCALLAB_LOG"), false), // Log encoding specific widgets - repar(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGREPART"), 1.0, 100.0, 1., 100.0))), + repar(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGREPART"), 1.0, 100.0, 0.5, 100.0))), ciecam(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_CIEC")))), autocompute(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_LOGAUTO")))), logPFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOGPFRA")))), - blackEv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLACK_EV"), -16.0, 0.0, 0.1, -5.0))), - whiteEv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WHITE_EV"), 0., 32.0, 0.1, 10.0))), + logPFrame2(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOGPFRA2")))), + blackEv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLACK_EV"), -16.00, 0.00, 0.01, -5.00))), + whiteEv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WHITE_EV"), 0.00, 32.00, 0.01, 10.00))), + whiteslog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGWHITESCIE"), -100, 100, 1, 0))), + blackslog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGBLACKSSCIE"), -100, 100, 1, 0))), + comprlog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COMPRCIE"), 0., 1., 0.01, 0.4))), + strelog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRENGTHCIELOG"), 0., 100., 0.5, 100.))), + satlog(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SATCIE")))), + fullimage(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FULLIMAGE")))), logFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOGFRA")))), Autogray(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AUTOGRAY")))), sourceGray(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_GRAY"), 1.0, 100.0, 0.1, 10.0))), sourceabs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_ABS"), 0.01, 16384.0, 0.01, 2000.0))), - sursour(Gtk::manage (new MyComboBoxText ())), + sursour(Gtk::manage(new MyComboBoxText())), surHBox(Gtk::manage(new Gtk::Box())), log1Frame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOG1FRA")))), log2Frame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOG2FRA")))), @@ -5264,7 +5283,7 @@ LocallabLog::LocallabLog(): //CurveEditorL(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_LOGCONTQ"))), //LshapeL(static_cast(CurveEditorL->addCurve(CT_Diagonal, "Q(Q)"))), targabs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_ABS"), 0.01, 16384.0, 0.01, 16.0))), - surround(Gtk::manage (new MyComboBoxText ())), + surround(Gtk::manage(new MyComboBoxText())), surrHBox(Gtk::manage(new Gtk::Box())), baselog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BASELOG"), 1.3, 3., 0.05, 2.))),//, Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), exprecovl(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), @@ -5282,7 +5301,7 @@ LocallabLog::LocallabLog(): expmaskL(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOWC")))), showmaskLMethod(Gtk::manage(new MyComboBoxText())), enaLMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), - // maskCurveEditorL(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASKCOL"))), +// maskCurveEditorL(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASKCOL"))), maskCurveEditorL(new CurveEditorGroup(options.lastlocalCurvesDir, "", 1)), CCmaskshapeL(static_cast(maskCurveEditorL->addCurve(CT_Flat, "C", nullptr, false, false))), LLmaskshapeL(static_cast(maskCurveEditorL->addCurve(CT_Flat, "L", nullptr, false, false))), @@ -5295,6 +5314,13 @@ LocallabLog::LocallabLog(): { + auto m = ProcEventMapper::getInstance(); + Evlocallabwhiteslog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_LOG_WHITES"); + Evlocallabblackslog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_LOG_BLACKS"); + Evlocallabcomprlog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_LOG_COMPR"); + Evlocallabstrelog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_LOG_STRE"); + Evlocallabsatlog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_LOG_SAT"); + set_orientation(Gtk::ORIENTATION_VERTICAL); // Parameter Log encoding specific widgets @@ -5307,9 +5333,16 @@ LocallabLog::LocallabLog(): whiteEv->setLogScale(16, 0); whiteEv->setAdjusterListener(this); + + whiteslog->setAdjusterListener(this); + blackslog->setAdjusterListener(this); + comprlog->setAdjusterListener(this); + strelog->setAdjusterListener(this); + ciecamconn = ciecam->signal_toggled().connect(sigc::mem_fun(*this, &LocallabLog::ciecamChanged)); fullimageConn = fullimage->signal_toggled().connect(sigc::mem_fun(*this, &LocallabLog::fullimageChanged)); + satlogconn = satlog->signal_toggled().connect(sigc::mem_fun(*this, &LocallabLog::satlogChanged)); AutograyConn = Autogray->signal_toggled().connect(sigc::mem_fun(*this, &LocallabLog::AutograyChanged)); @@ -5368,30 +5401,31 @@ LocallabLog::LocallabLog(): anglog->setAdjusterListener(this); - surHBox->set_spacing (2); - surHBox->set_tooltip_markup (M ("TP_LOCALLAB_LOGSURSOUR_TOOLTIP")); - Gtk::Label* surLabel = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_SURROUND") + ":")); - surHBox->pack_start (*surLabel, Gtk::PACK_SHRINK); - sursour->append (M ("TP_COLORAPP_SURROUND_AVER")); - sursour->append (M ("TP_COLORAPP_SURROUND_DIM")); - sursour->append (M ("TP_COLORAPP_SURROUND_DARK")); - sursour->set_active (0); - surHBox->pack_start (*sursour); - sursourconn = sursour->signal_changed().connect ( sigc::mem_fun (*this, &LocallabLog::sursourChanged) ); + surHBox->set_spacing(2); + surHBox->set_tooltip_markup(M("TP_LOCALLAB_LOGSURSOUR_TOOLTIP")); + Gtk::Label* surLabel = Gtk::manage(new Gtk::Label(M("TP_COLORAPP_SURROUND") + ":")); + surHBox->pack_start(*surLabel, Gtk::PACK_SHRINK); + sursour->append(M("TP_COLORAPP_SURROUND_AVER")); + sursour->append(M("TP_COLORAPP_SURROUND_DIM")); + sursour->append(M("TP_COLORAPP_SURROUND_DARK")); + sursour->append(M("TP_COLORAPP_SURROUND_EXDARK")); + sursour->set_active(0); + surHBox->pack_start(*sursour); + sursourconn = sursour->signal_changed().connect(sigc::mem_fun(*this, &LocallabLog::sursourChanged)); - surrHBox->set_spacing (2); - surrHBox->set_tooltip_markup (M ("TP_COLORAPP_SURROUND_TOOLTIP")); - Gtk::Label* surrLabel = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_SURROUND") + ":")); - surrHBox->pack_start (*surrLabel, Gtk::PACK_SHRINK); - surround->append (M ("TP_COLORAPP_SURROUND_AVER")); - surround->append (M ("TP_COLORAPP_SURROUND_DIM")); - surround->append (M ("TP_COLORAPP_SURROUND_DARK")); - surround->append (M ("TP_COLORAPP_SURROUND_EXDARK")); - surround->set_active (0); - surrHBox->pack_start (*surround); - surroundconn = surround->signal_changed().connect ( sigc::mem_fun (*this, &LocallabLog::surroundChanged) ); + surrHBox->set_spacing(2); + surrHBox->set_tooltip_markup(M("TP_COLORAPP_SURROUND_TOOLTIP")); + Gtk::Label* surrLabel = Gtk::manage(new Gtk::Label(M("TP_COLORAPP_SURROUND") + ":")); + surrHBox->pack_start(*surrLabel, Gtk::PACK_SHRINK); + surround->append(M("TP_COLORAPP_SURROUND_AVER")); + surround->append(M("TP_COLORAPP_SURROUND_DIM")); + surround->append(M("TP_COLORAPP_SURROUND_DARK")); + surround->append(M("TP_COLORAPP_SURROUND_EXDARK")); + surround->set_active(0); + surrHBox->pack_start(*surround); + surroundconn = surround->signal_changed().connect(sigc::mem_fun(*this, &LocallabLog::surroundChanged)); setExpandAlignProperties(expmaskL, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); @@ -5441,11 +5475,21 @@ LocallabLog::LocallabLog(): pack_start(*repar); pack_start(*ciecam); logPFrame->set_label_align(0.025, 0.5); + logPFrame2->set_label_align(0.025, 0.5); ToolParamBlock* const logPBox = Gtk::manage(new ToolParamBlock()); + ToolParamBlock* const logPBox2 = Gtk::manage(new ToolParamBlock()); logPBox->pack_start(*autocompute); logPBox->pack_start(*blackEv); logPBox->pack_start(*whiteEv); + logPBox->pack_start(*whiteslog); + logPBox->pack_start(*blackslog); + logPBox2->pack_start(*comprlog); + // logPBox2->pack_start(*strelog); + logPBox2->pack_start(*satlog); + logPFrame2->add(*logPBox2); + logPBox->pack_start(*logPFrame2); logPBox->pack_start(*fullimage); + logPFrame->add(*logPBox); pack_start(*logPFrame); // Gtk::Frame* const logFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOGFRA"))); @@ -5454,7 +5498,7 @@ LocallabLog::LocallabLog(): logFBox->pack_start(*Autogray); logFBox->pack_start(*sourceGray); logFBox->pack_start(*sourceabs); - logFBox->pack_start (*surHBox); + logFBox->pack_start(*surHBox); // logFBox->pack_start(*baselog); logFrame->add(*logFBox); pack_start(*logFrame); @@ -5483,7 +5527,7 @@ LocallabLog::LocallabLog(): logP2Box->pack_start(*targetGray); logP2Box->pack_start(*targabs); logP2Box->pack_start(*catad); - logP2Box->pack_start (*surrHBox); + logP2Box->pack_start(*surrHBox); ToolParamBlock* const logBox3 = Gtk::manage(new ToolParamBlock()); logBox3->pack_start(*maskusablel, Gtk::PACK_SHRINK, 0); logBox3->pack_start(*maskunusablel, Gtk::PACK_SHRINK, 0); @@ -5491,7 +5535,7 @@ LocallabLog::LocallabLog(): logBox3->pack_start(*lowthresl); logBox3->pack_start(*higthresl); logBox3->pack_start(*decayl); - // colBox3->pack_start(*invmaskc); + // colBox3->pack_start(*invmaskc); exprecovl->add(*logBox3, false); ToolParamBlock* const logP3Box = Gtk::manage(new ToolParamBlock()); @@ -5513,7 +5557,7 @@ LocallabLog::LocallabLog(): // pack_start(*sensilog); pack_start(*expmaskL, false, false); - // Gtk::Frame* const gradlogFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GRADLOGFRA"))); +// Gtk::Frame* const gradlogFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GRADLOGFRA"))); gradlogFrame->set_label_align(0.025, 0.5); ToolParamBlock* const gradlogBox = Gtk::manage(new ToolParamBlock()); gradlogBox->pack_start(*strlog); @@ -5550,11 +5594,15 @@ void LocallabLog::updateAdviceTooltips(const bool showTooltips) log2Frame->set_tooltip_text(M("TP_LOCALLAB_LOGVIEWING_TOOLTIP")); autocompute->set_tooltip_text(M("TP_LOCALLAB_LOGAUTO_TOOLTIP")); Autogray->set_tooltip_text(M("TP_LOCALLAB_LOGAUTOGRAY_TOOLTIP")); - // blackEv->set_tooltip_text(M("TP_LOCALLAB_LOGBLACKWHEV_TOOLTIP")); - // whiteEv->set_tooltip_text(M("TP_LOCALLAB_LOGBLACKWHEV_TOOLTIP")); + // blackEv->set_tooltip_text(M("TP_LOCALLAB_LOGBLACKWHEV_TOOLTIP")); + // whiteEv->set_tooltip_text(M("TP_LOCALLAB_LOGBLACKWHEV_TOOLTIP")); exprecovl->set_tooltip_markup(M("TP_LOCALLAB_MASKRELOG_TOOLTIP")); blackEv->set_tooltip_text(""); whiteEv->set_tooltip_text(""); + whiteslog->set_tooltip_text(M("TP_LOCALLAB_SIGMOIDWHITESCIE_TOOLTIP")); + blackslog->set_tooltip_text(M("TP_LOCALLAB_SIGMOIDWHITESCIE_TOOLTIP")); + comprlog->set_tooltip_text(M("TP_LOCALLAB_COMPRLOG_TOOLTIP")); + sourceGray->set_tooltip_text(M("TP_LOCALLAB_JZLOGYBOUT_TOOLTIP")); sourceabs->set_tooltip_text(M("TP_COLORAPP_ADAPSCEN_TOOLTIP")); targabs->set_tooltip_text(M("TP_COLORAPP_VIEWING_ABSOLUTELUMINANCE_TOOLTIP")); @@ -5634,6 +5682,9 @@ void LocallabLog::updateAdviceTooltips(const bool showTooltips) decayl->set_tooltip_text(""); lowthresl->set_tooltip_text(""); higthresl->set_tooltip_text(""); + whiteslog->set_tooltip_text(""); + blackslog->set_tooltip_text(""); + comprlog->set_tooltip_text(""); } } @@ -5645,9 +5696,10 @@ void LocallabLog::disableListener() autoconn.block(true); fullimageConn.block(true); ciecamconn.block(true); + satlogconn.block(true); enaLMaskConn.block(true); - surroundconn.block (true); - sursourconn.block (true); + surroundconn.block(true); + sursourconn.block(true); AutograyConn.block(true); showmaskLMethodConn.block(true); } @@ -5659,9 +5711,10 @@ void LocallabLog::enableListener() autoconn.block(false); fullimageConn.block(false); ciecamconn.block(false); + satlogconn.block(false); enaLMaskConn.block(false); - surroundconn.block (false); - sursourconn.block (false); + surroundconn.block(false); + sursourconn.block(false); AutograyConn.block(false); showmaskLMethodConn.block(false); } @@ -5706,34 +5759,43 @@ void LocallabLog::read(const rtengine::procparams::ProcParams* pp, const ParamsE repar->setValue(spot.repar); whiteEv->setValue(spot.whiteEv); -/* if(whiteEv->getValue() < 1.5){ - whiteEv->setValue(1.5); - } -*/ + whiteslog->setValue(spot.whiteslog); + blackslog->setValue(spot.blackslog); + comprlog->setValue(spot.comprlog); + strelog->setValue(spot.strelog); + + /* if(whiteEv->getValue() < 1.5){ + whiteEv->setValue(1.5); + } + */ if (spot.sursour == "Average") { - sursour->set_active (0); + sursour->set_active(0); } else if (spot.sursour == "Dim") { - sursour->set_active (1); + sursour->set_active(1); } else if (spot.sursour == "Dark") { - sursour->set_active (2); + sursour->set_active(2); + } else if (spot.sursour == "exDark") { + sursour->set_active(3); } if (spot.surround == "Average") { - surround->set_active (0); + surround->set_active(0); } else if (spot.surround == "Dim") { - surround->set_active (1); + surround->set_active(1); } else if (spot.surround == "Dark") { - surround->set_active (2); + surround->set_active(2); } else if (spot.surround == "ExtremelyDark") { - surround->set_active (3); + surround->set_active(3); } + recothresl->setValue((double)spot.recothresl); lowthresl->setValue((double)spot.lowthresl); higthresl->setValue((double)spot.higthresl); decayl->setValue((double)spot.decayl); ciecam->set_active(spot.ciecam); + satlog->set_active(spot.satlog); fullimage->set_active(spot.fullimage); Autogray->set_active(spot.Autogray); sourceGray->setValue(spot.sourceGray); @@ -5795,8 +5857,13 @@ void LocallabLog::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.repar = repar->getValue(); spot.blackEv = blackEv->getValue(); spot.whiteEv = whiteEv->getValue(); + spot.whiteslog = whiteslog->getIntValue(); + spot.blackslog = blackslog->getIntValue(); + spot.comprlog = comprlog->getValue(); + spot.strelog = strelog->getValue(); spot.fullimage = fullimage->get_active(); spot.ciecam = ciecam->get_active(); + spot.satlog = satlog->get_active(); spot.Autogray = Autogray->get_active(); spot.sourceGray = sourceGray->getValue(); spot.sourceabs = sourceabs->getValue(); @@ -5837,6 +5904,8 @@ void LocallabLog::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.sursour = "Dim"; } else if (sursour->get_active_row_number() == 2) { spot.sursour = "Dark"; + } else if (sursour->get_active_row_number() == 3) { + spot.sursour = "exDark"; } if (surround->get_active_row_number() == 0) { @@ -5887,12 +5956,12 @@ void LocallabLog::updateGUIToMode(const modeType new_type) case Simple: // Expert and Normal mode widgets are hidden in Simple mode ciecam->hide(); - ciecam->set_active(false); + ciecam->set_active(true); sourceabs->hide(); targabs->hide(); saturl->hide(); chroml->hide(); - contl->hide(); + contl->show(); contthres->hide(); lightl->hide(); lightq->hide(); @@ -5924,13 +5993,14 @@ void LocallabLog::updateGUIToMode(const modeType new_type) lightq->show(); contl->show(); contthres->show(); - contq->show(); + contq->hide(); colorfl->show(); surrHBox->show(); expL->hide(); surHBox->hide(); expmaskL->show(); gradlogFrame->show(); + if (enaLMask->get_active()) { maskusablel->show(); maskunusablel->hide(); @@ -5965,6 +6035,7 @@ void LocallabLog::updateGUIToMode(const modeType new_type) expmaskL->show(); gradlogFrame->show(); surHBox->show(); + if (enaLMask->get_active()) { maskusablel->show(); maskunusablel->hide(); @@ -5973,6 +6044,7 @@ void LocallabLog::updateGUIToMode(const modeType new_type) maskusablel->hide(); maskunusablel->show(); } + exprecovl->show(); decayl->show(); @@ -6036,7 +6108,7 @@ void LocallabLog::showmaskLMethodChanged() locToolListener->resetOtherMaskView(this); } - if(exp->getEnabled()) { + if (exp->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskMethod, ""); } @@ -6096,6 +6168,10 @@ void LocallabLog::setDefaults(const rtengine::procparams::ProcParams* defParams, repar->setDefault(defSpot.repar); blackEv->setDefault(defSpot.blackEv); whiteEv->setDefault(defSpot.whiteEv); + whiteslog->setDefault(defSpot.whiteslog); + blackslog->setDefault(defSpot.blackslog); + comprlog->setDefault(defSpot.comprlog); + strelog->setDefault(defSpot.strelog); sourceGray->setDefault(defSpot.sourceGray); sourceabs->setDefault(defSpot.sourceabs); targabs->setDefault(defSpot.targabs); @@ -6152,6 +6228,34 @@ void LocallabLog::adjusterChanged(Adjuster* a, double newval) } } + if (a == whiteslog) { + if (listener) { + listener->panelChanged(Evlocallabwhiteslog, + whiteslog->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + + if (a == blackslog) { + if (listener) { + listener->panelChanged(Evlocallabblackslog, + blackslog->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + + if (a == comprlog) { + if (listener) { + listener->panelChanged(Evlocallabcomprlog, + comprlog->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + + if (a == strelog) { + if (listener) { + listener->panelChanged(Evlocallabstrelog, + strelog->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + if (a == sourceGray) { if (listener) { listener->panelChanged(EvlocallabsourceGray, @@ -6352,9 +6456,9 @@ void LocallabLog::updateAutocompute(const float blackev, const float whiteev, co enableListener(); - return false; + return false; } - ); + ); } } @@ -6439,7 +6543,7 @@ void LocallabLog::ciecamChanged() catad->hide(); surrHBox->hide(); } -*/ + */ if (isLocActivated && exp->getEnabled()) { if (listener) { if (ciecam->get_active()) { @@ -6453,6 +6557,21 @@ void LocallabLog::ciecamChanged() } } +void LocallabLog::satlogChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (satlog->get_active()) { + listener->panelChanged(Evlocallabsatlog, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabsatlog, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + void LocallabLog::fullimageChanged() { @@ -6483,7 +6602,7 @@ void LocallabLog::updateMaskBackground(const double normChromar, const double no return false; } - ); + ); } @@ -6537,6 +6656,9 @@ void LocallabLog::updateLogGUI() blackEv->set_sensitive(false); whiteEv->set_sensitive(false); sourceGray->set_sensitive(false); + blackslog->set_sensitive(true); + whiteslog->set_sensitive(true); + if (mode == Expert || mode == Normal) { sourceabs->set_sensitive(false); } else { @@ -6546,15 +6668,19 @@ void LocallabLog::updateLogGUI() blackEv->set_sensitive(true); whiteEv->set_sensitive(true); sourceGray->set_sensitive(true); - if (mode == Expert || mode == Normal){ + blackslog->set_sensitive(false); + whiteslog->set_sensitive(false); + + if (mode == Expert || mode == Normal) { sourceabs->set_sensitive(true); } else { sourceabs->hide(); } } - if (mode == Expert || mode == Normal) { // Keep widget hidden in Simple mode - exprecovl->show(); - } + + if (mode == Expert || mode == Normal) { // Keep widget hidden in Simple mode + exprecovl->show(); + } } @@ -7316,7 +7442,7 @@ void LocallabMask::updateMaskBackground(const double normChromar, const double n return false; } - ); + ); } void LocallabMask::showmask_MethodChanged() @@ -7326,7 +7452,7 @@ void LocallabMask::showmask_MethodChanged() locToolListener->resetOtherMaskView(this); } - if(exp->getEnabled()) { + if (exp->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskMethod, ""); } @@ -7401,16 +7527,17 @@ Locallabcie::Locallabcie(): sensicie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), reparcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGREPART"), 1.0, 100.0, 1., 100.0))), jabcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_JAB")))), - modecam(Gtk::manage (new MyComboBoxText ())), - modecie(Gtk::manage (new MyComboBoxText ())), + modecam(Gtk::manage(new MyComboBoxText())), + modecie(Gtk::manage(new MyComboBoxText())), jzFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_JZFRA")))), modeHBoxcam(Gtk::manage(new Gtk::Box())), modeHBoxcie(Gtk::manage(new Gtk::Box())), cieFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOGFRA")))), + expcamscene(Gtk::manage(new MyExpander(false, Gtk::manage(new Gtk::Box())))), Autograycie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AUTOGRAYCIE")))), sourceGraycie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_GRAY"), 1.0, 100.0, 0.1, 18.0))), sourceabscie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_ABS"), 0.01, 16384.0, 0.01, 2000.0))), - sursourcie(Gtk::manage (new MyComboBoxText ())), + sursourcie(Gtk::manage(new MyComboBoxText())), surHBoxcie(Gtk::manage(new Gtk::Box())), cie1Frame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOG1FRA")))), cie1lightFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CIELIGHTFRA")))), @@ -7426,7 +7553,7 @@ Locallabcie::Locallabcie(): adapjzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_JZADAP"), 1., 10., 0.05, 4.))), jz100(Gtk::manage(new Adjuster(M("TP_LOCALLAB_JZ100"), 0.10, 0.90, 0.01, 0.25))), pqremap(Gtk::manage(new Adjuster(M("TP_LOCALLAB_JZPQREMAP"), 100., 10000., 0.1, 120.))), - pqremapcam16(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CAM16PQREMAP"), 100., 10000., 0.1, 100.))), + pqremapcam16(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CAM16PQREMAP"), 100., 10000., 1., 100.))), forcejz(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_JZFORCE")))), expjz(Gtk::manage(new MyExpander(false, Gtk::manage(new Gtk::Box())))), jzshFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_JZSHFRA")))), @@ -7447,27 +7574,87 @@ Locallabcie::Locallabcie(): clarisoftjz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.5, 0.))), expcam16(Gtk::manage(new MyExpander(false, Gtk::manage(new Gtk::Box())))), + expcamviewing(Gtk::manage(new MyExpander(false, Gtk::manage(new Gtk::Box())))), lightqcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGLIGHTQ"), -100., 100., 0.05, 0.))), contlcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCONTL"), -100., 100., 0.5, 0.))), contqcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCONQL"), -100., 100., 0.5, 0.))), + lightsigqcie(Gtk::manage(new Adjuster(M(""), -100., 100., 0.5, 0.))), + contsigqcie(Gtk::manage(new Adjuster(M(""), -100., 100., 0.5, 0.))), + contthrescie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCONTHRES"), -1., 1., 0.01, 0.))), logjzFrame(Gtk::manage(new Gtk::Frame())), logjz(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_JZLOG")))), - blackEvjz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLACK_EV"), -16.0, 0.0, 0.1, -5.0))), - whiteEvjz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WHITE_EV"), 0., 32.0, 0.1, 10.0))), + blackEvjz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLACK_EV"), -16.00, 0.00, 0.01, -5.00))), + whiteEvjz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WHITE_EV"), 0.00, 32.000, 0.01, 10.00))), targetjz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_JZTARGET_EV"), 4., 80.0, 0.1, 18.0))), bevwevFrame(Gtk::manage(new Gtk::Frame())), forcebw(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_BWFORCE")))), - + sigBox(Gtk::manage(new ToolParamBlock())), sigmoidFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SIGFRA")))), + sigmoidnormFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SIGNORM")))), sigq(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SIGFRA")))), sigmoidldacie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDLAMBDA"), 0.0, 1., 0.01, 0.5))), - sigmoidthcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDTH"), 0.1, 4., 0.01, 1., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), - sigmoidblcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDBL"), 0.5, 1.5, 0.01, 1.))), - sigmoidqjcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SIGMOIDQJ")))), + sigmoidthcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDTH"), 0.1, 4., 0.01, 1.2, Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), + sigmoidsenscie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDSENSI"), 0.1, 1.5, 0.01, 0.9))), + sigmoidblcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDBL"), 0.05, 1., 0.01, 0.75))), + autocomprHBox(Gtk::manage(new Gtk::Box())), + comprcieauto(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_SIGMOIDLOGAUTO")))), + normcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SIGMOIDNORMCIE")))), + modeHBoxbwev(Gtk::manage(new Gtk::Box())), + bwevMethod(Gtk::manage(new MyComboBoxText())), + logcieFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOGCIE")))), logcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LOGCIE")))), + comprBox(Gtk::manage(new ToolParamBlock())), + comprcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COMPRCIE"), 0., 1., 0.01, 0.4))), + strcielog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRENGTHCIELOG"), 0., 100., 0.5, 80.))), + satcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SATCIE")))), + logcieq(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LOGCIEQ")))), + comprcieth(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COMPRCIETH"), 0., 25., 0.01, 6.))), + + expprecam(Gtk::manage(new MyExpander(true, Gtk::manage(new Gtk::Box())))), + + gamjcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGGAMJCIE"), 0.7, 10., 0.01, 2.4))), + slopjcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGSLOPJCIE"), 0., 500., 0.01, 12.923))), + midtcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MIDTCIE"), -100, 100, 1, 0))), + smoothcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SMOOTHCIE_SCA")))), + ciesmoothBox(Gtk::manage(new ToolParamBlock())), + smoothBox(Gtk::manage(new Gtk::Box())), + smoothciemet(Gtk::manage(new MyComboBoxText())), + slopesmo(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOPESMOOTH"), 0.6, 1.6, 0.01, 1.))), + whitescie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGWHITESCIE"), -100, 100, 1, 0))), + blackscie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGBLACKSSCIE"), -100, 100, 1, 0))), + willBox(Gtk::manage(new Gtk::Box())), + illMethod(Gtk::manage(new MyComboBoxText())), + wprimBox(Gtk::manage(new Gtk::Box())), + primMethod(Gtk::manage(new MyComboBoxText())), + primCoordGridl(Gtk::manage(new Gtk::Grid())), + trcFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_TRCFRAME")))), + smoothFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CIE_SMOOTHFRAME")))), + primillFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_PRIMILLFRAME")))), + redBox(Gtk::manage(new ToolParamBlock())), + redxl(Gtk::manage(new Adjuster(M("TC_PRIM_REDX"), 0.41, 1.0, 0.0001, 0.7347))), + redyl(Gtk::manage(new Adjuster(M("TC_PRIM_REDY"), 0.0, 0.70, 0.0001, 0.2653))), + grexl(Gtk::manage(new Adjuster(M("TC_PRIM_GREX"), -0.1, 0.4, 0.0001, 0.1596))), + greyl(Gtk::manage(new Adjuster(M("TC_PRIM_GREY"), 0.50, 1.0, 0.0001, 0.8404))), + bluxl(Gtk::manage(new Adjuster(M("TC_PRIM_BLUX"), -0.1, 0.4, 0.0001, 0.0366))), + bluyl(Gtk::manage(new Adjuster(M("TC_PRIM_BLUY"), -0.1, 0.49, 0.0001, 0.0001))), + refi(Gtk::manage(new Adjuster(M("TC_PRIM_REFI"), -0.5, 1., 0.0001, 0.))), + + gridFramecie(Gtk::manage(new Gtk::Frame(M("TP_ICM_WORKING_CIEDIAG")))), + labgridcie(Gtk::manage(new LabGrid(EvlocallabGridciexy, M("TP_ICM_LABGRID_CIEXY"), true, true, false))), + colorFramecie(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_COLORFRAME")))), + + catBox(Gtk::manage(new Gtk::Box())), + catMethod(Gtk::manage(new MyComboBoxText())), + gamutcieBox(Gtk::manage(new Gtk::Box())), + gamutcie(Gtk::manage(new Gtk::CheckButton(M("TP_ICM_GAMUT")))), + shiftxl(Gtk::manage(new Adjuster(M("TC_LOCALLAB_PRIM_SHIFTX"), -0.20, 0.20, 0.0001, 0.))), + shiftyl(Gtk::manage(new Adjuster(M("TC_LOCALLAB_PRIM_SHIFTY"), -0.20, 0.20, 0.0001, 0.))), + sigmoidjzFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SIGJZFRA")))), + sigmoid2Frame(Gtk::manage(new Gtk::Frame(M("")))), + sigcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SIGCIE")))), sigjz(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SIGJZFRA")))), sigmoidldajzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDLAMBDA"), 0., 1.0, 0.01, 0.5))), sigmoidthjzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDTH"), 0.1, 4., 0.01, 1., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), @@ -7504,26 +7691,19 @@ Locallabcie::Locallabcie(): chjzcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_JZCH")))), strsoftjzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_JZSTRSOFTCIE"), 0, 100., 0.5, 100.))), -/* - ciezFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_ZCAMFRA")))), - - lightlzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGLIGHTL"), -100., 100., 0.5, 0.))), - lightqzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGLIGHTQ"), -100., 100., 0.05, 0.))), - contlzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCONTL"), -100., 100., 0.5, 0.))), - contqzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCONQL"), -100., 100., 0.5, 0.))), - contthreszcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ZCAMTHRES"), 0., 1., 0.01, 0.))), - colorflzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCOLORFL"), -100., 100., 0.5, 0.))), - saturzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SATURV"), -100., 100., 0.5, 0.))), - chromzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROML"), -100., 100., 0.5, 0.))), -*/ expLcie(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_CIETOOLEXP")))), cie2Frame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOG2FRA")))), targetGraycie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TARGET_GRAY"), 5.0, 80.0, 0.1, 18.0))), targabscie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_ABS"), 0.01, 16384.0, 0.01, 16.0))), - detailcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DETAIL"), 0., 100., 0.1, 0.))), + detailcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DETAIL"), 0., 100., 0.1, 30.))), + detailciejz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DETAIL"), 0., 100., 0.1, 30.))), catadcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CATAD"), -100., 100., 0.5, 0., Gtk::manage(new RTImage("circle-blue-small")), Gtk::manage(new RTImage("circle-orange-small"))))), - surroundcie(Gtk::manage (new MyComboBoxText ())), + surroundcie(Gtk::manage(new MyComboBoxText())), surrHBoxcie(Gtk::manage(new Gtk::Box())), + expgradcie(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_EXPGRAD")))), + strgradcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -4., 4., 0.05, 0.))), + anggradcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180, 180, 0.1, 0.))), + exprecovcie(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), maskusablecie(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), maskunusablecie(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUNUSABLE")))), @@ -7534,22 +7714,89 @@ Locallabcie::Locallabcie(): expmaskcie(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOWS")))), showmaskcieMethod(Gtk::manage(new MyComboBoxText())), enacieMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), + enacieMaskall(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASKALL")))), // maskSHCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), maskcieCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, "", 1)), CCmaskcieshape(static_cast(maskcieCurveEditorG->addCurve(CT_Flat, "C", nullptr, false, false))), LLmaskcieshape(static_cast(maskcieCurveEditorG->addCurve(CT_Flat, "L", nullptr, false, false))), HHmaskcieshape(static_cast(maskcieCurveEditorG->addCurve(CT_Flat, "LC(h)", nullptr, false, true))), + struFramecie(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LABSTRUM")))), + strumaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUMASKCOL"), 0., 200., 0.1, 0.))), + toolcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TOOLCOL")))), + blurFramecie(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LABBLURM")))), + fftcieMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FFTCOL_MASK")))), + contcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTCOL"), 0., 200., 0.5, 0.))), + blurcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURCOL"), 0.2, 100., 0.5, 0.2))), blendmaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), radmaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 0.))), lapmaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LAPMASKCOL"), 0.0, 100.0, 0.1, 0.))), chromaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), gammaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.25, 4.0, 0.01, 1.))), slomaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), + highmaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_HIGHMASKCOL"), 0, 100, 1, 0))), + shadmaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHAMASKCOL"), 0, 100, 1, 0))), + maskcieHCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, "")), + HHhmaskcieshape(static_cast(maskcieHCurveEditorG->addCurve(CT_Flat, "h(h)", nullptr, false, true))), mask2cieCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), - Lmaskcieshape(static_cast(mask2cieCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) + Lmaskcieshape(static_cast(mask2cieCurveEditorG->addCurve(CT_Diagonal, "L(L)"))), + wavFramecie(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_TOOLMASK_2")))), + mask2cieCurveEditorGwav(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVMASK"))), + LLmaskcieshapewav(static_cast(mask2cieCurveEditorGwav->addCurve(CT_Flat, "L(L)", nullptr, false, false))), + quaHcieBox(Gtk::manage(new Gtk::Box())), + csThresholdcie(Gtk::manage(new ThresholdAdjuster(M("TP_LOCALLAB_CSTHRESHOLDBLUR"), 0, 9, 0, 0, 6, 5, 0, false))) - { +{ + auto m = ProcEventMapper::getInstance(); + Evlocallabnormcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_NORM"); + Evlocallabstrumaskcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_STRU"); + EvLocallabtoolcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_STRU_TOOL"); + EvLocallabfftcieMask = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_BLURFFT"); + Evlocallabcontcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_BLURCONT"); + Evlocallabblurcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_BLURRAD"); + Evlocallabhighmaskcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_HIGH"); + Evlocallabshadmaskcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_SHAD"); + Evlocallabsigmoidsenscie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SIGADAP"); + EvlocallabLLmaskcieshapewav = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_WLC"); + EvlocallabcsThresholdcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_WLEV"); + Evlocallabcomprcie = m->newEvent(HDR, "HISTORY_MSG_LOCAL_CIE_BRICOMP"); + Evlocallabstrcielog = m->newEvent(HDR, "HISTORY_MSG_LOCAL_CIE_STRLOG"); + Evlocallabsatcie = m->newEvent(HDR, "HISTORY_MSG_LOCAL_CIE_SATCIE"); + Evlocallablogcieq = m->newEvent(HDR, "HISTORY_MSG_LOCAL_CIE_LOGCIEQ"); + Evlocallabcomprcieth = m->newEvent(HDR, "HISTORY_MSG_LOCAL_CIE_BRICOMPTH"); + EvlocallabHHhmaskcieshape = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_CHH"); + EvlocallabbwevMethod = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SIGMET"); + Evlocallabgamjcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_GAM"); + Evlocallabslopjcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SLOP"); + Evlocallabmidtcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_MIDT"); + Evlocallabslopesmo = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SLOPESMO"); + Evlocallabsmoothcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SMOOTH"); + Evlocallabsigcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SIG"); + Evlocallabillcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_ILL"); + Evlocallabprimcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_PRIM"); + Evlocallabcatcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_CAT"); + Evlocallabwhitescie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_WHITES"); + Evlocallabblackscie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_BLACKS"); + Evlocallabredxl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_REDXL"); + Evlocallabredyl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_REDYL"); + Evlocallabgrexl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_GREXL"); + Evlocallabgreyl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_GREYL"); + Evlocallabbluxl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_BLUXL"); + Evlocallabbluyl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_BLUYL"); + EvlocallabGridciexy = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_LABGRIDCIE"); + Evlocallabgamutcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_GAMUTCIE"); + Evlocallabexpprecam = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_EXPPRECAM"); + Evlocallablightsigqcie = m->newEvent(AUTOEXP, ""); + Evlocallabcontsigqcie = m->newEvent(AUTOEXP, ""); + Evlocallabrefi = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_REFI"); + Evlocallabshiftxl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SHIFTXL"); + Evlocallabshiftyl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SHIFTYL"); + Evlocallabanggradcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_ANGGRAD"); + Evlocallabstrgradcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_STRGRAD"); + Evlocallabdetailciejz = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_DETAILJZ"); + EvlocallabenacieMaskall = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_ENAMASKALL"); + Evlocallabsmoothciemet = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SMOOTHMET"); + set_orientation(Gtk::ORIENTATION_VERTICAL); // Parameter Ciecam specific widgets @@ -7560,89 +7807,285 @@ Locallabcie::Locallabcie(): pack_start(*sensicie); pack_start(*reparcie); - modeHBoxcam->set_spacing (2); + modeHBoxcam->set_spacing(2); //modeHBoxcam->set_tooltip_markup (M ("TP_LOCALLAB_CAMMODE_TOOLTIP")); - Gtk::Label* modeLabelcam = Gtk::manage (new Gtk::Label (M ("TP_LOCALLAB_CAMMODE") + ":")); - modeHBoxcam->pack_start (*modeLabelcam, Gtk::PACK_SHRINK); - modecam->append (M ("TP_LOCALLAB_CAMMODE_CAM16")); - modecam->append (M ("TP_LOCALLAB_CAMMODE_JZ")); - // modecam->append (M ("TP_LOCALLAB_CAMMODE_ALL")); -// modecam->append (M ("TP_LOCALLAB_CAMMODE_ZCAM")); - modecam->set_active (0); - modeHBoxcam->pack_start (*modecam); - modecamconn = modecam->signal_changed().connect ( sigc::mem_fun (*this, &Locallabcie::modecamChanged) ); + Gtk::Label* modeLabelcam = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_CAMMODE") + ":")); + modeHBoxcam->pack_start(*modeLabelcam, Gtk::PACK_SHRINK); + modecam->append(M("TP_LOCALLAB_CAMMODE_CAM16")); + modecam->append(M("TP_LOCALLAB_CAMMODE_JZ")); + modecam->set_active(0); + modeHBoxcam->pack_start(*modecam); + modecamconn = modecam->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::modecamChanged)); pack_start(*modeHBoxcam); - modeHBoxcie->set_spacing (2); - modeHBoxcie->set_tooltip_markup (M ("TP_LOCALLAB_CIEMODE_TOOLTIP")); - Gtk::Label* modeLabel = Gtk::manage (new Gtk::Label (M ("TP_LOCALLAB_CIEMODE") + ":")); - modeHBoxcie->pack_start (*modeLabel, Gtk::PACK_SHRINK); - modecie->append (M ("TP_LOCALLAB_CIEMODE_COM")); - modecie->append (M ("TP_LOCALLAB_CIEMODE_TM")); - modecie->append (M ("TP_LOCALLAB_CIEMODE_WAV")); - modecie->append (M ("TP_LOCALLAB_CIEMODE_DR")); -// modecie->append (M ("TP_LOCALLAB_CIEMODE_LOG")); - modecie->set_active (0); - modeHBoxcie->pack_start (*modecie); - modecieconn = modecie->signal_changed().connect ( sigc::mem_fun (*this, &Locallabcie::modecieChanged) ); + modeHBoxcie->set_spacing(2); + modeHBoxcie->set_tooltip_markup(M("TP_LOCALLAB_CIEMODE_TOOLTIP")); + Gtk::Label* modeLabel = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_CIEMODE") + ":")); + modeHBoxcie->pack_start(*modeLabel, Gtk::PACK_SHRINK); + modecie->append(M("TP_LOCALLAB_CIEMODE_COM")); + modecie->append(M("TP_LOCALLAB_CIEMODE_TM")); + modecie->append(M("TP_LOCALLAB_CIEMODE_WAV")); + modecie->append(M("TP_LOCALLAB_CIEMODE_DR")); + modecie->set_active(0); + modeHBoxcie->pack_start(*modecie); + modecieconn = modecie->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::modecieChanged)); pack_start(*modeHBoxcie); - surHBoxcie->set_spacing (2); - surHBoxcie->set_tooltip_markup (M ("TP_LOCALLAB_LOGSURSOUR_TOOLTIP")); - Gtk::Label* surLabel = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_SURROUND") + ":")); - surHBoxcie->pack_start (*surLabel, Gtk::PACK_SHRINK); - sursourcie->append (M ("TP_COLORAPP_SURROUND_AVER")); - sursourcie->append (M ("TP_COLORAPP_SURROUND_DIM")); - sursourcie->append (M ("TP_COLORAPP_SURROUND_DARK")); - sursourcie->set_active (0); - surHBoxcie->pack_start (*sursourcie); - sursourcieconn = sursourcie->signal_changed().connect ( sigc::mem_fun (*this, &Locallabcie::sursourcieChanged) ); + surHBoxcie->set_spacing(2); + surHBoxcie->set_tooltip_markup(M("TP_LOCALLAB_LOGSURSOUR_TOOLTIP")); + Gtk::Label* surLabel = Gtk::manage(new Gtk::Label(M("TP_COLORAPP_SURROUND") + ":")); + surHBoxcie->pack_start(*surLabel, Gtk::PACK_SHRINK); + sursourcie->append(M("TP_COLORAPP_SURROUND_AVER")); + sursourcie->append(M("TP_COLORAPP_SURROUND_DIM")); + sursourcie->append(M("TP_COLORAPP_SURROUND_DARK")); + sursourcie->append(M("TP_COLORAPP_SURROUND_EXDARK")); + sursourcie->append(M("TP_LOCALLAB_DISAB_CIECAM")); + sursourcie->set_active(0); + surHBoxcie->pack_start(*sursourcie); + sursourcieconn = sursourcie->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::sursourcieChanged)); cieFrame->set_label_align(0.025, 0.5); + + Gtk::Box *TittleVBoxcamscene; + TittleVBoxcamscene = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); + TittleVBoxcamscene->set_spacing(2); + Gtk::Box* const LCTitleHBoxcamscene = Gtk::manage(new Gtk::Box()); + Gtk::Label* const LCLabelcamscene = Gtk::manage(new Gtk::Label()); + LCLabelcamscene->set_markup(Glib::ustring("") + (M("TP_LOCALLAB_LOGFRA")) + Glib::ustring("")); + LCTitleHBoxcamscene->pack_start(*LCLabelcamscene, Gtk::PACK_SHRINK); + TittleVBoxcamscene->pack_start(*LCTitleHBoxcamscene, Gtk::PACK_SHRINK); + expcamscene->setLabel(TittleVBoxcamscene); + + setExpandAlignProperties(expcamscene, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + + + + ToolParamBlock* const cieFBox = Gtk::manage(new ToolParamBlock()); cieFBox->pack_start(*Autograycie); cieFBox->pack_start(*sourceGraycie); cieFBox->pack_start(*sourceabscie); cieFBox->pack_start(*pqremapcam16); + cieFBox->pack_start(*whitescie); + cieFBox->pack_start(*blackscie); + PQFrame->set_label_align(0.025, 0.5); ToolParamBlock* const PQFBox = Gtk::manage(new ToolParamBlock()); PQFBox->pack_start(*adapjzcie); PQFBox->pack_start(*jz100); PQFBox->pack_start(*pqremap); -// PQFBox->pack_start(*forcejz); -// PQFBox->pack_start(*contthreszcam); PQFrame->add(*PQFBox); - cieFBox->pack_start (*PQFrame); + cieFBox->pack_start(*PQFrame); logjzFrame->set_label_align(0.025, 0.5); logjzFrame->set_label_widget(*logjz); - // Gtk::Separator* const separatorjz = Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); ToolParamBlock* const logjzBox = Gtk::manage(new ToolParamBlock()); - //logjzBox->pack_start(*blackEvjz); - // logjzBox->pack_start(*whiteEvjz); - // logjzBox->pack_start(*separatorjz); logjzBox->pack_start(*targetjz); logjzFrame->add(*logjzBox); - cieFBox->pack_start (*logjzFrame); + cieFBox->pack_start(*logjzFrame); bevwevFrame->set_label_align(0.025, 0.5); ToolParamBlock* const bevwevBox = Gtk::manage(new ToolParamBlock()); bevwevBox->pack_start(*blackEvjz); bevwevBox->pack_start(*whiteEvjz); bevwevFrame->add(*bevwevBox); - cieFBox->pack_start (*bevwevFrame); + cieFBox->pack_start(*bevwevFrame); sigmoidFrame->set_label_align(0.025, 0.5); sigmoidFrame->set_label_widget(*sigq); - ToolParamBlock* const sigBox = Gtk::manage(new ToolParamBlock()); - Gtk::Separator* const separatorsig = Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); + sigmoidnormFrame->set_label_align(0.025, 0.5); + sigmoidnormFrame->set_label_widget(*normcie); + + + Gtk::Box *TittleVBoxprecam; + TittleVBoxprecam = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); + TittleVBoxprecam->set_spacing(2); + Gtk::Box* const LCTitleHBoxprecam = Gtk::manage(new Gtk::Box()); + Gtk::Label* const LCLabelprecam = Gtk::manage(new Gtk::Label()); + LCLabelprecam->set_markup(Glib::ustring("") + (M("TP_LOCALLAB_SIGTRCCIE")) + Glib::ustring("")); + LCTitleHBoxprecam->pack_start(*LCLabelprecam, Gtk::PACK_SHRINK); + TittleVBoxprecam->pack_start(*LCTitleHBoxprecam, Gtk::PACK_SHRINK); + expprecam->setLabel(TittleVBoxprecam); + + setExpandAlignProperties(expprecam, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + sigmoid2Frame->set_label_align(0.025, 0.5); + //sigmoid2Frame->set_label_widget(*sigcie); + logcieFrame->set_label_align(0.025, 0.5); + logcieFrame->set_label_widget(*logcie); + Gtk::Label* illLabel = Gtk::manage(new Gtk::Label(M("TP_ICM_WORKING_ILLU") + ":")); + willBox->pack_start(*illLabel, Gtk::PACK_SHRINK); + willBox->pack_start(*illMethod, Gtk::PACK_EXPAND_WIDGET); + illMethod->append(M("TP_ICM_WORKING_ILLU_D41")); + illMethod->append(M("TP_ICM_WORKING_ILLU_D50")); + illMethod->append(M("TP_ICM_WORKING_ILLU_D55")); + illMethod->append(M("TP_ICM_WORKING_ILLU_D60")); + illMethod->append(M("TP_ICM_WORKING_ILLU_D65")); + illMethod->append(M("TP_ICM_WORKING_ILLU_D80")); + + illMethod->append(M("TP_ICM_WORKING_ILLU_D120")); + + illMethod->append(M("TP_ICM_WORKING_ILLU_STDA")); + illMethod->append(M("TP_ICM_WORKING_ILLU_2000")); + illMethod->append(M("TP_ICM_WORKING_ILLU_1500")); + illMethod->append(M("TP_ICM_WORKING_ILLU_E")); + + + illMethod->set_active(1); + illMethodconn = illMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::illMethodChanged)); + + + Gtk::Label* primLabel = Gtk::manage(new Gtk::Label(M("TP_ICM_WORKING_PRIM") + ":")); + wprimBox->pack_start(*primLabel, Gtk::PACK_SHRINK); + wprimBox->pack_start(*primMethod, Gtk::PACK_EXPAND_WIDGET); + primMethod->append(M("TP_ICM_WORKING_PRIM_PROP")); + primMethod->append(M("TP_ICM_WORKING_PRIM_BET")); + primMethod->append(M("TP_ICM_WORKING_PRIM_WID")); + primMethod->append(M("TP_ICM_WORKING_PRIM_ACE")); + primMethod->append(M("TP_ICM_WORKING_PRIM_REC")); + primMethod->append(M("TP_ICM_WORKING_PRIM_ADOB")); + primMethod->append(M("TP_ICM_WORKING_PRIM_SRGB")); + primMethod->append(M("TP_ICM_WORKING_PRIM_JDCMAX")); + primMethod->append(M("TP_ICM_WORKING_PRIM_JDCMAXSTDA")); + primMethod->append(M("TP_ICM_WORKING_PRIM_AC0")); + primMethod->append(M("TP_ICM_WORKING_PRIM_BST")); + primMethod->append(M("TP_ICM_WORKING_PRIM_BRU")); + primMethod->append(M("TP_ICM_WORKING_PRIM_FREE")); + + primMethod->set_active(0); + primMethodconn = primMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::primMethodChanged)); + trcFrame->set_label_align(0.025, 0.5); + smoothFrame->set_label_align(0.025, 0.5); + + primillFrame->set_label_align(0.025, 0.5); + setExpandAlignProperties(grexl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + setExpandAlignProperties(greyl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + setExpandAlignProperties(bluxl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + setExpandAlignProperties(bluyl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + setExpandAlignProperties(redxl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + setExpandAlignProperties(redyl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + + + primCoordGridl->set_column_homogeneous(true); + primCoordGridl->attach(*redxl, 0, 0, 1, 1); + primCoordGridl->attach_next_to(*redyl, *redxl, Gtk::PositionType::POS_RIGHT, 1, 1); + primCoordGridl->attach_next_to(*grexl, *redxl, Gtk::PositionType::POS_BOTTOM, 1, 1); + primCoordGridl->attach_next_to(*greyl, *grexl, Gtk::PositionType::POS_RIGHT, 1, 1); + primCoordGridl->attach_next_to(*bluxl, *grexl, Gtk::PositionType::POS_BOTTOM, 1, 1); + primCoordGridl->attach_next_to(*bluyl, *bluxl, Gtk::PositionType::POS_RIGHT, 1, 1); + + redBox->pack_start(*primCoordGridl, Gtk::PACK_EXPAND_WIDGET); + + + redxl->setAdjusterListener(this); + redyl->setAdjusterListener(this); + grexl->setAdjusterListener(this); + greyl->setAdjusterListener(this); + bluxl->setAdjusterListener(this); + bluyl->setAdjusterListener(this); + refi->setAdjusterListener(this); + shiftxl->setAdjusterListener(this); + shiftyl->setAdjusterListener(this); + + + gridFramecie->set_label_align(0.025, 0.5); + ToolParamBlock* const gridBox = Gtk::manage(new ToolParamBlock()); + gridBox->pack_start(*labgridcie); + gridFramecie->add(*gridBox); + + Gtk::Label* catLabel = Gtk::manage(new Gtk::Label(M("TP_ICM_WORKING_CAT") + ":")); + catBox->pack_start(*catLabel, Gtk::PACK_SHRINK); + catBox->pack_start(*catMethod, Gtk::PACK_EXPAND_WIDGET); + catMethod->append(M("TP_ICM_WORKING_CAT_BRAD")); + catMethod->append(M("TP_ICM_WORKING_CAT_CAT16")); + catMethod->append(M("TP_ICM_WORKING_CAT_CAT02")); + catMethod->append(M("TP_ICM_WORKING_CAT_VK")); + catMethod->append(M("TP_ICM_WORKING_CAT_XYZ")); + catMethod->set_active(0); + catMethodconn = catMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::catMethodChanged)); + gamutcieBox->pack_start(*gamutcie, Gtk::PACK_EXPAND_WIDGET); + + gamutcieconn = gamutcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::gamutcieChanged)); + + ToolParamBlock* const signormBox = Gtk::manage(new ToolParamBlock()); + ToolParamBlock* const sigfraBox = Gtk::manage(new ToolParamBlock()); + + modeHBoxbwev->set_spacing(2); + ToolParamBlock* const gamcieBox = Gtk::manage(new ToolParamBlock()); + Gtk::Label* modeLabelbwev = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_SIGMOIDQJ") + ":")); + modeHBoxbwev->pack_start(*modeLabelbwev, Gtk::PACK_SHRINK); + + bwevMethod->append(M("TP_LOCALLAB_BWEVNONE")); + bwevMethod->append(M("TP_LOCALLAB_BWEVSIG")); + bwevMethod->set_active(1); + bwevMethodConn = bwevMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::bwevMethodChanged)); + modeHBoxbwev->pack_start(*bwevMethod); + + comprBox->pack_start(*comprcie); + comprBox->pack_start(*strcielog); + comprBox->pack_start(*satcie); + comprBox->pack_start(*logcieq); + logcieFrame->add(*comprBox); + gamcieBox->pack_start(*logcieFrame); + + ToolParamBlock* const trccieBox = Gtk::manage(new ToolParamBlock()); + ToolParamBlock* const smoothcieBox = Gtk::manage(new ToolParamBlock()); + ToolParamBlock* const primillBox = Gtk::manage(new ToolParamBlock()); + ToolParamBlock* const colorBox = Gtk::manage(new ToolParamBlock()); + + trccieBox->pack_start(*gamjcie); + trccieBox->pack_start(*slopjcie); + trccieBox->pack_start(*midtcie); + + smoothBox->pack_start(*smoothciemet, Gtk::PACK_EXPAND_WIDGET); + smoothciemet->append(M("TP_LOCALLAB_CIE_SMOOTH_NONE")); + smoothciemet->append(M("TP_LOCALLAB_CIE_SMOOTH_EV")); + smoothciemet->append(M("TP_LOCALLAB_CIE_SMOOTH_GAMMA ROLLOFF")); + smoothciemet->append(M("TP_LOCALLAB_CIE_SMOOTH_GAMMA")); + smoothciemet->set_active(0); + ciesmoothBox->pack_start(*smoothBox); + ciesmoothBox->pack_start(*slopesmo); + ciesmoothBox->pack_start(*smoothcie); + + smoothciemetconn = smoothciemet->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::smoothciemetChanged)); + + smoothcieBox->pack_start(*ciesmoothBox); + smoothFrame->add(*smoothcieBox); + trccieBox->pack_start(*smoothFrame); + trcFrame->add(*trccieBox); + gamcieBox->pack_start(*trcFrame); + primillBox->pack_start(*willBox); + colorFramecie->set_label_align(0.025, 0.5); + + primillBox->pack_start(*wprimBox); + primillBox->pack_start(*redBox); + primillBox->pack_start(*gridFramecie); + primillBox->pack_start(*gamutcieBox); + primillBox->pack_start(*catBox); + colorBox->pack_start(*refi); + colorBox->pack_start(*shiftxl); + colorBox->pack_start(*shiftyl); + colorFramecie->add(*colorBox); + primillBox->pack_start(*colorFramecie); + primillFrame->add(*primillBox); + gamcieBox->pack_start(*primillFrame); + + + + expprecam->add(*gamcieBox, false); + + + sigfraBox->pack_start(*sigmoidldacie); + sigfraBox->pack_start(*sigmoidthcie); + sigfraBox->pack_start(*sigmoidsenscie); + sigfraBox->pack_start(*modeHBoxbwev); + sigmoid2Frame->add(*sigfraBox); + sigBox->pack_start(*sigmoid2Frame); + + signormBox->pack_start(*sigmoidblcie); + sigmoidnormFrame->add(*signormBox); + sigBox->pack_start(*sigmoidnormFrame); - sigBox->pack_start(*sigmoidldacie); - sigBox->pack_start(*sigmoidthcie); - sigBox->pack_start(*sigmoidblcie); - sigBox->pack_start(*sigmoidqjcie); - sigBox->pack_start(*separatorsig); - sigBox->pack_start(*logcie); sigmoidFrame->add(*sigBox); - cieFBox->pack_start(*sigmoidFrame); sigmoidjzFrame->set_label_align(0.025, 0.5); @@ -7654,12 +8097,16 @@ Locallabcie::Locallabcie(): sigjzBox->pack_start(*forcebw); sigmoidjzFrame->add(*sigjzBox); - // jzBox->pack_start(*sigmoidjzFrame); cieFBox->pack_start(*sigmoidjzFrame); - cieFBox->pack_start (*surHBoxcie); - cieFrame->add(*cieFBox); - pack_start(*cieFrame); + cieFBox->pack_start(*surHBoxcie); + + + expcamscene->add(*cieFBox, false); + + pack_start(*expcamscene, false, false); + pack_start(*expprecam, false, false); + ToolParamBlock* const jzallBox = Gtk::manage(new ToolParamBlock()); Gtk::Box *TittleVBoxjz; @@ -7676,61 +8123,53 @@ Locallabcie::Locallabcie(): float R, G, B; std::vector six_shape; + for (int i = 0; i < 6; i++) { const float x = static_cast(i) * (1.f / 6.f); Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B); six_shape.emplace_back(x, R, G, B); } + std::vector milestone; - milestone.push_back ( GradientMilestone (0., 0., 0., 0.) ); - milestone.push_back ( GradientMilestone (1., 1., 1., 1.) ); + milestone.push_back(GradientMilestone(0., 0., 0., 0.)); + milestone.push_back(GradientMilestone(1., 1., 1., 1.)); jz1CurveEditorG->setCurveListener(this); shapejz->setResetCurve(DiagonalCurveType(defSpot.jzcurve.at(0)), defSpot.jzcurve); - shapejz->setBottomBarBgGradient (milestone); - shapejz->setLeftBarBgGradient (milestone); + shapejz->setBottomBarBgGradient(milestone); + shapejz->setLeftBarBgGradient(milestone); shapecz->setResetCurve(DiagonalCurveType(defSpot.czcurve.at(0)), defSpot.czcurve); std::vector shapeczMilestones; -// float R, G, B; - shapecz->setBottomBarColorProvider (this, 1); - shapecz->setLeftBarColorProvider (this, 1); - shapecz->setRangeDefaultMilestones (0.05, 0.2, 0.58); + shapecz->setBottomBarColorProvider(this, 1); + shapecz->setLeftBarColorProvider(this, 1); + shapecz->setRangeDefaultMilestones(0.05, 0.2, 0.58); for (int i = 0; i < 7; i++) { float x = float (i) * (1.0f / 6.f); - Color::hsv2rgb01 (x, 0.5f, 0.5f, R, G, B); - shapeczMilestones.push_back ( GradientMilestone (double (x), double (R), double (G), double (B)) ); + Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B); + shapeczMilestones.push_back(GradientMilestone(double (x), double (R), double (G), double (B))); } - shapecz->setBottomBarBgGradient (shapeczMilestones); - shapecz->setLeftBarBgGradient (shapeczMilestones); - shapecz->setRangeDefaultMilestones (0.05, 0.2, 0.58); + shapecz->setBottomBarBgGradient(shapeczMilestones); + shapecz->setLeftBarBgGradient(shapeczMilestones); + shapecz->setRangeDefaultMilestones(0.05, 0.2, 0.58); - shapeczjz->setLeftBarColorProvider (this, 1); - shapeczjz->setRangeDefaultMilestones (0.05, 0.2, 0.58); + shapeczjz->setLeftBarColorProvider(this, 1); + shapeczjz->setRangeDefaultMilestones(0.05, 0.2, 0.58); shapeczjz->setResetCurve(DiagonalCurveType(defSpot.czjzcurve.at(0)), defSpot.czjzcurve); - shapeczjz->setBottomBarBgGradient (milestone); - shapeczjz->setLeftBarBgGradient (shapeczMilestones); - shapeczjz->setRangeDefaultMilestones (0.05, 0.2, 0.58); + shapeczjz->setBottomBarBgGradient(milestone); + shapeczjz->setLeftBarBgGradient(shapeczMilestones); + shapeczjz->setRangeDefaultMilestones(0.05, 0.2, 0.58); jz1CurveEditorG->curveListComplete(); -/* - jz2CurveEditorG->setCurveListener(this); - shapeczjz->setLeftBarColorProvider (this, 1); - shapeczjz->setRangeDefaultMilestones (0.05, 0.2, 0.58); - shapeczjz->setResetCurve(DiagonalCurveType(defSpot.czjzcurve.at(0)), defSpot.czjzcurve); - shapeczjz->setBottomBarBgGradient (milestone); - shapeczjz->setLeftBarBgGradient (shapeczMilestones); - shapeczjz->setRangeDefaultMilestones (0.05, 0.2, 0.58); - jz2CurveEditorG->curveListComplete(); -*/ + jz2CurveEditorG->setCurveListener(this); LHshapejz->setIdentityValue(0.); LHshapejz->setResetCurve(FlatCurveType(defSpot.LHcurvejz.at(0)), defSpot.LHcurvejz); - // LHshapejz->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); + // LHshapejz->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); LHshapejz->setCurveColorProvider(this, 3); LHshapejz->setBottomBarBgGradient(six_shape); jz2CurveEditorG->curveListComplete(); @@ -7739,13 +8178,11 @@ Locallabcie::Locallabcie(): CHshapejz->setIdentityValue(0.); CHshapejz->setResetCurve(FlatCurveType(defSpot.CHcurvejz.at(0)), defSpot.CHcurvejz); - // CHshapejz->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); CHshapejz->setCurveColorProvider(this, 3); CHshapejz->setBottomBarBgGradient(six_shape); HHshapejz->setIdentityValue(0.); HHshapejz->setResetCurve(FlatCurveType(defSpot.HHcurvejz.at(0)), defSpot.HHcurvejz); - // HHshapejz->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); HHshapejz->setCurveColorProvider(this, 3); HHshapejz->setBottomBarBgGradient(six_shape); @@ -7760,6 +8197,7 @@ Locallabcie::Locallabcie(): ToolParamBlock* const ciePzlightBox = Gtk::manage(new ToolParamBlock()); ciePzlightBox->pack_start(*lightjzcie); ciePzlightBox->pack_start(*contjzcie); + ciePzlightBox->pack_start(*detailciejz); czlightFrame->add(*ciePzlightBox); jzBox->pack_start(*czlightFrame); @@ -7785,17 +8223,7 @@ Locallabcie::Locallabcie(): jzHHBox->pack_start(*softjzcie); HFramejz->add(*jzHHBox); jzBox->pack_start(*HFramejz); - /* - sigmoidjzFrame->set_label_align(0.025, 0.5); - ToolParamBlock* const sigjzBox = Gtk::manage(new ToolParamBlock()); - sigjzBox->pack_start(*sigmoidldajzcie); - sigjzBox->pack_start(*sigmoidthjzcie); - sigjzBox->pack_start(*sigmoidbljzcie); - sigjzBox->pack_start(*jabcie); - sigmoidjzFrame->add(*sigjzBox); - // jzBox->pack_start(*sigmoidjzFrame); - */ jzshFrame->set_label_align(0.025, 0.5); ToolParamBlock* const jzshBox = Gtk::manage(new ToolParamBlock()); jzshBox->pack_start(*hljzcie); @@ -7847,8 +8275,15 @@ Locallabcie::Locallabcie(): jabcieConn = jabcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::jabcieChanged)); AutograycieConn = Autograycie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::AutograycieChanged)); - sigmoidqjcieconn = sigmoidqjcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::sigmoidqjcieChanged)); + comprcieautoconn = comprcieauto->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::comprcieautoChanged)); + normcieconn = normcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::normcieChanged)); + expprecamconn = expprecam->signal_enabled_toggled().connect(sigc::mem_fun(*this, &Locallabcie::expprecamChanged)); + + sigcieconn = sigcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::sigcieChanged)); logcieconn = logcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::logcieChanged)); + satcieconn = satcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::satcieChanged)); + logcieqconn = logcieq->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::logcieqChanged)); + smoothcieconn = smoothcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::smoothcieChanged)); logjzconn = logjz->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::logjzChanged)); sigjzconn = sigjz->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::sigjzChanged)); sigqconn = sigq->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::sigqChanged)); @@ -7874,39 +8309,38 @@ Locallabcie::Locallabcie(): cieCurveEditorG->setCurveListener(this); - toneMethodcie->append (M ("TP_COLORAPP_TCMODE_LIGHTNESS")); - toneMethodcie->append (M ("TP_COLORAPP_TCMODE_BRIGHTNESS")); - toneMethodcie->set_active (0); + toneMethodcie->append(M("TP_COLORAPP_TCMODE_LIGHTNESS")); + toneMethodcie->append(M("TP_COLORAPP_TCMODE_BRIGHTNESS")); + toneMethodcie->set_active(0); toneMethodcieConn = toneMethodcie->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::toneMethodcieChanged)); shapecie->setResetCurve(DiagonalCurveType(defSpot.ciecurve.at(0)), defSpot.ciecurve); - shapecie->setBottomBarBgGradient (milestone); - shapecie->setLeftBarBgGradient (milestone); + shapecie->setBottomBarBgGradient(milestone); + shapecie->setLeftBarBgGradient(milestone); cieCurveEditorG->curveListComplete(); cieCurveEditorG2->setCurveListener(this); - toneMethodcie2->append (M ("TP_COLORAPP_TCMODE_CHROMA")); - toneMethodcie2->append (M ("TP_COLORAPP_TCMODE_SATUR")); - toneMethodcie2->append (M ("TP_COLORAPP_TCMODE_COLORF")); - toneMethodcie2->set_active (0); + toneMethodcie2->append(M("TP_COLORAPP_TCMODE_CHROMA")); + toneMethodcie2->append(M("TP_COLORAPP_TCMODE_SATUR")); + toneMethodcie2->append(M("TP_COLORAPP_TCMODE_COLORF")); + toneMethodcie2->set_active(0); toneMethodcieConn2 = toneMethodcie2->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::toneMethodcie2Changed)); shapecie2->setResetCurve(DiagonalCurveType(defSpot.ciecurve2.at(0)), defSpot.ciecurve2); - shapecie2->setBottomBarColorProvider (this, 1); - shapecie2->setLeftBarColorProvider (this, 1); - shapecie2->setRangeDefaultMilestones (0.05, 0.2, 0.58); + shapecie2->setBottomBarColorProvider(this, 1); + shapecie2->setLeftBarColorProvider(this, 1); + shapecie2->setRangeDefaultMilestones(0.05, 0.2, 0.58); std::vector shape2Milestones; -// float R, G, B; for (int i = 0; i < 7; i++) { float x = float (i) * (1.0f / 6.f); - Color::hsv2rgb01 (x, 0.5f, 0.5f, R, G, B); - shape2Milestones.push_back ( GradientMilestone (double (x), double (R), double (G), double (B)) ); + Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B); + shape2Milestones.push_back(GradientMilestone(double (x), double (R), double (G), double (B))); } - shapecie2->setBottomBarBgGradient (shape2Milestones); - shapecie2->setLeftBarBgGradient (shape2Milestones); + shapecie2->setBottomBarBgGradient(shape2Milestones); + shapecie2->setLeftBarBgGradient(shape2Milestones); - shapecie2->setRangeDefaultMilestones (0.05, 0.2, 0.58); + shapecie2->setRangeDefaultMilestones(0.05, 0.2, 0.58); cieCurveEditorG2->curveListComplete(); @@ -7922,12 +8356,14 @@ Locallabcie::Locallabcie(): lightjzcie->setAdjusterListener(this); lightqcie->setAdjusterListener(this); + lightsigqcie->setAdjusterListener(this); contlcie->setAdjusterListener(this); contjzcie->setAdjusterListener(this); adapjzcie->setAdjusterListener(this); jz100->setAdjusterListener(this); pqremap->setAdjusterListener(this); pqremapcam16->setAdjusterListener(this); + pqremapcam16->setLogScale(500, 100); hljzcie->setAdjusterListener(this); hlthjzcie->setAdjusterListener(this); shjzcie->setAdjusterListener(this); @@ -7942,23 +8378,24 @@ Locallabcie::Locallabcie(): targetjz->setLogScale(10, 18, true); sigmoidldacie->setAdjusterListener(this); sigmoidthcie->setAdjusterListener(this); + sigmoidsenscie->setAdjusterListener(this); sigmoidblcie->setAdjusterListener(this); + comprcie->setAdjusterListener(this); + strcielog->setAdjusterListener(this); + comprcieth->setAdjusterListener(this); + gamjcie->setAdjusterListener(this); + slopjcie->setAdjusterListener(this); + slopjcie->setLogScale(100, 1); + midtcie->setAdjusterListener(this); + whitescie->setAdjusterListener(this); + blackscie->setAdjusterListener(this); sigmoidldajzcie->setAdjusterListener(this); sigmoidthjzcie->setAdjusterListener(this); sigmoidbljzcie->setAdjusterListener(this); contqcie->setAdjusterListener(this); + contsigqcie->setAdjusterListener(this); colorflcie->setAdjusterListener(this); -/* - lightlzcam->setAdjusterListener(this); - lightqzcam->setAdjusterListener(this); - contlzcam->setAdjusterListener(this); - contqzcam->setAdjusterListener(this); - contthreszcam->setAdjusterListener(this); - colorflzcam->setAdjusterListener(this); - saturzcam->setAdjusterListener(this); - chromzcam->setAdjusterListener(this); -*/ targetGraycie->setAdjusterListener(this); targetGraycie->setLogScale(10, 18, true); targabscie->setLogScale(500, 0); @@ -7966,8 +8403,10 @@ Locallabcie::Locallabcie(): targabscie->setAdjusterListener(this); detailcie->setAdjusterListener(this); + detailciejz->setAdjusterListener(this); catadcie->setAdjusterListener(this); + slopesmo->setAdjusterListener(this); Gtk::Box *TittleVBoxcam16; TittleVBoxcam16 = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); @@ -7981,17 +8420,29 @@ Locallabcie::Locallabcie(): setExpandAlignProperties(expcam16, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - surrHBoxcie->set_spacing (2); - surrHBoxcie->set_tooltip_markup (M ("TP_COLORAPP_SURROUND_TOOLTIP")); - Gtk::Label* surrLabelcie = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_SURROUND") + ":")); - surrHBoxcie->pack_start (*surrLabelcie, Gtk::PACK_SHRINK); - surroundcie->append (M ("TP_COLORAPP_SURROUND_AVER")); - surroundcie->append (M ("TP_COLORAPP_SURROUND_DIM")); - surroundcie->append (M ("TP_COLORAPP_SURROUND_DARK")); -// surroundcie->append (M ("TP_COLORAPP_SURROUND_EXDARK")); - surroundcie->set_active (0); - surrHBoxcie->pack_start (*surroundcie); - surroundcieconn = surroundcie->signal_changed().connect ( sigc::mem_fun (*this, &Locallabcie::surroundcieChanged) ); + + Gtk::Box *TittleVBoxcamviewing; + TittleVBoxcamviewing = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); + TittleVBoxcamviewing->set_spacing(2); + Gtk::Box* const LCTitleHBoxcamviewing = Gtk::manage(new Gtk::Box()); + Gtk::Label* const LCLabelcamviewing = Gtk::manage(new Gtk::Label()); + LCLabelcamviewing->set_markup(Glib::ustring("") + (M("TP_LOCALLAB_LOG2FRA")) + Glib::ustring("")); + LCTitleHBoxcamviewing->pack_start(*LCLabelcamviewing, Gtk::PACK_SHRINK); + TittleVBoxcamviewing->pack_start(*LCTitleHBoxcamviewing, Gtk::PACK_SHRINK); + expcamviewing->setLabel(TittleVBoxcamviewing); + + setExpandAlignProperties(expcamviewing, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + surrHBoxcie->set_spacing(2); + surrHBoxcie->set_tooltip_markup(M("TP_COLORAPP_SURROUND_TOOLTIP")); + Gtk::Label* surrLabelcie = Gtk::manage(new Gtk::Label(M("TP_COLORAPP_SURROUND") + ":")); + surrHBoxcie->pack_start(*surrLabelcie, Gtk::PACK_SHRINK); + surroundcie->append(M("TP_COLORAPP_SURROUND_AVER")); + surroundcie->append(M("TP_COLORAPP_SURROUND_DIM")); + surroundcie->append(M("TP_COLORAPP_SURROUND_DARK")); + surroundcie->set_active(0); + surrHBoxcie->pack_start(*surroundcie); + surroundcieconn = surroundcie->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::surroundcieChanged)); cie1Frame->set_label_align(0.025, 0.5); cie1lightFrame->set_label_align(0.025, 0.5); @@ -8001,13 +8452,19 @@ Locallabcie::Locallabcie(): ToolParamBlock* const cieP1lightBox = Gtk::manage(new ToolParamBlock()); cieP1lightBox->pack_start(*lightlcie); cieP1lightBox->pack_start(*lightqcie); + cieP1lightBox->pack_start(*lightsigqcie); cie1lightFrame->add(*cieP1lightBox); cieP1Box->pack_start(*cie1lightFrame); ToolParamBlock* const cieP1contBox = Gtk::manage(new ToolParamBlock()); cieP1contBox->pack_start(*detailcie); cieP1contBox->pack_start(*contlcie); cieP1contBox->pack_start(*contqcie); + cieP1contBox->pack_start(*contsigqcie); cieP1contBox->pack_start(*contthrescie); + + contsigqcie->hide(); + lightsigqcie->hide(); + cie1contFrame->add(*cieP1contBox); cieP1Box->pack_start(*cie1contFrame); ToolParamBlock* const cieP1colorBox = Gtk::manage(new ToolParamBlock()); @@ -8018,45 +8475,19 @@ Locallabcie::Locallabcie(): cieP1colorBox->pack_start(*rstprotectcie); cie1colorFrame->add(*cieP1colorBox); cieP1Box->pack_start(*cie1colorFrame); - // pack_start(*blackEvjz); - // pack_start(*whiteEvjz); -/* - sigmoidFrame->set_label_align(0.025, 0.5); - ToolParamBlock* const sigBox = Gtk::manage(new ToolParamBlock()); + cieP1Box->pack_start(*sigmoidFrame);//disable provisory Sigmoid + - sigBox->pack_start(*sigmoidldacie); - sigBox->pack_start(*sigmoidthcie); - sigBox->pack_start(*sigmoidblcie); - sigBox->pack_start(*sigmoidqjcie); - sigmoidFrame->add(*sigBox); - cieP1Box->pack_start(*sigmoidFrame); - */ ToolParamBlock* const cieP11Box = Gtk::manage(new ToolParamBlock()); cieP11Box->pack_start(*cieCurveEditorG); cieP11Box->pack_start(*cieCurveEditorG2); expLcie->add(*cieP11Box, false); cieP1Box->pack_start(*expLcie, false, false); - // cie1Frame->add(*cieP1Box); - // expcam16->pack_start(*cie1Frame); expcam16->add(*cieP1Box, false); pack_start(*expcam16, false, false); pack_start(*expjz, false, false); -/* - ciezFrame->set_label_align(0.025, 0.5); - ToolParamBlock* const ciePzBox = Gtk::manage(new ToolParamBlock()); - ciePzBox->pack_start(*lightlzcam); - ciePzBox->pack_start(*lightqzcam); - ciePzBox->pack_start(*contlzcam); - ciePzBox->pack_start(*contqzcam); -// ciePzBox->pack_start(*contthreszcam); - ciePzBox->pack_start(*colorflzcam); - ciePzBox->pack_start(*saturzcam); - ciePzBox->pack_start(*chromzcam); - ciezFrame->add(*ciePzBox); - pack_start(*ciezFrame); -*/ cie2Frame->set_label_align(0.025, 0.5); ToolParamBlock* const cieP2Box = Gtk::manage(new ToolParamBlock()); @@ -8064,16 +8495,19 @@ Locallabcie::Locallabcie(): cieP2Box->pack_start(*targabscie); cieP2Box->pack_start(*catadcie); cieP2Box->pack_start(*surrHBoxcie); -// cieP2Box->pack_start(*detailcie); -// cieP2Box->pack_start(*jabcie); - cie2Frame->add(*cieP2Box); - pack_start(*cie2Frame); + expcamviewing->add(*cieP2Box, false); + + pack_start(*expcamviewing, false, false); + recothrescie->setAdjusterListener(this); lowthrescie->setAdjusterListener(this); higthrescie->setAdjusterListener(this); decaycie->setAdjusterListener(this); + + setExpandAlignProperties(expgradcie, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + setExpandAlignProperties(exprecovcie, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); @@ -8089,6 +8523,7 @@ Locallabcie::Locallabcie(): showmaskcieMethodConn = showmaskcieMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::showmaskcieMethodChanged)); enacieMaskConn = enacieMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::enacieMaskChanged)); + enacieMaskallConn = enacieMaskall->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::enacieMaskallChanged)); maskcieCurveEditorG->setCurveListener(this); CCmaskcieshape->setIdentityValue(0.); @@ -8105,12 +8540,35 @@ Locallabcie::Locallabcie(): HHmaskcieshape->setBottomBarColorProvider(this, 2); maskcieCurveEditorG->curveListComplete(); + + struFramecie->set_label_align(0.025, 0.5); + + strumaskcie->setAdjusterListener(this); + + toolcieConn = toolcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::toolcieChanged)); + + blurFramecie->set_label_align(0.025, 0.5); + + fftcieMaskConn = fftcieMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::fftcieMaskChanged)); + + contcie->setAdjusterListener(this); + + blurcie->setAdjusterListener(this); + blendmaskcie->setAdjusterListener(this); radmaskcie->setAdjusterListener(this); lapmaskcie->setAdjusterListener(this); gammaskcie->setAdjusterListener(this); slomaskcie->setAdjusterListener(this); + highmaskcie->setAdjusterListener(this); + shadmaskcie->setAdjusterListener(this); + maskcieHCurveEditorG->setCurveListener(this); + HHhmaskcieshape->setIdentityValue(0.); + HHhmaskcieshape->setResetCurve(FlatCurveType(defSpot.HHhmaskciecurve.at(0)), defSpot.HHhmaskciecurve); + HHhmaskcieshape->setCurveColorProvider(this, 2); + HHhmaskcieshape->setBottomBarColorProvider(this, 2); + maskcieHCurveEditorG->curveListComplete(); chromaskcie->setAdjusterListener(this); mask2cieCurveEditorG->setCurveListener(this); @@ -8121,6 +8579,24 @@ Locallabcie::Locallabcie(): mask2cieCurveEditorG->curveListComplete(); + mask2cieCurveEditorGwav->setCurveListener(this); + + LLmaskcieshapewav->setIdentityValue(0.); + LLmaskcieshapewav->setResetCurve(FlatCurveType(defSpot.LLmaskciecurvewav.at(0)), defSpot.LLmaskciecurvewav); + LLmaskcieshapewav->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + + mask2cieCurveEditorGwav->curveListComplete(); + csThresholdcie->setAdjusterListener(this); + + + strgradcie->setAdjusterListener(this); + anggradcie->setAdjusterListener(this); + ToolParamBlock* const cieBoxgrad = Gtk::manage(new ToolParamBlock()); + cieBoxgrad->pack_start(*strgradcie); + cieBoxgrad->pack_start(*anggradcie); + expgradcie->add(*cieBoxgrad, false); + pack_start(*expgradcie, false, false); + ToolParamBlock* const cieBox3 = Gtk::manage(new ToolParamBlock()); cieBox3->pack_start(*maskusablecie, Gtk::PACK_SHRINK, 0); cieBox3->pack_start(*maskunusablecie, Gtk::PACK_SHRINK, 0); @@ -8134,20 +8610,54 @@ Locallabcie::Locallabcie(): ToolParamBlock* const maskcieBox = Gtk::manage(new ToolParamBlock()); maskcieBox->pack_start(*showmaskcieMethod, Gtk::PACK_SHRINK, 4); maskcieBox->pack_start(*enacieMask, Gtk::PACK_SHRINK, 0); + maskcieBox->pack_start(*enacieMaskall, Gtk::PACK_SHRINK, 0); maskcieBox->pack_start(*maskcieCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + ToolParamBlock* const strumBoxcie = Gtk::manage(new ToolParamBlock()); + strumBoxcie->pack_start(*strumaskcie); + strumBoxcie->pack_start(*toolcie); + struFramecie->add(*strumBoxcie); + maskcieBox->pack_start(*struFramecie, Gtk::PACK_SHRINK, 0); + ToolParamBlock* const blurcieBox = Gtk::manage(new ToolParamBlock()); + blurcieBox->pack_start(*fftcieMask, Gtk::PACK_SHRINK, 0); + blurcieBox->pack_start(*contcie); + blurcieBox->pack_start(*blurcie); + blurFramecie->add(*blurcieBox); + maskcieBox->pack_start(*blurFramecie, Gtk::PACK_SHRINK, 0); + maskcieBox->pack_start(*blendmaskcie, Gtk::PACK_SHRINK, 0); maskcieBox->pack_start(*radmaskcie, Gtk::PACK_SHRINK, 0); - maskcieBox->pack_start(*lapmaskcie, Gtk::PACK_SHRINK, 0); + //maskcieBox->pack_start(*lapmaskcie, Gtk::PACK_SHRINK, 0); maskcieBox->pack_start(*chromaskcie, Gtk::PACK_SHRINK, 0); maskcieBox->pack_start(*gammaskcie, Gtk::PACK_SHRINK, 0); maskcieBox->pack_start(*slomaskcie, Gtk::PACK_SHRINK, 0); + maskcieBox->pack_start(*highmaskcie, Gtk::PACK_SHRINK, 0); + maskcieBox->pack_start(*shadmaskcie, Gtk::PACK_SHRINK, 0); + maskcieBox->pack_start(*maskcieHCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + maskcieBox->pack_start(*mask2cieCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + wavFramecie->set_label_align(0.025, 0.5); + ToolParamBlock* const toolcieBox2 = Gtk::manage(new ToolParamBlock()); + toolcieBox2->pack_start(*mask2cieCurveEditorGwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + toolcieBox2->pack_start(*csThresholdcie, Gtk::PACK_SHRINK, 0); + wavFramecie->add(*toolcieBox2); + maskcieBox->pack_start(*wavFramecie); + + expmaskcie->add(*maskcieBox, false); pack_start(*expmaskcie, false, false); - } +} + +void Locallabcie::setListener(ToolPanelListener* tpl) +{ + LocallabTool::setListener(tpl); + + // labgridcie->setListener(tpl); +} + + Locallabcie::~Locallabcie() { delete jz1CurveEditorG; @@ -8156,9 +8666,10 @@ Locallabcie::~Locallabcie() delete cieCurveEditorG; delete cieCurveEditorG2; delete maskcieCurveEditorG; + delete maskcieHCurveEditorG; delete mask2cieCurveEditorG; delete LocalcurveEditorwavjz; - + delete mask2cieCurveEditorGwav; } bool Locallabcie::isMaskViewActive() @@ -8177,7 +8688,7 @@ void Locallabcie::resetMaskView() void Locallabcie::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) { - cieMask = showmaskcieMethod->get_active_row_number(); + cieMask = showmaskcieMethod->get_active_row_number(); } void Locallabcie::setDefaultExpanderVisibility() @@ -8185,19 +8696,28 @@ void Locallabcie::setDefaultExpanderVisibility() expLcie->set_expanded(false); expjz->set_expanded(false); expwavjz->set_expanded(false); + expcamscene->set_expanded(false); expcam16->set_expanded(false); + expcamviewing->set_expanded(false); + expprecam->set_expanded(false); expmaskcie->set_expanded(false); exprecovcie->set_expanded(false); + expgradcie->set_expanded(false); } void Locallabcie::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { recothrescie->set_tooltip_text(M("TP_LOCALLAB_RECOTHRES02_TOOLTIP")); reparcie->set_tooltip_text(M("TP_LOCALLAB_LOGREPART_TOOLTIP")); - cieFrame->set_tooltip_text(M("TP_LOCALLAB_LOGSCENE_TOOLTIP")); + // cieFrame->set_tooltip_text(M("TP_LOCALLAB_LOGSCENE_TOOLTIP")); + expcamscene->set_tooltip_text(M("TP_LOCALLAB_LOGSCENE_TOOLTIP")); PQFrame->set_tooltip_text(M("TP_LOCALLAB_JZPQFRA_TOOLTIP")); qtoj->set_tooltip_text(M("TP_LOCALLAB_JZQTOJ_TOOLTIP")); logcie->set_tooltip_text(M("TP_LOCALLAB_LOGCIE_TOOLTIP")); + logcieq->set_tooltip_text(M("TP_LOCALLAB_LOGCIEQ_TOOLTIP")); + smoothcie->set_tooltip_text(M("TP_LOCALLAB_SMOOTHCIE_TOOLTIP")); + slopesmo->set_tooltip_text(M("TP_LOCALLAB_SMOOTHCIE_TOOLTIP")); + smoothciemet->set_tooltip_text(M("TP_LOCALLAB_SMOOTHCIE_TOOLTIP")); modecam->set_tooltip_text(M("TP_LOCALLAB_JZMODECAM_TOOLTIP")); adapjzcie->set_tooltip_text(M("TP_LOCALLAB_JABADAP_TOOLTIP")); jz100->set_tooltip_text(M("TP_LOCALLAB_JZ100_TOOLTIP")); @@ -8219,7 +8739,7 @@ void Locallabcie::updateAdviceTooltips(const bool showTooltips) sourceGraycie->set_tooltip_text(M("TP_LOCALLAB_JZLOGYBOUT_TOOLTIP")); sourceabscie->set_tooltip_text(M("TP_COLORAPP_ADAPSCEN_TOOLTIP")); cie1Frame->set_tooltip_text(M("TP_LOCALLAB_LOGIMAGE_TOOLTIP")); - sigmoidFrame->set_tooltip_text(M("TP_LOCALLAB_SIGMOID_TOOLTIP")); + sigmoidFrame->set_tooltip_text(M("TP_LOCALLAB_SIGMOID16_TOOLTIP")); sigmoidjzFrame->set_tooltip_text(M("TP_LOCALLAB_SIGMOID_TOOLTIP")); contlcie->set_tooltip_text(M("TP_LOCALLAB_LOGCONTL_TOOLTIP")); contqcie->set_tooltip_text(M("TP_LOCALLAB_LOGCONTQ_TOOLTIP")); @@ -8234,7 +8754,8 @@ void Locallabcie::updateAdviceTooltips(const bool showTooltips) targetGraycie->set_tooltip_text(M("TP_COLORAPP_YBOUT_TOOLTIP")); detailcie->set_tooltip_text(M("TP_LOCALLAB_LOGDETAIL_TOOLTIP")); catadcie->set_tooltip_text(M("TP_LOCALLAB_LOGCATAD_TOOLTIP")); - cie2Frame->set_tooltip_text(M("TP_LOCALLAB_LOGVIEWING_TOOLTIP")); + // cie2Frame->set_tooltip_text(M("TP_LOCALLAB_LOGVIEWING_TOOLTIP")); + expcamviewing->set_tooltip_text(M("TP_LOCALLAB_LOGVIEWING_TOOLTIP")); sensicie->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); CCmaskcieshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmaskcieshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); @@ -8245,16 +8766,41 @@ void Locallabcie::updateAdviceTooltips(const bool showTooltips) mask2cieCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); Lmaskcieshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); exprecovcie->set_tooltip_markup(M("TP_LOCALLAB_MASKRESH_TOOLTIP")); - + // expgradcie->set_tooltip_markup(M("TP_LOCALLAB_MASKRESH_TOOLTIP")); + strumaskcie->set_tooltip_text(M("TP_LOCALLAB_STRUSTRMASK_TOOLTIP")); + fftcieMask->set_tooltip_text(M("TP_LOCALLAB_FFTMASK_TOOLTIP")); + contcie->set_tooltip_text(M("TP_LOCALLAB_CONTTHMASK_TOOLTIP")); + blurcie->set_tooltip_text(M("TP_LOCALLAB_BLURRMASK_TOOLTIP")); + LLmaskcieshapewav->setTooltip(M("TP_LOCALLAB_LMASK_LEVEL_TOOLTIP")); + maskcieHCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_HHMASK_TOOLTIP")); + comprcieth->set_tooltip_text(M("TP_LOCALLAB_SIGMOIDQJCOMPRCIE_TOOLTIP")); + gamjcie->set_tooltip_text(M("TP_LOCALLAB_PRECAM_TOOLTIP")); + slopjcie->set_tooltip_text(M("TP_LOCALLAB_PRECAM_TOOLTIP")); + trcFrame->set_tooltip_text(M("TP_LOCALLAB_PRECAM_TOOLTIP")); + midtcie->set_tooltip_text(M("TP_LOCALLAB_PRECAM_TOOLTIP")); + whitescie->set_tooltip_text(M("TP_LOCALLAB_SIGMOIDWHITESCIE_TOOLTIP")); + blackscie->set_tooltip_text(M("TP_LOCALLAB_SIGMOIDWHITESCIE_TOOLTIP")); + normcie->set_tooltip_text(M("TP_LOCALLAB_SIGMOIDNORMCIE_TOOLTIP")); + sigmoidblcie->set_tooltip_text(M("TP_LOCALLAB_SIGMOIDNORMCIEBLEND_TOOLTIP")); + catBox->set_tooltip_text(M("TP_ICM_WORKING_CAT_TOOLTIP")); + wprimBox->set_tooltip_text(M("TP_ICM_WORKING_PRIM_TOOLTIP")); + expprecam->set_tooltip_text(M("TP_LOCALLAB_PRECAM_TOOLTIP")); + refi->set_tooltip_text(M("TP_LOCALLAB_PRECAMREFI_TOOLTIP")); + colorFramecie->set_tooltip_text(M("TP_LOCALLAB_PRECAMREFIMAIN_TOOLTIP")); + gamutcie->set_tooltip_text(M("TP_LOCALLAB_PRECAMGAMUT_TOOLTIP")); + shiftxl->set_tooltip_text(M("TC_LOCALLAB_PRIM_SHIFTX_TOOLTIP")); + shiftyl->set_tooltip_text(M("TC_LOCALLAB_PRIM_SHIFTX_TOOLTIP")); } else { reparcie->set_tooltip_text(""); recothrescie->set_tooltip_text(""); - cieFrame->set_tooltip_text(""); + // cieFrame->set_tooltip_text(""); + expcamscene->set_tooltip_text(""); PQFrame->set_tooltip_text(""); modecam->set_tooltip_text(""); qtoj->set_tooltip_text(""); logcie->set_tooltip_text(""); + logcieq->set_tooltip_text(""); jabcie->set_tooltip_text(""); adapjzcie->set_tooltip_text(""); jz100->set_tooltip_text(""); @@ -8283,7 +8829,8 @@ void Locallabcie::updateAdviceTooltips(const bool showTooltips) targetGraycie->set_tooltip_text(""); detailcie->set_tooltip_text(""); catadcie->set_tooltip_text(""); - cie2Frame->set_tooltip_text(""); + // cie2Frame->set_tooltip_text(""); + expcamviewing->set_tooltip_text(""); sensicie->set_tooltip_text(""); CCmaskcieshape->setTooltip(""); LLmaskcieshape->setTooltip(""); @@ -8294,6 +8841,7 @@ void Locallabcie::updateAdviceTooltips(const bool showTooltips) mask2cieCurveEditorG->set_tooltip_text(""); Lmaskcieshape->setTooltip(""); exprecovcie->set_tooltip_markup(""); + expgradcie->set_tooltip_markup(""); sigmalcjz->set_tooltip_text(""); clarilresjz->set_tooltip_text(""); claricresjz->set_tooltip_text(""); @@ -8302,6 +8850,32 @@ void Locallabcie::updateAdviceTooltips(const bool showTooltips) wavshapejz->setTooltip(""); LocalcurveEditorwavjz->set_tooltip_markup(""); csThresholdjz->set_tooltip_markup(""); + strumaskcie->set_tooltip_text(""); + fftcieMask->set_tooltip_text(""); + contcie->set_tooltip_text(""); + blurcie->set_tooltip_text(""); + LLmaskcieshapewav->setTooltip(""); + maskcieHCurveEditorG->set_tooltip_text(""); + comprcieth->set_tooltip_text(""); + gamjcie->set_tooltip_text(""); + slopjcie->set_tooltip_text(""); + trcFrame->set_tooltip_text(""); + midtcie->set_tooltip_text(""); + smoothcie->set_tooltip_text(""); + slopesmo->set_tooltip_text(""); + smoothciemet->set_tooltip_text(""); + whitescie->set_tooltip_text(""); + blackscie->set_tooltip_text(""); + normcie->set_tooltip_text(""); + sigmoidblcie->set_tooltip_text(""); + catBox->set_tooltip_text(""); + expprecam->set_tooltip_text(""); + wprimBox->set_tooltip_text(""); + refi->set_tooltip_text(""); + gamutcie->set_tooltip_text(""); + colorFramecie->set_tooltip_text(""); + shiftxl->set_tooltip_text(""); + shiftyl->set_tooltip_text(""); } } @@ -8313,20 +8887,35 @@ void Locallabcie::disableListener() forcebwConn.block(true); qtojConn.block(true); jabcieConn.block(true); - sigmoidqjcieconn.block(true); + comprcieautoconn.block(true); + normcieconn.block(true); + expprecamconn.block(true); + gamutcieconn.block(true); + primMethodconn.block(true); + illMethodconn.block(true); + smoothciemetconn.block(true); + catMethodconn.block(true); + sigcieconn.block(true); logcieconn.block(true); + satcieconn.block(true); + logcieqconn.block(true); + smoothcieconn.block(true); logjzconn.block(true); sigjzconn.block(true); sigqconn.block(true); chjzcieconn.block(true); - sursourcieconn.block (true); - surroundcieconn.block (true); - modecieconn.block (true); - modecamconn.block (true); + sursourcieconn.block(true); + surroundcieconn.block(true); + modecieconn.block(true); + modecamconn.block(true); + bwevMethodConn.block(true); toneMethodcieConn.block(true); toneMethodcieConn2.block(true); showmaskcieMethodConn.block(true); + toolcieConn.block(true); enacieMaskConn.block(true); + enacieMaskallConn.block(true); + fftcieMaskConn.block(true); } void Locallabcie::enableListener() @@ -8337,20 +8926,35 @@ void Locallabcie::enableListener() forcebwConn.block(false); qtojConn.block(false); jabcieConn.block(false); - sigmoidqjcieconn.block(false); + comprcieautoconn.block(false); + normcieconn.block(false); + expprecamconn.block(false); + gamutcieconn.block(false); + primMethodconn.block(false); + illMethodconn.block(false); + smoothciemetconn.block(false); + catMethodconn.block(false); + sigcieconn.block(false); logcieconn.block(false); + satcieconn.block(false); + logcieqconn.block(false); + smoothcieconn.block(false); logjzconn.block(false); sigjzconn.block(false); sigqconn.block(false); chjzcieconn.block(false); - sursourcieconn.block (false); - surroundcieconn.block (false); - modecieconn.block (false); - modecamconn.block (false); + sursourcieconn.block(false); + surroundcieconn.block(false); + modecieconn.block(false); + modecamconn.block(false); + bwevMethodConn.block(false); toneMethodcieConn.block(false); toneMethodcieConn2.block(false); showmaskcieMethodConn.block(false); + toolcieConn.block(false); enacieMaskConn.block(false); + enacieMaskallConn.block(false); + fftcieMaskConn.block(false); } void Locallabcie::showmaskcieMethodChanged() @@ -8362,7 +8966,7 @@ void Locallabcie::showmaskcieMethodChanged() locToolListener->resetOtherMaskView(this); } - if(exp->getEnabled()) { + if (exp->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskMethod, ""); } @@ -8395,12 +8999,117 @@ void Locallabcie::enacieMaskChanged() } } + +void Locallabcie::enacieMaskallChanged2() +{ + const LocallabParams::LocallabSpot defSpot; + + // if (modecam->get_active_row_number() == 1) { + if(!enacieMaskall->get_active()) { + lapmaskcie->setValue(defSpot.lapmaskcie); + gammaskcie->setValue(defSpot.gammaskcie); + slomaskcie->setValue(defSpot.slomaskcie); + highmaskcie->setValue(defSpot.highmaskcie); + shadmaskcie->setValue(defSpot.shadmaskcie); + HHhmaskcieshape->setCurve(defSpot.HHhmaskciecurve); + strumaskcie->setValue(defSpot.strumaskcie); + toolcie->set_active(defSpot.toolcie); + fftcieMask->set_active(defSpot.fftcieMask); + LLmaskcieshapewav->setCurve(defSpot.LLmaskciecurvewav); + lapmaskcie->hide(); + gammaskcie->hide(); + slomaskcie->hide(); + highmaskcie->hide(); + shadmaskcie->hide(); + maskcieHCurveEditorG->hide(); + struFramecie->hide(); + blurFramecie->hide(); + strumaskcie->hide(); + contcie->setValue(defSpot.contcie); + blurcie->setValue(defSpot.blurcie); + + toolcie->hide(); + fftcieMask->hide(); + mask2cieCurveEditorGwav->hide(); + wavFramecie->hide(); + } else { + lapmaskcie->show(); + gammaskcie->show(); + slomaskcie->show(); + highmaskcie->show(); + shadmaskcie->show(); + maskcieHCurveEditorG->show(); + struFramecie->show(); + blurFramecie->show(); + strumaskcie->show(); + toolcie->show(); + fftcieMask->show(); + mask2cieCurveEditorGwav->show(); + wavFramecie->show(); + } + // } +} + +void Locallabcie::enacieMaskallChanged() +{ + + enacieMaskallChanged2(); + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (enacieMaskall->get_active()) { + listener->panelChanged(EvlocallabenacieMaskall, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(EvlocallabenacieMaskall, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + + + +void Locallabcie::toolcieChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (toolcie->get_active()) { + listener->panelChanged(EvLocallabtoolcie, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(EvLocallabtoolcie, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + + +void Locallabcie::fftcieMaskChanged() +{ + // updateColorGUI3(); // Update GUI according to fftColorMash button state + + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (fftcieMask->get_active()) { + listener->panelChanged(EvLocallabfftcieMask, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(EvLocallabfftcieMask, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + + void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) { disableListener(); // Update GUI to selected spot value const int index = pp->locallab.selspot; + Glib::ustring prof = pp->icm.workingProfile; if (index < (int)pp->locallab.spots.size()) { const LocallabParams::LocallabSpot& spot = pp->locallab.spots.at(index); @@ -8408,28 +9117,25 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE exp->set_visible(spot.visicie); exp->setEnabled(spot.expcie); complexity->set_active(spot.complexcie); + expprecam->setEnabled(spot.expprecam); reparcie->setValue(spot.reparcie); sensicie->setValue(spot.sensicie); if (spot.modecam == "cam16") { - modecam->set_active (0); + modecam->set_active(0); } else if (spot.modecam == "jz") { - modecam->set_active (1); -// } else if (spot.modecam == "all") { -// modecam->set_active (2); -// } else if (spot.modecam == "zcam") { -// modecam->set_active (3); + modecam->set_active(1); } if (spot.modecie == "com") { - modecie->set_active (0); + modecie->set_active(0); } else if (spot.modecie == "tm") { - modecie->set_active (1); + modecie->set_active(1); } else if (spot.modecie == "wav") { - modecie->set_active (2); + modecie->set_active(2); } else if (spot.modecie == "dr") { - modecie->set_active (3); + modecie->set_active(3); // } else if (spot.modecie == "log") { // modecie->set_active (4); } @@ -8453,47 +9159,162 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE forcebw->set_active(spot.forcebw); qtoj->set_active(spot.qtoj); sourceGraycie->setValue(spot.sourceGraycie); - sigmoidqjcie->set_active(spot.sigmoidqjcie); + comprcieauto->set_active(spot.comprcieauto); + + if (Autograycie->get_active()) { + comprcieauto->set_active(true); + } + + if (spot.smoothciemet == "none") { + smoothciemet->set_active(0); + } else if (spot.smoothciemet == "Ev") { + smoothciemet->set_active(1); + } else if (spot.smoothciemet == "gam") { + smoothciemet->set_active(2); + } else if (spot.smoothciemet == "gamnorol") { + smoothciemet->set_active(3); + } + + + if (spot.illMethod == "d41") { + illMethod->set_active(0); + } else if (spot.illMethod == "d50") { + illMethod->set_active(1); + } else if (spot.illMethod == "d55") { + illMethod->set_active(2); + } else if (spot.illMethod == "d60") { + illMethod->set_active(3); + } else if (spot.illMethod == "d65") { + illMethod->set_active(4); + } else if (spot.illMethod == "d80") { + illMethod->set_active(5); + } else if (spot.illMethod == "d120") { + illMethod->set_active(6); + } else if (spot.illMethod == "stda") { + illMethod->set_active(7); + } else if (spot.illMethod == "T2000") { + illMethod->set_active(8); + } else if (spot.illMethod == "T1500") { + illMethod->set_active(9); + } else if (spot.illMethod == "iE") { + illMethod->set_active(10); + } + + illMethod->set_sensitive(false); + + if (spot.primMethod == "pro") { + primMethod->set_active(0); + illMethod->set_active(1); + } else if (spot.primMethod == "beta") { + primMethod->set_active(1); + illMethod->set_active(1); + } else if (spot.primMethod == "wid") { + primMethod->set_active(2); + illMethod->set_active(1); + } else if (spot.primMethod == "ac1") { + primMethod->set_active(3); + illMethod->set_active(3); + } else if (spot.primMethod == "rec") { + primMethod->set_active(4); + illMethod->set_active(4); + } else if (spot.primMethod == "ado") { + primMethod->set_active(5); + illMethod->set_active(4); + } else if (spot.primMethod == "srgb") { + primMethod->set_active(6); + illMethod->set_active(4); + } else if (spot.primMethod == "jdcmax") { + primMethod->set_active(7); + illMethod->set_active(1); + } else if (spot.primMethod == "jdcmaxstdA") { + primMethod->set_active(8); + illMethod->set_active(7); + } else if (spot.primMethod == "ac0") { + primMethod->set_active(9); + illMethod->set_active(3); + } else if (spot.primMethod == "best") { + primMethod->set_active(10); + illMethod->set_active(1); + } else if (spot.primMethod == "bru") { + primMethod->set_active(11); + illMethod->set_active(4); + } else if (spot.primMethod == "free") { + primMethod->set_active(9); + illMethod->set_sensitive(true); + + } + + if (spot.catMethod == "brad") { + catMethod->set_active(0); + } else if (spot.catMethod == "cat16") { + catMethod->set_active(1); + } else if (spot.catMethod == "cat02") { + catMethod->set_active(2); + } else if (spot.catMethod == "vky") { + catMethod->set_active(3); + } else if (spot.catMethod == "xyz") { + catMethod->set_active(4); + } + + + normcie->set_active(spot.normcie); + gamutcie->set_active(spot.gamutcie); + sigcie->set_active(spot.sigcie); logcie->set_active(spot.logcie); + satcie->set_active(spot.satcie); + logcieq->set_active(spot.logcieq); + smoothcie->set_active(spot.smoothcie); logjz->set_active(spot.logjz); sigjz->set_active(spot.sigjz); sigq->set_active(spot.sigq); - // chjzcie->set_active(spot.chjzcie); chjzcie->set_active(true);//force to true to avoid other mode sourceabscie->setValue(spot.sourceabscie); jabcie->set_active(spot.jabcie); jabcieChanged(); modecamChanged(); + sursourcieChanged(); + bwevMethodChanged(); + normcieChanged(); + expprecamChanged(); + gamutcieChanged(); + sigcieChanged(); + comprcieautoChanged(); + sigqChanged(); + logcieChanged(); + satcieChanged(); + logcieqChanged(); + smoothcieChanged(); + primMethodChanged(); + illMethodChanged(); + smoothciemetChanged(); - if(logcie->get_active()) { - sigmoidldacie->set_sensitive(false); - sigmoidthcie->set_sensitive(false); - sigmoidblcie->set_sensitive(false); - sigmoidqjcie->set_sensitive(false); - } else { - sigmoidldacie->set_sensitive(true); - sigmoidthcie->set_sensitive(true); - sigmoidblcie->set_sensitive(true); - sigmoidqjcie->set_sensitive(true); + if (spot.bwevMethod == "none") { + bwevMethod->set_active(0); + } else if (spot.bwevMethod == "sig") { + bwevMethod->set_active(1); } if (spot.sursourcie == "Average") { - sursourcie->set_active (0); + sursourcie->set_active(0); } else if (spot.sursourcie == "Dim") { - sursourcie->set_active (1); + sursourcie->set_active(1); } else if (spot.sursourcie == "Dark") { - sursourcie->set_active (2); + sursourcie->set_active(2); + } else if (spot.sursourcie == "exDark") { + sursourcie->set_active(3); + } else if (spot.sursourcie == "disacie") { + sursourcie->set_active(4); } + if (spot.surroundcie == "Average") { - surroundcie->set_active (0); + surroundcie->set_active(0); } else if (spot.surroundcie == "Dim") { - surroundcie->set_active (1); + surroundcie->set_active(1); } else if (spot.surroundcie == "Dark") { - surroundcie->set_active (2); -// } else if (spot.surroundcie == "ExtremelyDark") { -// surroundcie->set_active (3); + surroundcie->set_active(2); } + shapecie->setCurve(spot.ciecurve); shapecie2->setCurve(spot.ciecurve2); @@ -8517,8 +9338,10 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE lightlcie->setValue(spot.lightlcie); lightjzcie->setValue(spot.lightjzcie); lightqcie->setValue(spot.lightqcie); + lightsigqcie->setValue(spot.lightsigqcie); contlcie->setValue(spot.contlcie); contjzcie->setValue(spot.contjzcie); + detailciejz->setValue(spot.detailciejz); adapjzcie->setValue(spot.adapjzcie); jz100->setValue(spot.jz100); pqremap->setValue(spot.pqremap); @@ -8540,27 +9363,55 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE targetjz->setValue(spot.targetjz); sigmoidldacie->setValue(spot.sigmoidldacie); sigmoidthcie->setValue(spot.sigmoidthcie); + sigmoidsenscie->setValue(spot.sigmoidsenscie); sigmoidblcie->setValue(spot.sigmoidblcie); + comprcie->setValue(spot.comprcie); + strcielog->setValue(spot.strcielog); + comprcieth->setValue(spot.comprcieth); + gamjcie->setValue(spot.gamjcie); + slopjcie->setValue(spot.slopjcie); + slopesmo->setValue(spot.slopesmo); + midtcie->setValue(spot.midtcie); + whitescie->setValue(spot.whitescie); + blackscie->setValue(spot.blackscie); sigmoidldajzcie->setValue(spot.sigmoidldajzcie); sigmoidthjzcie->setValue(spot.sigmoidthjzcie); sigmoidbljzcie->setValue(spot.sigmoidbljzcie); contqcie->setValue(spot.contqcie); + contsigqcie->setValue(spot.contsigqcie); colorflcie->setValue(spot.colorflcie); targabscie->setValue(spot.targabscie); targetGraycie->setValue(spot.targetGraycie); detailcie->setValue(spot.detailcie); catadcie->setValue(spot.catadcie); -/* - lightlzcam->setValue(spot.lightlzcam); - lightqzcam->setValue(spot.lightqzcam); - contlzcam->setValue(spot.contlzcam); - contqzcam->setValue(spot.contqzcam); - contthreszcam->setValue(spot.contthreszcam); - colorflzcam->setValue(spot.colorflzcam); - saturzcam->setValue(spot.saturzcam); - chromzcam->setValue(spot.chromzcam); -*/ + + grexl->setValue(spot.grexl); + greyl->setValue(spot.greyl); + bluxl->setValue(spot.bluxl); + bluyl->setValue(spot.bluyl); + redxl->setValue(spot.redxl); + redyl->setValue(spot.redyl); + refi->setValue(spot.refi); + shiftxl->setValue(spot.shiftxl); + shiftyl->setValue(spot.shiftyl); + + labgridcie->setParams(spot.labgridcieALow, + spot.labgridcieBLow, + spot.labgridcieAHigh, + spot.labgridcieBHigh, + spot.labgridcieGx, + spot.labgridcieGy, + spot.labgridcieWx, + spot.labgridcieWy, + spot.labgridcieMx, + spot.labgridcieMy, + false); + + strgradcie->setValue((double)spot.strgradcie); + anggradcie->setValue((double)spot.anggradcie); + enacieMask->set_active(spot.enacieMask); + enacieMaskall->set_active(spot.enacieMaskall); CCmaskcieshape->setCurve(spot.CCmaskciecurve); LLmaskcieshape->setCurve(spot.LLmaskciecurve); HHmaskcieshape->setCurve(spot.HHmaskciecurve); @@ -8570,14 +9421,26 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE lapmaskcie->setValue(spot.lapmaskcie); gammaskcie->setValue(spot.gammaskcie); slomaskcie->setValue(spot.slomaskcie); + highmaskcie->setValue(spot.highmaskcie); + shadmaskcie->setValue(spot.shadmaskcie); + HHhmaskcieshape->setCurve(spot.HHhmaskciecurve); Lmaskcieshape->setCurve(spot.Lmaskciecurve); recothrescie->setValue((double)spot.recothrescie); lowthrescie->setValue((double)spot.lowthrescie); higthrescie->setValue((double)spot.higthrescie); decaycie->setValue((double)spot.decaycie); + strumaskcie->setValue(spot.strumaskcie); + toolcie->set_active(spot.toolcie); + fftcieMask->set_active(spot.fftcieMask); + contcie->setValue(spot.contcie); +// updateColorGUI3(); + blurcie->setValue(spot.blurcie); + LLmaskcieshapewav->setCurve(spot.LLmaskciecurvewav); + csThresholdcie->setValue(spot.csthresholdcie); } + enableListener(); // Update GUI according to complexity mode updateGUIToMode(static_cast(complexity->get_active_row_number())); @@ -8587,13 +9450,14 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) { - const int index = pp->locallab.selspot; + const int index = pp->locallab.selspot; if (index < (int)pp->locallab.spots.size()) { LocallabParams::LocallabSpot& spot = pp->locallab.spots.at(index); spot.expcie = exp->getEnabled(); spot.visicie = exp->get_visible(); spot.complexcie = complexity->get_active_row_number(); + spot.expprecam = expprecam->getEnabled(); spot.reparcie = reparcie->getValue(); spot.sensicie = sensicie->getIntValue(); @@ -8602,10 +9466,6 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.modecam = "cam16"; } else if (modecam->get_active_row_number() == 1) { spot.modecam = "jz"; -// } else if (modecam->get_active_row_number() == 2) { -// spot.modecam = "all"; -// } else if (modecam->get_active_row_number() == 3) { -// spot.modecam = "zcam"; } if (modecie->get_active_row_number() == 0) { @@ -8634,6 +9494,26 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.toneMethodcie2 = "thrc"; } + spot.redxl = redxl->getValue(); + spot.redyl = redyl->getValue(); + spot.grexl = grexl->getValue(); + spot.greyl = greyl->getValue(); + spot.bluxl = bluxl->getValue(); + spot.bluyl = bluyl->getValue(); + spot.refi = refi->getValue(); + spot.shiftxl = shiftxl->getValue(); + spot.shiftyl = shiftyl->getValue(); + labgridcie->getParams(spot.labgridcieALow, + spot.labgridcieBLow, + spot.labgridcieAHigh, + spot.labgridcieBHigh, + spot.labgridcieGx, + spot.labgridcieGy, + spot.labgridcieWx, + spot.labgridcieWy, + spot.labgridcieMx, + spot.labgridcieMy); + spot.Autograycie = Autograycie->get_active(); spot.forcejz = forcejz->get_active(); spot.forcebw = forcebw->get_active(); @@ -8641,19 +9521,109 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.jabcie = jabcie->get_active(); spot.sourceGraycie = sourceGraycie->getValue(); spot.sourceabscie = sourceabscie->getValue(); - spot.sigmoidqjcie = sigmoidqjcie->get_active(); + spot.comprcieauto = comprcieauto->get_active(); + spot.normcie = normcie->get_active(); + spot.gamutcie = gamutcie->get_active(); + spot.sigcie = sigcie->get_active(); spot.logcie = logcie->get_active(); + spot.satcie = satcie->get_active(); + spot.logcieq = logcieq->get_active(); + spot.smoothcie = smoothcie->get_active(); spot.logjz = logjz->get_active(); spot.sigjz = sigjz->get_active(); spot.chjzcie = chjzcie->get_active(); spot.sigq = sigq->get_active(); - if(sursourcie->get_active_row_number() == 0) { + if (sursourcie->get_active_row_number() == 0) { spot.sursourcie = "Average"; } else if (sursourcie->get_active_row_number() == 1) { spot.sursourcie = "Dim"; } else if (sursourcie->get_active_row_number() == 2) { spot.sursourcie = "Dark"; + } else if (sursourcie->get_active_row_number() == 3) { + spot.sursourcie = "exDark"; + } else if (sursourcie->get_active_row_number() == 4) { + spot.sursourcie = "disacie"; + } + + if (bwevMethod->get_active_row_number() == 0) { + spot.bwevMethod = "none"; + } else if (bwevMethod->get_active_row_number() == 1) { + spot.bwevMethod = "sig"; + } + + if (smoothciemet->get_active_row_number() == 0) { + spot.smoothciemet = "none"; + } else if (smoothciemet->get_active_row_number() == 1) { + spot.smoothciemet = "Ev"; + } else if (smoothciemet->get_active_row_number() == 2) { + spot.smoothciemet = "gam"; + } else if (smoothciemet->get_active_row_number() == 3) { + spot.smoothciemet = "gamnorol"; + } + + if (illMethod->get_active_row_number() == 0) { + spot.illMethod = "d41"; + } else if (illMethod->get_active_row_number() == 1) { + spot.illMethod = "d50"; + } else if (illMethod->get_active_row_number() == 2) { + spot.illMethod = "d55"; + } else if (illMethod->get_active_row_number() == 3) { + spot.illMethod = "d60"; + } else if (illMethod->get_active_row_number() == 4) { + spot.illMethod = "d65"; + } else if (illMethod->get_active_row_number() == 5) { + spot.illMethod = "d80"; + } else if (illMethod->get_active_row_number() == 6) { + spot.illMethod = "d120"; + } else if (illMethod->get_active_row_number() == 7) { + spot.illMethod = "stda"; + } else if (illMethod->get_active_row_number() == 8) { + spot.illMethod = "T2000"; + } else if (illMethod->get_active_row_number() == 9) { + spot.illMethod = "T1500"; + } else if (illMethod->get_active_row_number() == 10) { + spot.illMethod = "iE"; + } + + if (primMethod->get_active_row_number() == 0) { + spot.primMethod = "pro"; + } else if (primMethod->get_active_row_number() == 1) { + spot.primMethod = "beta"; + } else if (primMethod->get_active_row_number() == 2) { + spot.primMethod = "wid"; + } else if (primMethod->get_active_row_number() == 3) { + spot.primMethod = "ac1"; + } else if (primMethod->get_active_row_number() == 4) { + spot.primMethod = "rec"; + } else if (primMethod->get_active_row_number() == 5) { + spot.primMethod = "ado"; + } else if (primMethod->get_active_row_number() == 6) { + spot.primMethod = "srgb"; + } else if (primMethod->get_active_row_number() == 7) { + spot.primMethod = "jdcmax"; + } else if (primMethod->get_active_row_number() == 8) { + spot.primMethod = "jdcmaxstdA"; + } else if (primMethod->get_active_row_number() == 9) { + spot.primMethod = "ac0"; + } else if (primMethod->get_active_row_number() == 10) { + spot.primMethod = "best"; + } else if (primMethod->get_active_row_number() == 11) { + spot.primMethod = "bru"; + } else if (primMethod->get_active_row_number() == 12) { + spot.primMethod = "free"; + } + + if (catMethod->get_active_row_number() == 0) { + spot.catMethod = "brad"; + } else if (catMethod->get_active_row_number() == 1) { + spot.catMethod = "cat16"; + } else if (catMethod->get_active_row_number() == 2) { + spot.catMethod = "cat02"; + } else if (catMethod->get_active_row_number() == 3) { + spot.catMethod = "vky"; + } else if (catMethod->get_active_row_number() == 4) { + spot.catMethod = "xyz"; } if (surroundcie->get_active_row_number() == 0) { @@ -8662,9 +9632,8 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.surroundcie = "Dim"; } else if (surroundcie->get_active_row_number() == 2) { spot.surroundcie = "Dark"; -// } else if (surroundcie->get_active_row_number() == 3) { -// spot.surroundcie = "ExtremelyDark"; } + spot.jzcurve = shapejz->getCurve(); spot.czcurve = shapecz->getCurve(); spot.czjzcurve = shapeczjz->getCurve(); @@ -8687,7 +9656,9 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.lightlcie = lightlcie->getValue(); spot.lightjzcie = lightjzcie->getValue(); spot.lightqcie = lightqcie->getValue(); + spot.lightsigqcie = lightsigqcie->getValue(); spot.contlcie = contlcie->getValue(); + spot.detailciejz = detailciejz->getValue(); spot.contjzcie = contjzcie->getValue(); spot.adapjzcie = adapjzcie->getValue(); spot.jz100 = jz100->getValue(); @@ -8710,27 +9681,32 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.targetjz = targetjz->getValue(); spot.sigmoidldacie = sigmoidldacie->getValue(); spot.sigmoidthcie = sigmoidthcie->getValue(); + spot.sigmoidsenscie = sigmoidsenscie->getValue(); spot.sigmoidblcie = sigmoidblcie->getValue(); + spot.comprcie = comprcie->getValue(); + spot.strcielog = strcielog->getValue(); + spot.comprcieth = comprcieth->getValue(); + spot.gamjcie = gamjcie->getValue(); + spot.slopjcie = slopjcie->getValue(); + spot.slopesmo = slopesmo->getValue(); + spot.midtcie = midtcie->getIntValue(); + spot.whitescie = whitescie->getIntValue(); + spot.blackscie = blackscie->getIntValue(); spot.sigmoidldajzcie = sigmoidldajzcie->getValue(); spot.sigmoidthjzcie = sigmoidthjzcie->getValue(); spot.sigmoidbljzcie = sigmoidbljzcie->getValue(); spot.contqcie = contqcie->getValue(); + spot.contsigqcie = contsigqcie->getValue(); spot.colorflcie = colorflcie->getValue(); spot.targabscie = targabscie->getValue(); spot.targetGraycie = targetGraycie->getValue(); spot.catadcie = catadcie->getValue(); spot.detailcie = detailcie->getValue(); -/* - spot.lightlzcam = lightlzcam->getValue(); - spot.lightqzcam = lightqzcam->getValue(); - spot.contlzcam = contlzcam->getValue(); - spot.contqzcam = contqzcam->getValue(); - spot.contthreszcam = contthreszcam->getValue(); - spot.colorflzcam = colorflzcam->getValue(); - spot.saturzcam = saturzcam->getValue(); - spot.chromzcam = chromzcam->getValue(); -*/ + spot.strgradcie = strgradcie->getValue(); + spot.anggradcie = anggradcie->getValue(); + spot.enacieMask = enacieMask->get_active(); + spot.enacieMaskall = enacieMaskall->get_active(); spot.LLmaskciecurve = LLmaskcieshape->getCurve(); spot.CCmaskciecurve = CCmaskcieshape->getCurve(); spot.HHmaskciecurve = HHmaskcieshape->getCurve(); @@ -8740,11 +9716,21 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.lapmaskcie = lapmaskcie->getValue(); spot.gammaskcie = gammaskcie->getValue(); spot.slomaskcie = slomaskcie->getValue(); + spot.highmaskcie = highmaskcie->getValue(); + spot.shadmaskcie = shadmaskcie->getValue(); + spot.HHhmaskciecurve = HHhmaskcieshape->getCurve(); spot.Lmaskciecurve = Lmaskcieshape->getCurve(); spot.recothrescie = recothrescie->getValue(); spot.lowthrescie = lowthrescie->getValue(); spot.higthrescie = higthrescie->getValue(); spot.decaycie = decaycie->getValue(); + spot.strumaskcie = strumaskcie->getValue(); + spot.toolcie = toolcie->get_active(); + spot.fftcieMask = fftcieMask->get_active(); + spot.contcie = contcie->getValue(); + spot.blurcie = blurcie->getValue(); + spot.LLmaskciecurvewav = LLmaskcieshapewav->getCurve(); + spot.csthresholdcie = csThresholdcie->getValue(); } } @@ -8789,10 +9775,96 @@ void Locallabcie::updateMaskBackground(const double normChromar, const double no LLmaskcieshape->updateLocallabBackground(normLumar); HHmaskcieshape->updateLocallabBackground(normHuer); Lmaskcieshape->updateLocallabBackground(normLumar); + HHhmaskcieshape->updateLocallabBackground(normHuer); + return false; + } + ); +} + +void Locallabcie::updatePrimloc(const float redx, const float redy, const float grex, const float grey, const float blux, const float bluy) +{ + idle_register.add( + [this, redx, redy, grex, grey, blux, bluy]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update adjuster values according to autocomputed ones + disableListener(); + redxl->setValue(redx); + redyl->setValue(redy); + grexl->setValue(grex); + greyl->setValue(grey); + bluxl->setValue(blux); + bluyl->setValue(bluy); + + enableListener(); return false; } - ); + ); + +} + +void Locallabcie::updatesigloc(const float cont_sig, const float light_sig) +{ + idle_register.add( + [this, cont_sig, light_sig]() -> bool { + GThreadLock lock; + disableListener(); + + contsigqcie->setValue(cont_sig); + lightsigqcie->setValue(light_sig); + + enableListener(); + return false; + } + ); + +} + + + +void Locallabcie::updateiPrimloc(const float r_x, const float r_y, const float g_x, const float g_y, const float b_x, const float b_y, const float w_x, const float w_y, const float m_x, const float m_y, const float me_x, const float me_y) +{ + nextrx = r_x; + nextry = r_y; + nextbx = b_x; + nextby = b_y; + nextgx = g_x; + nextgy = g_y; + nextwx = w_x; + nextwy = w_y; + nextmx = m_x; + nextmy = m_y; + + //convert xy datas in datas for labgrid areas + nextrx = 1.81818f * (nextrx + 0.1f) - 1.f; + nextry = 1.81818f * (nextry + 0.1f) - 1.f; + nextbx = 1.81818f * (nextbx + 0.1f) - 1.f; + nextby = 1.81818f * (nextby + 0.1f) - 1.f; + nextgx = 1.81818f * (nextgx + 0.1f) - 1.f; + nextgy = 1.81818f * (nextgy + 0.1f) - 1.f; + nextwx = 1.81818f * (nextwx + 0.1f) - 1.f; + nextwy = 1.81818f * (nextwy + 0.1f) - 1.f; + nextmx = 1.81818f * (nextmx + 0.1f) - 1.f; + nextmy = 1.81818f * (nextmy + 0.1f) - 1.f; + + idle_register.add( + [this, r_x, r_y, g_x, g_y, b_x, b_y]() -> bool { + GThreadLock lock; + disableListener(); + + redxl->setValue(r_x); + redyl->setValue(r_y); + grexl->setValue(g_x); + greyl->setValue(g_y); + bluxl->setValue(b_x); + bluyl->setValue(b_y); + labgridcie->setParams(nextrx, nextry, nextbx, nextby, nextgx, nextgy, nextwx, nextwy, nextmx, nextmy, false); + enableListener(); + return false; + } + ); + } @@ -8818,12 +9890,10 @@ void Locallabcie::updateAutocompute(const float blackev, const float whiteev, co return false; } - ); + ); } } - - void Locallabcie::AutograycieChanged() { @@ -8834,6 +9904,11 @@ void Locallabcie::AutograycieChanged() jz100->set_sensitive(false); blackEvjz->set_sensitive(false); whiteEvjz->set_sensitive(false); + + comprcieauto->set_active(true); + whitescie->set_sensitive(true); + blackscie->set_sensitive(true); + } else { sourceGraycie->set_sensitive(true); sourceabscie->set_sensitive(true); @@ -8841,9 +9916,10 @@ void Locallabcie::AutograycieChanged() jz100->set_sensitive(true); blackEvjz->set_sensitive(true); whiteEvjz->set_sensitive(true); - // adapjzcie->set_sensitive(false); - // jz100->set_sensitive(false); + whitescie->set_sensitive(false); + blackscie->set_sensitive(false); } + if (isLocActivated && exp->getEnabled()) { if (listener) { if (Autograycie->get_active()) { @@ -8920,36 +9996,107 @@ void Locallabcie::jabcieChanged() } } -void Locallabcie::sigmoidqjcieChanged() +void Locallabcie::comprcieautoChanged() { + if (isLocActivated && exp->getEnabled()) { if (listener) { - if (sigmoidqjcie->get_active()) { - listener->panelChanged(Evlocallabsigmoidqjcie, + if (comprcieauto->get_active()) { + listener->panelChanged(Evlocallabcomprcieauto, M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); } else { - listener->panelChanged(Evlocallabsigmoidqjcie, + listener->panelChanged(Evlocallabcomprcieauto, M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); } } } } -void Locallabcie::logcieChanged() +void Locallabcie::normcieChanged() { - if(logcie->get_active()) { - sigmoidldacie->set_sensitive(false); - sigmoidthcie->set_sensitive(false); - sigmoidblcie->set_sensitive(false); - sigmoidqjcie->set_sensitive(false); - } else { - sigmoidldacie->set_sensitive(true); - sigmoidthcie->set_sensitive(true); + if (normcie->get_active()) { sigmoidblcie->set_sensitive(true); - sigmoidqjcie->set_sensitive(true); + } else { + sigmoidblcie->set_sensitive(false); } + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (normcie->get_active()) { + listener->panelChanged(Evlocallabnormcie, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabnormcie, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } + +} + + +void Locallabcie::gamutcieChanged() +{ + if (gamutcie->get_active()) { + catBox->set_sensitive(true); + } else { + catBox->set_sensitive(false); + } + + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (gamutcie->get_active()) { + listener->panelChanged(Evlocallabgamutcie, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabgamutcie, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } + +} + +void Locallabcie::expprecamChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (expprecam->getEnabled()) { + listener->panelChanged(Evlocallabexpprecam, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabexpprecam, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } + +} + + +void Locallabcie::sigcieChanged() +{ + contsigqcie->hide(); + lightsigqcie->hide(); + + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (sigcie->get_active()) { + listener->panelChanged(Evlocallabsigcie, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabsigcie, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } + +} + + +void Locallabcie::logcieChanged() +{ if (isLocActivated && exp->getEnabled()) { if (listener) { if (logcie->get_active()) { @@ -8963,6 +10110,60 @@ void Locallabcie::logcieChanged() } } +void Locallabcie::satcieChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (satcie->get_active()) { + listener->panelChanged(Evlocallabsatcie, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabsatcie, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + +void Locallabcie::logcieqChanged() +{ + if (logcieq->get_active()) { + satcie->hide(); + sigmoidnormFrame->hide(); + } else { + satcie->show(); + sigmoidnormFrame->show(); + } + + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (logcieq->get_active()) { + listener->panelChanged(Evlocallablogcieq, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallablogcieq, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + + +void Locallabcie::smoothcieChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (smoothcie->get_active()) { + listener->panelChanged(Evlocallabsmoothcie, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabsmoothcie, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + void Locallabcie::logjzChanged() { if (isLocActivated && exp->getEnabled()) { @@ -8995,6 +10196,9 @@ void Locallabcie::sigjzChanged() void Locallabcie::sigqChanged() { + contsigqcie->hide(); + lightsigqcie->hide(); + if (isLocActivated && exp->getEnabled()) { if (listener) { if (sigq->get_active()) { @@ -9015,6 +10219,7 @@ void Locallabcie::chjzcieChanged() } else { thrhjzcie->set_sensitive(false); } + if (isLocActivated && exp->getEnabled()) { if (listener) { if (chjzcie->get_active()) { @@ -9031,8 +10236,11 @@ void Locallabcie::chjzcieChanged() void Locallabcie::modecamChanged() { const int mode = complexity->get_active_row_number(); + contsigqcie->hide(); + lightsigqcie->hide(); + const LocallabParams::LocallabSpot defSpot; - if (modecam->get_active_row_number() == 1 || modecam->get_active_row_number() == 2) { + if (modecam->get_active_row_number() == 1) { expjz->show(); jzFrame->show(); adapjzcie->show(); @@ -9045,82 +10253,74 @@ void Locallabcie::modecamChanged() sigmoidjzFrame->show(); sigmoidFrame->hide(); forcejz->hide(); + expprecam->hide(); + expcam16->hide(); + expcamviewing->hide(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); } else { expjz->hide(); + lapmaskcie->show(); + jzFrame->hide(); adapjzcie->hide(); jz100->hide(); pqremap->hide(); - pqremapcam16->show(); + + if (mode == Expert) { + pqremapcam16->show(); + } else { + pqremapcam16->hide(); + } + jabcie->hide(); PQFrame->hide(); logjzFrame->hide(); - if (modecam->get_active_row_number() == 0){ + + if (modecam->get_active_row_number() == 0) { bevwevFrame->show(); sigmoidFrame->show(); + expprecam->show(); + } + sigmoidjzFrame->hide(); forcejz->hide(); catadcie->show(); } + surHBoxcie->show(); cie1Frame->show(); expcam16->show(); - cie2Frame->show(); + expcamviewing->show(); sourceGraycie->show(); - cieFrame->show(); + expcamscene->show(); if (modecam->get_active_row_number() == 1) { + guijzczhz(); surHBoxcie->show(); - cie1Frame->hide(); - expcam16->hide(); - targetGraycie->hide(); - targabscie->hide(); - surrHBoxcie->hide(); - forcejz->hide(); - pqremapcam16->hide(); - catadcie->hide(); - cie2Frame->hide(); - exprecovcie->hide(); - expmaskcie->hide(); - if(mode == Expert) { + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + + if (mode == Expert) { exprecovcie->show(); expmaskcie->show(); + expgradcie->hide(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + } - } - if (modecam->get_active_row_number() == 3) { - if(mode == Expert) { - cieFrame->show(); - cie1Frame->hide(); - expcam16->hide(); - cie2Frame->show(); - targetGraycie->show(); - targabscie->show(); - surrHBoxcie->show(); - PQFrame->show(); - logjzFrame->show(); - adapjzcie->hide(); - jz100->hide(); - forcejz->hide(); - pqremap->show(); - pqremapcam16->hide(); - catadcie->hide(); - cie2Frame->hide(); - - } else { - cieFrame->hide(); - cie1Frame->hide(); - expcam16->hide(); - cie2Frame->hide(); - catadcie->hide(); - cie2Frame->hide(); - - } + } else if (mode != Simple){ + exprecovcie->show(); + expgradcie->show(); + expmaskcie->show(); } - if(mode != Expert) { + + if (mode != Expert) { expjz->hide(); jzFrame->hide(); adapjzcie->hide(); @@ -9132,33 +10332,54 @@ void Locallabcie::modecamChanged() sigmoidjzFrame->hide(); sigmoidFrame->hide(); bevwevFrame->hide(); - if (modecam->get_active_row_number() == 0){ + + if (modecam->get_active_row_number() == 0) { bevwevFrame->show(); sigmoidFrame->show(); } forcejz->hide(); - pqremapcam16->show(); + + if (mode == Expert) { + pqremapcam16->show(); + } else { + pqremapcam16->hide(); + } + catadcie->show(); sourceGraycie->show(); - if (modecam->get_active_row_number() == 1 || modecam->get_active_row_number() == 3) { + if (modecam->get_active_row_number() == 1) { pqremapcam16->hide(); - cieFrame->hide(); + expcamscene->hide(); cie1Frame->hide(); expcam16->hide(); - cie2Frame->hide(); + expcamviewing->hide(); catadcie->hide(); - cie2Frame->hide(); + expgradcie->hide(); + expcam16->hide(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + + } else if (mode != Simple){ + exprecovcie->show(); + expgradcie->show(); + expmaskcie->show(); } } else { - cieFrame->show(); - cie2Frame->show(); - if (modecam->get_active_row_number() == 0){ + expcamscene->show(); + expcamviewing->show(); + + if (modecam->get_active_row_number() == 0) { bevwevFrame->show(); sigmoidjzFrame->hide(); + expprecam->show(); + lapmaskcie->show(); + } + if (modecam->get_active_row_number() == 1) { targetGraycie->hide(); targabscie->hide(); @@ -9171,7 +10392,13 @@ void Locallabcie::modecamChanged() sigmoidFrame->hide(); bevwevFrame->show(); catadcie->hide(); - cie2Frame->hide(); + expcamviewing->hide(); + expgradcie->hide(); + expcam16->hide(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + if (chjzcie->get_active()) { thrhjzcie->set_sensitive(true); } else { @@ -9180,34 +10407,35 @@ void Locallabcie::modecamChanged() } - if (modecam->get_active_row_number() == 3) { - cieFrame->show(); - cie2Frame->show(); - targetGraycie->show(); - targabscie->show(); - surrHBoxcie->show(); - PQFrame->show(); - logjzFrame->show(); - adapjzcie->hide(); - jz100->hide(); - forcejz->hide(); - pqremap->show(); - pqremapcam16->hide(); - catadcie->hide(); - cie2Frame->hide(); - } + } - if (modecam->get_active_row_number() == 0 || modecam->get_active_row_number() == 2) { - targetGraycie->show(); - targabscie->show(); - surrHBoxcie->show(); - cie2Frame->show(); - pqremapcam16->show(); + + if (modecam->get_active_row_number() == 0) { + targetGraycie->show(); + targabscie->show(); + surrHBoxcie->show(); + expprecam->show(); + expcamviewing->show(); + if (mode != Simple){ + exprecovcie->show(); + expgradcie->show(); + expmaskcie->show(); } + if (mode == Expert) { + pqremapcam16->show(); + } else { + pqremapcam16->hide(); + } + } + + contsigqcie->hide(); + lightsigqcie->hide(); + + if (isLocActivated && exp->getEnabled()) { if (listener) { @@ -9223,26 +10451,34 @@ void Locallabcie::modecieChanged() if (isLocActivated && exp->getEnabled()) { const int mode = complexity->get_active_row_number(); - exprecovcie->show(); - expmaskcie->show(); + exprecovcie->show(); + expmaskcie->show(); + expgradcie->show(); - if (modecie->get_active_row_number() > 0) { + if (modecie->get_active_row_number() > 0 && mode == Expert) { sensicie->hide(); reparcie->hide(); - exprecovcie->hide(); - expmaskcie->hide(); + exprecovcie->show(); + expmaskcie->show(); + expgradcie->hide(); } else { sensicie->show(); reparcie->show(); - if(mode == Expert) { + + if (mode == Expert) { exprecovcie->show(); expmaskcie->show(); + expgradcie->show(); } } + + contsigqcie->hide(); + lightsigqcie->hide(); + if (mode == Simple || mode == Normal) { // Keep widget hidden in Normal and Simple mode - modecie->set_active (0); + modecie->set_active(0); sensicie->show(); reparcie->show(); @@ -9259,6 +10495,22 @@ void Locallabcie::modecieChanged() void Locallabcie::sursourcieChanged() { + const LocallabParams::LocallabSpot defSpot; + + if (sursourcie->get_active_row_number() == 4) { + expcam16->hide(); + expcamviewing->hide(); + } else { + expcam16->show(); + expcamviewing->show(); + if(modecam->get_active_row_number() == 1) { + expcam16->hide(); + expcamviewing->hide(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + } + } + if (isLocActivated && exp->getEnabled()) { if (listener) { listener->panelChanged(Evlocallabsursourcie, @@ -9267,6 +10519,120 @@ void Locallabcie::sursourcieChanged() } } +void Locallabcie::catMethodChanged() +{ + + if (listener) { + listener->panelChanged(Evlocallabcatcie, catMethod->get_active_text()); + } + +} + +void Locallabcie::illMethodChanged() +{ + + if (listener) { + listener->panelChanged(Evlocallabillcie, illMethod->get_active_text()); + } + +} + +void Locallabcie::smoothciemetChanged() +{ + if(smoothciemet->get_active_row_number() == 3) { + slopesmo->show(); + smoothcie->show(); + } else { + slopesmo->hide(); + smoothcie->hide(); + } + + if (listener) { + listener->panelChanged(Evlocallabsmoothciemet, smoothciemet->get_active_text()); + } + +} + + +void Locallabcie::primMethodChanged() +{ + + if (primMethod->get_active_row_number() == 0) { + illMethod->set_active(1); + } else if (primMethod->get_active_row_number() == 1) { + illMethod->set_active(1); + } else if (primMethod->get_active_row_number() == 2) { + illMethod->set_active(1); + } else if (primMethod->get_active_row_number() == 3) { + illMethod->set_active(3); + } else if (primMethod->get_active_row_number() == 4) { + illMethod->set_active(4); + } else if (primMethod->get_active_row_number() == 5) { + illMethod->set_active(4); + } else if (primMethod->get_active_row_number() == 6) { + illMethod->set_active(4); + } else if (primMethod->get_active_row_number() == 7) { + illMethod->set_active(1); + } else if (primMethod->get_active_row_number() == 8) { + illMethod->set_active(7); + } else if (primMethod->get_active_row_number() == 9) { + illMethod->set_active(3); + } else if (primMethod->get_active_row_number() == 10) { + illMethod->set_active(1); + } else if (primMethod->get_active_row_number() == 11) { + illMethod->set_active(4); + } + + illMethod->set_sensitive(false); + + if (primMethod->get_active_row_number() == 12) { + redBox->set_sensitive(true); + illMethod->set_sensitive(true); + + } else { + redBox->set_sensitive(false); + } + + if (listener) { + listener->panelChanged(Evlocallabprimcie, primMethod->get_active_text()); + } + +} + +void Locallabcie::bwevMethodChanged() +{ + const LocallabParams::LocallabSpot defSpot; + const int mode = complexity->get_active_row_number(); + + if (bwevMethod->get_active_row_number() == 2) {// && sigcie->get_active()) { + comprcie->set_sensitive(true); + comprcieth->set_sensitive(true); + comprcieauto->set_sensitive(true); + comprcieauto->set_active(true); + + if (mode == Simple) { + comprcieth->set_sensitive(false); + comprcieauto->set_sensitive(false); + } + + } else { + comprcieth->set_sensitive(false); + comprcieauto->set_sensitive(false); + } + + if (bwevMethod->get_active_row_number() == 2) { + comprcie->setValue(defSpot.comprcie);//to test + } + + if (isLocActivated && exp->getEnabled()) { + if (listener) { + listener->panelChanged(EvlocallabbwevMethod, + bwevMethod->get_active_text() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } +} + + void Locallabcie::surroundcieChanged() { if (isLocActivated && exp->getEnabled()) { @@ -9277,8 +10643,37 @@ void Locallabcie::surroundcieChanged() } } +void Locallabcie::guijzczhz() +{ + expcamscene->hide(); + cie1Frame->hide(); + expcam16->hide(); + forcejz->hide(); + pqremapcam16->hide(); + PQFrame->hide(); + logjzFrame->hide(); + bevwevFrame->hide(); + sigmoidjzFrame->hide(); + sigmoidFrame->hide(); + catadcie->hide(); + expcamviewing->hide(); + maskusablecie->hide(); + maskunusablecie->hide(); + decaycie->hide(); + expmaskcie->hide(); + expprecam->hide(); + exprecovcie->hide(); + expgradcie->hide(); + lapmaskcie->hide(); +} + + + + void Locallabcie::updateGUIToMode(const modeType new_type) { + const LocallabParams::LocallabSpot defSpot; + switch (new_type) { case Simple: catadcie->show(); @@ -9297,102 +10692,122 @@ void Locallabcie::updateGUIToMode(const modeType new_type) surHBoxcie->show(); sourceabscie->show(); targabscie->show(); - detailcie->hide(); + detailcie->show(); //hide jabcie->hide(); modeHBoxcie->hide(); sensicie->show(); reparcie->show(); - sigmoidblcie->hide(); - + sigmoidsenscie->hide(); + sigmoidnormFrame->hide(); + pqremapcam16->hide(); expjz->hide(); jzFrame->hide(); adapjzcie->hide(); jz100->hide(); pqremap->show(); - pqremapcam16->show(); jabcie->hide(); targetGraycie->show(); targabscie->show(); surrHBoxcie->show(); forcejz->hide(); sourceGraycie->show(); - cieFrame->show(); + expcamscene->show(); exprecovcie->hide(); + expgradcie->hide(); maskusablecie->hide(); maskunusablecie->hide(); decaycie->hide(); expmaskcie->hide(); - expmaskcie->hide(); + comprcie->show(); + strcielog->show(); + satcie->show(); + logcieq->hide(); + blackEvjz->hide(); + whiteEvjz->hide(); + whitescie->hide(); + blackscie->hide(); + logcieFrame->hide(); + comprcieth->hide(); + comprcieauto->hide(); + comprBox->show(); + slopesmo->hide(); + smoothcie->hide(); - if (modecam->get_active_row_number() == 2) { - PQFrame->hide(); - logjzFrame->hide(); - sigmoidjzFrame->hide(); - bevwevFrame->hide(); - sigmoidFrame->hide(); - } - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0) { bevwevFrame->show(); - sigmoidFrame->show(); + sigmoidFrame->hide(); //show + expprecam->show(); + primillFrame->hide(); + expmaskcie->hide(); + exprecovcie->hide(); + expgradcie->hide(); + if(smoothciemet->get_active_row_number() == 3) { + slopesmo->show(); + smoothcie->show(); + } else { + slopesmo->hide(); + smoothcie->hide(); + } } if (modecam->get_active_row_number() == 1) { - cieFrame->hide(); - cie1Frame->hide(); - expcam16->hide(); - forcejz->hide(); - pqremapcam16->hide(); - PQFrame->hide(); - logjzFrame->hide(); - bevwevFrame->hide(); - sigmoidjzFrame->hide(); - sigmoidFrame->hide(); - catadcie->hide(); - cie2Frame->hide(); - maskusablecie->hide(); - maskunusablecie->hide(); - decaycie->hide(); - expmaskcie->hide(); - } - if (modecam->get_active_row_number() == 3) { - cieFrame->hide(); - cie1Frame->hide(); - expcam16->hide(); - cie2Frame->hide(); - pqremapcam16->hide(); - PQFrame->hide(); - logjzFrame->hide(); - catadcie->hide(); + // cieFrame->hide(); + guijzczhz(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + enacieMaskall->hide(); } + + contsigqcie->hide(); + lightsigqcie->hide(); + expmaskcie->hide(); + exprecovcie->hide(); + expgradcie->hide(); + break; + case Normal: // Expert mode widgets are hidden in Normal mode catadcie->show(); saturlcie->show(); rstprotectcie->show(); - chromlcie->hide(); - huecie->hide(); + chromlcie->show();//hide + huecie->show();//hide lightlcie->show(); - lightqcie->hide(); + lightqcie->show();//hide contlcie->show(); contthrescie->show(); - contqcie->hide(); + contqcie->show();//hide colorflcie->hide(); surrHBoxcie->show(); expLcie->hide(); surHBoxcie->show(); sourceabscie->show(); targabscie->show(); - detailcie->hide(); + detailcie->show();//hide jabcie->hide(); modeHBoxcie->hide(); sensicie->show(); reparcie->show(); sigmoidblcie->show(); + sigmoidsenscie->hide(); expjz->hide(); forcejz->hide(); + comprcie->show(); + strcielog->show(); + satcie->show(); + logcieq->hide(); + blackEvjz->show(); + whiteEvjz->show(); + whitescie->show(); + blackscie->show(); + + logcieFrame->hide(); + comprcieth->show(); + comprcieauto->show(); + comprBox->show(); jzFrame->hide(); adapjzcie->hide(); @@ -9402,15 +10817,24 @@ void Locallabcie::updateGUIToMode(const modeType new_type) targetGraycie->show(); targabscie->show(); surrHBoxcie->show(); - pqremapcam16->show(); + pqremapcam16->hide(); sourceGraycie->show(); - cieFrame->show(); + expcamscene->show(); exprecovcie->show(); + expgradcie->show(); expmaskcie->show(); decaycie->hide(); lapmaskcie->hide(); gammaskcie->hide(); slomaskcie->hide(); + highmaskcie->hide(); + shadmaskcie->hide(); + struFramecie->hide(); + blurFramecie->hide(); + wavFramecie->hide(); + maskcieHCurveEditorG->hide(); + sigmoidnormFrame->hide(); + if (enacieMask->get_active()) { maskusablecie->show(); maskunusablecie->hide(); @@ -9419,52 +10843,46 @@ void Locallabcie::updateGUIToMode(const modeType new_type) maskusablecie->hide(); maskunusablecie->show(); } - if (modecam->get_active_row_number() == 0){ + + if (modecam->get_active_row_number() == 0) { bevwevFrame->show(); sigmoidFrame->show(); + expprecam->show(); + primillFrame->hide();//show + enacieMaskall->hide(); + + if(smoothciemet->get_active_row_number() == 3) { + slopesmo->show(); + smoothcie->show(); + } else { + slopesmo->hide(); + smoothcie->hide(); + } } - if (modecam->get_active_row_number() == 2) { - PQFrame->hide(); - logjzFrame->hide(); - sigmoidjzFrame->hide(); - bevwevFrame->hide(); - } if (modecam->get_active_row_number() == 1) { - cieFrame->hide(); - cie1Frame->hide(); - expcam16->hide(); - forcejz->hide(); - pqremapcam16->hide(); - PQFrame->hide(); - logjzFrame->hide(); - sigmoidjzFrame->hide(); - bevwevFrame->hide(); - sigmoidFrame->hide(); - catadcie->hide(); - cie2Frame->hide(); - exprecovcie->hide(); - expmaskcie->hide(); - maskusablecie->hide(); - maskunusablecie->hide(); + guijzczhz(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + enacieMaskall->hide(); + } else { + exprecovcie->show(); + expgradcie->show(); + expmaskcie->show(); } - if (modecam->get_active_row_number() == 3) { - cieFrame->hide(); - cie1Frame->hide(); - expcam16->hide(); - cie2Frame->hide(); - pqremapcam16->hide(); - PQFrame->hide(); - catadcie->hide(); - logjzFrame->hide(); - } + + if (modecie->get_active_row_number() > 0) { exprecovcie->hide(); expmaskcie->hide(); + expgradcie->hide(); } + contsigqcie->hide(); + lightsigqcie->hide(); + break; case Expert: @@ -9488,20 +10906,48 @@ void Locallabcie::updateGUIToMode(const modeType new_type) detailcie->show(); modeHBoxcie->show(); sigmoidblcie->show(); + pqremapcam16->show(); + comprcie->show(); + strcielog->show(); + logcieq->show(); + blackEvjz->show(); + whiteEvjz->show(); + whitescie->show(); + blackscie->show(); + logcieFrame->show(); + comprcieth->show(); + comprcieauto->show(); + sigmoidsenscie->show(); + sigmoidnormFrame->show(); + + if (logcieq->get_active()) { + satcie->hide(); + sigmoidnormFrame->hide(); + } else { + satcie->show(); + sigmoidnormFrame->show(); + } + targetGraycie->show(); targabscie->show(); surrHBoxcie->show(); forcejz->hide(); - pqremapcam16->show(); sourceGraycie->show(); - cieFrame->show(); + expcamscene->show(); exprecovcie->show(); + expgradcie->show(); decaycie->show(); lapmaskcie->show(); gammaskcie->show(); slomaskcie->show(); + highmaskcie->show(); + shadmaskcie->show(); + maskcieHCurveEditorG->show(); expmaskcie->show(); - exprecovcie->show(); + struFramecie->show(); + blurFramecie->show(); + wavFramecie->show(); + comprBox->show(); if (enacieMask->get_active()) { maskusablecie->show(); @@ -9511,11 +10957,24 @@ void Locallabcie::updateGUIToMode(const modeType new_type) maskusablecie->hide(); maskunusablecie->show(); } - if (modecam->get_active_row_number() == 0){ + + if (modecam->get_active_row_number() == 0) { bevwevFrame->show(); + expprecam->show(); + primillFrame->show(); + enacieMaskallChanged2(); + enacieMaskall->show(); + + if(smoothciemet->get_active_row_number() == 3) { + slopesmo->show(); + smoothcie->show(); + } else { + slopesmo->hide(); + smoothcie->hide(); + } } - if (modecam->get_active_row_number() == 1 || modecam->get_active_row_number() == 2) { + if (modecam->get_active_row_number() == 1) { jabcie->show(); expjz->show(); jzFrame->show(); @@ -9528,12 +10987,22 @@ void Locallabcie::updateGUIToMode(const modeType new_type) sigmoidjzFrame->show(); sigmoidFrame->hide(); forcejz->hide(); + expprecam->hide(); + expgradcie->hide(); + expcam16->hide(); + exprecovcie->show(); + expmaskcie->show(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + enacieMaskall->show(); } - cieFrame->show(); - cie2Frame->show(); - if (modecam->get_active_row_number() == 0 || modecam->get_active_row_number() == 2) { + expcamscene->show(); + expcamviewing->show(); + + if (modecam->get_active_row_number() == 0) { targetGraycie->show(); targabscie->show(); surrHBoxcie->show(); @@ -9542,18 +11011,23 @@ void Locallabcie::updateGUIToMode(const modeType new_type) logjzFrame->hide(); sigmoidjzFrame->hide(); bevwevFrame->hide(); - if (modecam->get_active_row_number() == 0){ - bevwevFrame->show(); - sigmoidFrame->show(); - } + bevwevFrame->show(); + sigmoidFrame->show(); + expprecam->show(); + primillFrame->show(); + enacieMaskallChanged2(); + enacieMaskall->show(); + + if(smoothciemet->get_active_row_number() == 3) { + slopesmo->show(); + smoothcie->show(); + } else { + slopesmo->hide(); + smoothcie->hide(); + } } - if (modecam->get_active_row_number() == 2) { - PQFrame->show(); - logjzFrame->hide(); - sigmoidjzFrame->hide(); - bevwevFrame->hide(); - } + if (modecam->get_active_row_number() == 1) { surHBoxcie->show(); @@ -9567,76 +11041,100 @@ void Locallabcie::updateGUIToMode(const modeType new_type) sigmoidFrame->hide(); bevwevFrame->show(); catadcie->hide(); - cie2Frame->hide(); + expcamviewing->hide(); exprecovcie->show(); + expgradcie->show(); expmaskcie->show(); maskusablecie->show(); maskunusablecie->show(); + expprecam->hide(); + expgradcie->hide(); + expcam16->hide(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + enacieMaskall->show(); + if (chjzcie->get_active()) { thrhjzcie->set_sensitive(true); } else { thrhjzcie->set_sensitive(false); } - } - - if (modecam->get_active_row_number() == 3) { - cieFrame->show(); - cie1Frame->hide(); - expcam16->hide(); - cie2Frame->show(); - targetGraycie->show(); - targabscie->show(); - surrHBoxcie->show(); - PQFrame->show(); - logjzFrame->show(); - adapjzcie->hide(); - jz100->hide(); - forcejz->hide(); - pqremap->show(); - pqremapcam16->hide(); - catadcie->hide(); } + + if (modecie->get_active_row_number() > 0) { exprecovcie->hide(); expmaskcie->hide(); + expgradcie->hide(); } + contsigqcie->hide(); + lightsigqcie->hide(); + } } void Locallabcie::updatecieGUI() { + const LocallabParams::LocallabSpot defSpot; const int mode = complexity->get_active_row_number(); expmaskcie->show(); exprecovcie->show(); + expgradcie->show(); + + contsigqcie->hide(); + lightsigqcie->hide(); + + if (modecie->get_active_row_number() > 0) { sensicie->hide(); reparcie->hide(); exprecovcie->hide(); + expgradcie->hide(); expmaskcie->hide(); } else { sensicie->show(); reparcie->show(); exprecovcie->show(); + expgradcie->show(); expmaskcie->show(); } - surHBoxcie->show(); - cie1Frame->show(); - cie2Frame->show(); - expcam16->show(); - if (modecam->get_active_row_number() == 0){ - bevwevFrame->show(); + + surHBoxcie->show(); + cie1Frame->show(); + expcam16->show(); + expcamviewing->show(); + + if (modecam->get_active_row_number() == 0) { + bevwevFrame->show(); + expprecam->show(); + + if (mode == Simple) { + expmaskcie->hide(); + exprecovcie->hide(); + primillFrame->hide(); + expgradcie->hide(); + + } else if (mode == Normal) { + primillFrame->hide(); + } else { + primillFrame->show(); + } + + if(smoothciemet->get_active_row_number() == 3) { + slopesmo->show(); + smoothcie->show(); + } else { + slopesmo->hide(); + smoothcie->hide(); + } } - if (modecam->get_active_row_number() == 2 && mode == Expert) { - PQFrame->show(); - logjzFrame->show(); - sigmoidjzFrame->show(); - bevwevFrame->show(); - } - sourceGraycie->show(); - cieFrame->show(); + + sourceGraycie->show(); + expcamscene->show(); if (enacieMask->get_active() && mode != Simple) { maskusablecie->show(); @@ -9647,7 +11145,58 @@ void Locallabcie::updatecieGUI() maskunusablecie->show(); } - if (modecam->get_active_row_number() == 1) { + + if (Autograycie->get_active()) { + sourceGraycie->set_sensitive(false); + sourceabscie->set_sensitive(false); + adapjzcie->set_sensitive(false); + jz100->set_sensitive(false); + blackEvjz->set_sensitive(false); + whiteEvjz->set_sensitive(false); + whitescie->set_sensitive(true); + blackscie->set_sensitive(true); + comprcieauto->set_active(true); + + } else { + sourceGraycie->set_sensitive(true); + sourceabscie->set_sensitive(true); + adapjzcie->set_sensitive(true); + blackEvjz->set_sensitive(true); + whiteEvjz->set_sensitive(true); + whitescie->set_sensitive(false); + blackscie->set_sensitive(false); + jz100->set_sensitive(true); + } + + if (mode == Simple || mode == Normal) { // Keep widget hidden in Normal and Simple mode + modecie->set_active(0); + sensicie->show(); + reparcie->show(); + } + + if (sursourcie->get_active_row_number() == 4) { + expcam16->hide(); + expcamviewing->hide(); + } else { + expcam16->show(); + expcamviewing->show(); + if(modecam->get_active_row_number() == 1) { + expcam16->hide(); + expcamviewing->hide(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + } + } + + + if (modecie->get_active_row_number() > 0) { + exprecovcie->hide(); + expgradcie->hide(); + expmaskcie->hide(); + } + + if (modecam->get_active_row_number() == 1 && (mode == Expert)) { surHBoxcie->show(); cie1Frame->hide(); expcam16->hide(); @@ -9661,80 +11210,19 @@ void Locallabcie::updatecieGUI() bevwevFrame->show(); sigmoidFrame->hide(); catadcie->hide(); - cie2Frame->hide(); - if(mode != Expert) { - cieFrame->hide(); - cie1Frame->hide(); - expcam16->hide(); - cie2Frame->hide(); - PQFrame->hide(); - logjzFrame->hide(); - sigmoidjzFrame->hide(); - sigmoidFrame->hide(); - bevwevFrame->hide(); - if (modecam->get_active_row_number() == 0){ - bevwevFrame->show(); - sigmoidFrame->show(); - } - exprecovcie->hide(); - expmaskcie->hide(); - maskusablecie->hide(); - maskunusablecie->hide(); - } + expprecam->hide(); + expcamviewing->hide(); + expgradcie->hide(); + expcam16->hide(); + exprecovcie->show(); + expmaskcie->show(); + lapmaskcie->hide(); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + enacieMaskall->show(); } - if (modecam->get_active_row_number() == 3) { - if(mode == Expert) { - cie1Frame->hide(); - expcam16->hide(); - cie2Frame->show(); - targetGraycie->show(); - targabscie->show(); - surrHBoxcie->show(); - cieFrame->show(); - PQFrame->show(); - logjzFrame->show(); - adapjzcie->hide(); - jz100->hide(); - forcejz->hide(); - pqremap->show(); - pqremapcam16->hide(); - PQFrame->show(); - catadcie->hide(); - } else { - cie1Frame->hide(); - expcam16->hide(); - cie2Frame->hide(); - PQFrame->hide(); - logjzFrame->hide(); - } - } - if (Autograycie->get_active()) { - sourceGraycie->set_sensitive(false); - sourceabscie->set_sensitive(false); - adapjzcie->set_sensitive(false); - jz100->set_sensitive(false); - blackEvjz->set_sensitive(false); - whiteEvjz->set_sensitive(false); - } else { - sourceGraycie->set_sensitive(true); - sourceabscie->set_sensitive(true); - adapjzcie->set_sensitive(true); - blackEvjz->set_sensitive(true); - whiteEvjz->set_sensitive(true); - jz100->set_sensitive(true); - } - - if (mode == Simple || mode == Normal) { // Keep widget hidden in Normal and Simple mode - modecie->set_active (0); - sensicie->show(); - reparcie->show(); - } - if (modecie->get_active_row_number() > 0) { - exprecovcie->hide(); - expmaskcie->hide(); - } } @@ -9746,9 +11234,28 @@ void Locallabcie::convertParamToSimple() // Disable all listeners disableListener(); sigmoidblcie->setValue(defSpot.sigmoidblcie); + normcie->set_active(defSpot.normcie); + logcieq->set_active(defSpot.logcieq); + logcie->set_active(defSpot.logcie); + blackEvjz->setValue(defSpot.blackEvjz); + whiteEvjz->setValue(defSpot.whiteEvjz); + whitescie->setValue(defSpot.whitescie); + blackscie->setValue(defSpot.blackscie); + + sigq->set_active(defSpot.sigq); + //sigq->set_active(defSpot.sigq); + pqremapcam16->setValue(defSpot.pqremapcam16); showmaskcieMethod->set_active(0); enacieMask->set_active(defSpot.enacieMask); + enacieMaskall->set_active(defSpot.enacieMaskall); + strgradcie->setValue(defSpot.strgradcie); + anggradcie->setValue(defSpot.anggradcie); + refi->setValue(defSpot.refi); modecie->set_active(0); + primMethod->set_active(0);//Prophoto + illMethod->set_active(1);//D50 + catMethod->set_active(0); + // Enable all listeners enableListener(); } @@ -9760,11 +11267,17 @@ void Locallabcie::convertParamToNormal() // Disable all listeners disableListener(); contqcie->setValue(defSpot.contqcie); + sigmoidblcie->setValue(defSpot.sigmoidblcie); + normcie->set_active(defSpot.normcie); + logcieq->set_active(defSpot.logcieq); + logcie->set_active(defSpot.logcie); + + //contsigqcie->setValue(defSpot.contsigqcie); colorflcie->setValue(defSpot.colorflcie); lightqcie->setValue(defSpot.lightqcie); chromlcie->setValue(defSpot.chromlcie); huecie->setValue(defSpot.huecie); - detailcie->setValue(defSpot.detailcie); + // detailcie->setValue(defSpot.detailcie); jabcie->set_active(defSpot.jabcie); LHshapejz->setCurve(defSpot.LHcurvejz); CHshapejz->setCurve(defSpot.CHcurvejz); @@ -9776,6 +11289,7 @@ void Locallabcie::convertParamToNormal() shapecie2->setCurve(defSpot.ciecurve2); lightjzcie->setValue(defSpot.lightjzcie); contjzcie->setValue(defSpot.contjzcie); + detailciejz->setValue(defSpot.detailciejz); sigmoidldajzcie->setValue(defSpot.sigmoidldajzcie); hljzcie->setValue(defSpot.hljzcie); shjzcie->setValue(defSpot.shjzcie); @@ -9786,15 +11300,41 @@ void Locallabcie::convertParamToNormal() strsoftjzcie->setValue(defSpot.strsoftjzcie); thrhjzcie->setValue(defSpot.thrhjzcie); modecie->set_active(0); + //primMethod->set_active(0); + catMethod->set_active(0); + primMethod->set_active(0);//Prophoto + illMethod->set_active(1);//D50 + refi->setValue(defSpot.refi); + + pqremapcam16->setValue(defSpot.pqremapcam16); + logcieChanged(); + satcieChanged(); + logcieqChanged(); + if (modecam->get_active_row_number() == 1) { showmaskcieMethod->set_active(0); enacieMask->set_active(defSpot.enacieMask); logjz->set_active(defSpot.logjz); sigjz->set_active(defSpot.sigjz); + lapmaskcie->setValue(defSpot.lapmaskcie); + enacieMaskallChanged2(); + } + lapmaskcie->setValue(defSpot.lapmaskcie); gammaskcie->setValue(defSpot.gammaskcie); slomaskcie->setValue(defSpot.slomaskcie); + highmaskcie->setValue(defSpot.highmaskcie); + shadmaskcie->setValue(defSpot.shadmaskcie); + HHhmaskcieshape->setCurve(defSpot.HHhmaskciecurve); + strumaskcie->setValue(defSpot.strumaskcie); + toolcie->set_active(defSpot.toolcie); + fftcieMask->set_active(defSpot.fftcieMask); + contcie->setValue(defSpot.contcie); + blurcie->setValue(defSpot.blurcie); + sigmoidsenscie->setValue(defSpot.sigmoidsenscie); + LLmaskcieshapewav->setCurve(defSpot.LLmaskciecurvewav); + csThresholdcie->setValue(defSpot.csthresholdcie); // Enable all listeners enableListener(); @@ -9814,8 +11354,8 @@ void Locallabcie::setDefaults(const rtengine::procparams::ProcParams* defParams, sourceabscie->setDefault(defSpot.sourceabscie); saturlcie->setDefault(defSpot.saturlcie); rstprotectcie->setDefault(defSpot.rstprotectcie); - chromlcie->setDefault(defSpot.chromlcie); - huecie->setDefault(defSpot.huecie); + // chromlcie->setDefault(defSpot.chromlcie); + // huecie->setDefault(defSpot.huecie); chromjzcie->setDefault(defSpot.chromjzcie); saturjzcie->setDefault(defSpot.saturjzcie); huejzcie->setDefault(defSpot.huejzcie); @@ -9824,9 +11364,11 @@ void Locallabcie::setDefaults(const rtengine::procparams::ProcParams* defParams, thrhjzcie->setDefault(defSpot.thrhjzcie); lightlcie->setDefault(defSpot.lightlcie); lightjzcie->setDefault(defSpot.lightjzcie); - lightqcie->setDefault(defSpot.lightqcie); + //lightqcie->setDefault(defSpot.lightqcie); + lightsigqcie->setDefault(defSpot.lightsigqcie); contlcie->setDefault(defSpot.contlcie); contjzcie->setDefault(defSpot.contjzcie); + detailciejz->setDefault(defSpot.detailciejz); adapjzcie->setDefault(defSpot.adapjzcie); jz100->setDefault(defSpot.jz100); pqremap->setDefault(defSpot.pqremap); @@ -9847,53 +11389,94 @@ void Locallabcie::setDefaults(const rtengine::procparams::ProcParams* defParams, targetjz->setDefault(defSpot.targetjz); sigmoidldacie->setDefault(defSpot.sigmoidldacie); sigmoidthcie->setDefault(defSpot.sigmoidthcie); + sigmoidsenscie->setDefault(defSpot.sigmoidsenscie); sigmoidblcie->setDefault(defSpot.sigmoidblcie); + comprcie->setDefault(defSpot.comprcie); + strcielog->setDefault(defSpot.strcielog); + comprcieth->setDefault(defSpot.comprcieth); + gamjcie->setDefault(defSpot.gamjcie); + whitescie->setDefault(defSpot.whitescie); + blackscie->setDefault(defSpot.blackscie); + slopjcie->setDefault(defSpot.slopjcie); + slopesmo->setDefault(defSpot.slopesmo); + midtcie->setDefault(defSpot.midtcie); sigmoidldajzcie->setDefault(defSpot.sigmoidldajzcie); sigmoidthjzcie->setDefault(defSpot.sigmoidthjzcie); sigmoidbljzcie->setDefault(defSpot.sigmoidbljzcie); - contqcie->setDefault(defSpot.contqcie); + // contqcie->setDefault(defSpot.contqcie); + contsigqcie->setDefault(defSpot.contsigqcie); colorflcie->setDefault(defSpot.colorflcie); targabscie->setDefault(defSpot.targabscie); targetGraycie->setDefault(defSpot.targetGraycie); catadcie->setDefault(defSpot.catadcie); - detailcie->setDefault(defSpot.detailcie); + // detailcie->setDefault(defSpot.detailcie); + strgradcie->setDefault((double)defSpot.strgradcie); + anggradcie->setDefault((double)defSpot.anggradcie); blendmaskcie->setDefault((double)defSpot.blendmaskcie); radmaskcie->setDefault(defSpot.radmaskcie); chromaskcie->setDefault(defSpot.chromaskcie); lapmaskcie->setDefault(defSpot.lapmaskcie); gammaskcie->setDefault(defSpot.gammaskcie); slomaskcie->setDefault(defSpot.slomaskcie); + highmaskcie->setDefault(defSpot.highmaskcie); + shadmaskcie->setDefault(defSpot.shadmaskcie); recothrescie->setDefault((double)defSpot.recothrescie); lowthrescie->setDefault((double)defSpot.lowthrescie); higthrescie->setDefault((double)defSpot.higthrescie); decaycie->setDefault((double)defSpot.decaycie); + strumaskcie->setDefault(defSpot.strumaskcie); + contcie->setDefault(defSpot.contcie); + blurcie->setDefault(defSpot.blurcie); + csThresholdcie->setDefault(defSpot.csthresholdcie); + redxl->setDefault(defSpot.redxl); + redyl->setDefault(defSpot.redyl); + grexl->setDefault(defSpot.grexl); + greyl->setDefault(defSpot.greyl); + bluxl->setDefault(defSpot.bluxl); + bluyl->setDefault(defSpot.bluyl); + shiftxl->setDefault(defSpot.shiftxl); + shiftyl->setDefault(defSpot.shiftyl); + refi->setDefault(defSpot.refi); + labgridcie->setDefault(defSpot.labgridcieALow, + defSpot.labgridcieBLow, + defSpot.labgridcieAHigh, + defSpot.labgridcieBHigh, + defSpot.labgridcieGx, + defSpot.labgridcieGy, + defSpot.labgridcieWx, + defSpot.labgridcieWy, + defSpot.labgridcieMx, + defSpot.labgridcieMy); } } + + void Locallabcie::curveChanged(CurveEditor* ce) { if (isLocActivated && exp->getEnabled()) { - const auto spName = M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(getSpotName()) + ")"; - if (ce == shapejz) { + const auto spName = M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(getSpotName()) + ")"; + + if (ce == shapejz) { if (listener) { listener->panelChanged(Evlocallabshapejz, spName); } } - if (ce == shapecz) { + if (ce == shapecz) { if (listener) { listener->panelChanged(Evlocallabshapecz, spName); } } - if (ce == shapeczjz) { + if (ce == shapeczjz) { if (listener) { listener->panelChanged(Evlocallabshapeczjz, spName); } } - if (ce == HHshapejz) { + if (ce == HHshapejz) { if (listener) { listener->panelChanged(EvlocallabHHshapejz, spName); } @@ -9944,6 +11527,13 @@ void Locallabcie::curveChanged(CurveEditor* ce) } } + if (ce == HHhmaskcieshape) { + if (listener) { + listener->panelChanged(EvlocallabHHhmaskcieshape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + if (ce == Lmaskcieshape) { if (listener) { listener->panelChanged(EvlocallabLmaskcieshape, @@ -9958,6 +11548,12 @@ void Locallabcie::curveChanged(CurveEditor* ce) } } + if (ce == LLmaskcieshapewav) { + if (listener) { + listener->panelChanged(EvlocallabLLmaskcieshapewav, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } } } @@ -9971,6 +11567,14 @@ void Locallabcie::adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int new csThresholdjz->getHistoryString() + " (" + escapeHtmlChars(getSpotName()) + ")"); } } + + if (isLocActivated && exp->getEnabled()) { + if (listener) { + listener->panelChanged(EvlocallabcsThresholdcie, + csThresholdcie->getHistoryString() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } @@ -9980,6 +11584,7 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) if (isLocActivated && exp->getEnabled()) { const auto spName = " (" + escapeHtmlChars(getSpotName()) + ")"; + if (a == reparcie) { if (listener) { listener->panelChanged(Evlocallabreparcie, @@ -10009,7 +11614,7 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) if (listener) { listener->panelChanged(Evlocallabsourceabscie, - sourceabscie->getTextValue() + spName ); + sourceabscie->getTextValue() + spName); } } @@ -10104,11 +11709,18 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == lightsigqcie) { + if (listener) { + listener->panelChanged(Evlocallablightsigqcie, + lightsigqcie->getTextValue() + spName); + } + } + if (a == contlcie) { if (listener) { listener->panelChanged(Evlocallabcontlcie, - contlcie->getTextValue()+ spName); + contlcie->getTextValue() + spName); } } @@ -10119,6 +11731,13 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == detailciejz) { + if (listener) { + listener->panelChanged(Evlocallabdetailciejz, + detailciejz->getTextValue() + spName); + } + } + if (a == adapjzcie) { if (listener) { listener->panelChanged(Evlocallabadapjzcie, @@ -10136,14 +11755,14 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) if (a == pqremap) { if (listener) { listener->panelChanged(Evlocallabpqremap, - pqremap->getTextValue()+ spName ); + pqremap->getTextValue() + spName); } } if (a == pqremapcam16) { if (listener) { listener->panelChanged(Evlocallabpqremapcam16, - pqremapcam16->getTextValue()+ spName ); + pqremapcam16->getTextValue() + spName); } } @@ -10164,7 +11783,7 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) if (a == shjzcie) { if (listener) { listener->panelChanged(Evlocallabshjzcie, - shjzcie->getTextValue()+ spName ); + shjzcie->getTextValue() + spName); } } @@ -10259,10 +11878,17 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == sigmoidsenscie) { + if (listener) { + listener->panelChanged(Evlocallabsigmoidsenscie, + sigmoidsenscie->getTextValue() + spName); + } + } + if (a == sigmoidthjzcie) { if (listener) { listener->panelChanged(Evlocallabsigmoidthjzcie, - sigmoidthjzcie->getTextValue()+ spName ); + sigmoidthjzcie->getTextValue() + spName); } } @@ -10273,6 +11899,135 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == comprcie) { + if (listener) { + listener->panelChanged(Evlocallabcomprcie, + comprcie->getTextValue() + spName); + } + } + + if (a == strcielog) { + if (listener) { + listener->panelChanged(Evlocallabstrcielog, + strcielog->getTextValue() + spName); + } + } + + if (a == comprcieth) { + nextcomprciecount = 0; + + if (listener) { + listener->panelChanged(Evlocallabcomprcieth, + comprcieth->getTextValue() + spName); + } + } + + if (a == gamjcie) { + if (listener) { + listener->panelChanged(Evlocallabgamjcie, + gamjcie->getTextValue() + spName); + } + } + + if (a == slopjcie) { + if (listener) { + listener->panelChanged(Evlocallabslopjcie, + slopjcie->getTextValue() + spName); + } + } + + if (a == slopesmo) { + if (listener) { + listener->panelChanged(Evlocallabslopesmo, + slopesmo->getTextValue() + spName); + } + } + + if (a == midtcie) { + if (listener) { + listener->panelChanged(Evlocallabmidtcie, + midtcie->getTextValue() + spName); + } + } + + if (a == redxl) { + if (listener) { + listener->panelChanged(Evlocallabredxl, + redxl->getTextValue() + spName); + } + } + + if (a == redyl) { + if (listener) { + listener->panelChanged(Evlocallabredyl, + redyl->getTextValue() + spName); + } + } + + + if (a == grexl) { + if (listener) { + listener->panelChanged(Evlocallabgrexl, + grexl->getTextValue() + spName); + } + } + + if (a == greyl) { + if (listener) { + listener->panelChanged(Evlocallabgreyl, + greyl->getTextValue() + spName); + } + } + + if (a == bluxl) { + if (listener) { + listener->panelChanged(Evlocallabbluxl, + bluxl->getTextValue() + spName); + } + } + + if (a == bluyl) { + if (listener) { + listener->panelChanged(Evlocallabbluyl, + bluyl->getTextValue() + spName); + } + } + + if (a == refi) { + if (listener) { + listener->panelChanged(Evlocallabrefi, + refi->getTextValue() + spName); + } + } + + if (a == shiftxl) { + if (listener) { + listener->panelChanged(Evlocallabshiftxl, + shiftxl->getTextValue() + spName); + } + } + + if (a == shiftyl) { + if (listener) { + listener->panelChanged(Evlocallabshiftyl, + shiftyl->getTextValue() + spName); + } + } + + if (a == whitescie) { + if (listener) { + listener->panelChanged(Evlocallabwhitescie, + whitescie->getTextValue() + spName); + } + } + + if (a == blackscie) { + if (listener) { + listener->panelChanged(Evlocallabblackscie, + blackscie->getTextValue() + spName); + } + } + if (a == sigmoidbljzcie) { if (listener) { listener->panelChanged(Evlocallabsigmoidbljzcie, @@ -10287,70 +12042,20 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == contsigqcie) { + if (listener) { + listener->panelChanged(Evlocallabcontsigqcie, + contsigqcie->getTextValue() + spName); + } + } + if (a == colorflcie) { if (listener) { listener->panelChanged(Evlocallabcolorflcie, - colorflcie->getTextValue()+ spName ); + colorflcie->getTextValue() + spName); } } -/* - if (a == lightlzcam) { - if (listener) { - listener->panelChanged(Evlocallablightlzcam, - lightlzcam->getTextValue()+ spName ); - } - } - - if (a == lightqzcam) { - if (listener) { - listener->panelChanged(Evlocallablightqzcam, - lightqzcam->getTextValue()+ spName ); - } - } - - if (a == contlzcam) { - if (listener) { - listener->panelChanged(Evlocallabcontlzcam, - contlzcam->getTextValue()+ spName ); - } - } - - if (a == contqzcam) { - if (listener) { - listener->panelChanged(Evlocallabcontqzcam, - contqzcam->getTextValue()+ spName ); - } - } - - if (a == contthreszcam) { - if (listener) { - listener->panelChanged(Evlocallabcontthreszcam, - contthreszcam->getTextValue()+ spName ); - } - } - - if (a == colorflzcam) { - if (listener) { - listener->panelChanged(Evlocallabcolorflzcam, - colorflzcam->getTextValue()+ spName ); - } - } - - if (a == saturzcam) { - if (listener) { - listener->panelChanged(Evlocallabsaturzcam, - saturzcam->getTextValue()+ spName ); - } - } - - if (a == chromzcam) { - if (listener) { - listener->panelChanged(Evlocallabchromzcam, - chromzcam->getTextValue()+ spName ); - } - } -*/ if (a == targabscie) { if (listener) { listener->panelChanged(Evlocallabtargabscie, @@ -10379,6 +12084,20 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == strgradcie) { + if (listener) { + listener->panelChanged(Evlocallabstrgradcie, + strgradcie->getTextValue() + spName); + } + } + + if (a == anggradcie) { + if (listener) { + listener->panelChanged(Evlocallabanggradcie, + anggradcie->getTextValue() + spName); + } + } + if (a == blendmaskcie) { if (listener) { listener->panelChanged(Evlocallabblendmaskcie, @@ -10421,6 +12140,20 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == highmaskcie) { + if (listener) { + listener->panelChanged(Evlocallabhighmaskcie, + highmaskcie->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + + if (a == shadmaskcie) { + if (listener) { + listener->panelChanged(Evlocallabshadmaskcie, + shadmaskcie->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + if (a == recothrescie) { if (listener) { @@ -10450,12 +12183,33 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == strumaskcie) { + if (listener) { + listener->panelChanged(Evlocallabstrumaskcie, + strumaskcie->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + + if (a == contcie) { + if (listener) { + listener->panelChanged(Evlocallabcontcie, + contcie->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + + if (a == blurcie) { + if (listener) { + listener->panelChanged(Evlocallabblurcie, + blurcie->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } } void Locallabcie::enabledChanged() { - if (isLocActivated) { + if (isLocActivated) { if (listener) { if (exp->getEnabled()) { listener->panelChanged(EvLocenacie, diff --git a/rtgui/options.cc b/rtgui/options.cc index c8750809b..8bf431bc5 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -633,6 +633,7 @@ void Options::setDefaults() rtSettings.previewselection = 5;//between 1 to 40 rtSettings.cbdlsensi = 1.0;//between 0.001 to 1 rtSettings.fftwsigma = true; //choice between sigma^2 or empirical formula + rtSettings.basecorlog = 0.12;//reduction max Q in Cam16 sigmoid Log encoding between 0.05 and 0.5 // end locallab rtSettings.itcwb_enable = true; rtSettings.itcwb_deltaspec = 0.075; @@ -1977,6 +1978,10 @@ void Options::readFromFile(Glib::ustring fname) rtSettings.cbdlsensi = keyFile.get_double("Color Management", "Cbdlsensi"); } + if (keyFile.has_key("Color Management", "Besecorlog")) {//sensi base log for Q + rtSettings.basecorlog = keyFile.get_double("Color Management", "Basecorlog"); + } + } @@ -2662,6 +2667,7 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_string("Color Management", "ClutsDirectory", clutsDir); keyFile.set_integer("Color Management", "Previewselection", rtSettings.previewselection); keyFile.set_double("Color Management", "Cbdlsensi", rtSettings.cbdlsensi); + keyFile.set_double("Color Management", "Basecorlog", rtSettings.basecorlog); keyFile.set_double("Wavelet", "Edghi", rtSettings.edghi); keyFile.set_double("Wavelet", "Edglo", rtSettings.edglo); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index ca705682b..02d405f76 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -459,14 +459,20 @@ void ParamsEdited::set(bool v) icm.outputBPC = v; icm.workingTRCGamma = v; icm.workingTRCSlope = v; + icm.wmidtcie = v; + icm.wsmoothcie = v; icm.redx = v; icm.redy = v; icm.grex = v; icm.grey = v; icm.blux = v; icm.bluy = v; + icm.refi = v; + icm.shiftx = v; + icm.shifty = v; icm.preser = v; icm.fbw = v; + icm.trcExp = v; icm.gamut = v; icm.labgridcieALow = v; icm.labgridcieBLow = v; @@ -476,10 +482,13 @@ void ParamsEdited::set(bool v) icm.labgridcieGy = v; icm.labgridcieWx = v; icm.labgridcieWy = v; + icm.labgridcieMx = v; + icm.labgridcieMy = v; icm.aRendIntent = v; icm.workingTRC = v; icm.will = v; icm.wprim = v; + icm.wcat = v; raw.bayersensor.method = v; raw.bayersensor.border = v; raw.bayersensor.imageNum = v; @@ -1278,7 +1287,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).complexshadhigh = locallab.spots.at(j).complexshadhigh && pSpot.complexshadhigh == otherSpot.complexshadhigh; locallab.spots.at(j).shMethod = locallab.spots.at(j).shMethod && pSpot.shMethod == otherSpot.shMethod; - for (int k = 0; k < 5; k++) { + for (int k = 0; k < 6; k++) { locallab.spots.at(j).multsh[k] = locallab.spots.at(j).multsh[k] && pSpot.multsh[k] == otherSpot.multsh[k]; } @@ -1653,10 +1662,15 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).Autogray = locallab.spots.at(j).Autogray && pSpot.Autogray == otherSpot.Autogray; locallab.spots.at(j).fullimage = locallab.spots.at(j).fullimage && pSpot.fullimage == otherSpot.fullimage; locallab.spots.at(j).ciecam = locallab.spots.at(j).ciecam && pSpot.ciecam == otherSpot.ciecam; + locallab.spots.at(j).satlog = locallab.spots.at(j).satlog && pSpot.satlog == otherSpot.satlog; locallab.spots.at(j).enaLMask = locallab.spots.at(j).enaLMask && pSpot.enaLMask == otherSpot.enaLMask; locallab.spots.at(j).repar = locallab.spots.at(j).repar && pSpot.repar == otherSpot.repar; locallab.spots.at(j).blackEv = locallab.spots.at(j).blackEv && pSpot.blackEv == otherSpot.blackEv; locallab.spots.at(j).whiteEv = locallab.spots.at(j).whiteEv && pSpot.whiteEv == otherSpot.whiteEv; + locallab.spots.at(j).whiteslog = locallab.spots.at(j).whiteslog && pSpot.whiteslog == otherSpot.whiteslog; + locallab.spots.at(j).blackslog = locallab.spots.at(j).blackslog && pSpot.blackslog == otherSpot.blackslog; + locallab.spots.at(j).comprlog = locallab.spots.at(j).comprlog && pSpot.comprlog == otherSpot.comprlog; + locallab.spots.at(j).strelog = locallab.spots.at(j).strelog && pSpot.strelog == otherSpot.strelog; locallab.spots.at(j).detail = locallab.spots.at(j).detail && pSpot.detail == otherSpot.detail; locallab.spots.at(j).sursour = locallab.spots.at(j).sursour && pSpot.sursour == otherSpot.sursour; locallab.spots.at(j).surround = locallab.spots.at(j).surround && pSpot.surround == otherSpot.surround; @@ -1710,6 +1724,7 @@ void ParamsEdited::initFrom(const std::vector& //ciecam locallab.spots.at(j).visicie = locallab.spots.at(j).visicie && pSpot.visicie == otherSpot.visicie; locallab.spots.at(j).expcie = locallab.spots.at(j).expcie && pSpot.expcie == otherSpot.expcie; + locallab.spots.at(j).expprecam = locallab.spots.at(j).expprecam && pSpot.expprecam == otherSpot.expprecam; locallab.spots.at(j).complexcie = locallab.spots.at(j).complexcie && pSpot.complexcie == otherSpot.complexcie; locallab.spots.at(j).reparcie = locallab.spots.at(j).reparcie && pSpot.reparcie == otherSpot.reparcie; locallab.spots.at(j).sensicie = locallab.spots.at(j).sensicie && pSpot.sensicie == otherSpot.sensicie; @@ -1718,8 +1733,14 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).forcebw = locallab.spots.at(j).forcebw && pSpot.forcebw == otherSpot.forcebw; locallab.spots.at(j).qtoj = locallab.spots.at(j).qtoj && pSpot.qtoj == otherSpot.qtoj; locallab.spots.at(j).jabcie = locallab.spots.at(j).jabcie && pSpot.jabcie == otherSpot.jabcie; - locallab.spots.at(j).sigmoidqjcie = locallab.spots.at(j).sigmoidqjcie && pSpot.sigmoidqjcie == otherSpot.sigmoidqjcie; + locallab.spots.at(j).comprcieauto = locallab.spots.at(j).comprcieauto && pSpot.comprcieauto == otherSpot.comprcieauto; + locallab.spots.at(j).normcie = locallab.spots.at(j).normcie && pSpot.normcie == otherSpot.normcie; + locallab.spots.at(j).gamutcie = locallab.spots.at(j).gamutcie && pSpot.gamutcie == otherSpot.gamutcie; + locallab.spots.at(j).sigcie = locallab.spots.at(j).sigcie && pSpot.sigcie == otherSpot.sigcie; locallab.spots.at(j).logcie = locallab.spots.at(j).logcie && pSpot.logcie == otherSpot.logcie; + locallab.spots.at(j).satcie = locallab.spots.at(j).satcie && pSpot.satcie == otherSpot.satcie; + locallab.spots.at(j).logcieq = locallab.spots.at(j).logcieq && pSpot.logcieq == otherSpot.logcieq; + locallab.spots.at(j).smoothcie = locallab.spots.at(j).smoothcie && pSpot.smoothcie == otherSpot.smoothcie; locallab.spots.at(j).logjz = locallab.spots.at(j).logjz && pSpot.logjz == otherSpot.logjz; locallab.spots.at(j).sigjz = locallab.spots.at(j).sigjz && pSpot.sigjz == otherSpot.sigjz; locallab.spots.at(j).sigq = locallab.spots.at(j).sigq && pSpot.sigq == otherSpot.sigq; @@ -1728,6 +1749,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).sourceabscie = locallab.spots.at(j).sourceabscie && pSpot.sourceabscie == otherSpot.sourceabscie; locallab.spots.at(j).sursourcie = locallab.spots.at(j).sursourcie && pSpot.sursourcie == otherSpot.sursourcie; locallab.spots.at(j).modecam = locallab.spots.at(j).modecam && pSpot.modecam == otherSpot.modecam; + locallab.spots.at(j).bwevMethod = locallab.spots.at(j).bwevMethod && pSpot.bwevMethod == otherSpot.bwevMethod; locallab.spots.at(j).modecie = locallab.spots.at(j).modecie && pSpot.modecie == otherSpot.modecie; locallab.spots.at(j).saturlcie = locallab.spots.at(j).saturlcie && pSpot.saturlcie == otherSpot.saturlcie; locallab.spots.at(j).rstprotectcie = locallab.spots.at(j).rstprotectcie && pSpot.rstprotectcie == otherSpot.rstprotectcie; @@ -1752,8 +1774,10 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).lightlcie = locallab.spots.at(j).lightlcie && pSpot.lightlcie == otherSpot.lightlcie; locallab.spots.at(j).lightjzcie = locallab.spots.at(j).lightjzcie && pSpot.lightjzcie == otherSpot.lightjzcie; locallab.spots.at(j).lightqcie = locallab.spots.at(j).lightqcie && pSpot.lightqcie == otherSpot.lightqcie; + locallab.spots.at(j).lightsigqcie = locallab.spots.at(j).lightsigqcie && pSpot.lightsigqcie == otherSpot.lightsigqcie; locallab.spots.at(j).contlcie = locallab.spots.at(j).contlcie && pSpot.contlcie == otherSpot.contlcie; locallab.spots.at(j).contjzcie = locallab.spots.at(j).contjzcie && pSpot.contjzcie == otherSpot.contjzcie; + locallab.spots.at(j).detailciejz = locallab.spots.at(j).detailciejz && pSpot.detailciejz == otherSpot.detailciejz; locallab.spots.at(j).adapjzcie = locallab.spots.at(j).adapjzcie && pSpot.adapjzcie == otherSpot.adapjzcie; locallab.spots.at(j).jz100 = locallab.spots.at(j).jz100 && pSpot.jz100 == otherSpot.jz100; locallab.spots.at(j).pqremap = locallab.spots.at(j).pqremap && pSpot.pqremap == otherSpot.pqremap; @@ -1769,31 +1793,62 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).targetjz = locallab.spots.at(j).targetjz && pSpot.targetjz == otherSpot.targetjz; locallab.spots.at(j).sigmoidldacie = locallab.spots.at(j).sigmoidldacie && pSpot.sigmoidldacie == otherSpot.sigmoidldacie; locallab.spots.at(j).sigmoidthcie = locallab.spots.at(j).sigmoidthcie && pSpot.sigmoidthcie == otherSpot.sigmoidthcie; + locallab.spots.at(j).sigmoidsenscie = locallab.spots.at(j).sigmoidsenscie && pSpot.sigmoidsenscie == otherSpot.sigmoidsenscie; locallab.spots.at(j).sigmoidblcie = locallab.spots.at(j).sigmoidblcie && pSpot.sigmoidblcie == otherSpot.sigmoidblcie; + locallab.spots.at(j).comprcie = locallab.spots.at(j).comprcie && pSpot.comprcie == otherSpot.comprcie; + locallab.spots.at(j).strcielog = locallab.spots.at(j).strcielog && pSpot.strcielog == otherSpot.strcielog; + locallab.spots.at(j).comprcieth = locallab.spots.at(j).comprcieth && pSpot.comprcieth == otherSpot.comprcieth; + locallab.spots.at(j).gamjcie = locallab.spots.at(j).gamjcie && pSpot.gamjcie == otherSpot.gamjcie; + locallab.spots.at(j).slopjcie = locallab.spots.at(j).slopjcie && pSpot.slopjcie == otherSpot.slopjcie; + locallab.spots.at(j).slopesmo = locallab.spots.at(j).slopesmo && pSpot.slopesmo == otherSpot.slopesmo; + locallab.spots.at(j).midtcie = locallab.spots.at(j).midtcie && pSpot.midtcie == otherSpot.midtcie; + locallab.spots.at(j).grexl = locallab.spots.at(j).grexl && pSpot.grexl == otherSpot.grexl; + locallab.spots.at(j).greyl = locallab.spots.at(j).greyl && pSpot.greyl == otherSpot.greyl; + locallab.spots.at(j).redxl = locallab.spots.at(j).redxl && pSpot.redxl == otherSpot.redxl; + locallab.spots.at(j).redyl = locallab.spots.at(j).redyl && pSpot.redyl == otherSpot.redyl; + locallab.spots.at(j).bluxl = locallab.spots.at(j).bluxl && pSpot.bluxl == otherSpot.bluxl; + locallab.spots.at(j).bluyl = locallab.spots.at(j).bluyl && pSpot.bluyl == otherSpot.bluyl; + locallab.spots.at(j).refi = locallab.spots.at(j).refi && pSpot.refi == otherSpot.refi; + locallab.spots.at(j).shiftxl = locallab.spots.at(j).shiftxl && pSpot.shiftxl == otherSpot.shiftxl; + locallab.spots.at(j).shiftyl = locallab.spots.at(j).shiftyl && pSpot.shiftyl == otherSpot.shiftyl; + locallab.spots.at(j).labgridcieALow = locallab.spots.at(j).labgridcieALow && pSpot.labgridcieALow == otherSpot.labgridcieALow; + locallab.spots.at(j).labgridcieBLow = locallab.spots.at(j).labgridcieBLow && pSpot.labgridcieBLow == otherSpot.labgridcieBLow; + locallab.spots.at(j).labgridcieAHigh = locallab.spots.at(j).labgridcieAHigh && pSpot.labgridcieAHigh == otherSpot.labgridcieAHigh; + locallab.spots.at(j).labgridcieBHigh = locallab.spots.at(j).labgridcieBHigh && pSpot.labgridcieBHigh == otherSpot.labgridcieBHigh; + locallab.spots.at(j).labgridcieGx = locallab.spots.at(j).labgridcieGx && pSpot.labgridcieGx == otherSpot.labgridcieGx; + locallab.spots.at(j).labgridcieGy = locallab.spots.at(j).labgridcieGy && pSpot.labgridcieGy == otherSpot.labgridcieGy; + locallab.spots.at(j).labgridcieWx = locallab.spots.at(j).labgridcieWx && pSpot.labgridcieWx == otherSpot.labgridcieWx; + locallab.spots.at(j).labgridcieWy = locallab.spots.at(j).labgridcieWy && pSpot.labgridcieWy == otherSpot.labgridcieWy; + locallab.spots.at(j).labgridcieMx = locallab.spots.at(j).labgridcieMx && pSpot.labgridcieMx == otherSpot.labgridcieMx; + locallab.spots.at(j).labgridcieMy = locallab.spots.at(j).labgridcieMy && pSpot.labgridcieMy == otherSpot.labgridcieMy; + + locallab.spots.at(j).whitescie = locallab.spots.at(j).whitescie && pSpot.whitescie == otherSpot.whitescie; + locallab.spots.at(j).blackscie = locallab.spots.at(j).blackscie && pSpot.blackscie == otherSpot.blackscie; + locallab.spots.at(j).illMethod = locallab.spots.at(j).illMethod && pSpot.illMethod == otherSpot.illMethod; + locallab.spots.at(j).smoothciemet = locallab.spots.at(j).smoothciemet && pSpot.smoothciemet == otherSpot.smoothciemet; + locallab.spots.at(j).primMethod = locallab.spots.at(j).primMethod && pSpot.primMethod == otherSpot.primMethod; + locallab.spots.at(j).catMethod = locallab.spots.at(j).catMethod && pSpot.catMethod == otherSpot.catMethod; locallab.spots.at(j).sigmoidldajzcie = locallab.spots.at(j).sigmoidldajzcie && pSpot.sigmoidldajzcie == otherSpot.sigmoidldajzcie; locallab.spots.at(j).sigmoidthjzcie = locallab.spots.at(j).sigmoidthjzcie && pSpot.sigmoidthjzcie == otherSpot.sigmoidthjzcie; locallab.spots.at(j).sigmoidbljzcie = locallab.spots.at(j).sigmoidbljzcie && pSpot.sigmoidbljzcie == otherSpot.sigmoidbljzcie; locallab.spots.at(j).contqcie = locallab.spots.at(j).contqcie && pSpot.contqcie == otherSpot.contqcie; + locallab.spots.at(j).contsigqcie = locallab.spots.at(j).contsigqcie && pSpot.contsigqcie == otherSpot.contsigqcie; locallab.spots.at(j).colorflcie = locallab.spots.at(j).colorflcie && pSpot.colorflcie == otherSpot.colorflcie; locallab.spots.at(j).targabscie = locallab.spots.at(j).targabscie && pSpot.targabscie == otherSpot.targabscie; locallab.spots.at(j).targetGraycie = locallab.spots.at(j).targetGraycie && pSpot.targetGraycie == otherSpot.targetGraycie; locallab.spots.at(j).catadcie = locallab.spots.at(j).catadcie && pSpot.catadcie == otherSpot.catadcie; locallab.spots.at(j).detailcie = locallab.spots.at(j).detailcie && pSpot.detailcie == otherSpot.detailcie; locallab.spots.at(j).surroundcie = locallab.spots.at(j).surroundcie && pSpot.surroundcie == otherSpot.surroundcie; -/* - locallab.spots.at(j).lightlzcam = locallab.spots.at(j).lightlzcam && pSpot.lightlzcam == otherSpot.lightlzcam; - locallab.spots.at(j).lightqzcam = locallab.spots.at(j).lightqzcam && pSpot.lightqzcam == otherSpot.lightqzcam; - locallab.spots.at(j).contlzcam = locallab.spots.at(j).contlzcam && pSpot.contlzcam == otherSpot.contlzcam; - locallab.spots.at(j).contqzcam = locallab.spots.at(j).contqzcam && pSpot.contqzcam == otherSpot.contqzcam; - locallab.spots.at(j).contthreszcam = locallab.spots.at(j).contthreszcam && pSpot.contthreszcam == otherSpot.contthreszcam; - locallab.spots.at(j).colorflzcam = locallab.spots.at(j).colorflzcam && pSpot.colorflzcam == otherSpot.colorflzcam; - locallab.spots.at(j).saturzcam = locallab.spots.at(j).saturzcam && pSpot.saturzcam == otherSpot.saturzcam; - locallab.spots.at(j).chromzcam = locallab.spots.at(j).chromzcam && pSpot.chromzcam == otherSpot.chromzcam; -*/ - locallab.spots.at(j).enacieMask = locallab.spots.at(j).enaSHMask && pSpot.enaSHMask == otherSpot.enaSHMask; + + locallab.spots.at(j).strgradcie = locallab.spots.at(j).strgradcie && pSpot.strgradcie == otherSpot.strgradcie; + locallab.spots.at(j).anggradcie = locallab.spots.at(j).anggradcie && pSpot.anggradcie == otherSpot.anggradcie; + + locallab.spots.at(j).enacieMask = locallab.spots.at(j).enacieMask && pSpot.enacieMask == otherSpot.enacieMask; + locallab.spots.at(j).enacieMaskall = locallab.spots.at(j).enacieMaskall && pSpot.enacieMaskall == otherSpot.enacieMaskall; locallab.spots.at(j).CCmaskciecurve = locallab.spots.at(j).CCmaskciecurve && pSpot.CCmaskciecurve == otherSpot.CCmaskciecurve; locallab.spots.at(j).LLmaskciecurve = locallab.spots.at(j).LLmaskciecurve && pSpot.LLmaskciecurve == otherSpot.LLmaskciecurve; locallab.spots.at(j).HHmaskciecurve = locallab.spots.at(j).HHmaskciecurve && pSpot.HHmaskciecurve == otherSpot.HHmaskciecurve; + locallab.spots.at(j).HHhmaskciecurve = locallab.spots.at(j).HHhmaskciecurve && pSpot.HHhmaskciecurve == otherSpot.HHhmaskciecurve; locallab.spots.at(j).blendmaskcie = locallab.spots.at(j).blendmaskcie && pSpot.blendmaskcie == otherSpot.blendmaskcie; locallab.spots.at(j).radmaskcie = locallab.spots.at(j).radmaskcie && pSpot.radmaskcie == otherSpot.radmaskcie; locallab.spots.at(j).chromaskcie = locallab.spots.at(j).chromaskcie && pSpot.chromaskcie == otherSpot.chromaskcie; @@ -1811,6 +1866,15 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).clarilresjz = locallab.spots.at(j).clarilresjz && pSpot.clarilresjz == otherSpot.clarilresjz; locallab.spots.at(j).claricresjz = locallab.spots.at(j).claricresjz && pSpot.claricresjz == otherSpot.claricresjz; locallab.spots.at(j).clarisoftjz = locallab.spots.at(j).clarisoftjz && pSpot.clarisoftjz == otherSpot.clarisoftjz; + locallab.spots.at(j).strumaskcie = locallab.spots.at(j).strumaskcie && pSpot.strumaskcie == otherSpot.strumaskcie; + locallab.spots.at(j).toolcie = locallab.spots.at(j).toolcie && pSpot.toolcie == otherSpot.toolcie; + locallab.spots.at(j).fftcieMask = locallab.spots.at(j).fftcieMask && pSpot.fftcieMask == otherSpot.fftcieMask; + locallab.spots.at(j).blurcie = locallab.spots.at(j).blurcie && pSpot.blurcie == otherSpot.blurcie; + locallab.spots.at(j).contcie = locallab.spots.at(j).contcie && pSpot.contcie == otherSpot.contcie; + locallab.spots.at(j).highmaskcie = locallab.spots.at(j).highmaskcie && pSpot.highmaskcie == otherSpot.highmaskcie; + locallab.spots.at(j).shadmaskcie = locallab.spots.at(j).shadmaskcie && pSpot.shadmaskcie == otherSpot.shadmaskcie; + locallab.spots.at(j).LLmaskciecurvewav = locallab.spots.at(j).LLmaskciecurvewav && pSpot.LLmaskciecurvewav == otherSpot.LLmaskciecurvewav; + locallab.spots.at(j).csthresholdcie = locallab.spots.at(j).csthresholdcie && pSpot.csthresholdcie == otherSpot.csthresholdcie; } @@ -1890,12 +1954,17 @@ void ParamsEdited::initFrom(const std::vector& icm.outputBPC = icm.outputBPC && p.icm.outputBPC == other.icm.outputBPC ; icm.workingTRCGamma = icm.workingTRCGamma && p.icm.workingTRCGamma == other.icm.workingTRCGamma; icm.workingTRCSlope = icm.workingTRCSlope && p.icm.workingTRCSlope == other.icm.workingTRCSlope; + icm.wmidtcie = icm.wmidtcie && p.icm.wmidtcie == other.icm.wmidtcie; + icm.wsmoothcie = icm.wsmoothcie && p.icm.wsmoothcie == other.icm.wsmoothcie; icm.redx = icm.redx && p.icm.redx == other.icm.redx; icm.redy = icm.redy && p.icm.redy == other.icm.redy; icm.grex = icm.grex && p.icm.grex == other.icm.grex; icm.grey = icm.grey && p.icm.grey == other.icm.grey; icm.blux = icm.blux && p.icm.blux == other.icm.blux; icm.bluy = icm.bluy && p.icm.bluy == other.icm.bluy; + icm.refi = icm.refi && p.icm.refi == other.icm.refi; + icm.shiftx = icm.shiftx && p.icm.shiftx == other.icm.shiftx; + icm.shifty = icm.shifty && p.icm.shifty == other.icm.shifty; icm.labgridcieALow = icm.labgridcieALow && p.icm.labgridcieALow == other.icm.labgridcieALow; icm.labgridcieBLow = icm.labgridcieBLow && p.icm.labgridcieBLow == other.icm.labgridcieBLow; icm.labgridcieAHigh = icm.labgridcieAHigh && p.icm.labgridcieAHigh == other.icm.labgridcieAHigh; @@ -1904,13 +1973,17 @@ void ParamsEdited::initFrom(const std::vector& icm.labgridcieGy = icm.labgridcieGy && p.icm.labgridcieGy == other.icm.labgridcieGy; icm.labgridcieWx = icm.labgridcieWx && p.icm.labgridcieWx == other.icm.labgridcieWx; icm.labgridcieWy = icm.labgridcieWy && p.icm.labgridcieWy == other.icm.labgridcieWy; + icm.labgridcieMx = icm.labgridcieMx && p.icm.labgridcieMx == other.icm.labgridcieMx; + icm.labgridcieMy = icm.labgridcieMy && p.icm.labgridcieMy == other.icm.labgridcieMy; icm.preser = icm.preser && p.icm.preser == other.icm.preser; icm.fbw = icm.fbw && p.icm.fbw == other.icm.fbw; + icm.trcExp = icm.trcExp && p.icm.trcExp == other.icm.trcExp; icm.gamut = icm.gamut && p.icm.gamut == other.icm.gamut; icm.aRendIntent = icm.aRendIntent && p.icm.aRendIntent == other.icm.aRendIntent; icm.workingTRC = icm.workingTRC && p.icm.workingTRC == other.icm.workingTRC; icm.will = icm.will && p.icm.will == other.icm.will; icm.wprim = icm.wprim && p.icm.wprim == other.icm.wprim; + icm.wcat = icm.wcat && p.icm.wcat == other.icm.wcat; raw.bayersensor.method = raw.bayersensor.method && p.raw.bayersensor.method == other.raw.bayersensor.method; raw.bayersensor.border = raw.bayersensor.border && p.raw.bayersensor.border == other.raw.bayersensor.border; raw.bayersensor.imageNum = raw.bayersensor.imageNum && p.raw.bayersensor.imageNum == other.raw.bayersensor.imageNum; @@ -4155,7 +4228,7 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).shMethod = mods.locallab.spots.at(i).shMethod; } - for (int j = 0; j < 5; j++) { + for (int j = 0; j < 6; j++) { if (locallab.spots.at(i).multsh[j]) { toEdit.locallab.spots.at(i).multsh[j] = mods.locallab.spots.at(i).multsh[j]; } @@ -5606,6 +5679,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).ciecam = mods.locallab.spots.at(i).ciecam; } + if (locallab.spots.at(i).satlog) { + toEdit.locallab.spots.at(i).satlog = mods.locallab.spots.at(i).satlog; + } + if (locallab.spots.at(i).enaLMask) { toEdit.locallab.spots.at(i).enaLMask = mods.locallab.spots.at(i).enaLMask; } @@ -5622,6 +5699,22 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).whiteEv = mods.locallab.spots.at(i).whiteEv; } + if (locallab.spots.at(i).whiteslog) { + toEdit.locallab.spots.at(i).whiteslog = mods.locallab.spots.at(i).whiteslog; + } + + if (locallab.spots.at(i).blackslog) { + toEdit.locallab.spots.at(i).blackslog = mods.locallab.spots.at(i).blackslog; + } + + if (locallab.spots.at(i).comprlog) { + toEdit.locallab.spots.at(i).comprlog = mods.locallab.spots.at(i).comprlog; + } + + if (locallab.spots.at(i).strelog) { + toEdit.locallab.spots.at(i).strelog = mods.locallab.spots.at(i).strelog; + } + if (locallab.spots.at(i).detail) { toEdit.locallab.spots.at(i).detail = mods.locallab.spots.at(i).detail; } @@ -5816,6 +5909,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).expcie = mods.locallab.spots.at(i).expcie; } + if (locallab.spots.at(i).expprecam) { + toEdit.locallab.spots.at(i).expprecam = mods.locallab.spots.at(i).expprecam; + } + if (locallab.spots.at(i).complexcie) { toEdit.locallab.spots.at(i).complexcie = mods.locallab.spots.at(i).complexcie; } @@ -5848,14 +5945,39 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).jabcie = mods.locallab.spots.at(i).jabcie; } - if (locallab.spots.at(i).sigmoidqjcie) { - toEdit.locallab.spots.at(i).sigmoidqjcie = mods.locallab.spots.at(i).sigmoidqjcie; + if (locallab.spots.at(i).comprcieauto) { + toEdit.locallab.spots.at(i).comprcieauto = mods.locallab.spots.at(i).comprcieauto; + } + + if (locallab.spots.at(i).normcie) { + toEdit.locallab.spots.at(i).normcie = mods.locallab.spots.at(i).normcie; + } + + + if (locallab.spots.at(i).gamutcie) { + toEdit.locallab.spots.at(i).gamutcie = mods.locallab.spots.at(i).gamutcie; + } + + if (locallab.spots.at(i).sigcie) { + toEdit.locallab.spots.at(i).sigcie = mods.locallab.spots.at(i).sigcie; } if (locallab.spots.at(i).logcie) { toEdit.locallab.spots.at(i).logcie = mods.locallab.spots.at(i).logcie; } + if (locallab.spots.at(i).satcie) { + toEdit.locallab.spots.at(i).satcie = mods.locallab.spots.at(i).satcie; + } + + if (locallab.spots.at(i).logcieq) { + toEdit.locallab.spots.at(i).logcieq = mods.locallab.spots.at(i).logcieq; + } + + if (locallab.spots.at(i).smoothcie) { + toEdit.locallab.spots.at(i).smoothcie = mods.locallab.spots.at(i).smoothcie; + } + if (locallab.spots.at(i).logjz) { toEdit.locallab.spots.at(i).logjz = mods.locallab.spots.at(i).logjz; } @@ -5888,6 +6010,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).modecam = mods.locallab.spots.at(i).modecam; } + if (locallab.spots.at(i).bwevMethod) { + toEdit.locallab.spots.at(i).bwevMethod = mods.locallab.spots.at(i).bwevMethod; + } + if (locallab.spots.at(i).modecie) { toEdit.locallab.spots.at(i).modecie = mods.locallab.spots.at(i).modecie; } @@ -5980,6 +6106,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).lightqcie = mods.locallab.spots.at(i).lightqcie; } + if (locallab.spots.at(i).lightsigqcie) { + toEdit.locallab.spots.at(i).lightsigqcie = mods.locallab.spots.at(i).lightsigqcie; + } + if (locallab.spots.at(i).contlcie) { toEdit.locallab.spots.at(i).contlcie = mods.locallab.spots.at(i).contlcie; } @@ -5988,6 +6118,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).contjzcie = mods.locallab.spots.at(i).contjzcie; } + if (locallab.spots.at(i).detailciejz) { + toEdit.locallab.spots.at(i).detailciejz = mods.locallab.spots.at(i).detailciejz; + } + if (locallab.spots.at(i).adapjzcie) { toEdit.locallab.spots.at(i).adapjzcie = mods.locallab.spots.at(i).adapjzcie; } @@ -6048,10 +6182,142 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).sigmoidthcie = mods.locallab.spots.at(i).sigmoidthcie; } + if (locallab.spots.at(i).sigmoidsenscie) { + toEdit.locallab.spots.at(i).sigmoidsenscie = mods.locallab.spots.at(i).sigmoidsenscie; + } + if (locallab.spots.at(i).sigmoidblcie) { toEdit.locallab.spots.at(i).sigmoidblcie = mods.locallab.spots.at(i).sigmoidblcie; } + if (locallab.spots.at(i).comprcie) { + toEdit.locallab.spots.at(i).comprcie = mods.locallab.spots.at(i).comprcie; + } + + if (locallab.spots.at(i).strcielog) { + toEdit.locallab.spots.at(i).strcielog = mods.locallab.spots.at(i).strcielog; + } + + if (locallab.spots.at(i).comprcieth) { + toEdit.locallab.spots.at(i).comprcieth = mods.locallab.spots.at(i).comprcieth; + } + + if (locallab.spots.at(i).gamjcie) { + toEdit.locallab.spots.at(i).gamjcie = mods.locallab.spots.at(i).gamjcie; + } + + if (locallab.spots.at(i).slopjcie) { + toEdit.locallab.spots.at(i).slopjcie = mods.locallab.spots.at(i).slopjcie; + } + + if (locallab.spots.at(i).slopesmo) { + toEdit.locallab.spots.at(i).slopesmo = mods.locallab.spots.at(i).slopesmo; + } + + if (locallab.spots.at(i).midtcie) { + toEdit.locallab.spots.at(i).midtcie = mods.locallab.spots.at(i).midtcie; + } + + if (locallab.spots.at(i).grexl) { + toEdit.locallab.spots.at(i).grexl = mods.locallab.spots.at(i).grexl; + } + + if (locallab.spots.at(i).greyl) { + toEdit.locallab.spots.at(i).greyl = mods.locallab.spots.at(i).greyl; + } + + if (locallab.spots.at(i).redxl) { + toEdit.locallab.spots.at(i).redxl = mods.locallab.spots.at(i).redxl; + } + + if (locallab.spots.at(i).redyl) { + toEdit.locallab.spots.at(i).redyl = mods.locallab.spots.at(i).redyl; + } + + if (locallab.spots.at(i).bluxl) { + toEdit.locallab.spots.at(i).bluxl = mods.locallab.spots.at(i).bluxl; + } + + if (locallab.spots.at(i).bluyl) { + toEdit.locallab.spots.at(i).bluyl = mods.locallab.spots.at(i).bluyl; + } + + if (locallab.spots.at(i).refi) { + toEdit.locallab.spots.at(i).refi = mods.locallab.spots.at(i).refi; + } + + if (locallab.spots.at(i).shiftxl) { + toEdit.locallab.spots.at(i).shiftxl = mods.locallab.spots.at(i).shiftxl; + } + + if (locallab.spots.at(i).shiftyl) { + toEdit.locallab.spots.at(i).shiftyl = mods.locallab.spots.at(i).shiftyl; + } + + if (locallab.spots.at(i).labgridcieALow) { + toEdit.locallab.spots.at(i).labgridcieALow = mods.locallab.spots.at(i).labgridcieALow; + } + + if (locallab.spots.at(i).labgridcieBLow) { + toEdit.locallab.spots.at(i).labgridcieBLow = mods.locallab.spots.at(i).labgridcieBLow; + } + + if (locallab.spots.at(i).labgridcieAHigh) { + toEdit.locallab.spots.at(i).labgridcieAHigh = mods.locallab.spots.at(i).labgridcieAHigh; + } + + if (locallab.spots.at(i).labgridcieBHigh) { + toEdit.locallab.spots.at(i).labgridcieBHigh = mods.locallab.spots.at(i).labgridcieBHigh; + } + + if (locallab.spots.at(i).labgridcieGx) { + toEdit.locallab.spots.at(i).labgridcieGx = mods.locallab.spots.at(i).labgridcieGx; + } + + if (locallab.spots.at(i).labgridcieGy) { + toEdit.locallab.spots.at(i).labgridcieGy = mods.locallab.spots.at(i).labgridcieGy; + } + + if (locallab.spots.at(i).labgridcieWx) { + toEdit.locallab.spots.at(i).labgridcieWx = mods.locallab.spots.at(i).labgridcieWx; + } + + if (locallab.spots.at(i).labgridcieWy) { + toEdit.locallab.spots.at(i).labgridcieWy = mods.locallab.spots.at(i).labgridcieWy; + } + + if (locallab.spots.at(i).labgridcieMx) { + toEdit.locallab.spots.at(i).labgridcieMx = mods.locallab.spots.at(i).labgridcieMx; + } + + if (locallab.spots.at(i).labgridcieMy) { + toEdit.locallab.spots.at(i).labgridcieMy = mods.locallab.spots.at(i).labgridcieMy; + } + + if (locallab.spots.at(i).whitescie) { + toEdit.locallab.spots.at(i).whitescie = mods.locallab.spots.at(i).whitescie; + } + + if (locallab.spots.at(i).blackscie) { + toEdit.locallab.spots.at(i).blackscie = mods.locallab.spots.at(i).blackscie; + } + + if (locallab.spots.at(i).illMethod) { + toEdit.locallab.spots.at(i).illMethod = mods.locallab.spots.at(i).illMethod; + } + + if (locallab.spots.at(i).smoothciemet) { + toEdit.locallab.spots.at(i).smoothciemet = mods.locallab.spots.at(i).smoothciemet; + } + + if (locallab.spots.at(i).primMethod) { + toEdit.locallab.spots.at(i).primMethod = mods.locallab.spots.at(i).primMethod; + } + + if (locallab.spots.at(i).catMethod) { + toEdit.locallab.spots.at(i).catMethod = mods.locallab.spots.at(i).catMethod; + } + if (locallab.spots.at(i).sigmoidldajzcie) { toEdit.locallab.spots.at(i).sigmoidldajzcie = mods.locallab.spots.at(i).sigmoidldajzcie; } @@ -6069,42 +6335,13 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).contqcie = mods.locallab.spots.at(i).contqcie; } + if (locallab.spots.at(i).contsigqcie) { + toEdit.locallab.spots.at(i).contsigqcie = mods.locallab.spots.at(i).contsigqcie; + } + if (locallab.spots.at(i).colorflcie) { toEdit.locallab.spots.at(i).colorflcie = mods.locallab.spots.at(i).colorflcie; } -/* - if (locallab.spots.at(i).lightlzcam) { - toEdit.locallab.spots.at(i).lightlzcam = mods.locallab.spots.at(i).lightlzcam; - } - - if (locallab.spots.at(i).lightqzcam) { - toEdit.locallab.spots.at(i).lightqzcam = mods.locallab.spots.at(i).lightqzcam; - } - - if (locallab.spots.at(i).contlzcam) { - toEdit.locallab.spots.at(i).contlzcam = mods.locallab.spots.at(i).contlzcam; - } - - if (locallab.spots.at(i).contqzcam) { - toEdit.locallab.spots.at(i).contqzcam = mods.locallab.spots.at(i).contqzcam; - } - - if (locallab.spots.at(i).contthreszcam) { - toEdit.locallab.spots.at(i).contthreszcam = mods.locallab.spots.at(i).contthreszcam; - } - - if (locallab.spots.at(i).colorflzcam) { - toEdit.locallab.spots.at(i).colorflzcam = mods.locallab.spots.at(i).colorflzcam; - } - - if (locallab.spots.at(i).saturzcam) { - toEdit.locallab.spots.at(i).saturzcam = mods.locallab.spots.at(i).saturzcam; - } - - if (locallab.spots.at(i).chromzcam) { - toEdit.locallab.spots.at(i).chromzcam = mods.locallab.spots.at(i).chromzcam; - } -*/ if (locallab.spots.at(i).targabscie) { toEdit.locallab.spots.at(i).targabscie = mods.locallab.spots.at(i).targabscie; } @@ -6149,10 +6386,22 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).surroundcie = mods.locallab.spots.at(i).surroundcie; } + if (locallab.spots.at(i).strgradcie) { + toEdit.locallab.spots.at(i).strgradcie = mods.locallab.spots.at(i).strgradcie; + } + + if (locallab.spots.at(i).anggradcie) { + toEdit.locallab.spots.at(i).anggradcie = mods.locallab.spots.at(i).anggradcie; + } + if (locallab.spots.at(i).enacieMask) { toEdit.locallab.spots.at(i).enacieMask = mods.locallab.spots.at(i).enacieMask; } + if (locallab.spots.at(i).enacieMaskall) { + toEdit.locallab.spots.at(i).enacieMaskall = mods.locallab.spots.at(i).enacieMaskall; + } + if (locallab.spots.at(i).CCmaskciecurve) { toEdit.locallab.spots.at(i).CCmaskciecurve = mods.locallab.spots.at(i).CCmaskciecurve; } @@ -6165,6 +6414,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).HHmaskciecurve = mods.locallab.spots.at(i).HHmaskciecurve; } + if (locallab.spots.at(i).HHhmaskciecurve) { + toEdit.locallab.spots.at(i).HHhmaskciecurve = mods.locallab.spots.at(i).HHhmaskciecurve; + } + if (locallab.spots.at(i).blendmaskcie) { toEdit.locallab.spots.at(i).blendmaskcie = mods.locallab.spots.at(i).blendmaskcie; } @@ -6209,6 +6462,42 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).decaycie = mods.locallab.spots.at(i).decaycie; } + if (locallab.spots.at(i).strumaskcie) { + toEdit.locallab.spots.at(i).strumaskcie= mods.locallab.spots.at(i).strumaskcie; + } + + if (locallab.spots.at(i).toolcie) { + toEdit.locallab.spots.at(i).toolcie = mods.locallab.spots.at(i).toolcie; + } + + if (locallab.spots.at(i).fftcieMask) { + toEdit.locallab.spots.at(i).fftcieMask = mods.locallab.spots.at(i).fftcieMask; + } + + if (locallab.spots.at(i).blurcie) { + toEdit.locallab.spots.at(i).blurcie = mods.locallab.spots.at(i).blurcie; + } + + if (locallab.spots.at(i).contcie) { + toEdit.locallab.spots.at(i).contcie = mods.locallab.spots.at(i).contcie; + } + + if (locallab.spots.at(i).highmaskcie) { + toEdit.locallab.spots.at(i).highmaskcie = mods.locallab.spots.at(i).highmaskcie; + } + + if (locallab.spots.at(i).shadmaskcie) { + toEdit.locallab.spots.at(i).shadmaskcie = mods.locallab.spots.at(i).shadmaskcie; + } + + if (locallab.spots.at(i).LLmaskciecurvewav) { + toEdit.locallab.spots.at(i).LLmaskciecurvewav = mods.locallab.spots.at(i).LLmaskciecurvewav; + } + + if (locallab.spots.at(i).csthresholdcie) { + toEdit.locallab.spots.at(i).csthresholdcie = mods.locallab.spots.at(i).csthresholdcie; + } + } if (spot.enabled) { @@ -6461,6 +6750,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.icm.workingTRCSlope = mods.icm.workingTRCSlope; } + if (icm.wmidtcie) { + toEdit.icm.wmidtcie = mods.icm.wmidtcie; + } + + if (icm.wsmoothcie) { + toEdit.icm.wsmoothcie = mods.icm.wsmoothcie; + } + if (icm.redx) { toEdit.icm.redx = mods.icm.redx; } @@ -6485,6 +6782,18 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.icm.bluy = mods.icm.bluy; } + if (icm.refi) { + toEdit.icm.refi = mods.icm.refi; + } + + if (icm.shiftx) { + toEdit.icm.shiftx = mods.icm.shiftx; + } + + if (icm.shifty) { + toEdit.icm.shifty = mods.icm.shifty; + } + if (icm.preser) { toEdit.icm.preser = mods.icm.preser; } @@ -6493,6 +6802,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.icm.fbw = mods.icm.fbw; } + if (icm.trcExp) { + toEdit.icm.trcExp = mods.icm.trcExp; + } + if (icm.gamut) { toEdit.icm.gamut = mods.icm.gamut; } @@ -6529,6 +6842,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.icm.labgridcieWy = mods.icm.labgridcieWy; } + if (icm.labgridcieMx) { + toEdit.icm.labgridcieMx = mods.icm.labgridcieMx; + } + + if (icm.labgridcieMy) { + toEdit.icm.labgridcieMy = mods.icm.labgridcieMy; + } + if (icm.aRendIntent) { toEdit.icm.aRendIntent = mods.icm.aRendIntent; } @@ -6545,6 +6866,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.icm.wprim = mods.icm.wprim; } + if (icm.wcat) { + toEdit.icm.wcat = mods.icm.wcat; + } + if (raw.bayersensor.method) { toEdit.raw.bayersensor.method = mods.raw.bayersensor.method; } @@ -7685,7 +8010,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : expshadhigh(v), complexshadhigh(v), shMethod(v), - multsh{v, v, v, v, v, v}, + multsh{v, v, v, v, v, v, v}, highlights(v), h_tonalwidth(v), shadows(v), @@ -8054,8 +8379,13 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : fullimage(v), repar(v), ciecam(v), + satlog(v), blackEv(v), whiteEv(v), + whiteslog(v), + blackslog(v), + comprlog(v), + strelog(v), detail(v), sursour(v), surround(v), @@ -8108,6 +8438,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : visicie(v), complexcie(v), expcie(v), + expprecam(v), reparcie(v), sensicie(v), Autograycie(v), @@ -8115,8 +8446,14 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : forcebw(v), qtoj(v), jabcie(v), - sigmoidqjcie(v), + comprcieauto(v), + normcie(v), + gamutcie(v), + sigcie(v), logcie(v), + satcie(v), + logcieq(v), + smoothcie(v), logjz(v), sigjz(v), sigq(v), @@ -8125,6 +8462,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : sourceabscie(v), sursourcie(v), modecam(v), + bwevMethod(v), modecie(v), saturlcie(v), rstprotectcie(v), @@ -8149,8 +8487,10 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : lightlcie(v), lightjzcie(v), lightqcie(v), + lightsigqcie(v), contlcie(v), contjzcie(v), + detailciejz(v), adapjzcie(v), jz100(v), pqremap(v), @@ -8166,31 +8506,59 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : targetjz(v), sigmoidldacie(v), sigmoidthcie(v), + sigmoidsenscie(v), sigmoidblcie(v), + comprcie(v), + strcielog(v), + comprcieth(v), + gamjcie(v), + slopjcie(v), + slopesmo(v), + midtcie(v), + redxl(v), + redyl(v), + grexl(v), + greyl(v), + bluxl(v), + bluyl(v), + refi(v), + shiftxl(v), + shiftyl(v), + labgridcieALow(v), + labgridcieBLow(v), + labgridcieAHigh(v), + labgridcieBHigh(v), + labgridcieGx(v), + labgridcieGy(v), + labgridcieWx(v), + labgridcieWy(v), + labgridcieMx(v), + labgridcieMy(v), + whitescie(v), + blackscie(v), + illMethod(v), + smoothciemet(v), + primMethod(v), + catMethod(v), sigmoidldajzcie(v), sigmoidthjzcie(v), sigmoidbljzcie(v), contqcie(v), + contsigqcie(v), colorflcie(v), -/* - lightlzcam(v), - lightqzcam(v), - contlzcam(v), - contqzcam(v), - contthreszcam(v), - colorflzcam(v), - saturzcam(v), - chromzcam(v), -*/ targabscie(v), targetGraycie(v), catadcie(v), detailcie(v), surroundcie(v), + strgradcie(v), + anggradcie(v), enacieMask(v), + enacieMaskall(v), CCmaskciecurve(v), LLmaskciecurve(v), HHmaskciecurve(v), + HHhmaskciecurve(v), blendmaskcie(v), radmaskcie(v), sigmalcjz(v), @@ -8207,8 +8575,17 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : recothrescie(v), lowthrescie(v), higthrescie(v), - decaycie(v) - + decaycie(v), + strumaskcie(v), + toolcie(v), + fftcieMask(v), + contcie(v), + blurcie(v), + highmaskcie(v), + shadmaskcie(v), + LLmaskciecurvewav(v), + csthresholdcie(v) + { } @@ -8380,7 +8757,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) complexshadhigh = v; shMethod = v; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 6; i++) { multsh[i] = v; } @@ -8755,8 +9132,13 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) fullimage = v; repar = v; ciecam = v; + satlog = v; blackEv = v; whiteEv = v; + whiteslog = v; + blackslog = v; + comprlog = v; + strelog = v; detail = v; sursour = v; surround = v; @@ -8809,6 +9191,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) visicie= v; complexcie= v; expcie = v; + expprecam = v; reparcie = v; sensicie = v; Autograycie = v; @@ -8816,8 +9199,14 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) forcebw = v; qtoj = v; jabcie = v; - sigmoidqjcie = v; + comprcieauto = v; + normcie = v; + gamutcie = v; + sigcie = v; logcie = v; + satcie = v; + logcieq = v; + smoothcie = v; logjz = v; sigjz = v; sigq = v; @@ -8826,6 +9215,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) sourceabscie = v; sursourcie = v; modecam = v; + bwevMethod = v; modecie = v; saturlcie = v; rstprotectcie = v; @@ -8850,8 +9240,10 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) lightlcie = v; lightjzcie = v; lightqcie = v; + lightsigqcie = v; contlcie = v; contjzcie = v; + detailciejz = v; adapjzcie = v; jz100 = v; pqremap = v; @@ -8867,31 +9259,59 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) targetjz = v; sigmoidldacie = v; sigmoidthcie = v; + sigmoidsenscie = v; sigmoidblcie = v; + comprcie = v; + strcielog = v; + comprcieth = v; + gamjcie = v; + slopjcie = v; + slopesmo = v; + midtcie = v; + redxl = v; + redyl = v; + grexl = v; + greyl = v; + bluxl = v; + bluyl = v; + refi = v; + shiftxl = v; + shiftyl = v; + labgridcieALow = v; + labgridcieBLow = v; + labgridcieAHigh= v; + labgridcieBHigh = v; + labgridcieGx = v; + labgridcieGy = v; + labgridcieWx = v; + labgridcieWy = v; + labgridcieMx = v; + labgridcieMy = v; + whitescie = v; + blackscie = v; + illMethod = v; + smoothciemet = v; + primMethod = v; + catMethod = v; sigmoidldajzcie = v; sigmoidthjzcie = v; sigmoidbljzcie = v; contqcie = v; + contsigqcie = v; colorflcie = v; -/* - lightlzcam = v; - lightqzcam = v; - contlzcam = v; - contqzcam = v; - contthreszcam = v; - colorflzcam = v; - saturzcam = v; - chromzcam = v; -*/ targabscie = v; targetGraycie = v; catadcie = v; detailcie = v; surroundcie = v; + anggradcie = v; + strgradcie = v; enacieMask = v; + enacieMaskall = v; CCmaskciecurve = v; LLmaskciecurve = v; HHmaskciecurve = v; + HHhmaskciecurve = v; blendmaskcie = v; radmaskcie = v; sigmalcjz = v; @@ -8909,6 +9329,15 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) lowthrescie = v; higthrescie = v; decaycie = v; + strumaskcie = v; + toolcie = v; + fftcieMask = v; + contcie = v; + blurcie = v; + highmaskcie = v; + shadmaskcie = v; + LLmaskciecurvewav = v; + csthresholdcie = v; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 260779a7f..c8bd39f9b 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -577,7 +577,7 @@ public: bool expshadhigh; bool complexshadhigh; bool shMethod; - bool multsh[6]; + bool multsh[7]; bool highlights; bool h_tonalwidth; bool shadows; @@ -946,8 +946,13 @@ public: bool fullimage; bool repar; bool ciecam; + bool satlog; bool blackEv; bool whiteEv; + bool whiteslog; + bool blackslog; + bool comprlog; + bool strelog; bool detail; bool sursour; bool surround; @@ -1000,6 +1005,7 @@ public: bool visicie; bool complexcie; bool expcie; + bool expprecam; bool reparcie; bool sensicie; bool Autograycie; @@ -1007,8 +1013,14 @@ public: bool forcebw; bool qtoj; bool jabcie; - bool sigmoidqjcie; + bool comprcieauto; + bool normcie; + bool gamutcie; + bool sigcie; bool logcie; + bool satcie; + bool logcieq; + bool smoothcie; bool logjz; bool sigjz; bool sigq; @@ -1017,6 +1029,7 @@ public: bool sourceabscie; bool sursourcie; bool modecam; + bool bwevMethod; bool modecie; bool saturlcie; bool rstprotectcie; @@ -1041,8 +1054,10 @@ public: bool lightlcie; bool lightjzcie; bool lightqcie; + bool lightsigqcie; bool contlcie; bool contjzcie; + bool detailciejz; bool adapjzcie; bool jz100; bool pqremap; @@ -1058,31 +1073,61 @@ public: bool targetjz; bool sigmoidldacie; bool sigmoidthcie; + bool sigmoidsenscie; bool sigmoidblcie; + bool comprcie; + bool strcielog; + bool comprcieth; + bool gamjcie; + bool slopjcie; + bool slopesmo; + bool midtcie; + bool redxl; + bool redyl; + bool grexl; + bool greyl; + bool bluxl; + bool bluyl; + bool refi; + bool shiftxl; + bool shiftyl; + bool labgridcieALow; + bool labgridcieBLow; + bool labgridcieAHigh; + bool labgridcieBHigh; + bool labgridcieGx; + bool labgridcieGy; + bool labgridcieWx; + bool labgridcieWy; + bool labgridcieMx; + bool labgridcieMy; + bool whitescie; + bool blackscie; + bool illMethod; + bool smoothciemet; + bool primMethod; + bool catMethod; bool sigmoidldajzcie; bool sigmoidthjzcie; bool sigmoidbljzcie; bool contqcie; + bool contsigqcie; bool colorflcie; -/* - bool lightlzcam; - bool lightqzcam; - bool contlzcam; - bool contqzcam; - bool contthreszcam; - bool colorflzcam; - bool saturzcam; - bool chromzcam; -*/ + bool targabscie; bool targetGraycie; bool catadcie; bool detailcie; bool surroundcie; + bool strgradcie; + bool anggradcie; + bool enacieMask; + bool enacieMaskall; bool CCmaskciecurve; bool LLmaskciecurve; bool HHmaskciecurve; + bool HHhmaskciecurve; bool blendmaskcie; bool radmaskcie; bool sigmalcjz; @@ -1100,7 +1145,16 @@ public: bool lowthrescie; bool higthrescie; bool decaycie; - + bool strumaskcie; + bool toolcie; + bool fftcieMask; + bool contcie; + bool blurcie; + bool highmaskcie; + bool shadmaskcie; + bool LLmaskciecurvewav; + bool csthresholdcie; + LocallabSpotEdited(bool v); void set(bool v); @@ -1242,16 +1296,23 @@ struct ColorManagementParamsEdited { bool workingTRC; bool workingTRCGamma; bool workingTRCSlope; + bool wmidtcie; + bool wsmoothcie; bool will; bool wprim; + bool wcat; bool redx; bool redy; bool grex; bool grey; bool blux; bool bluy; + bool refi; + bool shiftx; + bool shifty; bool preser; bool fbw; + bool trcExp; bool gamut; bool labgridcieALow; bool labgridcieBLow; @@ -1261,6 +1322,8 @@ struct ColorManagementParamsEdited { bool labgridcieGy; bool labgridcieWx; bool labgridcieWy; + bool labgridcieMx; + bool labgridcieMy; bool aRendIntent; bool outputProfile; bool outputIntent; diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index c3ce7f6af..c807a1bd2 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -1749,7 +1749,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) strend->setValue(pp->wavelet.strend); detend->setValue(pp->wavelet.detend); thrend->setValue(pp->wavelet.thrend); - labgrid->setParams(pp->wavelet.labgridALow / WaveletParams::LABGRID_CORR_MAX, pp->wavelet.labgridBLow / WaveletParams::LABGRID_CORR_MAX, pp->wavelet.labgridAHigh / WaveletParams::LABGRID_CORR_MAX, pp->wavelet.labgridBHigh / WaveletParams::LABGRID_CORR_MAX, 0, 0, 0, 0, false); + labgrid->setParams(pp->wavelet.labgridALow / WaveletParams::LABGRID_CORR_MAX, pp->wavelet.labgridBLow / WaveletParams::LABGRID_CORR_MAX, pp->wavelet.labgridAHigh / WaveletParams::LABGRID_CORR_MAX, pp->wavelet.labgridBHigh / WaveletParams::LABGRID_CORR_MAX, 0, 0, 0, 0, 0, 0, false); sigm->setValue(pp->wavelet.sigm); levden->setValue(pp->wavelet.levden); @@ -2212,7 +2212,7 @@ void Wavelet::write(ProcParams* pp, ParamsEdited* pedited) pp->wavelet.chromco = chromco->getValue(); double zerox = 0.; double zeroy = 0.; - labgrid->getParams(pp->wavelet.labgridALow, pp->wavelet.labgridBLow, pp->wavelet.labgridAHigh, pp->wavelet.labgridBHigh, zerox, zeroy, zerox, zeroy); + labgrid->getParams(pp->wavelet.labgridALow, pp->wavelet.labgridBLow, pp->wavelet.labgridAHigh, pp->wavelet.labgridBHigh, zerox, zeroy, zerox, zeroy, zerox, zeroy); pp->wavelet.labgridALow *= WaveletParams::LABGRID_CORR_MAX; pp->wavelet.labgridAHigh *= WaveletParams::LABGRID_CORR_MAX; pp->wavelet.labgridBLow *= WaveletParams::LABGRID_CORR_MAX; @@ -2672,7 +2672,7 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit balchrom->setDefault(defParams->wavelet.balchrom); chromfi->setDefault(defParams->wavelet.chromfi); chromco->setDefault(defParams->wavelet.chromco); - labgrid->setDefault(defParams->wavelet.labgridALow / WaveletParams::LABGRID_CORR_MAX, defParams->wavelet.labgridBLow / WaveletParams::LABGRID_CORR_MAX, defParams->wavelet.labgridAHigh / WaveletParams::LABGRID_CORR_MAX, defParams->wavelet.labgridBHigh / WaveletParams::LABGRID_CORR_MAX, 0, 0, 0, 0); + labgrid->setDefault(defParams->wavelet.labgridALow / WaveletParams::LABGRID_CORR_MAX, defParams->wavelet.labgridBLow / WaveletParams::LABGRID_CORR_MAX, defParams->wavelet.labgridAHigh / WaveletParams::LABGRID_CORR_MAX, defParams->wavelet.labgridBHigh / WaveletParams::LABGRID_CORR_MAX, 0, 0, 0, 0, 0, 0); greenlow->setDefault(defParams->wavelet.greenlow); bluelow->setDefault(defParams->wavelet.bluelow); From 129e3f4dd8fdaad29e1bab650d5a12355f78a5d1 Mon Sep 17 00:00:00 2001 From: "U-PCSPECIALIST01\\jdesm" Date: Mon, 15 Apr 2024 07:54:24 +0200 Subject: [PATCH 09/31] Reset windows.yml appimage.yml --- .github/workflows/appimage.yml | 2 +- .github/workflows/windows.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index fd2652345..cf82dafb8 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '["Beep6581:lacam16n2"]' + publish_pre_dev_labels: '[]' jobs: build: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2f752f978..6963df7c9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '["Beep6581:lacam16n2"]' + publish_pre_dev_labels: '[]' jobs: build: From a1eaa8f64e803d8bf884787f0ef3e56b8e920b9c Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 18 Apr 2024 15:12:42 +0200 Subject: [PATCH 10/31] fix ModifyDate --- rtengine/metadata.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtengine/metadata.cc b/rtengine/metadata.cc index 0a55c1424..2e75e1f3c 100644 --- a/rtengine/metadata.cc +++ b/rtengine/metadata.cc @@ -29,6 +29,7 @@ #include "imagedata.h" #include "../rtgui/version.h" #include "../rtgui/pathutils.h" +#include #if EXIV2_TEST_VERSION(0,28,0) @@ -312,6 +313,13 @@ void Exiv2Metadata::saveToImage(const Glib::ustring &path, bool preserve_all_tag } dst->exifData()["Exif.Image.Software"] = "RawTherapee " RTVERSION; + + std::time_t t = std::time(nullptr); + char mbstr[100]; + if (std::strftime(mbstr, sizeof(mbstr), "%Y:%m:%d %H:%M:%S", std::localtime(&t))) { + dst->exifData()["Exif.Image.ModifyDate"] = mbstr; + } + import_exif_pairs(dst->exifData()); import_iptc_pairs(dst->iptcData()); bool xmp_tried = false; From 1aea652fea98df0268161bb84ff2f1dbd976973a Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 18 Apr 2024 16:48:08 +0200 Subject: [PATCH 11/31] Add correct DateTime (editing date) to Exif data Currently, RT does not save the editing date (Exif tag DateTime) in the exif data of the exported files, only DateTimeOriginal (the date/time the photo was captured). This patch fixes this. --- rtengine/metadata.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/metadata.cc b/rtengine/metadata.cc index 2e75e1f3c..38d115b7e 100644 --- a/rtengine/metadata.cc +++ b/rtengine/metadata.cc @@ -317,7 +317,7 @@ void Exiv2Metadata::saveToImage(const Glib::ustring &path, bool preserve_all_tag std::time_t t = std::time(nullptr); char mbstr[100]; if (std::strftime(mbstr, sizeof(mbstr), "%Y:%m:%d %H:%M:%S", std::localtime(&t))) { - dst->exifData()["Exif.Image.ModifyDate"] = mbstr; + dst->exifData()["Exif.Image.DateTime"] = mbstr; } import_exif_pairs(dst->exifData()); From b5abd46d0cfad8bd0cf9f1d63c46fe138c1b73c0 Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Thu, 18 Apr 2024 23:13:21 -0700 Subject: [PATCH 12/31] Add divider in pop-up button for RawTherapee theme Provide a visual cue that there are two buttons. --- rtdata/themes/RawTherapee.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rtdata/themes/RawTherapee.css b/rtdata/themes/RawTherapee.css index 499b2197e..486181ba9 100644 --- a/rtdata/themes/RawTherapee.css +++ b/rtdata/themes/RawTherapee.css @@ -1300,6 +1300,11 @@ combobox, .popupbutton-arrow { min-height: 2em; } +/* Visual divider between the icon and arrow in the pop-up button. */ +.image-combo button.Left { + border-right: solid 0.083333333333333333em #202020; +} + /* Makes image-combobox small icons centered */ button.toggle > grid > image { padding: 0.3333333333333333em; From 30cf3f721fdac985ca240db154377571913d5bfa Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 20 Apr 2024 17:11:31 +0200 Subject: [PATCH 13/31] UV photos - Wish from LarsHP Increased green (tint) value from 10 to 100 (#7043) * Change limits green to 40 instead of 10 * Publish uvgreen in pre-dev appimage.yml windows.yml * Change range setLogScale * Revert change to observer 2 - format * Set maxgreen 60 * Set maxgreen 100 and minequal 0.5 maxequal 1.8 * Set maxgreen 1000 minequal 0.4 maxequal 2.5 * Set maxgreen 100 minequal 0.5 maxequal 2 --- .github/workflows/appimage.yml | 4 ++-- .github/workflows/windows.yml | 1 + rtengine/colortemp.cc | 1 - rtengine/colortemp.h | 6 +++--- rtgui/whitebalance.cc | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index cf82dafb8..5a5c3b8d0 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -15,8 +15,8 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '[]' - + publish_pre_dev_labels: '[]' + jobs: build: runs-on: ubuntu-20.04 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6963df7c9..e5f4ce166 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -17,6 +17,7 @@ on: env: publish_pre_dev_labels: '[]' + jobs: build: runs-on: windows-latest diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index 1c98b3e8b..f8a4b60b2 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -32,7 +32,6 @@ namespace rtengine { - static const color_match_type cie_colour_match_jd2 = {//350nm to 830nm 5 nm J.Desmis 2° Standard Observer. {0.0000000, 0.000000, 0.000000}, {0.0000000, 0.000000, 0.000000}, {0.0001299, 0.0003917, 0.0006061}, {0.0002321, 0.000006965, 0.001086}, {0.0004149, 0.00001239, 0.001946}, {0.0007416, 0.00002202, 0.003846}, diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h index db69abe2d..00b79ef85 100644 --- a/rtengine/colortemp.h +++ b/rtengine/colortemp.h @@ -31,9 +31,9 @@ using color_match_type = double [97][3]; constexpr double MINTEMP = 1500.0; constexpr double MAXTEMP = 60000.0; constexpr double MINGREEN = 0.02; -constexpr double MAXGREEN = 10.0; -constexpr double MINEQUAL = 0.8; -constexpr double MAXEQUAL = 1.5; +constexpr double MAXGREEN = 100.0; +constexpr double MINEQUAL = 0.5; +constexpr double MAXEQUAL = 2.; constexpr double INITIALBLACKBODY = 4000.0; enum class StandardObserver { diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index 63a1d2100..d207ef7a2 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -31,9 +31,9 @@ #define MAXTEMP 60000 //12000 #define CENTERTEMP 4750 #define MINGREEN 0.02 -#define MAXGREEN 10.0 -#define MINEQUAL 0.8 -#define MAXEQUAL 1.5 +#define MAXGREEN 100.0 +#define MINEQUAL 0.5 +#define MAXEQUAL 2. using namespace rtengine; using namespace rtengine::procparams; @@ -396,7 +396,7 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, TOOL_NAME, M("TP_WBALANC pack_start(*StudLabel); pack_start(*PatchLabel); pack_start(*PatchlevelLabel); - + green->setLogScale(MAXGREEN / MINGREEN, MINGREEN); pack_start (*temp); //pack_start (*boxgreen); pack_start (*green); From c72e67ae24b00cb669165a965cbd6633ff44e4de Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 20 Apr 2024 17:34:53 +0200 Subject: [PATCH 14/31] Limits incompatibility between Ciecam and CBDL and others to Cam02 #7017 (#7023) * CBDL and others only with ciecam Cam16 * Change windows and appimage yml * Remove appimage.yml and windows.yml --- rtengine/dcrop.cc | 18 ++++++++++++------ rtengine/improccoordinator.cc | 12 ++++++++---- rtengine/rtthumbnail.cc | 3 ++- rtengine/simpleprocess.cc | 20 +++++++++++++------- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index a489bd681..bc0972092 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -813,7 +813,8 @@ void Crop::update(int todo) const bool needstransform = parent->ipf.needsTransform(skips(parent->fw, skip), skips(parent->fh, skip), parent->imgsrc->getRotateDegree(), parent->imgsrc->getMetaData()); // transform - if (needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) { + // if (needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) { + if (needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && params.colorappearance.modelmethod != "02")) { if (!transCrop) { transCrop = new Imagefloat(cropw, croph); } @@ -834,7 +835,8 @@ void Crop::update(int todo) transCrop = nullptr; } - if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { + // if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { + if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && params.colorappearance.modelmethod != "02") { const int W = baseCrop->getWidth(); const int H = baseCrop->getHeight(); @@ -1329,21 +1331,24 @@ void Crop::update(int todo) parent->ipf.vibrance(labnCrop, params.vibrance, params.toneCurve.hrenabled, params.icm.workingProfile); parent->ipf.labColorCorrectionRegions(labnCrop); - if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { + // if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (params.colorappearance.modelmethod != "02")) { parent->ipf.EPDToneMap(labnCrop, 0, skip); } //parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay. // for all treatments Defringe, Sharpening, Contrast detail , Microcontrast they are activated if "CIECAM" function are disabled if (skip == 1) { - if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + // if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !settings->autocielab) || (params.colorappearance.modelmethod != "02")) { parent->ipf.impulsedenoise(labnCrop); parent->ipf.defringe(labnCrop); } parent->ipf.MLsharpen(labnCrop); - if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + // if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !settings->autocielab) || (params.colorappearance.modelmethod != "02")) { parent->ipf.MLmicrocontrast(labnCrop); parent->ipf.sharpening(labnCrop, params.sharpening, parent->sharpMask); } @@ -1352,7 +1357,8 @@ void Crop::update(int todo) // if (skip==1) { if (params.dirpyrequalizer.cbdlMethod == "aft") { - if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled))) { + // if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled))) { + if (((params.colorappearance.enabled && !settings->autocielab) || (params.colorappearance.modelmethod != "02"))) { parent->ipf.dirpyrequalizer(labnCrop, skip); // parent->ipf.Lanczoslab (labnCrop,labnCrop , 1.f/skip); } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 604d353c4..8a6fd06e4 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -860,7 +860,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) bool needstransform = ipf.needsTransform(fw, fh, imgsrc->getRotateDegree(), imgsrc->getMetaData()); - if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && !params->colorappearance.enabled))) { + // if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && !params->colorappearance.enabled))) { + if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && params->colorappearance.modelmethod != "02"))) { // Forking the image assert(oprevi); Imagefloat *op = oprevi; @@ -882,7 +883,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } } - if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && !params->colorappearance.enabled) { + // if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && !params->colorappearance.enabled) { + if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && params->colorappearance.modelmethod != "02") { const int W = oprevi->getWidth(); const int H = oprevi->getHeight(); LabImage labcbdl(W, H); @@ -1755,12 +1757,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) ipf.vibrance(nprevl, params->vibrance, params->toneCurve.hrenabled, params->icm.workingProfile); ipf.labColorCorrectionRegions(nprevl); - if ((params->colorappearance.enabled && !params->colorappearance.tonecie) || (!params->colorappearance.enabled)) { + // if ((params->colorappearance.enabled && !params->colorappearance.tonecie) || (!params->colorappearance.enabled)) { + if ((params->colorappearance.enabled && !params->colorappearance.tonecie) || (params->colorappearance.modelmethod != "02")) { ipf.EPDToneMap(nprevl, 0, scale); } if (params->dirpyrequalizer.cbdlMethod == "aft") { - if (((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled))) { + // if (((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled))) { + if (((params->colorappearance.enabled && !settings->autocielab) || (params->colorappearance.modelmethod != "02"))) { ipf.dirpyrequalizer(nprevl, scale); } } diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 1691912a1..1816a7470 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1528,7 +1528,8 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT - if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || !params.colorappearance.enabled) { + // if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || !params.colorappearance.enabled) { + if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || params.colorappearance.modelmethod != "02") { ipf.EPDToneMap (labView, 5, 6); } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index e7d13884c..241d628e9 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1004,7 +1004,7 @@ private: } } } - + //colorappearance.modelmethod == "02" bool execcam = false; //execcam => work around for pre-ciecam in LA: about 0.1 second @@ -1523,7 +1523,8 @@ private: ipf.chromiLuminanceCurve(nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); - if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { + // if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (params.colorappearance.modelmethod != "02")) { ipf.EPDToneMap(labView, 0, 1); } @@ -1533,7 +1534,8 @@ private: // for all treatments Defringe, Sharpening, Contrast detail ,Microcontrast they are activated if "CIECAM" function are disabled - if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + // if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !settings->autocielab) || (params.colorappearance.modelmethod != "02")) { ipf.impulsedenoise(labView); ipf.defringe(labView); } @@ -1543,12 +1545,14 @@ private: } if (params.sharpenMicro.enabled) { - if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + // if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !settings->autocielab) || (params.colorappearance.modelmethod != "02")) { ipf.MLmicrocontrast(labView); //!params.colorappearance.sharpcie } } - if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) && params.sharpening.enabled) { + // if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) && params.sharpening.enabled) { + if (((params.colorappearance.enabled && !settings->autocielab) || (params.colorappearance.modelmethod != "02")) && params.sharpening.enabled) { ipf.sharpening(labView, params.sharpening); } @@ -1557,7 +1561,8 @@ private: // directional pyramid wavelet if (params.dirpyrequalizer.cbdlMethod == "aft") { - if ((params.colorappearance.enabled && !settings->autocielab) || !params.colorappearance.enabled) { + // if ((params.colorappearance.enabled && !settings->autocielab) || !params.colorappearance.enabled) { + if ((params.colorappearance.enabled && !settings->autocielab) || params.colorappearance.modelmethod != "02") { ipf.dirpyrequalizer(labView, 1); //TODO: this is the luminance tonecurve, not the RGB one } } @@ -1935,7 +1940,8 @@ private: } } - bool bwonly = params.blackwhite.enabled && !params.colorToning.enabled && !autili && !butili && !params.colorappearance.enabled; + // bool bwonly = params.blackwhite.enabled && !params.colorToning.enabled && !autili && !butili && !params.colorappearance.enabled; + bool bwonly = params.blackwhite.enabled && !params.colorToning.enabled && !autili && !butili && params.colorappearance.modelmethod != "02"; ///////////// Custom output gamma has been removed, the user now has to create ///////////// a new output profile with the ICCProfileCreator From 232c11c37c9e76cd8b1c76d982d5dcb55b137686 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Mon, 22 Apr 2024 09:45:12 +0200 Subject: [PATCH 15/31] dcp: avoid file descriptor leak on error. If the provided file doesn't contain valid dcp metadata the DCPProfile constructor will return without closing the file descriptor. --- rtengine/dcp.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/rtengine/dcp.cc b/rtengine/dcp.cc index 940b3c0c0..524ecf8af 100644 --- a/rtengine/dcp.cc +++ b/rtengine/dcp.cc @@ -1134,6 +1134,7 @@ DCPProfile::DCPProfile(const Glib::ustring& filename) : DCPMetadata md(file); if (!md.parse()) { printf ("Unable to load DCP profile '%s'.", filename.c_str()); + fclose(file); return; } From ff65f865594d8914b9c68d0f1d1198ac15a4d7f6 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 24 Apr 2024 11:37:43 +0200 Subject: [PATCH 16/31] dcp: use std::unique_ptr to automatically close file descriptor Use std::unique_ptr to automatically close file descriptor instead of manually closing it at every return point. --- rtengine/dcp.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/rtengine/dcp.cc b/rtengine/dcp.cc index 524ecf8af..df5627d2e 100644 --- a/rtengine/dcp.cc +++ b/rtengine/dcp.cc @@ -1124,17 +1124,20 @@ DCPProfile::DCPProfile(const Glib::ustring& filename) : 1.00000f }; - FILE* const file = g_fopen(filename.c_str(), "rb"); + const std::unique_ptr> file( + g_fopen(filename.c_str(), "rb"), + [](std::FILE *file) { + std::fclose(file); + }); if (file == nullptr) { printf ("Unable to load DCP profile '%s' !", filename.c_str()); return; } - DCPMetadata md(file); + DCPMetadata md(file.get()); if (!md.parse()) { printf ("Unable to load DCP profile '%s'.", filename.c_str()); - fclose(file); return; } @@ -1175,7 +1178,6 @@ DCPProfile::DCPProfile(const Glib::ustring& filename) : // Color Matrix (one is always there) if (!md.find(TAG_KEY_COLOR_MATRIX_1)) { std::cerr << "DCP '" << filename << "' is missing 'ColorMatrix1'. Skipped." << std::endl; - fclose(file); return; } @@ -1352,10 +1354,6 @@ DCPProfile::DCPProfile(const Glib::ustring& filename) : } } - if (file) { - fclose(file); - } - valid = true; } From a53ddf4282bfa89c7694f86fa8cc11ec656069ff Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 1 May 2024 07:49:14 +0200 Subject: [PATCH 17/31] Ciecam - Change management viewing temperature and tint #7055 (#7058) * Change management viewing temperature and tint * Enable autotemp wbcamchanged and hide history message * Change wbcamchnaged as proposed by kaesa --- rtengine/improccoordinator.cc | 4 ++-- rtengine/rtengine.h | 2 +- rtgui/colorappearance.cc | 26 ++++++++++++++++++++++---- rtgui/colorappearance.h | 2 +- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 8a6fd06e4..fbdddf63a 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -2308,8 +2308,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) tempsym = params->colorappearance.tempout; greensym = params->colorappearance.greenout; } - if (params->colorappearance.enabled) { - acListener->wbCamChanged(tempsym, greensym); //real temp and tint. + if (params->colorappearance.enabled && acListener) { + acListener->wbCamChanged(tempsym, greensym, params->colorappearance.autotempout); //real temp and tint. } } else { diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index fdd6676e6..e76d17336 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -372,7 +372,7 @@ public : virtual void autoCamChanged(double ccam, double ccamout) = 0; virtual void adapCamChanged(double cadap) = 0; virtual void ybCamChanged(int yb) = 0; - virtual void wbCamChanged(double tem, double tin) = 0; + virtual void wbCamChanged(double tem, double tin, bool autotemp) = 0; }; diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 0390ef869..d18cddcad 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -1880,18 +1880,36 @@ void ColorAppearance::adapCamChanged (double cadap) } -void ColorAppearance::wbCamChanged (double temp, double tin) +void ColorAppearance::wbCamChanged (double temp, double tin, bool autotemp) {//reactivate this function idle_register.add( - [this, temp, tin]() -> bool + [this, temp, tin, autotemp]() -> bool + { + if (temp != tempout->getValue()) { + disableListener(); + tempout->setValue(temp); + enableListener(); + listener->panelChanged (EvCATtempout, tempout->getTextValue()); + } + if (tin != greenout->getValue()) { + disableListener(); + greenout->setValue(tin); + enableListener(); + listener->panelChanged (EvCATgreenout, greenout->getTextValue()); + } + /* disableListener(); tempout->setValue(temp); greenout->setValue(tin); enableListener(); - listener->panelChanged (EvCATgreenout, greenout->getTextValue()); - listener->panelChanged (EvCATtempout, tempout->getTextValue()); + + if(!autotemp) { + listener->panelChanged (EvCATgreenout, "");//greenout->getTextValue()); + listener->panelChanged (EvCATtempout, "");//tempout->getTextValue()); + }*/ + return false; } ); diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index 714f3e557..e8f6084cd 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -66,7 +66,7 @@ public: void autoCamChanged (double ccam, double ccamout) override; bool autoCamComputed_ (); void adapCamChanged (double cadap) override; - void wbCamChanged(double tem, double tin) override; + void wbCamChanged(double tem, double tin, bool autotemp) override; bool adapCamComputed_ (); void ybCamChanged (int yb) override; bool ybCamComputed_ (); From ca569b051b258400cff14f72b32df69a33a13377 Mon Sep 17 00:00:00 2001 From: "U-PCSPECIALIST01\\jdesm" Date: Wed, 1 May 2024 10:48:15 +0200 Subject: [PATCH 18/31] Fixed bad variable assignement in iplocallab.cc --- rtengine/iplocallab.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 37ef276df..d7eca81ff 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -933,8 +933,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.balanexp = locallab.spots.at(sp).balanexp; lp.linear = locallab.spots.at(sp).linear; - if (locallab.spots.at(sp).smoothciemet == "norm") { - lp.smoothciem = 1; + if (locallab.spots.at(sp).smoothciemet == "none") { + lp.smoothciem = 0; } else if (locallab.spots.at(sp).smoothciemet == "Ev") { lp.smoothciem = 1; } else if (locallab.spots.at(sp).smoothciemet == "gam") { @@ -943,7 +943,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.smoothciem = 3; } - if (locallab.spots.at(sp).smoothciemet == "none") { + if (locallab.spots.at(sp).spotMethod == "norm") { lp.fullim = 0; } else if (locallab.spots.at(sp).spotMethod == "exc") { lp.fullim = 1; From b7749c0719c8e8e058b38a07a454df5c10eebd6f Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 2 May 2024 09:59:47 +0200 Subject: [PATCH 19/31] Add correct DateTime to Exif date --- rtengine/metadata.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtengine/metadata.cc b/rtengine/metadata.cc index 38d115b7e..1e0962dd2 100644 --- a/rtengine/metadata.cc +++ b/rtengine/metadata.cc @@ -315,9 +315,9 @@ void Exiv2Metadata::saveToImage(const Glib::ustring &path, bool preserve_all_tag dst->exifData()["Exif.Image.Software"] = "RawTherapee " RTVERSION; std::time_t t = std::time(nullptr); - char mbstr[100]; + char mbstr[20]; if (std::strftime(mbstr, sizeof(mbstr), "%Y:%m:%d %H:%M:%S", std::localtime(&t))) { - dst->exifData()["Exif.Image.DateTime"] = mbstr; + dst->exifData()["Exif.Image.DateTime"] = mbstr; } import_exif_pairs(dst->exifData()); From ca3d4a06b629dc7aa62f8ca1e9de1dac3e935301 Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Sun, 14 Apr 2024 18:00:34 -0700 Subject: [PATCH 20/31] Fix Panasonic DMC-FX150 16:9 raw crop The dcraw default leaves a couple of unwanted pixels on the right and bottom edges. Other aspect ratios are fine. --- rtengine/camconst.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 06c23afae..3f78739a5 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -2323,6 +2323,13 @@ Camera constants: "ranges": { "black": 15, "white": 4050 } // 15 is BL offset. dcraw/RT read the base offset from Exif and calculates total BL = BLbase+BLoffset }, + { // Quality C + "make_model": "Panasonic DMC-FX150", + "raw_crop": [ + { "frame": [ 4508, 2498 ], "crop": [ 0, 0, 4429, 2496] } // 16:9 ratio needs to shave a few extra pixels from dcraw's crop. + ] + }, + { // Quality A, replicated from rawimage.cc "make_model": "Panasonic DMC-FZ150", "dcraw_matrix": [ 10435,-3208,-72,-2293,10506,2067,-486,1725,4682 ], // RT, copy from custom dcp d55 From 18d69a6af631329b381e082c80d9d04d74fba89d Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 12 May 2024 07:33:48 +0200 Subject: [PATCH 21/31] Local adjustments - Colorappearance Cam16 - Source Data Adjustments - levels R G B and Black & White (#7071) * Change management viewing temperature and tint * Enable autotemp wbcamchanged and hide history message * Change wbcamchnaged as proposed by kaesa * First step levels * Levels with luminosity mode * History messages * Clean and comment code * Gamutmap xyz levels values * Change range slope R G B * Change range slope R G B * Harmonize case Slope and Levels * Harmonize case Slope and Levels 2 * Check Scale Yb viewing * Small change * Checbox black and white in source data adjustments * Change tooltip avoid color shift issue 7066 * modify appimage.yml and windows.yml * Fixed bad primaries space in free * Fixed bwcie only in advanced mode --- .github/workflows/appimage.yml | 2 +- .github/workflows/windows.yml | 2 +- rtdata/languages/default | 17 ++- rtengine/dcrop.cc | 7 +- rtengine/improccoordinator.cc | 3 +- rtengine/improcfun.h | 2 +- rtengine/iplocallab.cc | 213 +++++++++++++++++++++++++--- rtengine/procparams.cc | 24 ++++ rtengine/procparams.h | 6 + rtengine/rtengine.h | 1 + rtengine/simpleprocess.cc | 3 +- rtgui/locallab.cc | 3 +- rtgui/locallabtools.h | 20 ++- rtgui/locallabtools2.cc | 250 ++++++++++++++++++++++++++++++++- rtgui/paramsedited.cc | 43 +++++- rtgui/paramsedited.h | 6 + 16 files changed, 567 insertions(+), 35 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 5a5c3b8d0..90beb2c18 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '[]' + publish_pre_dev_labels: '["Beep6581:levels"]' jobs: build: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e5f4ce166..b30dd9f20 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '[]' + publish_pre_dev_labels: '["Beep6581:levels"]' jobs: diff --git a/rtdata/languages/default b/rtdata/languages/default index ad8962037..81c7bfeee 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1453,6 +1453,7 @@ HISTORY_MSG_ILLUM;CAL - SC - Illuminant HISTORY_MSG_LOCAL_CIE_ANGGRAD;Local CIECAM - gradient angle HISTORY_MSG_LOCAL_CIE_BRICOMP;Local CIECAM Brightness compression HISTORY_MSG_LOCAL_CIE_BRICOMPTH;Local CIECAM Brightness compression threshold +HISTORY_MSG_LOCAL_CIE_BWCIE;Local CIECAM - black and white HISTORY_MSG_LOCAL_CIE_CAT;Matrix adaptation HISTORY_MSG_LOCAL_CIE_DETAILJZ;Local JzCzHz Local contrast HISTORY_MSG_LOCAL_CIE_ENAMASKALL;Local CIECAM All mask tools @@ -1470,6 +1471,9 @@ HISTORY_MSG_LOCAL_CIE_SIGADAP;Local CIECAM Sigmoid adaptability HISTORY_MSG_LOCAL_CIE_SIGMET;Local CIECAM - Sigmoid method HISTORY_MSG_LOCAL_CIE_SLOP;Local CIECAM - Slope HISTORY_MSG_LOCAL_CIE_SLOPESMO;Local CIECAM - Gray balance +HISTORY_MSG_LOCAL_CIE_SLOPESMOR;Local CIECAM - Red balance +HISTORY_MSG_LOCAL_CIE_SLOPESMOG;Local CIECAM - Green balance +HISTORY_MSG_LOCAL_CIE_SLOPESMOB;Local CIECAM - Blue balance HISTORY_MSG_LOCAL_CIE_SMOOTHMET;Local CIECAM - Smooth lights method HISTORY_MSG_LOCAL_CIE_STRGRAD;Local CIECAM - gradient strength L HISTORY_MSG_LOCAL_CIE_TRC;Local CIECAM - TRC @@ -1483,6 +1487,8 @@ HISTORY_MSG_LOCAL_CIE_BLUYL;Local CIECAM - Blue Y HISTORY_MSG_LOCAL_CIE_SHIFTXL;Local CIECAM - Shift x HISTORY_MSG_LOCAL_CIE_SHIFTYL;Local CIECAM - Shift y HISTORY_MSG_LOCAL_CIE_SMOOTH;Local CIECAM - Scale Yb Scene +HISTORY_MSG_LOCAL_CIE_SMOOTHYB;Local CIECAM - Scale Yb Viewing +HISTORY_MSG_LOCAL_CIE_SMOOTH_LUM;Local CIECAM - levels - luminosity mode HISTORY_MSG_LOCAL_CIE_SATCIE;Local CIECAM - Saturation control HISTORY_MSG_LOCAL_CIE_STRLOG;Local CIECAM - Log encoding strength HISTORY_MSG_LOCAL_CIE_WHITES;Local CIECAM - Whites distribution @@ -2684,6 +2690,7 @@ TP_ICM_APPLYHUESATMAP_TOOLTIP;Employ the embedded DCP base table (HueSatMap). Th TP_ICM_APPLYLOOKTABLE;Look table TP_ICM_APPLYLOOKTABLE_TOOLTIP;Employ the embedded DCP look table. The setting is only available if the selected DCP has one. TP_ICM_BPC;Black Point Compensation +TP_ICM_BW;Black and White TP_ICM_DCPILLUMINANT;Illuminant TP_ICM_DCPILLUMINANT_INTERPOLATED;Interpolated TP_ICM_DCPILLUMINANT_TOOLTIP;Select which embedded DCP illuminant to employ. Default is 'interpolated' which is a mix between the two based on white balance. The setting is only available if a dual-illuminant DCP with interpolation support is selected. @@ -2843,7 +2850,7 @@ TP_LOCALLAB_ARTIF_TOOLTIP;ΔE scope threshold increases the range of ΔE scope. TP_LOCALLAB_AUTOGRAY;Auto mean luminance (Yb%) TP_LOCALLAB_AUTOGRAYCIE;Automatic TP_LOCALLAB_AVOID;Avoid color shift -TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space and apply Munsell correction (Uniform Perceptual Lab).\n\nDefault: Munsell only.\nMunsell only, fixes Lab mode hue drifts due to non-linearity, when chromaticity is changed (Uniform Perceptual Lab).\nLab, applies a gamut control, in relative colorimetric, Munsell is then applied.\nXYZ Absolute, applies gamut control, in absolute colorimetric, Munsell is then applied.\nXYZ Relative, applies gamut control, in relative colorimetric, Munsell is then applied. +TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space and apply Munsell correction (Uniform Perceptual Lab).\n\nDefault: Munsell only.\nMunsell only, fixes Lab mode hue drifts due to non-linearity, when chromaticity is changed (Uniform Perceptual Lab).\nLab, applies a gamut control, in relative colorimetric, Munsell is then applied.\nXYZ Absolute, applies gamut control, in absolute colorimetric, Munsell is then applied.\nXYZ Relative, applies gamut control, in relative colorimetric, Munsell is then applied. The result is not the same as Lab. TP_LOCALLAB_AVOIDMUN;Munsell correction only TP_LOCALLAB_AVOIDMUN_TOOLTIP;Munsell correction always disabled when Jz or CAM16 is used. TP_LOCALLAB_AVOIDRAD;Soft radius @@ -2920,9 +2927,10 @@ TP_LOCALLAB_CHRRT;Chroma TP_LOCALLAB_CIE;Color appearance (Cam16 & JzCzHz) TP_LOCALLAB_CIE_SMOOTH_NONE;None TP_LOCALLAB_CIE_SMOOTH_EV;Ev based -TP_LOCALLAB_CIE_SMOOTHFRAME;Highlight attenuation +TP_LOCALLAB_CIE_SMOOTHFRAME;Highlight attenuation & Levels TP_LOCALLAB_CIE_SMOOTH_GAMMA;Slope based TP_LOCALLAB_CIE_SMOOTH_GAMMA ROLLOFF;Gamma based +TP_LOCALLAB_CIE_SMOOTH_LEVELS;Levels TP_LOCALLAB_CIEC;Use Ciecam environment parameters TP_LOCALLAB_CIECAMLOG_TOOLTIP;This module is based on the CIECAM color appearance model which was designed to better simulate how human vision perceives colors under different lighting conditions.\nThe first Ciecam process 'Scene conditions' is carried out by Log encoding, it also uses 'Absolute luminance' at the time of shooting.\nThe second Ciecam process 'Image adjustments' is simplified and uses only 3 variables (local contrast, contrast J, saturation s).\nThe third Ciecam process 'Viewing conditions' adapts the output to the intended viewing conditions (monitor, TV, projector, printer, etc.) so that the chromatic and contrast appearance is preserved across the display environment. TP_LOCALLAB_CIECOLORFRA;Color @@ -3551,9 +3559,14 @@ TP_LOCALLAB_SIGMOIDWHITESCIE_TOOLTIP;Allows you, in Automatic, when the dynamic TP_LOCALLAB_SLOMASKCOL;Slope TP_LOCALLAB_SLOMASK_TOOLTIP;Adjusting Gamma and Slope can provide a soft and artifact-free transformation of the mask by progressively modifying 'L' to avoid any discontinuities. TP_LOCALLAB_SLOPESMOOTH;Gray balance (Slope) +TP_LOCALLAB_SLOPESMOOTHR;Red balance (Slope) +TP_LOCALLAB_SLOPESMOOTHG;Green balance (Slope) +TP_LOCALLAB_SLOPESMOOTHB;Blue balance (Slope) TP_LOCALLAB_SLOSH;Slope TP_LOCALLAB_SMOOTHCIE;Smooth & Tone-Mapping +TP_LOCALLAB_SMOOTHCIE_LUM;Luminosity mode TP_LOCALLAB_SMOOTHCIE_SCA;Scale Yb Scene +TP_LOCALLAB_SMOOTHCIE_YB;Scale Yb Viewing TP_LOCALLAB_SMOOTHCIE_TOOLTIP;Completes the processing carried out by gamma, slope and midtones by causing a slight lowering of lights. Please note this does not replace Highlight reconstruction.\n\nGamma - Slope - based: choice (Standard and Advanced) allows you to simulate a "Tone mapping" using: a) Scene conditions: Black-Ev, White-Ev, Mean luminance (Yb%); b) Viewing conditions: Mean luminance (Yb%).\nScale Yb Scene is function of White-Ev. TP_LOCALLAB_SOFT;Soft Light & Original Retinex TP_LOCALLAB_SOFTM;Soft Light diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index bc0972092..580475c37 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1062,10 +1062,11 @@ void Crop::update(int todo) float stdretie = parent->stdretis[sp]; float fab = 1.f; - float maxicam = -1000.f; + float maxicam = -1000.f; float rdx, rdy, grx, gry, blx, bly = 0.f; float meanx, meany, meanxe, meanye = 0.f; int ill = 2; + int prim = 3; float minCD; float maxCD; float mini; @@ -1155,7 +1156,7 @@ void Crop::update(int todo) huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, parent->previewDeltaE, parent->locallColorMask, parent->locallColorMaskinv, parent->locallExpMask, parent->locallExpMaskinv, parent->locallSHMask, parent->locallSHMaskinv, parent->locallvibMask, parent->localllcMask, parent->locallsharMask, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask, parent->localltmMask, parent->locallblMask, parent->localllogMask, parent->locall_Mask, parent->locallcieMask, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, - meantme, stdtme, meanretie, stdretie, fab, maxicam,rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye,ill, contsig, lightsig, + meantme, stdtme, meanretie, stdretie, fab, maxicam,rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, prim, ill, contsig, lightsig, highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46); LocallabListener::locallabDenoiseLC denoiselc; @@ -1268,7 +1269,7 @@ void Crop::update(int todo) LHutili, HHutili, CHutili, HHutilijz, CHutilijz, LHutilijz, cclocalcurve2, localcutili, rgblocalcurve2, localrgbutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, - meantme, stdtme, meanretie, stdretie, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, ill, contsig, lightsig, + meantme, stdtme, meanretie, stdretie, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, prim, ill, contsig, lightsig, highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46); } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index fbdddf63a..5f8a4df15 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -1280,6 +1280,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) float rdx, rdy, grx, gry, blx, bly = 0.f; float meanx, meany, meanxe, meanye = 0.f; int ill = 2; + int prim = 3; bool istm = params->locallab.spots.at(sp).equiltm && params->locallab.spots.at(sp).exptonemap; bool isreti = params->locallab.spots.at(sp).equilret && params->locallab.spots.at(sp).expreti; //preparation for mean and sigma on current RT-spot @@ -1426,7 +1427,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) LHutili, HHutili, CHutili, HHutilijz, CHutilijz, LHutilijz, cclocalcurve, localcutili, rgblocalcurve, localrgbutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, lastsav, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, - meantm, stdtm, meanreti, stdreti, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, ill, contsig, lightsig, + meantm, stdtm, meanreti, stdreti, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, prim, ill, contsig, lightsig, highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46); diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 3283c8b64..9c6c794f0 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -364,7 +364,7 @@ enum class BlurType { double& huerefblur, double &chromarefblur, double& lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, int &lastsav, bool prevDeltaE, int llColorMask, int llColorMaskinv, int llExpMask, int llExpMaskinv, int llSHMask, int llSHMaskinv, int llvibMask, int lllcMask, int llsharMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask, int lllogMask, int ll_Mask, int llcieMask, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, - float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab, float &maxicam, float &rdx, float &rdy, float &grx, float &gry, float &blx, float &bly, float &meanx, float &meany, float &meanxe, float &meanye, int &ill, float &contsig, float &lightsig, + float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab, float &maxicam, float &rdx, float &rdy, float &grx, float &gry, float &blx, float &bly, float &meanx, float &meany, float &meanxe, float &meanye, int &prim, int &ill, float &contsig, float &lightsig, float &highresi, float &nresi, float &highresi46, float &nresi46, float &Lhighresi, float &Lnresi, float &Lhighresi46, float &Lnresi46); void tone_eqcam2(ImProcFunctions *ipf, Imagefloat *rgb, int whits, int blacks, const Glib::ustring &workingProfile, double scale, bool multithread); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index d7eca81ff..a40f2f146 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -941,8 +941,11 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.smoothciem = 2; } else if (locallab.spots.at(sp).smoothciemet == "gamnorol") { lp.smoothciem = 3; + } else if (locallab.spots.at(sp).smoothciemet == "level") { + lp.smoothciem = 4; } + if (locallab.spots.at(sp).spotMethod == "norm") { lp.fullim = 0; } else if (locallab.spots.at(sp).spotMethod == "exc") { @@ -2610,12 +2613,15 @@ float do_get(float x, bool rolloff_, float mid_gray_scene, float gamma, float dr //Copyright (c) 2023 Thatcher Freeman // Adapted to Rawtherapee Jacques Desmis 25 mars 2024 -void tonemapFreeman(float target_slope, float white_point, float black_point, float mid_gray_scene, float mid_gray_view, bool rolloff, LUTf& lut, int mode, bool scale) +void tonemapFreeman(float target_slope, float target_sloper, float target_slopeg , float target_slopeb, float white_point, float black_point, float mid_gray_scene, float mid_gray_view, bool rolloff, LUTf& lut, LUTf& lutr, LUTf& lutg, LUTf& lutb, int mode, bool scale, bool takeyb) { float dr;//Dynamic Range float b; float c;//black point float gamma; + float gammar; + float gammag; + float gammab; float mid_gray_scene_;//Mean luminance - Scene conditions // mid_gray_view //Mean luminance - Viewing conditions @@ -2630,8 +2636,18 @@ void tonemapFreeman(float target_slope, float white_point, float black_point, fl b = (dr / (mid_gray_scene_ - c)) * (1.f - ((mid_gray_scene_ - c) / dr)) * mid_gray_scene_;//b - ponderate mid_gray_scene taking into account the total DR, and the dark part below the mid_gray_scene gamma = target_slope * (float) std::pow((mid_gray_scene_ + b), 2.0) / (dr * b);//Caculate gamma with slope and mid_gray_scene + gammar = target_sloper * (float) std::pow((mid_gray_scene_ + b), 2.0) / (dr * b);//Caculate gamma with slope and mid_gray_scene + gammag = target_slopeg * (float) std::pow((mid_gray_scene_ + b), 2.0) / (dr * b);//Caculate gamma with slope and mid_gray_scene + gammab = target_slopeb * (float) std::pow((mid_gray_scene_ + b), 2.0) / (dr * b);//Caculate gamma with slope and mid_gray_scene float kmid = 1.f;//general case - if(mode == 3 && target_slope != 1.f) {//case tone-mapping + //float kyb = 1.f; + if(takeyb){ + kmid = mid_gray_scene / mid_gray_view; + kmid = cbrt(kmid); + } + // if(mode == 3 && target_slope != 1.f ) {//case tone-mapping +/* + float midutil = mid_gray_view / mid_gray_scene;//take into account ratio between Yb source and Yb viewing float midk = 1.f; float k_slope = 2.2f; @@ -2639,13 +2655,24 @@ void tonemapFreeman(float target_slope, float white_point, float black_point, fl midk = pow_F(midutil, k_slope * (target_slope - 1.f));//ponderation in function target_slope when "slope user" < 1.f } kmid = midk; + } - if (settings->verbose) { +*/ + if (mode == 3 && settings->verbose) { printf("b=%f gamma=%f slope=%f DynRange=%f kmid=%f black=%f Yb-scale=%f\n", (double) b, (double) gamma, (double) target_slope, (double) dr, (double) kmid, (double) c, (double) mid_gray_scene_); } //lut - take from Alberto Griggio - for (int i = 0; i < 65536; ++i) {// i - value image RGB - lut[i] = do_get(float(i) / 65535.f, rolloff, mid_gray_scene_, gamma, dr, b, c, kmid);//call main function + if(mode == 4) { + for (int i = 0; i < 65536; ++i) {// i - value image RGB + lutr[i] = do_get(float(i) / 65535.f, rolloff, mid_gray_scene_, gammar, dr, b, c, kmid);//call main function + lutg[i] = do_get(float(i) / 65535.f, rolloff, mid_gray_scene_, gammag, dr, b, c, kmid);//call main function + lutb[i] = do_get(float(i) / 65535.f, rolloff, mid_gray_scene_, gammab, dr, b, c, kmid);//call main function + } + } else { + kmid = 1.f; + for (int i = 0; i < 65536; ++i) {// i - value image RGB + lut[i] = do_get(float(i) / 65535.f, rolloff, mid_gray_scene_, gamma, dr, b, c, kmid);//call main function + } } } @@ -13769,7 +13796,7 @@ void ImProcFunctions::Lab_Local( double& huerefblur, double& chromarefblur, double& lumarefblur, double& hueref, double& chromaref, double& lumaref, double& sobelref, int &lastsav, bool prevDeltaE, int llColorMask, int llColorMaskinv, int llExpMask, int llExpMaskinv, int llSHMask, int llSHMaskinv, int llvibMask, int lllcMask, int llsharMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask, int lllogMask, int ll_Mask, int llcieMask, float& minCD, float& maxCD, float& mini, float& maxi, float& Tmean, float& Tsigma, float& Tmin, float& Tmax, - float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab,float &maxicam, float &rdx, float &rdy, float &grx, float &gry, float &blx, float &bly, float &meanx, float &meany, float &meanxe, float &meanye, int &ill, float &contsig, float &lightsig, + float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab,float &maxicam, float &rdx, float &rdy, float &grx, float &gry, float &blx, float &bly, float &meanx, float &meany, float &meanxe, float &meanye, int &prim, int &ill, float &contsig, float &lightsig, float& highresi, float& nresi, float& highresi46, float& nresi46, float& Lhighresi, float& Lnresi, float& Lhighresi46, float& Lnresi46 ) @@ -19961,6 +19988,42 @@ void ImProcFunctions::Lab_Local( } if (params->locallab.spots.at(sp).expprecam && params->locallab.spots.at(sp).modecam == "cam16") { + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.workingProfile); + + float toxyz[3][3] = { + { + static_cast(wprof[0][0] / static_cast(Color::D50x)), + static_cast(wprof[0][1] / static_cast(Color::D50x)), + static_cast(wprof[0][2] / static_cast(Color::D50x)) + }, { + static_cast(wprof[1][0]), + static_cast(wprof[1][1]), + static_cast(wprof[1][2]) + }, { + static_cast(wprof[2][0] / static_cast(Color::D50z)), + static_cast(wprof[2][1] / static_cast(Color::D50z)), + static_cast(wprof[2][2] / static_cast(Color::D50z)) + } + }; + + float maxFactorToxyz = max(toxyz[1][0], toxyz[1][1], toxyz[1][2]); + float equalR = maxFactorToxyz / toxyz[1][0]; + float equalG = maxFactorToxyz / toxyz[1][1]; + float equalB = maxFactorToxyz / toxyz[1][2]; + //inverse matrix user select + double wip[3][3] = { + {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, + {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, + {wiprof[2][0], wiprof[2][1], wiprof[2][2]} + }; + double wp[3][3] = { + {wprof[0][0], wprof[0][1], wprof[0][2]}, + {wprof[1][0], wprof[1][1], wprof[1][2]}, + {wprof[2][0], wprof[2][1], wprof[2][2]} + }; + + Imagefloat *tmpImage = nullptr; tmpImage = new Imagefloat(bfw, bfh); Imagefloat *tmpImagelog = nullptr; @@ -19972,7 +20035,7 @@ void ImProcFunctions::Lab_Local( float gamtone = params->locallab.spots.at(sp).gamjcie; float slotone = params->locallab.spots.at(sp).slopjcie; cmsHTRANSFORM dummy = nullptr; - int prim = 3; + //int prim = 3; int typ = 1; rdx = params->locallab.spots.at(sp).redxl; rdy = params->locallab.spots.at(sp).redyl; @@ -20095,42 +20158,147 @@ void ImProcFunctions::Lab_Local( if(lp.smoothciem == 1) { tone_eqsmooth(this, tmpImage, lp, params->icm.workingProfile, sk, multiThread);//reduce Ev > 0 < 12 - } else if(lp.smoothciem == 2 || lp.smoothciem == 3) {// 2 - only smmoth highlightd - 3 - Tone mapping with slope and mid_grey + } else if(lp.smoothciem == 2 || lp.smoothciem == 3 || lp.smoothciem == 4) {// 2 - only smmoth highlightd - 3 - Tone mapping with slope and mid_grey //TonemapFreeman - Copyright (c) 2023 Thatcher Freeman float mid_gray = 0.01f * lp.sourcegraycie;//Mean luminance Yb Scene float mid_gray_view = 0.01f * lp.targetgraycie;//Mean luminance Yb Viewing + // if(mode == 3 && target_slope != 1.f ) {//case tone-mapping +/* if(params->locallab.spots.at(sp).{ + float midutil = mid_gray_view / mid_gray_scene;//take into account ratio between Yb source and Yb viewing + float midk = 1.f; + float k_slope = 2.2f; + if(target_slope >= 1.f) { + midk = pow_F(midutil, k_slope * (target_slope - 1.f));//ponderation in function target_slope when "slope user" < 1.f + } + kmid = midk; + + } +*/ lp.whiteevjz = LIM(lp.whiteevjz, 0.1f, 31.5f);//limit whiteEv to avoid crash float white_point = xexpf(lp.whiteevjz * std::log(2.f) + xlogf(mid_gray));//lp.whiteevjz White_Ev lp.blackevjz = LIM(lp.blackevjz, -15.5f, -0.2f);//limit BlackEv to avoid crash float black_point = xexpf(lp.blackevjz * std::log(2.f) + xlogf(mid_gray));//lp.blackevjz Black_Ev bool rolloff = true;//only soften highlights float slopegray = 1.f;//slopegray between 0.8 and 1.6 - lineary light the shadows by the user - the gamma is calculated according to slope and the characteristics of the image DR, White, Black + float slopegrayr = 1.f; + float slopegrayg = 1.f; + float slopegrayb = 1.f; int mode = 1; float slopsmoot = 1.f - ((float) params->locallab.spots.at(sp).slopesmo - 1.f);//modify response so when increase slope the grays are becoming lighter + float slopsmootr = 1.f - ((float) params->locallab.spots.at(sp).slopesmor - 1.f); + float slopsmootg = 1.f - ((float) params->locallab.spots.at(sp).slopesmog - 1.f); + float slopsmootb = 1.f - ((float) params->locallab.spots.at(sp).slopesmob - 1.f); + bool takeyb = params->locallab.spots.at(sp).smoothcieyb; + bool lummod = params->locallab.spots.at(sp).smoothcielum; + float maxsl= 4.f;//maximum real slope + float minslider = 0.01f;//minimum slider value > 0.f + float aa = (1.9f - maxsl) / (0.1f - minslider);//interpolation : 1.9f slope value for slider = 0.1f + float bb = 1.9f - 0.1f * aa; + if(lp.smoothciem == 3) {//slope activ, only with choice gamma - slope - based rolloff = false;//allows tone-mapping slope + if(slopsmoot < 0.1f) { + slopsmoot = aa * slopsmoot + bb; + } slopegray = slopsmoot; + slopegrayr = slopsmoot; + slopegrayg = slopsmoot; + slopegrayb = slopsmoot; mode = 3; + }//modify slope + if(lp.smoothciem == 4) {//levels + rolloff = false;//allows tone-mapping slope + if(slopsmootr < 0.1f) { + slopsmootr = aa * slopsmootr + bb; + } + slopegrayr = slopsmootr; + if(slopsmootg < 0.1f) { + slopsmootg = aa * slopsmootg + bb; + } + slopegrayg = slopsmootg; + if(slopsmootb < 0.1f) { + slopsmootb = aa * slopsmootb + bb; + } + slopegrayb = slopsmootb; + mode = 4; } + LUTf lut(65536, LUT_CLIP_OFF);//take from Alberto Griggio + LUTf lutr(65536, LUT_CLIP_OFF); + LUTf lutg(65536, LUT_CLIP_OFF); + LUTf lutb(65536, LUT_CLIP_OFF); bool scale = lp.issmoothcie;//scale Yb mid_gray - WhiteEv and BlavkEv - tonemapFreeman(slopegray, white_point, black_point, mid_gray, mid_gray_view, rolloff, lut, mode, scale); + + tonemapFreeman(slopegray, slopegrayr, slopegrayg, slopegrayb, white_point, black_point, mid_gray, mid_gray_view, rolloff, lut, lutr, lutg, lutb, mode, scale, takeyb); + if(lp.smoothciem == 4) { + if(lummod) {//luminosity mode by Lab conversion #ifdef _OPENMP #pragma omp parallel for #endif - for (int y = 0; y < bfh ; ++ y) {//apply Lut tone-mapping or smooth: thanks to Alberto - gain time. - for (int x = 0; x < bfw ; ++x) { - tmpImage->r(y, x) = 65535.f * lut[tmpImage->r(y, x)]; - tmpImage->g(y, x) = 65535.f * lut[tmpImage->g(y, x)]; - tmpImage->b(y, x) = 65535.f * lut[tmpImage->b(y, x)]; + for (int y = 0; y < bfh ; ++ y) { + for (int x = 0; x < bfw ; ++x) { + float r = tmpImage->r(y, x); + float g = tmpImage->g(y, x); + float b = tmpImage->b(y, x); + //convert to Lab to get a&b before RGB + float xx = toxyz[0][0] * r + toxyz[0][1] * g + toxyz[0][2] * b; + float yy = toxyz[1][0] * r + toxyz[1][1] * g + toxyz[1][2] * b; + float zz = toxyz[2][0] * r + toxyz[2][1] * g + toxyz[2][2] * b; + + float fx = xx < MAXVALF ? Color::cachef[xx] : 327.68f * std::cbrt(xx / MAXVALF); + float fy = yy < MAXVALF ? Color::cachef[yy] : 327.68f * std::cbrt(yy / MAXVALF); + float fz = zz < MAXVALF ? Color::cachef[zz] : 327.68f * std::cbrt(zz / MAXVALF); + + float a_1 = 500.0f * (fx - fy); + float b_1 = 200.0f * (fy - fz); + float rNew = 65535.f * lutr[tmpImage->r(y, x)]; + float gNew = 65535.f * lutg[tmpImage->g(y, x)]; + float bNew = 65535.f * lutb[tmpImage->b(y, x)]; + r += (rNew - r) * equalR; + g += (gNew - g) * equalG; + b += (bNew - b) * equalB; + float newy = toxyz[1][0] * r + toxyz[1][1] * g + toxyz[1][2] * b; + float L_2 = newy <= MAXVALF ? Color::cachefy[newy] : 327.68f * (116.f * xcbrtf(newy / MAXVALF) - 16.f); + float x_, y_, z_; + //calculate RGB with L_2 and old value of a and b + Color::Lab2XYZ(L_2, a_1, b_1, x_, y_, z_) ; + if (params->locallab.spots.at(sp).avoidgamutMethod != "NONE") {//possibility of deactivating to see usefulness. is it necessary? + Color::gamutmap(x_, y_, z_, wp);//if none disabled + } + Color::xyz2rgb(x_, y_, z_, r, g, b, wip); + tmpImage->r(y, x) = r; + tmpImage->g(y, x) = g; + tmpImage->b(y, x) = b; + } + } + } else {//RGG case + #ifdef _OPENMP + #pragma omp parallel for +#endif + for (int y = 0; y < bfh ; ++ y) {//apply Lut tone-mapping or smooth: thanks to Alberto - gain time. + for (int x = 0; x < bfw ; ++x) { + tmpImage->r(y, x) = 65535.f * lutr[tmpImage->r(y, x)]; + tmpImage->g(y, x) = 65535.f * lutg[tmpImage->g(y, x)]; + tmpImage->b(y, x) = 65535.f * lutb[tmpImage->b(y, x)]; + } + } + } + } else {//Slope case + #ifdef _OPENMP + #pragma omp parallel for +#endif + for (int y = 0; y < bfh ; ++ y) {//apply Lut tone-mapping or smooth: thanks to Alberto - gain time. + for (int x = 0; x < bfw ; ++x) { + tmpImage->r(y, x) = 65535.f * lut[tmpImage->r(y, x)]; + tmpImage->g(y, x) = 65535.f * lut[tmpImage->g(y, x)]; + tmpImage->b(y, x) = 65535.f * lut[tmpImage->b(y, x)]; + } } } - } - rgb2lab(*tmpImage, *bufexpfin, params->icm.workingProfile); delete tmpImage; @@ -20220,6 +20388,19 @@ void ImProcFunctions::Lab_Local( ImProcFunctions::localContrast(bufexpfin.get(), bufexpfin->L, localContrastParams, fftwlc, sk); } + if (params->locallab.spots.at(sp).bwcie) { +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) if (multiThread) +#endif + + for (int ir = 0; ir < bfh; ir++) { + for (int jr = 0; jr < bfw; jr++) { + bufexpfin->a[ir][jr] = 0.f; + bufexpfin->b[ir][jr] = 0.f; + } + } + } + const float repart = 1.0 - 0.01 * params->locallab.spots.at(sp).reparcie; int bw = bufexporig->W; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index cd80a8980..763decb75 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -4435,11 +4435,14 @@ LocallabParams::LocallabSpot::LocallabSpot() : comprcieauto(false), normcie(true), gamutcie(true), + bwcie(false), sigcie(true), logcie(false), satcie(true), logcieq(false), smoothcie(false), + smoothcieyb(false), + smoothcielum(false), logjz(false), sigjz(false), sigq(false), @@ -4624,6 +4627,9 @@ LocallabParams::LocallabSpot::LocallabSpot() : gamjcie(2.4), slopjcie(12.923), slopesmo(1.), + slopesmor(1.), + slopesmog(1.), + slopesmob(1.), midtcie(0), grexl(0.1596), greyl(0.8404), @@ -5392,11 +5398,14 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && comprcieauto == other.comprcieauto && normcie == other.normcie && gamutcie == other.gamutcie + && bwcie == other.bwcie && sigcie == other.sigcie && logcie == other.logcie && satcie == other.satcie && logcieq == other.logcieq && smoothcie == other.smoothcie + && smoothcieyb == other.smoothcieyb + && smoothcielum == other.smoothcielum && logjz == other.logjz && sigjz == other.sigjz && sigq == other.sigq @@ -5463,6 +5472,9 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && gamjcie == other.gamjcie && slopjcie == other.slopjcie && slopesmo == other.slopesmo + && slopesmor == other.slopesmor + && slopesmog == other.slopesmog + && slopesmob == other.slopesmob && midtcie == other.midtcie && redxl == other.redxl && redyl == other.redyl @@ -7334,11 +7346,14 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->comprcieauto, "Locallab", "comprcieauto_" + index_str, spot.comprcieauto, keyFile); saveToKeyfile(!pedited || spot_edited->normcie, "Locallab", "normcie_" + index_str, spot.normcie, keyFile); saveToKeyfile(!pedited || spot_edited->gamutcie, "Locallab", "gamutcie_" + index_str, spot.gamutcie, keyFile); + saveToKeyfile(!pedited || spot_edited->bwcie, "Locallab", "bwcie_" + index_str, spot.bwcie, keyFile); saveToKeyfile(!pedited || spot_edited->sigcie, "Locallab", "sigcie_" + index_str, spot.sigcie, keyFile); saveToKeyfile(!pedited || spot_edited->logcie, "Locallab", "logcie_" + index_str, spot.logcie, keyFile); saveToKeyfile(!pedited || spot_edited->satcie, "Locallab", "satcie_" + index_str, spot.satcie, keyFile); saveToKeyfile(!pedited || spot_edited->logcieq, "Locallab", "logcieq_" + index_str, spot.logcieq, keyFile); saveToKeyfile(!pedited || spot_edited->smoothcie, "Locallab", "smoothcie_" + index_str, spot.smoothcie, keyFile); + saveToKeyfile(!pedited || spot_edited->smoothcieyb, "Locallab", "smoothcieyb_" + index_str, spot.smoothcieyb, keyFile); + saveToKeyfile(!pedited || spot_edited->smoothcielum, "Locallab", "smoothcielum_" + index_str, spot.smoothcielum, keyFile); saveToKeyfile(!pedited || spot_edited->logjz, "Locallab", "Logjz_" + index_str, spot.logjz, keyFile); saveToKeyfile(!pedited || spot_edited->sigjz, "Locallab", "Sigjz_" + index_str, spot.sigjz, keyFile); saveToKeyfile(!pedited || spot_edited->sigq, "Locallab", "Sigq_" + index_str, spot.sigq, keyFile); @@ -7405,6 +7420,9 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->gamjcie, "Locallab", "gamjcie_" + index_str, spot.gamjcie, keyFile); saveToKeyfile(!pedited || spot_edited->slopjcie, "Locallab", "slopjcie_" + index_str, spot.slopjcie, keyFile); saveToKeyfile(!pedited || spot_edited->slopesmo, "Locallab", "slopesmo_" + index_str, spot.slopesmo, keyFile); + saveToKeyfile(!pedited || spot_edited->slopesmor, "Locallab", "slopesmor_" + index_str, spot.slopesmor, keyFile); + saveToKeyfile(!pedited || spot_edited->slopesmog, "Locallab", "slopesmog_" + index_str, spot.slopesmog, keyFile); + saveToKeyfile(!pedited || spot_edited->slopesmob, "Locallab", "slopesmob_" + index_str, spot.slopesmob, keyFile); saveToKeyfile(!pedited || spot_edited->midtcie, "Locallab", "midtcie_" + index_str, spot.midtcie, keyFile); saveToKeyfile(!pedited || spot_edited->redxl, "Locallab", "redxl_" + index_str, spot.redxl, keyFile); saveToKeyfile(!pedited || spot_edited->redyl, "Locallab", "redyl_" + index_str, spot.redyl, keyFile); @@ -9687,11 +9705,14 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "comprcieauto_" + index_str, spot.comprcieauto, spotEdited.comprcieauto); assignFromKeyfile(keyFile, "Locallab", "normcie_" + index_str, spot.normcie, spotEdited.normcie); assignFromKeyfile(keyFile, "Locallab", "gamutcie_" + index_str, spot.gamutcie, spotEdited.gamutcie); + assignFromKeyfile(keyFile, "Locallab", "bwcie_" + index_str, spot.bwcie, spotEdited.bwcie); assignFromKeyfile(keyFile, "Locallab", "sigcie_" + index_str, spot.sigcie, spotEdited.sigcie); assignFromKeyfile(keyFile, "Locallab", "logcie_" + index_str, spot.logcie, spotEdited.logcie); assignFromKeyfile(keyFile, "Locallab", "satcie_" + index_str, spot.satcie, spotEdited.satcie); assignFromKeyfile(keyFile, "Locallab", "logcieq_" + index_str, spot.logcieq, spotEdited.logcieq); assignFromKeyfile(keyFile, "Locallab", "smoothcie_" + index_str, spot.smoothcie, spotEdited.smoothcie); + assignFromKeyfile(keyFile, "Locallab", "smoothcieyb_" + index_str, spot.smoothcieyb, spotEdited.smoothcieyb); + assignFromKeyfile(keyFile, "Locallab", "smoothcielum_" + index_str, spot.smoothcielum, spotEdited.smoothcielum); assignFromKeyfile(keyFile, "Locallab", "Logjz_" + index_str, spot.logjz, spotEdited.logjz); assignFromKeyfile(keyFile, "Locallab", "Sigjz_" + index_str, spot.sigjz, spotEdited.sigjz); assignFromKeyfile(keyFile, "Locallab", "Sigq_" + index_str, spot.sigq, spotEdited.sigq); @@ -9767,7 +9788,10 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "gamjcie_" + index_str, spot.gamjcie, spotEdited.gamjcie); assignFromKeyfile(keyFile, "Locallab", "slopjcie_" + index_str, spot.slopjcie, spotEdited.slopjcie); assignFromKeyfile(keyFile, "Locallab", "slopesmo_" + index_str, spot.slopesmo, spotEdited.slopesmo); + assignFromKeyfile(keyFile, "Locallab", "slopesmor_" + index_str, spot.slopesmor, spotEdited.slopesmor); + assignFromKeyfile(keyFile, "Locallab", "slopesmog_" + index_str, spot.slopesmog, spotEdited.slopesmog); assignFromKeyfile(keyFile, "Locallab", "midtcie_" + index_str, spot.midtcie, spotEdited.midtcie); + assignFromKeyfile(keyFile, "Locallab", "slopesmob_" + index_str, spot.slopesmob, spotEdited.slopesmob); assignFromKeyfile(keyFile, "Locallab", "grexl_" + index_str, spot.grexl, spotEdited.grexl); assignFromKeyfile(keyFile, "Locallab", "greyl_" + index_str, spot.greyl, spotEdited.greyl); assignFromKeyfile(keyFile, "Locallab", "bluxl_" + index_str, spot.bluxl, spotEdited.bluxl); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 0eb991933..d1cad0a5d 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1663,11 +1663,14 @@ struct LocallabParams { bool comprcieauto; bool normcie; bool gamutcie; + bool bwcie; bool sigcie; bool logcie; bool satcie; bool logcieq; bool smoothcie; + bool smoothcieyb; + bool smoothcielum; bool logjz; bool sigjz; bool sigq; @@ -1734,6 +1737,9 @@ struct LocallabParams { double gamjcie; double slopjcie; double slopesmo; + double slopesmor; + double slopesmog; + double slopesmob; int midtcie; double grexl; double greyl; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index e76d17336..e27f372ae 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -448,6 +448,7 @@ public: double meanylc; double meanxelc; double meanyelc; + int primlc; }; struct locallabcieSIG { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 241d628e9..06194e437 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1260,6 +1260,7 @@ private: float rdx, rdy, grx, gry, blx, bly = 0.f; float meanx, meany, meanxe, meanye = 0.f; int ill = 2; + int prim = 3; if (params.locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reservView.get(), reservView.get(), 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge, locwavCurveden, locwavdenutili); @@ -1341,7 +1342,7 @@ private: LHutili, HHutili, CHutili, HHutilijz, CHutilijz, LHutilijz, cclocalcurve, localcutili, rgblocalcurve, localrgbutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, - meantme, stdtme, meanretie, stdretie, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, ill, contsig, lightsig, + meantme, stdtme, meanretie, stdretie, fab, maxicam, rdx, rdy, grx, gry, blx, bly, meanx, meany, meanxe, meanye, prim, ill, contsig, lightsig, highresi, nresi, highresi46, nresi46, Lhighresi, Lnresi, Lhighresi46, Lnresi46 ); diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 999653ad7..bc5e2144b 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -1187,8 +1187,9 @@ void Locallab::cieChanged(const std::vector &cielc, int selspot) const double m2 = cie_lc.at(selspot).meanylc; const double me1 = cie_lc.at(selspot).meanxelc; const double me2 = cie_lc.at(selspot).meanyelc; + const int pri = cie_lc.at(selspot).primlc; - expcie.updateiPrimloc(r1, r2, g1, g2, b1, b2, w1, w2, m1, m2, me1, me2); + expcie.updateiPrimloc(r1, r2, g1, g2, b1, b2, w1, w2, m1, m2, me1, me2, pri); } } diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 4a0e68564..1d43b6ef1 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -77,7 +77,12 @@ protected: rtengine::ProcEvent Evlocallabslopjcie; rtengine::ProcEvent Evlocallabmidtcie; rtengine::ProcEvent Evlocallabslopesmo; + rtengine::ProcEvent Evlocallabslopesmor; + rtengine::ProcEvent Evlocallabslopesmog; + rtengine::ProcEvent Evlocallabslopesmob; rtengine::ProcEvent Evlocallabsmoothcie; + rtengine::ProcEvent Evlocallabsmoothcieyb; + rtengine::ProcEvent Evlocallabsmoothcielum; rtengine::ProcEvent Evlocallabsmoothciemet; rtengine::ProcEvent Evlocallabsigcie; rtengine::ProcEvent Evlocallabillcie; @@ -98,6 +103,7 @@ protected: rtengine::ProcEvent Evlocallabbluyl; rtengine::ProcEvent EvlocallabGridciexy; rtengine::ProcEvent Evlocallabgamutcie; + rtengine::ProcEvent Evlocallabbwcie; rtengine::ProcEvent Evlocallabexpprecam; rtengine::ProcEvent Evlocallablightsigqcie; rtengine::ProcEvent Evlocallabcontsigqcie; @@ -1690,10 +1696,15 @@ private: Adjuster* const slopjcie; Adjuster* const midtcie; Gtk::CheckButton* const smoothcie; + Gtk::CheckButton* const smoothcieyb; + Gtk::CheckButton* const smoothcielum; ToolParamBlock* const ciesmoothBox; Gtk::Box* smoothBox; MyComboBoxText* const smoothciemet; Adjuster* const slopesmo; + Adjuster* const slopesmor; + Adjuster* const slopesmog; + Adjuster* const slopesmob; Adjuster* const whitescie; Adjuster* const blackscie; @@ -1724,6 +1735,8 @@ private: Gtk::CheckButton* const gamutcie; Adjuster* const shiftxl; Adjuster* const shiftyl; + Gtk::Box* bwcieBox; + Gtk::CheckButton* const bwcie; Gtk::Frame* const sigmoidjzFrame; Gtk::Frame* const sigmoid2Frame; @@ -1824,7 +1837,7 @@ private: ThresholdAdjuster* const csThresholdcie; int nextcomprciecount = 0; - sigc::connection AutograycieConn, primMethodconn, illMethodconn, smoothciemetconn, catMethodconn, forcejzConn, forcebwConn, qtojConn, showmaskcieMethodConn, enacieMaskConn, enacieMaskallConn, jabcieConn, sursourcieconn, surroundcieconn, modecieconn, modecamconn, comprcieautoconn, normcieconn, logcieconn, satcieconn, logcieqconn,smoothcieconn, logjzconn, sigjzconn, sigqconn, chjzcieconn, toneMethodcieConn, toneMethodcieConn2, toolcieConn, bwevMethodConn, fftcieMaskConn, gamutcieconn, expprecamconn, sigcieconn; + sigc::connection AutograycieConn, primMethodconn, illMethodconn, smoothciemetconn, catMethodconn, forcejzConn, forcebwConn, qtojConn, showmaskcieMethodConn, enacieMaskConn, enacieMaskallConn, jabcieConn, sursourcieconn, surroundcieconn, modecieconn, modecamconn, comprcieautoconn, normcieconn, logcieconn, satcieconn, logcieqconn,smoothcieconn, smoothcieybconn,smoothcielumconn, logjzconn, sigjzconn, sigqconn, chjzcieconn, toneMethodcieConn, toneMethodcieConn2, toolcieConn, bwevMethodConn, fftcieMaskConn, gamutcieconn, bwcieconn, expprecamconn, sigcieconn; public: Locallabcie(); ~Locallabcie(); @@ -1860,7 +1873,7 @@ public: void bwevMethodChanged(); void updateAutocompute(const float blackev, const float whiteev, const float sourceg, const float sourceab, const float targetg, const float jz1); void updatePrimloc(const float redx, const float redy, const float grex, const float grey, const float blux, const float bluy); - void updateiPrimloc(const float r_x, const float r_y, const float g_x, const float g_y, const float b_x, const float b_y, const float w_x, const float w_y, const float m_x, const float m_y, const float me_x, const float me_y); + void updateiPrimloc(const float r_x, const float r_y, const float g_x, const float g_y, const float b_x, const float b_y, const float w_x, const float w_y, const float m_x, const float m_y, const float me_x, const float me_y, const int pri_); void updatesigloc(const float cont_sig, const float light_sig); private: @@ -1877,6 +1890,7 @@ private: void comprcieautoChanged(); void normcieChanged(); void gamutcieChanged(); + void bwcieChanged(); void illMethodChanged(); void smoothciemetChanged(); void primMethodChanged(); @@ -1885,6 +1899,8 @@ private: void satcieChanged(); void logcieqChanged(); void smoothcieChanged(); + void smoothcieybChanged(); + void smoothcielumChanged(); void sigcieChanged(); void logjzChanged(); void sigjzChanged(); diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 5417271ab..17b5d3ead 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -7618,10 +7618,15 @@ Locallabcie::Locallabcie(): slopjcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGSLOPJCIE"), 0., 500., 0.01, 12.923))), midtcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MIDTCIE"), -100, 100, 1, 0))), smoothcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SMOOTHCIE_SCA")))), + smoothcieyb(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SMOOTHCIE_YB")))), + smoothcielum(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SMOOTHCIE_LUM")))), ciesmoothBox(Gtk::manage(new ToolParamBlock())), smoothBox(Gtk::manage(new Gtk::Box())), smoothciemet(Gtk::manage(new MyComboBoxText())), - slopesmo(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOPESMOOTH"), 0.6, 1.6, 0.01, 1.))), + slopesmo(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOPESMOOTH"), 0.01, 1.6, 0.01, 1.))), + slopesmor(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOPESMOOTHR"), 0.01, 1.6, 0.01, 1.))), + slopesmog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOPESMOOTHG"), 0.01, 1.6, 0.01, 1.))), + slopesmob(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOPESMOOTHB"), 0.01, 1.6, 0.01, 1.))), whitescie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGWHITESCIE"), -100, 100, 1, 0))), blackscie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGBLACKSSCIE"), -100, 100, 1, 0))), willBox(Gtk::manage(new Gtk::Box())), @@ -7651,6 +7656,8 @@ Locallabcie::Locallabcie(): gamutcie(Gtk::manage(new Gtk::CheckButton(M("TP_ICM_GAMUT")))), shiftxl(Gtk::manage(new Adjuster(M("TC_LOCALLAB_PRIM_SHIFTX"), -0.20, 0.20, 0.0001, 0.))), shiftyl(Gtk::manage(new Adjuster(M("TC_LOCALLAB_PRIM_SHIFTY"), -0.20, 0.20, 0.0001, 0.))), + bwcieBox(Gtk::manage(new Gtk::Box())), + bwcie(Gtk::manage(new Gtk::CheckButton(M("TP_ICM_BW")))), sigmoidjzFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SIGJZFRA")))), sigmoid2Frame(Gtk::manage(new Gtk::Frame(M("")))), @@ -7770,7 +7777,12 @@ Locallabcie::Locallabcie(): Evlocallabslopjcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SLOP"); Evlocallabmidtcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_MIDT"); Evlocallabslopesmo = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SLOPESMO"); + Evlocallabslopesmor = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SLOPESMOR"); + Evlocallabslopesmog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SLOPESMOG"); + Evlocallabslopesmob = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SLOPESMOB"); Evlocallabsmoothcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SMOOTH"); + Evlocallabsmoothcieyb = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SMOOTHYB"); + Evlocallabsmoothcielum = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SMOOTH_LUM"); Evlocallabsigcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_SIG"); Evlocallabillcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_ILL"); Evlocallabprimcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_PRIM"); @@ -7785,6 +7797,7 @@ Locallabcie::Locallabcie(): Evlocallabbluyl = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_BLUYL"); EvlocallabGridciexy = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_LABGRIDCIE"); Evlocallabgamutcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_GAMUTCIE"); + Evlocallabbwcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_BWCIE"); Evlocallabexpprecam = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_EXPPRECAM"); Evlocallablightsigqcie = m->newEvent(AUTOEXP, ""); Evlocallabcontsigqcie = m->newEvent(AUTOEXP, ""); @@ -8009,6 +8022,10 @@ Locallabcie::Locallabcie(): ToolParamBlock* const signormBox = Gtk::manage(new ToolParamBlock()); ToolParamBlock* const sigfraBox = Gtk::manage(new ToolParamBlock()); + bwcieBox->pack_start(*bwcie, Gtk::PACK_EXPAND_WIDGET); + + bwcieconn = bwcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::bwcieChanged)); + modeHBoxbwev->set_spacing(2); ToolParamBlock* const gamcieBox = Gtk::manage(new ToolParamBlock()); Gtk::Label* modeLabelbwev = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_SIGMOIDQJ") + ":")); @@ -8041,9 +8058,15 @@ Locallabcie::Locallabcie(): smoothciemet->append(M("TP_LOCALLAB_CIE_SMOOTH_EV")); smoothciemet->append(M("TP_LOCALLAB_CIE_SMOOTH_GAMMA ROLLOFF")); smoothciemet->append(M("TP_LOCALLAB_CIE_SMOOTH_GAMMA")); + smoothciemet->append(M("TP_LOCALLAB_CIE_SMOOTH_LEVELS")); smoothciemet->set_active(0); ciesmoothBox->pack_start(*smoothBox); ciesmoothBox->pack_start(*slopesmo); + ciesmoothBox->pack_start(*slopesmor); + ciesmoothBox->pack_start(*slopesmog); + ciesmoothBox->pack_start(*slopesmob); + ciesmoothBox->pack_start(*smoothcielum); + ciesmoothBox->pack_start(*smoothcieyb); ciesmoothBox->pack_start(*smoothcie); smoothciemetconn = smoothciemet->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::smoothciemetChanged)); @@ -8065,6 +8088,7 @@ Locallabcie::Locallabcie(): colorBox->pack_start(*shiftxl); colorBox->pack_start(*shiftyl); colorFramecie->add(*colorBox); + primillBox->pack_start(*bwcieBox); primillBox->pack_start(*colorFramecie); primillFrame->add(*primillBox); gamcieBox->pack_start(*primillFrame); @@ -8284,6 +8308,8 @@ Locallabcie::Locallabcie(): satcieconn = satcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::satcieChanged)); logcieqconn = logcieq->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::logcieqChanged)); smoothcieconn = smoothcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::smoothcieChanged)); + smoothcieybconn = smoothcieyb->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::smoothcieybChanged)); + smoothcielumconn = smoothcielum->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::smoothcielumChanged)); logjzconn = logjz->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::logjzChanged)); sigjzconn = sigjz->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::sigjzChanged)); sigqconn = sigq->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::sigqChanged)); @@ -8407,6 +8433,9 @@ Locallabcie::Locallabcie(): catadcie->setAdjusterListener(this); slopesmo->setAdjusterListener(this); + slopesmor->setAdjusterListener(this); + slopesmog->setAdjusterListener(this); + slopesmob->setAdjusterListener(this); Gtk::Box *TittleVBoxcam16; TittleVBoxcam16 = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); @@ -8891,6 +8920,7 @@ void Locallabcie::disableListener() normcieconn.block(true); expprecamconn.block(true); gamutcieconn.block(true); + bwcieconn.block(true); primMethodconn.block(true); illMethodconn.block(true); smoothciemetconn.block(true); @@ -8900,6 +8930,8 @@ void Locallabcie::disableListener() satcieconn.block(true); logcieqconn.block(true); smoothcieconn.block(true); + smoothcieybconn.block(true); + smoothcielumconn.block(true); logjzconn.block(true); sigjzconn.block(true); sigqconn.block(true); @@ -8930,6 +8962,7 @@ void Locallabcie::enableListener() normcieconn.block(false); expprecamconn.block(false); gamutcieconn.block(false); + bwcieconn.block(false); primMethodconn.block(false); illMethodconn.block(false); smoothciemetconn.block(false); @@ -8939,6 +8972,8 @@ void Locallabcie::enableListener() satcieconn.block(false); logcieqconn.block(false); smoothcieconn.block(false); + smoothcieybconn.block(false); + smoothcielumconn.block(false); logjzconn.block(false); sigjzconn.block(false); sigqconn.block(false); @@ -9173,6 +9208,8 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE smoothciemet->set_active(2); } else if (spot.smoothciemet == "gamnorol") { smoothciemet->set_active(3); + } else if (spot.smoothciemet == "level") { + smoothciemet->set_active(4); } @@ -9239,7 +9276,7 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE primMethod->set_active(11); illMethod->set_active(4); } else if (spot.primMethod == "free") { - primMethod->set_active(9); + primMethod->set_active(12); illMethod->set_sensitive(true); } @@ -9259,11 +9296,14 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE normcie->set_active(spot.normcie); gamutcie->set_active(spot.gamutcie); + bwcie->set_active(spot.bwcie); sigcie->set_active(spot.sigcie); logcie->set_active(spot.logcie); satcie->set_active(spot.satcie); logcieq->set_active(spot.logcieq); smoothcie->set_active(spot.smoothcie); + smoothcieyb->set_active(spot.smoothcieyb); + smoothcielum->set_active(spot.smoothcielum); logjz->set_active(spot.logjz); sigjz->set_active(spot.sigjz); sigq->set_active(spot.sigq); @@ -9277,6 +9317,7 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE normcieChanged(); expprecamChanged(); gamutcieChanged(); + bwcieChanged(); sigcieChanged(); comprcieautoChanged(); sigqChanged(); @@ -9284,6 +9325,8 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE satcieChanged(); logcieqChanged(); smoothcieChanged(); + smoothcieybChanged(); + smoothcielumChanged(); primMethodChanged(); illMethodChanged(); smoothciemetChanged(); @@ -9371,6 +9414,9 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE gamjcie->setValue(spot.gamjcie); slopjcie->setValue(spot.slopjcie); slopesmo->setValue(spot.slopesmo); + slopesmor->setValue(spot.slopesmor); + slopesmog->setValue(spot.slopesmog); + slopesmob->setValue(spot.slopesmob); midtcie->setValue(spot.midtcie); whitescie->setValue(spot.whitescie); blackscie->setValue(spot.blackscie); @@ -9524,11 +9570,14 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.comprcieauto = comprcieauto->get_active(); spot.normcie = normcie->get_active(); spot.gamutcie = gamutcie->get_active(); + spot.bwcie = bwcie->get_active(); spot.sigcie = sigcie->get_active(); spot.logcie = logcie->get_active(); spot.satcie = satcie->get_active(); spot.logcieq = logcieq->get_active(); spot.smoothcie = smoothcie->get_active(); + spot.smoothcieyb = smoothcieyb->get_active(); + spot.smoothcielum = smoothcielum->get_active(); spot.logjz = logjz->get_active(); spot.sigjz = sigjz->get_active(); spot.chjzcie = chjzcie->get_active(); @@ -9560,6 +9609,8 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.smoothciemet = "gam"; } else if (smoothciemet->get_active_row_number() == 3) { spot.smoothciemet = "gamnorol"; + } else if (smoothciemet->get_active_row_number() == 4) { + spot.smoothciemet = "level"; } if (illMethod->get_active_row_number() == 0) { @@ -9689,6 +9740,9 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.gamjcie = gamjcie->getValue(); spot.slopjcie = slopjcie->getValue(); spot.slopesmo = slopesmo->getValue(); + spot.slopesmor = slopesmor->getValue(); + spot.slopesmog = slopesmog->getValue(); + spot.slopesmob = slopesmob->getValue(); spot.midtcie = midtcie->getIntValue(); spot.whitescie = whitescie->getIntValue(); spot.blackscie = blackscie->getIntValue(); @@ -9823,7 +9877,7 @@ void Locallabcie::updatesigloc(const float cont_sig, const float light_sig) -void Locallabcie::updateiPrimloc(const float r_x, const float r_y, const float g_x, const float g_y, const float b_x, const float b_y, const float w_x, const float w_y, const float m_x, const float m_y, const float me_x, const float me_y) +void Locallabcie::updateiPrimloc(const float r_x, const float r_y, const float g_x, const float g_y, const float b_x, const float b_y, const float w_x, const float w_y, const float m_x, const float m_y, const float me_x, const float me_y, const int pri_) { nextrx = r_x; nextry = r_y; @@ -10058,6 +10112,24 @@ void Locallabcie::gamutcieChanged() } +void Locallabcie::bwcieChanged() +{ + + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (bwcie->get_active()) { + listener->panelChanged(Evlocallabbwcie, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabbwcie, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } + +} + + void Locallabcie::expprecamChanged() { if (isLocActivated && exp->getEnabled()) { @@ -10164,6 +10236,36 @@ void Locallabcie::smoothcieChanged() } } +void Locallabcie::smoothcieybChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (smoothcieyb->get_active()) { + listener->panelChanged(Evlocallabsmoothcieyb, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabsmoothcieyb, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + +void Locallabcie::smoothcielumChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (smoothcielum->get_active()) { + listener->panelChanged(Evlocallabsmoothcielum, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } else { + listener->panelChanged(Evlocallabsmoothcielum, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(getSpotName()) + ")"); + } + } + } +} + void Locallabcie::logjzChanged() { if (isLocActivated && exp->getEnabled()) { @@ -10541,10 +10643,28 @@ void Locallabcie::smoothciemetChanged() { if(smoothciemet->get_active_row_number() == 3) { slopesmo->show(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->show(); + smoothcieyb->hide(); + smoothcielum->hide(); + } else if(smoothciemet->get_active_row_number() == 4) { + slopesmo->hide(); + slopesmor->show(); + slopesmog->show(); + slopesmob->show(); + smoothcie->show(); + smoothcielum->show(); + smoothcieyb->show(); } else { slopesmo->hide(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->hide(); + smoothcielum->hide(); + smoothcieyb->hide(); } if (listener) { @@ -10731,7 +10851,12 @@ void Locallabcie::updateGUIToMode(const modeType new_type) comprcieauto->hide(); comprBox->show(); slopesmo->hide(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->hide(); + smoothcielum->hide(); + smoothcieyb->hide(); if (modecam->get_active_row_number() == 0) { bevwevFrame->show(); @@ -10743,10 +10868,28 @@ void Locallabcie::updateGUIToMode(const modeType new_type) expgradcie->hide(); if(smoothciemet->get_active_row_number() == 3) { slopesmo->show(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->show(); + smoothcielum->hide(); + smoothcieyb->hide(); + } else if(smoothciemet->get_active_row_number() == 4) { + slopesmo->hide(); + slopesmor->show(); + slopesmog->show(); + slopesmob->show(); + smoothcie->show(); + smoothcielum->show(); + smoothcieyb->show(); } else { slopesmo->hide(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->hide(); + smoothcielum->hide(); + smoothcieyb->hide(); } } @@ -10853,10 +10996,28 @@ void Locallabcie::updateGUIToMode(const modeType new_type) if(smoothciemet->get_active_row_number() == 3) { slopesmo->show(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->show(); + smoothcielum->hide(); + smoothcieyb->hide(); + } else if(smoothciemet->get_active_row_number() == 4) { + slopesmo->hide(); + slopesmor->show(); + slopesmog->show(); + slopesmob->show(); + smoothcie->show(); + smoothcielum->show(); + smoothcieyb->show(); } else { slopesmo->hide(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->hide(); + smoothcielum->hide(); + smoothcieyb->hide(); } } @@ -10967,10 +11128,28 @@ void Locallabcie::updateGUIToMode(const modeType new_type) if(smoothciemet->get_active_row_number() == 3) { slopesmo->show(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->show(); + smoothcielum->hide(); + smoothcieyb->hide(); + } else if(smoothciemet->get_active_row_number() == 4) { + slopesmo->hide(); + slopesmor->show(); + slopesmog->show(); + slopesmob->show(); + smoothcie->show(); + smoothcielum->show(); + smoothcieyb->show(); } else { slopesmo->hide(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->hide(); + smoothcielum->hide(); + smoothcieyb->hide(); } } @@ -11021,10 +11200,28 @@ void Locallabcie::updateGUIToMode(const modeType new_type) if(smoothciemet->get_active_row_number() == 3) { slopesmo->show(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->show(); + smoothcielum->hide(); + smoothcieyb->hide(); + } else if(smoothciemet->get_active_row_number() == 4) { + slopesmo->hide(); + slopesmor->show(); + slopesmog->show(); + slopesmob->show(); + smoothcie->show(); + smoothcielum->show(); + smoothcieyb->show(); } else { slopesmo->hide(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->hide(); + smoothcielum->hide(); + smoothcieyb->hide(); } } @@ -11125,10 +11322,28 @@ void Locallabcie::updatecieGUI() if(smoothciemet->get_active_row_number() == 3) { slopesmo->show(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->show(); + smoothcielum->hide(); + smoothcieyb->hide(); + } else if(smoothciemet->get_active_row_number() == 4) { + slopesmo->hide(); + slopesmor->show(); + slopesmog->show(); + slopesmob->show(); + smoothcie->show(); + smoothcielum->show(); + smoothcieyb->show(); } else { slopesmo->hide(); + slopesmor->hide(); + slopesmog->hide(); + slopesmob->hide(); smoothcie->hide(); + smoothcielum->hide(); + smoothcieyb->hide(); } } @@ -11241,6 +11456,7 @@ void Locallabcie::convertParamToSimple() whiteEvjz->setValue(defSpot.whiteEvjz); whitescie->setValue(defSpot.whitescie); blackscie->setValue(defSpot.blackscie); + bwcie->set_active(defSpot.bwcie); sigq->set_active(defSpot.sigq); //sigq->set_active(defSpot.sigq); @@ -11271,7 +11487,7 @@ void Locallabcie::convertParamToNormal() normcie->set_active(defSpot.normcie); logcieq->set_active(defSpot.logcieq); logcie->set_active(defSpot.logcie); - + bwcie->set_active(defSpot.bwcie); //contsigqcie->setValue(defSpot.contsigqcie); colorflcie->setValue(defSpot.colorflcie); lightqcie->setValue(defSpot.lightqcie); @@ -11399,7 +11615,9 @@ void Locallabcie::setDefaults(const rtengine::procparams::ProcParams* defParams, blackscie->setDefault(defSpot.blackscie); slopjcie->setDefault(defSpot.slopjcie); slopesmo->setDefault(defSpot.slopesmo); - midtcie->setDefault(defSpot.midtcie); + slopesmor->setDefault(defSpot.slopesmo); + slopesmog->setDefault(defSpot.slopesmog); + slopesmob->setDefault(defSpot.slopesmob); sigmoidldajzcie->setDefault(defSpot.sigmoidldajzcie); sigmoidthjzcie->setDefault(defSpot.sigmoidthjzcie); sigmoidbljzcie->setDefault(defSpot.sigmoidbljzcie); @@ -11943,6 +12161,28 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } } + if (a == slopesmor) { + if (listener) { + listener->panelChanged(Evlocallabslopesmor, + slopesmor->getTextValue() + spName); + } + } + + + if (a == slopesmog) { + if (listener) { + listener->panelChanged(Evlocallabslopesmog, + slopesmog->getTextValue() + spName); + } + } + + if (a == slopesmob) { + if (listener) { + listener->panelChanged(Evlocallabslopesmob, + slopesmob->getTextValue() + spName); + } + } + if (a == midtcie) { if (listener) { listener->panelChanged(Evlocallabmidtcie, diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 02d405f76..66ea3f9aa 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1736,11 +1736,14 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).comprcieauto = locallab.spots.at(j).comprcieauto && pSpot.comprcieauto == otherSpot.comprcieauto; locallab.spots.at(j).normcie = locallab.spots.at(j).normcie && pSpot.normcie == otherSpot.normcie; locallab.spots.at(j).gamutcie = locallab.spots.at(j).gamutcie && pSpot.gamutcie == otherSpot.gamutcie; + locallab.spots.at(j).bwcie = locallab.spots.at(j).bwcie && pSpot.bwcie == otherSpot.bwcie; locallab.spots.at(j).sigcie = locallab.spots.at(j).sigcie && pSpot.sigcie == otherSpot.sigcie; locallab.spots.at(j).logcie = locallab.spots.at(j).logcie && pSpot.logcie == otherSpot.logcie; locallab.spots.at(j).satcie = locallab.spots.at(j).satcie && pSpot.satcie == otherSpot.satcie; locallab.spots.at(j).logcieq = locallab.spots.at(j).logcieq && pSpot.logcieq == otherSpot.logcieq; locallab.spots.at(j).smoothcie = locallab.spots.at(j).smoothcie && pSpot.smoothcie == otherSpot.smoothcie; + locallab.spots.at(j).smoothcieyb = locallab.spots.at(j).smoothcieyb && pSpot.smoothcieyb == otherSpot.smoothcieyb; + locallab.spots.at(j).smoothcielum = locallab.spots.at(j).smoothcielum && pSpot.smoothcielum == otherSpot.smoothcielum; locallab.spots.at(j).logjz = locallab.spots.at(j).logjz && pSpot.logjz == otherSpot.logjz; locallab.spots.at(j).sigjz = locallab.spots.at(j).sigjz && pSpot.sigjz == otherSpot.sigjz; locallab.spots.at(j).sigq = locallab.spots.at(j).sigq && pSpot.sigq == otherSpot.sigq; @@ -1801,6 +1804,9 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).gamjcie = locallab.spots.at(j).gamjcie && pSpot.gamjcie == otherSpot.gamjcie; locallab.spots.at(j).slopjcie = locallab.spots.at(j).slopjcie && pSpot.slopjcie == otherSpot.slopjcie; locallab.spots.at(j).slopesmo = locallab.spots.at(j).slopesmo && pSpot.slopesmo == otherSpot.slopesmo; + locallab.spots.at(j).slopesmor = locallab.spots.at(j).slopesmor && pSpot.slopesmor == otherSpot.slopesmor; + locallab.spots.at(j).slopesmog = locallab.spots.at(j).slopesmog && pSpot.slopesmog == otherSpot.slopesmog; + locallab.spots.at(j).slopesmob = locallab.spots.at(j).slopesmob && pSpot.slopesmob == otherSpot.slopesmob; locallab.spots.at(j).midtcie = locallab.spots.at(j).midtcie && pSpot.midtcie == otherSpot.midtcie; locallab.spots.at(j).grexl = locallab.spots.at(j).grexl && pSpot.grexl == otherSpot.grexl; locallab.spots.at(j).greyl = locallab.spots.at(j).greyl && pSpot.greyl == otherSpot.greyl; @@ -5953,11 +5959,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).normcie = mods.locallab.spots.at(i).normcie; } - if (locallab.spots.at(i).gamutcie) { toEdit.locallab.spots.at(i).gamutcie = mods.locallab.spots.at(i).gamutcie; } + if (locallab.spots.at(i).bwcie) { + toEdit.locallab.spots.at(i).bwcie = mods.locallab.spots.at(i).bwcie; + } + if (locallab.spots.at(i).sigcie) { toEdit.locallab.spots.at(i).sigcie = mods.locallab.spots.at(i).sigcie; } @@ -5978,6 +5987,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).smoothcie = mods.locallab.spots.at(i).smoothcie; } + if (locallab.spots.at(i).smoothcieyb) { + toEdit.locallab.spots.at(i).smoothcieyb = mods.locallab.spots.at(i).smoothcieyb; + } + + if (locallab.spots.at(i).smoothcielum) { + toEdit.locallab.spots.at(i).smoothcielum = mods.locallab.spots.at(i).smoothcielum; + } + if (locallab.spots.at(i).logjz) { toEdit.locallab.spots.at(i).logjz = mods.locallab.spots.at(i).logjz; } @@ -6214,6 +6231,18 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).slopesmo = mods.locallab.spots.at(i).slopesmo; } + if (locallab.spots.at(i).slopesmor) { + toEdit.locallab.spots.at(i).slopesmor = mods.locallab.spots.at(i).slopesmor; + } + + if (locallab.spots.at(i).slopesmog) { + toEdit.locallab.spots.at(i).slopesmog = mods.locallab.spots.at(i).slopesmog; + } + + if (locallab.spots.at(i).slopesmob) { + toEdit.locallab.spots.at(i).slopesmob = mods.locallab.spots.at(i).slopesmob; + } + if (locallab.spots.at(i).midtcie) { toEdit.locallab.spots.at(i).midtcie = mods.locallab.spots.at(i).midtcie; } @@ -8449,11 +8478,14 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : comprcieauto(v), normcie(v), gamutcie(v), + bwcie(v), sigcie(v), logcie(v), satcie(v), logcieq(v), smoothcie(v), + smoothcieyb(v), + smoothcielum(v), logjz(v), sigjz(v), sigq(v), @@ -8514,6 +8546,9 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : gamjcie(v), slopjcie(v), slopesmo(v), + slopesmor(v), + slopesmog(v), + slopesmob(v), midtcie(v), redxl(v), redyl(v), @@ -9202,11 +9237,14 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) comprcieauto = v; normcie = v; gamutcie = v; + bwcie = v; sigcie = v; logcie = v; satcie = v; logcieq = v; smoothcie = v; + smoothcieyb = v; + smoothcielum = v; logjz = v; sigjz = v; sigq = v; @@ -9267,6 +9305,9 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) gamjcie = v; slopjcie = v; slopesmo = v; + slopesmor = v; + slopesmog = v; + slopesmob = v; midtcie = v; redxl = v; redyl = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index c8bd39f9b..57a3ea1cd 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -1016,11 +1016,14 @@ public: bool comprcieauto; bool normcie; bool gamutcie; + bool bwcie; bool sigcie; bool logcie; bool satcie; bool logcieq; bool smoothcie; + bool smoothcieyb; + bool smoothcielum; bool logjz; bool sigjz; bool sigq; @@ -1081,6 +1084,9 @@ public: bool gamjcie; bool slopjcie; bool slopesmo; + bool slopesmor; + bool slopesmog; + bool slopesmob; bool midtcie; bool redxl; bool redyl; From 1adf2bbac32c3a26ebf405806253517e24a24f98 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 12 May 2024 08:40:32 +0200 Subject: [PATCH 22/31] Wavelet selection levels issue 7069 (#7070) * Fixed wavelet selective luminance * Enable PR appimage.yml windows.yml * disabled appimage.yml and windows.yml --- rtengine/ipwavelet.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index e5e90a77f..f0b6afaaf 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -434,7 +434,10 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const cp.CHmet = 0; cp.HSmet = false; - if (params->wavelet.CHmethod == "with") { + + if (params->wavelet.CHmethod == "without") { + cp.CHmet = 0; + } else if (params->wavelet.CHmethod == "with") { cp.CHmet = 1; } else if (params->wavelet.CHmethod == "link") { cp.CHmet = 2; @@ -4139,8 +4142,8 @@ void ImProcFunctions::ContAllL(float *koeLi[12], float maxkoeLi, bool lipschitz, float diagacc = 1.f; float alpha = (1024.f + 15.f * (float) cpMul * scale * scale2 * lbeta * diagacc) / 1024.f ; - // if (cp.HSmet && cp.contena) { - if (cp.HSmet && cp.contena && waOpacityCurveSH) { + if (cp.HSmet && cp.contena) { + // if (cp.HSmet && cp.contena && waOpacityCurveSH) {//waOpacityCurveSH no long use float aaal = (1.f - alpha) / ((cp.b_lhl - cp.t_lhl) * kH[level]); float bbal = 1.f - aaal * cp.b_lhl * kH[level]; float aaar = (alpha - 1.f) / (cp.t_rhl - cp.b_rhl) * kH[level]; From 5a25619bd50d42059abe9818420f639b6d10e3bf Mon Sep 17 00:00:00 2001 From: "U-PCSPECIALIST01\\jdesm" Date: Sun, 12 May 2024 08:45:00 +0200 Subject: [PATCH 23/31] Restore appimage.yml and windows.yml --- .github/workflows/appimage.yml | 2 +- .github/workflows/windows.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 90beb2c18..5a5c3b8d0 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '["Beep6581:levels"]' + publish_pre_dev_labels: '[]' jobs: build: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b30dd9f20..e5f4ce166 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '["Beep6581:levels"]' + publish_pre_dev_labels: '[]' jobs: From 5571c3a4c68e73ecebd034c320551a24f2044216 Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 16 May 2024 08:21:16 +0200 Subject: [PATCH 24/31] Local adjustments tools used globally - Laspotmain (#6928) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * First step LA globally * fixed several GUI bad behavior * better behavior shows additional settings * Improve transition in main * First step hide-show invers and scope * Hide show invers and scope step2 * hide show others inverse and scope * Try to improve * Change windows.yml and appimage.yml * In Preference set choice for default Spot Method * Optimization call idle_register * forgotten delete mainfp * Re-enable sliders scope in colorlight - shadows - vibrance - move setting checkbox others settings * Fixed bad behavior hide - show * Optimize behavior * Bad behavior scope when changing method * Clean and comment code * disable preview mask and modif for cbdl and retinex * Fixed preview deltaE mask and modif log encode - exposure - new button preview color and light * Button preview deltaE - exposure * Button preview SH * Button preview Vibrance * Improce code using mask * Fixed several bad behavior - preview TM and Contrast * Preview log button * Preview Ciecam button * Preview common mask button * Disable Preview button in settings when not used in tools * Change call to controspotpanel in improcoordinator * Change Local adjustments title to Selective Editing * Change default value spotmethod in option * Missing cddl in preview settings * Change parameter setting spot type * put selective editing tab just after exposure tab * Disable preview ΔE button when another is enabled Only one button should be active at any given time. * Deactivate preview ΔE buttons when switching spots * Change tooltip Spot method * Change selective editing position * Remove duplicate line in language default * Remove appimage.yml windows.yml --------- Co-authored-by: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> --- .github/workflows/appimage.yml | 2 +- rtdata/languages/default | 14 +- rtengine/improccoordinator.cc | 72 +++++- rtengine/iplocallab.cc | 95 +++++-- rtengine/procparams.cc | 79 +++++- rtengine/rtengine.h | 25 ++ rtgui/controlspotpanel.cc | 194 +++++++++++++-- rtgui/controlspotpanel.h | 13 +- rtgui/guiutils.cc | 39 +++ rtgui/guiutils.h | 24 ++ rtgui/locallab.cc | 253 ++++++++++++++++++- rtgui/locallab.h | 16 +- rtgui/locallabtools.cc | 441 ++++++++++++++++++++++++++++++++- rtgui/locallabtools.h | 111 +++++++-- rtgui/locallabtools2.cc | 424 ++++++++++++++++++++++++++++++- rtgui/options.cc | 7 + rtgui/options.h | 2 + rtgui/preferences.cc | 26 +- rtgui/preferences.h | 2 + rtgui/toolpanelcoord.cc | 5 + 20 files changed, 1755 insertions(+), 89 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 5a5c3b8d0..e144f4189 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -15,7 +15,7 @@ on: workflow_dispatch: env: - publish_pre_dev_labels: '[]' + publish_pre_dev_labels: '[]' jobs: build: diff --git a/rtdata/languages/default b/rtdata/languages/default index 81c7bfeee..e363b1054 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1763,7 +1763,7 @@ MAIN_TAB_FAVORITES_TOOLTIP;Shortcut: Alt-u MAIN_TAB_FILTER; Filter MAIN_TAB_INSPECT; Inspect MAIN_TAB_IPTC;IPTC -MAIN_TAB_LOCALLAB;Local +MAIN_TAB_LOCALLAB;Selective Editing MAIN_TAB_LOCALLAB_TOOLTIP;Shortcut: Alt-o MAIN_TAB_METADATA;Metadata MAIN_TAB_METADATA_TOOLTIP;Shortcut: Alt-m @@ -1850,8 +1850,8 @@ PARTIALPASTE_LABCURVE;L*a*b* adjustments PARTIALPASTE_LENSGROUP;Lens Related Settings PARTIALPASTE_LENSPROFILE;Profiled lens correction PARTIALPASTE_LOCALCONTRAST;Local contrast -PARTIALPASTE_LOCALLAB;Local Adjustments -PARTIALPASTE_LOCALLABGROUP;Local Adjustments Settings +PARTIALPASTE_LOCALLAB;Selective Editing +PARTIALPASTE_LOCALLABGROUP;Selective Editing Settings PARTIALPASTE_METADATA;Metadata mode PARTIALPASTE_METAGROUP;Metadata settings PARTIALPASTE_PCVIGNETTE;Vignette filter @@ -2083,6 +2083,7 @@ PREFERENCES_SND_HELP;Enter a full file path to set a sound, or leave blank for n PREFERENCES_SND_LNGEDITPROCDONE;Editor processing done PREFERENCES_SND_QUEUEDONE;Queue processing done PREFERENCES_SND_THRESHOLDSECS;After seconds +PREFERENCES_SPOTLOC;Define Spot method for Local Adjustments PREFERENCES_STARTUPIMDIR;Image Directory at Startup PREFERENCES_TAB_BROWSER;File Browser PREFERENCES_TAB_COLORMGR;Color Management @@ -2959,7 +2960,7 @@ TP_LOCALLAB_CLARI_TOOLTIP;Levels 0 to 4 (included): 'Sharp mask' is enabled\nLev TP_LOCALLAB_CLIPTM;Clip restored data (gain) TP_LOCALLAB_COFR;Color & Light TP_LOCALLAB_COLORDE;ΔE preview color - intensity -TP_LOCALLAB_COLORDEPREV_TOOLTIP;Preview ΔE button will only work if you have activated one (and only one) of the tools in 'Add tool to current spot' menu.\nTo be able to preview ΔE with several tools enabled, use Mask and modifications - Preview ΔE. +TP_LOCALLAB_COLORDEPREV_TOOLTIP;Preview ΔE button in Settings will only work if you have activated 'Sharpening' or 'Soft Light and Original Retinex' or 'Blur/Grain and Denoise' or 'Dehaze and Retinex' or 'Contrast by Detail Levels' in 'Add tool to current spot' menu.\nFor others tools Preview ΔE button is 'in the tool' - to be able to preview ΔE with several tools enabled, use preferably Mask and modifications. TP_LOCALLAB_COLORDE_TOOLTIP;Show a blue color preview for ΔE selection if negative and green if positive.\n\nMask and modifications (show modified areas without mask): show actual modifications if positive, show enhanced modifications (luminance only) with blue and yellow if negative. TP_LOCALLAB_COLORSCOPE;Scope (color tools) TP_LOCALLAB_COLORSCOPE_TOOLTIP;Common Scope slider for Color and Light, Shadows/Highlights, Vibrance.\nOther tools have their own scope controls. @@ -3048,9 +3049,10 @@ TP_LOCALLAB_EV_VIS_ALL;Show all TP_LOCALLAB_EXCLUF;Excluding TP_LOCALLAB_EXCLUF_TOOLTIP;'Excluding' mode prevents adjacent spots from influencing certain parts of the image. Adjusting 'Scope' will extend the range of colors.\n You can also add tools to an Excluding spot and use them in the same way as for a normal spot. TP_LOCALLAB_EXCLUTYPE;Spot method -TP_LOCALLAB_EXCLUTYPE_TOOLTIP;Normal spot uses recursive data.\n\nExcluding spot reinitializes all local adjustment data.\nCan be used to totally or partially cancel a previous action or to carry out operations in Inverse mode.\n\n'Full image' allows you to use the local adjustment tools on the whole image.\n The RT Spot delimiters are set beyond the image preview boundaries.\n The transition is set to 100.\nNote, you may have to reposition the RT Spot slightly and adjust the Spot size to get the desired effect.\nPlease note: using Denoise or Wavelet or FFTW in full-image mode uses large amounts of memory and may cause the application to crash on lower capacity systems. +TP_LOCALLAB_EXCLUTYPE_TOOLTIP;Normal spot uses recursive data.\n\nExcluding spot reinitializes all local adjustment data.\nCan be used to totally or partially cancel a previous action or to carry out operations in Inverse mode.\nUse 'Scope' (Excluding) to set the exclusion intensity.\n\n'Full image' allows you to use the local adjustment tools on the whole image.\n The RT Spot delimiters are set beyond the image preview boundaries.\n The transition is set to 100.\nNote, you may have to reposition the RT Spot slightly and adjust the Spot size to get the desired effect.\nPlease note: using Denoise or Wavelet or FFTW in full-image mode uses large amounts of memory and may cause the application to crash on lower capacity systems.\n\n'Global' allows you to use the local adjustment tools on the whole image, without using deltaE or transitions. TP_LOCALLAB_EXECLU;Excluding spot TP_LOCALLAB_EXFULL;Full image +TP_LOCALLAB_EXMAIN;Global TP_LOCALLAB_EXNORM;Normal spot TP_LOCALLAB_EXPCBDL_TOOLTIP;Can be used to remove marks on the sensor or lens by reducing the contrast on the appropriate detail level(s). TP_LOCALLAB_EXPCHROMA;Chroma compensation @@ -3182,7 +3184,7 @@ TP_LOCALLAB_JZTARGET_EV;Viewing Mean luminance (Yb%) TP_LOCALLAB_JZTHRHCIE;Threshold Chroma for Jz(Hz) TP_LOCALLAB_JZWAVEXP;Wavelet Jz TP_LOCALLAB_LABBLURM;Blur Mask -TP_LOCALLAB_LABEL;Local Adjustments +TP_LOCALLAB_LABEL;Selective Editing TP_LOCALLAB_LABGRID;Color correction grid TP_LOCALLAB_LABGRIDMERG;Background TP_LOCALLAB_LABGRID_VALUES;High(a)=%1 High(b)=%2\nLow(a)=%3 Low(b)=%4 diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 5f8a4df15..46dd7bc29 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -1131,6 +1131,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) //std::vector locallref; std::vector locallretiminmax; std::vector locallcielc; + std::vector locallsetlc; std::vector locallciesig; huerefs.resize(params->locallab.spots.size()); huerefblurs.resize(params->locallab.spots.size()); @@ -1154,6 +1155,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) lumarefp = new float[sizespot]; float *fabrefp = nullptr; fabrefp = new float[sizespot]; + //new controls mainfp and scopefp with multi spots + int *mainfp = nullptr; + mainfp = new int[sizespot]; + int *scopefp = nullptr; + scopefp = new int[sizespot]; for (int sp = 0; sp < (int)params->locallab.spots.size(); sp++) { @@ -1164,7 +1170,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (params->locallab.spots.at(sp).equilret && params->locallab.spots.at(sp).expreti) { savenormreti.reset(new LabImage(*oprevl, true)); } - + if(params->locallab.spots.at(sp).colorscope != 30) {//compatibility with old method in controlspotpanel to change scope - default value 30 + scopefp[sp]= params->locallab.spots.at(sp).colorscope; + } // Set local curves of current spot to LUT locRETgainCurve.Set(params->locallab.spots.at(sp).localTgaincurve); locRETtransCurve.Set(params->locallab.spots.at(sp).localTtranscurve); @@ -1537,7 +1545,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locciesig.contsigq = contsig; locciesig.lightsigq = lightsig; locallciesig.push_back(locciesig); - + + // Recalculate references after if (params->locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reserv.get(), reserv.get(), 0, 0, pW, pH, scale, huerefblu, chromarefblu, lumarefblu, huer, chromar, lumar, sobeler, avg, locwavCurveden, locwavdenutili); @@ -1555,6 +1564,50 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } + + // new used linked to global and scope + mainfp[sp] = 0; + if (params->locallab.spots.at(sp).spotMethod == "main") { + mainfp[sp] = 3; + } else if (params->locallab.spots.at(sp).spotMethod == "full") { + mainfp[sp] = 2; + } + //keep using tools + bool iscolor = params->locallab.spots.at(sp).expcolor; + bool issh = params->locallab.spots.at(sp).expshadhigh; + bool isvib = params->locallab.spots.at(sp).expvibrance; + bool isexpos = params->locallab.spots.at(sp).expexpose; + bool issoft = params->locallab.spots.at(sp).expsoft; + bool isblur = params->locallab.spots.at(sp).expblur; + bool istom = params->locallab.spots.at(sp).exptonemap; + bool isret = params->locallab.spots.at(sp).expreti; + bool issharp = params->locallab.spots.at(sp).expsharp; + bool iscont = params->locallab.spots.at(sp).expcontrast; + bool iscbdl = params->locallab.spots.at(sp).expcbdl; + bool islog = params->locallab.spots.at(sp).explog; + bool ismas = params->locallab.spots.at(sp).expmask; + bool iscie = params->locallab.spots.at(sp).expcie; + bool isset = iscolor || issh || isvib; + + //set select spot settings + LocallabListener::locallabsetLC locsetlc; + locsetlc.mainf = mainfp[sp]; + locsetlc.iscolo = iscolor; + locsetlc.iss = issh; + locsetlc.isvi = isvib; + locsetlc.isexpo = isexpos; + locsetlc.issof = issoft; + locsetlc.isblu = isblur; + locsetlc.isto = istom; + locsetlc.isre = isret; + locsetlc.isshar = issharp; + locsetlc.iscon = iscont; + locsetlc.iscbd = iscbdl; + locsetlc.islo = islog; + locsetlc.isma = ismas; + locsetlc.isci = iscie; + locallsetlc.push_back(locsetlc); + if (locallListener) { locallListener->refChanged2(huerefp, chromarefp, lumarefp, fabrefp, params->locallab.selspot); locallListener->minmaxChanged(locallretiminmax, params->locallab.selspot); @@ -1562,6 +1615,18 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locallListener->cieChanged(locallcielc,params->locallab.selspot); } locallListener->sigChanged(locallciesig,params->locallab.selspot); + if(params->locallab.spots.at(sp).colorscope != 30) {//compatibility with old method in controlspotpanel + locallListener->scopeChangedcol(scopefp[sp], params->locallab.selspot, iscolor); + locallListener->scopeChangedsh(scopefp[sp], params->locallab.selspot, issh); + locallListener->scopeChangedvib(scopefp[sp], params->locallab.selspot, isvib); + locallListener->scopeChangedset(scopefp[sp], params->locallab.selspot, isset); + params->locallab.spots.at(sp).colorscope = 30; + } + // if (mainfp[sp] >= 0) {//minimize call to idle register + //used by Global fullimage. + locallListener->maiChanged(locallsetlc,params->locallab.selspot); + // } + } } @@ -1570,7 +1635,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) delete [] chromarefp; delete [] lumarefp; delete [] fabrefp; - + delete [] mainfp; + delete [] scopefp; ipf.lab2rgb(*nprevl, *oprevi, params->icm.workingProfile); //************************************************************* // end locallab diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index a40f2f146..1d03f7adc 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -952,6 +952,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.fullim = 1; } else if (locallab.spots.at(sp).spotMethod == "full") { lp.fullim = 2; + } else if (locallab.spots.at(sp).spotMethod == "main") {//new Global + lp.fullim = 3; } lp.fftColorMask = locallab.spots.at(sp).fftColorMask; @@ -1097,6 +1099,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.excmet = 1; } else if (locallab.spots.at(sp).spotMethod == "full") { lp.excmet = 2; + } else if (locallab.spots.at(sp).spotMethod == "main") { + lp.excmet = 3; } if (locallab.spots.at(sp).merMethod == "mone") { @@ -1852,10 +1856,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.blwh = locallab.spots.at(sp).blwh; lp.senscolor = (int) locallab.spots.at(sp).colorscope; //replace scope color vibrance shadows - lp.sens = lp.senscolor; +/* lp.sens = lp.senscolor; lp.sensv = lp.senscolor; lp.senshs = lp.senscolor; - +*/ lp.mLjz = locallab.spots.at(sp).clarilresjz / 100.0; lp.mCjz = locallab.spots.at(sp).claricresjz / 100.0; lp.softrjz = locallab.spots.at(sp).clarisoftjz; @@ -4947,7 +4951,10 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab //simple algo , perhaps we can improve as the others, but noise is here and not good for hue detection // BENCHFUN lumaref *= 327.68f; - const float ach = lp.trans / 100.f; + float ach = lp.trans / 100.f; + if(lp.fullim == 3 ) {//disabled transit + ach = 1.f; + } const float factnoise1 = 1.f + (lp.noisecf) / 500.f; const float factnoise2 = 1.f + (lp.noisecc) / 500.f; @@ -5024,6 +5031,9 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } + if(lp.fullim == 3 ) {//disabled scope + localFactor = 1.f; + } if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values continue; @@ -5058,6 +5068,9 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab difa = tmp1.a[y][x] - original->a[y][x]; difb = tmp1.b[y][x] - original->b[y][x]; } + if(lp.fullim == 3 ) {//disable scope + reducdEL = reducdEa = reducdEb = 1.f; + } difL *= localFactor * reducdEL; difa *= localFactor * reducdEa; @@ -5103,7 +5116,10 @@ void ImProcFunctions::DeNoise_Local2(const struct local_params& lp, LabImage* or lumaref *= 327.68f; - const float ach = lp.trans / 100.f; + float ach = lp.trans / 100.f; + if(lp.fullim == 3 ) {//disabled transit + ach = 1.f; + } const float factnoise1 = 1.f + (lp.noisecf) / 500.f; const float factnoise2 = 1.f + (lp.noisecc) / 500.f; @@ -5180,6 +5196,9 @@ void ImProcFunctions::DeNoise_Local2(const struct local_params& lp, LabImage* or } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } + if(lp.fullim == 3 ) {//disabled scope + localFactor = 1.f; + } if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values continue; @@ -5208,6 +5227,9 @@ void ImProcFunctions::DeNoise_Local2(const struct local_params& lp, LabImage* or difL = tmp1.L[y - ystart][x - xstart] - original->L[y][x]; difa = tmp1.a[y - ystart][x - xstart] - original->a[y][x]; difb = tmp1.b[y - ystart][x - xstart] - original->b[y][x]; + if(lp.fullim == 3 ) {//disable scope + reducdEL = reducdEa = reducdEb = 1.f; + } difL *= localFactor * reducdEL; difa *= localFactor * reducdEa; @@ -5297,7 +5319,10 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl float rL = origblur->L[y][x] / 327.68f; float dE = std::sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); - const float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensh); + float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensh); + if(lp.fullim == 3 ) {//disable scope + reducdE = 1.f; + } switch (zone) { case 0: { // outside selection and outside transition zone => full effect, no transition @@ -5446,6 +5471,10 @@ void ImProcFunctions::InverseBlurNoise_Local(LabImage * originalmask, const stru float huedelta2 = abdelta2 - chrodelta2; float dE = std::sqrt(kab * (kch * chrodelta2 + kH * huedelta2) + kL * SQR(refL - maskptr->L[y][x])); reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensbn); + if(lp.fullim == 3 ) {//disabled scope + reducdE = 1.f; + } + } switch (zone) { @@ -5795,13 +5824,19 @@ static void blendmask(const local_params& lp, int xstart, int ystart, int cx, in int zone; float localFactor = 1.f; - const float achm = lp.trans / 100.f; + float achm = lp.trans / 100.f; + if(lp.fullim == 3 ) {//disable transit + achm = 1.f; + } if (lp.shapmet == 0) { calcTransition(lox, loy, achm, lp, zone, localFactor); } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, achm, lp, zone, localFactor); } + if(lp.fullim == 3 ) {//disable scope + localFactor = 1.f; + } if (inv == 0) { if (zone > 0) { @@ -8033,7 +8068,7 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage * bufexpo transformed->L[y][x] = CLIP(12000.f + difL); transformed->a[y][x] = clipC(difa); transformed->b[y][x] = clipC(difb); - } else if (previewcb || previewtm || lp.prevdE) { + } else if (/* previewcb ||*/ previewtm || lp.prevdE) { if (std::fabs(difb) < 500.f) { difb += difL; } @@ -8651,7 +8686,7 @@ void optfft(int N_fftwsize, int &bfh, int &bfw, int &bfhr, int &bfwr, struct loc } } - if (fulima == 2) { // if full image, the ftsizeH and ftsizeW is a bit larger (about 10 to 200 pixels) than the image dimensions so that it is fully processed (consumes a bit more resources) + if(fulima >= 2) {// if full image, the ftsizeH and ftsizeW is a bit larger (about 10 to 200 pixels) than the image dimensions so that it is fully processed (consumes a bit more resources) for (int ftfu = 0; ftfu < N_fftwsize; ftfu++) { //find best values if (fftw_size[ftfu] <= (H + deltah)) { ftsizeH = fftw_size[ftfu]; @@ -8961,16 +8996,16 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in const bool masshow = ((lp.showmask_met == 1) && senstype == 20); - const bool previewvib = ((lp.showmaskvibmet == 4) && senstype == 2); - const bool previewexp = ((lp.showmaskexpmet == 5) && senstype == 1); - const bool previewcol = ((lp.showmaskcolmet == 5) && senstype == 0); - const bool previewSH = ((lp.showmaskSHmet == 4) && senstype == 9); - const bool previewtm = ((lp.showmasktmmet == 4) && senstype == 8); - const bool previewlc = ((lp.showmasklcmet == 4) && senstype == 10); + const bool previewvib = ((lp.showmaskvibmet == 4) && senstype == 2 && lp.fullim != 3); + const bool previewexp = ((lp.showmaskexpmet == 5) && senstype == 1 && lp.fullim != 3); + const bool previewcol = ((lp.showmaskcolmet == 5) && senstype == 0 && lp.fullim != 3); + const bool previewSH = ((lp.showmaskSHmet == 4) && senstype == 9 && lp.fullim != 3); + const bool previewtm = ((lp.showmasktmmet == 4) && senstype == 8 && lp.fullim != 3); + const bool previewlc = ((lp.showmasklcmet == 4) && senstype == 10 && lp.fullim != 3); const bool previeworig = ((lp.showmasksoftmet == 6) && senstype == 3 && lp.softmet == 1); - const bool previewmas = ((lp.showmask_met == 3) && senstype == 20); - const bool previewlog = ((lp.showmasklogmet == 4) && senstype == 11); - const bool previewcie = ((lp.showmaskciemet == 4) && senstype == 31); + const bool previewmas = ((lp.showmask_met == 3) && senstype == 20 && lp.fullim != 3); + const bool previewlog = ((lp.showmasklogmet == 4) && senstype == 11 && lp.fullim != 3); + const bool previewcie = ((lp.showmaskciemet == 4) && senstype == 31 && lp.fullim != 3); float radius = 3.f / sk; @@ -9175,7 +9210,10 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in const int lox = x + xstart + cx; int zone; float localFactor = 1.f; - const float achm = lp.trans / 100.f; + float achm = lp.trans / 100.f; + if(lp.fullim == 3 ) {//disable transit + achm = 1.f; + } //calculate transition if (lp.shapmet == 0) { @@ -9183,6 +9221,9 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in } else { /*if (lp.shapmet == 1)*/ calcTransitionrect(lox, loy, achm, lp, zone, localFactor); } + if(lp.fullim == 3 ) {//disable scope + localFactor = 1.f; + } // float hueh = 0; #ifdef __SSE2__ @@ -9221,6 +9262,9 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in const float dE = rsob + std::sqrt(kab * (kch * chrodelta2 + kH * huedelta2) + kL * SQR(refL - maskptr->L[y][x])); //reduction action with deltaE float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, varsens); + if(lp.fullim == 3 ) {//disable scope + reducdE = 1.f; + } if ((senstype == 11 || ( senstype == 31 && lp.islogcie)) && (varsens >= limvarsens)) { int maxvarsens = 90;//arbitrary value to get maximum incidence float ared = (1.f - reducdE) / (maxvarsens - limvarsens); @@ -9231,6 +9275,7 @@ void ImProcFunctions::transit_shapedetect2(int sp, float meantm, float stdtm, in if(varsens == 100.f) { reducdE = 1.f; } + float cli = (bufexpfin->L[y][x] - bufexporig->L[y][x]); float cla = (bufexpfin->a[y][x] - bufexporig->a[y][x]); float clb = (bufexpfin->b[y][x] - bufexporig->b[y][x]); @@ -15341,7 +15386,11 @@ void ImProcFunctions::Lab_Local( for (int y = 0; y < transformed->H ; y++) for (int x = 0; x < transformed->W; x++) { float dE = std::sqrt(SQR(refa - bufreti->a[y][x] / 327.68f) + SQR(refb - bufreti->b[y][x] / 327.68f) + SQR(static_cast(lumaref) - bufreti->b[y][x] / 327.68f)); - const float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sensibefore); + float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sensibefore); + if(lp.fullim == 3 ) {//disable scope + reducdE = 1.f; + } + reducDE[y][x] = clipDE(reducdE); } @@ -15702,7 +15751,11 @@ void ImProcFunctions::Lab_Local( for (int y = ystart; y < yend ; y++) { for (int x = xstart; x < xend; x++) { const float dE = std::sqrt(SQR(refa - bufreti->a[y - ystart][x - xstart] / 327.68f) + SQR(refb - bufreti->b[y - ystart][x - xstart] / 327.68f) + SQR(static_cast(lumaref) - bufreti->b[y - ystart][x - xstart] / 327.68f)); - const float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sensibefore); + float reducdE = calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sensibefore); + if(lp.fullim == 3 ) {//disable scope + reducdE = 1.f; + } + reducDE[y - ystart][x - xstart] = clipDE(reducdE); } } @@ -17480,7 +17533,7 @@ void ImProcFunctions::Lab_Local( int yEn = lp.yc + lp.ly; int xEn = lp.xc + lp.lx; - if (lp.fullim == 2) { //limit sharpening to image dimension...no more...to avoid a long treatment + if(lp.fullim >= 2) {//full-iamge and global - limit sharpening to image dimension...no more...to avoid a long treatment begy = 0; begx = 0; yEn = original->H; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 763decb75..9d759a723 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3038,7 +3038,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : labgridAHighmerg(-3500.0), labgridBHighmerg(-4600.0), strengthgrid(30), - sensi(15), + sensi(30), structcol(0), strcol(0.), strcolab(0.), @@ -3384,7 +3384,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : shadows(0), s_tonalwidth(30), sh_radius(40), - sensihs(15), + sensihs(30), enaSHMask(false), CCmaskSHcurve{ static_cast(FCT_MinMaxCPoints), @@ -3471,7 +3471,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : protectskins(false), avoidcolorshift(true), pastsattog(true), - sensiv(15), + sensiv(30), skintonescurve{ static_cast(DCT_Linear) }, @@ -4768,9 +4768,80 @@ LocallabParams::LocallabSpot::LocallabSpot() : 0.35 }, csthresholdcie(0, 0, 6, 5, false) - + { + // init settings with Preferences / options : must be followed by call to spotMethodChanged in controlspotpanel.cc (idle_register) + // new values default with different SpotMethod. + + if(options.spotmet == 3) {//global + spotMethod = "main"; + loc = {3000, 3000, 3000, 3000}; + transit =100.; + shape = "RECT"; + + } else if(options.spotmet == 2) {//full image + spotMethod = "full"; + loc = {3000, 3000, 3000, 3000}; + transit =100.; + shape = "RECT"; + sensi = 30; + sensiex = 60; + sensihs = 30; + sensiv = 30; + sensisf = 30; + sensibn = 40; + sensiden = 60; + sensitm = 60; + sensih = 60; + sensisha = 40; + sensilc = 60; + sensicb = 60; + sensilog = 60; + sensimask = 60; + sensicie = 60; + + } else if(options.spotmet == 1) {//exclude + spotMethod = "exc"; + shape = "ELI"; + loc = {150, 150, 150, 150}; + transit= 60.; + sensi = 30; + sensiex = 60; + sensihs = 30; + sensiv = 30; + sensibn = 40; + sensiden = 60; + sensitm = 60; + sensih = 60; + sensisha = 40; + sensilc = 60; + sensicb = 60; + sensilog = 60; + sensimask = 60; + sensicie = 60; + + } else if(options.spotmet == 0) {//normal + spotMethod = "norm"; + shape = "ELI"; + loc = {150, 150, 150, 150}; + transit= 60.; + sensi = 30; + sensiex = 60; + sensihs = 30; + sensiv = 30; + sensibn = 40; + sensiden = 60; + sensitm = 60; + sensih = 60; + sensisha = 40; + sensilc = 60; + sensicb = 60; + sensilog = 60; + sensimask = 60; + sensicie = 60; + } + } bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index e27f372ae..f1ee4108c 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -451,6 +451,25 @@ public: int primlc; }; +//select spot settings + struct locallabsetLC { + int mainf; + bool iscolo; + bool iss; + bool isvi; + bool isexpo; + bool issof; + bool isblu; + bool isto; + bool isre; + bool isshar; + bool iscon; + bool iscbd; + bool islo; + bool isma; + bool isci; + }; + struct locallabcieSIG { double contsigq; double lightsigq; @@ -461,9 +480,15 @@ public: virtual void minmaxChanged(const std::vector &minmax, int selspot) = 0; virtual void denChanged(const std::vector &denlc, int selspot) = 0; virtual void cieChanged(const std::vector &cielc, int selspot) = 0; + virtual void maiChanged(const std::vector &csetlc, int selspot) = 0; virtual void sigChanged(const std::vector &ciesig, int selspot) = 0; virtual void ciebefChanged(const std::vector &ciebef, int selspot) = 0; virtual void refChanged2(float *huerefp, float *chromarefp, float *lumarefp, float *fabrefp, int selspot) = 0; +// virtual void mainChanged(int spottype, int selspot, bool iscolor, bool issh, bool isvib, bool isexpos, bool issoft, bool isblur, bool istom, bool isret, bool issharp, bool iscont, bool iscbdl, bool islog, bool ismas, bool iscie) = 0; + virtual void scopeChangedcol(int scope, int selspot, bool enab) = 0; + virtual void scopeChangedsh(int scope, int selspot, bool enab) = 0; + virtual void scopeChangedvib(int scope, int selspot, bool enab) = 0; + virtual void scopeChangedset(int scope, int selspot, bool enab) = 0; }; diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 31510acbc..8588f6057 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -100,8 +100,11 @@ ControlSpotPanel::ControlSpotPanel(): preview_(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), ctboxshape(Gtk::manage(new Gtk::Box())), + ctboxactivmethod(Gtk::manage(new Gtk::Box())), + ctboxspotmethod(Gtk::manage(new Gtk::Box())), ctboxshapemethod(Gtk::manage(new Gtk::Box())), ctboxgamut(Gtk::manage(new Gtk::Box())), + artifBox2(Gtk::manage(new ToolParamBlock())), controlPanelListener(nullptr), lastObject_(-1), @@ -116,7 +119,7 @@ ControlSpotPanel::ControlSpotPanel(): auto m = ProcEventMapper::getInstance(); EvLocallabavoidgamutMethod = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_GAMUTMUNSEL"); const bool showtooltip = options.showtooltip; - pack_start(*hishow_); +// pack_start(*hishow_); Gtk::Box* const ctboxprevmethod = Gtk::manage(new Gtk::Box()); prevMethod_->append(M("TP_LOCALLAB_PREVHIDE")); @@ -204,8 +207,9 @@ ControlSpotPanel::ControlSpotPanel(): scrolledwindow_->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolledwindow_->set_min_content_height(150); pack_start(*scrolledwindow_); + pack_start(*hishow_); - Gtk::Box* const ctboxactivmethod = Gtk::manage(new Gtk::Box()); + // Gtk::Box* const ctboxactivmethod = Gtk::manage(new Gtk::Box()); ctboxactivmethod->pack_start(*activ_); pack_start(*ctboxactivmethod); @@ -223,7 +227,6 @@ ControlSpotPanel::ControlSpotPanel(): shape_->set_tooltip_text(M("TP_LOCALLAB_SHAPE_TOOLTIP")); } - Gtk::Box* const ctboxspotmethod = Gtk::manage(new Gtk::Box()); Gtk::Label* const labelspotmethod = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_EXCLUTYPE") + ":")); ctboxspotmethod->pack_start(*labelspotmethod, Gtk::PACK_SHRINK, 4); @@ -234,6 +237,7 @@ ControlSpotPanel::ControlSpotPanel(): spotMethod_->append(M("TP_LOCALLAB_EXNORM")); spotMethod_->append(M("TP_LOCALLAB_EXECLU")); spotMethod_->append(M("TP_LOCALLAB_EXFULL")); + spotMethod_->append(M("TP_LOCALLAB_EXMAIN"));//new choice Global spotMethod_->set_active(0); spotMethodconn_ = spotMethod_->signal_changed().connect( sigc::mem_fun( @@ -388,10 +392,11 @@ ControlSpotPanel::ControlSpotPanel(): // artifBox->pack_start(*colorscope_); expShapeDetect_->add(*artifBox, false); pack_start(*expShapeDetect_, false, false); - ToolParamBlock* const artifBox2 = Gtk::manage(new ToolParamBlock()); +// ToolParamBlock* const artifBox2 = Gtk::manage(new ToolParamBlock()); artifBox2->pack_start(*preview_); - artifBox2->pack_start(*colorscope_); + artifBox2->pack_start(*colorscope_);//unused with contrlspotpanel since 17 / 01 : 2024 but data used in color, vibrance, sh + colorscope_->hide(); pack_start(*artifBox2); ToolParamBlock* const specCaseBox = Gtk::manage(new ToolParamBlock()); @@ -552,7 +557,6 @@ ControlSpotPanel::ControlSpotPanel(): pack_start(*ctboxwavmethod); */ show_all(); - // Define row background color // Mouseovered spot (opaque orange) colorMouseover.set_red(1.); @@ -795,6 +799,7 @@ bool ControlSpotPanel::on_button_visibility(GdkEventButton* event) return false; } + bool ControlSpotPanel::blockTreeviewSearch(GdkEventKey* event) { // printf("blockTreeviewSearch\n"); @@ -982,7 +987,7 @@ void ControlSpotPanel::prevMethodChanged() void ControlSpotPanel::spotMethodChanged() { - + //01 2024 take into account new problems linked to Global spotmethod // Get selected control spot const auto s = treeview_->get_selection(); @@ -995,15 +1000,20 @@ void ControlSpotPanel::spotMethodChanged() const int oldSpotMethod = row[spots_.spotMethod]; row[spots_.spotMethod] = spotMethod_->get_active_row_number(); + //ctboxspotmethod->show(); + hishow_->show(); + ctboxshape->show(); + artifBox2->show(); + colorscope_->hide(); // Update Control Spot GUI according to spotMethod_ combobox state (to be compliant with updateParamVisibility function) if (multiImage && spotMethod_->get_active_text() == M("GENERAL_UNCHANGED")) { excluFrame->show(); + } else if (spotMethod_->get_active_row_number() == 0) { // Normal case excluFrame->hide(); - - // Reset spot shape only if previous spotMethod is Full image - if (oldSpotMethod == 2) { + // Reset spot shape only if previous spotMethod is Full image or Global + if (oldSpotMethod == 2 || oldSpotMethod == 3) { disableParamlistener(true); locX_->setValue(150.); row[spots_.locX] = locX_->getIntValue(); @@ -1023,8 +1033,8 @@ void ControlSpotPanel::spotMethodChanged() } else if (spotMethod_->get_active_row_number() == 1) { // Excluding case excluFrame->show(); - // Reset spot shape only if previous spotMethod is Full image - if (oldSpotMethod == 2) { + // Reset spot shape only if previous spotMethod is Full image or Global + if (oldSpotMethod == 2 || oldSpotMethod == 3) { disableParamlistener(true); locX_->setValue(150.); row[spots_.locX] = locX_->getIntValue(); @@ -1041,7 +1051,7 @@ void ControlSpotPanel::spotMethodChanged() disableParamlistener(false); updateControlSpotCurve(row); } - } else if (spotMethod_->get_active_row_number() == 2) { // Full image case + } else if (spotMethod_->get_active_row_number() == 2 || spotMethod_->get_active_row_number() == 3) { // Full image or Global case excluFrame->hide(); shape_->set_active(0); @@ -1057,6 +1067,31 @@ void ControlSpotPanel::spotMethodChanged() row[spots_.shape] = shape_->get_active_row_number(); transit_->setValue(100.); row[spots_.transit] = transit_->getValue(); + + if(spotMethod_->get_active_row_number() == 3) { //global + ctboxshape->hide(); + artifBox2->hide(); + hishow_->hide(); + expTransGrad_->hide(); + expShapeDetect_->hide(); + expSpecCases_->hide(); + expMaskMerge_->hide(); + circrad_->hide(); + ctboxshape->hide(); + } else { + ctboxshape->show(); + circrad_->show(); + artifBox2->show(); + colorscope_->hide(); + + hishow_->show(); + if(hishow_->get_active()) { + expTransGrad_->show(); + expShapeDetect_->show(); + expSpecCases_->show(); + expMaskMerge_->show(); + } + } } // Raise event @@ -1304,7 +1339,12 @@ void ControlSpotPanel::updateParamVisibility() } else { avoidrad_->hide(); } - + // ctboxspotmethod->show(); + hishow_->show(); + artifBox2->show(); + ctboxshape->show(); + colorscope_->hide(); + // Update Control Spot GUI according to spotMethod_ combobox state (to be compliant with spotMethodChanged function) if (multiImage && spotMethod_->get_active_text() == M("GENERAL_UNCHANGED")) { excluFrame->show(); @@ -1312,8 +1352,35 @@ void ControlSpotPanel::updateParamVisibility() excluFrame->hide(); } else if (spotMethod_->get_active_row_number() == 1) { // Excluding case excluFrame->show(); - } else if (spotMethod_->get_active_row_number() == 2) {//full image + } else if (spotMethod_->get_active_row_number() == 2 || spotMethod_->get_active_row_number() == 3) {//full image or global excluFrame->hide(); + + if(spotMethod_->get_active_row_number() == 3) { + artifBox2->hide(); + hishow_->hide(); + hishow_->set_active(false); + ctboxshape->hide(); + circrad_->hide(); + expTransGrad_->hide(); + expShapeDetect_->hide(); + expSpecCases_->hide(); + expMaskMerge_->hide(); + + } else { + artifBox2->show(); + colorscope_->hide(); + hishow_->show(); + ctboxshape->show(); + circrad_->show(); + if(hishow_->get_active()) { + expTransGrad_->show(); + expShapeDetect_->show(); + expSpecCases_->show(); + expMaskMerge_->show(); + } + + } + } /* @@ -1326,13 +1393,35 @@ void ControlSpotPanel::updateParamVisibility() ctboxshape->show(); } else if (prevMethod_->get_active_row_number() == 0) { // Normal case */ - if (!hishow_->get_active()) { // Normal case + //ctboxshape->show(); + // artifBox2->show(); + + if (!hishow_->get_active() || spotMethod_->get_active_row_number() == 3) { // Normal case or Global expTransGrad_->hide(); expShapeDetect_->hide(); expSpecCases_->hide(); expMaskMerge_->hide(); circrad_->hide(); ctboxshape->hide(); + if(spotMethod_->get_active_row_number() == 3) { + artifBox2->hide(); + hishow_->hide(); + ctboxshape->hide(); + circrad_->hide(); + expTransGrad_->hide(); + expShapeDetect_->hide(); + expSpecCases_->hide(); + expMaskMerge_->hide(); + + } else { + hishow_->show(); + artifBox2->show(); + colorscope_->hide(); + hishow_->show(); + ctboxshape->show(); + circrad_->show(); + } + } else { // Excluding case expTransGrad_->show(); expShapeDetect_->show(); @@ -1340,6 +1429,8 @@ void ControlSpotPanel::updateParamVisibility() expMaskMerge_->show(); circrad_->show(); ctboxshape->show(); + hishow_->show(); + } @@ -1603,8 +1694,9 @@ void ControlSpotPanel::hishowChanged() row[spots_.hishow] = hishow_->get_active(); + ctboxshape->show(); - if (!hishow_->get_active()) { // Normal case + if (!hishow_->get_active() || spotMethod_->get_active_row_number() == 3) { // Normal case or Global expTransGrad_->hide(); expShapeDetect_->hide(); expSpecCases_->hide(); @@ -1612,6 +1704,20 @@ void ControlSpotPanel::hishowChanged() circrad_->hide(); ctboxshape->hide(); shapeMethod_->set_active(0); + if(spotMethod_->get_active_row_number() == 3) { + hishow_->hide(); + hishow_->set_active(false); + circrad_->hide(); + expTransGrad_->hide(); + expShapeDetect_->hide(); + expSpecCases_->hide(); + expMaskMerge_->hide(); + + } else { + hishow_->show(); + circrad_->show(); + + } } else { // Excluding case expTransGrad_->show(); @@ -1620,7 +1726,9 @@ void ControlSpotPanel::hishowChanged() expMaskMerge_->show(); circrad_->show(); ctboxshape->show(); - } + hishow_->show(); + + } // Raise event if (listener) { @@ -2764,6 +2872,56 @@ void ControlSpotPanel::deleteControlSpot(const int index) disableParamlistener(false); } +//new function linked to Global and options +void ControlSpotPanel::updateguiset(int spottype, bool iscolor, bool issh, bool isvib, bool isexpos, bool issoft, bool isblur, bool istom, bool isret, bool issharp, bool iscont, bool iscbdl, bool islog, bool ismas, bool iscie) +{ + { //with this function we can 1) activate Settings SpotMethod + // also if need GUI for mask , todo... + idle_register.add( + [this, spottype, iscolor, issh , isvib, isexpos, issoft, isblur, istom, isret, issharp, iscont, iscbdl, islog, ismas, iscie]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + if(spottype >= 2 && options.spotmet >= 2) {//optimize update + spotMethodChanged(); + } + + if((iscolor || issh || isvib || isexpos || istom || iscont || islog || ismas || iscie) + && !issharp && !issoft && !isret && !isblur & !iscbdl) { + preview_->hide(); + } else if (issoft || isblur || isret || issharp || iscbdl) { + preview_->show(); + } + enableListener(); + + return false; + } + ); + } + +} +//new function linked to change scope +void ControlSpotPanel::updateguiscopeset(int scope) +{ + { //with this function we can disabled old values scope + idle_register.add( + [this, scope]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + disableListener(); + colorscope_->setValue(scope); + adjusterChanged(colorscope_, 0.); + enableListener(); + + return false; + } + ); + } + +} + + void ControlSpotPanel::setDefaults(const rtengine::procparams::ProcParams * defParams, const ParamsEdited * pedited) { const int index = defParams->locallab.selspot; diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index e9eddf4e5..855f2d94a 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -55,7 +55,7 @@ public: bool isvisible; int prevMethod; // 0 = Normal, 1 = Excluding int shape; // 0 = Ellipse, 1 = Rectangle - int spotMethod; // 0 = Normal, 1 = Excluding + int spotMethod; // 0 = Normal, 1 = Excluding 2 = fullimage 3 = main int sensiexclu; int structexclu; int shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) @@ -106,6 +106,7 @@ public: SpotDuplication = 4, SpotAllVisibilityChanged = 5 }; + IdleRegister idle_register; // Constructor and management functions /** @@ -220,6 +221,12 @@ public: // Batch mode management // Note: Batch mode is deactivated for Locallab + + /** + * upadte function to work with Preferences and spotMethod + */ + void updateguiset(int spottype, bool iscolor, bool issh, bool isvib, bool isexpos, bool issoft, bool isblur, bool istom, bool isret, bool issharp, bool iscont, bool iscbdl, bool islog, bool ismas, bool iscie); + void updateguiscopeset(int scope); private: // Cell renderer @@ -435,8 +442,12 @@ private: sigc::connection previewConn_; Gtk::Box* const ctboxshape; + Gtk::Box* const ctboxactivmethod; + Gtk::Box* const ctboxspotmethod; + Gtk::Box* const ctboxshapemethod; Gtk::Box* const ctboxgamut; + ToolParamBlock* const artifBox2; // Internal variables ControlPanelListener* controlPanelListener; diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 974cd36ec..2bbdcd8cd 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -2028,3 +2028,42 @@ void SpotPicker::spotSizeChanged() { _spotHalfWidth = atoi(_spotSizeSetter.get_active_text().c_str()); } + +// OptionalRadioButtonGroup class + +void OptionalRadioButtonGroup::onButtonToggled(Gtk::ToggleButton *button) +{ + if (!button) { + return; + } + + if (button->get_active()) { + if (active_button == button) { + // Same button, noting to do. + } else if (active_button) { + // Deactivate the other button. + active_button->set_active(false); + } + active_button = button; + } else { + if (active_button == button) { + // Active button got deactivated. + active_button = nullptr; + } else { + // No effect on other buttons. + } + } +} + +Gtk::ToggleButton *OptionalRadioButtonGroup::getActiveButton() const +{ + return active_button; +} + +void OptionalRadioButtonGroup::register_button(Gtk::ToggleButton &button) +{ + button.signal_toggled().connect(sigc::bind( + sigc::mem_fun(this, &OptionalRadioButtonGroup::onButtonToggled), + &button)); + onButtonToggled(&button); +} diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index e8e7d7930..169d0ae11 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -756,6 +756,30 @@ class SpotPicker : public Gtk::Grid void spotSizeChanged(); }; +/** + * Enforces the rule that zero or one registered toggle button is enabled at any + * given time. + */ +class OptionalRadioButtonGroup +{ + Gtk::ToggleButton *active_button{nullptr}; + + void onButtonToggled(Gtk::ToggleButton *button); + +public: + /** + * Returns the toggle button that is active, or null if none are active. + */ + Gtk::ToggleButton *getActiveButton() const; + /** + * Adds a toggle button to this group. + * + * If the provided button is active, any existing active button in this + * group will be deactivated. + */ + void register_button(Gtk::ToggleButton &button); +}; + inline void setActiveTextOrIndex(Gtk::ComboBoxText &comboBox, const Glib::ustring &text, int index) { bool valueSet = false; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index bc5e2144b..13b68ba6d 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -175,6 +175,28 @@ Locallab::Locallab(): toollist->setLocallabToolListListener(this); panel->pack_start(*toollist, false, false); + // Add all the tools' preview delta E buttons to one group. + for (auto button : { + expcolor.getPreviewDeltaEButton(), + expexpose.getPreviewDeltaEButton(), + expshadhigh.getPreviewDeltaEButton(), + expvibrance.getPreviewDeltaEButton(), + expsoft.getPreviewDeltaEButton(), + expblur.getPreviewDeltaEButton(), + exptonemap.getPreviewDeltaEButton(), + expreti.getPreviewDeltaEButton(), + expsharp.getPreviewDeltaEButton(), + expcontrast.getPreviewDeltaEButton(), + expcbdl.getPreviewDeltaEButton(), + explog.getPreviewDeltaEButton(), + expmask.getPreviewDeltaEButton(), + expcie.getPreviewDeltaEButton(), + }) { + if (button) { + delta_e_preview_button_group.register_button(*button); + } + } + // Add Locallab tools to panel widget ToolVBox* const toolpanel = Gtk::manage(new ToolVBox()); toolpanel->set_name("LocallabToolPanel"); @@ -249,7 +271,7 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit if (pp->locallab.spots.at(i).shape == "ELI") { r.shape = 0; - } else { + } else if (pp->locallab.spots.at(i).shape == "RECT") { r.shape = 1; } @@ -265,8 +287,10 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit r.spotMethod = 1; } else if (pp->locallab.spots.at(i).spotMethod == "full"){ r.spotMethod = 2; + } else if (pp->locallab.spots.at(i).spotMethod == "main"){ + r.spotMethod = 3; } - + r.sensiexclu = pp->locallab.spots.at(i).sensiexclu; r.structexclu = pp->locallab.spots.at(i).structexclu; @@ -420,7 +444,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited if (newSpot->shape == "ELI") { r.shape = 0; - } else { + } else if (newSpot->shape == "RECT"){ r.shape = 1; } @@ -437,6 +461,8 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r.spotMethod = 1; } else if(newSpot->spotMethod == "full") { r.spotMethod = 2; + } else if(newSpot->spotMethod == "main") { + r.spotMethod = 3; } r.sensiexclu = newSpot->sensiexclu; @@ -746,7 +772,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited if (newSpot->shape == "ELI") { r.shape = 0; - } else { + } else if (newSpot->shape == "RECT"){ r.shape = 1; } @@ -762,8 +788,10 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r.spotMethod = 1; } else if (newSpot->spotMethod == "full") { r.spotMethod = 2; + } else if (newSpot->spotMethod == "main") { + r.spotMethod = 3; } - + r.sensiexclu = newSpot->sensiexclu; r.structexclu = newSpot->structexclu; @@ -810,7 +838,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited } } - if(r.spotMethod != 2) { + if(r.spotMethod == 0 || r.spotMethod == 1 ) { r.locX = newSpot->loc.at(0); r.locXL = newSpot->loc.at(1); r.locY = newSpot->loc.at(2); @@ -960,6 +988,8 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).spotMethod = "exc"; } else if (r->spotMethod == 2) { pp->locallab.spots.at(pp->locallab.selspot).spotMethod = "full"; + } else if (r->spotMethod == 3) { + pp->locallab.spots.at(pp->locallab.selspot).spotMethod = "main"; } pp->locallab.spots.at(pp->locallab.selspot).sensiexclu = r->sensiexclu; @@ -1130,7 +1160,108 @@ void Locallab::denChanged(const std::vector &denlc, int selsp } } +// New fonctions to change Scope color +void Locallab::scopeChangedcol(int scope, int selspot, bool enab) +{ + if(enab) { + expcolor.updateguiscopecolor(scope); + } + +} +// New fonctions to change Scope Shadows Highlight +void Locallab::scopeChangedsh(int scope, int selspot, bool enab) +{ + if(enab) { + expshadhigh.updateguiscopesahd(scope); + } + +} + +// New fonctions to change Scope Vibrance + +void Locallab::scopeChangedvib(int scope, int selspot, bool enab) +{ + if(enab) { + expvibrance.updateguiscopevib(scope); + } + +} + +//reinit expsettings +void Locallab::scopeChangedset(int scope, int selspot, bool enab) +{ + if(enab) { + expsettings->updateguiscopeset(30);//30 defaut value..perhaps possible to pass default value ?? + } + +} +/* +//main new fonction global to hide show and activated or not some functions - inverse, scope... +void Locallab::mainChanged(int spottype, int selspot, bool iscolor, bool issh, bool isvib, bool isexpos, bool issoft, bool isblur, bool istom, bool isret, bool issharp, bool iscont, bool iscbdl, bool islog, bool ismas, bool iscie ) +{ + + + if(iscolor) { + expcolor.updateguicolor(spottype); + } + + if(issh) { + expshadhigh.updateguishad(spottype); + } + + if(isvib) { + expvibrance.updateguivib(spottype); + } + + if(isexpos) { + expexpose.updateguiexpos(spottype); + } + + if(issoft) { + expsoft.updateguisoft(spottype); + } + + if(isblur) { + expblur.updateguiblur(spottype); + } + + if(istom) { + exptonemap.updateguitone(spottype); + } + + if(isret) { + expreti.updateguireti(spottype); + } + + if(issharp) { + expsharp.updateguisharp(spottype); + } + + if(iscont) { + expcontrast.updateguicont(spottype); + } + + if(iscbdl) { + expcbdl.updateguicbdl(spottype); + } + + if(islog) { + explog.updateguilog(spottype); + } + + if(ismas) { + expmask.updateguimask(spottype); + } + + if(iscie) { + expcie.updateguicie(spottype); + } + + expsettings->updateguiset(spottype, iscolor, issh, isvib, isexpos, issoft, isblur, istom, isret, issharp, iscont, iscbdl, islog, ismas, iscie); + +} +*/ void Locallab::sigChanged(const std::vector &ciesig, int selspot) { cie_sig = ciesig; @@ -1168,6 +1299,86 @@ void Locallab::ciebefChanged(const std::vector &ciebef, int sels } +void Locallab::maiChanged(const std::vector &setlc, int selspot) +{ + set_lc = setlc; + if (selspot < (int) set_lc.size()) { + const int spottype = set_lc.at(selspot).mainf; + const bool iscolor = set_lc.at(selspot).iscolo; + const bool issh = set_lc.at(selspot).iss; + const bool isvib = set_lc.at(selspot).isvi; + const bool isexpos = set_lc.at(selspot).isexpo; + const bool issoft = set_lc.at(selspot).issof; + const bool isblur = set_lc.at(selspot).isblu; + const bool istom = set_lc.at(selspot).isto; + const bool isret = set_lc.at(selspot).isre; + const bool issharp = set_lc.at(selspot).isshar; + const bool iscont = set_lc.at(selspot).iscon; + const bool iscbdl = set_lc.at(selspot).iscbd; + const bool islog = set_lc.at(selspot).islo; + const bool ismas = set_lc.at(selspot).isma; + const bool iscie = set_lc.at(selspot).isci; + + if(iscolor) { + expcolor.updateguicolor(spottype); + } + + if(issh) { + expshadhigh.updateguishad(spottype); + } + + if(isvib) { + expvibrance.updateguivib(spottype); + } + + if(isexpos) { + expexpose.updateguiexpos(spottype); + } + + if(issoft) { + expsoft.updateguisoft(spottype); + } + + if(isblur) { + expblur.updateguiblur(spottype); + } + + if(istom) { + exptonemap.updateguitone(spottype); + } + + if(isret) { + expreti.updateguireti(spottype); + } + + if(issharp) { + expsharp.updateguisharp(spottype); + } + + if(iscont) { + expcontrast.updateguicont(spottype); + } + + if(iscbdl) { + expcbdl.updateguicbdl(spottype); + } + + if(islog) { + explog.updateguilog(spottype); + } + + if(ismas) { + expmask.updateguimask(spottype); + } + + if(iscie) { + expcie.updateguicie(spottype); + } + + expsettings->updateguiset(spottype, iscolor, issh, isvib, isexpos, issoft, isblur, istom, isret, issharp, iscont, iscbdl, islog, ismas, iscie); + } +} + void Locallab::cieChanged(const std::vector &cielc, int selspot) { // Saving transmitted min/max data @@ -1231,6 +1442,30 @@ void Locallab::resetMaskVisibility() // Reset deltaE preview expsettings->resetDeltaEPreview(); + for (auto tool : std::initializer_list{ + &expcolor, + &expexpose, + &expshadhigh, + &expvibrance, + &expsoft, + &expblur, + &exptonemap, + &expreti, + &expsharp, + &expcontrast, + &expcbdl, + &explog, + &expmask, + &expcie, + }) { + auto button = tool->getPreviewDeltaEButton(); + auto connection = tool->getPreviewDeltaEButtonConnection(); + if (button && connection) { + connection->block(); + button->set_active(false); + connection->unblock(); + } + } // Reset mask preview for all Locallab tools for (auto tool : locallabTools) { @@ -1370,6 +1605,12 @@ void Locallab::resetToolMaskView() for (auto tool : locallabTools) { tool->resetMaskView(); } + + // Deactivate any preview delta E toggle button. + auto active_preview_button = delta_e_preview_button_group.getActiveButton(); + if (active_preview_button) { + active_preview_button->set_active(false); + } } void Locallab::resetOtherMaskView(LocallabTool* current) diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 1848e6481..0add444ac 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -25,6 +25,7 @@ #pragma once #include "controlspotpanel.h" +#include "guiutils.h" #include "locallabtools.h" /* ==== LocallabToolListListener ==== */ @@ -118,6 +119,8 @@ private: LocallabMask expmask; Locallabcie expcie; + OptionalRadioButtonGroup delta_e_preview_button_group; + std::vector locallabTools; // Locallab tools mask background management data @@ -131,6 +134,8 @@ private: std::vector cie_lc; + std::vector set_lc; + std::vector cie_sig; // Locallab tools mask background management data @@ -154,7 +159,16 @@ public: // Locallab Retinex tool min/man management function void minmaxChanged(const std::vector &minmax, int selspot) override; - + + // new functions for global - normal use +// void mainChanged(int spottype, int selspot, bool iscolor, bool issh, bool isvib, bool isexpos, bool issoft, bool isblur, bool istom, bool isret, bool issharp, bool iscont, bool iscbdl, bool islog, bool ismas, bool iscie)override; + void scopeChangedcol(int scope, int selspot, bool enab)override; + void scopeChangedsh(int scope, int selspot, bool enab)override; + void scopeChangedvib(int scope, int selspot, bool enab)override; + void scopeChangedset(int scope, int selspot, bool enab)override; + + void maiChanged(const std::vector &setlc, int selspot) override; + //Locallab denoise // Locallab Retinex tool min/man management function void denChanged(const std::vector &denlc, int selspot) override; diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index 7db035e0b..fd4ed22be 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -300,6 +300,16 @@ void LocallabTool::refChanged(const double huer, const double lumar, const doubl updateMaskBackground(normChromar, normLumar, normHuer, normHuerjz); } +Gtk::ToggleButton *LocallabTool::getPreviewDeltaEButton() const +{ + return nullptr; +} + +sigc::connection *LocallabTool::getPreviewDeltaEButtonConnection() +{ + return nullptr; +} + void LocallabTool::colorForValue(double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller) { float R = 0.f; @@ -367,6 +377,8 @@ void LocallabTool::enableListener() } } + + bool LocallabTool::on_remove_change(GdkEventButton* event) { if (event->button == GDK_BUTTON_PRIMARY) { @@ -445,7 +457,9 @@ LocallabColor::LocallabColor(): labgrid(Gtk::manage(new LabGrid(EvLocallabLabGridValue, M("TP_LOCALLAB_LABGRID_VALUES"), true, false))), gridMethod(Gtk::manage(new MyComboBoxText())), strengthgrid(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRGRID"), 0, 100, 1, 30))), - sensi(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))), + sensi(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 30))), + previewcol(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), + structcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL1"), 0, 100, 1, 0))), blurcolde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), softradiuscol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.5, 0.))), @@ -526,6 +540,8 @@ LocallabColor::LocallabColor(): LLmaskcolshapewav(static_cast(mask2CurveEditorGwav->addCurve(CT_Flat, "L(L)", nullptr, false, false))), csThresholdcol(Gtk::manage(new ThresholdAdjuster(M("TP_LOCALLAB_CSTHRESHOLDBLUR"), 0, 9, 0, 0, 6, 5, 0, false))) { + auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewcol = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWCOL"); set_orientation(Gtk::ORIENTATION_VERTICAL); @@ -596,6 +612,11 @@ LocallabColor::LocallabColor(): setExpandAlignProperties(expcurvcol, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + previewcol->set_active(false); + previewcolConn = previewcol->signal_clicked().connect( + sigc::mem_fun( + *this, &LocallabColor::previewcolChanged)); + qualitycurveMethod->append(M("TP_LOCALLAB_CURVNONE")); qualitycurveMethod->append(M("TP_LOCALLAB_CURVCURR")); qualitycurveMethod->set_active(0); @@ -813,6 +834,9 @@ LocallabColor::LocallabColor(): // Add Color & Light specific widgets to GUI pack_start(*reparcol); + pack_start(*sensi); + pack_start(*previewcol); + pack_start(*invers); ToolParamBlock* const lumBox = Gtk::manage(new ToolParamBlock()); lumBox->pack_start(*lightness); @@ -833,7 +857,7 @@ LocallabColor::LocallabColor(): superBox->pack_start(*gridFrame); superFrame->add(*superBox); pack_start(*superFrame); - // pack_start(*sensi); + // pack_start(*sensi); pack_start(*structcol); pack_start(*blurcolde); pack_start(*softradiuscol); @@ -949,6 +973,22 @@ LocallabColor::~LocallabColor() delete mask2CurveEditorGwav; } +void LocallabColor::previewcolChanged() +{ + + if(previewcol->get_active()) { + showmaskcolMethod->set_active(5); + } else { + showmaskcolMethod->set_active(0); + } + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewcol,""); + } + } +} + void LocallabColor::setListener(ToolPanelListener* tpl) { LocallabTool::setListener(tpl); @@ -957,6 +997,64 @@ void LocallabColor::setListener(ToolPanelListener* tpl) labgridmerg->setListener(tpl); } +//new function Global +void LocallabColor::updateguicolor(int spottype) +{ + { + // Disable all listeners + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + invers->hide(); + sensi->hide(); + showmaskcolMethod->set_active(0); + previewcol->hide(); + previewcol->set_active(false); + resetMaskView(); + } else { + invers->show(); + sensi->show(); + if(!invers->get_active()) { + previewcol->show(); + } else { + previewcol->hide(); + } + + } + enableListener(); + + return false; + } + ); + } + +} + +//new function scope +void LocallabColor::updateguiscopecolor(int scope) +{ + { + idle_register.add( + [this, scope]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + disableListener(); + sensi->setValue(scope); + enableListener(); + + return false; + } + ); + } + +} + + bool LocallabColor::isMaskViewActive() { return ((showmaskcolMethod->get_active_row_number() != 0) || (showmaskcolMethodinv->get_active_row_number() != 0)); @@ -980,6 +1078,16 @@ void LocallabColor::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, colorMaskinv = showmaskcolMethodinv->get_active_row_number(); } +Gtk::ToggleButton *LocallabColor::getPreviewDeltaEButton() const +{ + return previewcol; +} + +sigc::connection *LocallabColor::getPreviewDeltaEButtonConnection() +{ + return &previewcolConn; +} + void LocallabColor::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { @@ -1550,7 +1658,7 @@ void LocallabColor::setDefaults(const rtengine::procparams::ProcParams* defParam void LocallabColor::adjusterChanged(Adjuster* a, double newval) { if (isLocActivated && exp->getEnabled()) { - if (a == lightness) { + if (a == lightness) { if (listener) { listener->panelChanged(Evlocallablightness, lightness->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -1595,7 +1703,7 @@ void LocallabColor::adjusterChanged(Adjuster* a, double newval) if (a == sensi) { if (listener) { listener->panelChanged(Evlocallabsensi, - sensi->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); + sensi->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); } } @@ -2574,6 +2682,8 @@ LocallabExposure::LocallabExposure(): fatanchor(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATANCHOR"), 0.1, 100.0, 0.01, 50., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), gamex(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMC"), 0.5, 3.0, 0.05, 1.))), sensiex(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), + previewexe(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), + structexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), blurexpde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), exptoolexp(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_EXPTOOL")))), @@ -2625,6 +2735,8 @@ LocallabExposure::LocallabExposure(): set_orientation(Gtk::ORIENTATION_VERTICAL); const LocallabParams::LocallabSpot defSpot; + auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewexe = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWEXE"); // Parameter Exposure specific widgets expMethod->append(M("TP_LOCALLAB_STD")); @@ -2706,6 +2818,12 @@ LocallabExposure::LocallabExposure(): lowthrese->setAdjusterListener(this); higthrese->setAdjusterListener(this); decaye->setAdjusterListener(this); + + previewexe->set_active(false); + previewexeConn = previewexe->signal_clicked().connect( + sigc::mem_fun( + *this, &LocallabExposure::previewexeChanged)); + setExpandAlignProperties(exprecove, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); normConn = norm->signal_toggled().connect(sigc::mem_fun(*this, &LocallabExposure::normChanged)); fatsaturConn = fatsatur->signal_toggled().connect(sigc::mem_fun(*this, &LocallabExposure::fatsaturChanged)); @@ -2781,6 +2899,7 @@ LocallabExposure::LocallabExposure(): // Add Color & Light specific widgets to GUI pack_start(*sensiex); + pack_start(*previewexe); pack_start(*reparexp); pack_start(*inversex); ToolParamBlock* const pdeBox = Gtk::manage(new ToolParamBlock()); @@ -2873,6 +2992,60 @@ bool LocallabExposure::isMaskViewActive() return ((showmaskexpMethod->get_active_row_number() != 0) || (showmaskexpMethodinv->get_active_row_number() != 0)); } +//new function Global +void LocallabExposure::updateguiexpos(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + inversex->hide(); + sensiex->hide(); + previewexe->hide(); + showmaskexpMethod->set_active(0); + previewexe->set_active(false); + + resetMaskView(); + } else { + inversex->show(); + sensiex->show(); + if(!inversex->get_active()) { + previewexe->show(); + } else { + previewexe->hide(); + } + } + enableListener(); + + return false; + } + ); + } + +} + +void LocallabExposure::previewexeChanged() +{ + + if(previewexe->get_active()) { + showmaskexpMethod->set_active(5); + } else { + showmaskexpMethod->set_active(0); + } + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewexe,""); + } + } +} + + void LocallabExposure::resetMaskView() { showmaskexpMethodConn.block(true); @@ -2891,6 +3064,16 @@ void LocallabExposure::getMaskView(int &colorMask, int &colorMaskinv, int &expMa expMaskinv = showmaskexpMethodinv->get_active_row_number(); } +Gtk::ToggleButton *LocallabExposure::getPreviewDeltaEButton() const +{ + return previewexe; +} + +sigc::connection *LocallabExposure::getPreviewDeltaEButtonConnection() +{ + return &previewexeConn; +} + void LocallabExposure::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { @@ -3616,6 +3799,7 @@ void LocallabExposure::convertParamToSimple() softradiusexp->setValue(defSpot.softradiusexp); enaExpMask->set_active(defSpot.enaExpMask); enaExpMaskaft->set_active(defSpot.enaExpMaskaft); + showmaskexpMethod->set_active(0); gamex->setValue(defSpot.gamex); // CCmaskexpshape->setCurve(defSpot.CCmaskexpcurve); // LLmaskexpshape->setCurve(defSpot.CCmaskexpcurve); @@ -4040,7 +4224,8 @@ LocallabShadow::LocallabShadow(): shadows(Gtk::manage(new Adjuster(M("TP_SHADOWSHLIGHTS_SHADOWS"), 0, 100, 1, 0))), s_tonalwidth(Gtk::manage(new Adjuster(M("TP_SHADOWSHLIGHTS_SHTONALW"), 10, 100, 1, 30))), sh_radius(Gtk::manage(new Adjuster(M("TP_SHADOWSHLIGHTS_RADIUS"), 0, 100, 1, 40))), - sensihs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))),//unused here, but used for normalize_mean_dt + sensihs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 30))),//reused - unused here, but used for normalize_mean_dt + previewsh(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), blurSHde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), exprecovs(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), maskusables(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), @@ -4078,6 +4263,9 @@ LocallabShadow::LocallabShadow(): fatanchorSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATANCHOR"), 1., 100., 1., 50., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), EvlocallabTePivot(ProcEventMapper::getInstance()->newEvent(AUTOEXP, "HISTORY_MSG_LOCALLAB_TE_PIVOT")) { + auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewsh = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWSH"); + set_orientation(Gtk::ORIENTATION_VERTICAL); const LocallabParams::LocallabSpot defSpot; @@ -4134,6 +4322,11 @@ LocallabShadow::LocallabShadow(): setExpandAlignProperties(expmasksh, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + previewsh->set_active(false); + previewshConn = previewsh->signal_clicked().connect( + sigc::mem_fun( + *this, &LocallabShadow::previewshChanged)); + showmaskSHMethod->append(M("TP_LOCALLAB_SHOWMNONE")); showmaskSHMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmaskSHMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); @@ -4196,6 +4389,9 @@ LocallabShadow::LocallabShadow(): // Add Shadow highlight specific widgets to GUI pack_start(*reparsh); + pack_start(*sensihs);// reused / unused here, but used for normalize_mean_dt + pack_start(*previewsh); + pack_start(*inverssh); pack_start(*shMethod); @@ -4210,7 +4406,7 @@ LocallabShadow::LocallabShadow(): pack_start(*shadows); pack_start(*s_tonalwidth); pack_start(*sh_radius); - // pack_start(*sensihs);//unused here, but used for normalize_mean_dt +// pack_start(*sensihs);// reused / unused here, but used for normalize_mean_dt pack_start(*blurSHde); ToolParamBlock* const shBox3 = Gtk::manage(new ToolParamBlock()); shBox3->pack_start(*maskusables, Gtk::PACK_SHRINK, 0); @@ -4278,6 +4474,90 @@ void LocallabShadow::resetMaskView() showmaskSHMethodConninv.block(false); } +Gtk::ToggleButton *LocallabShadow::getPreviewDeltaEButton() const +{ + return previewsh; +} + +sigc::connection *LocallabShadow::getPreviewDeltaEButtonConnection() +{ + return &previewshConn; +} + +void LocallabShadow::previewshChanged() +{ + + if(previewsh->get_active()) { + showmaskSHMethod->set_active(4); + } else { + showmaskSHMethod->set_active(0); + } + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewsh,""); + } + } +} + + +//new function Global +void LocallabShadow::updateguishad(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + inverssh->hide(); + sensihs->hide(); + showmaskSHMethod->set_active(0); + previewsh->hide(); + previewsh->set_active(false); + resetMaskView(); + } else { + sensihs->show(); + inverssh->show(); + if(!inverssh->get_active()) { + previewsh->show(); + } else { + previewsh->hide(); + } + + } + enableListener(); + + return false; + } + ); + } + +} + +void LocallabShadow::updateguiscopesahd(int scope) +{ + { + idle_register.add( + [this, scope]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + disableListener(); + sensihs->setValue(scope); + + enableListener(); + return false; + } + ); + } + +} + + + void LocallabShadow::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) { shMask = showmaskSHMethod->get_active_row_number(); @@ -5154,7 +5434,8 @@ LocallabVibrance::LocallabVibrance(): protectSkins(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PROTECTSKINS")))), avoidColorShift(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_AVOIDCOLORSHIFT")))), pastSatTog(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PASTSATTOG")))), - sensiv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))),//unused here, but used for normalize_mean_dt + sensiv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 30))),//reused - unused here, but used for normalize_mean_dt + previewvib(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), curveEditorGG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL"))), skinTonesCurve(static_cast(curveEditorGG->addCurve(CT_Diagonal, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES")))), exprecovv(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), @@ -5186,6 +5467,9 @@ LocallabVibrance::LocallabVibrance(): mask2vibCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), Lmaskvibshape(static_cast(mask2vibCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) { + auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewvib = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWVIB"); + set_orientation(Gtk::ORIENTATION_VERTICAL); float R, G, B; @@ -5250,6 +5534,11 @@ LocallabVibrance::LocallabVibrance(): angvib->set_tooltip_text(M("TP_LOCALLAB_GRADANG_TOOLTIP")); angvib->setAdjusterListener(this); + previewvib->set_active(false); + previewvibConn = previewvib->signal_clicked().connect( + sigc::mem_fun( + *this, &LocallabVibrance::previewvibChanged)); + setExpandAlignProperties(expmaskvib, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); showmaskvibMethod->append(M("TP_LOCALLAB_SHOWMNONE")); @@ -5301,6 +5590,8 @@ LocallabVibrance::LocallabVibrance(): mask2vibCurveEditorG->curveListComplete(); // Add Vibrance specific widgets to GUI + pack_start(*sensiv, Gtk::PACK_SHRINK, 0);//reused - nused here, but used for normalize_mean_dt + pack_start(*previewvib, Gtk::PACK_SHRINK, 0); pack_start(*saturated, Gtk::PACK_SHRINK, 0); pack_start(*pastels, Gtk::PACK_SHRINK, 0); pack_start(*vibgam, Gtk::PACK_SHRINK, 0); @@ -5311,7 +5602,7 @@ LocallabVibrance::LocallabVibrance(): pack_start(*protectSkins, Gtk::PACK_SHRINK, 0); pack_start(*avoidColorShift, Gtk::PACK_SHRINK, 0); pack_start(*pastSatTog, Gtk::PACK_SHRINK, 0); - // pack_start(*sensiv, Gtk::PACK_SHRINK, 0);//unused here, but used for normalize_mean_dt +// pack_start(*sensiv, Gtk::PACK_SHRINK, 0);//reused - nused here, but used for normalize_mean_dt pack_start(*curveEditorGG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor ToolParamBlock* const vibBox3 = Gtk::manage(new ToolParamBlock()); vibBox3->pack_start(*maskusablev, Gtk::PACK_SHRINK, 0); @@ -5365,6 +5656,81 @@ void LocallabVibrance::resetMaskView() showmaskvibMethodConn.block(false); } +Gtk::ToggleButton *LocallabVibrance::getPreviewDeltaEButton() const +{ + return previewvib; +} + +sigc::connection *LocallabVibrance::getPreviewDeltaEButtonConnection() +{ + return &previewvibConn; +} + +//new function Global +void LocallabVibrance::updateguivib(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensiv->hide(); + showmaskvibMethod->set_active(0); + previewvib->hide(); + previewvib->set_active(false); + resetMaskView(); + } else { + sensiv->show(); + previewvib->show(); + } + enableListener(); + + return false; + } + ); + } + +} + +void LocallabVibrance::previewvibChanged() +{ + + if(previewvib->get_active()) { + showmaskvibMethod->set_active(4); + } else { + showmaskvibMethod->set_active(0); + } + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewvib,""); + } + } +} + +//new function scope +void LocallabVibrance::updateguiscopevib(int scope) +{ + { + idle_register.add( + [this, scope]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + disableListener(); + sensiv->setValue(scope); + enableListener(); + + return false; + } + ); + } + +} + void LocallabVibrance::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) { vibMask = showmaskvibMethod->get_active_row_number(); @@ -6188,6 +6554,32 @@ void LocallabSoft::resetMaskView() showmasksoftMethodConn.block(false); } +//new function Global +void LocallabSoft::updateguisoft(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensisf->hide(); + } else { + sensisf->show(); + } + enableListener(); + + return false; + } + ); + } + +} + + void LocallabSoft::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) { softMask = showmasksoftMethod->get_active_row_number(); @@ -7062,6 +7454,39 @@ void LocallabBlur::resetMaskView() showmaskblMethodConn.block(false); } +//new function Global +void LocallabBlur::updateguiblur(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensibn->hide(); + sensiden->hide(); + invbl->hide(); + + } else { + sensibn->show(); + sensiden->show(); + invbl->show(); + + } + enableListener(); + + return false; + } + ); + } + +} + + + void LocallabBlur::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) { blMask = showmaskblMethod->get_active_row_number(); diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 1d43b6ef1..17f9bd5cb 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -55,6 +55,15 @@ protected: Normal = 1, Simple = 2 }; + rtengine::ProcEvent Evlocallabpreviewcol; + rtengine::ProcEvent Evlocallabpreviewexe; + rtengine::ProcEvent Evlocallabpreviewsh; + rtengine::ProcEvent Evlocallabpreviewvib; + rtengine::ProcEvent Evlocallabpreviewtm; + rtengine::ProcEvent Evlocallabpreviewlc; + rtengine::ProcEvent Evlocallabpreviewlog; + rtengine::ProcEvent Evlocallabpreviewcie; + rtengine::ProcEvent Evlocallabpreviewmas; rtengine::ProcEvent Evlocallabnormcie; rtengine::ProcEvent Evlocallabstrumaskcie; rtengine::ProcEvent EvLocallabtoolcie; @@ -186,6 +195,9 @@ public: virtual void resetMaskView() {}; virtual void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) {}; + virtual Gtk::ToggleButton *getPreviewDeltaEButton() const; + virtual sigc::connection *getPreviewDeltaEButtonConnection(); + // Advice tooltips management function virtual void updateAdviceTooltips(const bool showTooltips) {}; @@ -248,6 +260,8 @@ private: MyComboBoxText* const gridMethod; Adjuster* const strengthgrid; Adjuster* const sensi; + Gtk::ToggleButton* const previewcol; + Adjuster* const structcol; Adjuster* const blurcolde; Adjuster* const softradiuscol; @@ -326,18 +340,20 @@ private: FlatCurveEditor* const LLmaskcolshapewav; ThresholdAdjuster* const csThresholdcol; - sigc::connection curvactivConn, gridMethodConn, inversConn, qualitycurveMethodConn, toneMethodConn, specialConn, merMethodConn, mergecolMethodConn, showmaskcolMethodConn, showmaskcolMethodConninv, enaColorMaskConn, toolcolConn, fftColorMaskConn; + sigc::connection curvactivConn, previewcolConn, gridMethodConn, inversConn, qualitycurveMethodConn, toneMethodConn, specialConn, merMethodConn, mergecolMethodConn, showmaskcolMethodConn, showmaskcolMethodConninv, enaColorMaskConn, toolcolConn, fftColorMaskConn; public: LocallabColor(); ~LocallabColor(); void setListener(ToolPanelListener* tpl) override; - bool isMaskViewActive() override; void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; + void updateAdviceTooltips(const bool showTooltips) override; void setDefaultExpanderVisibility() override; @@ -354,6 +370,9 @@ public: void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override {}; // Not used void adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) override; void curveChanged(CurveEditor* ce) override; + void updateguicolor(int spottype); + void updateguiscopecolor(int scope); + void previewcolChanged(); private: void enabledChanged() override; @@ -362,7 +381,6 @@ private: void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer, const double normHuerjz) override; - void curvactivChanged(); void gridMethodChanged(); void inversChanged(); @@ -376,7 +394,6 @@ private: void enaColorMaskChanged(); void toolcolChanged(); void fftColorMaskChanged(); - void updateColorGUI1(); void updateColorGUI2(); void updateColorGUI3(); @@ -409,6 +426,8 @@ private: Adjuster* const fatanchor; Adjuster* const gamex; Adjuster* const sensiex; + Gtk::ToggleButton* const previewexe; + Adjuster* const structexp; Adjuster* const blurexpde; MyExpander* const exptoolexp; @@ -456,7 +475,7 @@ private: DiagonalCurveEditor* const Lmaskexpshape; rtengine::ProcEvent Evlocallabtmosatur; - sigc::connection expMethodConn, exnoiseMethodConn, inversexConn, normConn, fatsaturConn, showmaskexpMethodConn, showmaskexpMethodConninv, enaExpMaskConn, enaExpMaskaftConn; + sigc::connection expMethodConn, exnoiseMethodConn, previewexeConn, inversexConn, normConn, fatsaturConn, showmaskexpMethodConn, showmaskexpMethodConninv, enaExpMaskConn, enaExpMaskaftConn; public: LocallabExposure(); @@ -466,6 +485,9 @@ public: void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; + void updateAdviceTooltips(const bool showTooltips) override; void setDefaultExpanderVisibility() override; @@ -476,6 +498,8 @@ public: void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; void curveChanged(CurveEditor* ce) override; + void updateguiexpos(int spottype); + void previewexeChanged(); private: void enabledChanged() override; @@ -519,6 +543,8 @@ private: Adjuster* const s_tonalwidth; Adjuster* const sh_radius; Adjuster* const sensihs; + Gtk::ToggleButton* const previewsh; + Adjuster* const blurSHde; MyExpander* const exprecovs; Gtk::Label* const maskusables; @@ -556,7 +582,7 @@ private: rtengine::ProcEvent EvlocallabTePivot; - sigc::connection shMethodConn, inversshConn, showmaskSHMethodConn, showmaskSHMethodConninv, enaSHMaskConn; + sigc::connection shMethodConn, previewshConn, inversshConn, showmaskSHMethodConn, showmaskSHMethodConninv, enaSHMaskConn; public: LocallabShadow(); @@ -566,8 +592,13 @@ public: void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; - void updateAdviceTooltips(const bool showTooltips) override; + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; + void updateAdviceTooltips(const bool showTooltips) override; + void updateguishad(int spottype); + void updateguiscopesahd(int scope); + void setDefaultExpanderVisibility() override; void disableListener() override; void enableListener() override; @@ -576,6 +607,7 @@ public: void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; void curveChanged(CurveEditor* ce) override; + void previewshChanged(); private: void enabledChanged() override; @@ -613,6 +645,8 @@ private: Gtk::CheckButton* const avoidColorShift; Gtk::CheckButton* const pastSatTog; Adjuster* const sensiv; + Gtk::ToggleButton* const previewvib; + CurveEditorGroup* const curveEditorGG; DiagonalCurveEditor* const skinTonesCurve; MyExpander* const exprecovv; @@ -643,7 +677,7 @@ private: CurveEditorGroup* const mask2vibCurveEditorG; DiagonalCurveEditor* const Lmaskvibshape; - sigc::connection pskinsConn, ashiftConn, pastsattogConn, showmaskvibMethodConn, enavibMaskConn; + sigc::connection pskinsConn, previewvibConn, ashiftConn, pastsattogConn, showmaskvibMethodConn, enavibMaskConn; public: LocallabVibrance(); @@ -653,7 +687,12 @@ public: void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; + void updateAdviceTooltips(const bool showTooltips) override; + void updateguivib(int spottype); + void updateguiscopevib(int scope); void setDefaultExpanderVisibility() override; void disableListener() override; @@ -670,6 +709,7 @@ public: void adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) override {}; // Not used std::vector getCurvePoints(ThresholdSelector* tAdjuster) const override; void curveChanged(CurveEditor* ce) override; + void previewvibChanged(); private: void enabledChanged() override; @@ -712,6 +752,7 @@ public: void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; void updateAdviceTooltips(const bool showTooltips) override; + void updateguisoft(int spottype); void disableListener() override; void enableListener() override; @@ -765,6 +806,7 @@ private: Adjuster* const lowthres; Adjuster* const higthres; Adjuster* const sensibn; + MyComboBoxText* const blurMethod; Gtk::CheckButton* const invbl; MyComboBoxText* const chroMethod; @@ -827,6 +869,7 @@ private: Adjuster* const nlgam; Adjuster* const bilateral; Adjuster* const sensiden; + Adjuster* const reparden; Gtk::Button* neutral; MyExpander* const expmaskbl; @@ -863,13 +906,13 @@ public: ~LocallabBlur(); void updatedenlc(const double highres, const double nres, const double highres46, const double nres46, const double Lhighres, const double Lnres, const double Lhighres46, const double Lnres46); - bool isMaskViewActive() override; void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; void updateAdviceTooltips(const bool showTooltips) override; void neutral_pressed(); + void updateguiblur(int spottype); void setDefaultExpanderVisibility() override; void disableListener() override; @@ -931,6 +974,8 @@ private: Adjuster* const rewei; Adjuster* const softradiustm; Adjuster* const sensitm; + Gtk::ToggleButton* const previewtm; + MyExpander* const exprecovt; Gtk::Label* const maskusablet; Gtk::Label* const maskunusablet; @@ -955,7 +1000,7 @@ private: CurveEditorGroup* const mask2tmCurveEditorG; DiagonalCurveEditor* const Lmasktmshape; - sigc::connection equiltmConn, showmasktmMethodConn, enatmMaskConn, enatmMaskaftConn; + sigc::connection equiltmConn, previewtmConn, showmasktmMethodConn, enatmMaskConn, enatmMaskaftConn; public: LocallabTone(); @@ -965,8 +1010,12 @@ public: void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; - void updateAdviceTooltips(const bool showTooltips) override; + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; + void updateAdviceTooltips(const bool showTooltips) override; + void updateguitone(int spottype); + void previewtmChanged(); void setDefaultExpanderVisibility() override; void disableListener() override; void enableListener() override; @@ -1062,6 +1111,7 @@ public: ~LocallabRetinex(); void updateMinMax(const double cdma, const double cdmin, const double mini, const double maxi, const double Tmean, const double Tsigma, const double Tmin, const double Tmax); + void updateguireti(int spottype); bool isMaskViewActive() override; void resetMaskView() override; @@ -1128,6 +1178,7 @@ public: void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; void updateAdviceTooltips(const bool showTooltips) override; + void updateguisharp(int spottype); void disableListener() override; void enableListener() override; @@ -1176,6 +1227,8 @@ private: Adjuster* const residgam; Adjuster* const residslop; Adjuster* const sensilc; + Gtk::ToggleButton* const previewlc; + Adjuster* const reparw; Gtk::Frame* const clariFrame; Adjuster* const clarilres; @@ -1251,7 +1304,7 @@ private: CurveEditorGroup* const mask2lcCurveEditorG; DiagonalCurveEditor* const Lmasklcshape; - sigc::connection localcontMethodConn, origlcConn, wavgradlConn, wavedgConn, localedgMethodConn, waveshowConn, localneiMethodConn, wavblurConn, blurlcConn, wavcontConn, wavcompreConn, wavcompConn, fftwlcConn, showmasklcMethodConn, enalcMaskConn; + sigc::connection localcontMethodConn, previewlcConn, origlcConn, wavgradlConn, wavedgConn, localedgMethodConn, waveshowConn, localneiMethodConn, wavblurConn, blurlcConn, wavcontConn, wavcompreConn, wavcompConn, fftwlcConn, showmasklcMethodConn, enalcMaskConn; public: LocallabContrast(); @@ -1261,8 +1314,11 @@ public: void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; - void updateAdviceTooltips(const bool showTooltips) override; + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; + void updateAdviceTooltips(const bool showTooltips) override; + void updateguicont(int spottype); void setDefaultExpanderVisibility() override; void disableListener() override; void enableListener() override; @@ -1277,6 +1333,7 @@ public: void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override {}; // Not used void adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) override; void curveChanged(CurveEditor* ce) override; + void previewlcChanged(); private: void enabledChanged() override; @@ -1361,6 +1418,7 @@ public: void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; void updateAdviceTooltips(const bool showTooltips) override; + void updateguicbdl(int spottype); void setDefaultExpanderVisibility() override; void disableListener() override; @@ -1443,6 +1501,8 @@ private: Adjuster* const decayl; Adjuster* const sensilog; + Gtk::ToggleButton* const previewlog; + Gtk::Frame* const gradlogFrame; Adjuster* const strlog; Adjuster* const anglog; @@ -1461,7 +1521,7 @@ private: sigc::connection autoconn, ciecamconn, fullimageConn, AutograyConn; sigc::connection surroundconn, sursourconn, satlogconn; - sigc::connection showmaskLMethodConn, enaLMaskConn; + sigc::connection showmaskLMethodConn, enaLMaskConn, previewlogConn; public: LocallabLog(); ~LocallabLog(); @@ -1469,6 +1529,11 @@ public: bool isMaskViewActive() override; void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; + void updateguilog(int spottype); + void previewlogChanged(); + + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; void updateAdviceTooltips(const bool showTooltips) override; void surroundChanged(); @@ -1514,6 +1579,8 @@ class LocallabMask: { private: Adjuster* const sensimask; + Gtk::ToggleButton* const previewmas; + Adjuster* const blendmask; Adjuster* const blendmaskab; Adjuster* const softradiusmask; @@ -1548,7 +1615,7 @@ private: Adjuster* const str_mask; Adjuster* const ang_mask; - sigc::connection showmask_MethodConn, enamaskConn, toolmaskConn, fftmaskConn; + sigc::connection showmask_MethodConn, previewmasConn, enamaskConn, toolmaskConn, fftmaskConn; public: LocallabMask(); @@ -1558,7 +1625,12 @@ public: void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; + void updateAdviceTooltips(const bool showTooltips) override; + void updateguimask(int spottype); + void previewmasChanged(); void disableListener() override; void enableListener() override; @@ -1601,6 +1673,8 @@ class Locallabcie: { private: Adjuster* const sensicie; + Gtk::ToggleButton* const previewcie; + Adjuster* const reparcie; Gtk::CheckButton* const jabcie; MyComboBoxText* const modecam; @@ -1838,6 +1912,7 @@ private: int nextcomprciecount = 0; sigc::connection AutograycieConn, primMethodconn, illMethodconn, smoothciemetconn, catMethodconn, forcejzConn, forcebwConn, qtojConn, showmaskcieMethodConn, enacieMaskConn, enacieMaskallConn, jabcieConn, sursourcieconn, surroundcieconn, modecieconn, modecamconn, comprcieautoconn, normcieconn, logcieconn, satcieconn, logcieqconn,smoothcieconn, smoothcieybconn,smoothcielumconn, logjzconn, sigjzconn, sigqconn, chjzcieconn, toneMethodcieConn, toneMethodcieConn2, toolcieConn, bwevMethodConn, fftcieMaskConn, gamutcieconn, bwcieconn, expprecamconn, sigcieconn; + sigc::connection previewcieConn, sigmoidqjcieconn; public: Locallabcie(); ~Locallabcie(); @@ -1848,9 +1923,13 @@ public: void resetMaskView() override; void getMaskView(int &colorMask, int &colorMaskinv, int &expMask, int &expMaskinv, int &shMask, int &shMaskinv, int &vibMask, int &softMask, int &blMask, int &tmMask, int &retiMask, int &sharMask, int &lcMask, int &cbMask, int &logMask, int &maskMask, int &cieMask) override; + Gtk::ToggleButton *getPreviewDeltaEButton() const override; + sigc::connection *getPreviewDeltaEButtonConnection() override; + void updateAdviceTooltips(const bool showTooltips) override; void setDefaultExpanderVisibility() override; - + void updateguicie(int spottype); + void previewcieChanged(); void disableListener() override; void enableListener() override; void read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override; diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 17b5d3ead..af09224b5 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -132,6 +132,7 @@ LocallabTone::LocallabTone(): rewei(Gtk::manage(new Adjuster(M("TP_LOCALLAB_REWEI"), 0, 3, 1, 0))), softradiustm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 0.))),//unused here, but used for normalize_mean_dt sensitm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), + previewtm(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), exprecovt(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), maskusablet(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), maskunusablet(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUNUSABLE")))), @@ -157,6 +158,9 @@ LocallabTone::LocallabTone(): mask2tmCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), Lmasktmshape(static_cast(mask2tmCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) { + auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewtm = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWTM"); + set_orientation(Gtk::ORIENTATION_VERTICAL); const LocallabParams::LocallabSpot defSpot; @@ -191,6 +195,11 @@ LocallabTone::LocallabTone(): decayt->setAdjusterListener(this); setExpandAlignProperties(exprecovt, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + previewtm->set_active(false); + previewtmConn = previewtm->signal_clicked().connect( + sigc::mem_fun( + *this, &LocallabTone::previewtmChanged)); + setExpandAlignProperties(expmasktm, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); showmasktmMethod->append(M("TP_LOCALLAB_SHOWMNONE")); @@ -246,6 +255,7 @@ LocallabTone::LocallabTone(): // Add Tone Mapping specific widgets to GUI // pack_start(*amount); // To use if we change transit_shapedetect parameters pack_start(*sensitm); + pack_start(*previewtm); pack_start(*repartm); pack_start(*separatortm); pack_start(*stren); @@ -307,6 +317,16 @@ void LocallabTone::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, tmMask = showmasktmMethod->get_active_row_number(); } +Gtk::ToggleButton *LocallabTone::getPreviewDeltaEButton() const +{ + return previewtm; +} + +sigc::connection *LocallabTone::getPreviewDeltaEButtonConnection() +{ + return &previewtmConn; +} + void LocallabTone::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { @@ -395,6 +415,58 @@ void LocallabTone::enableListener() enatmMaskaftConn.block(false); } +//new function Global +void LocallabTone::updateguitone(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensitm->hide(); + // showmasktmMethodConn.block(true); + showmasktmMethod->set_active(0); + // showmasktmMethodConn.block(false); + previewtm->hide(); + // previewtmConn.block(true); + previewtm->set_active(false); + // previewtmConn.block(false); + resetMaskView(); + } else { + sensitm->show(); + previewtm->show(); + } + enableListener(); + + return false; + } + ); + } + +} + +void LocallabTone::previewtmChanged() +{ + // showmasktmMethodConn.block(true); + + if(previewtm->get_active()) { + showmasktmMethod->set_active(4); + } else { + showmasktmMethod->set_active(0); + } + // showmasktmMethodConn.block(false); + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewtm,""); + } + } +} + void LocallabTone::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) { // Disable all listeners @@ -945,7 +1017,7 @@ LocallabRetinex::LocallabRetinex(): showmaskretiMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmaskretiMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); showmaskretiMethod->append(M("TP_LOCALLAB_SHOWMASK")); - showmaskretiMethod->append(M("TP_LOCALLAB_SHOWREF")); + // showmaskretiMethod->append(M("TP_LOCALLAB_SHOWREF")); showmaskretiMethod->set_active(0); showmaskretiMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); showmaskretiMethodConn = showmaskretiMethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabRetinex::showmaskretiMethodChanged)); @@ -1103,6 +1175,32 @@ void LocallabRetinex::updateMinMax(const double cdma, const double cdmin, const ); } +//new function Global +void LocallabRetinex::updateguireti(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensih->hide(); + } else { + sensih->show(); + } + enableListener(); + + return false; + } + ); + } + +} + + bool LocallabRetinex::isMaskViewActive() { return (showmaskretiMethod->get_active_row_number() != 0); @@ -2109,6 +2207,33 @@ void LocallabSharp::enableListener() showmasksharMethodConn.block(false); } +//new function Global +void LocallabSharp::updateguisharp(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensisha->hide(); + inverssha->hide(); + } else { + sensisha->show(); + inverssha->show(); + } + enableListener(); + + return false; + } + ); + } + +} + void LocallabSharp::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) { // Disable all listeners @@ -2397,6 +2522,7 @@ LocallabContrast::LocallabContrast(): residgam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMSH"), 0.25, 15.0, 0.01, 2.4))), residslop(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOSH"), 0.0, 500.0, 0.01, 12.92))), sensilc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), + previewlc(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), reparw(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGREPART"), 1.0, 100.0, 1., 100.0))), clariFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CLARIFRA")))), clarilres(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARILRES"), -20., 100., 0.5, 0.))), @@ -2474,6 +2600,9 @@ LocallabContrast::LocallabContrast(): mask2lcCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), Lmasklcshape(static_cast(mask2lcCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) { + auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewlc = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWLC"); + set_orientation(Gtk::ORIENTATION_VERTICAL); const LocallabParams::LocallabSpot defSpot; @@ -2720,6 +2849,11 @@ LocallabContrast::LocallabContrast(): setExpandAlignProperties(expmasklc, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + previewlc->set_active(false); + previewlcConn = previewlc->signal_clicked().connect( + sigc::mem_fun( + *this, &LocallabContrast::previewlcChanged)); + showmasklcMethod->append(M("TP_LOCALLAB_SHOWMNONE")); showmasklcMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmasklcMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); @@ -2764,6 +2898,7 @@ LocallabContrast::LocallabContrast(): // Add Local contrast specific widgets to GUI pack_start(*sensilc); + pack_start(*previewlc); pack_start(*reparw); pack_start(*localcontMethod); pack_start(*lcradius); @@ -2957,6 +3092,62 @@ void LocallabContrast::getMaskView(int &colorMask, int &colorMaskinv, int &expMa lcMask = showmasklcMethod->get_active_row_number(); } +Gtk::ToggleButton *LocallabContrast::getPreviewDeltaEButton() const +{ + return previewlc; +} + +sigc::connection *LocallabContrast::getPreviewDeltaEButtonConnection() +{ + return &previewlcConn; +} + +//new function Global +void LocallabContrast::updateguicont(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensilc->hide(); + showmasklcMethod->set_active(0); + previewlc->hide(); + previewlc->set_active(false); + resetMaskView(); + + } else { + sensilc->show(); + previewlc->show(); + } + enableListener(); + + return false; + } + ); + } + +} + +void LocallabContrast::previewlcChanged() +{ + if(previewlc->get_active()) { + showmasklcMethod->set_active(4); + } else { + showmasklcMethod->set_active(0); + } + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewlc,""); + } + } +} + void LocallabContrast::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { @@ -4532,7 +4723,7 @@ lumacontrastPlusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACON showmaskcbMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmaskcbMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); showmaskcbMethod->append(M("TP_LOCALLAB_SHOWMASK")); - showmaskcbMethod->append(M("TP_LOCALLAB_SHOWREF")); +// showmaskcbMethod->append(M("TP_LOCALLAB_SHOWREF")); showmaskcbMethod->set_active(0); showmaskcbMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); showmaskcbMethodConn = showmaskcbMethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabCBDL::showmaskcbMethodChanged)); @@ -4662,6 +4853,32 @@ void LocallabCBDL::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, cbMask = showmaskcbMethod->get_active_row_number(); } +//new function Global +void LocallabCBDL::updateguicbdl(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensicb->hide(); + } else { + sensicb->show(); + } + enableListener(); + + return false; + } + ); + } + +} + + void LocallabCBDL::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { @@ -5295,6 +5512,7 @@ LocallabLog::LocallabLog(): decayl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKDDECAY"), 0.5, 4., 0.1, 2.))), sensilog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), + previewlog(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), gradlogFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GRADLOGFRA")))), strlog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -2.0, 2.0, 0.05, 0.))), anglog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180, 180, 0.1, 0.))), @@ -5315,6 +5533,7 @@ LocallabLog::LocallabLog(): { auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewlog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWLOG"); Evlocallabwhiteslog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_LOG_WHITES"); Evlocallabblackslog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_LOG_BLACKS"); Evlocallabcomprlog = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_LOG_COMPR"); @@ -5429,6 +5648,11 @@ LocallabLog::LocallabLog(): setExpandAlignProperties(expmaskL, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + previewlog->set_active(false); + previewlogConn = previewlog->signal_clicked().connect( + sigc::mem_fun( + *this, &LocallabLog::previewlogChanged)); + showmaskLMethod->append(M("TP_LOCALLAB_SHOWMNONE")); showmaskLMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmaskLMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); @@ -5472,6 +5696,8 @@ LocallabLog::LocallabLog(): // Add Log encoding specific widgets to GUI pack_start(*sensilog); + pack_start(*previewlog); + pack_start(*repar); pack_start(*ciecam); logPFrame->set_label_align(0.025, 0.5); @@ -5582,6 +5808,54 @@ void LocallabLog::setDefaultExpanderVisibility() } +//new function Global +void LocallabLog::updateguilog(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensilog->hide(); + showmaskLMethod->set_active(0); + previewlog->hide(); + previewlog->set_active(false); + resetMaskView(); + + } else { + sensilog->show(); + previewlog->show(); + } + enableListener(); + + return false; + } + ); + } + +} + +void LocallabLog::previewlogChanged() +{ + + if(previewlog->get_active()) { + showmaskLMethod->set_active(4); + } else { + showmaskLMethod->set_active(0); + } + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewlog,""); + } + } +} + + void LocallabLog::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { @@ -5738,6 +6012,16 @@ void LocallabLog::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, i logMask = showmaskLMethod->get_active_row_number(); } +Gtk::ToggleButton *LocallabLog::getPreviewDeltaEButton() const +{ + return previewlog; +} + +sigc::connection *LocallabLog::getPreviewDeltaEButtonConnection() +{ + return &previewlogConn; +} + void LocallabLog::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) { @@ -5977,6 +6261,7 @@ void LocallabLog::updateGUIToMode(const modeType new_type) maskusablel->hide(); maskunusablel->hide(); decayl->hide(); + break; case Normal: @@ -6070,6 +6355,7 @@ void LocallabLog::convertParamToSimple() strlog->setValue(defSpot.strlog); anglog->setValue(defSpot.anglog); enaLMask->set_active(false); + showmaskLMethod->set_active(0); recothresl->setValue(defSpot.recothresl); lowthresl->setValue(defSpot.lowthresl); higthresl->setValue(defSpot.higthresl); @@ -6691,6 +6977,7 @@ LocallabMask::LocallabMask(): // Common mask specific widgets sensimask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), + previewmas(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), blendmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKMASK"), -100., 100., 0.1, -10.))), blendmaskab(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKMASKAB"), -100., 100., 0.1, -10.))), softradiusmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.5, 1.))), @@ -6727,6 +7014,9 @@ LocallabMask::LocallabMask(): ang_mask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180., 180., 0.1, 0.))) { + auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewmas = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWMAS"); + set_orientation(Gtk::ORIENTATION_VERTICAL); const LocallabParams::LocallabSpot defSpot; @@ -6742,6 +7032,11 @@ LocallabMask::LocallabMask(): softradiusmask->setAdjusterListener(this); + previewmas->set_active(false); + previewmasConn = previewmas->signal_clicked().connect( + sigc::mem_fun( + *this, &LocallabMask::previewmasChanged)); + showmask_Method->append(M("TP_LOCALLAB_SHOWMNONE")); showmask_Method->append(M("TP_LOCALLAB_SHOWMODIFMASK")); showmask_Method->append(M("TP_LOCALLAB_SHOWMASK")); @@ -6833,6 +7128,7 @@ LocallabMask::LocallabMask(): // Add Common mask specific widgets to GUI pack_start(*sensimask); + pack_start(*previewmas); pack_start(*blendmask); pack_start(*blendmaskab); pack_start(*softradiusmask); @@ -6895,6 +7191,64 @@ void LocallabMask::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, maskMask = showmask_Method->get_active_row_number(); } +Gtk::ToggleButton *LocallabMask::getPreviewDeltaEButton() const +{ + return previewmas; +} + +sigc::connection *LocallabMask::getPreviewDeltaEButtonConnection() +{ + return &previewmasConn; +} + +//new function Global +void LocallabMask::updateguimask(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensimask->hide(); + showmask_Method->set_active(0); + previewmas->hide(); + previewmas->set_active(false); + resetMaskView(); + + } else { + sensimask->show(); + previewmas->show(); + } + enableListener(); + + return false; + } + ); + } + +} + +void LocallabMask::previewmasChanged() +{ + + if(previewmas->get_active()) { + showmask_Method->set_active(3); + } else { + showmask_Method->set_active(0); + } + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewmas,""); + } + } +} + + void LocallabMask::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { @@ -7365,6 +7719,7 @@ void LocallabMask::convertParamToSimple() // Set hidden specific GUI widgets in Simple mode to default spot values gammask->setValue(defSpot.gammask); slopmask->setValue(defSpot.slopmask); + //Lmask_shape->setCurve(defSpot.Lmask_curve); // Enable all listeners @@ -7525,6 +7880,8 @@ Locallabcie::Locallabcie(): LocallabTool(this, M("TP_LOCALLAB_CIE_TOOLNAME"), M("TP_LOCALLAB_CIE"), false), // ciecam specific widgets sensicie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), + previewcie(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), + reparcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGREPART"), 1.0, 100.0, 1., 100.0))), jabcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_JAB")))), modecam(Gtk::manage(new MyComboBoxText())), @@ -7755,6 +8112,7 @@ Locallabcie::Locallabcie(): { auto m = ProcEventMapper::getInstance(); + Evlocallabpreviewcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_PREVIEWCIE"); Evlocallabnormcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIE_NORM"); Evlocallabstrumaskcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_STRU"); EvLocallabtoolcie = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_CIEMASK_STRU_TOOL"); @@ -7819,6 +8177,7 @@ Locallabcie::Locallabcie(): pack_start(*sensicie); + pack_start(*previewcie); pack_start(*reparcie); modeHBoxcam->set_spacing(2); //modeHBoxcam->set_tooltip_markup (M ("TP_LOCALLAB_CAMMODE_TOOLTIP")); @@ -8542,6 +8901,11 @@ Locallabcie::Locallabcie(): setExpandAlignProperties(expmaskcie, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + previewcie->set_active(false); + previewcieConn = previewcie->signal_clicked().connect( + sigc::mem_fun( + *this, &Locallabcie::previewcieChanged)); + showmaskcieMethod->append(M("TP_LOCALLAB_SHOWMNONE")); showmaskcieMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmaskcieMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); @@ -8720,6 +9084,62 @@ void Locallabcie::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, i cieMask = showmaskcieMethod->get_active_row_number(); } +Gtk::ToggleButton *Locallabcie::getPreviewDeltaEButton() const +{ + return previewcie; +} + +sigc::connection *Locallabcie::getPreviewDeltaEButtonConnection() +{ + return &previewcieConn; +} + +//new function Global +void Locallabcie::updateguicie(int spottype) +{ + { + idle_register.add( + [this, spottype]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update GUI fullimage or main + disableListener(); + + if(spottype == 3) { + sensicie->hide(); + showmaskcieMethod->set_active(0); + previewcie->hide(); + previewcie->set_active(false); + resetMaskView(); + } else { + sensicie->show(); + previewcie->show(); + } + enableListener(); + + return false; + } + ); + } + +} + +void Locallabcie::previewcieChanged() +{ + + if(previewcie->get_active()) { + showmaskcieMethod->set_active(4); + } else { + showmaskcieMethod->set_active(0); + } + + if (isLocActivated) { + if (listener) { + listener->panelChanged(Evlocallabpreviewcie,""); + } + } +} + void Locallabcie::setDefaultExpanderVisibility() { expLcie->set_expanded(false); diff --git a/rtgui/options.cc b/rtgui/options.cc index 81bcac3f1..c96febe86 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -470,6 +470,8 @@ void Options::setDefaults() histogramTraceBrightness = 1; curvebboxpos = 1; complexity = 2; + spotmet = 0; + inspectorWindow = false; zoomOnScroll = true; prevdemo = PD_Sidecar; @@ -1749,6 +1751,10 @@ void Options::readFromFile(Glib::ustring fname) complexity = keyFile.get_integer("GUI", "Complexity"); } + if (keyFile.has_key("GUI", "Spotmet")) { + spotmet = keyFile.get_integer("GUI", "Spotmet"); + } + if (keyFile.has_key("GUI", "InspectorWindow")) { inspectorWindow = keyFile.get_boolean("GUI", "InspectorWindow"); } @@ -2625,6 +2631,7 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_integer("GUI", "CurveBBoxPosition", curvebboxpos); keyFile.set_boolean("GUI", "Showtooltip", showtooltip); keyFile.set_integer("GUI", "Complexity", complexity); + keyFile.set_integer("GUI", "Spotmet", spotmet); keyFile.set_boolean("GUI", "InspectorWindow", inspectorWindow); keyFile.set_boolean("GUI", "ZoomOnScroll", zoomOnScroll); keyFile.set_integer("GUI", "MaxZoom", static_cast(maxZoomLimit)); diff --git a/rtgui/options.h b/rtgui/options.h index d65013dac..b2221e844 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -330,6 +330,8 @@ public: bool internalThumbIfUntouched; bool overwriteOutputFile; int complexity; + int spotmet; + bool inspectorWindow; // open inspector in separate window bool zoomOnScroll; // translate scroll events to zoom diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index eddfc561e..d92080af8 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1111,6 +1111,9 @@ Gtk::Widget* Preferences::getGeneralPanel() workflowGrid->attach_next_to(*curveBBoxPosL, *flayoutlab, Gtk::POS_BOTTOM, 1, 1); workflowGrid->attach_next_to(*curveBBoxPosC, *editorLayout, Gtk::POS_BOTTOM, 1, 1); workflowGrid->attach_next_to(*curveBBoxPosRestartL, *lNextStart, Gtk::POS_BOTTOM, 1, 1); + + curveBBoxPosS = Gtk::manage(new Gtk::ComboBoxText()); + setExpandAlignProperties(curveBBoxPosS, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); Gtk::Label* complexityL = Gtk::manage(new Gtk::Label(M("PREFERENCES_COMPLEXITYLOC") + ":")); setExpandAlignProperties(complexityL, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); @@ -1123,13 +1126,29 @@ Gtk::Widget* Preferences::getGeneralPanel() workflowGrid->attach_next_to(*complexityL, *curveBBoxPosL, Gtk::POS_BOTTOM, 1, 1); workflowGrid->attach_next_to(*complexitylocal, *curveBBoxPosC, Gtk::POS_BOTTOM, 1, 1); + + Gtk::Label* spotlocalL = Gtk::manage(new Gtk::Label(M("PREFERENCES_SPOTLOC") + ":")); + setExpandAlignProperties(spotlocalL, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); + spotlocal = Gtk::manage(new Gtk::ComboBoxText()); + setExpandAlignProperties(spotlocal, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); + spotlocal->append(M("TP_LOCALLAB_EXNORM")); + spotlocal->append(M("TP_LOCALLAB_EXECLU")); + spotlocal->append(M("TP_LOCALLAB_EXFULL")); + spotlocal->append(M("TP_LOCALLAB_EXMAIN")); + spotlocal->set_active(2); + workflowGrid->attach_next_to(*spotlocalL, *complexityL, Gtk::POS_BOTTOM, 1, 1); + workflowGrid->attach_next_to(*spotlocal, *complexitylocal, Gtk::POS_BOTTOM, 1, 1); + + zoomOnScrollCB = Gtk::manage(new Gtk::CheckButton(M("PREFERENCES_ZOOMONSCROLL"))); setExpandAlignProperties(zoomOnScrollCB, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); - workflowGrid->attach_next_to(*zoomOnScrollCB, *complexityL, Gtk::POS_BOTTOM, 1, 1); + //workflowGrid->attach_next_to(*zoomOnScrollCB, *complexityL, Gtk::POS_BOTTOM, 1, 1); + workflowGrid->attach_next_to(*zoomOnScrollCB, *spotlocalL, Gtk::POS_BOTTOM, 1, 1); inspectorWindowCB = Gtk::manage(new Gtk::CheckButton(M("PREFERENCES_INSPECTORWINDOW"))); setExpandAlignProperties(inspectorWindowCB, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); - workflowGrid->attach_next_to(*inspectorWindowCB, *complexitylocal, Gtk::POS_BOTTOM, 1, 1); + // workflowGrid->attach_next_to(*inspectorWindowCB, *complexitylocal, Gtk::POS_BOTTOM, 1, 1); + workflowGrid->attach_next_to(*inspectorWindowCB, *spotlocal, Gtk::POS_BOTTOM, 1, 1); Gtk::Label* inspectorNextStartL = Gtk::manage(new Gtk::Label(Glib::ustring("(") + M("PREFERENCES_APPLNEXTSTARTUP") + ")")); setExpandAlignProperties(inspectorNextStartL, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); workflowGrid->attach_next_to(*inspectorNextStartL, *inspectorWindowCB, Gtk::POS_RIGHT, 1, 1); @@ -1994,6 +2013,8 @@ void Preferences::storePreferences() moptions.curvebboxpos = curveBBoxPosC->get_active_row_number(); moptions.complexity = complexitylocal->get_active_row_number(); + moptions.spotmet = spotlocal->get_active_row_number(); + moptions.inspectorWindow = inspectorWindowCB->get_active(); moptions.zoomOnScroll = zoomOnScrollCB->get_active(); moptions.histogramPosition = ckbHistogramPositionLeft->get_active() ? 1 : 2; @@ -2216,6 +2237,7 @@ void Preferences::fillPreferences() curveBBoxPosC->set_active(moptions.curvebboxpos); complexitylocal->set_active(moptions.complexity); + spotlocal->set_active(moptions.spotmet); inspectorWindowCB->set_active(moptions.inspectorWindow); zoomOnScrollCB->set_active(moptions.zoomOnScroll); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 191f122f5..e01ec85c0 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -162,8 +162,10 @@ class Preferences final : Gtk::ComboBoxText* cprevdemo; Gtk::CheckButton* ctiffserialize; Gtk::ComboBoxText* curveBBoxPosC; + Gtk::ComboBoxText* curveBBoxPosS; Gtk::ComboBoxText* complexitylocal; + Gtk::ComboBoxText* spotlocal; Gtk::CheckButton* inspectorWindowCB; Gtk::CheckButton* zoomOnScrollCB; diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 966a81b42..efad8f0a6 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -475,6 +475,11 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit toolPanelNotebook->append_page(*favoritePanelSW, *toiF); } toolPanelNotebook->append_page (*exposurePanelSW, *toiE); +/* + if (!batch) { + toolPanelNotebook->append_page(*locallabPanelSW, *toiL); + } +*/ toolPanelNotebook->append_page (*detailsPanelSW, *toiD); toolPanelNotebook->append_page (*colorPanelSW, *toiC); toolPanelNotebook->append_page (*advancedPanelSW, *toiW); From e316e872f3483de430b6fd8fe6cfeaa304ee1382 Mon Sep 17 00:00:00 2001 From: "U-PCSPECIALIST01\\jdesm" Date: Fri, 17 May 2024 07:46:17 +0200 Subject: [PATCH 25/31] Abstract Profile - Change label Highlight attenuation --- rtdata/languages/default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index e363b1054..dfd7e76b7 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -3565,7 +3565,7 @@ TP_LOCALLAB_SLOPESMOOTHR;Red balance (Slope) TP_LOCALLAB_SLOPESMOOTHG;Green balance (Slope) TP_LOCALLAB_SLOPESMOOTHB;Blue balance (Slope) TP_LOCALLAB_SLOSH;Slope -TP_LOCALLAB_SMOOTHCIE;Smooth & Tone-Mapping +TP_LOCALLAB_SMOOTHCIE;Highlight attenuation TP_LOCALLAB_SMOOTHCIE_LUM;Luminosity mode TP_LOCALLAB_SMOOTHCIE_SCA;Scale Yb Scene TP_LOCALLAB_SMOOTHCIE_YB;Scale Yb Viewing From efdc5bce3b9794847093baeb040937ab55eba86e Mon Sep 17 00:00:00 2001 From: Richard E Barber Date: Sun, 19 May 2024 04:27:10 -0700 Subject: [PATCH 26/31] Fix linking with jpeg-turbo patch via Termux PR https://github.com/termux-user-repository/tur/pull/1027 --- rtengine/jdatasrc.cc | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/rtengine/jdatasrc.cc b/rtengine/jdatasrc.cc index fa13b9dd1..a0d12657f 100644 --- a/rtengine/jdatasrc.cc +++ b/rtengine/jdatasrc.cc @@ -247,20 +247,6 @@ my_error_exit (j_common_ptr cinfo) #endif } - -#ifdef _WIN32 -#define JVERSION "6b 27-Mar-1998" -#define JCOPYRIGHT_SHORT "(C) 1998, Thomas G. Lane" -#define JMESSAGE(code,string) string , - -const char * const jpeg_std_message_table[] = { -#include "jerror.h" - NULL -}; -#else -extern const char * const jpeg_std_message_table[]; -#endif - /* * Actual output of an error or trace message. * Applications may override this method to send JPEG messages somewhere @@ -409,24 +395,14 @@ reset_error_mgr (j_common_ptr cinfo) GLOBAL(struct jpeg_error_mgr *) my_jpeg_std_error (struct jpeg_error_mgr * err) { + err = jpeg_std_error(err); + /* override these functions */ err->error_exit = my_error_exit; err->emit_message = emit_message; err->output_message = output_message; err->format_message = format_message; err->reset_error_mgr = reset_error_mgr; - err->trace_level = 0; /* default = no tracing */ - err->num_warnings = 0; /* no warnings emitted yet */ - err->msg_code = 0; /* may be useful as a flag for "no error" */ - - /* Initialize message table pointers */ - err->jpeg_message_table = jpeg_std_message_table; - err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1; - - err->addon_message_table = nullptr; - err->first_addon_message = 0; /* for safety */ - err->last_addon_message = 0; - return err; } From 7789a8574b454ebd874522a70930ae4b40726da4 Mon Sep 17 00:00:00 2001 From: Richard E Barber Date: Sun, 19 May 2024 16:39:28 -0700 Subject: [PATCH 27/31] removes redundant jpeg error message Co-authored-by: Lawrence37 <45837045+Lawrence37@users.noreply.github.com> --- rtengine/jdatasrc.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rtengine/jdatasrc.cc b/rtengine/jdatasrc.cc index a0d12657f..96b6f83b6 100644 --- a/rtengine/jdatasrc.cc +++ b/rtengine/jdatasrc.cc @@ -399,10 +399,6 @@ my_jpeg_std_error (struct jpeg_error_mgr * err) /* override these functions */ err->error_exit = my_error_exit; - err->emit_message = emit_message; - err->output_message = output_message; - err->format_message = format_message; - err->reset_error_mgr = reset_error_mgr; return err; } From c74bcad19e99cca59e892ff844df2ccc24048d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Fri, 24 May 2024 09:35:48 +0200 Subject: [PATCH 28/31] jdatasrc.cc: remove now unused functions --- rtengine/jdatasrc.cc | 145 ------------------------------------------- 1 file changed, 145 deletions(-) diff --git a/rtengine/jdatasrc.cc b/rtengine/jdatasrc.cc index 96b6f83b6..48d428914 100644 --- a/rtengine/jdatasrc.cc +++ b/rtengine/jdatasrc.cc @@ -247,151 +247,6 @@ my_error_exit (j_common_ptr cinfo) #endif } -/* - * Actual output of an error or trace message. - * Applications may override this method to send JPEG messages somewhere - * other than stderr. - * - * On Windows, printing to stderr is generally completely useless, - * so we provide optional code to produce an error-dialog popup. - * Most Windows applications will still prefer to override this routine, - * but if they don't, it'll do something at least marginally useful. - * - * NOTE: to use the library in an environment that doesn't support the - * C stdio library, you may have to delete the call to fprintf() entirely, - * not just not use this routine. - */ - -METHODDEF(void) -output_message (j_common_ptr cinfo) -{ - char buffer[JMSG_LENGTH_MAX]; - - /* Create the message */ - (*cinfo->err->format_message) (cinfo, buffer); - -#ifdef USE_WINDOWS_MESSAGEBOX - /* Display it in a message dialog box */ - MessageBox(GetActiveWindow(), buffer, "JPEG Library Error", - MB_OK | MB_ICONERROR); -#else - /* Send it to stderr, adding a newline */ - fprintf(stderr, "%s\n", buffer); -#endif -} - - -/* - * Decide whether to emit a trace or warning message. - * msg_level is one of: - * -1: recoverable corrupt-data warning, may want to abort. - * 0: important advisory messages (always display to user). - * 1: first level of tracing detail. - * 2,3,...: successively more detailed tracing messages. - * An application might override this method if it wanted to abort on warnings - * or change the policy about which messages to display. - */ - -METHODDEF(void) -emit_message (j_common_ptr cinfo, int msg_level) -{ - struct jpeg_error_mgr * err = cinfo->err; - - if (msg_level < 0) { - /* It's a warning message. Since corrupt files may generate many warnings, - * the policy implemented here is to show only the first warning, - * unless trace_level >= 3. - */ - if (err->num_warnings == 0 || err->trace_level >= 3) { - (*err->output_message) (cinfo); - } - - /* Always count warnings in num_warnings. */ - err->num_warnings++; - } else { - /* It's a trace message. Show it if trace_level >= msg_level. */ - if (err->trace_level >= msg_level) { - (*err->output_message) (cinfo); - } - } -} - - -/* - * Format a message string for the most recent JPEG error or message. - * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX - * characters. Note that no '\n' character is added to the string. - * Few applications should need to override this method. - */ - -METHODDEF(void) -format_message (j_common_ptr cinfo, char * buffer) -{ - struct jpeg_error_mgr * err = cinfo->err; - int msg_code = err->msg_code; - const char * msgtext = nullptr; - const char * msgptr; - char ch; - boolean isstring; - - /* Look up message string in proper table */ - if (msg_code > 0 && msg_code <= err->last_jpeg_message) { - msgtext = err->jpeg_message_table[msg_code]; - } else if (err->addon_message_table != nullptr && - msg_code >= err->first_addon_message && - msg_code <= err->last_addon_message) { - msgtext = err->addon_message_table[msg_code - err->first_addon_message]; - } - - /* Defend against bogus message number */ - if (msgtext == nullptr) { - err->msg_parm.i[0] = msg_code; - msgtext = err->jpeg_message_table[0]; - } - - /* Check for string parameter, as indicated by %s in the message text */ - isstring = FALSE; - msgptr = msgtext; - - while ((ch = *msgptr++) != '\0') { - if (ch == '%') { - if (*msgptr == 's') { - isstring = TRUE; - } - - break; - } - } - - /* Format the message into the passed buffer */ - if (isstring) { - snprintf(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s); - } else - snprintf(buffer, JMSG_LENGTH_MAX, msgtext, - err->msg_parm.i[0], err->msg_parm.i[1], - err->msg_parm.i[2], err->msg_parm.i[3], - err->msg_parm.i[4], err->msg_parm.i[5], - err->msg_parm.i[6], err->msg_parm.i[7]); -} - - -/* - * Reset error state variables at start of a new image. - * This is called during compression startup to reset trace/error - * processing to default state, without losing any application-specific - * method pointers. An application might possibly want to override - * this method if it has additional error processing state. - */ - -METHODDEF(void) -reset_error_mgr (j_common_ptr cinfo) -{ - cinfo->err->num_warnings = 0; - /* trace_level is not reset since it is an application-supplied parameter */ - cinfo->err->msg_code = 0; /* may be useful as a flag for "no error" */ -} - - GLOBAL(struct jpeg_error_mgr *) my_jpeg_std_error (struct jpeg_error_mgr * err) { From 1b19ac162120dd153e5089333f6ebf29f25ffbe3 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Thu, 16 May 2024 10:31:30 +0200 Subject: [PATCH 29/31] dcraw/camconst: add Sony ILCE-6700 * Add dcraw adobe_coeffs entry for Sony ILCE-6700 * Add camconst raw crop for Sony ILCE-6700 --- rtengine/camconst.json | 5 +++++ rtengine/dcraw.cc | 2 ++ 2 files changed, 7 insertions(+) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 3f78739a5..b80d776b8 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -3028,6 +3028,11 @@ Camera constants: "pdaf_offset" : 3 }, + { // Quality C + "make_model": [ "Sony ILCE-6700" ], + "raw_crop": [ 0, 0, 6244, 4168 ] + }, + { // Quality C "make_model": "Sony ILCE-7C", "dcraw_matrix": [ 7374, -2389, -551, -5435, 13162, 2519, -1006, 1795, 6552 ] diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 56d400d3d..d4a29e6cb 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -9085,6 +9085,8 @@ void CLASS adobe_coeff (const char *make, const char *model) { 5991,-1732,-443,-4100,11989,2381,-704,1467,5992 } }, { "Sony ILCA-99M2", 0, 0, { 6660,-1918,-471,-4613,12398,2485,-649,1433,6447 } }, + { "Sony ILCE-6700", 0, 0, + { 6972,-2408,-600,-4330,12101,2515,-388,1277,5847 } }, { "Sony ILCE-6", 0, 0, /* 6300, 6500 */ { 5973,-1695,-419,-3826,11797,2293,-639,1398,5789 } }, { "Sony ILCE-7M2", 0, 0, From 71f452aa1272eec0aa943ae579c6b5417fc204a6 Mon Sep 17 00:00:00 2001 From: Lawrence37 <45837045+Lawrence37@users.noreply.github.com> Date: Mon, 27 May 2024 11:13:09 -0700 Subject: [PATCH 30/31] Fix crash when trying to load DCP (#7039) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stream a C-string of the file name instead of the Glib::ustring. The ustring can throw an exception with certain locale settings and file name character combinations, such as with LANG=es_ES and the character "ä". Only print the message if verbose is true. --- rtengine/dcp.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rtengine/dcp.cc b/rtengine/dcp.cc index df5627d2e..96ade2e36 100644 --- a/rtengine/dcp.cc +++ b/rtengine/dcp.cc @@ -1177,7 +1177,9 @@ DCPProfile::DCPProfile(const Glib::ustring& filename) : // Color Matrix (one is always there) if (!md.find(TAG_KEY_COLOR_MATRIX_1)) { - std::cerr << "DCP '" << filename << "' is missing 'ColorMatrix1'. Skipped." << std::endl; + if (settings->verbose) { + std::cerr << "DCP '" << filename.c_str() << "' is missing 'ColorMatrix1'. Skipped." << std::endl; + } return; } From 4a5194e2d7df3e4ddc9acae19867eb46ee0c5130 Mon Sep 17 00:00:00 2001 From: "U-PCSPECIALIST01\\jdesm" Date: Tue, 28 May 2024 08:06:37 +0200 Subject: [PATCH 31/31] Change sizeband to 6 in ToneEqualizerParamsEdited issue 7085 --- rtgui/paramsedited.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 57a3ea1cd..27f9ac9cc 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -371,7 +371,7 @@ struct SHParamsEdited { struct ToneEqualizerParamsEdited { bool enabled; - std::array bands; + std::array bands; bool regularization; bool show_colormap; bool pivot;