From 463c5e613ebd1839083406047c029a1aa0fe2b96 Mon Sep 17 00:00:00 2001 From: jc-frisch Date: Tue, 12 Apr 2011 10:25:17 +0200 Subject: [PATCH] One more patch toward Default --- rtengine/hlmultipliers.cc | 7 +++- rtengine/hlrecovery.cc | 4 +- rtengine/improcfun.cc | 8 +--- rtengine/myfile.cc | 3 +- rtengine/myfile.h | 4 ++ rtengine/procevents.h | 81 ++++++++++++++++++------------------- rtengine/procparams.cc | 78 +++++++++++++++++++----------------- rtengine/rawimagesource.h | 82 +++++++++++++++++++------------------- rtengine/refreshmap.cc | 28 ++++++------- rtengine/rtengine.h | 12 +++--- rtengine/stdimagesource.cc | 16 +++++++- 11 files changed, 169 insertions(+), 154 deletions(-) diff --git a/rtengine/hlmultipliers.cc b/rtengine/hlmultipliers.cc index 2f66d79ce..6347c0d90 100644 --- a/rtengine/hlmultipliers.cc +++ b/rtengine/hlmultipliers.cc @@ -20,6 +20,7 @@ #include #include #include +#include #define MAXVAL 0xffff #define CLIP(a) ((a)>0?((a)chmixer.green[0]!=0 || params->chmixer.green[1]!=100 || params->chmixer.green[2]!=0 || \ params->chmixer.blue[0]!=0 || params->chmixer.blue[1]!=0 || params->chmixer.blue[2]!=100); -// int mapval; -// double factor; int tW = working->width; int tH = working->height; -// int r, g, b; -// float h, s, v; -// float satparam,valparam; -// int hue, hueband, hueres, nbrband; double pi = M_PI; FlatCurve* hCurve; FlatCurve* sCurve; @@ -264,7 +258,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, LUTf & hltone float* cossq = new float [8192]; for (int i=0; i<8192; i++) - cossq[i] = SQR(cos(pi*(float)i/16384)); + cossq[i] = SQR(cos(pi*(float)i/16384.0)); FlatCurveType hCurveType = (FlatCurveType)params->hsvequalizer.hcurve.at(0); FlatCurveType sCurveType = (FlatCurveType)params->hsvequalizer.scurve.at(0); diff --git a/rtengine/myfile.cc b/rtengine/myfile.cc index d73772502..ff92d408c 100644 --- a/rtengine/myfile.cc +++ b/rtengine/myfile.cc @@ -19,6 +19,7 @@ #include #include #include +#include #ifdef RAWZOR_SUPPORT #include #endif @@ -65,7 +66,7 @@ int munmap(void *start, size_t length) IMFILE* fopen (const char* fname) { - int fd = ::open(fname,O_RDONLY); + int fd = safe_open_ReadOnly(fname); if ( fd < 0 ) return 0; diff --git a/rtengine/myfile.h b/rtengine/myfile.h index c8ed35a85..2222eab37 100644 --- a/rtengine/myfile.h +++ b/rtengine/myfile.h @@ -44,6 +44,7 @@ inline int feof (IMFILE* f) { } inline void fseek (IMFILE* f, int p, int how) { + int fpos = f->pos; if (how==SEEK_SET) f->pos = p; @@ -51,6 +52,9 @@ inline void fseek (IMFILE* f, int p, int how) { f->pos += p; else if (how==SEEK_END) f->pos = f->size-p; + + if (f->pos < 0 || f->pos> f->size) + f->pos = fpos; } inline int fgetc (IMFILE* f) { diff --git a/rtengine/procevents.h b/rtengine/procevents.h index c15b5be29..1228d0f82 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -89,10 +89,10 @@ enum ProcEvent { EvCACorr=64, EvHREnabled=65, EvHRAmount=66, - EvHRMethod=67, - EvWProfile=68, - EvOProfile=69, - EvIProfile=70, + EvHRMethod=67, + EvWProfile=68, + EvOProfile=69, + EvIProfile=70, EvVignetting=71, EvChMixer=72, EvResizeScale=73, @@ -113,50 +113,47 @@ enum ProcEvent { EvDPDNEnabled=88, EvDPDNLuma=89, EvDPDNChroma=90, - EvDPDNGamma=91, - EvDirPyrEqualizer=92, + EvDPDNGamma=91, + EvDirPyrEqualizer=92, EvDirPyrEqlEnabled=93, - EvLSaturation=94, + EvLSaturation=94, EvLaCurve=95, EvLbCurve=96, EvDemosaicMethod=97, EvPreProcessHotDeadPixel=98, - EvSaturation=99, - EvHSVEqualizerH=100, - EvHSVEqualizerS=101, - EvHSVEqualizerV=102, - EvHSVEqEnabled=103, - EvDefringeEnabled=104, - EvDefringeRadius=105, - EvDefringeThreshold=106, - - EvResizeBoundingBox=107, - EvResizeAppliesTo=108, - - EvLAvoidClip=109, - EvLSatLimiter=110, - EvLSatLimit=111, - EvDemosaicDCBIter=112, - EvDemosaicFalseColorIter=113, - EvDemosaicDCBEnhanced=114, - EvPreProcessCARed=115, - EvPreProcessCABlue=116, - EvPreProcessLineDenoise=117, - EvPreProcessGEquilThresh=118, - EvPreProcessAutoCA=119, - EvPreProcessAutoDF=120, - EvPreProcessDFFile=121, - EvFlatFieldFile=122, - EvFlatFieldAutoSelect=123, - EvFlatFieldBlurRadius=124, - EvFlatFieldBlurType=125, - EvHLComprThreshold=126, - - EvDPDNLumCurve=127, - EvDPDNChromCurve=128, + EvSaturation=99, + EvHSVEqualizerH=100, + EvHSVEqualizerS=101, + EvHSVEqualizerV=102, + EvHSVEqEnabled=103, + EvDefringeEnabled=104, + EvDefringeRadius=105, + EvDefringeThreshold=106, + EvHLComprThreshold=107, + EvResizeBoundingBox=108, + EvResizeAppliesTo=109, + EvLAvoidClip=110, + EvLSatLimiter=111, + EvLSatLimit=112, + EvDemosaicDCBIter=113, + EvDemosaicFalseColorIter=114, + EvDemosaicDCBEnhanced=115, + EvPreProcessCARed=116, + EvPreProcessCABlue=117, + EvPreProcessLineDenoise=118, + EvPreProcessGEquilThresh=119, + EvPreProcessAutoCA=120, + EvPreProcessAutoDF=121, + EvPreProcessDFFile=122, + EvPreProcessExpCorrLinear=123, + EvPreProcessExpCorrPH=124, + EvFlatFieldFile=125, + EvFlatFieldAutoSelect=126, + EvFlatFieldBlurRadius=127, + EvFlatFieldBlurType=128, EvAutoDIST=129, - EvPreProcessExpCorrLinear=130, - EvPreProcessExpCorrPH=131, + EvDPDNLumCurve=130, + EvDPDNChromCurve=131, NUMOFEVENTS=132 }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 8519d1bd1..a583a97e7 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -59,22 +59,26 @@ void ProcParams::setDefaults () { toneCurve.expcomp = 0; toneCurve.brightness = 0; toneCurve.contrast = 0; - toneCurve.saturation = 0; + toneCurve.saturation = 0; toneCurve.black = 0; toneCurve.hlcompr = 70; toneCurve.hlcomprthresh = 0; toneCurve.shcompr = 25; toneCurve.curve.clear (); + toneCurve.curve.push_back(DCT_Linear); labCurve.brightness = 0; labCurve.contrast = 0; - labCurve.saturation = 0; - labCurve.avoidclip = false; + labCurve.saturation = 0; + labCurve.avoidclip = false; labCurve.enable_saturationlimiter = false; - labCurve.saturationlimit = 50; + labCurve.saturationlimit = 50; labCurve.lcurve.clear (); - labCurve.acurve.clear (); + labCurve.lcurve.push_back(DCT_Linear); + labCurve.acurve.clear (); + labCurve.acurve.push_back(DCT_Linear); labCurve.bcurve.clear (); + labCurve.bcurve.push_back(DCT_Linear); sharpening.enabled = true; sharpening.radius = 1.0; @@ -112,21 +116,21 @@ void ProcParams::setDefaults () { colorDenoise.radius = 1.9; colorDenoise.edgetolerance = 2000; - impulseDenoise.enabled = false; - impulseDenoise.thresh = 50; + impulseDenoise.enabled = false; + impulseDenoise.thresh = 50; - defringe.enabled = false; - defringe.radius = 2.0; - defringe.threshold = 25; + defringe.enabled = false; + defringe.radius = 2.0; + defringe.threshold = 25; - dirpyrDenoise.enabled = false; + dirpyrDenoise.enabled = false; dirpyrDenoise.luma = 10; - dirpyrDenoise.chroma = 10; - dirpyrDenoise.gamma = 2.0; - dirpyrDenoise.lumcurve.clear (); - dirpyrDenoise.lumcurve.push_back (DCT_Linear); - dirpyrDenoise.chromcurve.clear (); - dirpyrDenoise.chromcurve.push_back (DCT_Linear); + dirpyrDenoise.chroma = 10; + dirpyrDenoise.gamma = 2.0; + dirpyrDenoise.lumcurve.clear (); + dirpyrDenoise.lumcurve.push_back (DCT_Linear); + dirpyrDenoise.chromcurve.clear (); + dirpyrDenoise.chromcurve.push_back (DCT_Linear); sh.enabled = false; sh.hq = false; @@ -206,29 +210,29 @@ void ProcParams::setDefaults () { { dirpyrequalizer.mult[i] = 1.0; } - dirpyrequalizer.mult[4] = 0.0; - hsvequalizer.hcurve.clear (); - hsvequalizer.hcurve.push_back (FCT_Linear); - hsvequalizer.scurve.clear (); - hsvequalizer.scurve.push_back (FCT_Linear); - hsvequalizer.vcurve.clear (); - hsvequalizer.vcurve.push_back (FCT_Linear); + dirpyrequalizer.mult[4] = 0.0; + hsvequalizer.hcurve.clear (); + hsvequalizer.hcurve.push_back (FCT_Linear); + hsvequalizer.scurve.clear (); + hsvequalizer.scurve.push_back (FCT_Linear); + hsvequalizer.vcurve.clear (); + hsvequalizer.vcurve.push_back (FCT_Linear); raw.df_autoselect = false; raw.ff_AutoSelect = false; raw.ff_BlurRadius = 32; raw.ff_BlurType = RAWParams::ff_BlurTypestring[RAWParams::area_ff]; raw.cared = 0; - raw.cablue = 0; + raw.cablue = 0; raw.ca_autocorrect = false; raw.hotdeadpix_filt = false; - raw.hotdeadpix_thresh = 40; + raw.hotdeadpix_thresh = 40; raw.linenoise = 0; raw.greenthresh = 0; raw.ccSteps = 1; raw.dmethod = RAWParams::methodstring[RAWParams::hphd];; raw.dcb_iterations=2; raw.dcb_enhance=false; - // exposure before interpolation + // exposure before interpolation raw.expos=1.0; raw.preser=0.0; @@ -449,10 +453,10 @@ int ProcParams::save (Glib::ustring fname) const { keyFile.set_integer ("RAW", "FlatFieldBlurRadius", raw.ff_BlurRadius ); keyFile.set_string ("RAW", "FlatFieldBlurType", raw.ff_BlurType ); keyFile.set_boolean ("RAW", "CA", raw.ca_autocorrect ); - keyFile.set_double ("RAW", "CARed", raw.cared ); + keyFile.set_double ("RAW", "CARed", raw.cared ); keyFile.set_double ("RAW", "CABlue", raw.cablue ); - keyFile.set_boolean ("RAW", "HotDeadPixels", raw.hotdeadpix_filt ); - keyFile.set_integer ("RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh ); + keyFile.set_boolean ("RAW", "HotDeadPixels", raw.hotdeadpix_filt ); + keyFile.set_integer ("RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh ); keyFile.set_integer ("RAW", "LineDenoise", raw.linenoise); keyFile.set_integer ("RAW", "GreenEqThreshold", raw.greenthresh); keyFile.set_integer ("RAW", "CcSteps", raw.ccSteps); @@ -956,10 +960,10 @@ bool ProcParams::operator== (const ProcParams& other) { && resize.height == other.resize.height && raw.dark_frame == other.raw.dark_frame && raw.df_autoselect == other.raw.df_autoselect - && raw.ff_file == other.raw.ff_file - && raw.ff_AutoSelect == other.raw.ff_AutoSelect - && raw.ff_BlurRadius == other.raw.ff_BlurRadius - && raw.ff_BlurType == other.raw.ff_BlurType + && raw.ff_file == other.raw.ff_file + && raw.ff_AutoSelect == other.raw.ff_AutoSelect + && raw.ff_BlurRadius == other.raw.ff_BlurRadius + && raw.ff_BlurType == other.raw.ff_BlurType && raw.dcb_enhance == other.raw.dcb_enhance && raw.dcb_iterations == other.raw.dcb_iterations && raw.ccSteps == other.raw.ccSteps @@ -976,9 +980,9 @@ bool ProcParams::operator== (const ProcParams& other) { && icm.output == other.icm.output && equalizer == other.equalizer && dirpyrequalizer == other.dirpyrequalizer - && hsvequalizer.hcurve == other.hsvequalizer.hcurve - && hsvequalizer.scurve == other.hsvequalizer.scurve - && hsvequalizer.vcurve == other.hsvequalizer.vcurve + && hsvequalizer.hcurve == other.hsvequalizer.hcurve + && hsvequalizer.scurve == other.hsvequalizer.scurve + && hsvequalizer.vcurve == other.hsvequalizer.vcurve && exif==other.exif && iptc==other.iptc && raw.expos==other.raw.expos diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 65ed2556e..52e6ac9cb 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -27,9 +27,9 @@ namespace rtengine { template void freeArray (T** a, int H) { - //for (int i=0; i T** allocArray (int W, int H) { @@ -51,7 +51,7 @@ class RawImageSource : public ImageSource { protected: Glib::Mutex isrcMutex; - + int W, H; ColorTemp wb; ProgressListener* plistener; @@ -75,8 +75,8 @@ class RawImageSource : public ImageSource { double defGain; //int blcode[16][16][32]; // Looks like it's an unused variable... bool full; - cmsHPROFILE camProfile; - cmsHPROFILE embProfile; + cmsHPROFILE camProfile; + cmsHPROFILE embProfile; RawImage* ri; // Copy of raw pixels @@ -85,7 +85,7 @@ class RawImageSource : public ImageSource { double* cache; int threshold; - float** rawData; // holds pixel values, data[i][j] corresponds to the ith row and jth column + float** rawData; // holds pixel values, data[i][j] corresponds to the ith row and jth column // the interpolated green plane: float** green; @@ -93,8 +93,8 @@ class RawImageSource : public ImageSource { float** red; // the interpolated blue plane: float** blue; - - + + void hphd_vertical (float** hpmap, int col_from, int col_to); void hphd_horizontal (float** hpmap, int row_from, int row_to); void hphd_green (float** hpmap); @@ -112,13 +112,13 @@ class RawImageSource : public ImageSource { public: RawImageSource (); ~RawImageSource (); - + int load (Glib::ustring fname, bool batch = false); void preprocess (const RAWParams &raw); void demosaic (const RAWParams &raw); void copyOriginalPixels(const RAWParams &raw, RawImage *ri, RawImage *riDark, RawImage *riFlatFile ); - void cfaboxblur (RawImage *riFlatFile, float* cfablur, int boxH, int boxW ); - void scaleColors (int winx,int winy,int winw,int winh ); + void cfaboxblur (RawImage *riFlatFile, float* cfablur, int boxH, int boxW ); + void scaleColors (int winx,int winy,int winw,int winh ); void getImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, HRecParams hrp, ColorManagementParams cmp, RAWParams raw); ColorTemp getWB () { return wb; } ColorTemp getAutoWB (); @@ -135,8 +135,8 @@ class RawImageSource : public ImageSource { int getAEHistogram (LUTu & histogram, int& histcompr); static void colorSpaceConversion16 (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], double& defgain); - static void colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], double& defgain); - static void inverse33 (double (*coeff)[3], double (*icoeff)[3]); + static void colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], double& defgain); + static void inverse33 (double (*coeff)[3], double (*icoeff)[3]); static void HLRecovery_Luminance (float* rin, float* gin, float* bin, float* rout, float* gout, float* bout, int width, float maxval); static void HLRecovery_CIELab (float* rin, float* gin, float* bin, float* rout, float* gout, float* bout, int width, float maxval, double cam[3][3], double icam[3][3]); @@ -152,47 +152,47 @@ class RawImageSource : public ImageSource { inline void interpolate_row_rb (float* ar, float* ab, float* pg, float* cg, float* ng, int i); inline void interpolate_row_rb_mul_pp (float* ar, float* ab, float* pg, float* cg, float* ng, int i, double r_mul, double g_mul, double b_mul, int x1, int width, int skip); - int LinEqSolve( int nDim, float* pfMatr, float* pfVect, float* pfSolution);//Emil's CA auto correction - void CA_correct_RT (double cared, double cablue); - void ddct8x8s(int isgn, float **a); - void exp_bef (float expos, float preser); // exposure before interpolation + int LinEqSolve( int nDim, float* pfMatr, float* pfVect, float* pfSolution);//Emil's CA auto correction + void CA_correct_RT (double cared, double cablue); + void ddct8x8s(int isgn, float **a); + void exp_bef (float expos, float preser); // exposure before interpolation - int cfaCleanFromMap( PixelsMap &bitmapBads ); - int findHotDeadPixel( PixelsMap &bpMap, float thresh); + int cfaCleanFromMap( PixelsMap &bitmapBads ); + int findHotDeadPixel( PixelsMap &bpMap, float thresh); - void cfa_linedn (float linenoiselevel);//Emil's line denoise + void cfa_linedn (float linenoiselevel);//Emil's line denoise - void green_equilibrate (float greenthresh);//Emil's green equilibration + void green_equilibrate (float greenthresh);//Emil's green equilibration - void nodemosaic(); + void nodemosaic(); void eahd_demosaic(); void hphd_demosaic(); void vng4_demosaic(); void ppg_demosaic(); - void amaze_demosaic_RT(int winx, int winy, int winw, int winh);//Emil's code for AMaZE - void fast_demo(int winx, int winy, int winw, int winh);//Emil's code for fast demosaicing + void amaze_demosaic_RT(int winx, int winy, int winw, int winh);//Emil's code for AMaZE + void fast_demo(int winx, int winy, int winw, int winh);//Emil's code for fast demosaicing void dcb_demosaic(int iterations, int dcb_enhance); void ahd_demosaic(int winx, int winy, int winw, int winh); - void border_interpolate(int border, float (*image)[4], int start = 0, int end = 0); - void dcb_initTileLimits(int &colMin, int &rowMin, int &colMax, int &rowMax, int x0, int y0, int border); - void fill_raw( ushort (*cache )[4], int x0, int y0, float** rawData); - void fill_border( ushort (*cache )[4], int border, int x0, int y0); - void copy_to_buffer(ushort (*image2)[3], ushort (*image)[4]); - void dcb_hid(ushort (*image)[4], ushort (*bufferH)[3], ushort (*bufferV)[3], int x0, int y0); - void dcb_color(ushort (*image)[4], int x0, int y0); - void dcb_hid2(ushort (*image)[4], int x0, int y0); - void dcb_map(ushort (*image)[4], int x0, int y0); - void dcb_correction(ushort (*image)[4], int x0, int y0); - void dcb_pp(ushort (*image)[4], int x0, int y0); - void dcb_correction2(ushort (*image)[4], int x0, int y0); - void restore_from_buffer(ushort (*image)[4], ushort (*image2)[3]); - void dcb_refinement(ushort (*image)[4], int x0, int y0); - void dcb_color_full(ushort (*image)[4], int x0, int y0, float (*chroma)[2]); + void border_interpolate(int border, float (*image)[4], int start = 0, int end = 0); + void dcb_initTileLimits(int &colMin, int &rowMin, int &colMax, int &rowMax, int x0, int y0, int border); + void fill_raw( ushort (*cache )[4], int x0, int y0, float** rawData); + void fill_border( ushort (*cache )[4], int border, int x0, int y0); + void copy_to_buffer(ushort (*image2)[3], ushort (*image)[4]); + void dcb_hid(ushort (*image)[4], ushort (*bufferH)[3], ushort (*bufferV)[3], int x0, int y0); + void dcb_color(ushort (*image)[4], int x0, int y0); + void dcb_hid2(ushort (*image)[4], int x0, int y0); + void dcb_map(ushort (*image)[4], int x0, int y0); + void dcb_correction(ushort (*image)[4], int x0, int y0); + void dcb_pp(ushort (*image)[4], int x0, int y0); + void dcb_correction2(ushort (*image)[4], int x0, int y0); + void restore_from_buffer(ushort (*image)[4], ushort (*image2)[3]); + void dcb_refinement(ushort (*image)[4], int x0, int y0); + void dcb_color_full(ushort (*image)[4], int x0, int y0, float (*chroma)[2]); void transLine (float* red, float* green, float* blue, int i, Imagefloat* image, int tran, int imw, int imh, int fw); void hflip (Imagefloat* im); - void vflip (Imagefloat* im); - + void vflip (Imagefloat* im); + }; }; #endif diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 684bf24db..9fa462e67 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -127,11 +127,12 @@ RGBCURVE, // EvHSVEqEnabled, DEFRINGE, // EvDefringeEnabled, DEFRINGE, // EvDefringeRadius, DEFRINGE, // EvDefringeThreshold, +RGBCURVE, // EvHLComprThreshold, RESIZE, // EvResizeBoundingBox -RESIZE, // EvResizeAppliesTo - LUMINANCECURVE, // EvCBAvoidClip, - LUMINANCECURVE, // EvCBSatLimiter, - LUMINANCECURVE, // EvCBSatLimit, +RESIZE, // EvResizeAppliesTo +LUMINANCECURVE, // EvCBAvoidClip, +LUMINANCECURVE, // EvCBSatLimiter, +LUMINANCECURVE, // EvCBSatLimit, DEMOSAIC, // EvDemosaicDCBIter DEMOSAIC, // EvDemosaicFalseColorIter DEMOSAIC, // EvDemosaicDCBEnhanced @@ -142,16 +143,15 @@ DARKFRAME, // EvPreProcessGEquilThresh DARKFRAME, // EvPreProcessAutoCA DARKFRAME, // EvPreProcessAutoDF DARKFRAME, // EvPreProcessDFFile - FLATFIELD, // EvFlatFieldFile, - FLATFIELD, // EvFlatFieldAutoSelect, - FLATFIELD, // EvFlatFieldBlurRadius, - FLATFIELD, // EvFlatFieldBlurType, -RGBCURVE, // EvHLComprThreshold, - DIRPYRDENOISE, // EvDPDNLumCurve, - DIRPYRDENOISE, // EvDPDNChromCurve, - TRANSFORM, // EvAutoDIST - DARKFRAME, // EvPreProcessExpCorrLinear - DARKFRAME, // EvPreProcessExpCorrPH +DARKFRAME, // EvPreProcessExpCorrLinear +DARKFRAME, // EvPreProcessExpCorrPH +FLATFIELD, // EvFlatFieldFile, +FLATFIELD, // EvFlatFieldAutoSelect, +FLATFIELD, // EvFlatFieldBlurRadius, +FLATFIELD, // EvFlatFieldBlurType, +TRANSFORM, // EvAutoDIST, +DIRPYRDENOISE, // EvDPDNLumCurve, +DIRPYRDENOISE, // EvDPDNChromCurve, }; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 6725109b4..52fca7fd7 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -223,10 +223,11 @@ namespace rtengine { public: /** Sets the window defining the crop. */ virtual void setWindow (int cx, int cy, int cw, int ch, int skip) {} + /** First try to update (threadless update). If it returns false, make a full update */ - virtual bool tryUpdate () { return false; } - /** Perform a full recalculation of the part of the image corresponding to the crop. */ - virtual void fullUpdate () {} + virtual bool tryUpdate () { return false; } + /** Perform a full recalculation of the part of the image corresponding to the crop. */ + virtual void fullUpdate () {} /** Sets the listener of the crop. */ virtual void setListener (DetailedCropListener* il) {} /** Destroys the crop. */ @@ -369,10 +370,9 @@ namespace rtengine { * with processing. If no new job is given, it finishes. * The ProcessingJob passed becomes invalid, you can not use it any more. * @param job the ProcessingJob to cancel. - * @param bpl is the BatchProcessingListener that is called when the image is ready or the next job is needed. It also acts as a ProgressListener. + * @param bpl is the BatchProcessingListener that is called when the image is ready or the next job is needed. It also acts as a ProgressListener. * @param tunnelMetaData tunnels IPTC and XMP to output without change */ - - void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData); + void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData); extern Glib::Mutex* lcmsMutex; diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index 820dba25f..558d61c64 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -76,7 +76,7 @@ int StdImageSource::load (Glib::ustring fname, bool batch) { img = new Image16 (); if (plistener) { - plistener->setProgressStr ("Loading..."); + plistener->setProgressStr ("PROGRESSBAR_LOADING"); plistener->setProgress (0.0); img->setProgressListener (plistener); } @@ -92,7 +92,7 @@ int StdImageSource::load (Glib::ustring fname, bool batch) { idata = new ImageData (fname); if (plistener) { - plistener->setProgressStr ("Ready."); + plistener->setProgressStr ("PROGRESSBAR_READY"); plistener->setProgress (1.0); } @@ -141,6 +141,8 @@ void StdImageSource::transform (PreviewProps pp, int tran, int &sx1, int &sy1, i sy2 = sy1 + pp.w; } //printf ("ppx %d ppy %d ppw %d pph %d s: %d %d %d %d\n",pp.x, pp.y,pp.w,pp.h,sx1,sy1,sx2,sy2); + if (sx1<0)sx1=0; + if (sy1<0)sy1=0; } void StdImageSource::getImage_ (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first, HRecParams hrp) { @@ -159,12 +161,22 @@ void StdImageSource::getImage_ (ColorTemp ctemp, int tran, Imagefloat* image, Pr bm /= mul_lum; int sx1, sy1, sx2, sy2; + transform (pp, tran, sx1, sy1, sx2, sy2); + // printf(" sx1:%d sy1:%d sx2:%d sy2:%d\n",sx1, sy1, sx2, sy2); /* the sizes are already known: image->width and image->height int imwidth = (sx2 - sx1) / pp.skip + ((sx2 - sx1) % pp.skip > 0); int imheight = (sy2 - sy1) / pp.skip + ((sy2 - sy1) % pp.skip > 0); */ int imwidth=image->width,imheight=image->height; + // printf("1: imw=%d imh=%d\n",imwidth,imheight); + if (((tran & TR_ROT) == TR_R90)||((tran & TR_ROT) == TR_R270)) + { + int swap = imwidth; + imwidth=imheight; + imheight=swap; + } + // printf("2: imw=%d imh=%d\n",imwidth,imheight); int istart = sy1; int maxx=img->width,maxy=img->height; int mtran = tran;