From 186d7daf6ef1424d80c477dd82b4e75f76ed845a Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Wed, 24 Nov 2010 10:10:29 -0600 Subject: [PATCH] Patch to make autoexposure of thumbs and preview image agree. The problem was that white balance was applied to raw data for preview image but not for thumbs. I sure hope all this improves with rtengine2. --- rtengine/dcraw.cc | 8 ++++---- rtengine/dcraw.patch | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 04996e7c5..2c10b5028 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -9488,7 +9488,7 @@ t4.set (); tpp->aeHistogram = new unsigned int[65536>>tpp->aeHistCompression]; memset (tpp->aeHistogram, 0, (65536>>tpp->aeHistCompression)*sizeof(int)); int radd = 4; - int gadd = 2; + int gadd = 4; int badd = 4; if (!filter) radd = gadd = badd = 1; @@ -9505,11 +9505,11 @@ t4.set (); } for (int j=start; jaeHistogram[image[i* ::width+j][1]>>tpp->aeHistCompression]+=gadd; + tpp->aeHistogram[CLIP((int)(tpp->camwbGreen*image[i* ::width+j][1]))>>tpp->aeHistCompression]+=gadd; else if (FISRED(filter,i,j)) - tpp->aeHistogram[image[i* ::width+j][0]>>tpp->aeHistCompression]+=radd; + tpp->aeHistogram[CLIP((int)(tpp->camwbRed*image[i* ::width+j][0]))>>tpp->aeHistCompression]+=radd; else if (FISBLUE(filter,i,j)) - tpp->aeHistogram[image[i* ::width+j][2]>>tpp->aeHistCompression]+=badd; + tpp->aeHistogram[CLIP((int)(tpp->camwbBlue*image[i* ::width+j][2]))>>tpp->aeHistCompression]+=badd; } t5.set (); diff --git a/rtengine/dcraw.patch b/rtengine/dcraw.patch index 6f172437d..b759638ee 100644 --- a/rtengine/dcraw.patch +++ b/rtengine/dcraw.patch @@ -890,7 +890,7 @@ + tpp->aeHistogram = new unsigned int[65536>>tpp->aeHistCompression]; + memset (tpp->aeHistogram, 0, (65536>>tpp->aeHistCompression)*sizeof(int)); + int radd = 4; -+ int gadd = 2; ++ int gadd = 4; + int badd = 4; + if (!filter) + radd = gadd = badd = 1; @@ -907,11 +907,11 @@ + } + for (int j=start; jaeHistogram[image[i* ::width+j][1]>>tpp->aeHistCompression]+=gadd; ++ tpp->aeHistogram[CLIP((int)(tpp->camwbGreen*image[i* ::width+j][1]))>>tpp->aeHistCompression]+=gadd; + else if (FISRED(filter,i,j)) -+ tpp->aeHistogram[image[i* ::width+j][0]>>tpp->aeHistCompression]+=radd; ++ tpp->aeHistogram[CLIP((int)(tpp->camwbRed*image[i* ::width+j][0]))>>tpp->aeHistCompression]+=radd; + else if (FISBLUE(filter,i,j)) -+ tpp->aeHistogram[image[i* ::width+j][2]>>tpp->aeHistCompression]+=badd; ++ tpp->aeHistogram[CLIP((int)(tpp->camwbBlue*image[i* ::width+j][2]))>>tpp->aeHistCompression]+=badd; + } + +t5.set ();