diff --git a/rtdata/languages/default b/rtdata/languages/default index 185191bcd..70e351595 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1994,6 +1994,8 @@ PREFERENCES_PROPERTY;Property PREFERENCES_PRTINTENT;Rendering intent PREFERENCES_PRTPROFILE;Color profile PREFERENCES_PSPATH;Adobe Photoshop installation directory +PREFERENCES_RAW_DECODER;Raw Decoder +PREFERENCES_RAW_DECODER_ENABLE_LIBRAW;Use LibRaw 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_SAVE_TP_OPEN_NOW;Save tool collapsed/expanded state now diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index d96993a0d..4577a3f63 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -492,8 +492,14 @@ int RawImage::loadRaw(bool loadData, unsigned int imageNum, bool closeFile, Prog shot_select = imageNum; - libraw.reset(new LibRaw()); + if (settings->enableLibRaw) { + libraw.reset(new LibRaw()); + } int libraw_error = [&]() -> int { + if (!settings->enableLibRaw) { + return LIBRAW_SUCCESS; + } + libraw->imgdata.params.use_camera_wb = 1; int err = libraw->open_buffer(ifp->data, ifp->size); @@ -654,7 +660,9 @@ int RawImage::loadRaw(bool loadData, unsigned int imageNum, bool closeFile, Prog return libraw_error; } } else { - libraw->recycle(); + if (libraw) { + libraw->recycle(); + } } if (decoder == Decoder::DCRAW) { diff --git a/rtengine/settings.h b/rtengine/settings.h index fbbb51bbb..383611c2a 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -51,6 +51,7 @@ public: Glib::ustring flatFieldsPath; ///< The default directory for flat fields Glib::ustring cameraProfilesPath; ///< The default directory for camera profiles Glib::ustring lensProfilesPath; ///< The default directory for lens profiles + bool enableLibRaw; ///< Use LibRaw to decode raw images. Glib::ustring adobe; // filename of AdobeRGB1998 profile (default to the bundled one) Glib::ustring prophoto; // filename of Prophoto profile (default to the bundled one) diff --git a/rtgui/options.cc b/rtgui/options.cc index 61d67f9b6..cc3ca6cca 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -591,6 +591,7 @@ void Options::setDefaults() #else rtSettings.iccDirectory = "/usr/share/color/icc"; #endif + rtSettings.enableLibRaw = true; // rtSettings.viewingdevice = 0; // rtSettings.viewingdevicegrey = 3; // rtSettings.viewinggreySc = 1; @@ -1745,6 +1746,14 @@ void Options::readFromFile(Glib::ustring fname) } } + const Glib::ustring groupRawDecoder = "Raw Decoder"; + if (keyFile.has_group(groupRawDecoder)) { + const Glib::ustring keyEnableLibRaw = "EnableLibRaw"; + if (keyFile.has_key(groupRawDecoder, keyEnableLibRaw)) { + rtSettings.enableLibRaw = keyFile.get_boolean(groupRawDecoder, keyEnableLibRaw); + } + } + if (keyFile.has_group("Color Management")) { if (keyFile.has_key("Color Management", "ICCDirectory")) { rtSettings.iccDirectory = keyFile.get_string("Color Management", "ICCDirectory"); @@ -2590,6 +2599,8 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_integer("Crop Settings", "GuidesMode", cropGuides); keyFile.set_boolean("Crop Settings", "AutoFit", cropAutoFit); + keyFile.set_boolean("Raw Decoder", "EnableLibRaw", rtSettings.enableLibRaw); + keyFile.set_string("Color Management", "PrinterProfile", rtSettings.printerProfile); keyFile.set_integer("Color Management", "PrinterIntent", rtSettings.printerIntent); keyFile.set_boolean("Color Management", "PrinterBPC", rtSettings.printerBPC); diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 103075274..c9d360e7e 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -744,6 +744,14 @@ Gtk::Widget* Preferences::getImageProcessingPanel () cropFrame->add(*cropGrid); vbImageProcessing->pack_start(*cropFrame, Gtk::PACK_SHRINK, 4); + Gtk::Frame *rawDecoderFrame = Gtk::manage(new Gtk::Frame(M("PREFERENCES_RAW_DECODER"))); + Gtk::Box *rawDecoderContainer = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); + rawDecoderFrame->add(*rawDecoderContainer); + enableLibRaw = Gtk::manage(new Gtk::CheckButton()); + enableLibRaw->add(*Gtk::manage(new Gtk::Label(M("PREFERENCES_RAW_DECODER_ENABLE_LIBRAW")))); + rawDecoderContainer->pack_start(*enableLibRaw); + vbImageProcessing->pack_start(*rawDecoderFrame, Gtk::PACK_SHRINK, 4); + swImageProcessing->add(*vbImageProcessing); return swImageProcessing; @@ -1995,6 +2003,8 @@ void Preferences::storePreferences() moptions.cropGuides = Options::CropGuidesMode(cropGuidesCombo->get_active_row_number()); moptions.cropAutoFit = cropAutoFitCB->get_active(); + moptions.rtSettings.enableLibRaw = enableLibRaw->get_active(); + toolLocationPreference->updateOptions(); moptions.rtSettings.metadata_xmp_sync = rtengine::Settings::MetadataXmpSync(metadataSyncCombo->get_active_row_number()); @@ -2229,6 +2239,8 @@ void Preferences::fillPreferences() cropGuidesCombo->set_active(moptions.cropGuides); cropAutoFitCB->set_active(moptions.cropAutoFit); + enableLibRaw->set_active(moptions.rtSettings.enableLibRaw); + addc.block(false); setc.block(false); cpfconn.block(false); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 219844d55..4135b9792 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -249,6 +249,8 @@ class Preferences final : Gtk::ComboBoxText *cropGuidesCombo; Gtk::CheckButton *cropAutoFitCB; + Gtk::CheckButton *enableLibRaw; + Gtk::ComboBoxText *metadataSyncCombo; Gtk::ComboBoxText *xmpSidecarCombo;