diff --git a/rtengine/curves.cc b/rtengine/curves.cc index a0613c150..2e82d0330 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -119,8 +119,7 @@ namespace rtengine { satcurvePoints.push_back(1); satcurvePoints.push_back(1+saturation/200.0); } - DiagonalCurve* satcurve = NULL; - satcurve = new DiagonalCurve (satcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, + DiagonalCurve* satcurve = new DiagonalCurve (satcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create a curve if needed @@ -178,8 +177,8 @@ namespace rtengine { boutCurve[i] = (65535.0 * dbcurve[i]); satCurve[i] = (65535.0 * dscurve[i]); } - //delete [] dcurve; - //delete satcurve; + + delete satcurve; } @@ -251,8 +250,7 @@ namespace rtengine { brightcurvePoints.push_back(1); // white point brightcurvePoints.push_back(1); // value at white point - DiagonalCurve* brightcurve = NULL; - brightcurve = new DiagonalCurve (brightcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, + DiagonalCurve* brightcurve = new DiagonalCurve (brightcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% float exp_scale = a; @@ -347,8 +345,7 @@ namespace rtengine { contrastcurvePoints.push_back(1); // white point contrastcurvePoints.push_back(1); // value at white point - DiagonalCurve* contrastcurve = NULL; - contrastcurve = new DiagonalCurve (contrastcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, + DiagonalCurve* contrastcurve = new DiagonalCurve (contrastcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // apply contrast enhancement @@ -444,8 +441,7 @@ namespace rtengine { brightcurvePoints.push_back(1); // white point brightcurvePoints.push_back(1); // value at white point - DiagonalCurve* brightcurve = NULL; - brightcurve = new DiagonalCurve (brightcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, + DiagonalCurve* brightcurve = new DiagonalCurve (brightcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for (int i=0; i<32768; i++) {//L values range up to 32767, higher values are for highlight overflow @@ -494,14 +490,14 @@ namespace rtengine { contrastcurvePoints.push_back(1); // white point contrastcurvePoints.push_back(1); // value at white point - DiagonalCurve* contrastcurve = NULL; - contrastcurve = new DiagonalCurve (contrastcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, + DiagonalCurve* contrastcurve = new DiagonalCurve (contrastcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000, //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // apply contrast enhancement for (int i=0; i<32768; i++) { dcurve[i] = contrastcurve->getVal (dcurve[i]); } + delete contrastcurve; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -562,11 +558,4 @@ void CurveFactory::init () { fclose (f);*/ } -void CurveFactory::cleanup () { - - //delete [] gammatab; - //delete [] igammatab_srgb; - //delete [] gammatab_srgb; -} - } diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 6f5736c98..b0ec1d26b 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -190,8 +190,6 @@ void Crop::update (int todo) { // switch back to rgb parent->ipf.lab2rgb (labnCrop, cropImg); - // this in workinging space is held in parallel to allow analysis like shadow/highlight - cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, params.icm.working); //parent->ipf.lab2rgb (laboCrop, cropImg); //cropImg = baseCrop->to8(); @@ -227,6 +225,9 @@ void Crop::update (int todo) { } */ if (cropImageListener) { + // this in workinging space is held in parallel to allow analysis like shadow/highlight + Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, params.icm.working); + int finalW = rqcropw; if (cropImg->getWidth()-leftBorder < finalW) finalW = cropImg->getWidth()-leftBorder; @@ -243,6 +244,7 @@ void Crop::update (int todo) { cropImageListener->setDetailedCrop (final, finaltrue, params.icm, params.crop, rqcropx, rqcropy, rqcropw, rqcroph, skip); delete final; delete finaltrue; + delete cropImgtrue; } } @@ -345,7 +347,6 @@ if (settings->verbose) printf ("setcropsizes before lock\n"); laboCrop = new LabImage (cropw, croph); labnCrop = new LabImage (cropw, croph); cropImg = new Image8 (cropw, croph); - cropImgtrue = new Image8 (cropw, croph); cshmap = new SHMap (cropw, croph, true); diff --git a/rtengine/dcrop.h b/rtengine/dcrop.h index d6ab150a4..be53bdfee 100644 --- a/rtengine/dcrop.h +++ b/rtengine/dcrop.h @@ -39,9 +39,7 @@ class Crop : public DetailedCrop { Imagefloat* origCrop, *baseCrop; Imagefloat* *resizeCrop, *transCrop; LabImage *laboCrop, *labnCrop; - Image8 *cropImg; - Image8 *cropImgtrue; - + Image8 *cropImg; // permanently allocated in RAM and only renewed on size changes float** cbuffer; float * cbuf_real; diff --git a/rtengine/init.cc b/rtengine/init.cc index fce420697..c4040d4c9 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -50,7 +50,6 @@ int init (const Settings* s) { void cleanup () { - CurveFactory::cleanup (); ImProcFunctions::cleanupCache (); Thumbnail::cleanupGamma (); } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index dff6fafda..4732b361d 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -44,7 +44,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p pl->setProgressStr ("PROGRESSBAR_PROCESSING"); pl->setProgress (0.0); } - + InitialImage* ii = job->initialImage; if (!ii) { ii = InitialImage::load (job->fname, job->isRaw, &errorCode); @@ -98,13 +98,12 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p else if (params.wb.method=="Auto") currWB = imgsrc->getAutoWB (); - Imagefloat* baseImg; PreviewProps pp (0, 0, fw, fh, 1); imgsrc->preprocess( params.raw ); if (pl) pl->setProgress (0.20); imgsrc->demosaic( params.raw ); if (pl) pl->setProgress (0.40); - baseImg = new Imagefloat (fw, fh); + Imagefloat* baseImg = new Imagefloat (fw, fh); imgsrc->getImage (currWB, tr, baseImg, pp, params.hlrecovery, params.icm, params.raw); if (pl) pl->setProgress (0.45); @@ -150,7 +149,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p LUTf curve (65536,0); LUTf satcurve (65536,0); LUTu dummy; - + CurveFactory::complexCurve (br, bl/65535.0, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, params.toneCurve.shcompr, params.toneCurve.brightness, params.toneCurve.contrast, imgsrc->getGamma(), true, params.toneCurve.curve, hist16, curve1, curve2, curve, dummy); LabImage* labView = new LabImage (fw,fh); @@ -158,7 +157,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p ipf.rgbProc (baseImg, labView, curve1, curve2, curve, shmap, params.toneCurve.saturation); if (shmap) - delete shmap; + delete shmap; if (pl) pl->setProgress (0.5); @@ -183,9 +182,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p ipf.dirpyrdenoise (labView); ipf.sharpening (labView, (float**)buffer); - // color processing - /*ipf.colorCurve (labView, labView); - ipf.colordenoise (labView, buffer);*/ // wavelet equalizer @@ -201,7 +197,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (pl) pl->setProgress (0.60); // crop and convert to rgb16 - Image16* readyImg; int cx = 0, cy = 0, cw = labView->W, ch = labView->H; if (params.crop.enabled) { cx = params.crop.x; @@ -209,7 +204,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p cw = params.crop.w; ch = params.crop.h; } - readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm.output); + Image16* readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm.output); delete labView; if (pl) pl->setProgress (0.70); @@ -282,7 +277,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p else readyImg->setMetadata (ii->getMetaData()->getExifData (), params.exif, params.iptc); - + ProfileContent pc; if (params.icm.output.compare (0, 6, "No ICM") && params.icm.output!="") pc = iccStore->getContent (params.icm.output); @@ -293,7 +288,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (!job->initialImage) ii->decreaseRef (); - + delete job; if (pl) pl->setProgress (0.75); diff --git a/rtgui/curveeditor.cc b/rtgui/curveeditor.cc index 6bb48ae65..1a720aa81 100644 --- a/rtgui/curveeditor.cc +++ b/rtgui/curveeditor.cc @@ -108,10 +108,6 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEd typeconn = curveType->signal_changed().connect (sigc::mem_fun(*this, &CurveEditor::typeSelectionChanged) ); } -CurveEditor::~CurveEditor () { - -} - void CurveEditor::setCurve (const std::vector& p) { tempCurve = p; group->setCurveExternal(this, p); diff --git a/rtgui/curveeditor.h b/rtgui/curveeditor.h index 4028ff9b1..11e71614d 100644 --- a/rtgui/curveeditor.h +++ b/rtgui/curveeditor.h @@ -66,7 +66,7 @@ class CurveEditor { public: CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEditorSubGroup* ceSubGroup); - ~CurveEditor (); + void typeSelectionChanged (int n); void curveTypeToggled(); bool isUnChanged ();