diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index b8c4ae2fc..b4bfb12ee 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -823,22 +823,19 @@ void RawImageSource::ppg_demosaic() if(plistener) plistener->setProgress(0.67 + 0.33*row/(height-1)); } - red = new float*[H]; - for (int i=0; i cfa (width,height,rawData); + float** rawptr = rawData; + array2D cfa (width,height,rawptr); //array2D checker (width,height,ARRAY2D_CLEAR_DATA); diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 3fb3a2952..84d7c277d 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -77,12 +77,8 @@ PIX_SORT(p[1],p[2]) ; median=p[2] ;} RawImageSource::RawImageSource () :ImageSource() ,plistener(NULL) -,green(NULL) -,red(NULL) -,blue(NULL) ,cache(NULL) ,border(4) -,rawData(NULL) ,ri(NULL) { hrmap[0] = NULL; @@ -104,15 +100,6 @@ RawImageSource::~RawImageSource () { delete ri; } - //These freeArray commands are causing RT not to terminate properly ??? - /*if (green) - freeArray(green, H); - if (red) - freeArray(red, H); - if (blue) - freeArray(blue, H); - if(rawData) - freeArray(rawData, H);*/ if( cache ) delete [] cache; if (hrmap[0]!=NULL) { @@ -945,9 +932,9 @@ int RawImageSource::load (Glib::ustring fname, bool batch) { rml.ciffLength = ri->get_ciffLen(); idata = new ImageData (fname, &rml); - green = allocArray(W,H); - red = allocArray(W,H); - blue = allocArray(W,H); + green(W,H);// = allocArray(W,H); + red(W,H);// = allocArray(W,H); + blue(W,H);// = allocArray(W,H); //hpmap = allocArray(W, H); if (plistener) { @@ -1148,23 +1135,19 @@ void RawImageSource::flushRawData() { cache = 0; } if (rawData) { - freeArray(rawData, H); - rawData = 0; + rawData(0,0); } } void RawImageSource::flushRGB() { if (green) { - freeArray(green, H); - green = 0; + green(0,0); } if (red) { - freeArray(red, H); - red = 0; + red(0,0); } if (blue) { - freeArray(blue, H); - blue = 0; + blue(0,0); } } @@ -1191,7 +1174,7 @@ void RawImageSource::copyOriginalPixels(const RAWParams &raw, RawImage *src, Raw { if (ri->isBayer()) { if (!rawData) - rawData = allocArray(W,H); + rawData(W,H); if (riDark && W == riDark->get_width() && H == riDark->get_height()) { for (int row = 0; row < H; row++) { for (int col = 0; col < W; col++) { @@ -1276,7 +1259,7 @@ void RawImageSource::copyOriginalPixels(const RAWParams &raw, RawImage *src, Raw } else { // No bayer pattern // TODO: Is there a flat field correction possible? - if (!rawData) rawData = allocArray(3*W,H); + if (!rawData) rawData(3*W,H); if (riDark && W == riDark->get_width() && H == riDark->get_height()) { for (int row = 0; row < H; row++) { diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 38c195725..2b7d027cc 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -100,14 +100,14 @@ class RawImageSource : public ImageSource { double* cache; int threshold; - float** rawData; // holds preprocessed pixel values, rowData[i][j] corresponds to the ith row and jth column + array2D rawData; // holds preprocessed pixel values, rowData[i][j] corresponds to the ith row and jth column // the interpolated green plane: - float** green; + array2D green; // the interpolated red plane: - float** red; + array2D red; // the interpolated blue plane: - float** blue; + array2D blue; void hphd_vertical (float** hpmap, int col_from, int col_to);