diff options
author | Hub Figuiere <hub@figuiere.net> | 2011-12-17 14:19:00 -0800 |
---|---|---|
committer | Hub Figuiere <hub@figuiere.net> | 2011-12-17 14:19:00 -0800 |
commit | 63b90051a3ac15758aee651856e3c69270f354c4 (patch) | |
tree | c0a612227334d4ed0aad243f1d6a4d0d5069bafd /dcraw | |
parent | 1490b99d44f4eec8115d17780f997400d98d351f (diff) |
upgrade dcraw
Diffstat (limited to 'dcraw')
-rw-r--r-- | dcraw/dcraw.c,v | 216 |
1 files changed, 157 insertions, 59 deletions
diff --git a/dcraw/dcraw.c,v b/dcraw/dcraw.c,v index e840290..71a0d9b 100644 --- a/dcraw/dcraw.c,v +++ b/dcraw/dcraw.c,v @@ -1,10 +1,15 @@ -head 1.444; +head 1.445; access; symbols; locks; strict; comment @ * @; +1.445 +date 2011.10.07.01.00.37; author dcoffin; state Exp; +branches; +next 1.444; + 1.444 date 2011.07.23.20.33.32; author dcoffin; state Exp; branches; @@ -2253,17 +2258,14 @@ desc @ -1.444 +1.445 log -@Support ARRIRAW and Redcode R3D raw formats (video only). -Support the Leica D-LUX 5 and V-LUX 2, Panasonic G3 and GF3, -Olympus E-P3, Sony NEX-C3 and SLT-A35, and Canon SX30. -Updated support for Nikon encrypted WB and Canon sRAW/mRAW. +@Copied new color matrices from DNG Converter 6.5. @ text @/* dcraw.c -- Dave Coffin's raw photo decoder - Copyright 1997-2010 by Dave Coffin, dcoffin a cybercom o net + Copyright 1997-2011 by Dave Coffin, dcoffin a cybercom o net This is a command-line ANSI C program to convert raw photos from any digital camera on any computer running any operating system. @@ -2286,7 +2288,7 @@ text $Date$ */ -#define DCRAW_VERSION "9.10" +#define DCRAW_VERSION "9.11" #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -3994,7 +3996,7 @@ void CLASS sinar_4shot_load_raw() if ((r = row-top_margin - (shot >> 1 & 1)) >= height) continue; for (col=0; col < raw_width; col++) { if ((c = col-left_margin - (shot & 1)) >= width) continue; - image[r*width+c][FC(row,col)] = pixel[col]; + image[r*width+c][FC(row,col)] = pixel[col]; } } } @@ -4478,7 +4480,7 @@ void CLASS eight_bit_load_raw() for (col=0; col < raw_width; col++) { val = curve[pixel[col]]; if ((unsigned) (col-left_margin) < width) - BAYER(row,col-left_margin) = val; + BAYER(row,col-left_margin) = val; else lblack += val; } } @@ -4757,7 +4759,7 @@ void CLASS sony_arw2_load_raw() merror (data, "sony_arw2_load_raw()"); for (row=0; row < height; row++) { fread (data, 1, raw_width, ifp); - for (dp=data, col=0; col < width-30; dp+=16) { + for (dp=data, col=0; col < raw_width-30; dp+=16) { max = 0x7ff & (val = sget4(dp)); min = 0x7ff & val >> 11; imax = 0x0f & val >> 22; @@ -4772,7 +4774,7 @@ void CLASS sony_arw2_load_raw() bit += 7; } for (i=0; i < 16; i++, col+=2) - BAYER(row,col) = curve[pix[i] << 1] >> 2; + if (col < width) BAYER(row,col) = curve[pix[i] << 1] >> 2; col -= col & 1 ? 1:31; } } @@ -5914,7 +5916,7 @@ void CLASS wavelet_denoise() lpass = size*((lev & 1)+1); for (row=0; row < iheight; row++) { hat_transform (temp, fimg+hpass+row*iwidth, 1, iwidth, 1 << lev); - for (col=0; col < iwidth; col++) + for (col=0; col < iwidth; col++) fimg[lpass + row*iwidth + col] = temp[col] * 0.25; } for (col=0; col < iwidth; col++) { @@ -6705,6 +6707,7 @@ void CLASS parse_makernote (int base, int uptag) The MakerNote might have its own TIFF header (possibly with its own byte-order!), or it might just be a table. */ + if (!strcmp(make,"Nokia")) return; fread (buf, 1, 10, ifp); if (!strncmp (buf,"KDK" ,3) || /* these aren't TIFF tables */ !strncmp (buf,"VER" ,3) || @@ -7834,7 +7837,7 @@ void CLASS parse_external_jpeg() } else while (isdigit(*--jext)) { if (*jext != '9') { - (*jext)++; + (*jext)++; break; } *jext = '0'; @@ -8561,7 +8564,7 @@ void CLASS adobe_coeff (const char *make, const char *model) { "Canon PowerShot SX1 IS", 0, 0, { 6578,-259,-502,-5974,13030,3309,-308,1058,4970 } }, { "Canon PowerShot SX110 IS", 0, 0, /* DJC */ - { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } }, + { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } }, { "CASIO EX-S20", 0, 0, /* DJC */ { 11634,-3924,-1128,-4968,12954,2015,-1588,2648,7206 } }, { "CASIO EX-Z750", 0, 0, /* DJC */ @@ -8630,6 +8633,8 @@ void CLASS adobe_coeff (const char *make, const char *model) { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "FUJIFILM FinePix F550EXR", 0, 0, { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, + { "FUJIFILM FinePix F600EXR", 0, 0, + { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "FUJIFILM FinePix X100", 0, 0, { 12161,-4457,-1069,-5034,12874,2400,-795,1724,6904 } }, { "Imacon Ixpress", 0, 0, /* DJC */ @@ -8800,6 +8805,8 @@ void CLASS adobe_coeff (const char *make, const char *model) { 9698,-3367,-914,-4706,12584,2368,-837,968,5801 } }, { "NIKON COOLPIX P7000", 0, 0, { 11432,-3679,-1111,-3169,11239,2202,-791,1380,4455 } }, + { "NIKON COOLPIX P7100", 0, 0, + { 11053,-4269,-1024,-1976,10182,2088,-526,1263,4469 } }, { "OLYMPUS C5050", 0, 0, { 10508,-3124,-1273,-6079,14294,1901,-1653,2306,6237 } }, { "OLYMPUS C5060", 0, 0, @@ -8848,14 +8855,18 @@ void CLASS adobe_coeff (const char *make, const char *model) { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, { "OLYMPUS E-P2", 0, 0xffd, { 8343,-2050,-1021,-7715,15705,2103,-1831,2380,8235 } }, - { "OLYMPUS E-P3", 0, 0, /* DJC */ - { 7488,-3021,-55,-2377,8348,4029,-816,2405,6327 } }, + { "OLYMPUS E-P3", 0, 0, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "OLYMPUS E-PL1s", 0, 0, { 11409,-3872,-1393,-4572,12757,2003,-709,1810,7415 } }, { "OLYMPUS E-PL1", 0, 0, { 11408,-4289,-1215,-4286,12385,2118,-387,1467,7787 } }, { "OLYMPUS E-PL2", 0, 0, { 15030,-5552,-1806,-3987,12387,1767,-592,1670,7023 } }, + { "OLYMPUS E-PL3", 0, 0, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, + { "OLYMPUS E-PM1", 0, 0, + { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "OLYMPUS SP350", 0, 0, { 12078,-4836,-1069,-6671,14306,2578,-786,939,7418 } }, { "OLYMPUS SP3", 0, 0, @@ -8950,6 +8961,8 @@ void CLASS adobe_coeff (const char *make, const char *model) { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, { "LEICA V-LUX 2", 143, 0xfff, { 16197,-6146,-1761,-2393,10765,1869,366,2238,5248 } }, + { "Panasonic DMC-FZ150", 143, 0xfff, + { 11904,-4541,-1189,-2355,10899,1662,-296,1586,4289 } }, { "Panasonic DMC-FX150", 15, 0xfff, { 9082,-2907,-925,-6119,13377,3058,-1797,2641,5609 } }, { "Panasonic DMC-G10", 0, 0, @@ -8958,28 +8971,32 @@ void CLASS adobe_coeff (const char *make, const char *model) { 8199,-2065,-1056,-8124,16156,2033,-2458,3022,7220 } }, { "Panasonic DMC-G2", 15, 0xf3c, { 10113,-3400,-1114,-4765,12683,2317,-377,1437,6710 } }, - { "Panasonic DMC-G3", 143, 0xfff, /* DJC */ - { 6460,-2578,-366,-2786,8728,4059,-1073,2525,6254 } }, + { "Panasonic DMC-G3", 143, 0xfff, + { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, { "Panasonic DMC-GF1", 15, 0xf92, { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, { "Panasonic DMC-GF2", 143, 0xfff, { 7888,-1902,-1011,-8106,16085,2099,-2353,2866,7330 } }, - { "Panasonic DMC-GF3", 143, 0xfff, /* DJC */ - { 8407,-3261,-502,-3997,10651,3347,-1095,2742,7294 } }, + { "Panasonic DMC-GF3", 143, 0xfff, + { 9051,-2468,-1204,-5212,13276,2121,-1197,2510,6890 } }, { "Panasonic DMC-GH1", 15, 0xf92, { 6299,-1466,-532,-6535,13852,2969,-2331,3112,5984 } }, { "Panasonic DMC-GH2", 15, 0xf95, { 7780,-2410,-806,-3913,11724,2484,-1018,2390,5298 } }, { "Phase One H 20", 0, 0, /* DJC */ { 1313,1855,-109,-6715,15908,808,-327,1840,6020 } }, + { "Phase One H 25", 0, 0, + { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, { "Phase One P 2", 0, 0, { 2905,732,-237,-8134,16626,1476,-3038,4253,7517 } }, { "Phase One P 30", 0, 0, { 4516,-245,-37,-7020,14976,2173,-3206,4671,7087 } }, { "Phase One P 45", 0, 0, { 5053,-24,-117,-5684,14076,1702,-2619,4492,5849 } }, + { "Phase One P40", 0, 0, + { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, { "Phase One P65", 0, 0, - { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, + { 8035,435,-962,-6001,13872,2320,-1159,3065,5434 } }, { "RED ONE", 704, 0xffff, /* DJC */ { 21014,-7891,-2613,-3056,12201,856,-2203,5125,8042 } }, { "SAMSUNG EX1", 0, 0x3e00, @@ -9028,20 +9045,28 @@ void CLASS adobe_coeff (const char *make, const char *model) { 5413,-1162,-365,-5665,13098,2866,-608,1179,8440 } }, { "SONY DSLR-A900", 128, 0, { 5209,-1072,-397,-8845,16120,2919,-1618,1803,8654 } }, + { "SONY NEX-5N", 128, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, + { "SONY NEX-C3", 128, 0, + { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, { "SONY NEX-3", 138, 0, /* DJC */ { 6907,-1256,-645,-4940,12621,2320,-1710,2581,6230 } }, { "SONY NEX-5", 116, 0, /* DJC */ { 6807,-1350,-342,-4216,11649,2567,-1089,2001,6420 } }, - { "SONY NEX-C3", 128, 0, /* DJC */ - { 5171,-1786,-46,-3375,9315,4061,-611,1865,6473 } }, - { "SONY NEX", 128, 0, /* Adobe's matrix */ + { "SONY NEX-3", 128, 0, /* Adobe */ + { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, + { "SONY NEX-5", 128, 0, /* Adobe */ { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, { "SONY SLT-A33", 128, 0, { 6069,-1221,-366,-5221,12779,2734,-1024,2066,6834 } }, - { "SONY SLT-A35", 128, 0, /* DJC */ - { 4504,-1495,115,-3507,9101,4407,-669,1844,6806 } }, + { "SONY SLT-A35", 128, 0, + { 5986,-1618,-415,-4557,11820,3120,-681,1404,6971 } }, { "SONY SLT-A55", 128, 0, - { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } } + { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, + { "SONY SLT-A65", 128, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "SONY SLT-A77", 128, 0, + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } } }; double cam_xyz[4][3]; char name[130]; @@ -9434,13 +9459,13 @@ void CLASS identify() { height = 2616; width = 3896; } if (height == 3136 && width == 4864) /* Pentax K20D and Samsung GX20 */ { height = 3124; width = 4688; filters = 0x16161616; } - if (!strcmp(model,"K-r") || !strcmp(model,"K-x")) + if (width == 4352 && (!strcmp(model,"K-r") || !strcmp(model,"K-x"))) { width = 4309; filters = 0x16161616; } - if (!strcmp(model,"K-5")) + if (width >= 4960 && !strcmp(model,"K-5")) { left_margin = 10; width = 4950; filters = 0x16161616; } - if (!strcmp(model,"K-7")) + if (width == 4736 && !strcmp(model,"K-7")) { height = 3122; width = 4684; filters = 0x16161616; top_margin = 2; } - if (!strcmp(model,"645D")) + if (width == 7424 && !strcmp(model,"645D")) { height = 5502; width = 7328; filters = 0x61616161; top_margin = 29; left_margin = 48; } if (height == 3014 && width == 4096) /* Ricoh GX200 */ @@ -10328,6 +10353,8 @@ wb550: adobe_coeff ("SONY","DSC-R1"); width = 3925; order = 0x4d4d; + } else if (!strcmp(make,"SONY") && raw_width == 6048) { + width -= 24; } else if (!strcmp(model,"DSLR-A100")) { if (width == 3880) { height--; @@ -10755,7 +10782,7 @@ void CLASS convert_to_rgb() for (j=0; j < 3; j++) { for (num = k=0; k < 3; k++) num += xyzd50_srgb[i][k] * inverse[j][k]; - oprof[pbody[j*3+23]/4+i+2] = num * 0x10000 + 0.5; + oprof[pbody[j*3+23]/4+i+2] = num * 0x10000 + 0.5; } for (i=0; i < phead[0]/4; i++) oprof[i] = htonl(oprof[i]); @@ -11439,6 +11466,77 @@ cleanup: @ +1.444 +log +@Support ARRIRAW and Redcode R3D raw formats (video only). +Support the Leica D-LUX 5 and V-LUX 2, Panasonic G3 and GF3, +Olympus E-P3, Sony NEX-C3 and SLT-A35, and Canon SX30. +Updated support for Nikon encrypted WB and Canon sRAW/mRAW. +@ +text +@d3 1 +a3 1 + Copyright 1997-2010 by Dave Coffin, dcoffin a cybercom o net +d26 1 +a26 1 +#define DCRAW_VERSION "9.10" +d2497 1 +a2497 1 + for (dp=data, col=0; col < width-30; dp+=16) { +d2512 1 +a2512 1 + BAYER(row,col) = curve[pix[i] << 1] >> 2; +d4445 1 +d6371 2 +d6543 2 +d6593 2 +a6594 2 + { "OLYMPUS E-P3", 0, 0, /* DJC */ + { 7488,-3021,-55,-2377,8348,4029,-816,2405,6327 } }, +d6601 4 +d6699 2 +d6709 2 +a6710 2 + { "Panasonic DMC-G3", 143, 0xfff, /* DJC */ + { 6460,-2578,-366,-2786,8728,4059,-1073,2525,6254 } }, +d6715 2 +a6716 2 + { "Panasonic DMC-GF3", 143, 0xfff, /* DJC */ + { 8407,-3261,-502,-3997,10651,3347,-1095,2742,7294 } }, +d6723 2 +d6731 2 +d6734 1 +a6734 1 + { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, +d6783 4 +d6791 3 +a6793 3 + { "SONY NEX-C3", 128, 0, /* DJC */ + { 5171,-1786,-46,-3375,9315,4061,-611,1865,6473 } }, + { "SONY NEX", 128, 0, /* Adobe's matrix */ +d6797 2 +a6798 2 + { "SONY SLT-A35", 128, 0, /* DJC */ + { 4504,-1495,115,-3507,9101,4407,-669,1844,6806 } }, +d6800 5 +a6804 1 + { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } } +d7197 1 +a7197 1 + if (!strcmp(model,"K-r") || !strcmp(model,"K-x")) +d7199 1 +a7199 1 + if (!strcmp(model,"K-5")) +d7201 1 +a7201 1 + if (!strcmp(model,"K-7")) +d7203 1 +a7203 1 + if (!strcmp(model,"645D")) +d8091 2 +@ + + 1.443 log @Support the Fuji HS20EXR/F550EXR, Kodak Z990, Leaf AFi-II 12, @@ -17053,7 +17151,7 @@ void CLASS cam_to_cielab (ushort cam[4], float lab[3]) } for (i=0; i < 3; i++) for (j=0; j < colors; j++) - for (xyz_cam[i][j] = k=0; k < 3; k++) + for (xyz_cam[i][j] = k=0; k < 3; k++) xyz_cam[i][j] += xyz_rgb[i][k] * rgb_cam[k][j] / d65_white[i]; } else { xyz[0] = xyz[1] = xyz[2] = 0.5; @@ -31182,7 +31280,7 @@ a1546 4 for (c=0; c < colors; c++) { /* Smallest pre_mul[] value */ pre_mul[c] = sum[c]/count[c]; /* should be 1.0 */ if (maxd < pre_mul[c]) - maxd = pre_mul[c]; + maxd = pre_mul[c]; a1547 9 for (c=0; c < colors; c++) pre_mul[c] = maxd / pre_mul[c]; @@ -37147,7 +37245,7 @@ a510 1 d512 3 a514 2 for (col=0; col < width; col++) - image[(row+r)*width+col][FC(row+r,col)] = + image[(row+r)*width+col][FC(row+r,col)] = d516 2 d519 1 a521 9 @@ -37425,10 +37523,10 @@ pro90_filter(int row, int col) d472 1 a472 1 - image[(row+r)*width+col][(*filter)(row+r,col)] = + image[(row+r)*width+col][(*filter)(row+r,col)] = d491 1 a491 1 - image[(row+r)*width+col][(*filter)(row+r,col)] = + image[(row+r)*width+col][(*filter)(row+r,col)] = a504 5 rgb_filter(row,col) { @@ -38512,7 +38610,7 @@ a895 6 fd = open(data,WFLAGS,0644); if (fd < 0) { perror(data); - return; } + return; } write_ppm(fd); close(fd); d897 2 @@ -38701,7 +38799,7 @@ a482 1 for (row=0; row < H; row++) a483 2 for (i=0; i < W; i+=4) - dummy=gmcy[row][i][0]; + dummy=gmcy[row][i][0]; d485 2 a486 2 if (row > 1) first_interpolate(row-1); @@ -39330,22 +39428,22 @@ value for each pixel. Do linear interpolation to get the other three. d161 1 a161 1 - for (sx=x-1; sx < x+2; sx++) + for (sx=x-1; sx < x+2; sx++) d163 2 a164 2 - c=filter(sy,sx); - gmcy[y][x][c] += gmcy[sy][sx][c] >> *sp++; + c=filter(sy,sx); + gmcy[y][x][c] += gmcy[sy][sx][c] >> *sp++; d172 2 a173 2 the color balance to avoid artifacts. This function may be called more than once. d198 1 a198 1 - for (sx=x-1; sx < x+2; sx++) + for (sx=x-1; sx < x+2; sx++) d200 4 a203 4 - sc=filter(sy,sx); - this_row[x][sc] += + sc=filter(sy,sx); + this_row[x][sc] += ( (unsigned long) gmcy[sy][sx][sc] << 16) / gmcy[sy][sx][c] * gmcy[y][x][c] >> (16 + *sp++); d217 1 @@ -39356,7 +39454,7 @@ a248 1 } d282 1 a282 1 - histo [(int)rgb[c] >> 10]++; + histo [(int)rgb[c] >> 10]++; d311 1 a311 1 expo = (gamma_val-1)/2; /* Pull these out of the loop */ @@ -39686,7 +39784,7 @@ a147 12 for (icol=gcol=mcol=0; icol < 1120; icol++) { if ( icol % 10 != 1 && icol % 10 != 9 ) - grid[gcol++] = data[icol]; /* Data pixels go here */ + grid[gcol++] = data[icol]; /* Data pixels go here */ else myst[mcol++] = data[icol]; /* Mystery pixels go here */ } @@ -39701,7 +39799,7 @@ d154 7 a160 5 if ( icol % 10 != 1 && icol % 10 != 9 ) { - gmcy[orow][ocol][color(orow,ocol)] = (ushort) data[icol] << 6; + gmcy[orow][ocol][color(orow,ocol)] = (ushort) data[icol] << 6; ocol++; } a161 2 @@ -39756,15 +39854,15 @@ a301 1 d303 1 a303 4 for (sy=y; sy < y+2; sy++) - for (sx=x; sx < x+2; sx++) - gmcy[color(sx,sy)] = pgm[sy][sx]; + for (sx=x; sx < x+2; sx++) + gmcy[color(sx,sy)] = pgm[sy][sx]; get_rgb(rgb,gmcy); d306 9 a314 4 - val = floor(rgb[c]); - if (val < 0) val=0; - if (val > 255) val=255; - ppm[x][c] = val; + val = floor(rgb[c]); + if (val < 0) val=0; + if (val > 255) val=255; + ppm[x][c] = val; d317 1 a317 1 write (out, ppm, sizeof ppm); @@ -39836,7 +39934,7 @@ a163 1 d166 5 a170 2 if ( icol % 10 != 1 && icol % 10 != 9 ) /* Delete the "mystery pixels" */ - pgm[orow][ocol++] = data[icol]; + pgm[orow][ocol++] = data[icol]; d175 1 a175 3 close(in); @@ -39971,7 +40069,7 @@ a282 14 fd = open(fname,WFLAGS,0644); /* a PGM file */ if (fd < 0) { perror(fname); - continue; } + continue; } write(fd,"P5\n854 613\n255\n",15); write(fd, pgm, 613*854); close(fd); @@ -40316,7 +40414,7 @@ a238 14 { c = ((y & 1) << 1) + (x & 1); if ((y & 3) == 2) /* 0=green, 1=magenta, 2=cyan, 3=yellow */ - c ^= 1; /* Swap green and magenta */ + c ^= 1; /* Swap green and magenta */ if (max[c] < pgm[y][x]) max[c] = pgm[y][x]; } @@ -40343,7 +40441,7 @@ a250 1 val = floor(mat[c][3] * scale); d253 1 a253 1 - *pptr++ = val; + *pptr++ = val; d256 1 a256 1 write (out, ppm, 854*3); |