From 800e82b7629fbb0b879a147730cc905857a0be0e Mon Sep 17 00:00:00 2001 From: Andrey Skvortsov Date: Sun, 12 Sep 2010 23:36:29 -0700 Subject: [PATCH] separate settings for preview and batch --- rtdata/languages/English (US) | 3 +- rtdata/options/options.lin | 1 + rtdata/options/options.osx | 1 + rtdata/options/options.win | 1 + rtengine/imagesource.h | 2 +- rtengine/loadinitial.cc | 6 ++- rtengine/rawimagesource.cc | 54 ++++++++++++++++++-------- rtengine/rawimagesource.h | 2 +- rtengine/settings.h | 1 + rtengine/stdimagesource.cc | 2 +- rtengine/stdimagesource.h | 2 +- rtgui/editorpanel.cc | 5 ++- rtgui/options.cc | 5 ++- rtgui/preferences.cc | 71 +++++++++++++++++++++++++++++++++++ rtgui/preferences.h | 4 +- 15 files changed, 135 insertions(+), 25 deletions(-) diff --git a/rtdata/languages/English (US) b/rtdata/languages/English (US) index 059aaa914..8044e5669 100644 --- a/rtdata/languages/English (US) +++ b/rtdata/languages/English (US) @@ -381,7 +381,8 @@ PREFERENCES_DIRLAST;Last visited directory PREFERENCES_DIROTHER;Other PREFERENCES_DIRSELECTDLG;Select Image Directory at Startup... PREFERENCES_DIRSOFTWARE;Installation directory -PREFERENCES_DMETHOD;Method +PREFERENCES_DMETHOD;Preview +PREFERENCES_DMETHODBATCH;Batch PREFERENCES_EDITORCMDLINE;Other command line PREFERENCES_EXTERNALEDITOR;External editor PREFERENCES_FALSECOLOR;False color suppression steps diff --git a/rtdata/options/options.lin b/rtdata/options/options.lin index 738f60d47..58f9dd2d8 100644 --- a/rtdata/options/options.lin +++ b/rtdata/options/options.lin @@ -81,6 +81,7 @@ ToolPanelsExpanded=1;1;0;0;0;1;1;0;0;0;0;1;1;0;0;0;0;0; [Algorithms] DemosaicMethod=hphd +DemosaicMethodBatch=hphd ColorCorrection=1 [Crop Settings] diff --git a/rtdata/options/options.osx b/rtdata/options/options.osx index c0307c50e..1c80f627f 100644 --- a/rtdata/options/options.osx +++ b/rtdata/options/options.osx @@ -83,6 +83,7 @@ ToolPanelsExpanded=1;1;0;0;0;1;1;0;0;0;0;1;1;0;0;0;0;0; [Algorithms] DemosaicMethod=hphd +DemosaicMethodBatch=hphd ColorCorrection=1 [Crop Settings] diff --git a/rtdata/options/options.win b/rtdata/options/options.win index 8fcedce86..34e0d2be0 100644 --- a/rtdata/options/options.win +++ b/rtdata/options/options.win @@ -81,6 +81,7 @@ ToolPanelsExpanded=1;1;0;0;0;1;1;0;0;0;0;1;1;0;0;0;0;0; [Algorithms] DemosaicMethod=hphd +DemosaicMethodBatch=hphd ColorCorrection=1 [Crop Settings] diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 2e260c853..c38977729 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -65,7 +65,7 @@ class ImageSource : public InitialImage { ImageSource () : references (1), embProfile(NULL), idata(NULL) {} virtual ~ImageSource () {} - virtual int load (Glib::ustring fname) =0; + virtual int load (Glib::ustring fname, bool batch = false) =0; virtual void getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hlp, ColorManagementParams cmp) {} virtual ColorTemp getWB () =0; virtual ColorTemp getAutoWB () =0; diff --git a/rtengine/loadinitial.cc b/rtengine/loadinitial.cc index f12ce63b8..0bd524351 100644 --- a/rtengine/loadinitial.cc +++ b/rtengine/loadinitial.cc @@ -32,7 +32,11 @@ InitialImage* InitialImage::load (const Glib::ustring& fname, bool isRaw, int* e isrc = new RawImageSource (); isrc->setProgressListener (pl); - *errorCode = isrc->load (fname); + + if(isRaw && pl == NULL) + *errorCode = isrc->load (fname, true); + else + *errorCode = isrc->load (fname); if (*errorCode) { delete isrc; return NULL; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index b723f130d..928fdf39a 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -724,7 +724,7 @@ void RawImageSource::inverse33 (double (*coeff)[3], double (*icoeff)[3]) { icoeff[2][2] = (coeff[0][1]*coeff[1][0]-coeff[0][0]*coeff[1][1]) / nom; } -int RawImageSource::load (Glib::ustring fname) { +int RawImageSource::load (Glib::ustring fname, bool batch) { fileName = fname; @@ -900,22 +900,44 @@ int RawImageSource::load (Glib::ustring fname) { //MyTime t1,t2; //t1.set(); // demosaic - if (settings->demosaicMethod=="hphd") - hphd_demosaic (); - else if (settings->demosaicMethod=="vng4") - vng4_demosaic (); - else if (settings->demosaicMethod=="ahd") - ahd_demosaic (); - else if (settings->demosaicMethod=="bilinear") - bilinear_demosaic(); - //else if (settings->demosaicMethod=="ppg") - // ppg_demosaic (); - else if (settings->demosaicMethod=="amaze") - amaze_demosaic_RT ();//Emil's code for AMaZE - else if (settings->demosaicMethod=="dcb") - dcb_demosaic(settings->dcb_iterations, settings->dcb_enhance? 1:0); + if(!batch) + { + if (settings->demosaicMethod=="hphd") + hphd_demosaic (); + else if (settings->demosaicMethod=="vng4") + vng4_demosaic (); + else if (settings->demosaicMethod=="ahd") + ahd_demosaic (); + else if (settings->demosaicMethod=="bilinear") + bilinear_demosaic(); + //else if (settings->demosaicMethod=="ppg") + // ppg_demosaic (); + else if (settings->demosaicMethod=="amaze") + amaze_demosaic_RT ();//Emil's code for AMaZE + else if (settings->demosaicMethod=="dcb") + dcb_demosaic(settings->dcb_iterations, settings->dcb_enhance? 1:0); + else + eahd_demosaic (); + } else - eahd_demosaic (); + { + if (settings->demosaicMethodBatch =="hphd") + hphd_demosaic (); + else if (settings->demosaicMethodBatch=="vng4") + vng4_demosaic (); + else if (settings->demosaicMethodBatch=="ahd") + ahd_demosaic (); + else if (settings->demosaicMethodBatch=="bilinear") + bilinear_demosaic(); + //else if (settings->demosaicMethod=="ppg") + // ppg_demosaic (); + else if (settings->demosaicMethodBatch=="amaze") + amaze_demosaic_RT ();//Emil's code for AMaZE + else if (settings->demosaicMethodBatch=="dcb") + dcb_demosaic(settings->dcb_iterations, settings->dcb_enhance? 1:0); + else + eahd_demosaic (); + } //t2.set(); //printf("Demosaicing:%d usec\n",t2.etime(t1)); } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 9ccb257ab..6dd71df3c 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -104,7 +104,7 @@ class RawImageSource : public ImageSource { RawImageSource (); ~RawImageSource (); - int load (Glib::ustring fname); + int load (Glib::ustring fname, bool batch = false); void getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hrp, ColorManagementParams cmp); ColorTemp getWB () { return wb; } ColorTemp getAutoWB (); diff --git a/rtengine/settings.h b/rtengine/settings.h index 6ef87dbbf..f412b61d0 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -26,6 +26,7 @@ namespace rtengine { public: bool dualThreadEnabled; ///< If true, the image processing operations with utilize two processor cores (if possible) std::string demosaicMethod; ///< The algorithm used for demosaicing. Can be "eahd", "hphd", "ahd", "vng4", "amaze", "bilinear". + std::string demosaicMethodBatch; ///< The algorithm used for demosaicing. Can be "eahd", "hphd", "ahd", "vng4", "amaze", "bilinear". int colorCorrectionSteps; ///< The number of color correction steps applied right after the demosaicing Glib::ustring iccDirectory; ///< The directory containing the possible output icc profiles int colorimetricIntent; ///< Colorimetric intent used at color space conversions diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index a42a72d26..af589af68 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -70,7 +70,7 @@ StdImageSource::~StdImageSource () { freeArray(needhr, img->height); } -int StdImageSource::load (Glib::ustring fname) { +int StdImageSource::load (Glib::ustring fname, bool batch) { fileName = fname; diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index 8565c5670..7442fda0b 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -43,7 +43,7 @@ class StdImageSource : public ImageSource { StdImageSource (); ~StdImageSource (); - int load (Glib::ustring fname); + int load (Glib::ustring fname, bool batch = false); void getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hrp, ColorManagementParams cmp); ColorTemp getWB () { return wb; } ColorTemp getAutoWB (); diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 7d6ae81d7..77f555014 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -381,6 +381,8 @@ void EditorPanel::close () { void EditorPanel::saveProfile () { + if (!ipc) + return; ProcParams params; ipc->getParams (¶ms); @@ -641,7 +643,8 @@ BatchQueueEntry* EditorPanel::createBatchQueueEntry () { rtengine::procparams::ProcParams pparams; ipc->getParams (&pparams); - rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams); + //rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams); + rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (openThm->getFileName (), openThm->getType()==FT_Raw, pparams); int prevh = options.maxThumbnailHeight; int prevw = prevh; guint8* prev = NULL;//(guint8*) previewHandler->getImagePreview (prevw, prevh); diff --git a/rtgui/options.cc b/rtgui/options.cc index 88164e918..4c23c515b 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -120,7 +120,8 @@ void Options::setDefaults () { baBehav = std::vector (babehav, babehav+ADDSET_PARAM_NUM); rtSettings.dualThreadEnabled = true; - rtSettings.demosaicMethod = "amaze";//Emil's code for AMaZE + rtSettings.demosaicMethod = "hphd"; + rtSettings.demosaicMethodBatch = "hphd"; rtSettings.ca_autocorrect = false;//Emil's CA correction rtSettings.hotdeadpix_filt = true;//Emil's hot/dead pixel filter @@ -266,6 +267,7 @@ if (keyFile.has_group ("GUI")) { if (keyFile.has_group ("Algorithms")) { if (keyFile.has_key ("Algorithms", "DemosaicMethod")) rtSettings.demosaicMethod = keyFile.get_string ("Algorithms", "DemosaicMethod"); + if (keyFile.has_key ("Algorithms", "DemosaicMethodBatch")) rtSettings.demosaicMethodBatch = keyFile.get_string ("Algorithms", "DemosaicMethodBatch"); if (keyFile.has_key ("Algorithms", "ColorCorrection")) rtSettings.colorCorrectionSteps = keyFile.get_integer ("Algorithms", "ColorCorrection"); if(keyFile.has_key("Algorithms", "DCBIterations")) rtSettings.dcb_iterations = keyFile.get_integer("Algorithms", "DCBIterations"); if(keyFile.has_key("Algorithms", "DCBEnhance")) rtSettings.dcb_enhance = keyFile.get_boolean("Algorithms", "DCBEnhance"); @@ -394,6 +396,7 @@ int Options::saveToFile (Glib::ustring fname) { keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen); keyFile.set_string ("Algorithms", "DemosaicMethod", rtSettings.demosaicMethod); + keyFile.set_string ("Algorithms", "DemosaicMethodBatch", rtSettings.demosaicMethodBatch); keyFile.set_integer ("Algorithms", "ColorCorrection", rtSettings.colorCorrectionSteps); keyFile.set_integer ("Algorithms", "DCBIterations", rtSettings.dcb_iterations); keyFile.set_boolean ("Algorithms", "DCBEnhance", rtSettings.dcb_enhance); diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 7a85010b2..0aa227470 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -255,6 +255,7 @@ Gtk::Widget* Preferences::getProcParamsPanel () { Gtk::VBox* fdb = Gtk::manage (new Gtk::VBox ()); fdb->set_border_width (4); fdem->add (*fdb); + Gtk::Label* dmlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_DMETHOD")+":")); dmethod = Gtk::manage (new Gtk::ComboBoxText ()); Gtk::HBox* hb11 = Gtk::manage (new Gtk::HBox ()); @@ -268,6 +269,21 @@ Gtk::Widget* Preferences::getProcParamsPanel () { dmethod->append_text ("DCB"); dmethod->append_text ("AHD"); dmethod->append_text ("Bilinear"); + + Gtk::Label* dmlab2 = Gtk::manage (new Gtk::Label (M("PREFERENCES_DMETHODBATCH")+": ")); + dmethodBatch = Gtk::manage (new Gtk::ComboBoxText ()); + Gtk::HBox* hb111 = Gtk::manage (new Gtk::HBox ()); + hb111->pack_start (*dmlab2, Gtk::PACK_SHRINK, 4); + hb111->pack_start (*dmethodBatch); + dmethodBatch->append_text ("EAHD"); + dmethodBatch->append_text ("HPHD"); + dmethodBatch->append_text ("VNG-4"); + //dmethod->append_text ("PPG"); + dmethodBatch->append_text ("AMaZE");//Emil's code for AMaZE + dmethodBatch->append_text ("DCB"); + dmethodBatch->append_text ("AHD"); + dmethodBatch->append_text ("Bilinear"); + Gtk::Label* cclab = Gtk::manage (new Gtk::Label (M("PREFERENCES_FALSECOLOR")+":")); ccSteps = Gtk::manage (new Gtk::SpinButton ()); ccSteps->set_digits (0); @@ -316,6 +332,7 @@ Gtk::Widget* Preferences::getProcParamsPanel () { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% fdb->pack_start (*hb11, Gtk::PACK_SHRINK, 4); + fdb->pack_start (*hb111, Gtk::PACK_SHRINK, 4); fdb->pack_start (*hb12, Gtk::PACK_SHRINK, 4); fdb->pack_start (*hb13, Gtk::PACK_SHRINK, 4); fdb->pack_start (*dcbEnhance, Gtk::PACK_SHRINK, 4); @@ -338,6 +355,7 @@ Gtk::Widget* Preferences::getProcParamsPanel () { } dmconn = dmethod->signal_changed().connect( sigc::mem_fun(*this, &Preferences::dmethodChanged) ); + dmconnBatch = dmethod->signal_changed().connect( sigc::mem_fun(*this, &Preferences::dmethodBatchChanged) ); return mvbpp; } @@ -751,6 +769,21 @@ void Preferences::storePreferences () { moptions.rtSettings.demosaicMethod = "ahd"; else if (dmethod->get_active_row_number()==6) moptions.rtSettings.demosaicMethod = "bilinear"; + + if (dmethodBatch->get_active_row_number()==0) + moptions.rtSettings.demosaicMethodBatch = "eahd"; + else if (dmethodBatch->get_active_row_number()==1) + moptions.rtSettings.demosaicMethodBatch = "hphd"; + else if (dmethodBatch->get_active_row_number()==2) + moptions.rtSettings.demosaicMethodBatch = "vng4"; + else if (dmethodBatch->get_active_row_number()==3) + moptions.rtSettings.demosaicMethodBatch = "amaze"; + else if (dmethodBatch->get_active_row_number()==4) + moptions.rtSettings.demosaicMethodBatch = "dcb"; + else if (dmethodBatch->get_active_row_number()==5) + moptions.rtSettings.demosaicMethodBatch = "ahd"; + else if (dmethodBatch->get_active_row_number()==6) + moptions.rtSettings.demosaicMethodBatch = "bilinear"; moptions.rtSettings.dcb_iterations=(int)dcbIterations->get_value(); moptions.rtSettings.dcb_enhance=dcbEnhance->get_active(); moptions.rtSettings.ca_autocorrect=caAutoCorrect->get_active();//Emil's CA correction @@ -803,6 +836,7 @@ void Preferences::storePreferences () { void Preferences::fillPreferences () { dmconn.block (true); + dmconnBatch.block(true); tconn.block (true); rprofiles->set_active_text (moptions.defProfRaw); @@ -853,6 +887,22 @@ void Preferences::fillPreferences () { dmethod->set_active (5); else if (moptions.rtSettings.demosaicMethod=="bilinear") dmethod->set_active (6); + + if (moptions.rtSettings.demosaicMethodBatch=="eahd") + dmethodBatch->set_active (0); + else if (moptions.rtSettings.demosaicMethodBatch=="hphd") + dmethodBatch->set_active (1); + else if (moptions.rtSettings.demosaicMethodBatch=="vng4") + dmethodBatch->set_active (2); + else if (moptions.rtSettings.demosaicMethodBatch=="amaze")//Emil's code for AMaZE + dmethodBatch->set_active (3); + else if (moptions.rtSettings.demosaicMethodBatch=="dcb") + dmethodBatch->set_active (4); + else if (moptions.rtSettings.demosaicMethodBatch=="ahd") + dmethodBatch->set_active (5); + else if (moptions.rtSettings.demosaicMethodBatch=="bilinear") + dmethodBatch->set_active (6); + dcbEnhance->set_active(moptions.rtSettings.dcb_enhance); dcbIterations->set_value(moptions.rtSettings.dcb_iterations); dcbEnhance->set_sensitive(moptions.rtSettings.demosaicMethod=="dcb"); @@ -914,6 +964,7 @@ void Preferences::fillPreferences () { setc.block (false); dmconn.block (false); + dmconnBatch.block(false); tconn.block (false); } @@ -977,6 +1028,26 @@ void Preferences::dmethodChanged () { } } +void Preferences::dmethodBatchChanged () { + + if (dmethod->get_active_row_number()==0) + ccSteps->set_value (2); + else if (dmethod->get_active_row_number()==1) + ccSteps->set_value (1); + else if (dmethod->get_active_row_number()==2) + ccSteps->set_value (2); + + if (dmethod->get_active_row_number()==4) { + dcbEnhance->set_sensitive(true); + dcbIterations->set_sensitive(true); + dcbIterationsLabel->set_sensitive(true); + } else { + dcbEnhance->set_sensitive(false); + dcbIterations->set_sensitive(false); + dcbIterationsLabel->set_sensitive(false); + } +} + void Preferences::aboutPressed () { Splash* splash = new Splash (-1); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 646202017..8098a5d76 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -53,6 +53,7 @@ class Preferences : public Gtk::Dialog { Gtk::ComboBoxText* rprofiles; Gtk::ComboBoxText* iprofiles; Gtk::ComboBoxText* dmethod; + Gtk::ComboBoxText* dmethodBatch; Gtk::ComboBoxText* languages; Gtk::Entry* dateformat; Gtk::Entry* startupdir; @@ -110,12 +111,13 @@ class Preferences : public Gtk::Dialog { Gtk::ComboBoxText* loadParamsPreference; Options moptions; - sigc::connection dmconn, tconn, addc, setc; + sigc::connection dmconn, dmconnBatch, tconn, addc, setc; void fillPreferences (); void storePreferences (); void parseDir (Glib::ustring dirname, std::vector& items, Glib::ustring ext); void dmethodChanged (); + void dmethodBatchChanged (); void themeChanged ();