From df76c5b6a81b54d8a04191ae3204697b804cc367 Mon Sep 17 00:00:00 2001 From: Oliver Duis Date: Tue, 17 Jul 2012 21:54:18 +0200 Subject: [PATCH] Sync with DEFAULT --- rtengine/EdgePreservingDecomposition.h | 4 +- rtengine/FTblockDN.cc | 16 ++++---- rtengine/array2D.h | 4 +- rtengine/curves.cc | 1 - rtengine/curves.h | 1 - rtengine/dcraw.c | 16 +++++--- rtengine/dcraw.cc | 16 +++++--- rtengine/dcraw.patch | 39 +++++++------------ rtengine/demosaic_algos.cc | 3 +- rtengine/dfmanager.cc | 17 ++++---- rtengine/improcfun.cc | 11 +++--- rtengine/improcfun.h | 2 +- rtengine/init.cc | 2 +- rtengine/iplab2rgb.cc | 54 +++++++++++++------------- rtengine/ipvibrance.cc | 12 +++--- rtengine/lcp.cc | 14 ++++++- rtengine/lcp.h | 2 +- rtengine/rawimagesource_i.h | 2 +- rtengine/safegtk.cc | 44 ++++++++++++++++++++- 19 files changed, 155 insertions(+), 105 deletions(-) diff --git a/rtengine/EdgePreservingDecomposition.h b/rtengine/EdgePreservingDecomposition.h index e32262aa9..b3b832823 100644 --- a/rtengine/EdgePreservingDecomposition.h +++ b/rtengine/EdgePreservingDecomposition.h @@ -123,9 +123,7 @@ public: the more compression is applied, with Compression = 1 giving no effect and above 1 the opposite effect. You can totally use Compression = 1 and play with DetailBoost for some really sweet unsharp masking. If working on luma/grey, consider giving it a logarithm. In place calculation to save memory (Source == Compressed) is totally ok. Reweightings > 0 invokes CreateIteratedBlur instead of CreateBlur. */ - float *CompressDynamicRange(float *Source, float Scale = 1.0f, float EdgeStopping = 1.4f, - float CompressionExponent = 0.8f, float DetailBoost = 0.1f, unsigned int Iterates = 20, - unsigned int Reweightings = 0, float *Compressed = NULL); + float *CompressDynamicRange(float *Source, float Scale = 1.0f, float EdgeStopping = 1.4f, float CompressionExponent = 0.8f, float DetailBoost = 0.1f, unsigned int Iterates = 20, unsigned int Reweightings = 0, float *Compressed = NULL); private: MultiDiagonalSymmetricMatrix *A; //The equations are simple enough to not mandate a matrix class, but fast solution NEEDS a complicated preconditioner. diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index c83203e21..99c0255c2 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -112,7 +112,7 @@ namespace rtengine { LUTf gamcurve(65536,0); for (int i=0; i<65536; i++) { - gamcurve[i] = (gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)) * 32768.0f; + gamcurve[i] = (Color::gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)) * 32768.0f; } // inverse gamma transform for output data @@ -123,7 +123,7 @@ namespace rtengine { LUTf igamcurve(65536,0); for (int i=0; i<65536; i++) { - igamcurve[i] = (gamma((float)i/32768.0f, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0f); + igamcurve[i] = (Color::gamma((float)i/32768.0f, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0f); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -224,9 +224,9 @@ namespace rtengine { float Y = gain*src->g[i][j];//xyz_prophoto[1][0]*src->r[i][j] + xyz_prophoto[1][1]*src->g[i][j] + xyz_prophoto[1][2]*src->b[i][j]; float Z = gain*src->b[i][j];//xyz_prophoto[2][0]*src->r[i][j] + xyz_prophoto[2][1]*src->g[i][j] + xyz_prophoto[2][2]*src->b[i][j]; - X = X<65535.0f ? gamcurve[X] : (gamma((double)X/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)*32768.0f); - Y = Y<65535.0f ? gamcurve[Y] : (gamma((double)Y/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)*32768.0f); - Z = Z<65535.0f ? gamcurve[Z] : (gamma((double)Z/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)*32768.0f); + X = X<65535.0f ? gamcurve[X] : (Color::gamma((double)X/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)*32768.0f); + Y = Y<65535.0f ? gamcurve[Y] : (Color::gamma((double)Y/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)*32768.0f); + Z = Z<65535.0f ? gamcurve[Z] : (Color::gamma((double)Z/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)*32768.0f); labdn->L[i1][j1] = Y; labdn->a[i1][j1] = (X-Y); @@ -449,9 +449,9 @@ namespace rtengine { X = (labdn->a[i1][j1]) + Y; Z = Y - (labdn->b[i1][j1]); - X = X<32768.0f ? igamcurve[X] : (gamma((float)X/32768.0f, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0f); - Y = Y<32768.0f ? igamcurve[Y] : (gamma((float)Y/32768.0f, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0f); - Z = Z<32768.0f ? igamcurve[Z] : (gamma((float)Z/32768.0f, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0f); + X = X<32768.0f ? igamcurve[X] : (Color::gamma((float)X/32768.0f, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0f); + Y = Y<32768.0f ? igamcurve[Y] : (Color::gamma((float)Y/32768.0f, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0f); + Z = Z<32768.0f ? igamcurve[Z] : (Color::gamma((float)Z/32768.0f, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0f); //Y = 65535.0f*(0.05+0.1*((float)rand()/(float)RAND_MAX));//test with random data diff --git a/rtengine/array2D.h b/rtengine/array2D.h index d2a09dd31..b80f1d1e8 100644 --- a/rtengine/array2D.h +++ b/rtengine/array2D.h @@ -99,7 +99,7 @@ public: // use as empty declaration, resize before use! // very useful as a member object array2D() : - x(0), y(0), owner(0), ptr(NULL), data(NULL), lock(0), flags(0) { + x(0), y(0), owner(0), ptr(NULL), data(NULL), lock(0) { //printf("got empty array2D init\n"); } @@ -262,7 +262,7 @@ public: array2D & operator[](int index) { if (static_cast(index) >= num) { - printf("index %0u is out of range[0..%0u]", index, num - 1); + printf("index %0u is out of range[0..%0lu]", index, num - 1); raise( SIGSEGV); } return list[index]; diff --git a/rtengine/curves.cc b/rtengine/curves.cc index d431478eb..ef556a792 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -29,7 +29,6 @@ #include "array2D.h" #include "LUT.h" #include "curves.h" -#include "color.h" #undef CLIPD #define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f) diff --git a/rtengine/curves.h b/rtengine/curves.h index d2275ed26..1a48ad034 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -32,7 +32,6 @@ #define CURVES_MIN_POLY_POINTS 1000 #include "rt_math.h" -//#define SQR(x) ((x)*(x)) #define CLIPI(a) ((a)>0?((a)<65534?(a):65534):0) diff --git a/rtengine/dcraw.c b/rtengine/dcraw.c index ef6daee3b..737d1989c 100644 --- a/rtengine/dcraw.c +++ b/rtengine/dcraw.c @@ -19,8 +19,8 @@ *If you have not modified dcraw.c in any way, a link to my homepage qualifies as "full source code". - $Revision: 1.450 $ - $Date: 2012/06/30 20:36:46 $ + $Revision: 1.451 $ + $Date: 2012/07/05 04:33:11 $ */ #define DCRAW_VERSION "9.16" @@ -6897,6 +6897,8 @@ void CLASS adobe_coeff (const char *make, const char *model) { 8898,-2498,-994,-3144,11328,2066,-760,1381,4576 } }, { "SAMSUNG NX2", 0, 0xfff, /* NX20, NX200, NX210 */ { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, + { "SAMSUNG NX1000", 0, 0, + { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, { "SAMSUNG NX", 0, 0, /* NX5, NX10, NX11, NX100 */ { 10332,-3234,-1168,-6111,14639,1520,-1352,2647,8331 } }, { "SAMSUNG WB2000", 0, 0xfff, @@ -6913,6 +6915,8 @@ void CLASS adobe_coeff (const char *make, const char *model) { 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-RX100", 192, 0, /* DJC */ + { 7329,-2746,-405,-2691,9338,3354,-136,1259,5051 } }, { "SONY DSLR-A100", 0, 0xfeb, { 9437,-2811,-774,-8405,16215,2290,-710,596,7181 } }, { "SONY DSLR-A290", 0, 0, @@ -6968,7 +6972,7 @@ void CLASS adobe_coeff (const char *make, const char *model) { "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 } } + { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, }; double cam_xyz[4][3]; char name[130]; @@ -8040,11 +8044,11 @@ konica_400z: raw_width = fsize/height/2; order = 0x4d4d; load_raw = &CLASS unpacked_load_raw; - } else if (!strncmp(model,"NX1",3)) { + } else if (!strcmp(make,"SAMSUNG") && raw_width == 4704) { height -= top_margin = 8; width -= 2 * (left_margin = 8); load_flags = 32; - } else if (!strncmp(model,"NX2",3)) { + } else if (!strcmp(make,"SAMSUNG") && raw_width == 5632) { order = 0x4949; height = 3694; top_margin = 2; @@ -8312,6 +8316,8 @@ wb550: adobe_coeff ("SONY","DSC-R1"); width = 3925; order = 0x4d4d; + } else if (!strcmp(make,"SONY") && raw_width == 5504) { + width -= 8; } else if (!strcmp(make,"SONY") && raw_width == 6048) { width -= 24; } else if (!strcmp(model,"DSLR-A100")) { diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 03c144b3a..60e1d96ec 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -31,11 +31,11 @@ *If you have not modified dcraw.c in any way, a link to my homepage qualifies as "full source code". - $Revision: 1.448 $ - $Date: 2012/06/18 19:44:18 $ + $Revision: 1.451 $ + $Date: 2012/07/05 04:33:11 $ */ -#define DCRAW_VERSION "9.15" +#define DCRAW_VERSION "9.16" #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -6506,6 +6506,8 @@ void CLASS adobe_coeff (const char *make, const char *model) { 8898,-2498,-994,-3144,11328,2066,-760,1381,4576 } }, { "SAMSUNG NX2", 0, 0xfff, /* NX20, NX200, NX210 */ { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, + { "SAMSUNG NX1000", 0, 0, + { 6933,-2268,-753,-4921,13387,1647,-803,1641,6096 } }, { "SAMSUNG NX", 0, 0, /* NX5, NX10, NX11, NX100 */ { 10332,-3234,-1168,-6111,14639,1520,-1352,2647,8331 } }, { "SAMSUNG WB2000", 0, 0xfff, @@ -6522,6 +6524,8 @@ void CLASS adobe_coeff (const char *make, const char *model) { 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-RX100", 192, 0, /* DJC */ + { 7329,-2746,-405,-2691,9338,3354,-136,1259,5051 } }, { "SONY DSLR-A100", 0, 0xfeb, { 9437,-2811,-774,-8405,16215,2290,-710,596,7181 } }, { "SONY DSLR-A290", 0, 0, @@ -7657,11 +7661,11 @@ konica_400z: raw_width = fsize/height/2; order = 0x4d4d; load_raw = &CLASS unpacked_load_raw; - } else if (!strncmp(model,"NX1",3)) { + } else if (!strcmp(make,"SAMSUNG") && raw_width == 4704) { height -= top_margin = 8; width -= 2 * (left_margin = 8); load_flags = 32; - } else if (!strncmp(model,"NX2",3)) { + } else if (!strcmp(make,"SAMSUNG") && raw_width == 5632) { order = 0x4949; height = 3694; top_margin = 2; @@ -7929,6 +7933,8 @@ wb550: adobe_coeff ("SONY","DSC-R1"); width = 3925; order = 0x4d4d; + } else if (!strcmp(make,"SONY") && raw_width == 5504) { + width -= 8; } else if (!strcmp(make,"SONY") && raw_width == 6048) { width -= 24; } else if (!strcmp(model,"DSLR-A100")) { diff --git a/rtengine/dcraw.patch b/rtengine/dcraw.patch index feffe90ec..a10690d98 100644 --- a/rtengine/dcraw.patch +++ b/rtengine/dcraw.patch @@ -1,5 +1,5 @@ ---- C:/GCC/RT/RTSrc/rtengine/dcraw.c Wed Jul 04 20:53:43 2012 -+++ C:/GCC/RT/RTSrc/rtengine/dcraw.cc Wed Jul 04 21:00:00 2012 +--- C:/GCC/RT/RTSrc/rtengine/dcraw.c Sun Jul 08 22:42:31 2012 ++++ C:/GCC/RT/RTSrc/rtengine/dcraw.cc Sun Jul 08 22:53:12 2012 @@ -1,5 +1,17 @@ +/*RT*/#include +/*RT*/#include @@ -18,20 +18,7 @@ Copyright 1997-2012 by Dave Coffin, dcoffin a cybercom o net This is a command-line ANSI C program to convert raw photos from -@@ -17,31 +29,31 @@ - since Revision 1.237. All other code remains free for all uses. - - *If you have not modified dcraw.c in any way, a link to my - homepage qualifies as "full source code". - -- $Revision: 1.450 $ -- $Date: 2012/06/30 20:36:46 $ -+ $Revision: 1.448 $ -+ $Date: 2012/06/18 19:44:18 $ - */ - --#define DCRAW_VERSION "9.16" -+#define DCRAW_VERSION "9.15" +@@ -27,21 +39,21 @@ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -1288,7 +1275,7 @@ { "Phase One H 20", 0, 0, /* DJC */ { 1313,1855,-109,-6715,15908,808,-327,1840,6020 } }, { "Phase One H 25", 0, 0, -@@ -6933,26 +6542,24 @@ +@@ -6937,26 +6546,24 @@ { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, { "SONY DSLR-A580", 128, 0xfeb, { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, @@ -1327,7 +1314,7 @@ { "SONY NEX", 128, 0, /* NEX-C3, NEX-F3 */ { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, { "SONY SLT-A33", 128, 0, -@@ -6962,15 +6569,15 @@ +@@ -6966,15 +6573,15 @@ { "SONY SLT-A37", 128, 0, { 5991,-1456,-455,-4764,12135,2980,-707,1425,6701 } }, { "SONY SLT-A55", 128, 0, @@ -1338,7 +1325,7 @@ { "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 } } +- { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, + { "SONY SLT-A77", 128, 0, /* RT - Colin Walker */ + { 5126,-830,-261,-4788,12196,2934,-948,1602,7068 } } }; @@ -1346,7 +1333,7 @@ char name[130]; int i, j; -@@ -7214,17 +6821,26 @@ +@@ -7218,17 +6825,26 @@ hlen = get4(); fseek (ifp, 0, SEEK_SET); fread (head, 1, 32, ifp); @@ -1375,7 +1362,7 @@ } else if (!memcmp (head,"\xff\xd8\xff\xe1",4) && !memcmp (head+6,"Exif",4)) { fseek (ifp, 4, SEEK_SET); -@@ -7265,10 +6881,11 @@ +@@ -7269,10 +6885,11 @@ } load_raw = &CLASS unpacked_load_raw; fseek (ifp, 100+28*(shot_select > 0), SEEK_SET); @@ -1387,7 +1374,7 @@ fseek (ifp, 0, SEEK_SET); parse_riff(); } else if (!memcmp (head,"\0\001\0\001\0@",6)) { -@@ -7362,11 +6979,11 @@ +@@ -7366,11 +6983,11 @@ if (height == 2624 && width == 3936) /* Pentax K10D and Samsung GX10 */ { height = 2616; width = 3896; } if (height == 3136 && width == 4864) /* Pentax K20D and Samsung GX20 */ @@ -1400,7 +1387,7 @@ if (width == 4736 && !strcmp(model,"K-7")) { height = 3122; width = 4684; filters = 0x16161616; top_margin = 2; } if (width == 7424 && !strcmp(model,"645D")) -@@ -7766,11 +7383,11 @@ +@@ -7770,11 +7387,11 @@ height -= top_margin; width -= left_margin; } else if (is_canon && raw_width == 5920) { @@ -1413,7 +1400,7 @@ cam_mul[0] *= 256/527.0; cam_mul[2] *= 256/317.0; } else if (!strcmp(model,"D1X")) { -@@ -7795,11 +7412,11 @@ +@@ -7799,11 +7416,11 @@ width -= 42; } else if (!strcmp(model,"D5100") || !strcmp(model,"D7000")) { @@ -1426,7 +1413,7 @@ width -= 52; left_margin = 2; } else if (!strncmp(model,"D40",3) || -@@ -8690,198 +8307,11 @@ +@@ -8696,198 +8313,11 @@ quit: cmsCloseProfile (hInProfile); } @@ -1626,7 +1613,7 @@ ushort tag, type; int count; union { char c[4]; short s[2]; int i; } val; -@@ -8901,572 +8331,13 @@ +@@ -8907,572 +8337,13 @@ int rat[10]; unsigned gps[26]; char desc[512], make[64], model[64], soft[32], date[20], artist[64]; diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 5363d5d77..202da7b11 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -163,12 +163,11 @@ void RawImageSource::eahd_demosaic () { homh[ipx][j] = 0; homv[ipx][j] = 0; } - int sh, sv, idx, idx2; + int sh, sv, idx; for (int j=1; j0 && settings->verbose) @@ -256,7 +256,7 @@ dfInfo *DFManager::addFileInfo(const Glib::ustring &filename ,bool pool ) return false; Glib::RefPtr info = safe_query_file_info(file); if (info && info->get_file_type() != Gio::FILE_TYPE_DIRECTORY && (!info->is_hidden() || !options.fbShowHidden)) { - size_t lastdot = info->get_name().find_last_of ('.'); + size_t lastdot = info->get_name().find_last_of ('.'); if (options.is_extention_enabled(lastdot!=Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){ RawImage ri(filename); int res = ri.loadRaw(false); // Read informations about shot @@ -397,13 +397,16 @@ int DFManager::scanBadPixelsFile( Glib::ustring filename ) { FILE *file = fopen( filename.c_str(),"r" ); if( !file ) return false; - size_t lastdot = filename.find_last_of ('.'); - size_t dirpos1 = filename.find_last_of ('/'); - size_t dirpos2 = filename.find_last_of ('\\'); + size_t lastdot = filename.find_last_of ('.'); + size_t dirpos1 = filename.find_last_of ('/'); + size_t dirpos2 = filename.find_last_of ('\\'); if( dirpos1 == Glib::ustring::npos && dirpos2== Glib::ustring::npos ) dirpos1 =0; - else + else if( dirpos1 != Glib::ustring::npos && dirpos2 != Glib::ustring::npos ) dirpos1= (dirpos1> dirpos2 ? dirpos1: dirpos2); + else if( dirpos1 == Glib::ustring::npos ) + dirpos1= dirpos2; + std::string makmodel(filename,dirpos1+1,lastdot-(dirpos1+1) ); std::list bp; char line[256]; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 50ab3df84..727161c5a 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -71,7 +71,7 @@ void ImProcFunctions::initCache () { gamma2curve(maxindex,0); for (int i=0; ieps_max) { + if (i>Color::eps_max) { cachef[i] = 327.68*( exp(1.0/3.0 * log((double)i / MAXVAL) )); } else { @@ -327,7 +327,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, LUTf & hltone if (sat!=0 || hCurveEnabled || sCurveEnabled || vCurveEnabled) { float h,s,v; - rgb2hsv(r,g,b,h,s,v); + Color::rgb2hsv(r,g,b,h,s,v); if (sat > 0.5) { s = (1-(float)sat/100)*s+(float)sat/100*(1-SQR(SQR(1-min(s,1.0f)))); if (s<0) s=0; @@ -370,7 +370,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, LUTf & hltone } } - hsv2rgb(h,s,v,r,g,b); + Color::hsv2rgb(h,s,v,r,g,b); } float x = toxyz[0][0] * r + toxyz[0][1] * g + toxyz[0][2] * b; @@ -479,9 +479,9 @@ void ImProcFunctions::chrominanceCurve (LabImage* lold, LabImage* lnew, LUTf & a if (params->labCurve.avoidclip) { //Luv limiter float Y,u,v; - Lab2Yuv(lnew->L[i][j],atmp,btmp,Y,u,v); + Color::Lab2Yuv(lnew->L[i][j],atmp,btmp,Y,u,v); //Yuv2Lab includes gamut restriction map - Yuv2Lab(Y,u,v,lnew->L[i][j],lnew->a[i][j],lnew->b[i][j], wp); + Color::Yuv2Lab(Y,u,v,lnew->L[i][j],lnew->a[i][j],lnew->b[i][j], wp); } else { //Luv limiter only @@ -740,6 +740,7 @@ fclose(f);*/ return; } + // compute clipping points based on the original histograms (linear, without exp comp.) int clipped = 0; int rawmax = (imax) - 1; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index e62663eef..5672c8551 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -36,7 +36,7 @@ namespace rtengine { using namespace procparams; - class ImProcFunctions : public Color { +class ImProcFunctions { static LUTf gamma2curve; diff --git a/rtengine/init.cc b/rtengine/init.cc index eb51703f5..e3d5d4f2a 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -18,7 +18,6 @@ */ #include "rtengine.h" #include "iccstore.h" -#include "color.h" #include "dcp.h" #include "improcfun.h" #include "improccoordinator.h" @@ -57,6 +56,7 @@ int init (const Settings* s, Glib::ustring baseDir) { void cleanup () { ProcParams::cleanup (); + Color::cleanup (); ImProcFunctions::cleanupCache (); Thumbnail::cleanupGamma (); } diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 4e62cfe88..05e501c07 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -74,9 +74,9 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) { fx = (0.002 * ra[j]) / 327.68 + fy; fz = fy - (0.005 * rb[j]) / 327.68; - x_ = f2xyz(fx)*Color::D50x; - y_ = f2xyz(fy); - z_ = f2xyz(fz)*Color::D50z; + x_ = Color::f2xyz(fx)*Color::D50x; + y_ = Color::f2xyz(fy); + z_ = Color::f2xyz(fz)*Color::D50z; buffer[iy++] = (unsigned short)CLIP(x_* MAXVAL+0.5); buffer[iy++] = (unsigned short)CLIP(y_* MAXVAL+0.5); @@ -108,11 +108,11 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) { fx = (0.002 * ra[j]) / 327.68 + fy; fz = fy - (0.005 * rb[j]) / 327.68; - x_ = 65535.0 * f2xyz(fx)*Color::D50x; - y_ = 65535.0 * f2xyz(fy); - z_ = 65535.0 * f2xyz(fz)*Color::D50z; + x_ = 65535.0 * Color::f2xyz(fx)*Color::D50x; + y_ = 65535.0 * Color::f2xyz(fy); + z_ = 65535.0 * Color::f2xyz(fz)*Color::D50z; - xyz2srgb(x_,y_,z_,R,G,B); + Color::xyz2srgb(x_,y_,z_,R,G,B); /* copy RGB */ //int R1=((int)gamma2curve[(R)]) @@ -165,9 +165,9 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, float fx = (0.002 * ra[j])/327.68 + fy; float fz = fy - (0.005 * rb[j])/327.68; - float x_ = 65535.0 * f2xyz(fx)*Color::D50x; - float y_ = 65535.0 * f2xyz(fy); - float z_ = 65535.0 * f2xyz(fz)*Color::D50z; + float x_ = 65535.0 * Color::f2xyz(fx)*Color::D50x; + float y_ = 65535.0 * Color::f2xyz(fy); + float z_ = 65535.0 * Color::f2xyz(fz)*Color::D50z; buffer[iy++] = CLIP((int)(x_+0.5)); buffer[iy++] = CLIP((int)(y_+0.5)); @@ -205,9 +205,9 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, float fx = (0.002 * ra[j])/327.68 + fy; float fz = fy - (0.005 * rb[j])/327.68; - float x_ = 65535.0 * f2xyz(fx)*Color::D50x; - float y_ = 65535.0 * f2xyz(fy); - float z_ = 65535.0 * f2xyz(fz)*Color::D50z; + float x_ = 65535.0 * Color::f2xyz(fx)*Color::D50x; + float y_ = 65535.0 * Color::f2xyz(fy); + float z_ = 65535.0 * Color::f2xyz(fz)*Color::D50z; Color::xyz2rgb(x_,y_,z_,R,G,B,rgb_xyz); @@ -249,9 +249,9 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int float fx = (0.002 * ra[j])/327.68 + fy; float fz = fy - (0.005 * rb[j])/327.68; - float x_ = 65535.0 * f2xyz(fx)*Color::D50x; - float y_ = 65535.0 * f2xyz(fy); - float z_ = 65535.0 * f2xyz(fz)*Color::D50z; + float x_ = 65535.0 * Color::f2xyz(fx)*Color::D50x; + float y_ = 65535.0 * Color::f2xyz(fy); + float z_ = 65535.0 * Color::f2xyz(fz)*Color::D50z; xa[j-cx] = CLIP((int)(x_+0.5)); ya[j-cx] = CLIP((int)(y_+0.5)); @@ -280,11 +280,11 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int float fx = (0.002 * ra[j])/327.68 + fy; float fz = fy - (0.005 * rb[j])/327.68; - float x_ = 65535.0 * f2xyz(fx)*Color::D50x; - float y_ = 65535.0 * f2xyz(fy); - float z_ = 65535.0 * f2xyz(fz)*Color::D50z; + float x_ = 65535.0 * Color::f2xyz(fx)*Color::D50x; + float y_ = 65535.0 * Color::f2xyz(fy); + float z_ = 65535.0 * Color::f2xyz(fz)*Color::D50z; - xyz2srgb(x_,y_,z_,R,G,B); + Color::xyz2srgb(x_,y_,z_,R,G,B); image->r[i-cy][j-cx] = (int)gamma2curve[CLIP(R)]; image->g[i-cy][j-cx] = (int)gamma2curve[CLIP(G)]; @@ -388,9 +388,9 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int float fx = (0.002 * ra[j])/327.68 + fy; float fz = fy - (0.005 * rb[j])/327.68; - float x_ = 65535.0 * f2xyz(fx)*D50x; - float y_ = 65535.0 * f2xyz(fy); - float z_ = 65535.0 * f2xyz(fz)*D50z; + float x_ = 65535.0 * Color::f2xyz(fx)*Color::D50x; + float y_ = 65535.0 * Color::f2xyz(fy); + float z_ = 65535.0 * Color::f2xyz(fz)*Color::D50z; xa[j-cx] = CLIP((int)x_); ya[j-cx] = CLIP((int)y_); @@ -419,11 +419,11 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int float fx = (0.002 * ra[j])/327.68 + fy; float fz = fy - (0.005 * rb[j])/327.68; - float x_ = 65535.0 * f2xyz(fx)*D50x; - float y_ = 65535.0 * f2xyz(fy); - float z_ = 65535.0 * f2xyz(fz)*D50z; + float x_ = 65535.0 * Color::f2xyz(fx)*Color::D50x; + float y_ = 65535.0 * Color::f2xyz(fy); + float z_ = 65535.0 * Color::f2xyz(fz)*Color::D50z; - xyz2srgb(x_,y_,z_,R,G,B); + Color::xyz2srgb(x_,y_,z_,R,G,B); image->r[i-cy][j-cx] = (int)gamma2curve[CLIP(R)]; image->g[i-cy][j-cx] = (int)gamma2curve[CLIP(G)]; diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc index f830d785c..af06a172a 100644 --- a/rtengine/ipvibrance.cc +++ b/rtengine/ipvibrance.cc @@ -2145,9 +2145,9 @@ void ImProcFunctions::vibrance (LabImage* lab) { fx = (0.002 * aprov1) + fy; fz = fy - (0.005 * bprov1); - x_ = 65535.0 * f2xyz(fx)*Color::D50x; - y_ = 65535.0 * f2xyz(fy); - z_ = 65535.0 * f2xyz(fz)*Color::D50z; + x_ = 65535.0 * Color::f2xyz(fx)*Color::D50x; + y_ = 65535.0 * Color::f2xyz(fy); + z_ = 65535.0 * Color::f2xyz(fz)*Color::D50z; Color::xyz2rgb(x_,y_,z_,R,G,B,wip); // gamut control before saturation to put Lab values in future gamut, but not RGB @@ -2323,9 +2323,9 @@ void ImProcFunctions::vibrance (LabImage* lab) { fxx = (0.002 * aprovn) + fyy; fzz = fyy - (0.005 * bprovn); - xx_ = 65535.0 * f2xyz(fxx)*Color::D50x; - yy_ = 65535.0 * f2xyz(fyy); - zz_ = 65535.0 * f2xyz(fzz)*Color::D50z; + xx_ = 65535.0 * Color::f2xyz(fxx)*Color::D50x; + yy_ = 65535.0 * Color::f2xyz(fyy); + zz_ = 65535.0 * Color::f2xyz(fzz)*Color::D50z; Color::xyz2rgb(xx_,yy_,zz_,RR,GG,BB,wip); if(RR<0.0 || GG < 0.0 || BB < 0.0) { diff --git a/rtengine/lcp.cc b/rtengine/lcp.cc index 4fdecb19a..3982675bf 100644 --- a/rtengine/lcp.cc +++ b/rtengine/lcp.cc @@ -236,7 +236,7 @@ LCPProfile::LCPProfile(Glib::ustring fname) { isFisheye=inCamProfiles=firstLIDone=inPerspect=inAlternateLensID=false; sensorFormatFactor=1; for (int i=0;i(pLCPProfile); bool parseAttr=false; + if (*pProf->inInvalidTag) return; // We ignore everything in dirty tag till it's gone + // clean up tagname const char* src=strrchr(el,':'); if (src==NULL) src=const_cast(el); else src++; strcpy(pProf->lastTag,src); + if (!strcmp("VignetteModelPiecewiseParam",src)) strcpy(pProf->inInvalidTag,src); + if (!strcmp("CameraProfiles",src)) pProf->inCamProfiles=true; if (!strcmp("AlternateLensIDs",src)) pProf->inAlternateLensID=true; if (!pProf->inCamProfiles || pProf->inAlternateLensID) return; @@ -516,7 +520,7 @@ void XMLCALL LCPProfile::XmlStartHandler(void *pLCPProfile, const char *el, cons void XMLCALL LCPProfile::XmlTextHandler(void *pLCPProfile, const XML_Char *s, int len) { LCPProfile *pProf=static_cast(pLCPProfile); - if (!pProf->inCamProfiles || pProf->inAlternateLensID) return; + if (!pProf->inCamProfiles || pProf->inAlternateLensID || *pProf->inInvalidTag) return; // Check if it contains non-whitespaces (there are several calls to this for one tag unfortunately) bool onlyWhiteSpace=true; @@ -599,6 +603,12 @@ void XMLCALL LCPProfile::XmlTextHandler(void *pLCPProfile, const XML_Char *s, in void XMLCALL LCPProfile::XmlEndHandler(void *pLCPProfile, const char *el) { LCPProfile *pProf=static_cast(pLCPProfile); + // We ignore everything in dirty tag till it's gone + if (*pProf->inInvalidTag) { + if (strstr(el,pProf->inInvalidTag)) *pProf->inInvalidTag=0; + return; + } + if (strstr(el,":CameraProfiles")) pProf->inCamProfiles=false; if (strstr(el,":AlternateLensIDs")) pProf->inAlternateLensID=false; diff --git a/rtengine/lcp.h b/rtengine/lcp.h index e17db1b78..71d71c3e5 100644 --- a/rtengine/lcp.h +++ b/rtengine/lcp.h @@ -63,7 +63,7 @@ namespace rtengine { class LCPProfile { // Temporary data for parsing bool inCamProfiles,firstLIDone,inPerspect,inAlternateLensID; - char lastTag[256]; + char lastTag[256],inInvalidTag[256]; LCPPersModel* pCurPersModel; LCPModelCommon* pCurCommon; diff --git a/rtengine/rawimagesource_i.h b/rtengine/rawimagesource_i.h index 7c4277a15..30e3ef633 100644 --- a/rtengine/rawimagesource_i.h +++ b/rtengine/rawimagesource_i.h @@ -21,7 +21,7 @@ #define RAWIMAGESOURCE_I_H_INCLUDED #include "rawimagesource.h" -//include "rt_math.h" + #include "curves.h" namespace rtengine { diff --git a/rtengine/safegtk.cc b/rtengine/safegtk.cc index 922c4c330..c0cf1e4d3 100644 --- a/rtengine/safegtk.cc +++ b/rtengine/safegtk.cc @@ -97,6 +97,48 @@ Glib::RefPtr safe_query_file_info (Glib::RefPtr &file) # define SAFE_ENUMERATOR_CODE_END } if (error.get()) printf ("%s\n", error->what().c_str());}while (0) #endif +#ifdef WIN32 + +// High speed Windows version +void safe_build_file_list (Glib::RefPtr &dir, std::vector &flist) +{ + Glib::ustring fullPath=dir->get_path() + Glib::ustring("\\*"); + + DWORD dwVersion=GetVersion(); + bool win7Plus=(LOBYTE(LOWORD(dwVersion))>6) || ((LOBYTE(LOWORD(dwVersion))==6) && HIBYTE(LOWORD(dwVersion))>=1); // 6.1 or better + + wchar_t *wDirName = (wchar_t*)g_utf8_to_utf16 (fullPath.c_str(), -1, NULL, NULL, NULL); + WIN32_FIND_DATAW fi; + + HANDLE hFF=FindFirstFileExW(wDirName, + //win7Plus ? FindExInfoBasic : // TODO: Add if MinGW is updated, makes it even faster + FindExInfoStandard,&fi, + FindExSearchNameMatch,NULL, + win7Plus ? 2 : 0); // Win7 large fetch + + if (hFF != INVALID_HANDLE_VALUE) { + do { + SYSTEMTIME stUTC; + FileTimeToSystemTime(&fi.ftLastWriteTime, &stUTC); + char time[64]; + sprintf(time,"%d-%02d-%02dT%02d:%02d:%02dZ",stUTC.wYear,stUTC.wMonth,stUTC.wDay,stUTC.wHour,stUTC.wMinute,stUTC.wSecond); + Glib::TimeVal timeVal; + timeVal.assign_from_iso8601(Glib::ustring(time)); + + char pathA[MAX_PATH]; + WideCharToMultiByte(CP_UTF8,0,(WCHAR*)fi.cFileName,-1,pathA,MAX_PATH,0,0); + flist.push_back (FileMTimeInfo (removeExtension(Glib::ustring(pathA)), timeVal)); + + } while (FindNextFileW(hFF, &fi)); + + FindClose(hFF); + } + + g_free(wDirName); +} +#else + +// Generic file list build void safe_build_file_list (Glib::RefPtr &dir, std::vector &flist) { Glib::RefPtr dirList; @@ -106,7 +148,7 @@ void safe_build_file_list (Glib::RefPtr &dir, std::vector