From c1397446470e2cad95fb1754eca0face28ef5df5 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 16 Jan 2018 20:38:29 +0100 Subject: [PATCH 1/2] RT somtimes misinterpretes image orientation of Canon CR2 files, fixes #4293 --- rtengine/dcraw.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index eee4f34c0..4786000bb 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -5497,7 +5497,8 @@ nf: order = 0x4949; for (c=i=2; (ushort) c != 0xbbbb && i < len; i++) c = c << 8 | fgetc(ifp); while ((i+=4) < len-5) - if (get4() == 257 && (i=len) && (c = (get4(),fgetc(ifp))) < 3) + if (get4() == 257 && (i=len) && (c = (get4(),fgetc(ifp))) < 3 && strcmp(make,"Canon")) + // don't use this tag for Canon cameras as it's known to give wrong orientation some times flip = "065"[c]-'0'; } if (tag == 0x10 && type == 4) From f644d41ff22e85773ee6d30ae9469420062bbfcd Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 16 Jan 2018 22:34:29 +0100 Subject: [PATCH 2/2] Remove buggy (unpredictable) automatic setting of HL reconstruction when using Auto levels, fixes #4249 --- rtengine/improccoordinator.cc | 21 +-------------------- rtengine/procparams.cc | 16 ---------------- rtengine/procparams.h | 1 - rtengine/simpleprocess.cc | 10 ---------- 4 files changed, 1 insertion(+), 47 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 765c4b704..87a039a7c 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -199,11 +199,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) imgsrc->preprocess ( rp, params.lensProf, params.coarse ); imgsrc->getRAWHistogram ( histRedRaw, histGreenRaw, histBlueRaw ); - if (highDetailNeeded) { - highDetailPreprocessComputed = true; - } else { - highDetailPreprocessComputed = false; - } + highDetailPreprocessComputed = highDetailNeeded; } /* @@ -269,21 +265,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - - // Updating toneCurve.hrenabled if necessary - // It has to be done there, because the next 'if' statement will use the value computed here - if (todo & M_AUTOEXP) { - if (params.toneCurve.autoexp) {// this enabled HLRecovery - if (ToneCurveParams::HLReconstructionNecessary (histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { - // switching params.toneCurve.hrenabled to true -> shouting in listener's ears! - params.toneCurve.hrenabled = true; - - // forcing INIT to be done, to reconstruct HL again - todo |= M_INIT; - } - } - } - if (todo & (M_INIT | M_LINDENOISE | M_HDR)) { MyMutex::MyLock initLock (minit); // Also used in crop window diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 80041e706..e1d62bb99 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -357,22 +357,6 @@ bool ToneCurveParams::operator !=(const ToneCurveParams& other) const return !(*this == other); } -bool ToneCurveParams::HLReconstructionNecessary(const LUTu& histRedRaw, const LUTu& histGreenRaw, const LUTu& histBlueRaw) -{ - if (options.rtSettings.verbose) { - printf("histRedRaw[ 0]=%07d, histGreenRaw[ 0]=%07d, histBlueRaw[ 0]=%07d\nhistRedRaw[255]=%07d, histGreenRaw[255]=%07d, histBlueRaw[255]=%07d\n", - histRedRaw[0], histGreenRaw[0], histBlueRaw[0], histRedRaw[255], histGreenRaw[255], histBlueRaw[255]); - } - - return - histRedRaw[255] > 50 - || histGreenRaw[255] > 50 - || histBlueRaw[255] > 50 - || histRedRaw[0] > 50 - || histGreenRaw[0] > 50 - || histBlueRaw[0] > 50; -} - RetinexParams::RetinexParams() : enabled(false), cdcurve{ diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 7cc80b313..b3f13d00f 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -286,7 +286,6 @@ struct ToneCurveParams { bool operator ==(const ToneCurveParams& other) const; bool operator !=(const ToneCurveParams& other) const; - static bool HLReconstructionNecessary(const LUTu& histRedRaw, const LUTu& histGreenRaw, const LUTu& histBlueRaw); }; /** diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 027600302..ebb591590 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -200,16 +200,6 @@ private: imgsrc->setCurrentFrame (params.raw.bayersensor.imageNum); imgsrc->preprocess ( params.raw, params.lensProf, params.coarse, params.dirpyrDenoise.enabled); - if (params.toneCurve.autoexp) {// this enabled HLRecovery - LUTu histRedRaw (256), histGreenRaw (256), histBlueRaw (256); - imgsrc->getRAWHistogram (histRedRaw, histGreenRaw, histBlueRaw); - - if (ToneCurveParams::HLReconstructionNecessary (histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { - params.toneCurve.hrenabled = true; - // WARNING: Highlight Reconstruction is being forced 'on', should we force a method here too? - } - } - if (pl) { pl->setProgress (0.20); }