iplocallab.cc: further cleanups; also removed some debug code
This commit is contained in:
@@ -51,10 +51,6 @@
|
||||
|
||||
#include "../rtgui/editcallbacks.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include "mytime.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace rtengine;
|
||||
@@ -511,12 +507,6 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
bool showSharpMask)
|
||||
{
|
||||
if (params->colorappearance.enabled) {
|
||||
|
||||
#ifdef _DEBUG
|
||||
MyTime t1e, t2e;
|
||||
t1e.set();
|
||||
#endif
|
||||
|
||||
//preparate for histograms CIECAM
|
||||
LUTu hist16JCAM;
|
||||
LUTu hist16_CCAM;
|
||||
@@ -1021,10 +1011,8 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
#ifdef __SSE2__
|
||||
int bufferLength = ((width + 3) / 4) * 4; // bufferLength has to be a multiple of 4
|
||||
#endif
|
||||
#ifndef _DEBUG
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
float minQThr = 10000.f;
|
||||
@@ -1038,10 +1026,8 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
float Mbuffer[bufferLength] ALIGNED16;
|
||||
float sbuffer[bufferLength] ALIGNED16;
|
||||
#endif
|
||||
#ifndef _DEBUG
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for schedule(dynamic, 16)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
@@ -1560,16 +1546,8 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool neg = false;
|
||||
bool more_rgb = false;
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
#else
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f);
|
||||
#endif
|
||||
|
||||
lab->L[i][j] = Lprov1 * 327.68f;
|
||||
lab->a[i][j] = 327.68f * Chprov1 * sincosval.y;
|
||||
lab->b[i][j] = 327.68f * Chprov1 * sincosval.x;
|
||||
@@ -1623,15 +1601,8 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
sincosval.x = bb / (Chprov1 * 327.68f);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool neg = false;
|
||||
bool more_rgb = false;
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
#else
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f);
|
||||
#endif
|
||||
lab->L[i][j] = Lprov1 * 327.68f;
|
||||
lab->a[i][j] = 327.68f * Chprov1 * sincosval.y;
|
||||
lab->b[i][j] = 327.68f * Chprov1 * sincosval.x;
|
||||
@@ -1670,16 +1641,6 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
if (settings->verbose) {
|
||||
t2e.set();
|
||||
printf("CIECAM02 performed in %d usec:\n", t2e.etime(t1e));
|
||||
// printf("minc=%f maxc=%f minj=%f maxj=%f\n",minc,maxc,minj,maxj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (settings->autocielab) {
|
||||
if ((params->colorappearance.tonecie && (epdEnabled)) || (params->sharpening.enabled && settings->autocielab && execsharp)
|
||||
|| (params->dirpyrequalizer.enabled && settings->autocielab) || (params->defringe.enabled && settings->autocielab) || (params->sharpenMicro.enabled && settings->autocielab)
|
||||
@@ -1759,18 +1720,13 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
const float co_e = (pow_F(f_l, 0.25f));
|
||||
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
#ifndef _DEBUG
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for schedule(dynamic, 10)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < height; i++) // update CieImages with new values after sharpening, defringe, contrast by detail level
|
||||
for (int j = 0; j < width; j++) {
|
||||
float interm = fabsf(ncie->sh_p[i][j] / (32768.f));
|
||||
@@ -1800,10 +1756,8 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
constexpr float eps = 0.0001f;
|
||||
const float co_e = (pow_F(f_l, 0.25f)) + eps;
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
#ifdef __SSE2__
|
||||
@@ -1816,10 +1770,8 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
float *zbuffer = hbuffer; // "
|
||||
#endif
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for schedule(dynamic, 10)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < height; i++) { // update CIECAM with new values after tone-mapping
|
||||
@@ -1901,15 +1853,8 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool neg = false;
|
||||
bool more_rgb = false;
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
#else
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f);
|
||||
#endif
|
||||
|
||||
lab->L[i][j] = Lprov1 * 327.68f;
|
||||
lab->a[i][j] = 327.68f * Chprov1 * sincosval.y;
|
||||
@@ -1963,15 +1908,8 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
|
||||
sincosval.x = bb / (Chprov1 * 327.68f);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool neg = false;
|
||||
bool more_rgb = false;
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
#else
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.96f);
|
||||
#endif
|
||||
lab->L[i][j] = Lprov1 * 327.68f;
|
||||
lab->a[i][j] = 327.68f * Chprov1 * sincosval.y;
|
||||
lab->b[i][j] = 327.68f * Chprov1 * sincosval.x;
|
||||
@@ -2691,15 +2629,8 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
sincosval.x = b_1 / (Chpro * 327.68f);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool neg = false;
|
||||
bool more_rgb = false;
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(HH, sincosval, Lpro, Chpro, r, g, b, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
#else
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(HH, sincosval, Lpro, Chpro, r, g, b, wip, highlight, 0.15f, 0.96f);
|
||||
#endif
|
||||
//end of gamut control
|
||||
} else {
|
||||
float x_, y_, z_;
|
||||
@@ -3101,15 +3032,8 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
|
||||
float RR, GG, BB;
|
||||
L /= 327.68f;
|
||||
#ifdef _DEBUG
|
||||
bool neg = false;
|
||||
bool more_rgb = false;
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(HH, sincosval, L, CC, RR, GG, BB, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
#else
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(HH, sincosval, L, CC, RR, GG, BB, wip, highlight, 0.15f, 0.96f);
|
||||
#endif
|
||||
L *= 327.68f;
|
||||
//convert l => rgb
|
||||
Color::L2XYZ(L, X, Y, Z);
|
||||
@@ -4341,13 +4265,6 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW
|
||||
const float histLFactor = pW != 1 ? histLCurve.getSize() / 100.f : 1.f;
|
||||
const float histCFactor = pW != 1 ? histCCurve.getSize() / 48000.f : 1.f;
|
||||
|
||||
#ifdef _DEBUG
|
||||
MyTime t1e, t2e;
|
||||
t1e.set();
|
||||
// init variables to display Munsell corrections
|
||||
MunsellDebugInfo* MunsDebugInfo = new MunsellDebugInfo();
|
||||
#endif
|
||||
|
||||
float adjustr = 1.0f;
|
||||
|
||||
// if(params->labCurve.avoidclip ){
|
||||
@@ -4446,11 +4363,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW
|
||||
};
|
||||
|
||||
#ifdef _OPENMP
|
||||
#ifdef _DEBUG
|
||||
#pragma omp parallel default(shared) firstprivate(lold, lnew, MunsDebugInfo, pW) if (multiThread)
|
||||
#else
|
||||
#pragma omp parallel if (multiThread)
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
#ifdef __SSE2__
|
||||
@@ -4912,18 +4825,9 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW
|
||||
//gamutmap Lch ==> preserve Hue,but a little slower than gamutbdy for high values...and little faster for low values
|
||||
if (gamutLch) {
|
||||
float R, G, B;
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool neg = false;
|
||||
bool more_rgb = false;
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
|
||||
#else
|
||||
//gamut control : Lab values are in gamut
|
||||
Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f);
|
||||
#endif
|
||||
lnew->L[i][j] = Lprov1 * 327.68f;
|
||||
// float2 sincosval = xsincosf(HH);
|
||||
lnew->a[i][j] = 327.68f * Chprov1 * sincosval.y;
|
||||
lnew->b[i][j] = 327.68f * Chprov1 * sincosval.x;
|
||||
} else {
|
||||
@@ -4941,12 +4845,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW
|
||||
|
||||
Lprov1 = lnew->L[i][j] / 327.68f;
|
||||
Chprov = sqrt(SQR(lnew->a[i][j]) + SQR(lnew->b[i][j])) / 327.68f;
|
||||
|
||||
#ifdef _DEBUG
|
||||
Color::AllMunsellLch(/*lumaMuns*/true, Lprov1, LL, HH, Chprov, memChprov, correctionHue, correctlum, MunsDebugInfo);
|
||||
#else
|
||||
Color::AllMunsellLch(/*lumaMuns*/true, Lprov1, LL, HH, Chprov, memChprov, correctionHue, correctlum);
|
||||
#endif
|
||||
|
||||
if (correctionHue != 0.f || correctlum != 0.f) {
|
||||
if (fabs(correctionHue) < 0.015f) {
|
||||
@@ -4983,18 +4882,6 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW
|
||||
}
|
||||
} // end of parallelization
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
if (settings->verbose) {
|
||||
t2e.set();
|
||||
printf("Color::AllMunsellLch (correction performed in %d usec):\n", t2e.etime(t1e));
|
||||
printf(" Munsell chrominance: MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad dep=%u\n", MunsDebugInfo->maxdhue[0], MunsDebugInfo->maxdhue[1], MunsDebugInfo->maxdhue[2], MunsDebugInfo->maxdhue[3], MunsDebugInfo->depass);
|
||||
printf(" Munsell luminance : MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad dep=%u\n", MunsDebugInfo->maxdhuelum[0], MunsDebugInfo->maxdhuelum[1], MunsDebugInfo->maxdhuelum[2], MunsDebugInfo->maxdhuelum[3], MunsDebugInfo->depassLum);
|
||||
}
|
||||
|
||||
delete MunsDebugInfo;
|
||||
#endif
|
||||
|
||||
if (chCurve) {
|
||||
delete chCurve;
|
||||
}
|
||||
@@ -5220,12 +5107,9 @@ void ImProcFunctions::EPDToneMapCIE(CieImage *ncie, float a_w, float c_, int Wid
|
||||
|
||||
//Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping.
|
||||
float s = (1.0f + 38.7889f) * powf(Compression, 1.5856f) / (1.0f + 38.7889f * powf(Compression, 1.5856f));
|
||||
#ifndef _DEBUG
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,10)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < Hei; i++)
|
||||
for (int j = 0; j < Wid; j++) {
|
||||
ncie->Q_p[i][j] = (ncie->Q_p[i][j] * Qpro) / gamm;
|
||||
|
||||
Reference in New Issue
Block a user