Fixed two memory leaks, one of it huge; see issue #636
This commit is contained in:
@@ -119,8 +119,7 @@ namespace rtengine {
|
|||||||
satcurvePoints.push_back(1);
|
satcurvePoints.push_back(1);
|
||||||
satcurvePoints.push_back(1+saturation/200.0);
|
satcurvePoints.push_back(1+saturation/200.0);
|
||||||
}
|
}
|
||||||
DiagonalCurve* satcurve = NULL;
|
DiagonalCurve* satcurve = new DiagonalCurve (satcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
||||||
satcurve = new DiagonalCurve (satcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
// create a curve if needed
|
// create a curve if needed
|
||||||
@@ -178,8 +177,8 @@ namespace rtengine {
|
|||||||
boutCurve[i] = (65535.0 * dbcurve[i]);
|
boutCurve[i] = (65535.0 * dbcurve[i]);
|
||||||
satCurve[i] = (65535.0 * dscurve[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); // white point
|
||||||
brightcurvePoints.push_back(1); // value at white point
|
brightcurvePoints.push_back(1); // value at white point
|
||||||
|
|
||||||
DiagonalCurve* brightcurve = NULL;
|
DiagonalCurve* brightcurve = new DiagonalCurve (brightcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
||||||
brightcurve = new DiagonalCurve (brightcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
float exp_scale = a;
|
float exp_scale = a;
|
||||||
@@ -347,8 +345,7 @@ namespace rtengine {
|
|||||||
contrastcurvePoints.push_back(1); // white point
|
contrastcurvePoints.push_back(1); // white point
|
||||||
contrastcurvePoints.push_back(1); // value at white point
|
contrastcurvePoints.push_back(1); // value at white point
|
||||||
|
|
||||||
DiagonalCurve* contrastcurve = NULL;
|
DiagonalCurve* contrastcurve = new DiagonalCurve (contrastcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
||||||
contrastcurve = new DiagonalCurve (contrastcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
// apply contrast enhancement
|
// apply contrast enhancement
|
||||||
@@ -444,8 +441,7 @@ namespace rtengine {
|
|||||||
brightcurvePoints.push_back(1); // white point
|
brightcurvePoints.push_back(1); // white point
|
||||||
brightcurvePoints.push_back(1); // value at white point
|
brightcurvePoints.push_back(1); // value at white point
|
||||||
|
|
||||||
DiagonalCurve* brightcurve = NULL;
|
DiagonalCurve* brightcurve = new DiagonalCurve (brightcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
||||||
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
|
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); // white point
|
||||||
contrastcurvePoints.push_back(1); // value at white point
|
contrastcurvePoints.push_back(1); // value at white point
|
||||||
|
|
||||||
DiagonalCurve* contrastcurve = NULL;
|
DiagonalCurve* contrastcurve = new DiagonalCurve (contrastcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
||||||
contrastcurve = new DiagonalCurve (contrastcurvePoints, CURVES_MIN_POLY_POINTS/skip); // Actually, CURVES_MIN_POLY_POINTS = 1000,
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
// apply contrast enhancement
|
// apply contrast enhancement
|
||||||
for (int i=0; i<32768; i++) {
|
for (int i=0; i<32768; i++) {
|
||||||
dcurve[i] = contrastcurve->getVal (dcurve[i]);
|
dcurve[i] = contrastcurve->getVal (dcurve[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete contrastcurve;
|
delete contrastcurve;
|
||||||
}
|
}
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
@@ -562,11 +558,4 @@ void CurveFactory::init () {
|
|||||||
fclose (f);*/
|
fclose (f);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurveFactory::cleanup () {
|
|
||||||
|
|
||||||
//delete [] gammatab;
|
|
||||||
//delete [] igammatab_srgb;
|
|
||||||
//delete [] gammatab_srgb;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -190,8 +190,6 @@ void Crop::update (int todo) {
|
|||||||
// switch back to rgb
|
// switch back to rgb
|
||||||
parent->ipf.lab2rgb (labnCrop, cropImg);
|
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);
|
//parent->ipf.lab2rgb (laboCrop, cropImg);
|
||||||
|
|
||||||
//cropImg = baseCrop->to8();
|
//cropImg = baseCrop->to8();
|
||||||
@@ -227,6 +225,9 @@ void Crop::update (int todo) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (cropImageListener) {
|
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;
|
int finalW = rqcropw;
|
||||||
if (cropImg->getWidth()-leftBorder < finalW)
|
if (cropImg->getWidth()-leftBorder < finalW)
|
||||||
finalW = cropImg->getWidth()-leftBorder;
|
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);
|
cropImageListener->setDetailedCrop (final, finaltrue, params.icm, params.crop, rqcropx, rqcropy, rqcropw, rqcroph, skip);
|
||||||
delete final;
|
delete final;
|
||||||
delete finaltrue;
|
delete finaltrue;
|
||||||
|
delete cropImgtrue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +347,6 @@ if (settings->verbose) printf ("setcropsizes before lock\n");
|
|||||||
laboCrop = new LabImage (cropw, croph);
|
laboCrop = new LabImage (cropw, croph);
|
||||||
labnCrop = new LabImage (cropw, croph);
|
labnCrop = new LabImage (cropw, croph);
|
||||||
cropImg = new Image8 (cropw, croph);
|
cropImg = new Image8 (cropw, croph);
|
||||||
cropImgtrue = new Image8 (cropw, croph);
|
|
||||||
|
|
||||||
cshmap = new SHMap (cropw, croph, true);
|
cshmap = new SHMap (cropw, croph, true);
|
||||||
|
|
||||||
|
@@ -39,9 +39,7 @@ class Crop : public DetailedCrop {
|
|||||||
Imagefloat* origCrop, *baseCrop;
|
Imagefloat* origCrop, *baseCrop;
|
||||||
Imagefloat* *resizeCrop, *transCrop;
|
Imagefloat* *resizeCrop, *transCrop;
|
||||||
LabImage *laboCrop, *labnCrop;
|
LabImage *laboCrop, *labnCrop;
|
||||||
Image8 *cropImg;
|
Image8 *cropImg; // permanently allocated in RAM and only renewed on size changes
|
||||||
Image8 *cropImgtrue;
|
|
||||||
|
|
||||||
|
|
||||||
float** cbuffer;
|
float** cbuffer;
|
||||||
float * cbuf_real;
|
float * cbuf_real;
|
||||||
|
@@ -50,7 +50,6 @@ int init (const Settings* s) {
|
|||||||
|
|
||||||
void cleanup () {
|
void cleanup () {
|
||||||
|
|
||||||
CurveFactory::cleanup ();
|
|
||||||
ImProcFunctions::cleanupCache ();
|
ImProcFunctions::cleanupCache ();
|
||||||
Thumbnail::cleanupGamma ();
|
Thumbnail::cleanupGamma ();
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
pl->setProgressStr ("PROGRESSBAR_PROCESSING");
|
pl->setProgressStr ("PROGRESSBAR_PROCESSING");
|
||||||
pl->setProgress (0.0);
|
pl->setProgress (0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
InitialImage* ii = job->initialImage;
|
InitialImage* ii = job->initialImage;
|
||||||
if (!ii) {
|
if (!ii) {
|
||||||
ii = InitialImage::load (job->fname, job->isRaw, &errorCode);
|
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")
|
else if (params.wb.method=="Auto")
|
||||||
currWB = imgsrc->getAutoWB ();
|
currWB = imgsrc->getAutoWB ();
|
||||||
|
|
||||||
Imagefloat* baseImg;
|
|
||||||
PreviewProps pp (0, 0, fw, fh, 1);
|
PreviewProps pp (0, 0, fw, fh, 1);
|
||||||
imgsrc->preprocess( params.raw );
|
imgsrc->preprocess( params.raw );
|
||||||
if (pl) pl->setProgress (0.20);
|
if (pl) pl->setProgress (0.20);
|
||||||
imgsrc->demosaic( params.raw );
|
imgsrc->demosaic( params.raw );
|
||||||
if (pl) pl->setProgress (0.40);
|
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);
|
imgsrc->getImage (currWB, tr, baseImg, pp, params.hlrecovery, params.icm, params.raw);
|
||||||
if (pl) pl->setProgress (0.45);
|
if (pl) pl->setProgress (0.45);
|
||||||
|
|
||||||
@@ -150,7 +149,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
LUTf curve (65536,0);
|
LUTf curve (65536,0);
|
||||||
LUTf satcurve (65536,0);
|
LUTf satcurve (65536,0);
|
||||||
LUTu dummy;
|
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);
|
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);
|
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);
|
ipf.rgbProc (baseImg, labView, curve1, curve2, curve, shmap, params.toneCurve.saturation);
|
||||||
|
|
||||||
if (shmap)
|
if (shmap)
|
||||||
delete shmap;
|
delete shmap;
|
||||||
|
|
||||||
if (pl)
|
if (pl)
|
||||||
pl->setProgress (0.5);
|
pl->setProgress (0.5);
|
||||||
@@ -183,9 +182,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
ipf.dirpyrdenoise (labView);
|
ipf.dirpyrdenoise (labView);
|
||||||
ipf.sharpening (labView, (float**)buffer);
|
ipf.sharpening (labView, (float**)buffer);
|
||||||
|
|
||||||
// color processing
|
|
||||||
/*ipf.colorCurve (labView, labView);
|
|
||||||
ipf.colordenoise (labView, buffer);*/
|
|
||||||
|
|
||||||
|
|
||||||
// wavelet equalizer
|
// wavelet equalizer
|
||||||
@@ -201,7 +197,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
if (pl) pl->setProgress (0.60);
|
if (pl) pl->setProgress (0.60);
|
||||||
|
|
||||||
// crop and convert to rgb16
|
// crop and convert to rgb16
|
||||||
Image16* readyImg;
|
|
||||||
int cx = 0, cy = 0, cw = labView->W, ch = labView->H;
|
int cx = 0, cy = 0, cw = labView->W, ch = labView->H;
|
||||||
if (params.crop.enabled) {
|
if (params.crop.enabled) {
|
||||||
cx = params.crop.x;
|
cx = params.crop.x;
|
||||||
@@ -209,7 +204,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
cw = params.crop.w;
|
cw = params.crop.w;
|
||||||
ch = params.crop.h;
|
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;
|
delete labView;
|
||||||
if (pl) pl->setProgress (0.70);
|
if (pl) pl->setProgress (0.70);
|
||||||
|
|
||||||
@@ -282,7 +277,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
else
|
else
|
||||||
readyImg->setMetadata (ii->getMetaData()->getExifData (), params.exif, params.iptc);
|
readyImg->setMetadata (ii->getMetaData()->getExifData (), params.exif, params.iptc);
|
||||||
|
|
||||||
|
|
||||||
ProfileContent pc;
|
ProfileContent pc;
|
||||||
if (params.icm.output.compare (0, 6, "No ICM") && params.icm.output!="")
|
if (params.icm.output.compare (0, 6, "No ICM") && params.icm.output!="")
|
||||||
pc = iccStore->getContent (params.icm.output);
|
pc = iccStore->getContent (params.icm.output);
|
||||||
@@ -293,7 +288,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
|
|
||||||
if (!job->initialImage)
|
if (!job->initialImage)
|
||||||
ii->decreaseRef ();
|
ii->decreaseRef ();
|
||||||
|
|
||||||
delete job;
|
delete job;
|
||||||
if (pl)
|
if (pl)
|
||||||
pl->setProgress (0.75);
|
pl->setProgress (0.75);
|
||||||
|
@@ -108,10 +108,6 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEd
|
|||||||
typeconn = curveType->signal_changed().connect (sigc::mem_fun(*this, &CurveEditor::typeSelectionChanged) );
|
typeconn = curveType->signal_changed().connect (sigc::mem_fun(*this, &CurveEditor::typeSelectionChanged) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CurveEditor::~CurveEditor () {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CurveEditor::setCurve (const std::vector<double>& p) {
|
void CurveEditor::setCurve (const std::vector<double>& p) {
|
||||||
tempCurve = p;
|
tempCurve = p;
|
||||||
group->setCurveExternal(this, p);
|
group->setCurveExternal(this, p);
|
||||||
|
@@ -66,7 +66,7 @@ class CurveEditor {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEditorSubGroup* ceSubGroup);
|
CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEditorSubGroup* ceSubGroup);
|
||||||
~CurveEditor ();
|
|
||||||
void typeSelectionChanged (int n);
|
void typeSelectionChanged (int n);
|
||||||
void curveTypeToggled();
|
void curveTypeToggled();
|
||||||
bool isUnChanged ();
|
bool isUnChanged ();
|
||||||
|
Reference in New Issue
Block a user