From ec2f378bbf372b4ad3fa5f0a9c493bc39cd48d2c Mon Sep 17 00:00:00 2001 From: DrSlony Date: Sun, 15 Feb 2015 19:47:03 +0100 Subject: [PATCH] Demosaicing method used for the preview at <100% zoom, issue 2664 --- rtdata/languages/default | 10 ++- rtengine/improccoordinator.cc | 14 +++-- rtengine/ipwavelet.cc | 4 +- rtgui/options.cc | 6 +- rtgui/options.h | 11 ++-- rtgui/preferences.cc | 112 +++++++++++++++++----------------- rtgui/preferences.h | 2 + 7 files changed, 84 insertions(+), 75 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 84397bcb7..656036bb1 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -778,8 +778,8 @@ PREFERENCES_CIEART_FRAME;CIECAM02-Specific Settings PREFERENCES_CIEART_LABEL;Use float precision instead of double PREFERENCES_CIEART_TOOLTIP;If enabled, CIECAM02 calculations are performed in the single-precision floating-point format instead of the double-precision one. This provides a small increase in speed at the expense of a negligible loss of quality. PREFERENCES_CLIPPINGIND;Clipping Indication -PREFERENCES_CLUTSCACHE;HaldCLUT cache -PREFERENCES_CLUTSCACHE_LABEL;Max number of cached Cluts +PREFERENCES_CLUTSCACHE;HaldCLUT Cache +PREFERENCES_CLUTSCACHE_LABEL;Maximum number of cached CLUTs PREFERENCES_CLUTSDIR;HaldCLUT directory PREFERENCES_CMETRICINTENT;Colorimetric intent PREFERENCES_CUSTPROFBUILDHINT;Executable (or script) file called when a new initial processing profile should be generated for an image.\n\nThe path of the communication file (*.ini style, a.k.a. "Keyfile") is added as a command line parameter. It contains various parameters required for the scripts and image Exif to allow a rules-based processing profile generation.\n\nWARNING: You are responsible for using double quotes where necessary if you're using paths containing spaces. @@ -801,6 +801,10 @@ PREFERENCES_DATEFORMATHINT;You can use the following formatting strings:\n%y< PREFERENCES_DATEFORMAT;Date format PREFERENCES_DEFAULTLANG;Default Language PREFERENCES_DEFAULTTHEME;Default Theme +PREFERENCES_PREVDEMO;Preview Demosaic Method +PREFERENCES_PREVDEMO_LABEL;Demosaicing method used for the preview at <100% zoom: +PREFERENCES_PREVDEMO_FAST;Fast +PREFERENCES_PREVDEMO_SIDECAR;As in PP3 PREFERENCES_DIRDARKFRAMES;Dark-frames directory PREFERENCES_DIRHOME;Home directory PREFERENCES_DIRLAST;Last visited directory @@ -847,7 +851,7 @@ PREFERENCES_ICCDIR;Directory containing color profiles PREFERENCES_IMG_RELOAD_NEEDED;These changes require the image to be reloaded (or a new image to be opened) to take effect. PREFERENCES_IMPROCPARAMS;Default Processing Profile PREFERENCES_INSPECT_LABEL;Inspect -PREFERENCES_INSPECT_MAXBUFFERS_LABEL;Maximum number of buffers +PREFERENCES_INSPECT_MAXBUFFERS_LABEL;Maximum number of cached images PREFERENCES_INSPECT_MAXBUFFERS_TOOLTIP;Set the maximum number of images stored in cache when hovering over them in the File Browser; systems with little RAM (2GB) should keep this value set to 1 or 2. PREFERENCES_INTENT_ABSOLUTE;Absolute Colorimetric PREFERENCES_INTENT_PERCEPTUAL;Perceptual diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 984a88075..a27e13918 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -136,8 +136,12 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { // Tells to the ImProcFunctions' tools what is the preview scale, which may lead to some simplifications ipf.setScale (scale); + bool highDetailNeeded = false; + + if (options.prevdemo==PD_Sidecar) highDetailNeeded = true; //i#2664 + else highDetailNeeded = (todo & M_HIGHQUAL); + // Check if any detail crops need high detail. If not, take a fast path short cut - bool highDetailNeeded = (todo & M_HIGHQUAL); if (!highDetailNeeded) { for (size_t i=0; iget_skip() == 1 ) { // skip=1 -> full resolution @@ -158,9 +162,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { rp.bayersensor.ccSteps = 0; rp.xtranssensor.ccSteps = 0; - /* Commented out the following line so that the hot pixel filter works at <100% zoom levels too, to fix issue 2535. - * rp.deadPixelFilter = rp.hotPixelFilter = false; - */ + //rp.deadPixelFilter = rp.hotPixelFilter = false; } progress ("Applying white balance, color correction & sRGB conversion...",100*readyphase/numofphases); @@ -293,13 +295,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { if((noiseLCurve || noiseCCurve) && denoiseParams.enabled && (scale==1)){//only allocate memory if enabled and scale=1 // we only need image reduced to 1/4 here calclum = new Imagefloat ((pW+1)/2, (pH+1)/2);//for luminance denoise curve - for(int ii=0;iir(ii>>1,jj>>1) = orig_prev->r(ii,jj); calclum->g(ii>>1,jj>>1) = orig_prev->g(ii,jj); calclum->b(ii>>1,jj>>1) = orig_prev->b(ii,jj); } - } + } imgsrc->convertColorSpace(calclum, params.icm, currWB, params.raw);//claculate values after colorspace conversion } //always enabled to calculated auto Chroma diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 4386e920e..1bf444d9b 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -562,10 +562,10 @@ omp_set_nested(oldNested); delete dsttmp; } -// if (settings->verbose) { + if (settings->verbose) { t2e.set(); printf("Wavelet performed in %d usec:\n", t2e.etime(t1e)); -// } + } }//end o diff --git a/rtgui/options.cc b/rtgui/options.cc index 8cb840a2e..41939ec26 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -361,7 +361,7 @@ void Options::setDefaults () { histogramPosition = 1; histogramBar = true; histogramFullMode = false; - + prevdemo = PD_Sidecar; rgbDenoiseThreadLimit = 0; #if defined( _OPENMP ) && defined( __x86_64__ ) clutCacheSize = omp_get_num_procs(); @@ -554,7 +554,7 @@ void Options::setDefaults () { rtSettings.leveldnaut=0; rtSettings.leveldnliss=0; rtSettings.leveldnautsimpl=0; - + rtSettings.monitorProfile = ""; rtSettings.autoMonitorProfile = false; rtSettings.adobe = "RT_Medium_gsRGB"; // put the name of yours profiles (here windows) @@ -769,6 +769,7 @@ if (keyFile.has_group ("Performance")) { if (keyFile.has_key ("Performance", "SIMPLNRAUT")) rtSettings.leveldnautsimpl = keyFile.get_integer ("Performance", "SIMPLNRAUT"); if (keyFile.has_key ("Performance", "ClutCacheSize")) clutCacheSize = keyFile.get_integer ("Performance", "ClutCacheSize"); if (keyFile.has_key ("Performance", "MaxInspectorBuffers")) maxInspectorBuffers = keyFile.get_integer ("Performance", "MaxInspectorBuffers"); + if (keyFile.has_key ("Performance", "PreviewDemosaicFromSidecar")) prevdemo = (prevdemo_t)keyFile.get_integer ("Performance", "PreviewDemosaicFromSidecar"); } if (keyFile.has_group ("GUI")) { @@ -1054,6 +1055,7 @@ int Options::saveToFile (Glib::ustring fname) { keyFile.set_integer ("Performance", "SIMPLNRAUT", rtSettings.leveldnautsimpl); keyFile.set_integer ("Performance", "ClutCacheSize", clutCacheSize); keyFile.set_integer ("Performance", "MaxInspectorBuffers", maxInspectorBuffers); + keyFile.set_integer ("Performance", "PreviewDemosaicFromSidecar", prevdemo); keyFile.set_string ("Output", "Format", saveFormat.format); keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); diff --git a/rtgui/options.h b/rtgui/options.h index 97a1ec4be..8c22b63d8 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -55,6 +55,7 @@ class SaveFormat { enum ThFileType {FT_Invalid=-1, FT_None=0, FT_Raw=1, FT_Jpeg=2, FT_Tiff=3, FT_Png=4, FT_Custom=5, FT_Tiff16=6, FT_Png16=7, FT_Custom16=8}; enum PPLoadLocation {PLL_Cache=0, PLL_Input=1}; enum CPBKeyType {CPBKT_TID=0, CPBKT_NAME=1, CPBKT_TID_NAME=2}; +enum prevdemo_t {PD_Sidecar=1, PD_Fast=0}; namespace rtengine { class SafeKeyFile; @@ -179,7 +180,7 @@ class Options { //std::vector crvOpen; std::vector baBehav; rtengine::Settings rtSettings; - + std::vector favoriteDirs; std::vector renameTemplates; bool renameUseTemplates; @@ -196,7 +197,7 @@ class Options { int multiDisplayMode; // 0=none, 1=Edit panels on other display std::vector cutOverlayBrush; // Red;Green;Blue;Alpha , all ranging 0..1 std::vector navGuideBrush; // Red;Green;Blue;Alpha , all ranging 0..1 - + Glib::ustring sndBatchQueueDone; Glib::ustring sndLngEditProcDone; double sndLngEditProcDoneSecs; // Minimum processing time seconds till the sound is played @@ -204,7 +205,7 @@ class Options { bool tunnelMetaData; // Pass through IPTC and XMP unchanged int histogramPosition; // 0=disabled, 1=left pane, 2=right pane -// int histogramWorking; // 0=disabled, 1=left pane, 2=right pane + //int histogramWorking; // 0=disabled, 1=left pane, 2=right pane bool histogramBar; bool histogramFullMode; bool showProfileSelector; @@ -215,13 +216,13 @@ class Options { bool showFilmStripToolBar; - Glib::ustring clutsDir; - // Performance options + Glib::ustring clutsDir; int rgbDenoiseThreadLimit; // maximum number of threads for the denoising tool ; 0 = use the maximum available int maxInspectorBuffers; // maximum number of buffers (i.e. images) for the Inspector feature int clutCacheSize; bool filledProfile; // Used as reminder for the ProfilePanel "mode" + prevdemo_t prevdemo; // Demosaicing method used for the <100% preview bool menuGroupRank; bool menuGroupLabel; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 282a0124c..e8e616023 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -513,6 +513,55 @@ Gtk::Widget* Preferences::getPerformancePanel () { Gtk::VBox* mainContainer = Gtk::manage( new Gtk::VBox () ); mainContainer->set_border_width (4); mainContainer->set_spacing(4); + + Gtk::Frame* fprevdemo = Gtk::manage (new Gtk::Frame (M("PREFERENCES_PREVDEMO"))); + Gtk::HBox* hbprevdemo = Gtk::manage (new Gtk::HBox (false, 4)); + Gtk::Label* lprevdemo = Gtk::manage (new Gtk::Label (M("PREFERENCES_PREVDEMO_LABEL"))); + cprevdemo = Gtk::manage (new Gtk::ComboBoxText ()); + cprevdemo->append_text (M("PREFERENCES_PREVDEMO_FAST")); + cprevdemo->append_text (M("PREFERENCES_PREVDEMO_SIDECAR")); + cprevdemo->set_active (1); + hbprevdemo->pack_start (*lprevdemo, Gtk::PACK_SHRINK); + hbprevdemo->pack_start (*cprevdemo); + fprevdemo->add (*hbprevdemo); + hbprevdemo->set_border_width(4); + mainContainer->pack_start (*fprevdemo, Gtk::PACK_SHRINK, 4); + + Gtk::Frame* fclut = Gtk::manage( new Gtk::Frame (M("PREFERENCES_CLUTSCACHE")) ); + Gtk::HBox* clutCacheSizeHB = Gtk::manage( new Gtk::HBox () ); + clutCacheSizeHB->set_border_width(4); + clutCacheSizeHB->set_spacing(4); + Gtk::Label* CLUTLl = Gtk::manage( new Gtk::Label (M("PREFERENCES_CLUTSCACHE_LABEL") + ":", Gtk::ALIGN_LEFT)); + clutCacheSizeSB = Gtk::manage( new Gtk::SpinButton () ); + clutCacheSizeSB->set_digits (0); + clutCacheSizeSB->set_increments (1, 5); + clutCacheSizeSB->set_max_length(2); // Will this be sufficient? :) +#ifdef _OPENMP + clutCacheSizeSB->set_range (1, 2*omp_get_num_procs()); +#else + clutCacheSizeSB->set_range (1, 8); +#endif + clutCacheSizeHB->pack_start (*CLUTLl, Gtk::PACK_SHRINK, 0); + clutCacheSizeHB->pack_end (*clutCacheSizeSB, Gtk::PACK_SHRINK, 0); + fclut->add (*clutCacheSizeHB); + mainContainer->pack_start (*fclut, Gtk::PACK_SHRINK, 4); + + Gtk::Frame* finspect = Gtk::manage( new Gtk::Frame (M("PREFERENCES_INSPECT_LABEL")) ); + Gtk::HBox* maxIBuffersHB = Gtk::manage( new Gtk::HBox () ); + maxIBuffersHB->set_border_width(4); + maxIBuffersHB->set_spacing(4); + maxIBuffersHB->set_tooltip_text(M("PREFERENCES_INSPECT_MAXBUFFERS_TOOLTIP")); + Gtk::Label* maxIBufferLbl = Gtk::manage( new Gtk::Label (M("PREFERENCES_INSPECT_MAXBUFFERS_LABEL") + ":", Gtk::ALIGN_LEFT)); + maxInspectorBuffersSB = Gtk::manage( new Gtk::SpinButton () ); + maxInspectorBuffersSB->set_digits (0); + maxInspectorBuffersSB->set_increments (1, 5); + maxInspectorBuffersSB->set_max_length(2); + maxInspectorBuffersSB->set_range (1, 12); // ... we have to set a limit, 12 seem to be enough even for systems with tons of RAM + maxIBuffersHB->pack_start (*maxIBufferLbl, Gtk::PACK_SHRINK, 0); + maxIBuffersHB->pack_end (*maxInspectorBuffersSB, Gtk::PACK_SHRINK, 0); + finspect->add(*maxIBuffersHB); + mainContainer->pack_start(*finspect, Gtk::PACK_SHRINK, 4); + Gtk::Frame* fdenoise = Gtk::manage( new Gtk::Frame (M("PREFERENCES_NOISE")) ); Gtk::VBox* vbdenoise = Gtk::manage( new Gtk::VBox () ); vbdenoise->set_border_width (4); @@ -590,59 +639,6 @@ Gtk::Widget* Preferences::getPerformancePanel () { fdenoise->add (*vbdenoise); mainContainer->pack_start (*fdenoise, Gtk::PACK_SHRINK, 4); - /* Gtk::Label* dntilab = Gtk::manage (new Gtk::Label (M("PREFERENCES_TINB")+":", Gtk::ALIGN_LEFT)); - - dnti = Gtk::manage (new Gtk::ComboBoxText ()); - dnti->append_text (M("PREFERENCES_TISTD")); - dnti->append_text (M("PREFERENCES_TIMAX")); - Gtk::Table* colon2 = Gtk::manage (new Gtk::Table (1, 3)); - colon2->attach (*dntilab, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2); - colon2->attach (*dnti, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK, Gtk::SHRINK, 2, 2); - colon2->attach (*restartNeeded4, 2, 3, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2); - vbdenoise->pack_start (*colon2, Gtk::PACK_SHRINK, 4); -*/ - - Gtk::Frame* fclut = Gtk::manage( new Gtk::Frame (M("PREFERENCES_CLUTSCACHE")) ); - Gtk::HBox* clutCacheSizeHB = Gtk::manage( new Gtk::HBox () ); - clutCacheSizeHB->set_border_width(4); - clutCacheSizeHB->set_spacing(4); - Gtk::Label* CLUTLl = Gtk::manage( new Gtk::Label (M("PREFERENCES_CLUTSCACHE_LABEL") + ":", Gtk::ALIGN_LEFT)); - clutCacheSizeSB = Gtk::manage( new Gtk::SpinButton () ); - clutCacheSizeSB->set_digits (0); - clutCacheSizeSB->set_increments (1, 5); - clutCacheSizeSB->set_max_length(2); // Will this be sufficient? :) - - -#ifdef _OPENMP - clutCacheSizeSB->set_range (1, 2*omp_get_num_procs()); -#else - clutCacheSizeSB->set_range (1, 8); -#endif - - clutCacheSizeHB->pack_start (*CLUTLl, Gtk::PACK_SHRINK, 0); - clutCacheSizeHB->pack_end (*clutCacheSizeSB, Gtk::PACK_SHRINK, 0); - - fclut->add (*clutCacheSizeHB); - mainContainer->pack_start (*fclut, Gtk::PACK_SHRINK, 4); - - Gtk::Frame* finspect = Gtk::manage( new Gtk::Frame (M("PREFERENCES_INSPECT_LABEL")) ); - - Gtk::HBox* maxIBuffersHB = Gtk::manage( new Gtk::HBox () ); - maxIBuffersHB->set_border_width(4); - maxIBuffersHB->set_spacing(4); - maxIBuffersHB->set_tooltip_text(M("PREFERENCES_INSPECT_MAXBUFFERS_TOOLTIP")); - Gtk::Label* maxIBufferLbl = Gtk::manage( new Gtk::Label (M("PREFERENCES_INSPECT_MAXBUFFERS_LABEL") + ":", Gtk::ALIGN_LEFT)); - maxInspectorBuffersSB = Gtk::manage( new Gtk::SpinButton () ); - maxInspectorBuffersSB->set_digits (0); - maxInspectorBuffersSB->set_increments (1, 5); - maxInspectorBuffersSB->set_max_length(2); - maxInspectorBuffersSB->set_range (1, 12); // ... we have to set a limit, 12 seem to be enough even for systems with tons of RAM - maxIBuffersHB->pack_start (*maxIBufferLbl, Gtk::PACK_SHRINK, 0); - maxIBuffersHB->pack_end (*maxInspectorBuffersSB, Gtk::PACK_SHRINK, 0); - finspect->add(*maxIBuffersHB); - - mainContainer->pack_start(*finspect, Gtk::PACK_SHRINK, 4); - return mainContainer; } @@ -1285,7 +1281,6 @@ void Preferences::storePreferences () { moptions.defProfImg = iprofiles->getFullPathFromActiveRow(); if (moptions.defProfImg.empty()) moptions.defProfImg = DEFPROFILE_INTERNAL; - moptions.dateFormat = dateformat->get_text(); moptions.panAccelFactor = (int)panFactor->get_value(); moptions.fbShowDateTime = showDateTime->get_active (); @@ -1303,7 +1298,7 @@ void Preferences::storePreferences () { moptions.theme = theme->get_active_text (); moptions.slimUI = slimUI->get_active (); moptions.useSystemTheme = chUseSystemTheme->get_active (); - + Gdk::Color cropCol=butCropCol->get_color(); moptions.cutOverlayBrush[0]=cropCol.get_red_p(); moptions.cutOverlayBrush[1]=cropCol.get_green_p(); @@ -1358,6 +1353,8 @@ void Preferences::storePreferences () { moptions.rtSettings.nrwavlevel = dnwavlev->get_active_row_number (); moptions.rtSettings.leveldnautsimpl = dnautsimpl->get_active_row_number (); + moptions.prevdemo = (prevdemo_t)cprevdemo->get_active_row_number (); + if (sdcurrent->get_active ()) moptions.startupDir = STARTUPDIR_CURRENT; else if (sdhome->get_active ()) @@ -1376,14 +1373,14 @@ void Preferences::storePreferences () { moptions.parseExtensions.push_back (c[i][extensionColumns.ext]); moptions.parseExtensionsEnabled.push_back (c[i][extensionColumns.enabled]); } - + moptions.maxThumbnailHeight = (int)maxThumbSize->get_value (); moptions.maxCacheEntries = (int)maxCacheEntries->get_value (); moptions.overlayedFileNames = overlayedFileNames->get_active (); moptions.filmStripOverlayedFileNames = filmStripOverlayedFileNames->get_active(); moptions.sameThumbSize = sameThumbSize->get_active(); moptions.internalThumbIfUntouched = ckbInternalThumbIfUntouched->get_active (); - + moptions.saveParamsFile = saveParamsFile->get_active (); moptions.saveParamsCache = saveParamsCache->get_active (); moptions.paramsLoadLocation = (PPLoadLocation)loadParamsPreference->get_active_row_number (); @@ -1464,6 +1461,7 @@ void Preferences::fillPreferences () { dnaut->set_active (moptions.rtSettings.leveldnaut); dnautsimpl->set_active (moptions.rtSettings.leveldnautsimpl); dnwavlev->set_active (moptions.rtSettings.nrwavlevel); + cprevdemo->set_active (moptions.prevdemo); // cbAutocielab->set_active (moptions.rtSettings.autocielab); cbciecamfloat->set_active (moptions.rtSettings.ciecamfloat); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 7893f2efe..781453a5b 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -102,6 +102,8 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener { Gtk::ComboBoxText* dnwavlev; Gtk::ComboBoxText* dnliss; + Gtk::ComboBoxText* cprevdemo; + Gtk::ComboBoxText* theme; Gtk::CheckButton* slimUI; Gtk::HBox* hbtheme;