From fea35baf69300de63680ffdb94a5a6135abb548c Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 1 Feb 2016 10:55:34 +0100 Subject: [PATCH 1/6] Try to solved iplab2rgb ipwavelet partialpasted retinex --- rtengine/iplab2rgb.cc | 8 ++++++++ rtengine/ipwavelet.cc | 8 ++++++-- rtengine/procparams.cc | 7 ++++++- rtgui/partialpastedlg.h | 2 +- rtgui/retinex.cc | 2 +- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index c36e185d0..9dd68d29a 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -386,6 +386,14 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int Image16* image = new Image16 (cw, ch); float p1, p2, p3, p4, p5, p6; //primaries + //default primaries + p1 = 0.7347; //Prophoto primaries + p2 = 0.2653; + p3 = 0.1596; + p4 = 0.8404; + p5 = 0.0366; + p6 = 0.0001; + //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 pwr; diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 8680a17dc..fd672f2b7 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -2032,7 +2032,8 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * if(cp.lip3 && cp.lipp) { // comparaison betwwen pixel and neighbours - float kneigh, somm; + float kneigh = 38.f; + float somm = 50.f; if(cp.neigh == 0) { kneigh = 38.f; @@ -3191,7 +3192,9 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float scale = 1.f; float scale2 = 1.f; - float LL100, LL100res, LL100init, kH[maxlvl]; + float LL100, LL100res, LL100init;// kH[maxlvl]; + float *kH = new float [maxlvl];//allocate memory + int ii = i / W_L; int jj = i - ii * W_L; float LL = labco->L[ii * 2][jj * 2]; @@ -3307,6 +3310,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit kLlev = alpha; } + delete [] kH; WavCoeffs_L[dir][i] *= (kLlev); } } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 90eafe375..f79f51c91 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2609,17 +2609,21 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol if (!pedited || pedited->icm.outputIntent) { Glib::ustring intent; + switch (icm.outputIntent) { default: case RI_PERCEPTUAL: intent = "Perceptual"; break; + case RI_RELATIVE: intent = "Relative"; break; + case RI_SATURATION: intent = "Saturation"; break; + case RI_ABSOLUTE: intent = "Absolute"; break; @@ -4110,7 +4114,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) if (keyFile.has_key ("Retinex", "Radius")) { - sh.radius = keyFile.get_integer ("Retinex", "Radius"); + retinex.radius = keyFile.get_integer ("Retinex", "Radius"); if (pedited) { pedited->retinex.radius = true; @@ -5845,6 +5849,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) if (keyFile.has_key ("Color Management", "OutputProfileIntent")) { Glib::ustring intent = keyFile.get_string ("Color Management", "OutputProfileIntent"); + if (intent == "Perceptual") { icm.outputIntent = RI_PERCEPTUAL; } else if (intent == "Relative") { diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h index 86f7fd1c2..b443f9dc6 100644 --- a/rtgui/partialpastedlg.h +++ b/rtgui/partialpastedlg.h @@ -67,7 +67,7 @@ public: // options in color: Gtk::CheckButton* icm; - Gtk::CheckButton* gam; + // Gtk::CheckButton* gam; Gtk::CheckButton* vibrance; Gtk::CheckButton* chmixer; Gtk::CheckButton* blackwhite; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 3d9a56fc3..561a28edf 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -1327,12 +1327,12 @@ void Retinex::trimValues (rtengine::procparams::ProcParams* pp) limd->trimValue(pp->retinex.limd); highl->trimValue(pp->retinex.highl); baselog->trimValue(pp->retinex.baselog); -// grbl->trimValue(pp->retinex.grbl); gam->trimValue(pp->retinex.gam); slope->trimValue(pp->retinex.slope); highlights->trimValue(pp->retinex.highlights); 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) { From d2c13ff1aa9447b2ee73114503d6a92113b39ce1 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 7 Feb 2016 13:30:51 +0100 Subject: [PATCH 2/6] Remove some commented out or unused members of the partial-paste dialog. --- rtgui/partialpastedlg.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h index b443f9dc6..7376e1481 100644 --- a/rtgui/partialpastedlg.h +++ b/rtgui/partialpastedlg.h @@ -67,7 +67,6 @@ public: // options in color: Gtk::CheckButton* icm; - // Gtk::CheckButton* gam; Gtk::CheckButton* vibrance; Gtk::CheckButton* chmixer; Gtk::CheckButton* blackwhite; @@ -111,7 +110,6 @@ public: Gtk::CheckButton* raw_ccSteps; Gtk::CheckButton* raw_dcb_iterations; Gtk::CheckButton* raw_dcb_enhance; - //Gtk::CheckButton* raw_all_enhance; Gtk::CheckButton* raw_lmmse_iterations; Gtk::CheckButton* df_file; @@ -129,9 +127,9 @@ public: sigc::connection vibranceConn, chmixerConn, hsveqConn, rgbcurvesConn, chmixerbwConn, colortoningConn, filmSimulationConn; sigc::connection distortionConn, cacorrConn, vignettingConn, lcpConn; 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 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: PartialPasteDlg (Glib::ustring title); From 246115ecb2a312c4f643751a88c8019b84d0a2b6 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 7 Feb 2016 13:35:16 +0100 Subject: [PATCH 3/6] Fix some value and code duplication in parameter initialization. --- rtengine/iplab2rgb.cc | 28 +++++++++------------------- rtengine/ipwavelet.cc | 15 ++++----------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 9dd68d29a..65f0190a9 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -41,8 +41,6 @@ const int numprof = 7; void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) { - //gamutmap(lab); - if (monitorTransform) { int W = lab->W; @@ -386,15 +384,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int Image16* image = new Image16 (cw, ch); float p1, p2, p3, p4, p5, p6; //primaries - //default primaries - p1 = 0.7347; //Prophoto primaries - p2 = 0.2653; - p3 = 0.1596; - p4 = 0.8404; - p5 = 0.0366; - p6 = 0.0001; - //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 pwr; double ts; @@ -409,15 +399,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int //primaries for 7 working profiles ==> output profiles // eventually to adapt primaries if RT used special profiles ! - if(profi == "ProPhoto") { - 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") { + if (profi == "WideGamut") { p1 = 0.7350; //Widegamut primaries p2 = 0.2650; p3 = 0.1150; @@ -465,6 +447,14 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int p5 = 0.1300; p6 = 0.0350; 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 diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index fd672f2b7..a071160bb 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -2031,17 +2031,10 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * float interm = 0.f; if(cp.lip3 && cp.lipp) { - // comparaison betwwen pixel and neighbours - float kneigh = 38.f; - float somm = 50.f; - - if(cp.neigh == 0) { - kneigh = 38.f; - somm = 50.f; - } else if(cp.neigh == 1) { - kneigh = 28.f; - somm = 40.f; - } + // comparaison between pixel and neighbours + const auto neigh = cp.neigh == 1; + const auto kneigh = neigh ? 28.f : 38.f; + const auto somm = neigh ? 40.f : 50.f; 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] From 171674a3e85247d3abb285fb1fe39098f23823ce Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 7 Feb 2016 13:43:58 +0100 Subject: [PATCH 4/6] Assert memory access preconditions in ImProcFunctions::ContAllL and begin to remove some of the detritus in that file as well. --- rtengine/ipwavelet.cc | 92 ++++--------------------------------------- 1 file changed, 7 insertions(+), 85 deletions(-) diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index a071160bb..004423ba3 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -23,9 +23,9 @@ // //////////////////////////////////////////////////////////////// +#include +#include - -#include #include "../rtgui/threadutils.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 // init variables to display Munsell corrections MunsellDebugInfo* MunsDebugInfo = new MunsellDebugInfo(); @@ -219,10 +216,6 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int 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") { cp.contmet = 1; } else if(params->wavelet.TMmethod == "tm") { @@ -1314,15 +1307,7 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int delete dsttmp; } - if (settings->verbose) { - t2e.set(); - printf("Wavelet performed in %d usec:\n", t2e.etime(t1e)); - } - -}//end o - - - +} #undef TS #undef fTS @@ -1460,7 +1445,6 @@ void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, struct cont_param for (int dir = 1; dir < 4; 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]); - // 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; @@ -1501,9 +1485,6 @@ void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, struct cont_param sigmaN[level] = SN; MaxP[level] = maxLP; 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) @@ -1520,27 +1501,7 @@ float *ImProcFunctions::ContrastDR(float *Source, int skip, struct cont_params & #endif 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] ; - } return Contrast; @@ -1608,9 +1569,6 @@ SSEFUNCTION float *ImProcFunctions::CompressDR(float *Source, int skip, struct c temp = (Compression - 1.0f) / 20.f; } -// printf("temp=%f \n", temp); - - #ifdef __SSE2__ #ifdef _RT_NESTED_OPENMP #pragma omp parallel @@ -2682,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, 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}; float scaleskip[10]; @@ -2694,17 +2654,11 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float t_r = settings->top_right; float t_l = settings->top_left; float b_r = settings->bot_right; - float b_l = settings->bot_left; float edd = settings->ed_detec; - float eddlow = settings->ed_low; float eddstrength = settings->ed_detecStr; float aedstr = (eddstrength - 1.f) / 90.f; 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) { float * koe; float maxkoe = 0.f; @@ -2718,7 +2672,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit maxkoe = 0.f; - if(cp.detectedge) {// + if(cp.detectedge) { float** tmC; int borderL = 1; tmC = new float*[H_L]; @@ -2779,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++) { delete [] tmC[i]; } @@ -2840,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 float refin = value * exp (expkoef); @@ -2868,7 +2817,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float edgePrecalc = 1.f + refin; //estimate edge "pseudo variance" - //bool exa=false; if(cp.EDmet == 2) { //curve // if(exa) {//curve float insigma = 0.666f; //SD @@ -2883,7 +2831,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float absciss; float kinterm; float kmul; - // for (int i=0; iL[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 Date: Sun, 7 Feb 2016 14:04:16 +0100 Subject: [PATCH 5/6] Remove some duplication w.r.t. the ICC store from the lab2rgb function. --- rtengine/iplab2rgb.cc | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 65f0190a9..89deac08f 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -30,15 +30,8 @@ namespace rtengine { -#define CLIP01(a) ((a)>0?((a)<1?(a):1):0) - 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) { if (monitorTransform) { @@ -209,18 +202,7 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, } } else { - double rgb_xyz[3][3]; - - 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; - } - } + const auto rgb_xyz = iccStore->workingSpaceMatrix (profile); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) if (multiThread) From a3531d87fbc1f2386a19dd602501a7b50fccd9a7 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 7 Feb 2016 14:10:36 +0100 Subject: [PATCH 6/6] Fix passing the large type struct cont_params by value in the image processing functions. --- rtengine/improcfun.h | 16 ++++------------ rtengine/ipwavelet.cc | 8 ++++---- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 74db0ff3f..44224fa2e 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -286,14 +286,13 @@ public: void dirpyrdenoise (LabImage* src);//Emil's pyramid denoise 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); 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); 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 CAT02 (Imagefloat* baseImg, const ProcParams* params); // pyramid denoise 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, 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 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, int W_ab, int H_ab, const bool useChannelA); 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]); - void Eval2 (float ** WavCoeffs_L, int level, struct cont_params cp, + 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, 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); 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 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); diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 004423ba3..4e433b453 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -1412,7 +1412,7 @@ void ImProcFunctions::Sigma( float * RESTRICT DataList, int datalen, float aver } 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"); int maxlvl = WaveletCoeffs_L.maxlevel(); @@ -1430,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) { const float eps = 0.01f; @@ -1666,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) { @@ -2324,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;