Update of /cvsroot/ufraw/ufraw
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22744

Modified Files:
        dcraw.cc dcraw.h 
Log Message:
dcraw modified 8.97 (1.427). Changelog: Support the Canon A470, G11, Nikon 
D3000, and Panasonic FZ35/FZ38. Support camera WB for the Kodak EasyShare Z980 
and Z1015.

Index: dcraw.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw.cc,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -d -r1.186 -r1.187
--- dcraw.cc    20 Aug 2009 16:40:21 -0000      1.186
+++ dcraw.cc    30 Aug 2009 15:50:12 -0000      1.187
@@ -19,7 +19,7 @@
 #include "config.h"
 #endif
 
-#define DCRAW_VERSION "8.96"
+#define DCRAW_VERSION "8.97"
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
@@ -1148,7 +1148,7 @@
   free (pixel);
 }
 
-void CLASS pentax_k10_load_raw()
+void CLASS pentax_load_raw()
 {
   ushort bit[2][13], huff[4097];
   int row, col, diff, c, i;
@@ -1331,23 +1331,6 @@
   return nz > 20;
 }
 
-/* Here raw_width is in bytes, not pixels. */
-void CLASS nikon_e900_load_raw()
-{
-  int offset=0, irow, row, col;
-
-  for (irow=0; irow < height; irow++) {
-    row = irow * 2 % height;
-    if (row == 1)
-      offset = - (-offset & -4096);
-    fseek (ifp, offset, SEEK_SET);
-    offset += raw_width;
-    getbits(-1);
-    for (col=0; col < width; col++)
-      BAYER(row,col) = getbits(10);
-  }
-}
-
 /*
    The Fuji Super CCD is just a Bayer grid rotated 45 degrees.
  */
@@ -1832,7 +1815,7 @@
 
 void CLASS packed_load_raw()
 {
-  int vbits=0, bwide, pwide, rbits, bite, irow, row, col, val, i;
+  int vbits=0, bwide, pwide, rbits, bite, half, irow, row, col, val, i;
   UINT64 bitbuf=0;
 
   if ((ushort)(raw_width * 8) >= width * tiff_bps) /* Is raw_width in bytes? */
@@ -1842,16 +1825,17 @@
   if (load_flags & 1) bwide = bwide * 16 / 15;
   fseek (ifp, top_margin*bwide, SEEK_CUR);
   bite = 8 + (load_flags & 24);
+  half = (height+1) >> 1;
   for (irow=0; irow < height; irow++) {
     row = irow;
     if (load_flags & 2 &&
-       (row = irow * 2 % height + irow / (height/2)) == 1 &&
+       (row = irow % half * 2 + irow / half) == 1 &&
        load_flags & 4) {
       if (vbits=0, tiff_compress)
-       fseek (ifp, data_offset - (-width*height*3/4 & -2048), SEEK_SET);
+       fseek (ifp, data_offset - (-half*bwide & -2048), SEEK_SET);
       else {
        fseek (ifp, 0, SEEK_END);
-       fseek (ifp, ftell(ifp)/2, SEEK_SET);
+       fseek (ifp, ftell(ifp) >> 3 << 2, SEEK_SET);
       }
     }
     for (col=0; col < pwide; col++) {
@@ -1956,7 +1940,7 @@
     }
 }
 
-void CLASS olympus_e410_load_raw()
+void CLASS olympus_load_raw()
 {
   ushort huff[4096];
   int row, col, nbits, sign, low, high, i, c, w, n, nw;
@@ -4679,7 +4663,7 @@
     if ((tag | 0x70) == 0x2070 && type == 4)
       fseek (ifp, get4()+base, SEEK_SET);
     if (tag == 0x2010 && type != 7)
-      load_raw = &CLASS olympus_e410_load_raw;
+      load_raw = &CLASS olympus_load_raw;
     if (tag == 0x2020)
       parse_thumb_note (base, 257, 258);
     if (tag == 0x2040)
@@ -5404,7 +5388,7 @@
       case 34713:
        load_raw = &CLASS nikon_compressed_load_raw;            break;
       case 65535:
-       load_raw = &CLASS pentax_k10_load_raw;                  break;
+       load_raw = &CLASS pentax_load_raw;                      break;
       case 65000:
        switch (tiff_ifd[raw].phint) {
          case 2: load_raw = &CLASS kodak_rgb_load_raw;   filters = 0;  break;
@@ -6128,12 +6112,16 @@
        { 6806,-179,-1020,-8097,16415,1687,-3267,4236,7690 } },
     { "Canon EOS", 0, 0,
        { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } },
+    { "Canon PowerShot A530", 0, 0,
+       { 0 } },        /* don't want the A5 matrix */  
     { "Canon PowerShot A50", 0, 0,
        { -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } },
     { "Canon PowerShot A5", 0, 0,
        { -4801,9475,1952,2926,1611,4094,-5259,10164,5947,-1554,10883,547 } },
     { "Canon PowerShot G10", 0, 0,
        { 11093,-3906,-1028,-5047,12492,2879,-1003,1750,5561 } },
+    { "Canon PowerShot G11", 0, 0,
+       { 0 } },        /* don't want the G1 matrix */
     { "Canon PowerShot G1", 0, 0,
        { -4778,9467,2172,4743,-1141,4344,-5146,9908,6077,-1566,11051,557 } },
     { "Canon PowerShot G2", 0, 0,
@@ -6164,6 +6152,8 @@
        { 8795,-2482,-797,-7804,15403,2573,-1422,1996,7082 } },
     { "Canon PowerShot S70", 0, 0,
        { 9976,-3810,-832,-7115,14463,2906,-901,989,7889 } },
+    { "Canon PowerShot A470", 0, 0,    /* DJC */
+       { 12513,-4407,-1242,-2680,10276,2405,-878,2215,4734 } },
     { "Canon PowerShot A610", 0, 0,    /* DJC */
        { 15591,-6402,-1592,-5365,13198,2168,-1300,1824,5075 } },
     { "Canon PowerShot A620", 0, 0,    /* DJC */
@@ -6338,8 +6328,8 @@
        { 5710,-901,-615,-8594,16617,2024,-2975,4120,6830 } },
     { "NIKON D2X", 0, 0,
        { 10231,-2769,-1255,-8301,15900,2552,-797,680,7148 } },
-    { "NIKON D3000", 0, 0,             /* DJC */
-       { 11040,-3622,-985,-4895,12819,2077,-651,1019,6976 } },
+    { "NIKON D3000", 0, 0,
+       { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } },
     { "NIKON D300", 0, 0,
        { 9030,-1992,-715,-8465,16302,2255,-2689,3217,8069 } },
     { "NIKON D3X", 0, 0,
@@ -6410,7 +6400,7 @@
        { 7828,-1761,-348,-5788,14071,1830,-2853,4518,6557 } },
     { "OLYMPUS E-330", 0, 0,
        { 8961,-2473,-1084,-7979,15990,2067,-2319,3035,8249 } },
-    { "OLYMPUS E-30", 0, 0,
+    { "OLYMPUS E-30", 0, 0xfbc,
        { 8144,-1861,-1111,-7763,15894,1929,-1865,2542,7607 } },
     { "OLYMPUS E-3", 0, 0xf99,
        { 9487,-2875,-1115,-7533,15606,2010,-1618,2100,7389 } },
@@ -6430,6 +6420,8 @@
        { 8344,-2322,-1020,-7596,15635,2048,-1748,2269,7287 } },
     { "OLYMPUS E-620", 0, 0xfb9,
        { 8453,-2198,-1092,-7609,15681,2008,-1725,2337,7824 } },
+    { "OLYMPUS E-P1", 0, 0xffd,
+       { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } },
     { "OLYMPUS SP350", 0, 0,
        { 12078,-4836,-1069,-6671,14306,2578,-786,939,7418 } },
     { "OLYMPUS SP3", 0, 0,
@@ -6476,6 +6468,8 @@
        { 10109,-3488,-993,-5412,12812,2916,-1305,2140,5543 } },
     { "Panasonic DMC-FZ30", 0, 0xf94c,
        { 10976,-4029,-1141,-7918,15491,2600,-1670,2071,8246 } },
+    { "Panasonic DMC-FZ35", 147, 0xfff,
+       { 9938,-2780,-890,-4604,12393,2480,-1117,2304,4620 } },
     { "Panasonic DMC-FZ50", 0, 0xfff0, /* aka "LEICA V-LUX1" */
        { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } },
     { "Panasonic DMC-L10", 15, 0xf96,
@@ -6546,10 +6540,12 @@
     if (!strncmp (name, table[i].prefix, strlen(table[i].prefix))) {
       if (table[i].black)   black   = (ushort) table[i].black;
       if (table[i].maximum) maximum = (ushort) table[i].maximum;
-      for (j=0; j < 4; j++)
-       for (k=0; k < 3; k++)
-         cam_xyz[j][k] = table[i].trans[3*j+k] / 10000.0;
-      cam_xyz_coeff (cam_xyz);
+      if (table[i].trans[0]) {
+       for (j=0; j < 4; j++)
+         for (k=0; k < 3; k++)
+           cam_xyz[0][j] = table[i].trans[3*j+k] / 10000.0;
+       cam_xyz_coeff (cam_xyz);
+      }
       break;
     }
 }
@@ -6593,23 +6589,22 @@
   return sum[0] < sum[1] ? 0x4d4d : 0x4949;
 }
 
-float CLASS find_green (int off0, int off1)
+float CLASS find_green (int bps, int bite, int off0, int off1)
 {
   UINT64 bitbuf=0;
-  int vbits, bite, col, i, c;
+  int vbits, col, i, c;
   ushort img[2][2064];
   double sum[]={0,0};
 
-  bite = 8 + (load_flags & 24);
   FORC(2) {
     fseek (ifp, c ? off1:off0, SEEK_SET);
     for (vbits=col=0; col < width; col++) {
-      for (vbits -= 12; vbits < 0; vbits += bite) {
+      for (vbits -= bps; vbits < 0; vbits += bite) {
        bitbuf <<= bite;
        for (i=0; i < bite; i+=8)
          bitbuf |= (unsigned) (fgetc(ifp) << i);
       }
-      img[c][col] = bitbuf << (52-vbits) >> 52;
+      img[c][col] = bitbuf << (64-bps-vbits) >> (64-bps);
     }
   }
   FORC(width-1) {
@@ -6644,7 +6639,6 @@
     {  6166488, "Kodak",    "C603"            ,0 },
     {  9116448, "Kodak",    "C603y"           ,0 },
     {   311696, "ST Micro", "STV680 VGA"      ,0 },  /* SPYz */
-    {   614400, "Kodak",    "KAI-0340"        ,0 },
     {   787456, "Creative", "PC-CAM 600"      ,0 },
     {  1138688, "Minolta",  "RD175"           ,0 },
     {  3840000, "Foculus",  "531C"            ,0 },
@@ -6664,6 +6658,7 @@
     {  6653280, "Canon",    "PowerShot A530"  ,0 },
     {  6573120, "Canon",    "PowerShot A610"  ,0 },
     {  9219600, "Canon",    "PowerShot A620"  ,0 },
+    {  9243240, "Canon",    "PowerShot A470"  ,0 },
     { 10341600, "Canon",    "PowerShot A720"  ,0 },
     { 10383120, "Canon",    "PowerShot A630"  ,0 },
     { 12945240, "Canon",    "PowerShot A640"  ,0 },
@@ -6957,7 +6952,6 @@
     raw_width  = 2672;
     top_margin  = 6;
     left_margin = 10;
-    raw_color = 0;
     goto canon_a5;
   } else if (!strcmp(model,"PowerShot A610")) {
     if (canon_s2is()) strcpy (model+10, "S2 IS");
@@ -6976,6 +6970,14 @@
     top_margin  = 12;
     left_margin = 36;
     goto canon_a5;
+  } else if (!strcmp(model,"PowerShot A470")) {
+    height = 2328;
+    width  = 3096;
+    raw_height = 2346;
+    raw_width  = 3152;
+    top_margin  = 6;
+    left_margin = 12;
+    goto canon_a5;
   } else if (!strcmp(model,"PowerShot A720")) {
     height = 2472;
     width  = 3298;
@@ -7088,6 +7090,11 @@
     top_margin  = 12;
     left_margin = 74;
     goto canon_cr2;
+  } else if (is_canon && raw_width == 3744) {
+    height = 2760;
+    width  = 3684;
+    top_margin  = 16;
+    left_margin = 8;
   } else if (is_canon && raw_width == 3944) {
     height = 2602;
     width  = 3908;
@@ -7205,7 +7212,6 @@
     height = 963;
     width = 1287;
     raw_width = 1632;
-    load_raw = &CLASS nikon_e900_load_raw;
     maximum = 0x3f4;
     colors = 4;
     filters = 0x1e1e1e1e;
@@ -7213,14 +7219,18 @@
     pre_mul[0] = 1.2085;
     pre_mul[1] = 1.0943;
     pre_mul[3] = 1.1103;
+    goto e900;
   } else if (fsize == 2465792) {
     height = 1203;
     width  = 1616;
     raw_width = 2048;
-    load_raw = &CLASS nikon_e900_load_raw;
     colors = 4;
     filters = 0x4b4b4b4b;
     adobe_coeff ("NIKON","E950");
+e900:
+    tiff_bps = 10;
+    load_raw = &CLASS packed_load_raw;
+    load_flags = 6;
   } else if (fsize == 4771840) {
     height = 1540;
     width  = 2064;
@@ -7262,8 +7272,8 @@
       filters = 0x16161616;
     }
     if (make[0] == 'O') {
-      i = find_green (0, fsize/2);
-      c = find_green (0, 3096);
+      i = find_green (12, 32, 0, fsize/2);
+      c = find_green (12, 32, 0, 3096);
       if (abs(i) < abs(c)) {
        SWAP(i,c);
        load_flags = 24;
@@ -7418,12 +7428,6 @@
     flip = 2;
     filters = 0x16161616;
     black = 16;
-  } else if (!strcmp(model,"KAI-0340")) {
-    height = 477;
-    width  = 640;
-    order = 0x4949;
-    data_offset = 3840;
-    load_raw = &CLASS unpacked_load_raw;
   } else if (!strcmp(model,"N95")) {
     height = raw_height - (top_margin = 2);
   } else if (!strcmp(model,"531C")) {
@@ -7633,14 +7637,19 @@
        width = 3982;
        if (height == 2250) goto lx3;
        width = 4018;
-       if (!strcmp(model,"DMC-GH1")) goto gh1;
+       filters = 0x16161616;
+       if (!strncmp(model,"DMC-FZ3",7)) {
+         height -= 2;
+         adobe_coeff ("Panasonic","DMC-FZ35");  break;
+       }
        filters = 0x49494949;
+       if (!strcmp(model,"DMC-GH1")) break;
        zero_is_bad = 1;
        adobe_coeff ("Panasonic","DMC-G1");  break;
       case 4172:
       case 4396:
        width -= 28;
-gh1:   filters = 0x49494949;
+       filters = 0x49494949;
        adobe_coeff ("Panasonic","DMC-GH1");  break;
       case 4290:
        height += 38;
@@ -7668,7 +7677,8 @@
     height += height & 1;
     filters = exif_cfa;
     if (width == 4100) width -= 4;
-    if (load_raw == &CLASS olympus_e410_load_raw) {
+    if (load_raw == &CLASS olympus_load_raw) {
+      tiff_bps = 12;
       black >>= 4;
     } else if (!strcmp(model,"E-10") ||
              !strncmp(model,"E-20",4)) {
@@ -7725,7 +7735,12 @@
   } else if (!strcmp(model,"C603v")) {
     height = 480;
     width  = 640;
-    goto c603v;
+    if (fsize < 614400 || find_green (16, 16, 3840, 5120) < 25) goto c603v;
+    strcpy (model,"KAI-0340");
+    height -= 3;
+    data_offset = 3840;
+    order = 0x4949;
+    load_raw = &CLASS unpacked_load_raw;
   } else if (!strcmp(model,"C603y")) {
     height = 2134;
     width  = 2848;

Index: dcraw.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- dcraw.h     14 Aug 2009 04:30:13 -0000      1.53
+++ dcraw.h     30 Aug 2009 15:50:12 -0000      1.54
@@ -146,7 +146,7 @@
 void adobe_copy_pixel (int row, int col, ushort **rp);
 void adobe_dng_load_raw_lj();
 void adobe_dng_load_raw_nc();
-void pentax_k10_load_raw();
+void pentax_load_raw();
 void nikon_compressed_load_raw();
 int nikon_is_compressed();
 int nikon_e995();
@@ -174,7 +174,7 @@
 void nokia_load_raw();
 unsigned pana_bits (int nbits);
 void panasonic_load_raw();
-void olympus_e410_load_raw();
+void olympus_load_raw();
 void minolta_rd175_load_raw();
 void quicktake_100_load_raw();
 void kodak_radc_load_raw();
@@ -258,7 +258,7 @@
 void adobe_coeff (const char *make, const char *model);
 void simple_coeff (int index);
 short guess_byte_order (int words);
-float find_green (int off0, int off1);
+float find_green (int bps, int bite, int off0, int off1);
 void identify();
 #ifndef NO_LCMS
 void apply_profile (const char *input, const char *output);


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to