diff --git a/rtengine/LUT.h b/rtengine/LUT.h index 965180c92..418f90a23 100644 --- a/rtengine/LUT.h +++ b/rtengine/LUT.h @@ -52,6 +52,8 @@ * LUTf stands for LUT * LUTi stands for LUT * LUTu stands for LUT + * LUTd stands for LUT + * LUTuc stands for LUT */ #ifndef LUT_H_ @@ -65,6 +67,7 @@ #define LUTi LUT #define LUTu LUT #define LUTd LUT +#define LUTuc LUT #include #ifndef NDEBUG diff --git a/rtengine/color.cc b/rtengine/color.cc index faf8e358e..82eecb3eb 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -36,7 +36,7 @@ LUTf Color::cachef; LUTf Color::gamma2curve; LUTf Color::gammatab; -unsigned char* Color::gammatabThumb = nullptr; +LUTuc Color::gammatabThumb; LUTf Color::igammatab_srgb; LUTf Color::gammatab_srgb; // LUTf Color::igammatab_709; @@ -141,7 +141,7 @@ void Color::init () cachef(maxindex, LUT_CLIP_BELOW); gamma2curve(maxindex, LUT_CLIP_BELOW | LUT_CLIP_ABOVE); gammatab(maxindex, 0); - gammatabThumb = new unsigned char[maxindex]; + gammatabThumb(maxindex, 0); igammatab_srgb(maxindex, 0); gammatab_srgb(maxindex, 0); @@ -163,20 +163,25 @@ void Color::init () #ifdef _OPENMP #pragma omp parallel sections -#endif // _OPENMP +#endif { #ifdef _OPENMP #pragma omp section #endif + { + int i = 0; + int epsmaxint = eps_max; - for (int i = 0; i < maxindex; i++) { - if (i > eps_max) { - cachef[i] = 327.68 * std::cbrt((double)i / MAXVALF); - } else { + for (; i <= epsmaxint; i++) + { cachef[i] = 327.68 * ((kappa * i / MAXVALF + 16.0) / 116.0); } - } + for(; i < maxindex; i++) + { + cachef[i] = 327.68 * std::cbrt((double)i / MAXVALF); + } + } #ifdef _OPENMP #pragma omp section #endif @@ -293,7 +298,6 @@ void Color::init () gammatab_26_11[i] = 65535.0 * gamma26_11 (i / 65535.0); } -//gammatab_145_3 #ifdef _OPENMP #pragma omp section #endif @@ -335,10 +339,6 @@ void Color::cleanup () if (linearGammaTRC) { cmsFreeToneCurve(linearGammaTRC); } - - if(gammatabThumb) { - delete [] gammatabThumb; - } } void Color::rgb2hsl(float r, float g, float b, float &h, float &s, float &l) diff --git a/rtengine/color.h b/rtengine/color.h index 89c34c3ca..3f78692d8 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -148,7 +148,7 @@ public: // look-up tables for the simple exponential gamma static LUTf gammatab; - static unsigned char *gammatabThumb; // for thumbnails + static LUTuc gammatabThumb; // for thumbnails static void init (); diff --git a/rtengine/init.cc b/rtengine/init.cc index 4bba74a43..d2509b620 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -29,8 +29,6 @@ #include "rtthumbnail.h" #include "../rtgui/profilestore.h" #include "../rtgui/threadutils.h" -#define BENCHMARK -#include "StopWatch.h" namespace rtengine { @@ -41,7 +39,6 @@ MyMutex* lcmsMutex = NULL; int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDir) { - BENCHFUN settings = s; iccStore->init (s->iccDirectory, baseDir + "/iccprofiles"); iccStore->findDefaultMonitorProfile(); diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 090841a9e..1cd1d56e1 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -45,7 +45,7 @@ #include "rawimagesource.h" #include "improcfun.h" #include "opthelper.h" -#define BENCHMARK +//#define BENCHMARK #include "StopWatch.h" #define MAX_RETINEX_SCALES 8 diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index 5f7ea8ad6..f9f6c12a1 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -23,7 +23,6 @@ #include "iimage.h" #include "rtthumbnail.h" #include "rawimagesource.h" -#include "StopWatch.h" using namespace rtengine; using namespace procparams; @@ -144,9 +143,7 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext rawImage.getImage (wb, TR_NONE, image, pp, params.toneCurve, params.icm, params.raw); output = new Image8(fw, fh); rawImage.convertColorSpace(image, params.icm, wb); - StopWatch Stop1("inspector loop"); #pragma omp parallel for schedule(dynamic, 10) - for (int i = 0; i < fh; ++i) for (int j = 0; j < fw; ++j) { image->r(i, j) = Color::gamma2curve[image->r(i, j)]; @@ -154,7 +151,6 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext image->b(i, j) = Color::gamma2curve[image->b(i, j)]; } - Stop1.stop(); image->resizeImgTo(fw, fh, TI_Nearest, output); data = output->getData();