From 64979b0660dac565ad492a6262bf1272dbe3e011 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 10 Mar 2018 12:18:56 +0100 Subject: [PATCH] PDAF patterns ignored in user's camconst, #4435 --- rtengine/camconst.cc | 26 +++++++++++++++++++++++--- rtengine/camconst.h | 4 +++- rtengine/pdaflinesfilter.cc | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/rtengine/camconst.cc b/rtengine/camconst.cc index 09a9e55ab..3d4342ed9 100644 --- a/rtengine/camconst.cc +++ b/rtengine/camconst.cc @@ -380,10 +380,28 @@ CameraConst::has_pdafPattern() return pdafPattern.size() > 0; } -void -CameraConst::get_pdafPattern(std::vector &pattern) +std::vector +CameraConst::get_pdafPattern() { - pattern = pdafPattern; + return pdafPattern; +} + +void +CameraConst::update_pdafPattern(const std::vector &other) +{ + if (other.empty()) { + return; + } + pdafPattern = other; +} + +void +CameraConst::update_pdafOffset(int other) +{ + if (other == 0) { + return; + } + pdafOffset = other; } bool @@ -719,6 +737,8 @@ CameraConstantsStore::parse_camera_constants_file(Glib::ustring filename_) // deleting all the existing levels, replaced by the new ones existingcc->update_Levels(cc); existingcc->update_Crop(cc); + existingcc->update_pdafPattern(cc->get_pdafPattern()); + existingcc->update_pdafOffset(cc->get_pdafOffset()); if (settings->verbose) { printf("Merging camera constants for \"%s\"\n", make_model.c_str()); diff --git a/rtengine/camconst.h b/rtengine/camconst.h index 0f5d5d2ba..60e17201b 100644 --- a/rtengine/camconst.h +++ b/rtengine/camconst.h @@ -37,7 +37,7 @@ public: bool has_pdafPattern(void); void update_dcrawMatrix(const short *other); const short *get_dcrawMatrix(void); - void get_pdafPattern(std::vector &pattern); + std::vector get_pdafPattern(); int get_pdafOffset() {return pdafOffset;} bool has_rawCrop(void); void get_rawCrop(int& left_margin, int& top_margin, int& width, int& height); @@ -47,6 +47,8 @@ public: int get_WhiteLevel(int idx, int iso_speed, float fnumber); void update_Levels(const CameraConst *other); void update_Crop(CameraConst *other); + void update_pdafPattern(const std::vector &other); + void update_pdafOffset(int other); }; class CameraConstantsStore diff --git a/rtengine/pdaflinesfilter.cc b/rtengine/pdaflinesfilter.cc index 20355c0dd..b026324bc 100644 --- a/rtengine/pdaflinesfilter.cc +++ b/rtengine/pdaflinesfilter.cc @@ -134,7 +134,7 @@ PDAFLinesFilter::PDAFLinesFilter(RawImage *ri): CameraConst *cc = ccs->get(ri_->get_maker().c_str(), ri_->get_model().c_str()); if (cc) { - cc->get_pdafPattern(pattern_); + pattern_ = cc->get_pdafPattern(); if(!pattern_.empty()) { offset_ = cc->get_pdafOffset(); }