From 3f13a98135d7bfe8d03c6603b435cc99e2051355 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 1 Nov 2016 02:20:43 +0100 Subject: [PATCH] Prepare rtengine to allow extraction of individual frames from multi frame raw files (i.e. Pentax pixel shift) --- rtengine/rawimage.cc | 4 +++- rtengine/rawimage.h | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index 382ebe0a7..2d778a3b5 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -398,7 +398,7 @@ skip_block: } } -int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistener, double progressRange) +int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistener, double progressRange, unsigned int frameNum) { ifname = filename.c_str(); image = nullptr; @@ -435,6 +435,8 @@ int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistene return 2; } + setFrameNumber(frameNum); + if (flip == 5) { this->rotate_deg = 270; } else if (flip == 3) { diff --git a/rtengine/rawimage.h b/rtengine/rawimage.h index 88ef5d710..c3da24f0d 100644 --- a/rtengine/rawimage.h +++ b/rtengine/rawimage.h @@ -106,7 +106,7 @@ public: explicit RawImage( const Glib::ustring &name ); ~RawImage(); - int loadRaw (bool loadData = true, bool closeFile = true, ProgressListener *plistener = nullptr, double progressRange = 1.0); + int loadRaw (bool loadData = true, bool closeFile = true, ProgressListener *plistener = nullptr, double progressRange = 1.0, unsigned int frameNum = 0); void get_colorsCoeff( float* pre_mul_, float* scale_mul_, float* cblack_, bool forceAutoWB ); void set_prefilters() { @@ -307,6 +307,13 @@ public: return zero_is_bad == 1 ? true : false; } + void setFrameNumber(unsigned int frameNum) { + // a single raw file can contain more than one frame. + // Variable is_raw holds the number of frames in the raw file + // use setFrameNumber() to set the number of the frame [0; is_raw - 1] to be processed + shot_select = std::min(std::max(is_raw, 1) - 1, frameNum); + } + public: // dcraw functions void scale_colors()