diff --git a/rtdata/languages/default b/rtdata/languages/default index 3d74db023..3019f49bd 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1202,6 +1202,8 @@ PREFERENCES_PRTPROFILE;Color profile PREFERENCES_PSPATH;Adobe Photoshop installation directory PREFERENCES_REMEMBERZOOMPAN;Remember zoom % and pan offset PREFERENCES_REMEMBERZOOMPAN_TOOLTIP;Remember the zoom % and pan offset of the current image when opening a new image.\n\nThis option only works in "Single Editor Tab Mode" and when "Demosaicing method used for the preview at <100% zoom" is set to "As in PP3". +PREFERENCES_RAWCA;Raw CA correction +PREFERENCES_RAWCA_CHUNKSIZE;Tiles per thread PREFERENCES_SAVE_TP_OPEN_NOW;Save tool collapsed/expanded state now PREFERENCES_SELECTLANG;Select language PREFERENCES_SERIALIZE_TIFF_READ;TIFF Read Settings diff --git a/rtengine/CA_correct_RT.cc b/rtengine/CA_correct_RT.cc index e27f894ee..0d150c5c4 100644 --- a/rtengine/CA_correct_RT.cc +++ b/rtengine/CA_correct_RT.cc @@ -27,7 +27,7 @@ #include "rt_math.h" #include "gauss.h" #include "median.h" -//#define BENCHMARK +#define BENCHMARK #include "StopWatch.h" namespace { @@ -121,7 +121,8 @@ float* RawImageSource::CA_correct_RT( bool fitParamsIn, bool fitParamsOut, float* buffer, - bool freeBuffer + bool freeBuffer, + size_t chunkSize ) { BENCHFUN @@ -279,7 +280,7 @@ float* RawImageSource::CA_correct_RT( float blockdenomthr[2][2] = {}; #ifdef _OPENMP - #pragma omp for collapse(2) schedule(dynamic) nowait + #pragma omp for collapse(2) schedule(dynamic, chunkSize) nowait #endif for (int top = -border ; top < height; top += ts - border2) { for (int left = -border; left < width - (W & 1); left += ts - border2) { @@ -821,7 +822,7 @@ float* RawImageSource::CA_correct_RT( //green interpolated to optical sample points for R/B float* gshift = (float (*)) (data + 2 * sizeof(float) * ts * ts + sizeof(float) * ts * tsh + 4 * 64); // there is no overlap in buffer usage => share #ifdef _OPENMP - #pragma omp for schedule(dynamic) collapse(2) + #pragma omp for schedule(dynamic, chunkSize) collapse(2) #endif for (int top = -border; top < height; top += ts - border2) { for (int left = -border; left < width - (W & 1); left += ts - border2) { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index b7f90ba3a..d567ab671 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -2031,13 +2031,13 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } if(numFrames == 4) { double fitParams[64]; - float *buffer = CA_correct_RT(raw.ca_autocorrect, raw.caautoiterations, raw.cared, raw.cablue, raw.ca_avoidcolourshift, *rawDataFrames[0], fitParams, false, true, nullptr, false); + float *buffer = CA_correct_RT(raw.ca_autocorrect, raw.caautoiterations, raw.cared, raw.cablue, raw.ca_avoidcolourshift, *rawDataFrames[0], fitParams, false, true, nullptr, false, options.chunkSizeCA); for(int i = 1; i < 3; ++i) { - CA_correct_RT(raw.ca_autocorrect, raw.caautoiterations, raw.cared, raw.cablue, raw.ca_avoidcolourshift, *rawDataFrames[i], fitParams, true, false, buffer, false); + CA_correct_RT(raw.ca_autocorrect, raw.caautoiterations, raw.cared, raw.cablue, raw.ca_avoidcolourshift, *rawDataFrames[i], fitParams, true, false, buffer, false, options.chunkSizeCA); } - CA_correct_RT(raw.ca_autocorrect, raw.caautoiterations, raw.cared, raw.cablue, raw.ca_avoidcolourshift, *rawDataFrames[3], fitParams, true, false, buffer, true); + CA_correct_RT(raw.ca_autocorrect, raw.caautoiterations, raw.cared, raw.cablue, raw.ca_avoidcolourshift, *rawDataFrames[3], fitParams, true, false, buffer, true, options.chunkSizeCA); } else { - CA_correct_RT(raw.ca_autocorrect, raw.caautoiterations, raw.cared, raw.cablue, raw.ca_avoidcolourshift, rawData, nullptr, false, false, nullptr, true); + CA_correct_RT(raw.ca_autocorrect, raw.caautoiterations, raw.cared, raw.cablue, raw.ca_avoidcolourshift, rawData, nullptr, false, false, nullptr, true, options.chunkSizeCA); } } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index acf2deccb..34ac1cef3 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -249,7 +249,8 @@ protected: bool fitParamsIn, bool fitParamsOut, float* buffer, - bool freeBuffer + bool freeBuffer, + size_t chunkSize = 1 ); void ddct8x8s(int isgn, float a[8][8]); diff --git a/rtgui/options.cc b/rtgui/options.cc index 1dd3040aa..01146111d 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -448,7 +448,7 @@ void Options::setDefaults() maxInspectorBuffers = 2; // a rather conservative value for low specced systems... inspectorDelay = 0; serializeTiffRead = true; - + chunkSizeCA = 1; FileBrowserToolbarSingleRow = false; hideTPVScrollbar = false; whiteBalanceSpotSize = 8; @@ -1079,6 +1079,10 @@ void Options::readFromFile(Glib::ustring fname) serializeTiffRead = keyFile.get_boolean("Performance", "SerializeTiffRead"); } + if (keyFile.has_key("Performance", "ChunkSizeCA")) { + chunkSizeCA = keyFile.get_integer("Performance", "ChunkSizeCA"); + } + if (keyFile.has_key("Performance", "ThumbnailInspectorMode")) { rtSettings.thumbnail_inspector_mode = static_cast(keyFile.get_integer("Performance", "ThumbnailInspectorMode")); } @@ -1949,6 +1953,7 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_integer("Performance", "InspectorDelay", inspectorDelay); keyFile.set_integer("Performance", "PreviewDemosaicFromSidecar", prevdemo); keyFile.set_boolean("Performance", "SerializeTiffRead", serializeTiffRead); + keyFile.set_integer("Performance", "ChunkSizeCA", chunkSizeCA); keyFile.set_integer("Performance", "ThumbnailInspectorMode", int(rtSettings.thumbnail_inspector_mode)); keyFile.set_string("Output", "Format", saveFormat.format); diff --git a/rtgui/options.h b/rtgui/options.h index 5001306ff..f325605ab 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -314,7 +314,7 @@ public: bool filledProfile; // Used as reminder for the ProfilePanel "mode" prevdemo_t prevdemo; // Demosaicing method used for the <100% preview bool serializeTiffRead; - + size_t chunkSizeCA; bool menuGroupRank; bool menuGroupLabel; bool menuGroupFileOperations; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index c10c37b1f..94c9118c3 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -666,6 +666,20 @@ Gtk::Widget* Preferences::getPerformancePanel () fclut->add (*clutCacheSizeHB); vbPerformance->pack_start (*fclut, Gtk::PACK_SHRINK, 4); + Gtk::Frame* fca = Gtk::manage ( new Gtk::Frame (M ("PREFERENCES_RAWCA")) ); + Gtk::HBox* cachunkSizeHB = Gtk::manage ( new Gtk::HBox () ); + cachunkSizeHB->set_spacing (4); + Gtk::Label* CALl = Gtk::manage ( new Gtk::Label (M ("PREFERENCES_RAWCA_CHUNKSIZE") + ":", Gtk::ALIGN_START)); + chunkSizeCASB = Gtk::manage ( new Gtk::SpinButton () ); + chunkSizeCASB->set_digits (0); + chunkSizeCASB->set_increments (1, 5); + chunkSizeCASB->set_max_length (2); // Will this be sufficient? :) + chunkSizeCASB->set_range (1, 16); + cachunkSizeHB->pack_start (*CALl, Gtk::PACK_SHRINK, 0); + cachunkSizeHB->pack_end (*chunkSizeCASB, Gtk::PACK_SHRINK, 0); + fca->add (*cachunkSizeHB); + vbPerformance->pack_start (*fca, 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_spacing (4); @@ -1783,6 +1797,7 @@ void Preferences::storePreferences () moptions.rgbDenoiseThreadLimit = threadsSpinBtn->get_value_as_int(); moptions.clutCacheSize = clutCacheSizeSB->get_value_as_int(); + moptions.chunkSizeCA = chunkSizeCASB->get_value_as_int(); moptions.maxInspectorBuffers = maxInspectorBuffersSB->get_value_as_int(); moptions.rtSettings.thumbnail_inspector_mode = static_cast(thumbnailInspectorMode->get_active_row_number()); @@ -1987,6 +2002,7 @@ void Preferences::fillPreferences () threadsSpinBtn->set_value (moptions.rgbDenoiseThreadLimit); clutCacheSizeSB->set_value (moptions.clutCacheSize); + chunkSizeCASB->set_value (moptions.chunkSizeCA); maxInspectorBuffersSB->set_value (moptions.maxInspectorBuffers); thumbnailInspectorMode->set_active(int(moptions.rtSettings.thumbnail_inspector_mode)); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 3b78c0472..2320209d9 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -161,6 +161,7 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener Gtk::SpinButton* threadsSpinBtn; Gtk::SpinButton* clutCacheSizeSB; + Gtk::SpinButton* chunkSizeCASB; Gtk::SpinButton* maxInspectorBuffersSB; Gtk::ComboBoxText *thumbnailInspectorMode;