Removed benchmark code and made Color::gammatabThumb a LUTuc

This commit is contained in:
heckflosse 2016-02-25 19:14:00 +01:00
parent 1b220543f3
commit f0113b8f57
6 changed files with 18 additions and 22 deletions

View File

@ -52,6 +52,8 @@
* LUTf stands for LUT<float>
* LUTi stands for LUT<int>
* LUTu stands for LUT<unsigned int>
* LUTd stands for LUT<double>
* LUTuc stands for LUT<unsigned char>
*/
#ifndef LUT_H_
@ -65,6 +67,7 @@
#define LUTi LUT<int>
#define LUTu LUT<unsigned int>
#define LUTd LUT<double>
#define LUTuc LUT<unsigned char>
#include <cstring>
#ifndef NDEBUG

View File

@ -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)

View File

@ -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 ();

View File

@ -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();

View File

@ -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

View File

@ -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<Image8>(fw, fh, TI_Nearest, output);
data = output->getData();