Merge pull request #3138 from Beep6581/coverity_scan_one

Try to solve issues found in iplab2rgb, ipwavelet, partialpastedialog and retinex during Coverity scan.
This commit is contained in:
adamreichold
2016-02-08 19:39:41 +01:00
6 changed files with 39 additions and 145 deletions

View File

@@ -286,14 +286,13 @@ public:
void dirpyrdenoise (LabImage* src);//Emil's pyramid denoise void dirpyrdenoise (LabImage* src);//Emil's pyramid denoise
void dirpyrequalizer (LabImage* lab, int scale);//Emil's wavelet void dirpyrequalizer (LabImage* lab, int scale);//Emil's wavelet
void EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params cp, int W_L, int H_L, float max0, float min0); void EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params& cp, int W_L, int H_L, float max0, float min0);
float *CompressDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Compressed); float *CompressDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Compressed);
void ContrastResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params &cp, int W_L, int H_L, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx); void ContrastResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params &cp, int W_L, int H_L, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx);
float *ContrastDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast = NULL); float *ContrastDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast = NULL);
void EPDToneMap(LabImage *lab, unsigned int Iterates = 0, int skip = 1); void EPDToneMap(LabImage *lab, unsigned int Iterates = 0, int skip = 1);
void EPDToneMapCIE(CieImage *ncie, float a_w, float c_, float w_h, int Wid, int Hei, int begh, int endh, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1); void EPDToneMapCIE(CieImage *ncie, float a_w, float c_, float w_h, int Wid, int Hei, int begh, int endh, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1);
// void CAT02 (Imagefloat* baseImg, const ProcParams* params);
// pyramid denoise // pyramid denoise
procparams::DirPyrDenoiseParams dnparams; procparams::DirPyrDenoiseParams dnparams;
@@ -303,13 +302,6 @@ public:
void idirpyr (LabImage* data_coarse, LabImage* data_fine, int level, LUTf &rangefn_L, LUTf & nrwt_l, LUTf & nrwt_ab, void idirpyr (LabImage* data_coarse, LabImage* data_fine, int level, LUTf &rangefn_L, LUTf & nrwt_l, LUTf & nrwt_ab,
int pitch, int scale, const int luma, const int chroma/*, LUTf & Lcurve, LUTf & abcurve*/ ); int pitch, int scale, const int luma, const int chroma/*, LUTf & Lcurve, LUTf & abcurve*/ );
// FT denoise
//void RGB_InputTransf(Imagefloat * src, LabImage * dst, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe);
//void RGB_OutputTransf(LabImage * src, Imagefloat * dst, const procparams::DirPyrDenoiseParams & dnparams);
//void output_tile_row (float *Lbloxrow, float ** Lhipassdn, float ** tilemask, int height, int width, int top, int blkrad );
// void MSR(LabImage* lab, int width, int height, int skip);
void Tile_calc (int tilesize, int overlap, int kall, int imwidth, int imheight, int &numtiles_W, int &numtiles_H, int &tilewidth, int &tileheight, int &tileWskip, int &tileHskip); void Tile_calc (int tilesize, int overlap, int kall, int imwidth, int imheight, int &numtiles_W, int &numtiles_H, int &tilewidth, int &tileheight, int &tileWskip, int &tileHskip);
void ip_wavelet(LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, bool wavcontlutili, int skip); void ip_wavelet(LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, bool wavcontlutili, int skip);
@@ -327,13 +319,13 @@ public:
void ContAllAB (LabImage * lab, int maxlvl, float **varhue, float **varchrom, float ** WavCoeffs_a, float * WavCoeffs_a0, int level, int dir, const WavOpacityCurveW & waOpacityCurveW, struct cont_params &cp, void ContAllAB (LabImage * lab, int maxlvl, float **varhue, float **varchrom, float ** WavCoeffs_a, float * WavCoeffs_a0, int level, int dir, const WavOpacityCurveW & waOpacityCurveW, struct cont_params &cp,
int W_ab, int H_ab, const bool useChannelA); int W_ab, int H_ab, const bool useChannelA);
void Evaluate2(wavelet_decomposition &WaveletCoeffs_L, void Evaluate2(wavelet_decomposition &WaveletCoeffs_L,
struct cont_params cp, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float madL[8][3]); const struct cont_params& cp, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float madL[8][3]);
void Eval2 (float ** WavCoeffs_L, int level, struct cont_params cp, void Eval2 (float ** WavCoeffs_L, int level, const struct cont_params& cp,
int W_L, int H_L, int skip_L, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float *madL); int W_L, int H_L, int skip_L, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float *madL);
void Aver(float * HH_Coeffs, int datalen, float &averagePlus, float &averageNeg, float &max, float &min); void Aver(float * HH_Coeffs, int datalen, float &averagePlus, float &averageNeg, float &max, float &min);
void Sigma(float * HH_Coeffs, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg); void Sigma(float * HH_Coeffs, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg);
void calckoe(float ** WavCoeffs_LL, struct cont_params cp, float ** koeLi, int level, int dir, int W_L, int H_L, float edd, float *maxkoeLi, float **tmC = NULL); void calckoe(float ** WavCoeffs_LL, const struct cont_params& cp, float ** koeLi, int level, int dir, int W_L, int H_L, float edd, float *maxkoeLi, float **tmC = NULL);

View File

@@ -30,19 +30,10 @@
namespace rtengine namespace rtengine
{ {
#define CLIP01(a) ((a)>0?((a)<1?(a):1):0)
extern const Settings* settings; extern const Settings* settings;
const double (*wprof[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_bruce, xyz_beta, xyz_best};
const double (*iwprof[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, bruce_xyz, beta_xyz, best_xyz};
const char* wprofnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB"};
const int numprof = 7;
void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image)
{ {
//gamutmap(lab);
if (monitorTransform) { if (monitorTransform) {
int W = lab->W; int W = lab->W;
@@ -211,18 +202,7 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch,
} }
} else { } else {
double rgb_xyz[3][3]; const auto rgb_xyz = iccStore->workingSpaceMatrix (profile);
for (int i = 0; i < numprof; i++) {
if (profile == wprofnames[i]) {
for (int m = 0; m < 3; m++)
for (int n = 0; n < 3; n++) {
rgb_xyz[m][n] = iwprof[i][m][n];
}
break;
}
}
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16) if (multiThread) #pragma omp parallel for schedule(dynamic,16) if (multiThread)
@@ -386,7 +366,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
Image16* image = new Image16 (cw, ch); Image16* image = new Image16 (cw, ch);
float p1, p2, p3, p4, p5, p6; //primaries float p1, p2, p3, p4, p5, p6; //primaries
//double ga0,ga1,ga2,ga3,ga4,ga5=0.0,ga6=0.0;//gamma parameters
double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; //gamma parameters double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; //gamma parameters
double pwr; double pwr;
double ts; double ts;
@@ -401,15 +381,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
//primaries for 7 working profiles ==> output profiles //primaries for 7 working profiles ==> output profiles
// eventually to adapt primaries if RT used special profiles ! // eventually to adapt primaries if RT used special profiles !
if(profi == "ProPhoto") { if (profi == "WideGamut") {
p1 = 0.7347; //Prophoto primaries
p2 = 0.2653;
p3 = 0.1596;
p4 = 0.8404;
p5 = 0.0366;
p6 = 0.0001;
select_temp = 1;
} else if (profi == "WideGamut") {
p1 = 0.7350; //Widegamut primaries p1 = 0.7350; //Widegamut primaries
p2 = 0.2650; p2 = 0.2650;
p3 = 0.1150; p3 = 0.1150;
@@ -457,6 +429,14 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
p5 = 0.1300; p5 = 0.1300;
p6 = 0.0350; p6 = 0.0350;
select_temp = 1; select_temp = 1;
} else {
p1 = 0.7347; //ProPhoto and default primaries
p2 = 0.2653;
p3 = 0.1596;
p4 = 0.8404;
p5 = 0.0366;
p6 = 0.0001;
select_temp = 1;
} }
if (!freegamma) {//if Free gamma not selected if (!freegamma) {//if Free gamma not selected

View File

@@ -23,9 +23,9 @@
// //
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
#include <cassert>
#include <cmath>
#include <math.h>
#include "../rtgui/threadutils.h" #include "../rtgui/threadutils.h"
#include "rtengine.h" #include "rtengine.h"
@@ -163,9 +163,6 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int
{ {
MyTime t1e, t2e ;
t1e.set();
#ifdef _DEBUG #ifdef _DEBUG
// init variables to display Munsell corrections // init variables to display Munsell corrections
MunsellDebugInfo* MunsDebugInfo = new MunsellDebugInfo(); MunsellDebugInfo* MunsDebugInfo = new MunsellDebugInfo();
@@ -219,10 +216,6 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int
cp.tonemap = true; cp.tonemap = true;
} }
/*else if(params->wavelet.TMmethod=="std") {cp.TMmeth=1;cp.tonemap=true;}
else if(params->wavelet.TMmethod=="high") {cp.TMmeth=2;cp.tonemap=true;}
else if(params->wavelet.TMmethod=="lowhigh") {cp.TMmeth=3;cp.tonemap=true;}
*/
if(params->wavelet.TMmethod == "cont") { if(params->wavelet.TMmethod == "cont") {
cp.contmet = 1; cp.contmet = 1;
} else if(params->wavelet.TMmethod == "tm") { } else if(params->wavelet.TMmethod == "tm") {
@@ -1314,15 +1307,7 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int
delete dsttmp; delete dsttmp;
} }
if (settings->verbose) { }
t2e.set();
printf("Wavelet performed in %d usec:\n", t2e.etime(t1e));
}
}//end o
#undef TS #undef TS
#undef fTS #undef fTS
@@ -1427,7 +1412,7 @@ void ImProcFunctions::Sigma( float * RESTRICT DataList, int datalen, float aver
} }
void ImProcFunctions::Evaluate2(wavelet_decomposition &WaveletCoeffs_L, void ImProcFunctions::Evaluate2(wavelet_decomposition &WaveletCoeffs_L,
struct cont_params cp, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float madL[8][3]) const struct cont_params& cp, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float madL[8][3])
{ {
//StopWatch Stop1("Evaluate2"); //StopWatch Stop1("Evaluate2");
int maxlvl = WaveletCoeffs_L.maxlevel(); int maxlvl = WaveletCoeffs_L.maxlevel();
@@ -1445,7 +1430,7 @@ void ImProcFunctions::Evaluate2(wavelet_decomposition &WaveletCoeffs_L,
} }
} }
void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, struct cont_params cp, void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, const struct cont_params& cp,
int W_L, int H_L, int skip_L, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float *madL) int W_L, int H_L, int skip_L, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float *madL)
{ {
const float eps = 0.01f; const float eps = 0.01f;
@@ -1460,7 +1445,6 @@ void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, struct cont_param
for (int dir = 1; dir < 4; dir++) { for (int dir = 1; dir < 4; dir++) {
Aver(WavCoeffs_L[dir], W_L * H_L, avLP[dir], avLN[dir], maxL[dir], minL[dir]); Aver(WavCoeffs_L[dir], W_L * H_L, avLP[dir], avLN[dir], maxL[dir], minL[dir]);
Sigma(WavCoeffs_L[dir], W_L * H_L, avLP[dir], avLN[dir], sigP[dir], sigN[dir]); Sigma(WavCoeffs_L[dir], W_L * H_L, avLP[dir], avLN[dir], sigP[dir], sigN[dir]);
// printf("dir=%d level=%d avLP=%f max=%f avLN=%f min=%f sigP=%f sigN=%f\n",dir,level,avLP[dir] ,maxL[dir], avLN[dir] ,minL[dir], sigP[dir], sigN[dir]);
} }
AvL = 0.f; AvL = 0.f;
@@ -1501,9 +1485,6 @@ void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, struct cont_param
sigmaN[level] = SN; sigmaN[level] = SN;
MaxP[level] = maxLP; MaxP[level] = maxLP;
MaxN[level] = maxLN; MaxN[level] = maxLN;
// if(params->wavelet.CLmethod!="all") {//display only if user choose different from all
// printf("Ind=%d Level=%d MadL=%f AvL=%f AvN=%f SL=%f SN=%f maxP=%f maxN=%f\n",ind, level,MADL,mean[level],meanN[level],sigma[level],sigmaN[level],MaxP[level],MaxN[level]);
// }
} }
float *ImProcFunctions::ContrastDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast) float *ImProcFunctions::ContrastDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast)
@@ -1520,27 +1501,7 @@ float *ImProcFunctions::ContrastDR(float *Source, int skip, struct cont_params &
#endif #endif
for (int i = 0; i < W_L * H_L; i++) { //contrast for (int i = 0; i < W_L * H_L; i++) { //contrast
/*
//source between 0 and 1
if(Source[i] < 1.f) {
float prov;
if( 32768.f*Source[i]> ave) {
float kh = ah*(Source[i]*100.f)+bh;
prov=32768.f*Source[i];
Contrast[i]=ave+kh*(Source[i]*32768.f-ave);
} else {
float kl = al*(Source[i]*100.f)+bl;
prov=32768.f*Source[i];
Contrast[i]=ave-kl*(ave-Source[i]*32768.f);
}
float diflc=Contrast[i]-prov;
diflc*=factorx;
Contrast[i] = (prov + diflc)/32768.f;
//contrast between 0 and 1
}
*/
Contrast[i] = Source[i] ; Contrast[i] = Source[i] ;
} }
return Contrast; return Contrast;
@@ -1608,9 +1569,6 @@ SSEFUNCTION float *ImProcFunctions::CompressDR(float *Source, int skip, struct c
temp = (Compression - 1.0f) / 20.f; temp = (Compression - 1.0f) / 20.f;
} }
// printf("temp=%f \n", temp);
#ifdef __SSE2__ #ifdef __SSE2__
#ifdef _RT_NESTED_OPENMP #ifdef _RT_NESTED_OPENMP
#pragma omp parallel #pragma omp parallel
@@ -1708,7 +1666,7 @@ void ImProcFunctions::ContrastResid(float * WavCoeffs_L0, unsigned int Iterates
void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params cp, int W_L, int H_L, float max0, float min0) void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params& cp, int W_L, int H_L, float max0, float min0)
{ {
@@ -2031,16 +1989,10 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
float interm = 0.f; float interm = 0.f;
if(cp.lip3 && cp.lipp) { if(cp.lip3 && cp.lipp) {
// comparaison betwwen pixel and neighbours // comparaison between pixel and neighbours
float kneigh, somm; const auto neigh = cp.neigh == 1;
const auto kneigh = neigh ? 28.f : 38.f;
if(cp.neigh == 0) { const auto somm = neigh ? 40.f : 50.f;
kneigh = 38.f;
somm = 50.f;
} else if(cp.neigh == 1) {
kneigh = 28.f;
somm = 40.f;
}
for (int dir = 1; dir < 4; dir++) { //neighbours proxi for (int dir = 1; dir < 4; dir++) { //neighbours proxi
koeLi[lvl * 3 + dir - 1][i * W_L + j] = (kneigh * koeLi[lvl * 3 + dir - 1][i * W_L + j] + 2.f * koeLi[lvl * 3 + dir - 1][(i - 1) * W_L + j] + 2.f * koeLi[lvl * 3 + dir - 1][(i + 1) * W_L + j] koeLi[lvl * 3 + dir - 1][i * W_L + j] = (kneigh * koeLi[lvl * 3 + dir - 1][i * W_L + j] + 2.f * koeLi[lvl * 3 + dir - 1][(i - 1) * W_L + j] + 2.f * koeLi[lvl * 3 + dir - 1][(i + 1) * W_L + j]
@@ -2372,7 +2324,7 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void ImProcFunctions::calckoe(float ** WavCoeffs_LL, struct cont_params cp, float *koeLi[12], int level, int dir, int W_L, int H_L, float edd, float *maxkoeLi, float **tmC) void ImProcFunctions::calckoe(float ** WavCoeffs_LL, const struct cont_params& cp, float *koeLi[12], int level, int dir, int W_L, int H_L, float edd, float *maxkoeLi, float **tmC)
{ {
int borderL = 2; int borderL = 2;
@@ -2688,6 +2640,8 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0,
void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * labco, float ** varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * labco, float ** varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp,
int W_L, int H_L, int skip, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili) int W_L, int H_L, int skip, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili)
{ {
assert (level >= 0);
assert (maxlvl > level);
static const float scales[10] = {1.f, 2.f, 4.f, 8.f, 16.f, 32.f, 64.f, 128.f, 256.f, 512.f}; static const float scales[10] = {1.f, 2.f, 4.f, 8.f, 16.f, 32.f, 64.f, 128.f, 256.f, 512.f};
float scaleskip[10]; float scaleskip[10];
@@ -2700,17 +2654,11 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
float t_r = settings->top_right; float t_r = settings->top_right;
float t_l = settings->top_left; float t_l = settings->top_left;
float b_r = settings->bot_right; float b_r = settings->bot_right;
float b_l = settings->bot_left;
float edd = settings->ed_detec; float edd = settings->ed_detec;
float eddlow = settings->ed_low;
float eddstrength = settings->ed_detecStr; float eddstrength = settings->ed_detecStr;
float aedstr = (eddstrength - 1.f) / 90.f; float aedstr = (eddstrength - 1.f) / 90.f;
float bedstr = 1.f - 10.f * aedstr; float bedstr = 1.f - 10.f * aedstr;
bool refi = false;
// if(cp.lev0s > 0.f || cp.lev1s > 0.f || cp.lev2s > 0.f) refi=true;
// if(cp.val > 0 || refi) {//edge
if(cp.val > 0 && cp.edgeena) { if(cp.val > 0 && cp.edgeena) {
float * koe; float * koe;
float maxkoe = 0.f; float maxkoe = 0.f;
@@ -2724,7 +2672,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
maxkoe = 0.f; maxkoe = 0.f;
if(cp.detectedge) {// if(cp.detectedge) {
float** tmC; float** tmC;
int borderL = 1; int borderL = 1;
tmC = new float*[H_L]; tmC = new float*[H_L];
@@ -2785,8 +2733,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
} }
} }
//printf("maxkoe=%f \n",maxkoe);
for (int i = 0; i < H_L; i++) { for (int i = 0; i < H_L; i++) {
delete [] tmC[i]; delete [] tmC[i];
} }
@@ -2846,9 +2792,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
} }
} }
float coefsd = 0.85f; //arbitray value to reduce effect after sigma in all case
float coefmean = 0.85f; //arbitray value to reduce effect after sigma in all case
// edge = 1.f + value * exp (expkoef);//estimate edge "pseudo variance"
//take into account local contrast //take into account local contrast
float refin = value * exp (expkoef); float refin = value * exp (expkoef);
@@ -2874,7 +2817,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
float edgePrecalc = 1.f + refin; //estimate edge "pseudo variance" float edgePrecalc = 1.f + refin; //estimate edge "pseudo variance"
//bool exa=false;
if(cp.EDmet == 2) { //curve if(cp.EDmet == 2) { //curve
// if(exa) {//curve // if(exa) {//curve
float insigma = 0.666f; //SD float insigma = 0.666f; //SD
@@ -2889,7 +2831,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
float absciss; float absciss;
float kinterm; float kinterm;
float kmul; float kmul;
// for (int i=0; i<W_L*H_L; i++) {
int borderL = 1; int borderL = 1;
for(int i = borderL; i < H_L - borderL; i++ ) { for(int i = borderL; i < H_L - borderL; i++ ) {
@@ -3151,7 +3092,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
mea[7] = mean[level] + 2.f * sigma[level]; //95% mea[7] = mean[level] + 2.f * sigma[level]; //95%
mea[8] = mean[level] + 2.5f * sigma[level]; //99% mea[8] = mean[level] + 2.5f * sigma[level]; //99%
bool skinControl = (skinprot != 0.f);
bool useChromAndHue = (skinprot != 0.f || cp.HSmet); bool useChromAndHue = (skinprot != 0.f || cp.HSmet);
float modchro, kLlev; float modchro, kLlev;
@@ -3192,6 +3132,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
float scale2 = 1.f; float scale2 = 1.f;
float LL100, LL100res, LL100init, kH[maxlvl]; float LL100, LL100res, LL100init, kH[maxlvl];
int ii = i / W_L; int ii = i / W_L;
int jj = i - ii * W_L; int jj = i - ii * W_L;
float LL = labco->L[ii * 2][jj * 2]; float LL = labco->L[ii * 2][jj * 2];
@@ -3209,18 +3150,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
if(useChromAndHue) { if(useChromAndHue) {
/*
int ii=i/W_L;
int jj=i-ii*W_L;
float LL = labco->L[ii*2][jj*2];
LL100=LL100init=LL/327.68f;
LL100res=WavCoeffs_L0[i]/327.68f;
float delta=fabs(LL100init-LL100res)/(maxlvl/2);
for(int ml=0;ml<maxlvl;ml++) {
if(ml < maxlvl/2) kH[ml]=(LL100res+ml*delta)/LL100res;// fixed a priori max to level middle
else kH[ml]=(LL100init-ml*delta)/LL100res;
}
*/
float modhue = varhue[ii][jj]; float modhue = varhue[ii][jj];
modchro = varchrom[ii * 2][jj * 2]; modchro = varchrom[ii * 2][jj * 2];
// hue chroma skin with initial lab datas // hue chroma skin with initial lab datas
@@ -3252,20 +3181,10 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
} else { } else {
scale2 = 1.f + 1.9f * valparam; //near 0 but not zero if curve # 0 scale2 = 1.f + 1.9f * valparam; //near 0 but not zero if curve # 0
} }
//curve Contrast / hue
} }
//
//linear transition HL //linear transition HL
float diagacc = 1.f; float diagacc = 1.f;
/*
if(cp.diag) {
if(dir <=2) diagacc=0.75f;
if(dir ==3) diagacc=1.5f;
}
*/
float alpha = (1024.f + 15.f * (float) cpMul * scale * scale2 * beta * diagacc) / 1024.f ; float alpha = (1024.f + 15.f * (float) cpMul * scale * scale2 * beta * diagacc) / 1024.f ;
if(cp.HSmet && cp.contena) { if(cp.HSmet && cp.contena) {

View File

@@ -2609,17 +2609,21 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol
if (!pedited || pedited->icm.outputIntent) { if (!pedited || pedited->icm.outputIntent) {
Glib::ustring intent; Glib::ustring intent;
switch (icm.outputIntent) { switch (icm.outputIntent) {
default: default:
case RI_PERCEPTUAL: case RI_PERCEPTUAL:
intent = "Perceptual"; intent = "Perceptual";
break; break;
case RI_RELATIVE: case RI_RELATIVE:
intent = "Relative"; intent = "Relative";
break; break;
case RI_SATURATION: case RI_SATURATION:
intent = "Saturation"; intent = "Saturation";
break; break;
case RI_ABSOLUTE: case RI_ABSOLUTE:
intent = "Absolute"; intent = "Absolute";
break; break;
@@ -4110,7 +4114,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited)
if (keyFile.has_key ("Retinex", "Radius")) { if (keyFile.has_key ("Retinex", "Radius")) {
sh.radius = keyFile.get_integer ("Retinex", "Radius"); retinex.radius = keyFile.get_integer ("Retinex", "Radius");
if (pedited) { if (pedited) {
pedited->retinex.radius = true; pedited->retinex.radius = true;
@@ -5845,6 +5849,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited)
if (keyFile.has_key ("Color Management", "OutputProfileIntent")) { if (keyFile.has_key ("Color Management", "OutputProfileIntent")) {
Glib::ustring intent = keyFile.get_string ("Color Management", "OutputProfileIntent"); Glib::ustring intent = keyFile.get_string ("Color Management", "OutputProfileIntent");
if (intent == "Perceptual") { if (intent == "Perceptual") {
icm.outputIntent = RI_PERCEPTUAL; icm.outputIntent = RI_PERCEPTUAL;
} else if (intent == "Relative") { } else if (intent == "Relative") {

View File

@@ -67,7 +67,6 @@ public:
// options in color: // options in color:
Gtk::CheckButton* icm; Gtk::CheckButton* icm;
Gtk::CheckButton* gam;
Gtk::CheckButton* vibrance; Gtk::CheckButton* vibrance;
Gtk::CheckButton* chmixer; Gtk::CheckButton* chmixer;
Gtk::CheckButton* blackwhite; Gtk::CheckButton* blackwhite;
@@ -111,7 +110,6 @@ public:
Gtk::CheckButton* raw_ccSteps; Gtk::CheckButton* raw_ccSteps;
Gtk::CheckButton* raw_dcb_iterations; Gtk::CheckButton* raw_dcb_iterations;
Gtk::CheckButton* raw_dcb_enhance; Gtk::CheckButton* raw_dcb_enhance;
//Gtk::CheckButton* raw_all_enhance;
Gtk::CheckButton* raw_lmmse_iterations; Gtk::CheckButton* raw_lmmse_iterations;
Gtk::CheckButton* df_file; Gtk::CheckButton* df_file;
@@ -129,9 +127,9 @@ public:
sigc::connection vibranceConn, chmixerConn, hsveqConn, rgbcurvesConn, chmixerbwConn, colortoningConn, filmSimulationConn; sigc::connection vibranceConn, chmixerConn, hsveqConn, rgbcurvesConn, chmixerbwConn, colortoningConn, filmSimulationConn;
sigc::connection distortionConn, cacorrConn, vignettingConn, lcpConn; sigc::connection distortionConn, cacorrConn, vignettingConn, lcpConn;
sigc::connection coarserotConn, finerotConn, cropConn, resizeConn, prsharpeningConn, perspectiveConn, commonTransConn; sigc::connection coarserotConn, finerotConn, cropConn, resizeConn, prsharpeningConn, perspectiveConn, commonTransConn;
sigc::connection exifchConn, iptcConn, icmConn, gamcsconn; sigc::connection exifchConn, iptcConn, icmConn;
sigc::connection df_fileConn, df_AutoSelectConn, ff_fileConn, ff_AutoSelectConn, ff_BlurRadiusConn, ff_BlurTypeConn, ff_ClipControlConn; sigc::connection df_fileConn, df_AutoSelectConn, ff_fileConn, ff_AutoSelectConn, ff_BlurRadiusConn, ff_BlurTypeConn, ff_ClipControlConn;
sigc::connection raw_caredConn, raw_cablueConn, raw_ca_autocorrectConn, raw_hotpix_filtConn, raw_deadpix_filtConn, raw_linenoiseConn, raw_greenthreshConn, raw_ccStepsConn, raw_methodConn, raw_dcb_iterationsConn, raw_lmmse_iterationsConn, raw_dcb_enhanceConn, raw_exposConn, raw_preserConn, raw_blackConn; //,raw_all_enhanceConn sigc::connection raw_caredConn, raw_cablueConn, raw_ca_autocorrectConn, raw_hotpix_filtConn, raw_deadpix_filtConn, raw_linenoiseConn, raw_greenthreshConn, raw_ccStepsConn, raw_methodConn, raw_dcb_iterationsConn, raw_lmmse_iterationsConn, raw_dcb_enhanceConn, raw_exposConn, raw_preserConn, raw_blackConn;
public: public:
PartialPasteDlg (Glib::ustring title); PartialPasteDlg (Glib::ustring title);

View File

@@ -1327,12 +1327,12 @@ void Retinex::trimValues (rtengine::procparams::ProcParams* pp)
limd->trimValue(pp->retinex.limd); limd->trimValue(pp->retinex.limd);
highl->trimValue(pp->retinex.highl); highl->trimValue(pp->retinex.highl);
baselog->trimValue(pp->retinex.baselog); baselog->trimValue(pp->retinex.baselog);
// grbl->trimValue(pp->retinex.grbl);
gam->trimValue(pp->retinex.gam); gam->trimValue(pp->retinex.gam);
slope->trimValue(pp->retinex.slope); slope->trimValue(pp->retinex.slope);
highlights->trimValue(pp->retinex.highlights); highlights->trimValue(pp->retinex.highlights);
shadows->trimValue(pp->retinex.shadows); shadows->trimValue(pp->retinex.shadows);
} }
void Retinex::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI) void Retinex::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI)
{ {