Update of /cvsroot/ufraw/ufraw In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8263
Modified Files: dcraw.cc dcraw.h dcraw_api.cc Log Message: dcraw modified 9.20 (1.459). Changelog: Use Little CMS version 2. Support the Kodak 12-megapixel camera(s). Can now use '-M' with a DNG file that embeds a bad color matrix. Improved support for Nokia cameraphones. Support the Alcatel 5235D, Powershot G16 and S120, Pentax K-3, etc. Added tone curve for Canon RMF files. Copied color matrices from DNG Converter 8.3. Support blacklevel patterns up to 64x64. Index: dcraw.cc =================================================================== RCS file: /cvsroot/ufraw/ufraw/dcraw.cc,v retrieving revision 1.307 retrieving revision 1.308 diff -u -d -r1.307 -r1.308 --- dcraw.cc 1 Jan 2014 06:00:22 -0000 1.307 +++ dcraw.cc 17 Jan 2014 13:30:14 -0000 1.308 @@ -1,6 +1,6 @@ /* dcraw.cc - Dave Coffin's raw photo decoder - C++ adaptation - Copyright 1997-2013 by Dave Coffin, dcoffin a cybercom o net + Copyright 1997-2014 by Dave Coffin, dcoffin a cybercom o net Copyright 2004-2014 by Udi Fuchs, udifuchs a gmail o com This program is free software; you can redistribute it and/or modify @@ -22,7 +22,7 @@ #include "uf_progress.h" } -#define DCRAW_VERSION "9.19" +#define DCRAW_VERSION "9.20" #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -157,7 +157,7 @@ gamm[0] = 0.45, gamm[1] = 4.5, gamm[2] = gamm[3] = gamm[4] = gamm[5] = 0; bright=1, user_mul[0] = user_mul[1] = user_mul[2] = user_mul[3] = 0; threshold=0, half_size=0, four_color_rgb=0, document_mode=0, highlight=0; -verbose=0, use_auto_wb=0, use_camera_wb=0, use_camera_matrix=-1; +verbose=0, use_auto_wb=0, use_camera_wb=0, use_camera_matrix=1; output_color=1, output_bps=8, output_tiff=0, med_passes=0, no_auto_bright=0; greybox[0] = greybox[1] = 0, greybox[2] = greybox[3] = UINT_MAX; tone_curve_size = 0, tone_curve_offset = 0; /* Nikon Tone Curves UF*/ @@ -655,7 +655,7 @@ // TODO: The following static variables are not thread-safe static unsigned bitbuf=0; static int vbits=0, reset=0; - int c; + unsigned c; if (nbits > 25) return 0; if (nbits < 0) @@ -1870,10 +1870,10 @@ if ((orow -= 2) < 0) orow += raw_height; } - RAW(orow,ocol) = bits >> (10*c+2) & 0x3ff; + RAW(orow,ocol) = curve[bits >> (10*c+2) & 0x3ff]; } } - maximum = 0x3ff; + maximum = curve[0x3ff]; } unsigned CLASS pana_bits (int nbits) @@ -2083,8 +2083,7 @@ 2,-26, 2,-13, 2,1, 3,-39, 4,16, 5,-55, 6,-76, 6,37 }; ushort huff[19][256]; - unsigned i; - int row, col, tree, nreps, rep, step, j, k, c, s, r, x, y, val; + int row, col, tree, nreps, rep, step, i, j, k, c, s, r, x, y, val; short last[3] = { 16,16,16 }, mul[3], buf[3][3][386]; static const ushort pt[] = { 0,0, 1280,1344, 2320,3616, 3328,8000, 4095,16383, 65535,16383 }; @@ -2093,7 +2092,7 @@ for (c=pt[i-2]; c <= pt[i]; c++) curve[c] = (float) (c-pt[i-2]) / (pt[i]-pt[i-2]) * (pt[i+1]-pt[i-1]) + pt[i-1] + 0.5; - for (s=i=0; i < sizeof src; i+=2) + for (s=i=0; i < (int) sizeof src; i+=2) FORC(256 >> src[i]) huff[0][s++] = src[i] << 8 | (uchar) src[i+1]; s = kodak_cbpp == 243 ? 2 : 3; @@ -2156,7 +2155,7 @@ RAW(y,x) = val; } } - for (i=0; (int) i < height*width; i++) + for (i=0; i < height*width; i++) raw_image[i] = curve[raw_image[i]]; maximum = 0x3fff; } @@ -2481,8 +2480,6 @@ int row, col, len, c, i, rgb[3]; ushort *ip=image[0]; - if (raw_image) free (raw_image); - raw_image = 0; for (row=0; row < height; row++) for (col=0; col < width; col+=256) { len = MIN (256, width-col); @@ -2517,8 +2514,8 @@ for (p=0; p < 127; p++) pad[p] = htonl(pad[p]); } - while (len--) - *data++ ^= pad[p++ & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127]; + while (len-- && p++) + *data++ ^= pad[(p-1) & 127] = pad[p & 127] ^ pad[(p+64) & 127]; } void CLASS sony_load_raw() @@ -2576,7 +2573,7 @@ ushort pix[16]; int row, col, val, max, min, imax, imin, sh, bit, i; - data = (uchar *) malloc (raw_width+1); /* +1 to fix buffer overflow - NKBJ */ + data = (uchar *) malloc (raw_width+1); merror (data, "sony_arw2_load_raw()"); for (row=0; row < height; row++) { fread (data, 1, raw_width, ifp); @@ -2628,6 +2625,9 @@ } } } + for (row=0; row < raw_height-1; row+=2) + for (col=0; col < raw_width-1; col+=2) + SWAP (RAW(row,col+1), RAW(row+1,col)); } #define HOLE(row) ((holes >> (((row) - raw_height) & 7)) & 1) @@ -3078,10 +3078,6 @@ return 1; } -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif float CLASS foveon_avg (short *pix, int range[2], float cfilt) { int i; @@ -3095,9 +3091,6 @@ if (range[1] - range[0] == 1) return sum/2; return (sum - min - max) / (range[1] - range[0] - 1); } -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)) -#pragma GCC diagnostic pop -#endif short * CLASS foveon_make_curve (double max, double mul, double filt) { @@ -3572,11 +3565,11 @@ for (col=0; col < width; col++) BAYER2(row,col) = RAW(row+top_margin,col+left_margin); } - if (mask[0][3]) goto mask_set; + if (mask[0][3] > 0) goto mask_set; if (load_raw == &CLASS canon_load_raw || load_raw == &CLASS lossless_jpeg_load_raw) { - mask[0][1] = mask[1][1] = 2; - mask[0][3] = -2; + mask[0][1] = mask[1][1] += 2; + mask[0][3] -= 2; goto sides; } if (load_raw == &CLASS canon_600_load_raw || @@ -3796,7 +3789,7 @@ out[i][j] += work[j][k+3] * in[i][k]; } -void CLASS cam_xyz_coeff (double cam_xyz[4][3]) +void CLASS cam_xyz_coeff (float rgb_cam[3][4], double cam_xyz[4][3]) { double cam_rgb[4][3], inverse[4][3], num; unsigned i, j, k; @@ -3814,7 +3807,7 @@ pre_mul[i] = 1 / num; } pseudoinverse (cam_rgb, inverse, colors); - for (raw_color = i=0; i < 3; i++) + for (i=0; i < 3; i++) for (j=0; j < colors; j++) rgb_cam[i][j] = inverse[j][i]; } @@ -3873,11 +3866,11 @@ (1 - gmb_xyY[sq][0] - gmb_xyY[sq][1]) / gmb_xyY[sq][1]; } pseudoinverse (gmb_xyz, inverse, NSQ); - for (i=0; i < colors; i++) + 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 (cam_xyz); + cam_xyz_coeff (rgb_cam, cam_xyz); 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]); @@ -4049,10 +4042,17 @@ _("Scaling with darkness %d, saturation %d, and\nmultipliers"), dark, sat); FORC4 dcraw_message(DCRAW_VERBOSE, " %f", pre_mul[c]); dcraw_message(DCRAW_VERBOSE, "\n"); + if (filters > 1000 && (cblack[4]+1)/2 == 1 && (cblack[5]+1)/2 == 1) { + FORC4 cblack[FC(c/2,c%2)] += + cblack[6 + c/2 % cblack[4] * cblack[4] + c%2 % cblack[5]]; + cblack[4] = cblack[5] = 0; + } size = iheight*iwidth; for (i=0; i < size*4; i++) { - val = image[0][i]; - if (!val) continue; + if (!(val = image[0][i])) continue; + if (cblack[4] && cblack[5]) + val -= cblack[6 + i/4 / iwidth % cblack[4] * cblack[4] + + i/4 % iwidth % cblack[5]]; val -= cblack[i & 3]; val *= scale_mul[i & 3]; image[0][i] = CLIP(val); @@ -4963,9 +4963,8 @@ 0xbe,0x57,0x19,0x32,0x7e,0x2a,0xd0,0xb8,0xba,0x29,0x00,0x3c,0x52,0x7d,0xa8,0x49, 0x3b,0x2d,0xeb,0x25,0x49,0xfa,0xa3,0xaa,0x39,0xa7,0xc5,0xa7,0x50,0x11,0x36,0xfb, 0xc6,0x67,0x4a,0xf5,0xa5,0x12,0x65,0x7e,0xb0,0xdf,0xaf,0x4e,0xb3,0x61,0x7f,0x2f } }; - unsigned offset=0, entries, tag, type, len, save; - int c, i; - unsigned ver97=0, serial=0, wbi=0, wb[4]={0,0,0,0}; + unsigned offset=0, entries, tag, type, len, save, c; + unsigned ver97=0, serial=0, i, wbi=0, wb[4]={0,0,0,0}; uchar buf97[324], ci, cj, ck; short morder, sorder=order; char buf[10]; @@ -4982,7 +4981,7 @@ if (!strncmp (buf,"KC" ,2) || /* Konica KD-400Z, KD-510Z */ !strncmp (buf,"MLY" ,3)) { /* Minolta DiMAGE G series */ order = 0x4d4d; - while ((i=ftell(ifp)) < data_offset && i < 16384) { + while ((i=ftell(ifp)) < (unsigned) data_offset && i < 16384) { wb[0] = wb[2]; wb[2] = wb[1]; wb[1] = wb[3]; wb[3] = get2(); if (wb[1] == 256 && wb[3] == 256 && @@ -4997,10 +4996,12 @@ if (get2() != 42) goto quit; offset = get4(); fseek (ifp, offset-8, SEEK_CUR); - } else if (!strcmp (buf,"OLYMPUS")) { + } else if (!strcmp (buf,"OLYMPUS") || + !strcmp (buf,"PENTAX ")) { base = ftell(ifp)-10; fseek (ifp, -2, SEEK_CUR); - order = get2(); get2(); + order = get2(); + if (buf[0] == 'O') get2(); } else if (!strncmp (buf,"SONY",4) || !strcmp (buf,"Panasonic")) { goto nf; @@ -5057,9 +5058,9 @@ if (tag == 0xc && len == 4) FORC3 cam_mul[(c << 1 | c >> 1) & 3] = getreal(type); if (tag == 0xd && type == 7 && get2() == 0xaaaa) { - for (c=i=2; (ushort) c != 0xbbbb && i < (int) len; i++) + for (c=i=2; (ushort) c != 0xbbbb && i < len; i++) c = c << 8 | fgetc(ifp); - while ((i+=4) < (int) len-5) + while ((i+=4) < len-5) if (get4() == 257 && (i=len) && (c = (get4(),fgetc(ifp))) < 3) flip = "065"[c]-'0'; } @@ -5089,7 +5090,7 @@ if (tag == 0x1c) tag = 0x1017; } if (tag == 0x1d) - while ((c = fgetc(ifp)) && c != EOF) + while ((c = fgetc(ifp)) && c != (unsigned) EOF) serial = serial*10 + (isdigit(c) ? c - '0' : c % 10); if (tag == 0x81) { /* NTC UF*/ tone_mode_offset = ftell(ifp); @@ -5341,7 +5342,8 @@ { "","DCB2","Volare","Cantare","CMost","Valeo 6","Valeo 11","Valeo 22", "Valeo 11p","Valeo 17","","Aptus 17","Aptus 22","Aptus 75","Aptus 65", "Aptus 54S","Aptus 65S","Aptus 75S","AFi 5","AFi 6","AFi 7", - "","","","","","","","","","","","","","","","","","AFi-II 12" }; + "Aptus-II 7","","","Aptus-II 6","","","Aptus-II 10","Aptus-II 5", + "","","","","Aptus-II 10R","Aptus-II 8","","Aptus-II 12","","AFi-II 12" }; float romm_cam[3][3]; fseek (ifp, offset, SEEK_SET); @@ -5455,7 +5457,6 @@ { unsigned entries, tag, type, len, plen=16, save, i, j, c; int ifd, use_cm=0, cfa, ima_len=0; - int blrr=1, blrc=1, dblack[] = { 0,0,0,0 }; char software[64], *cbuf, *cp; uchar cfa_pat[16], cfa_pc[] = { 0,1,2,3 }, tab[256]; double cc[4][4], cm[4][3], cam_xyz[4][3], num; @@ -5608,7 +5609,7 @@ data_offset = get4()+base; ifd++; break; } - if(len > 1000) len=1000; /* 1000 SubIFDs is enough */ + if(len > 1000) len = 1000; /* 1000 SubIFDs are enough */ while (len--) { i = ftell(ifp); fseek (ifp, get4()+base, SEEK_SET); @@ -5807,23 +5808,17 @@ linear_table (len); break; case 50713: /* BlackLevelRepeatDim */ - blrr = get2(); - blrc = get2(); + cblack[4] = get2(); + cblack[5] = get2(); + if ((unsigned)(cblack[4] * cblack[5]) > sizeof cblack / sizeof *cblack - 6) + cblack[4] = cblack[5] = 1; break; case 61450: - blrr = blrc = 2; + cblack[4] = cblack[5] = MIN(sqrt(len),64); if (filters == UINT_MAX) filters = 0x94949494; case 50714: /* BlackLevel */ - black = getreal(type); - if ((unsigned)(filters+1) < 1000) break; - dblack[0] = black; - dblack[1] = (blrc == 2) ? getreal(type):dblack[0]; - dblack[2] = (blrr == 2) ? getreal(type):dblack[0]; - dblack[3] = (blrc == 2 && blrr == 2) ? getreal(type):dblack[1]; - if (colors == 3) - filters |= ((filters >> 2 & 0x22222222) | - (filters << 2 & 0x88888888)) & filters << 1; - FORC4 cblack[filters >> (c << 1) & 3] = dblack[c]; + FORC ((unsigned)(cblack[4] * cblack[5])) + cblack[6+c] = getreal(type); black = 0; break; case 50715: /* BlackLevelDeltaH */ @@ -5919,7 +5914,7 @@ FORCC for (i=0; i < 3; i++) for (cam_xyz[c][i]=j=0; j < colors; j++) cam_xyz[c][i] += cc[c][j] * cm[j][i] * xyz[i]; - cam_xyz_coeff (cam_xyz); + cam_xyz_coeff (cmatrix, cam_xyz); } if (asn[0]) { cam_mul[3] = 0; @@ -5969,9 +5964,9 @@ max_samp = tiff_ifd[i].samples; if (max_samp > 3) max_samp = 3; if ((tiff_ifd[i].comp != 6 || tiff_ifd[i].samples != 3) && - (tiff_ifd[i].width | tiff_ifd[i].height) < 0x10000 && - (unsigned)tiff_ifd[i].bps < 33 && (unsigned)tiff_ifd[i].samples < 13 && - tiff_ifd[i].width*tiff_ifd[i].height > raw_width*raw_height) { + (tiff_ifd[i].width | tiff_ifd[i].height) < 0x10000 && + (unsigned)tiff_ifd[i].bps < 33 && (unsigned)tiff_ifd[i].samples < 13 && + tiff_ifd[i].width*tiff_ifd[i].height > raw_width*raw_height) { raw_width = tiff_ifd[i].width; raw_height = tiff_ifd[i].height; tiff_bps = tiff_ifd[i].bps; @@ -6057,10 +6052,10 @@ is_raw = 0; for (i=0; i < tiff_nifds; i++) if ((int) i != raw && tiff_ifd[i].samples == max_samp && - tiff_ifd[i].bps > 0 && tiff_ifd[i].bps < 33 && - ((unsigned)(tiff_ifd[i].width | tiff_ifd[i].height)) < 0x10000 && + tiff_ifd[i].bps > 0 && tiff_ifd[i].bps < 33 && + ((unsigned)(tiff_ifd[i].width | tiff_ifd[i].height)) < 0x10000 && tiff_ifd[i].width * tiff_ifd[i].height / (SQR(tiff_ifd[i].bps)+1) > - (int)(thumb_width * thumb_height / (SQR(thumb_misc)+1)) + (int)(thumb_width * thumb_height / (SQR(thumb_misc)+1)) && tiff_ifd[i].comp != 34892) { thumb_width = tiff_ifd[i].width; thumb_height = tiff_ifd[i].height; @@ -6639,7 +6634,7 @@ dcraw_message (DCRAW_WARNING, _("%s: Tail is missing, parsing from head...\n"), ifname_display); fseek (ifp, 0, SEEK_SET); - while ((len = get4()) != (unsigned) EOF) { + while ((len = get4()) != EOF) { if (get4() == 0x52454456) if (is_raw++ == shot_select) #ifdef HAVE_FSEEKO @@ -6809,7 +6804,7 @@ { 4920,616,-593,-6493,13964,2784,-1774,3178,7005 } }, { "Canon EOS 60D", 0, 0x2ff7, { 6719,-994,-925,-4408,12426,2211,-887,2129,6051 } }, - { "Canon EOS 70D", 0, 0x3a98, /* Darktable */ + { "Canon EOS 70D", 0, 0x3bc7, { 7034,-804,-1014,-4420,12564,2058,-851,1994,5758 } }, { "Canon EOS 100D", 0, 0x350f, { 6602,-841,-939,-4472,12458,2247,-975,2039,6148 } }, @@ -6857,6 +6852,8 @@ { 6847,-614,-1014,-4669,12737,2139,-1197,2488,6846 } }, { "Canon EOS-1D", 0, 0xe20, { 6806,-179,-1020,-8097,16415,1687,-3267,4236,7690 } }, + { "Canon EOS C500", 853, 0, /* DJC */ + { 17851,-10604,922,-7425,16662,763,-3660,3636,22278 } }, { "Canon PowerShot A530", 0, 0, { 0 } }, /* don't want the A5 matrix */ { "Canon PowerShot A50", 0, 0, @@ -6871,7 +6868,7 @@ { 13244,-5501,-1248,-1508,9858,1935,-270,1083,4366 } }, { "Canon PowerShot G15", 0, 0, { 7474,-2301,-567,-4056,11456,2975,-222,716,4181 } }, - { "Canon PowerShot G16", 0, 0, /* Darktable */ + { "Canon PowerShot G16", 0, 0, { 8020,-2687,-682,-3704,11879,2052,-965,1921,5556 } }, { "Canon PowerShot G1 X", 0, 0, { 7378,-1255,-1043,-4088,12251,2048,-876,1946,5805 } }, @@ -6913,6 +6910,8 @@ { 7968,-2565,-636,-2873,10697,2513,180,667,4211 } }, { "Canon PowerShot S110", 0, 0, { 8039,-2643,-654,-3783,11230,2930,-206,690,4194 } }, + { "Canon PowerShot S120", 0, 0, + { 6961,-1685,-695,-4625,12945,1836,-1114,2152,5518 } }, { "Canon PowerShot SX1 IS", 0, 0, { 6578,-259,-502,-5974,13030,3309,-308,1058,4970 } }, { "Canon PowerShot SX50 HS", 0, 0, @@ -6971,10 +6970,10 @@ { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm S100FS", 514, 0, { 11521,-4355,-1065,-6524,13767,3058,-1466,1984,6045 } }, - { "Fujifilm S200EXR", 512, 0x3fff, - { 11401,-4498,-1312,-5088,12751,2613,-838,1568,5941 } }, { "Fujifilm S20Pro", 0, 0, { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } }, + { "Fujifilm S20", 512, 0x3fff, + { 11401,-4498,-1312,-5088,12751,2613,-838,1568,5941 } }, { "Fujifilm S2Pro", 128, 0, { 12492,-4690,-1402,-7033,15423,1647,-1507,2111,7697 } }, { "Fujifilm S3Pro", 0, 0, @@ -7011,12 +7010,14 @@ { 12300,-5110,-1304,-9117,17143,1998,-1947,2448,8100 } }, { "Fujifilm HS10 HS11", 0, 0xf68, { 12440,-3954,-1183,-1123,9674,1708,-83,1614,4086 } }, - { "Fujifilm HS20EXR", 0, 0, + { "Fujifilm HS2", 0, 0, { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm HS3", 0, 0, { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "Fujifilm HS50EXR", 0, 0, { 12085,-4727,-953,-3257,11489,2002,-511,2046,4592 } }, + { "Fujifilm F900EXR", 0, 0, + { 12085,-4727,-953,-3257,11489,2002,-511,2046,4592 } }, { "Fujifilm X100S", 0, 0, { 10592,-4262,-1008,-3514,11355,2465,-870,2025,6386 } }, { "Fujifilm X100", 0, 0, @@ -7027,12 +7028,20 @@ { 11768,-4971,-1133,-4904,12927,2183,-480,1723,4605 } }, { "Fujifilm X-Pro1", 0, 0, { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, + { "Fujifilm X-A1", 0, 0, + { 11086,-4555,-839,-3512,11310,2517,-815,1341,5940 } }, { "Fujifilm X-E1", 0, 0, { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, - { "Fujifilm XF1", 0, 0, - { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { "Fujifilm X-E2", 0, 0, + { 8458,-2451,-855,-4597,12447,2407,-1475,2482,6526 } }, + { "Fujifilm X-M1", 0, 0, + { 10413,-3996,-993,-3721,11640,2361,-733,1540,6011 } }, { "Fujifilm X-S1", 0, 0, { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { "Fujifilm XF1", 0, 0, + { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, + { "Fujifilm XQ1", 0, 0, + { 9252,-2704,-1064,-5893,14265,1717,-1101,2341,4349 } }, { "Imacon Ixpress", 0, 0, /* DJC */ { 7025,-1415,-704,-5188,13765,1424,-1248,2742,6038 } }, { "Kodak NC2000", 0, 0, @@ -7157,18 +7166,22 @@ { 6992,-1668,-806,-8138,15748,2543,-874,850,7897 } }, { "Nikon D4", 0, 0, { 8598,-2848,-857,-5618,13606,2195,-1002,1773,7137 } }, + { "Nikon Df", 0, 0, + { 8598,-2848,-857,-5618,13606,2195,-1002,1773,7137 } }, { "Nikon D5000", 0, 0xf00, { 7309,-1403,-519,-8474,16008,2622,-2433,2826,8064 } }, { "Nikon D5100", 0, 0x3de6, { 8198,-2239,-724,-4871,12389,2798,-1043,2050,7181 } }, { "Nikon D5200", 0, 0, { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, - { "Nikon D5300", 0, 0x3e14, /* Darktable */ - { 8322,-3112,-1047,-6367,14342,2179,-988,1638,6394 } }, + { "Nikon D5300", 600, 0, + { 6988,-1384,-714,-5631,13410,2447,-1485,2204,7318 } }, { "Nikon D50", 0, 0, { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, { "Nikon D600", 0, 0x3e07, { 8178,-2245,-609,-4857,12394,2776,-1207,2086,7298 } }, + { "Nikon D610", 0, 0, + { 8178,-2245,-609,-4857,12394,2776,-1207,2086,7298 } }, { "Nikon D60", 0, 0, { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, { "Nikon D7000", 0, 0, @@ -7227,14 +7240,14 @@ { 11053,-4269,-1024,-1976,10182,2088,-526,1263,4469 } }, { "Nikon COOLPIX P7700", 200, 0, { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, - { "Nikon COOLPIX P7800", 200, 0, /* copied from P7700 - Darktable */ + { "Nikon COOLPIX P7800", 200, 0, { 10321,-3920,-931,-2750,11146,1824,-442,1545,5539 } }, - { "Nikon 1 AW1", 0, 0, /* Darktable */ - { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, { "Nikon 1 V2", 0, 0, { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, { "Nikon 1 J3", 0, 0, { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, + { "Nikon 1 AW1", 0, 0, + { 6588,-1305,-693,-3277,10987,2634,-355,2016,5106 } }, { "Nikon 1 ", 0, 0, { 8994,-2667,-865,-4594,12324,2552,-699,1786,6260 } }, { "Olympus C5050", 0, 0, @@ -7287,7 +7300,7 @@ { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, { "Olympus E-P3", 0, 0, { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, - { "Olympus E-P5", 0, 0, /* Darktable */ + { "Olympus E-P5", 0, 0, { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, { "Olympus E-PL1s", 0, 0, { 11409,-3872,-1393,-4572,12757,2003,-709,1810,7415 } }, @@ -7299,10 +7312,14 @@ { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "Olympus E-PL5", 0, 0xfcb, { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-PL6", 0, 0, + { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, { "Olympus E-PM1", 0, 0, { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "Olympus E-PM2", 0, 0, { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, + { "Olympus E-M1", 0, 0, + { 7687,-1984,-606,-4327,11928,2721,-1381,2339,6452 } }, { "Olympus E-M5", 0, 0xfe1, { 8380,-2630,-639,-2887,10725,2496,-627,1427,5438 } }, { "Olympus SP350", 0, 0, @@ -7319,6 +7336,8 @@ { 10915,-3677,-982,-5587,12986,2911,-1168,1968,6223 } }, { "Olympus SP570UZ", 0, 0, { 11522,-4044,-1146,-4736,12172,2904,-988,1829,6039 } }, + { "Olympus STYLUS1", 0, 0, + { 8360,-2420,-880,-3928,12353,1739,-1381,2416,5173 } }, { "Olympus XZ-10", 0, 0, { 9777,-3483,-925,-2886,11297,1800,-602,1663,5134 } }, { "Olympus XZ-1", 0, 0, @@ -7353,6 +7372,8 @@ { 8843,-2837,-625,-5025,12644,2668,-411,1234,7410 } }, { "Pentax K-r", 0, 0, { 9895,-3077,-850,-5304,13035,2521,-883,1768,6936 } }, + { "Pentax K-3", 0, 0, + { 7415,-2052,-721,-5186,12788,2682,-1446,2157,6773 } }, { "Pentax K-5 II", 0, 0, { 8170,-2725,-639,-4440,12017,2744,-771,1465,6599 } }, { "Pentax K-5", 0, 0, @@ -7375,6 +7396,8 @@ { 13639,-5535,-1371,-1698,9633,2430,316,1152,4108 } }, { "Panasonic DMC-FZ50", 0, 0, { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, + { "Panasonic DMC-FZ7", 144, 0, + { 11532,-4324,-1066,-2375,10847,1749,-564,1699,4351 } }, { "Leica V-LUX1", 0, 0, { 7906,-2709,-594,-6231,13351,3220,-1922,2631,6537 } }, { "Panasonic DMC-L10", 15, 0xf96, @@ -7387,6 +7410,10 @@ { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, { "Leica DIGILUX 2", 0, 0, { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } }, + { "Panasonic DMC-LF1", 143, 0, + { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, + { "Leica C (Typ 112)", 143, 0, + { 9379,-3267,-816,-3227,11560,1881,-926,1928,5340 } }, { "Panasonic DMC-LX1", 0, 0xf7f, { 10704,-4187,-1230,-8314,15952,2501,-920,945,8927 } }, { "Leica D-LUX2", 0, 0xf7f, @@ -7431,8 +7458,8 @@ { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, { "Panasonic DMC-G5", 143, 0xfff, { 7798,-2562,-740,-3879,11584,2613,-1055,2248,5434 } }, - { "Panasonic DMC-G6", 143, 0xfff, /* DJC */ - { 6395,-2583,-40,-3677,9109,4569,-1502,2806,6431 } }, + { "Panasonic DMC-G6", 142, 0xfff, + { 8294,-2891,-651,-3869,11590,2595,-1183,2267,5352 } }, { "Panasonic DMC-GF1", 15, 0xf92, { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, { "Panasonic DMC-GF2", 143, 0xfff, @@ -7449,9 +7476,11 @@ { 7780,-2410,-806,-3913,11724,2484,-1018,2390,5298 } }, { "Panasonic DMC-GH3", 144, 0, { 6559,-1752,-491,-3672,11407,2586,-962,1875,5130 } }, + { "Panasonic DMC-GM1", 143, 0, + { 6770,-1895,-744,-5232,13145,2303,-1664,2691,5703 } }, { "Panasonic DMC-GX1", 143, 0, { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, - { "Panasonic DMC-GX7", 150, 0, /* Darktable */ + { "Panasonic DMC-GX7", 143, 0, { 7610,-2780,-576,-4614,12195,2733,-1375,2393,6490 } }, { "Phase One H 20", 0, 0, /* DJC */ { 1313,1855,-109,-6715,15908,808,-327,1840,6020 } }, @@ -7473,7 +7502,7 @@ { 8898,-2498,-994,-3144,11328,2066,-760,1381,4576 } }, { "Samsung EX2F", 0, 0x7ff, { 10648,-3897,-1055,-2022,10573,1668,-492,1611,4742 } }, - { "Samsung EK-GN120", 0, 0, /* Samsung Galaxy NX - Darktable */ + { "Samsung EK-GN120", 0, 0, { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, { "Samsung NX300", 0, 0, { 7557,-2522,-739,-4679,12949,1894,-840,1777,5311 } }, @@ -7491,6 +7520,8 @@ { 12093,-3557,-1155,-1000,9534,1733,-22,1787,4576 } }, { "Samsung GX-1", 0, 0, { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, + { "Samsung GX20", 0, 0, /* copied from Pentax K20D */ + { 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } }, { "Samsung S85", 0, 0, /* DJC */ { 11885,-3968,-1473,-4214,12299,1916,-835,1655,5549 } }, { "Sinar", 0, 0, /* DJC */ @@ -7501,8 +7532,12 @@ { 8512,-2641,-694,-8042,15670,2526,-1821,2117,7414 } }, { "Sony DSC-V3", 0, 0, { 7511,-2571,-692,-7894,15088,3060,-948,1111,8128 } }, + { "Sony DSC-RX100M2", 200, 0, + { 6596,-2079,-562,-4782,13016,1933,-970,1581,5181 } }, { "Sony DSC-RX100", 200, 0, { 8651,-2754,-1057,-3464,12207,1373,-568,1398,4434 } }, + { "Sony DSC-RX10", 200, 0, + { 6679,-1825,-745,-5047,13256,1953,-1580,2422,5183 } }, { "Sony DSC-RX1", 128, 0, { 6344,-1612,-462,-4863,12477,2681,-865,1786,6899 } }, { "Sony DSLR-A100", 0, 0xfeb, @@ -7533,11 +7568,17 @@ { 5413,-1162,-365,-5665,13098,2866,-608,1179,8440 } }, { "Sony DSLR-A900", 128, 0, { 5209,-1072,-397,-8845,16120,2919,-1618,1803,8654 } }, + { "Sony ILCE-7R", 128, 0, + { 4913,-541,-202,-6130,13513,2906,-1564,2151,7183 } }, + { "Sony ILCE-7", 128, 0, + { 5271,-712,-347,-6153,13653,2763,-1601,2366,7242 } }, + { "Sony ILCE-3000", 128, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, { "Sony NEX-5N", 128, 0, { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, { "Sony NEX-5R", 128, 0, { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, - { "Sony NEX-5T", 128, 0, /* Darktable */ + { "Sony NEX-5T", 128, 0, { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, { "Sony NEX-3N", 128, 0, { 6129,-1545,-418,-4930,12490,2743,-977,1693,6615 } }, @@ -7576,8 +7617,7 @@ }; double cam_xyz[4][3]; char name[130]; - unsigned i; - int j, k; + unsigned i, j, k; sprintf (name, "%s %s", make, model); for (i=0; i < sizeof table / sizeof *table; i++) @@ -7585,10 +7625,10 @@ if (table[i].black) black = (ushort) table[i].black; if (table[i].maximum) maximum = (ushort) table[i].maximum; if (table[i].trans[0]) { - 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); + 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 (rgb_cam, cam_xyz); } break; } @@ -7689,13 +7729,13 @@ { 4508, 2962, 0, 0, -3, -4 }, { 4508, 3330, 0, 0, -3, -6 }, }; - static const ushort canon[][6] = { + static const ushort canon[][11] = { { 1944, 1416, 0, 0, 48, 0 }, - { 2144, 1560, 4, 8, 52, 2 }, + { 2144, 1560, 4, 8, 52, 2, 0, 0, 0, 25 }, { 2224, 1456, 48, 6, 0, 2 }, { 2376, 1728, 12, 6, 52, 2 }, { 2672, 1968, 12, 6, 44, 2 }, - { 3152, 2068, 64, 12, 0, 0 }, + { 3152, 2068, 64, 12, 0, 0, 16 }, { 3160, 2344, 44, 12, 4, 4 }, { 3344, 2484, 4, 6, 52, 6 }, { 3516, 2328, 42, 14, 0, 0 }, @@ -7703,17 +7743,17 @@ { 3744, 2784, 52, 12, 8, 12 }, { 3944, 2622, 30, 18, 6, 2 }, { 3948, 2622, 42, 18, 0, 2 }, - { 3984, 2622, 76, 20, 0, 2 }, + { 3984, 2622, 76, 20, 0, 2, 14 }, { 4104, 3048, 48, 12, 24, 12 }, { 4116, 2178, 4, 2, 0, 0 }, { 4152, 2772, 192, 12, 0, 0 }, { 4160, 3124, 104, 11, 8, 65 }, - { 4176, 3062, 96, 17, 8, 0 }, - { 4192, 3062, 96, 18, 24, 0 }, /* NKBJ */ + { 4176, 3062, 96, 17, 8, 0, 0, 16, 0, 7, 0x49 }, + { 4192, 3062, 96, 17, 24, 0, 0, 16, 0, 0, 0x49 }, { 4312, 2876, 22, 18, 0, 2 }, { 4352, 2874, 62, 18, 0, 0 }, { 4476, 2954, 90, 34, 0, 0 }, - { 4480, 3348, 12, 10, 36, 12 }, + { 4480, 3348, 12, 10, 36, 12, 0, 0, 0, 18, 0x49 }, { 4496, 3366, 80, 50, 12, 0 }, { 4832, 3204, 62, 26, 0, 0 }, { 4832, 3228, 62, 51, 0, 0 }, @@ -7738,6 +7778,7 @@ { 0x190, "EOS 40D" }, { 0x169, "EOS-1D Mark III" }, { 0x261, "EOS 50D" }, { 0x281, "EOS-1D Mark IV" }, { 0x287, "EOS 60D" }, { 0x167, "EOS-1DS" }, + { 0x325, "EOS 70D" }, { 0x170, "EOS 300D" }, { 0x188, "EOS-1Ds Mark II" }, { 0x176, "EOS 450D" }, { 0x215, "EOS-1Ds Mark III" }, { 0x189, "EOS 350D" }, { 0x324, "EOS-1D C" }, @@ -7767,6 +7808,7 @@ { 10134620,2588,1958, 0, 0, 0, 0, 9,0x94,0,0,"AVT","F-510C",12 }, { 16157136,3272,2469, 0, 0, 0, 0, 9,0x94,0,0,"AVT","F-810C",0 }, { 15980544,3264,2448, 0, 0, 0, 0, 8,0x61,0,1,"AgfaPhoto","DC-833m",0 }, + { 9631728,2532,1902, 0, 0, 0, 0,96,0x61,0,0,"Alcatel","5035D",0 }, { 2868726,1384,1036, 0, 0, 0, 0,64,0x49,0,8,"Baumer","TXG14",1078 }, { 5298000,2400,1766,12,12,44, 2,40,0x94,0,2,"Canon","PowerShot SD300",0 }, { 6553440,2664,1968, 4, 4,44, 4,40,0x94,0,2,"Canon","PowerShot A460",0 }, @@ -7782,7 +7824,7 @@ { 15467760,3720,2772, 6,12,30, 0,40,0x94,0,2,"Canon","PowerShot SX110 IS",0 }, { 15534576,3728,2778,12, 9,44, 9,40,0x94,0,2,"Canon","PowerShot SX120 IS",0 }, { 18653760,4080,3048,24,12,24,12,40,0x94,0,2,"Canon","PowerShot SX20 IS",0 }, - { 19131120,4168,3060,92,16, 4, 1, 8,0x94,0,2,"Canon","PowerShot SX220 HS",0 }, + { 19131120,4168,3060,92,16, 4, 1,40,0x94,0,2,"Canon","PowerShot SX220 HS",0 }, { 21936096,4464,3276,25,10,73,12,40,0x16,0,2,"Canon","PowerShot SX30 IS",0 }, { 24724224,4704,3504, 8,16,56, 8,40,0x94,0,2,"Canon","PowerShot A3300 IS",0 }, { 1976352,1632,1211, 0, 2, 0, 1, 0,0x94,0,1,"Casio","QV-2000UX",0 }, @@ -7807,6 +7849,8 @@ { 18702336,4096,3044, 0, 0,24, 0,80,0x94,7,1,"Casio","EX-ZR100",0 }, { 7684000,2260,1700, 0, 0, 0, 0,13,0x94,0,1,"Casio","QV-4000",0 }, { 787456,1024, 769, 0, 1, 0, 0, 0,0x49,0,0,"Creative","PC-CAM 600",0 }, + { 28829184,4384,3288, 0, 0, 0, 0,36,0x61,0,0,"DJI","",0 }, + { 15151104,4608,3288, 0, 0, 0, 0, 0,0x94,0,0,"Matrix","",0 }, { 3840000,1600,1200, 0, 0, 0, 0,65,0x49,0,0,"Foculus","531C",0 }, { 307200, 640, 480, 0, 0, 0, 0, 0,0x94,0,0,"Generic","640x480",0 }, { 62464, 256, 244, 1, 1, 6, 1, 0,0x8d,0,0,"Kodak","DC20",0 }, @@ -7818,6 +7862,9 @@ { 6166488,2864,2152, 0, 0, 0, 0, 0,0x94,0,0,"Kodak","C603",3160 }, { 460800, 640, 480, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","C603",0 }, { 9116448,2848,2134, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","C603",0 }, + { 12241200,4040,3030, 2, 0, 0,13, 0,0x49,0,0,"Kodak","12MP",0 }, + { 12272756,4040,3030, 2, 0, 0,13, 0,0x49,0,0,"Kodak","12MP",31556 }, + { 18000000,4000,3000, 0, 0, 0, 0, 0,0x00,0,0,"Kodak","12MP",0 }, { 614400, 640, 480, 0, 3, 0, 0,64,0x94,0,0,"Kodak","KAI-0340",0 }, { 3884928,1608,1207, 0, 0, 0, 0,96,0x16,0,0,"Micron","2010",3212 }, { 1138688,1534, 986, 0, 0, 0, 0, 0,0x61,0,0,"Minolta","RD175",513 }, @@ -7962,15 +8009,18 @@ filters = 0x61616161; } else if (!memcmp (head,"NOKIARAW",8)) { strcpy (make, "NOKIA"); - strcpy (model, "X2"); order = 0x4949; fseek (ifp, 300, SEEK_SET); data_offset = get4(); i = get4(); width = get2(); height = get2(); - data_offset += i - width * 5 / 4 * height; - load_raw = &CLASS nokia_load_raw; + switch (tiff_bps = i*8 / (width * height)) { + case 8: load_raw = &CLASS eight_bit_load_raw; break; + case 10: load_raw = &CLASS nokia_load_raw; + } + raw_height = height + (top_margin = i / (width * tiff_bps/8) - height); + mask[0][3] = 1; filters = 0x61616161; } else if (!memcmp (head,"ARRI",4)) { order = 0x4949; @@ -7994,6 +8044,7 @@ fread (model, 1, 30, ifp); data_offset = 0x10000; load_raw = &CLASS canon_rmf_load_raw; + gamma_curve (0, 12.25, 1, 1023); } else if (!memcmp (head+4,"RED1",4)) { strcpy (make, "Red"); strcpy (model,"One"); @@ -8033,7 +8084,7 @@ switch (tiff_bps = (fsize-data_offset)*8 / (raw_width*raw_height)) { case 6: load_raw = &CLASS minolta_rd175_load_raw; break; - case 8: + case 8: load_raw = &CLASS eight_bit_load_raw; break; case 10: case 12: load_flags |= 128; @@ -8068,6 +8119,8 @@ ((cp = strcasestr(model," DIGITAL CAMERA")) || (cp = strstr(model,"FILE VERSION")))) *cp = 0; + if (!strncasecmp(model,"PENTAX",6)) + strcpy (make, "Pentax"); cp = make + strlen(make); /* Remove trailing spaces */ while (*--cp == ' ') *cp = 0; cp = model + strlen(model); @@ -8094,6 +8147,8 @@ { left_margin = 10; width = 4950; filters = 0x16161616; } if (width == 4736 && !strcmp(model,"K-7")) { height = 3122; width = 4684; filters = 0x16161616; top_margin = 2; } + if (width == 6080 && !strcmp(model,"K-3")) + { left_margin = 4; width = 6040; } if (width == 7424 && !strcmp(model,"645D")) { height = 5502; width = 7328; filters = 0x61616161; top_margin = 29; left_margin = 48; } @@ -8120,6 +8175,11 @@ height = raw_height - (top_margin = canon[i][3]); width -= canon[i][4]; height -= canon[i][5]; + mask[0][1] = canon[i][6]; + mask[0][3] = -canon[i][7]; + mask[1][1] = canon[i][8]; + mask[1][3] = -canon[i][9]; + if (canon[i][10]) filters = canon[i][10] * 0x01010101; } if ((unique_id | 0x20000) == 0x2720000) { left_margin = 8; @@ -8195,16 +8255,7 @@ } else if (!strcmp(model,"PowerShot A610")) { if (canon_s2is()) strcpy (model+10, "S2 IS"); } else if (!strcmp(model,"PowerShot SX220 HS")) { - mask[0][0] = top_margin = 16; - mask[0][2] = top_margin + height; - mask[0][3] = left_margin = 92; - } else if (!strcmp(model,"PowerShot SX50 HS")) { - mask[0][0] = top_margin = 17; - mask[0][2] = raw_height; - mask[0][3] = 80; - filters = 0x49494949; - } else if (!strcmp(model,"PowerShot G10")) { - filters = 0x49494949; + mask[1][3] = -4; } else if (!strcmp(model,"EOS D2000C")) { filters = 0x61616161; black = curve[200]; @@ -8239,7 +8290,8 @@ !strcmp(model,"D600") || !strncmp(model,"D800",4)) { width -= 46; - } else if (!strcmp(model,"D4")) { + } else if (!strcmp(model,"D4") || + !strcmp(model,"Df")) { width -= 52; left_margin = 2; } else if (!strncmp(model,"D40",3) || @@ -8343,7 +8395,8 @@ if (width == 4032 || width == 4952) left_margin = 0; if (width == 3328 && (width -= 66)) left_margin = 34; if (width == 4936) left_margin = 4; - if (!strcmp(model,"HS50EXR")) { + if (!strcmp(model,"HS50EXR") || + !strcmp(model,"F900EXR")) { width += 2; left_margin = 0; filters = 0x16161616; @@ -8402,7 +8455,8 @@ } else if (!strcmp(make,"Samsung") && raw_height == 3714) { height -= 18; width = 5536; - filters = 0x49494949; + filters = 0x61616161; + colors = 3; } else if (!strcmp(make,"Samsung") && raw_width == 5632) { order = 0x4949; height = 3694; @@ -8607,10 +8661,11 @@ height -= top_margin = 4; width -= left_margin = 32; gamma_curve (0, 7, 1, 255); - } else if (!strcmp(model,"C603") || !strcmp(model,"C330")) { + } else if (!strcmp(model,"C603") || !strcmp(model,"C330") + || !strcmp(model,"12MP")) { order = 0x4949; if (filters && data_offset) { - fseek (ifp, 168, SEEK_SET); + fseek (ifp, data_offset < 4096 ? 168 : 5252, SEEK_SET); read_shorts (curve, 256); } else gamma_curve (0, 3.875, 1, 255); load_raw = filters ? &CLASS eight_bit_load_raw @@ -8738,9 +8793,6 @@ if (!model[0]) sprintf (model, "%dx%d", width, height); if (filters == UINT_MAX) filters = 0x94949494; - if (raw_color) adobe_coeff (make, model); - if (load_raw == &CLASS kodak_radc_load_raw) - if (raw_color) adobe_coeff ("Apple","Quicktake"); if (thumb_offset && !thumb_height) { fseek (ifp, thumb_offset, SEEK_SET); if (ljpeg_start (&jh, 1)) { @@ -8749,6 +8801,14 @@ } } dng_skip: + if ((use_camera_matrix & (use_camera_wb || dng_version)) + && cmatrix[0][0] > 0.125) { + memcpy (rgb_cam, cmatrix, sizeof cmatrix); + raw_color = 0; + } + if (raw_color) adobe_coeff (make, model); + if (load_raw == &CLASS kodak_radc_load_raw) + if (raw_color) adobe_coeff ("Apple","Quicktake"); if (fuji_width) { fuji_width = width >> !fuji_layout; if (~fuji_width & 1) filters = 0x49494949; @@ -8872,7 +8932,7 @@ quit: cmsCloseProfile (hInProfile); } -#endif /* !NO_LCMS */ +#endif void CLASS convert_to_rgb() { @@ -9367,7 +9427,7 @@ case 'p': cam_profile = argv[arg++]; #endif break; - case 'P': bpfile = const_cast<char *>(argv[arg++]); break; + case 'P': bpfile = argv[arg++]; break; case 'K': dark_frame = argv[arg++]; break; case 'z': timestamp_only = 1; break; case 'e': thumbnail_only = 1; break; @@ -9379,7 +9439,7 @@ case 'A': FORC4 greybox[c] = atoi(argv[arg++]); case 'a': use_auto_wb = 1; break; case 'w': use_camera_wb = 1; break; - case 'M': use_camera_matrix = (opm == '+'); break; + case 'M': use_camera_matrix = 3 * (opm == '+'); break; case 'I': read_from_stdin = 1; break; case 'E': document_mode++; case 'D': document_mode++; @@ -9395,8 +9455,6 @@ return 1; } } - if (use_camera_matrix < 0) - use_camera_matrix = use_camera_wb; if (arg == argc) { dcraw_message (DCRAW_ERROR,_("No files to process.\n")); return 1; @@ -9463,6 +9521,7 @@ height = thumb_height; width = thumb_width; filters = 0; + colors = 3; } else { fseek (ifp, thumb_offset, SEEK_SET); write_fun = write_thumb; @@ -9547,10 +9606,6 @@ fclose(ifp); continue; } - if (use_camera_matrix && cmatrix[0][0] > 0.25) { - memcpy (rgb_cam, cmatrix, sizeof cmatrix); - raw_color = 0; - } if (meta_length) { meta_data = (char *) malloc (meta_length); merror (meta_data, "main()"); @@ -9594,9 +9649,15 @@ quality = 2 + !fuji_width; if (user_qual >= 0) quality = user_qual; i = cblack[3]; - FORC3 if (i > (int) cblack[c]) i = cblack[c]; + FORC3 if (i > cblack[c]) i = cblack[c]; FORC4 cblack[c] -= i; black += i; + i = cblack[6]; + FORC ((unsigned)(cblack[4] * cblack[5])) + if (i > cblack[6+c]) i = cblack[6+c]; + FORC ((unsigned)(cblack[4] * cblack[5])) + cblack[6+c] -= i; + black += i; if (user_black >= 0) black = user_black; FORC4 cblack[c] += black; if (user_sat > 0) maximum = user_sat; Index: dcraw.h =================================================================== RCS file: /cvsroot/ufraw/ufraw/dcraw.h,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- dcraw.h 1 Jan 2014 06:00:22 -0000 1.78 +++ dcraw.h 17 Jan 2014 13:30:14 -0000 1.79 @@ -1,6 +1,6 @@ /* dcraw.h - Dave Coffin's raw photo decoder - header for C++ adaptation - Copyright 1997-2013 by Dave Coffin, dcoffin a cybercom o net + Copyright 1997-2014 by Dave Coffin, dcoffin a cybercom o net Copyright 2004-2014 by Udi Fuchs, udifuchs a gmail o com This program is free software; you can redistribute it and/or modify @@ -53,13 +53,13 @@ unsigned thumb_length, meta_length, profile_length; unsigned thumb_misc, *oprof, fuji_layout, shot_select, multi_out; unsigned tiff_nifds, tiff_samples, tiff_bps, tiff_compress; - unsigned black, cblack[4], maximum, mix_green, raw_color, zero_is_bad; + unsigned black, maximum, mix_green, raw_color, zero_is_bad; unsigned zero_after_ff, is_raw, dng_version, is_foveon, data_error; unsigned tile_width, tile_length, gpsdata[32], load_flags; unsigned flip, tiff_flip, filters, colors; ushort raw_height, raw_width, height, width, top_margin, left_margin; ushort shrink, iheight, iwidth, fuji_width, thumb_width, thumb_height; - ushort *raw_image, (*image)[4]; + ushort *raw_image, (*image)[4], cblack[4102]; ushort white[8][8], curve[0x10000], cr2_slice[3], sraw_mul[4]; double pixel_aspect, aber[4], gamm[6]; float bright, user_mul[4], threshold; @@ -225,7 +225,7 @@ void subtract(const char *fname); void gamma_curve(double pwr, double ts, int mode, int imax); void pseudoinverse(double(*in)[3], double(*out)[3], int size); - void cam_xyz_coeff(double cam_xyz[4][3]); + void cam_xyz_coeff(float rgb_cam[3][4], double cam_xyz[4][3]); void colorcheck(); void hat_transform(float *temp, float *base, int st, int size, int sc); void wavelet_denoise(); Index: dcraw_api.cc =================================================================== RCS file: /cvsroot/ufraw/ufraw/dcraw_api.cc,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -r1.94 -r1.95 --- dcraw_api.cc 1 Jan 2014 06:00:22 -0000 1.94 +++ dcraw_api.cc 17 Jan 2014 13:30:14 -0000 1.95 @@ -145,6 +145,12 @@ FORC3 if ((unsigned)i > d->cblack[c]) i = d->cblack[c]; FORC4 d->cblack[c] -= i; d->black += i; + i = d->cblack[6]; + FORC(d->cblack[4] * d->cblack[5]) + if (i > d->cblack[6 + c]) i = d->cblack[6 + c]; + FORC(d->cblack[4] * d->cblack[5]) + d->cblack[6 + c] -= i; + d->black += i; h->black = d->black; h->shrink = d->shrink = (h->filters != 0); h->pixel_aspect = d->pixel_aspect; @@ -222,11 +228,6 @@ } h->raw.height = d->iheight = (h->height + h->shrink) >> h->shrink; h->raw.width = d->iwidth = (h->width + h->shrink) >> h->shrink; - /* copied from the end of dcraw's identify() */ - if (d->filters > 999 && d->colors == 3) { - d->filters |= ((d->filters >> 2 & 0x22222222) | - (d->filters << 2 & 0x88888888)) & d->filters << 1; - } h->raw.colors = d->colors; h->fourColorFilters = d->filters; if (d->filters || d->colors == 1) { @@ -271,6 +272,12 @@ FORC3 if ((unsigned)i > d->cblack[c]) i = d->cblack[c]; FORC4 d->cblack[c] -= i; d->black += i; + i = d->cblack[6]; + FORC(d->cblack[4] * d->cblack[5]) + if (i > d->cblack[6 + c]) i = d->cblack[6 + c]; + FORC(d->cblack[4] * d->cblack[5]) + d->cblack[6 + c] -= i; + d->black += i; h->black = d->black; d->dcraw_message(DCRAW_VERBOSE, _("Black: %d, Maximum: %d\n"), d->black, d->maximum); ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ ufraw-cvs mailing list ufraw-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ufraw-cvs