From 2d730572f58ec1c51f74b24496698c8c9d2c108a Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 3 Nov 2016 01:27:56 +0100 Subject: [PATCH] Fixed gui (thanks to Hombre) and cleaned code a bit --- rtengine/rawimage.cc | 6 +----- rtengine/rawimagesource.cc | 25 ++++++++++++++++++++----- rtgui/bayerprocess.cc | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index 395a8bc55..43b829148 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -424,15 +424,11 @@ int RawImage::loadRaw (bool loadData, unsigned int &imageNum, bool closeFile, Pr //***************** Read ALL raw file info // set the number of the frame to extract. If the number is larger then number of existing frames - 1, dcraw will handle that correctly - identify (); - fclose(ifp); - ifp = gfopen (ifname); // Maps to either file map or direct fopen - shot_select = imageNum; - shot_select = std::min(shot_select, std::max(is_raw, 1u) - 1); identify(); std::cout << "israw : " << is_raw << std::endl; // in case dcraw didn't handle the above mentioned case... + shot_select = std::min(shot_select, std::max(is_raw, 1u) - 1); imageNum = shot_select; if (!is_raw) { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 9cef132ae..6e71e771f 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1506,9 +1506,21 @@ int RawImageSource::load (const Glib::ustring &fname, int imageNum, bool batch) plistener->setProgress (0.0); } - unsigned int tempImageNum = 16; - do { - tempImageNum --; + unsigned int tempImageNum = 256; + // requesting a subimage which is not available gives subimage 0. We use 256 to access a non existent frame resulting in frame 0 + ri = new RawImage(fname); + int errCode = ri->loadRaw (true, tempImageNum, true, plistener, 0.8); + // now tempImageNum is adjusted to the number of last frame + + if (errCode) { + return errCode; + } + ri->compress_image(); + ri->set_prefilters(); + riFrames[0] = ri; + numFrames ++; + + while (tempImageNum) { numFrames ++; ri = new RawImage(fname); int errCode = ri->loadRaw (true, tempImageNum, true, plistener, 0.8); @@ -1520,9 +1532,10 @@ int RawImageSource::load (const Glib::ustring &fname, int imageNum, bool batch) riFrames[tempImageNum] = ri; ri->compress_image(); ri->set_prefilters(); - } while (tempImageNum); + tempImageNum --; + } - if(numFrames > 1 ) { + if(numFrames > 1 ) { // this disables multi frame support for Fuji S5 until I found a solution to handle different dimensions if(riFrames[0]->get_width() != riFrames[1]->get_width() || riFrames[0]->get_height() != riFrames[1]->get_height()) { numFrames = 1; } @@ -1530,6 +1543,8 @@ int RawImageSource::load (const Glib::ustring &fname, int imageNum, bool batch) std::cout << "numframes : " << numFrames << std::endl; + ri = riFrames[0]; + if (plistener) { plistener->setProgress (0.9); } diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index 3a4f2898a..639eabc02 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -39,7 +39,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA pack_start( *hb1, Gtk::PACK_SHRINK, 4); imageNumberBox = Gtk::manage (new Gtk::HBox ()); - hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_IMAGENUM") + ": ")), Gtk::PACK_SHRINK, 4); + imageNumberBox->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_IMAGENUM") + ": ")), Gtk::PACK_SHRINK, 4); imageNumber = Gtk::manage (new MyComboBoxText ()); imageNumber->append_text("1"); imageNumber->append_text("2");