Update of /cvsroot/ufraw/ufraw
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28260

Modified Files:
        dcraw.cc 
Log Message:
dcraw modified 9.21 (1.465). Changelog: In colorcheck(), darken sample squares 
and do a second pass for exact white balance.

Index: dcraw.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw.cc,v
retrieving revision 1.314
retrieving revision 1.315
diff -u -d -r1.314 -r1.315
--- dcraw.cc    15 Jun 2014 02:30:11 -0000      1.314
+++ dcraw.cc    29 Jun 2014 03:15:11 -0000      1.315
@@ -487,7 +487,7 @@
   float **A, *b, *c, *d, *x, *y;
   int i, j;
 
-  A = (float **)calloc (((2*len + 4)*sizeof **A + sizeof *A), 2*len);
+  A = (float **) calloc (((2*len + 4)*sizeof **A + sizeof *A), 2*len);
   if (!A) return;
   A[0] = (float *) (A + 2*len);
   for (i = 1; i < 2*len; i++)
@@ -4027,8 +4027,8 @@
     { 0.310, 0.316, 9.0 },             // Neutral 3.5
     { 0.310, 0.316, 3.1 } };           // Black
   double gmb_cam[NSQ][4], gmb_xyz[NSQ][3];
-  double inverse[NSQ][3], cam_xyz[4][3], num;
-  int c, i, j, k, sq, row, col, count[4];
+  double inverse[NSQ][3], cam_xyz[4][3], balance[4], num;
+  int c, i, j, k, sq, row, col, pass, count[4];
 
   memset (gmb_cam, 0, sizeof gmb_cam);
   for (sq=0; sq < NSQ; sq++) {
@@ -4037,7 +4037,8 @@
       for (col=cut[sq][2]; col < cut[sq][2]+cut[sq][0]; col++) {
        c = FC(row,col);
        if (c >= colors) c -= 2;
-       gmb_cam[sq][c] += BAYER(row,col);
+       gmb_cam[sq][c] += BAYER2(row,col);
+       BAYER2(row,col) = black + (BAYER2(row,col)-black)/2;
        count[c]++;
       }
     FORCC gmb_cam[sq][c] = gmb_cam[sq][c]/count[c] - black;
@@ -4047,11 +4048,16 @@
                (1 - gmb_xyY[sq][0] - gmb_xyY[sq][1]) / gmb_xyY[sq][1];
   }
   pseudoinverse (gmb_xyz, inverse, NSQ);
-  for (raw_color = i=0; i < colors; i++)
-    for (j=0; j < 3; j++)
-      for (cam_xyz[i][j] = k=0; k < NSQ; k++)
-       cam_xyz[i][j] += gmb_cam[k][i] * inverse[k][j];
-  cam_xyz_coeff (rgb_cam, cam_xyz);
+  for (pass=0; pass < 2; pass++) {
+    for (raw_color = i=0; i < colors; i++)
+      for (j=0; j < 3; j++)
+       for (cam_xyz[i][j] = k=0; k < NSQ; k++)
+         cam_xyz[i][j] += gmb_cam[k][i] * inverse[k][j];
+    cam_xyz_coeff (rgb_cam, cam_xyz);
+    FORCC balance[c] = pre_mul[c] * gmb_cam[20][c];
+    for (sq=0; sq < NSQ; sq++)
+      FORCC gmb_cam[sq][c] *= balance[c];
+  }
   if (verbose) {
     dcraw_message (DCRAW_VERBOSE, "    { \"%s %s\", %d,\n\t{", make, model, 
black);
     num = 10000 / (cam_xyz[1][0] + cam_xyz[1][1] + cam_xyz[1][2]);


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to