From d6e42edcc6d49a7a61b3acfd485a3be2cfe14c94 Mon Sep 17 00:00:00 2001 From: natureh 510 Date: Tue, 26 Feb 2013 01:05:44 +0100 Subject: [PATCH] Issue 1680: "FtblockDN.cc RGB_denoise": this patch add a Performance tab to limit the number of core used for RGB denoising tool --- rtdata/languages/Deutsch | 3 +++ rtdata/languages/Francais | 3 +++ rtdata/languages/default | 3 +++ rtengine/FTblockDN.cc | 2 +- rtgui/options.cc | 10 +++++++++- rtgui/options.h | 3 +++ rtgui/preferences.cc | 31 +++++++++++++++++++++++++++++++ rtgui/preferences.h | 3 +++ 8 files changed, 56 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/Deutsch b/rtdata/languages/Deutsch index 66e363efb..fb9375736 100644 --- a/rtdata/languages/Deutsch +++ b/rtdata/languages/Deutsch @@ -712,6 +712,8 @@ PREFERENCES_PROFILESAVECACHE;Verarbeitungsparameter im Zwischenspeicher speicher PREFERENCES_PROFILESAVEINPUT;Verarbeitungsparameter zusammen mit Datei speichern (Sidecar) PREFERENCES_PROPERTY;Eigenschaft PREFERENCES_PSPATH;Adobe Photoshop Installationsverzeichnis +PREFERENCES_RGBDTL_LABEL;Max. Anzahl Threads für Rauschminderung +PREFERENCES_RGBDTL_TOOLTIP;Die Rauschminderung benötigt mindestens 128MB RAM für ein 10 Megapixel-Bild oder 512MB für ein 40 Megapixel-Bild, und zusätzlich 128MB RAM pro Thread. Je mehr Threads parallel ablaufen, desto schneller ist die Berechnung. Bei Einstellung "0" werden so viele Threads wie möglich benutzt. PREFERENCES_SELECTFONT;Schriftart PREFERENCES_SELECTICCDIRDLG;Wähle ICC-Profile-Verzeichnis... PREFERENCES_SELECTLANG;Sprache @@ -738,6 +740,7 @@ PREFERENCES_TAB_COLORMGR;Farbmanagement PREFERENCES_TAB_GENERAL;Allgemein PREFERENCES_TAB_IMPROC;Bildbearbeitung PREFERENCES_TAB_OUTPUT;Ausgabe +PREFERENCES_TAB_PERFORMANCE;Performance PREFERENCES_TAB_SOUND;Systemklänge PREFERENCES_THUMBSIZE;Größe der Vorschau PREFERENCES_TP_LABEL;Werkzeugbereich: diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index f12111e4b..0a22f1148 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -778,6 +778,8 @@ PREFERENCES_PROFILESAVECACHE;Enregistrer la paramètres de traitement dans le Ca PREFERENCES_PROFILESAVEINPUT;Enregistrer la paramètres de traitement accolé au fichier d'entrée PREFERENCES_PROPERTY;Propriété PREFERENCES_PSPATH;Dossier d'installation d'Adobe Photoshop +PREFERENCES_RGBDTL_LABEL;Nombre maximum d'unités de calcul pour la Réduction du bruit +PREFERENCES_RGBDTL_TOOLTIP;La réduction du bruit nécessite un minimum d'à peu près 128Mo de RAM pour une image de 10MPix ou 512Mo pour une image de 40MPix, ainsi que 128Mo de RAM supplémentaire par unité de calcul. Plus il y aura d'unité de calcul travaillant en parallèle, plus ce sera rapide. Laissez la valeur à "0" pour utiliser automatiquement autant d'unité de calcul que possible. PREFERENCES_SELECTFONT;Police de caractère PREFERENCES_SELECTICCDIRDLG;Choix du dossier des profils ICC... PREFERENCES_SELECTLANG;Choix de la langue @@ -804,6 +806,7 @@ PREFERENCES_TAB_COLORMGR;Gestion des couleurs PREFERENCES_TAB_GENERAL;Général PREFERENCES_TAB_IMPROC;Traitement de l'image PREFERENCES_TAB_OUTPUT;Options de sortie +PREFERENCES_TAB_PERFORMANCE;Performance PREFERENCES_TAB_SOUND;Sons PREFERENCES_THUMBSIZE;Tailles des vignettes PREFERENCES_TP_LABEL;Panneau des outils: diff --git a/rtdata/languages/default b/rtdata/languages/default index 0311978b3..bd7121f9d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -774,6 +774,8 @@ PREFERENCES_PROFILESAVECACHE;Save processing profile to the cache PREFERENCES_PROFILESAVEINPUT;Save processing profile next to the input file PREFERENCES_PROPERTY;Property PREFERENCES_PSPATH;Adobe Photoshop installation directory +PREFERENCES_RGBDTL_LABEL;Max number of threads for Noise Reduction +PREFERENCES_RGBDTL_TOOLTIP;Noise Reduction requires a baseline of about 128MB RAM for a 10MPix image or 512MB for a 40MPix image, and additionally 128MB RAM per thread. The more threads run in parallel, the faster the computation. Leave the setting at "0" to automatically use as many threads as possible. PREFERENCES_SELECTFONT;Select font PREFERENCES_SELECTICCDIRDLG;Select Color Profile Directory... PREFERENCES_SELECTLANG;Select language @@ -800,6 +802,7 @@ PREFERENCES_TAB_COLORMGR;Color Management PREFERENCES_TAB_GENERAL;General PREFERENCES_TAB_IMPROC;Image Processing PREFERENCES_TAB_OUTPUT;Output Options +PREFERENCES_TAB_PERFORMANCE;Performance PREFERENCES_TAB_SOUND;Sounds PREFERENCES_THUMBSIZE;Thumbnail Size PREFERENCES_TP_LABEL;Tool panel: diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 732c0892a..f74cfaad6 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -227,7 +227,7 @@ namespace rtengine { // Calculate number of tiles. If less than omp_get_max_threads(), then limit num_threads to number of tiles int numtiles = numtiles_W * numtiles_H; int numthreads = MIN(numtiles,omp_get_max_threads()); - //if(options.RgbDenoiseThreadLimit > 0) numthreads = MIN(numthreads,options.RgbDenoiseThreadLimit); + if(options.rgbDenoiseThreadLimit > 0) numthreads = MIN(numthreads,options.rgbDenoiseThreadLimit); #pragma omp parallel num_threads(numthreads) #endif { diff --git a/rtgui/options.cc b/rtgui/options.cc index 8155b965f..abdf88c29 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -303,7 +303,9 @@ void Options::setDefaults () { histogramPosition = 2; histogramBar = true; histogramFullMode = false; - + + rgbDenoiseThreadLimit = 0; + showProfileSelector = true; FileBrowserToolbarSingleRow = false; hideTPVScrollbar = false; @@ -603,6 +605,10 @@ if (keyFile.has_group ("Clipping Indication")) { if (keyFile.has_key ("Clipping Indication", "BlinkClipped")) blinkClipped = keyFile.get_boolean ("Clipping Indication", "BlinkClipped"); } +if (keyFile.has_group ("Performance")) { + if (keyFile.has_key ("Performance", "RgbDenoiseThreadLimit")) rgbDenoiseThreadLimit = keyFile.get_integer ("Performance", "RgbDenoiseThreadLimit"); +} + if (keyFile.has_group ("GUI")) { if (keyFile.has_key ("GUI", "Font")) font = keyFile.get_string ("GUI", "Font"); if (keyFile.has_key ("GUI", "WindowWidth")) windowWidth = keyFile.get_integer ("GUI", "WindowWidth"); @@ -820,6 +826,8 @@ int Options::saveToFile (Glib::ustring fname) { keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold); keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped); + keyFile.set_integer ("Performance", "RgbDenoiseThreadLimit", rgbDenoiseThreadLimit); + keyFile.set_string ("Output", "Format", saveFormat.format); keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); keyFile.set_integer ("Output", "JpegSubSamp", saveFormat.jpegSubSamp); diff --git a/rtgui/options.h b/rtgui/options.h index 90378546e..e20bd8cd1 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -194,6 +194,9 @@ class Options { bool UseIconNoText; int whiteBalanceSpotSize; + // Performance options + int rgbDenoiseThreadLimit; // maximum number of threads for the denoising tool ; 0 = use the maximum available + bool menuGroupRank; bool menuGroupLabel; bool menuGroupFileOperations; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 7f81e446e..bfb35416f 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -82,6 +82,7 @@ Preferences::Preferences (RTWindow *rtwindow):parent(rtwindow) { nb->append_page (*getFileBrowserPanel(), M("PREFERENCES_TAB_BROWSER")); nb->append_page (*getColorManagementPanel(),M("PREFERENCES_TAB_COLORMGR")); nb->append_page (*getBatchProcPanel(), M("PREFERENCES_BATCH_PROCESSING")); + nb->append_page (*getPerformancePanel(), M("PREFERENCES_TAB_PERFORMANCE")); // Sounds only on Windows and Linux #if defined(WIN32) || defined(__linux__) nb->append_page (*getSoundPanel(), M("PREFERENCES_TAB_SOUND")); @@ -395,6 +396,32 @@ Gtk::Widget* Preferences::getProcParamsPanel () { return mvbpp; } +Gtk::Widget* Preferences::getPerformancePanel () { + Gtk::VBox* mainContainer = Gtk::manage( new Gtk::VBox () ); + mainContainer->set_spacing(4); + + Gtk::HBox* threadLimitHB = Gtk::manage( new Gtk::HBox () ); + threadLimitHB->set_border_width(4); + threadLimitHB->set_spacing(4); + threadLimitHB->set_tooltip_text(M("PREFERENCES_RGBDTL_TOOLTIP")); + Gtk::Label* RGBDTLl = Gtk::manage( new Gtk::Label (M("PREFERENCES_RGBDTL_LABEL") + ":", Gtk::ALIGN_LEFT)); + rgbDenoiseTreadLimitSB = Gtk::manage( new Gtk::SpinButton () ); + rgbDenoiseTreadLimitSB->set_digits (0); + rgbDenoiseTreadLimitSB->set_increments (1, 5); + rgbDenoiseTreadLimitSB->set_max_length(2); // Will this be sufficient? :) + int maxThreadNumber = 10; +#ifdef _OPENMP + maxThreadNumber = omp_get_max_threads(); +#endif + rgbDenoiseTreadLimitSB->set_range (0, maxThreadNumber); + threadLimitHB->pack_start (*RGBDTLl, Gtk::PACK_SHRINK, 0); + threadLimitHB->pack_end (*rgbDenoiseTreadLimitSB, Gtk::PACK_SHRINK, 0); + + mainContainer->pack_start(*threadLimitHB, Gtk::PACK_SHRINK, 4); + + return mainContainer; +} + Gtk::Widget* Preferences::getColorManagementPanel () { Gtk::VBox* mvbcm = Gtk::manage (new Gtk::VBox ()); @@ -1134,6 +1161,8 @@ void Preferences::storePreferences () { moptions.overwriteOutputFile = chOverwriteOutputFile->get_active (); moptions.UseIconNoText = ckbUseIconNoText->get_active(); + moptions.rgbDenoiseThreadLimit = rgbDenoiseTreadLimitSB->get_value_as_int(); + // Sounds only on Windows and Linux #if defined(WIN32) || defined(__linux__) moptions.sndEnable = ckbSndEnable->get_active (); @@ -1250,6 +1279,8 @@ void Preferences::fillPreferences () { ckbHideTPVScrollbar->set_active(moptions.hideTPVScrollbar); ckbUseIconNoText->set_active(moptions.UseIconNoText); + rgbDenoiseTreadLimitSB->set_value(moptions.rgbDenoiseThreadLimit); + //darkFrameDir->set_filename( moptions.rtSettings.darkFramesPath ); //updateDFinfos(); darkFrameDir->set_current_folder( moptions.rtSettings.darkFramesPath ); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 14512a1bf..1a4c383cb 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -111,6 +111,8 @@ class Preferences : public Gtk::Dialog { Gtk::Button* delExt; Gtk::CheckButton* overlayedFileNames; + Gtk::SpinButton* rgbDenoiseTreadLimitSB; + Gtk::CheckButton* ckbmenuGroupRank; Gtk::CheckButton* ckbmenuGroupLabel; Gtk::CheckButton* ckbmenuGroupFileOperations; @@ -172,6 +174,7 @@ class Preferences : public Gtk::Dialog { Gtk::Widget* getFileBrowserPanel (); Gtk::Widget* getGeneralPanel (); Gtk::Widget* getBatchProcPanel (); + Gtk::Widget* getPerformancePanel (); Gtk::Widget* getSoundPanel (); public: