From 7181f4b2451cd6a88e4102e1bdaad297da1c4b80 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 24 Nov 2017 11:41:48 +0100 Subject: [PATCH] dcraw: apply the fix for #4129 only for DNGs coming from the Adobe DNG Converter --- rtengine/dcraw.cc | 15 ++++++++++----- rtengine/dcraw.h | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 7fef1146f..9ae313530 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -6410,6 +6410,9 @@ guess_cfa_pc: } if (!use_cm) FORCC pre_mul[c] /= cc[cm_D65][c][c]; + + RT_from_adobe_dng_converter = !strncmp(software, "Adobe DNG Converter", 19); + return 0; } @@ -9690,14 +9693,16 @@ bw: colors = 1; } dng_skip: if ((use_camera_matrix & (use_camera_wb || dng_version)) - && cmatrix[0][0] > 0.125) { + && cmatrix[0][0] > 0.125 + && !RT_from_adobe_dng_converter /* RT -- do not use the embedded + * matrices for DNGs coming from the + * Adobe DNG Converter, to ensure + * consistency of WB values between + * DNG-converted and original raw + * files. See #4129 */) { memcpy (rgb_cam, cmatrix, sizeof cmatrix); raw_color = 0; - if (dng_version && !use_camera_wb) { // RT - raw_color = 1; - } } - // RT -- TODO: check if these special cases are still needed! if(!strncmp(make, "Panasonic", 9) && !strncmp(model, "DMC-LX100",9)) adobe_coeff (make, model); if(!strncmp(make, "Samsung", 7) && !strncmp(model, "GX20",4)) diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index cc1f36484..0a10f9732 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -58,6 +58,7 @@ public: ,RT_whitelevel_from_constant(0) ,RT_blacklevel_from_constant(0) ,RT_matrix_from_constant(0) + ,RT_from_adobe_dng_converter(false) ,getbithuff(this,ifp,zero_after_ff) { memset(&hbd, 0, sizeof(hbd)); @@ -151,6 +152,7 @@ protected: int RT_whitelevel_from_constant; int RT_blacklevel_from_constant; int RT_matrix_from_constant; + bool RT_from_adobe_dng_converter; float cam_mul[4], pre_mul[4], cmatrix[3][4], rgb_cam[3][4];