Update of /cvsroot/ufraw/ufraw In directory vz-cvs-3.sog:/tmp/cvs-serv32115
Modified Files: dcraw.cc dcraw.h Log Message: dcraw modified 9.10 (1.444). Changelog: 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. Index: dcraw.cc =================================================================== RCS file: /cvsroot/ufraw/ufraw/dcraw.cc,v retrieving revision 1.244 retrieving revision 1.245 diff -u -d -r1.244 -r1.245 --- dcraw.cc 16 Jul 2011 12:25:45 -0000 1.244 +++ dcraw.cc 24 Jul 2011 14:59:40 -0000 1.245 @@ -22,7 +22,7 @@ #include "uf_progress.h" } -#define DCRAW_VERSION "9.08" +#define DCRAW_VERSION "9.10" // dcraw plays with array bounds everywhere, there is no point to warn about it. #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__INTEL_COMPILER) @@ -45,16 +45,22 @@ #include <string.h> #include <time.h> #include <sys/types.h> + +//#ifdef NODEPS +#define NO_JASPER +//#define NO_JPEG +//#define NO_LCMS +//#endif +#ifndef NO_JASPER +#include <jasper/jasper.h> /* Decode RED camera movies */ +#endif #ifdef HAVE_LIBJPEG extern "C" { -#include <jpeglib.h> +#include <jpeglib.h> /* Decode compressed Kodak DC120 photos */ } #endif -/* - NO_LCMS disables the "-p" option. - */ #ifndef NO_LCMS -#include <lcms.h> +#include <lcms.h> /* Support color profiles */ #endif #ifndef DCRAW_NOMAIN #ifdef LOCALEDIR @@ -67,6 +73,7 @@ #include <glib/gi18n.h> /*For _(String) definition - NKBJ*/ #endif #ifndef HAVE_CONFIG_H /*fseeko() is handled by the UFRaw config system - NKBJ*/ + #if defined(DJGPP) || defined(__MINGW32__) #define fseeko fseek #define ftello ftell @@ -1056,7 +1063,7 @@ sscanf (cp, "%d.%d.%d", v, v+1, v+2); ver = (v[0]*1000 + v[1])*1000 + v[2]; hue = (jh.sraw+1) << 2; - if (unique_id == 0x80000218 && ver > 1000006 && ver < 3000000) + if (unique_id >= 0x80000281 || (unique_id == 0x80000218 && ver > 1000006)) hue = jh.sraw << 1; ip = (short (*)[4]) image; rp = ip[0]; @@ -1081,7 +1088,7 @@ } else { rp[1] = (rp[1] << 2) + hue; rp[2] = (rp[2] << 2) + hue; - pix[0] = rp[0] + (( 200*rp[1] + 22929*rp[2]) >> 14); + pix[0] = rp[0] + (( 50*rp[1] + 22929*rp[2]) >> 14); pix[1] = rp[0] + ((-5640*rp[1] - 11751*rp[2]) >> 14); pix[2] = rp[0] + ((29040*rp[1] - 101*rp[2]) >> 14); } @@ -1867,7 +1874,7 @@ bitbuf |= (unsigned) (fgetc(ifp) << i); } val = bitbuf << (64-tiff_bps-vbits) >> (64-tiff_bps); - i = (col ^ (bite == 24)) - left_margin; + i = (col ^ (load_flags >> 6)) - left_margin; if ((unsigned) i < width) BAYER(row,i) = val; else if (load_flags & 32) { @@ -2746,6 +2753,58 @@ if (holes) fill_holes (holes); } +void CLASS redcine_load_raw() +{ +#ifndef NO_JASPER + int c, row, col; + jas_stream_t *in; + jas_image_t *jimg; + jas_matrix_t *jmat; + jas_seqent_t *data; + ushort *img, *pix; + + jas_init(); + in = jas_stream_fopen (ifname, "rb"); + jas_stream_seek (in, data_offset+20, SEEK_SET); + jimg = jas_image_decode (in, -1, 0); + if (!jimg) longjmp (failure, 3); + jmat = jas_matrix_create (height/2, width/2); + merror (jmat, "redcine_load_raw()"); + img = (ushort *) calloc ((height+2)*(width+2), 2); + merror (img, "redcine_load_raw()"); + FORC4 { + jas_image_readcmpt (jimg, c, 0, 0, width/2, height/2, jmat); + data = jas_matrix_getref (jmat, 0, 0); + for (row = c >> 1; row < height; row+=2) + for (col = c & 1; col < width; col+=2) + img[(row+1)*(width+2)+col+1] = data[(row/2)*(width/2)+col/2]; + } + for (col=1; col <= width; col++) { + img[col] = img[2*(width+2)+col]; + img[(height+1)*(width+2)+col] = img[(height-1)*(width+2)+col]; + } + for (row=0; row < height+2; row++) { + img[row*(width+2)] = img[row*(width+2)+2]; + img[(row+1)*(width+2)-1] = img[(row+1)*(width+2)-3]; + } + for (row=1; row <= height; row++) { + pix = img + row*(width+2) + (col = 1 + (FC(row,1) & 1)); + for ( ; col <= width; col+=2, pix+=2) { + c = (((pix[0] - 0x800) << 3) + + pix[-(width+2)] + pix[width+2] + pix[-1] + pix[1]) >> 2; + pix[0] = LIM(c,0,4095); + } + } + for (row=0; row < height; row++) + for (col=0; col < width; col++) + BAYER(row,col) = curve[img[(row+1)*(width+2)+col+1]]; + free (img); + jas_matrix_destroy (jmat); + jas_image_destroy (jimg); + jas_stream_close (in); +#endif +} + /* RESTRICTED code starts here */ void CLASS foveon_decoder (unsigned size, unsigned code) @@ -4473,7 +4532,7 @@ unsigned offset=0, entries, tag, type, len, save; unsigned ver97=0, serial=0, wbi=0, wb[4]={0,0,0,0}; uchar buf97[324], ci, cj, ck; - short sorder=order; + short morder, sorder=order; char buf[10]; /* The MakerNote might have its own TIFF header (possibly with @@ -4528,7 +4587,9 @@ } entries = get2(); if (entries > 1000) return; + morder = order; while (entries--) { + order = morder; tiff_get (base, &tag, &type, &len, &save); tag |= uptag << 16; if (tag == 2 && strstr(make,"NIKON") && !iso_speed) @@ -4649,23 +4710,21 @@ } } if (tag == 0xa1 && type == 7) { - type = order; order = 0x4949; fseek (ifp, 140, SEEK_CUR); FORC3 cam_mul[c] = get4(); - order = type; } if (tag == 0xa4 && type == 3) { fseek (ifp, wbi*48, SEEK_CUR); FORC3 cam_mul[c] = get2(); } - if (tag == 0xa7 && (unsigned) (ver97-200) < 12 && !cam_mul[0]) { + if (tag == 0xa7 && (unsigned) (ver97-200) < 17) { ci = xlat[0][serial & 0xff]; cj = xlat[1][fgetc(ifp)^fgetc(ifp)^fgetc(ifp)^fgetc(ifp)]; ck = 0x60; for (i=0; i < 324; i++) buf97[i] ^= (cj += ci * ck++); - i = "66666>666;6A"[ver97-200] - '0'; + i = "66666>666;6A;:;55"[ver97-200] - '0'; FORC4 cam_mul[c ^ (c >> 1) ^ (i & 1)] = sget2 (buf97 + (i & -2) + c*2); } @@ -4680,7 +4739,6 @@ if (tag == 0x401 && type == 4 && len == 4) FORC4 cblack[c ^ c >> 1] = get4(); if (tag == 0xe01) { /* Nikon Capture Note */ - type = order; order = 0x4949; fseek (ifp, 22, SEEK_CUR); for (offset=22; offset+22 < len; offset += 22+i) { @@ -4690,7 +4748,6 @@ if (tag == 0x76a43207) flip = get2(); else fseek (ifp, i, SEEK_CUR); } - order = type; } if (tag == 0xe80 && len == 256 && type == 7) { fseek (ifp, 48, SEEK_CUR); @@ -5027,7 +5084,7 @@ case 61446: raw_height = 0; load_raw = &CLASS packed_load_raw; - load_flags = 16 | (get4() && (filters=0x16161616)) << 3; + load_flags = get4() && (filters=0x16161616) ? 24:80; break; case 259: /* Compression */ tiff_ifd[ifd].comp = get2(); @@ -5483,7 +5540,7 @@ if (tiff_ifd[raw].bytes*5 == raw_width*raw_height*8) { tiff_bps = 12; load_raw = &CLASS packed_load_raw; - load_flags = 17; + load_flags = 81; } break; case 6: case 7: case 99: @@ -5499,7 +5556,7 @@ raw_height += 8; load_raw = &CLASS sony_arw_load_raw; break; } - load_flags = 15; + load_flags = 79; case 32769: load_flags++; case 32770: @@ -6080,6 +6137,35 @@ data_offset += (INT64) get4() << 32; } +void CLASS parse_redcine() +{ + unsigned i, len, rdvo; + + order = 0x4d4d; + is_raw = 0; + fseek (ifp, 52, SEEK_SET); + width = get4(); + height = get4(); + fseek (ifp, 0, SEEK_END); + fseek (ifp, -(i = ftello(ifp) & 511), SEEK_CUR); + if (get4() != i || get4() != 0x52454f42) { + fprintf (stderr,_("%s: Tail is missing, parsing from head...\n"), ifname); + fseek (ifp, 0, SEEK_SET); + while ((len = get4()) != EOF) { + if (get4() == 0x52454456) + if (is_raw++ == shot_select) + data_offset = ftello(ifp) - 8; + fseek (ifp, len-8, SEEK_CUR); + } + } else { + rdvo = get4(); + fseek (ifp, 12, SEEK_CUR); + is_raw = get4(); + fseeko (ifp, rdvo+8 + shot_select*4, SEEK_SET); + data_offset = get4(); + } +} + char * CLASS foveon_gets (int offset, char *str, int len) { int i; @@ -6609,6 +6695,8 @@ { 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-PL1s", 0, 0, { 11409,-3872,-1393,-4572,12757,2003,-709,1810,7415 } }, { "OLYMPUS E-PL1", 0, 0, @@ -6703,8 +6791,12 @@ { 8128,-2668,-655,-6134,13307,3161,-1782,2568,6083 } }, { "Panasonic DMC-LX5", 143, 0, { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, + { "LEICA D-LUX 5", 143, 0, + { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, { "Panasonic DMC-FZ100", 143, 0xfff, { 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-FX150", 15, 0xfff, { 9082,-2907,-925,-6119,13377,3058,-1797,2641,5609 } }, { "Panasonic DMC-G10", 0, 0, @@ -6713,12 +6805,14 @@ { 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, 0, /* DJC */ + { "Panasonic DMC-G3", 143, 0xfff, /* DJC */ { 6460,-2578,-366,-2786,8728,4059,-1073,2525,6254 } }, { "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-GH1", 15, 0xf92, { 6299,-1466,-532,-6535,13852,2969,-2331,3112,5984 } }, { "Panasonic DMC-GH2", 15, 0xf95, @@ -6733,6 +6827,8 @@ { 5053,-24,-117,-5684,14076,1702,-2619,4492,5849 } }, { "Phase One P65", 0, 0, { 7914,1414,-1190,-8777,16582,2280,-2811,4605,5562 } }, + { "RED ONE", 704, 0xffff, /* DJC */ + { 21014,-7891,-2613,-3056,12201,856,-2203,5125,8042 } }, { "SAMSUNG EX1", 0, 0x3e00, { 8898,-2498,-994,-3144,11328,2066,-760,1381,4576 } }, { "SAMSUNG NX1", 0, 0, @@ -6783,10 +6879,14 @@ { 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 */ { 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-A55", 128, 0, { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } } }; @@ -6952,6 +7052,7 @@ { 15467760, "Canon", "PowerShot SX110 IS",0 }, { 15534576, "Canon", "PowerShot SX120 IS",0 }, { 18653760, "Canon", "PowerShot SX20 IS",0 }, + { 21936096, "Canon", "PowerShot SX30 IS",0 }, { 5939200, "OLYMPUS", "C770UZ" ,0 }, { 1581060, "NIKON", "E900" ,1 }, /* or E900s,E910 */ { 2465792, "NIKON", "E950" ,1 }, /* or E800,E700 */ @@ -7108,6 +7209,25 @@ data_offset += i - width * 5 / 4 * height; load_raw = &CLASS nokia_load_raw; filters = 0x61616161; + } else if (!memcmp (head,"ARRI",4)) { + order = 0x4949; + fseek (ifp, 20, SEEK_SET); + width = get4(); + height = get4(); + strcpy (make, "ARRI"); + fseek (ifp, 668, SEEK_SET); + fread (model, 1, 64, ifp); + data_offset = 4096; + load_raw = &CLASS packed_load_raw; + load_flags = 88; + filters = 0x61616161; + } else if (!memcmp (head+4,"RED1",4)) { + strcpy (make, "RED"); + strcpy (model,"ONE"); + parse_redcine(); + load_raw = &CLASS redcine_load_raw; + gamma_curve (1/2.4, 12.92, 1, 4095); + filters = 0x49494949; } else if (!memcmp (head,"DSC-Image",9)) parse_rollei(); else if (!memcmp (head,"PWAD",4)) @@ -7366,6 +7486,17 @@ load_raw = &CLASS packed_load_raw; load_flags = 40; zero_is_bad = 1; + } else if (!strcmp(model,"PowerShot SX30 IS")) { + height = 3254; + width = 4366; + raw_height = 3276; + raw_width = 4464; + top_margin = 10; + left_margin = 25; + filters = 0x16161616; + load_raw = &CLASS packed_load_raw; + load_flags = 40; + zero_is_bad = 1; } else if (!strcmp(model,"PowerShot Pro90 IS")) { width = 1896; colors = 4; @@ -8005,6 +8136,7 @@ height += height & 1; filters = exif_cfa; if (width == 4100) width -= 4; + if (width == 4080) width -= 24; if (load_raw == &CLASS unpacked_load_raw) load_flags = 4; tiff_bps = 12; @@ -8326,9 +8458,17 @@ if (!tiff_bps) tiff_bps = 12; if (!maximum) maximum = (1 << tiff_bps) - 1; if (!load_raw || height < 22) is_raw = 0; +#ifdef NO_JASPER + if (load_raw == &CLASS redcine_load_raw) { + dcraw_message (DCRAW_ERROR,_("%s: You must link dcraw with %s!!\n"), + ifname_display, "libjasper"); + is_raw = 0; + } +#endif #ifndef HAVE_LIBJPEG if (load_raw == &CLASS kodak_jpeg_load_raw) { - dcraw_message (DCRAW_ERROR,_("%s: You must link dcraw with libjpeg!!\n"), ifname_display); + dcraw_message (DCRAW_ERROR,_("%s: You must link dcraw with %s!!\n"), + ifname_display, "libjpeg"); is_raw = 0; } #endif @@ -9009,8 +9149,8 @@ } else if (!is_raw) dcraw_message (DCRAW_ERROR,_("Cannot decode file %s\n"), ifname); if (!is_raw) goto next; - shrink = filters && (half_size || - ((threshold || aber[0] != 1 || aber[2] != 1) && !identify_only)); + shrink = filters && (half_size || (!identify_only && + (threshold || aber[0] != 1 || aber[2] != 1))); iheight = (height + shrink) >> shrink; iwidth = (width + shrink) >> shrink; if (identify_only) { Index: dcraw.h =================================================================== RCS file: /cvsroot/ufraw/ufraw/dcraw.h,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- dcraw.h 1 Mar 2011 03:38:35 -0000 1.69 +++ dcraw.h 24 Jul 2011 14:59:40 -0000 1.70 @@ -12,9 +12,12 @@ It can work as either a command-line tool or called by other programs. */ -#define ushort UshORt -typedef unsigned char uchar; -typedef unsigned short ushort; +#if !defined(uchar) +#define uchar unsigned char +#endif +#if !defined(ushort) +#define ushort unsigned short +#endif /* * The following is somewhat ugly because of various requirements: @@ -195,6 +198,7 @@ int median4(int *p); void fill_holes(int holes); void smal_v9_load_raw(); + void redcine_load_raw(); void foveon_decoder(unsigned size, unsigned code); void foveon_thumb(); void foveon_load_camf(); @@ -252,6 +256,7 @@ void parse_riff(); void parse_smal(int offset, unsigned fsize); void parse_cine(); + void parse_redcine(); char * foveon_gets(int offset, char *str, int len); void parse_foveon(); void adobe_coeff(const char *make, const char *model); ------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ ufraw-cvs mailing list ufraw-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ufraw-cvs