From baa2d91ee6cef32e4e4a1de69caae3a0f30d6103 Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 12 Oct 2017 17:46:31 +0200 Subject: [PATCH] add chroma to cbdl --- rtdata/languages/default | 3 + rtengine/dcrop.cc | 4 + rtengine/dirpyr_equalizer.cc | 8 +- rtengine/improccoordinator.cc | 69 ++++++-- rtengine/improccoordinator.h | 1 + rtengine/improcfun.h | 4 +- rtengine/iplocallab.cc | 292 ++++++++++++++++++++++++++-------- rtengine/procevents.h | 1 + rtengine/procparams.cc | 16 +- rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 3 +- rtengine/simpleprocess.cc | 5 +- rtgui/locallab.cc | 31 +++- rtgui/locallab.h | 3 +- rtgui/paramsedited.cc | 6 + rtgui/paramsedited.h | 1 + 16 files changed, 353 insertions(+), 95 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index cff036866..16c75e001 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -825,6 +825,7 @@ HISTORY_MSG_575;Local - Exp Contrast curve HISTORY_MSG_576;Local - Centerbuf HISTORY_MSG_577;Local - adjblur HISTORY_MSG_578;Local - cut past +HISTORY_MSG_579;Local - cbdl chroma HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -1810,6 +1811,8 @@ TP_LOCALLAB_CUTPAST;Copy past buffer TP_LOCALLAB_DENOIS;Denoise TP_LOCALLAB_DUST;Dust Spot Removal TP_LOCALLAB_LUM;Curves +TP_LOCALLAB_CHROMACBDL;Chroma +TP_LOCALLAB_CHROMACB_TOOLTIP;Acts as an amplifier-reducer action compare to sliders of luminance.\nUnder 100 reduce, above 100 amplifie TP_LOCALLAB_CURVEEDITOR_TONES_TOOLTIP;L=f(L), can be used with L(H) in Color and Light TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP;To be active, you must check button 'Enable curves' TP_LOCALLAB_CURVEMETHOD_TOOLTIP;'Normal', the curve L=f(L) has the same algorithm than slider lightness.\n'Super' the curve L=f(L) has an new improved algorithm, which can leeds in some cases to artifacts. diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index bc1c29156..4641f3ca0 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1034,6 +1034,8 @@ void Crop::update (int todo) params.locallab.cutpast = true; } + params.locallab.chromacbdl = parent->chromacbdls[sp]; + std::vector cretie; for (int j = 0; j < parent->sizeretics[sp]; j++) { @@ -1367,6 +1369,8 @@ void Crop::update (int todo) } + parent->chromacbdls[sp] = params.locallab.chromacbdl = parent->chromacbdls[0]; + std::vector ccret; for (int j = 0; j < parent->sizeretics[sp]; j++) { diff --git a/rtengine/dirpyr_equalizer.cc b/rtengine/dirpyr_equalizer.cc index 2011c6cbe..8cd2a91d3 100644 --- a/rtengine/dirpyr_equalizer.cc +++ b/rtengine/dirpyr_equalizer.cc @@ -261,7 +261,7 @@ SSEFUNCTION void ImProcFunctions :: dirpyr_equalizer (float ** src, float ** dst } -SSEFUNCTION void ImProcFunctions :: cbdl_local_temp (float ** src, float ** dst, float ** loctemp, int srcwidth, int srcheight, const float * mult, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev) +SSEFUNCTION void ImProcFunctions :: cbdl_local_temp (float ** src, float ** dst, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev) { int lastlevel = maxlevelloc; @@ -312,18 +312,17 @@ SSEFUNCTION void ImProcFunctions :: cbdl_local_temp (float ** src, float ** dst, if (lv >= 1) { if (scalefl[lv] < 1.f) { - multi[lv] = (atten123 * ((float) mult[lv] - 1.f) / 100.f) + 1.f; //modulate action if zoom < 100% + if(mult[lv] > 1.f) multi[lv] = (atten123 * ((float) mult[lv] - 1.f) / 100.f) + 1.f; //modulate action if zoom < 100% } else { multi[lv] = (float) mult[lv]; } } else { if (scalefl[lv] < 1.f) { - multi[lv] = (atten0 * ((float) mult[lv] - 1.f) / 100.f) + 1.f; //modulate action if zoom < 100% + if(mult[lv] > 1.f) multi[lv] = (atten0 * ((float) mult[lv] - 1.f) / 100.f) + 1.f; //modulate action if zoom < 100% } else { multi[lv] = (float) mult[lv]; } } - } if (settings->verbose) { @@ -377,6 +376,7 @@ SSEFUNCTION void ImProcFunctions :: cbdl_local_temp (float ** src, float ** dst, for (int j = 0; j < srcwidth; j++) { dst[i][j] = src[i][j]; loctemp[i][j] = CLIP (buffer[i][j]); // TODO: Really a clip necessary? + // dst[i][j] = CLIP (buffer[i][j]); // TODO: Really a clip necessary? } } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index bfb8720c3..a818ce5c9 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -160,6 +160,7 @@ ImProcCoordinator::ImProcCoordinator () mult2s (500, -10000), mult3s (500, -10000), mult4s (500, -10000), + chromacbdls (500, -10000), thresholds (500, -10000), sensicbs (500, -10000), activlums (500, -10000), @@ -838,7 +839,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) }; - int maxdata = 77;//73 for 10011 + int maxdata = 78;//73 for 10011 if (fic0) { //find current version mip @@ -882,7 +883,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //initilize newues when first utilisation of Locallab. Prepare creation of Mip files for (int sp = 1; sp < maxspot; sp++) { // spots default int t_sp = sp; - int t_mipversion = 10012;//new value for each change + int t_mipversion = 10013;//new value for each change int t_circrad = 18; int t_locX = 250; int t_locY = 250; @@ -988,6 +989,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int t_adjblur = 0; int t_cutpast = 0; + //10013 + int t_chromacbdl = 0; //all variables except locRETgainCurve 'coomon for all) fic << "Mipversion=" << t_mipversion << '@' << endl; @@ -1071,6 +1074,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fic << "Adjblur=" << t_adjblur << '@' << endl; fic << "Cutpast=" << t_cutpast << '@' << endl; + fic << "Chromacbdl=" << t_chromacbdl << '@' << endl; + fic << "curveReti=" << t_curvret << '@' << endl; fic << "curveLL=" << t_curvll << '@' << endl; fic << "curveLH=" << t_curvlh << '@' << endl; @@ -1289,6 +1294,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) dataspot[73][0] = cutpasts[0] = 1; } + dataspot[74][0] = chromacbdls[0] = params.locallab.chromacbdl; + // for all curves work around - I do not know how to do with params curves... //curve Reti local int siz = params.locallab.localTgaincurve.size(); @@ -1544,7 +1551,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) maxind = 57; } - if (versionmip == 10007 || versionmip == 10008) { + if (versionmip == 10008) { maxind = 58; } @@ -1558,6 +1565,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) maxind = 70; } + if (versionmip == 10012) { + maxind = 74; + } + while (getline (fich, line)) { spotline = line; std::size_t pos = spotline.find ("="); @@ -1647,7 +1658,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (versionmip == 10001) { + if (versionmip <= 10001) { for (int sp = 1; sp < maxspot; sp++) { // spots default dataspot[55][sp] = 500; //retrab @@ -1656,7 +1667,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (versionmip == 10002) { + if (versionmip <= 10002) { for (int sp = 1; sp < maxspot; sp++) { // spots default std::string ll_str = "3000A0B0C1000D1000E"; //"3000A0B0C499D501E1000F1000G"; //"3000A0B0C1000D1000E"; //"3000A0B0C200D200E800F800G1000H1000I";//"0A" @@ -1664,7 +1675,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (versionmip == 10003) { + if (versionmip <= 10003) { for (int sp = 1; sp < maxspot; sp++) { // spots default std::string lh_str = "1000A0B500C350D350E166F500G350H350I333J500K350L350M500N500O350P350Q666R500S350T350U833V500W350X350Y"; @@ -1672,14 +1683,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (versionmip == 10004) { + if (versionmip <= 10004) { for (int sp = 1; sp < maxspot; sp++) { // spots default dataspot[56][sp] = 0; //curvactiv } } - if (versionmip == 10005) { + if (versionmip <= 10005) { for (int sp = 1; sp < maxspot; sp++) { // spots default std::string cc_str = "3000A0B0C1000D1000E"; @@ -1687,14 +1698,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (versionmip == 10006) { + if (versionmip <= 10006) { for (int sp = 1; sp < maxspot; sp++) { // spots default dataspot[57][sp] = 0; //qualitycurveMethod } } - if (versionmip == 10007) { + if (versionmip <= 10007) { for (int sp = 1; sp < maxspot; sp++) { // spots default std::string hh_str = "1000A0B500C350D350E166F500G350H350I333J500K350L350M500N500O350P350Q666R500S350T350U833V500W350X350Y"; @@ -1702,7 +1713,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (versionmip == 10008) { + if (versionmip <= 10008) { //vibrance for (int sp = 1; sp < maxspot; sp++) { // spots default @@ -1718,7 +1729,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (versionmip == 10009) {//exposure + if (versionmip <= 10009) {//exposure for (int sp = 1; sp < maxspot; sp++) { // spots default dataspot[64][sp] = 0; dataspot[65][sp] = 0; @@ -1730,7 +1741,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (versionmip == 10010) { + if (versionmip <= 10010) { for (int sp = 1; sp < maxspot; sp++) { // spots default std::string ex_str = "3000A0B0C1000D1000E"; @@ -1738,6 +1749,23 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } + if (versionmip <= 10011) {// + for (int sp = 1; sp < maxspot; sp++) { // spots default + dataspot[70][sp] = 0; + dataspot[71][sp] = 0; + dataspot[72][sp] = 0; + dataspot[73][sp] = 0; + + } + } + + if (versionmip <= 10012) {// + for (int sp = 1; sp < maxspot; sp++) { // spots default + dataspot[74][sp] = 0; + + } + } + //here we change the number of spot if (ns < (maxspot - 1)) { @@ -1746,7 +1774,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int sp = ns + 1 ; sp < maxspot; sp++) { // spots default int t_sp = sp; - int t_mipversion = 10012; + int t_mipversion = 10013; int t_circrad = 18; int t_locX = 250; int t_locY = 250; @@ -1844,6 +1872,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int t_adjblur = 0; int t_cutpast = 0; + //10013 + int t_chromacbdl = 0; + fic << "Mipversion=" << t_mipversion << '@' << endl; fic << "Spot=" << t_sp << '@' << endl; fic << "Circrad=" << t_circrad << '@' << endl; @@ -1923,6 +1954,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fic << "Adjblur=" << t_adjblur << '@' << endl; fic << "Cutpast=" << t_cutpast << '@' << endl; + fic << "Chromacbdl=" << t_chromacbdl << '@' << endl; + fic << "curveReti=" << t_curvret << '@' << endl; fic << "curveLL=" << t_curvll << '@' << endl; fic << "curveLH=" << t_curvlh << '@' << endl; @@ -2228,6 +2261,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) params.locallab.cutpast = true; } + params.locallab.chromacbdl = chromacbdls[sp] = dataspot[74][sp]; int *s_datc; s_datc = new int[70]; @@ -2709,6 +2743,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) cutpasts[sp] = 1; } + dataspot[74][sp] = chromacbdls[sp] = params.locallab.chromacbdl = dataspot[74][0]; int *s_datc; s_datc = new int[70]; @@ -2948,7 +2983,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int spe = 1; spe < maxspot; spe++) { int t_sp = spe; - int t_mipversion = 10012; + int t_mipversion = 10013; int t_circrad = dataspot[2][spe]; int t_locX = dataspot[3][spe]; int t_locY = dataspot[4][spe]; @@ -3026,6 +3061,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int t_adjblur = dataspot[72][spe]; int t_cutpast = dataspot[73][spe]; + int t_chromacbdl = dataspot[74][spe]; + int t_hueref = dataspot[maxdata - 3][spe]; int t_chromaref = dataspot[maxdata - 2][spe]; int t_lumaref = dataspot[maxdata - 1][spe]; @@ -3121,6 +3158,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fou << "Adjblur=" << t_adjblur << '@' << endl; fou << "Cutpast=" << t_cutpast << '@' << endl; + fou << "Chromacbdl=" << t_chromacbdl << '@' << endl; + fou << "hueref=" << t_hueref << '@' << endl; fou << "chromaref=" << t_chromaref << '@' << endl; fou << "lumaref=" << t_lumaref << '@' << endl; diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index ff1e72fbc..0e8117c9a 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -306,6 +306,7 @@ protected: LUTi mult2s; LUTi mult3s; LUTi mult4s; + LUTi chromacbdls; LUTi thresholds; LUTi sensicbs; LUTi activlums; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index b3f642095..07e4a28ac 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -302,7 +302,7 @@ public: void Reti_Local (int call, float ** buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int chro); void InverseReti_Local (const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int chro); void Contrast_Local (int call, float ave, LabImage * bufcontorig, float ** buflightc, float moy, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, float pm, struct local_contra &lco, float lumaref, float av, const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); - void cbdl_Local (int call, int sp, float ** buflight, float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + void cbdl_Local (int call, int sp, float ** buflight, float ** bufchrom, float **loctemp, float **loctempch, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int chro); void BlurNoise_Local (int call, int sp, LabImage* tmp1, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); void TM_Local (int call, int sp, LabImage* tmp1, float ** buflight, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); static void strcurv_data (std::string retistr, int *s_datc, int &siz); @@ -377,7 +377,7 @@ public: // pyramid wavelet void dirpyr_equalizer (float ** src, float ** dst, int srcwidth, int srcheight, float ** l_a, float ** l_b, float ** dest_a, float ** dest_b, const double * mult, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale);//Emil's directional pyramid wavelet - void cbdl_local_temp (float ** src, float ** dst, float ** loctemp, int srcwidth, int srcheight, const float * mult, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale); + void cbdl_local_temp (float ** src, float ** dst, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale); void dirpyr_equalizercam (CieImage* ncie, float ** src, float ** dst, int srcwidth, int srcheight, float ** h_p, float ** C_p, const double * mult, const double dirpyrThreshold, const double skinprot, bool execdir, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale);//Emil's directional pyramid wavelet void dirpyr_channel (float ** data_fine, float ** data_coarse, int width, int height, int level, int scale); void idirpyr_eq_channel_loc (float ** data_coarse, float ** data_fine, float ** loctemp, float ** buffer, int width, int height, int level, float multi[5], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index fca3c6c1d..e425b263d 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -116,6 +116,7 @@ struct local_params { float noisecc; float mulloc[5]; float threshol; + float chromacb; float strengt; float gamm; float esto; @@ -198,6 +199,8 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str } float thresho = ((float)locallab.threshold ) / 100.f; + float chromcbdl = (float)locallab.chromacbdl ; + int local_chroma = locallab.chroma; int local_sensi = locallab.sensi; int local_sensibn = locallab.sensibn; @@ -283,6 +286,7 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str } lp.threshol = thresho; + lp.chromacb = chromcbdl; lp.colorena = locallab.expcolor; lp.blurena = locallab.expblur; lp.tonemapena = locallab.exptonemap; @@ -1396,7 +1400,7 @@ void ImProcFunctions::DeNoise_Local (int call, const struct local_params& lp, La } -void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float ** bufchrom, float **loctemp, float **loctempch, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int chro) { //local CBDL BENCHFUN @@ -1415,6 +1419,9 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l const float ahu = 1.f / (2.8f * lp.senscb - 280.f); const float bhu = 1.f - ahu * 2.8f * lp.senscb; + const float alum = 1.f / (lp.senscb - 100.f); + const float blum = 1.f - alum * lp.senscb; + #ifdef _OPENMP #pragma omp parallel if (multiThread) #endif @@ -1476,14 +1483,15 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; #endif // int zone; + float rL = original->L[y][x] / 327.68f; //retrieve data float cli = 1.f; - // if (lp.curvact == true) { + if (chro == 0) { - cli = (buflight[loy - begy][lox - begx]); - // } + cli = buflight[loy - begy][lox - begx]; + } //parameters for linear interpolation in function of real hue float apluscligh = (1.f - cli) / delhu; @@ -1493,6 +1501,23 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l float realcligh = 1.f; + float cchr = 1.f; + + if (chro == 1) { + cchr = bufchrom[loy - begy][lox - begx]; + //printf("cc=%f ", cchr); + + } + + //printf("cc=%f ", cchr); + //parameters for linear interpolation in function of real hue + float apluscchro = (1.f - cchr) / delhu; + float bpluscchro = 1.f - apluscchro * hueplus; + float amoinscchro = (cchr - 1.f) / delhu; + float bmoinscchro = 1.f - amoinscchro * huemoins; + + float realcchro = 1.f; + // float localFactor = 1.f; // calcTransition (lox, loy, ach, lp, zone, localFactor); @@ -1500,6 +1525,7 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l float khu = 0.f; float kch = 1.f; float fach = 1.f; + float falu = 1.f; float deltachro = fabs (rchro - chromaref); float deltahue = fabs (rhue - hueref); @@ -1508,6 +1534,7 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l } float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 + float deltaL = fabs (lumaref - rL); //between 0 and 100 //kch to modulate action with chroma if (deltachro < 160.f * SQR (lp.senscb / 100.f)) { @@ -1530,15 +1557,18 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l if ((hueref + dhue) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good if (rhue >= hueplus - delhu ) { realcligh = apluscligh * rhue + bpluscligh; + realcchro = apluscchro * rhue + bpluscchro; khu = apl * rhue + bpl; } else if (rhue < huemoins + delhu) { khu = amo * rhue + bmo; realcligh = amoinscligh * rhue + bmoinscligh; + realcchro = amoinscchro * rhue + bmoinscchro; } else { khu = 1.f; realcligh = cli; + realcchro = cchr; } @@ -1547,15 +1577,18 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; + realcchro = apluscchro * rhue + bpluscchro; khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { khu = amo * rhue + bmo; + realcchro = amoinscchro * rhue + bmoinscchro; realcligh = amoinscligh * rhue + bmoinscligh; } else { khu = 1.f; realcligh = cli; + realcchro = cchr; } @@ -1565,14 +1598,17 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins ) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; + realcchro = apluscchro * rhue + bpluscchro; khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { realcligh = amoinscligh * rhue + bmoinscligh; + realcchro = amoinscchro * rhue + bmoinscchro; khu = amo * rhue + bmo; } else { realcligh = cli; + realcchro = cchr; khu = 1.f; @@ -1582,37 +1618,49 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; + realcchro = apluscchro * rhue + bpluscchro; khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { khu = amo * rhue + bmo; realcligh = amoinscligh * rhue + bmoinscligh; + realcchro = amoinscchro * rhue + bmoinscchro; } else { khu = 1.f; realcligh = cli; + realcchro = cchr; } // kzon = true; } - if (deltaE < 2.8f * lp.senscb) { - fach = khu; - } else { - fach = khu * (ahu * deltaE + bhu); - } + if (lp.senscb <= 20.f) { + + if (deltaE < 2.8f * lp.senscb) { + fach = khu; + } else { + fach = khu * (ahu * deltaE + bhu); + } - float kcr = 10.f; + float kcr = 10.f; - if (rchro < kcr) { - fach *= (1.f / (kcr * kcr)) * rchro * rchro; - } + if (rchro < kcr) { + fach *= (1.f / (kcr * kcr)) * rchro * rchro; + } - if (lp.qualmet == 1) { - } else { - fach = 1.f; + if (lp.qualmet >= 1) { + } else { + fach = 1.f; + } + + if (deltaL < lp.senscb) { + falu = 1.f; + } else { + falu = alum * deltaL + blum; + } } //fach = khu ; @@ -1629,9 +1677,11 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l */ } + //printf("rli=%f rch=%f ", realcligh, realcchro ); float fli = ((100.f + realcligh) / 100.f);//luma transition float kcr = 100.f * lp.thr; float falL = 1.f; + // float fchr = ((100.f + realcchro) / 100.f);//chroma transition if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm falL *= pow (rchro / kcr, lp.iterat / 10.f); @@ -1639,28 +1689,70 @@ void ImProcFunctions::cbdl_Local (int call, int sp, float ** buflight, float **l switch (zone) { case 0: { // outside selection and outside transition zone => no effect, keep original values - transformed->L[y][x] = original->L[y][x]; + if (chro == 0) { + transformed->L[y][x] = original->L[y][x]; + } + + if (chro == 1) { + transformed->a[y][x] = original->a[y][x]; + transformed->b[y][x] = original->b[y][x]; + } + break; } case 1: { // inside transition zone float factorx = localFactor; float difL = 0.f; + float difa = 0.f; + float difb = 0.f; - difL = loctemp[loy - begy][lox - begx] * fli * falL - original->L[y][x]; + if (chro == 0) { - //float difL = loctemp[y][x] - original->L[y][x]; - difL *= factorx; - transformed->L[y][x] = original->L[y][x] + difL * kch * fach; + difL = loctemp[loy - begy][lox - begx] * fli * falL - original->L[y][x]; + difL *= factorx; + transformed->L[y][x] = original->L[y][x] + difL * kch * fach; + } + + if (chro == 1) { + + float difab = loctempch[loy - begy][lox - begx] - sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); + difa = difab * cos (rhue); + difb = difab * sin (rhue); + difa *= factorx * (100.f + realcchro * falu * falL) / 100.f; + difb *= factorx * (100.f + realcchro * falu * falL) / 100.f; + difa *= kch * fach; + difb *= kch * fach; + transformed->a[y][x] = CLIPC (original->a[y][x] + difa); + transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + } break; } case 2: { // inside selection => full effect, no transition float difL = 0.f; - difL = loctemp[loy - begy][lox - begx] * fli * falL - original->L[y][x]; + float difa = 0.f; + float difb = 0.f; - transformed->L[y][x] = original->L[y][x] + difL * kch * fach; + if (chro == 0) { + + difL = loctemp[loy - begy][lox - begx] * fli * falL - original->L[y][x]; + transformed->L[y][x] = original->L[y][x] + difL * kch * fach; + } + + if (chro == 1) { + float difab = loctempch[loy - begy][lox - begx] - sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); + difa = difab * cos (rhue); + difb = difab * sin (rhue); + difa *= (100.f + realcchro * falu * falL) / 100.f; + difb *= (100.f + realcchro * falu * falL) / 100.f; + difa *= kch * fach; + difb *= kch * fach; + transformed->a[y][x] = CLIPC (original->a[y][x] + difa); + transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + + } } } @@ -6573,7 +6665,9 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** //begin cbdl if ((lp.mulloc[0] != 1.f || lp.mulloc[1] != 1.f || lp.mulloc[2] != 1.f || lp.mulloc[3] != 1.f || lp.mulloc[4] != 1.f) && lp.cbdlena) { float **bufsh = nullptr;//buffer por square zone + float **bufchr = nullptr;//buffer por square zone float **loctemp = nullptr; + float **loctempch = nullptr; int bfh = int (lp.ly + lp.lyT) + del; //bfw bfh real size of square zone int bfw = int (lp.lx + lp.lxL) + del; float b_l = -5.f; @@ -6583,6 +6677,19 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** double skinprot = 0.; int choice = 0; float **buflight = nullptr; + float **bufchrom = nullptr; + + // I initialize these variable in case of ! + float hueplus = hueref + dhuecb; + float huemoins = hueref - dhuecb; + + if (hueplus > rtengine::RT_PI) { + hueplus = hueref + dhuecb - 2.f * rtengine::RT_PI; + } + + if (huemoins < -rtengine::RT_PI) { + huemoins = hueref - dhuecb + 2.f * rtengine::RT_PI; + } if (call <= 3) { //call from simpleprocess dcrop improcc @@ -6592,12 +6699,35 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** bufsh[i] = new float[bfw]; } + bufchr = new float*[bfh]; + + for (int i = 0; i < bfh; i++) { + bufchr[i] = new float[bfw]; + } + buflight = new float*[bfh];//for lightness reti for (int i = 0; i < bfh; i++) { buflight[i] = new float[bfw]; } + bufchrom = new float*[bfh];//for lightness reti + + for (int i = 0; i < bfh; i++) { + bufchrom[i] = new float[bfw]; + } + + loctemp = new float*[bfh];//allocate temp + + for (int i = 0; i < bfh; i++) { + loctemp[i] = new float[bfw]; + } + + loctempch = new float*[bfh];//allocate temp + + for (int i = 0; i < bfh; i++) { + loctempch[i] = new float[bfw]; + } #ifdef _OPENMP #pragma omp parallel for @@ -6607,7 +6737,10 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** for (int jr = 0; jr < bfw; jr++) { bufsh[ir][jr] = 0.f; buflight[ir][jr] = 0.f; - + bufchr[ir][jr] = 0.f; + bufchrom[ir][jr] = 0.f; + loctemp[ir][jr] = 0.f; + loctempch[ir][jr] = 0.f; } @@ -6627,16 +6760,12 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { bufsh[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas + bufchr[loy - begy][lox - begx] = sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); } } - loctemp = new float*[bfh];//allocate temp - for (int i = 0; i < bfh; i++) { - loctemp[i] = new float[bfw]; - } - - ImProcFunctions::cbdl_local_temp (bufsh, bufsh, loctemp, bfw, bfh, lp.mulloc, lp.threshol, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); + ImProcFunctions::cbdl_local_temp (bufsh, bufsh, loctemp, bfw, bfh, lp.mulloc, 1.f, lp.threshol, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); #ifdef _OPENMP @@ -6651,47 +6780,18 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { float rL; rL = CLIPRET ((loctemp[loy - begy][lox - begx] - original->L[y][x]) / 330.f); - /* - if (rL > maxc) { - maxc = rL; - } - - if (rL < minc) { - minc = rL; - } - */ buflight[loy - begy][lox - begx] = rL; } } -// printf ("min=%2.2f max=%2.2f", minc, maxc); - } - // I initialize these variable in case of ! - float hueplus = hueref + dhuecb; - float huemoins = hueref - dhuecb; + cbdl_Local (call, sp, buflight, bufchrom, loctemp, loctempch, hueplus, huemoins, hueref, dhuecb, chromaref, lumaref, lp, original, transformed, cx, cy, 0); - if (hueplus > rtengine::RT_PI) { - hueplus = hueref + dhuecb - 2.f * rtengine::RT_PI; - } - - if (huemoins < -rtengine::RT_PI) { - huemoins = hueref - dhuecb + 2.f * rtengine::RT_PI; - } - - cbdl_Local (call, sp, buflight, loctemp, hueplus, huemoins, hueref, dhuecb, chromaref, lumaref, lp, original, transformed, cx, cy); - - if (call <= 3) { - for (int i = 0; i < bfh; i++) { - delete [] loctemp[i]; - } - - delete [] loctemp; for (int i = 0; i < bfh; i++) { delete [] bufsh[i]; @@ -6699,22 +6799,84 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** delete [] bufsh; + //chroma CBDL begin here + if (lp.chromacb > 0.f) { + if (lp.chromacb <= 1.f) { + lp.chromacb = 1.f; + } + + float multc[5]; + + + for (int lv = 0; lv < 5; lv++) { + multc[lv] = (lp.chromacb * ((float) lp.mulloc[lv] - 1.f) / 100.f) + 1.f; + + if (multc[lv] <= 0.f) { + multc[lv] = 0.f; + } + } + + { + ImProcFunctions::cbdl_local_temp (bufchr, bufchr, loctempch, bfw, bfh, multc, lp.chromacb, lp.threshol, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); + + float rch; + +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int y = 0; y < transformed->H ; y++) //{ + for (int x = 0; x < transformed->W; x++) { + int lox = cx + x; + int loy = cy + y; + + if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { + rch = CLIPRET ((loctempch[loy - begy][lox - begx] - sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x]))) / 3.f); + bufchrom[loy - begy][lox - begx] = rch; + } + } + } + + cbdl_Local (call, sp, buflight, bufchrom, loctemp, loctempch, hueplus, huemoins, hueref, dhuecb, chromaref, lumaref, lp, original, transformed, cx, cy, 1); + } + + for (int i = 0; i < bfh; i++) { + delete [] loctemp[i]; + } + + delete [] loctemp; + + for (int i = 0; i < bfh; i++) { + delete [] loctempch[i]; + } + + delete [] loctempch; + + + for (int i = 0; i < bfh; i++) { + delete [] bufchr[i]; + } + + delete [] bufchr; + + for (int i = 0; i < bfh; i++) { delete [] buflight[i]; } delete [] buflight; - } /* else { - for (int i = 0; i < GH; i++) { - delete [] loctemp[i]; + for (int i = 0; i < bfh; i++) { + delete [] bufchrom[i]; } - delete [] loctemp; + delete [] bufchrom; + + } -*/ + } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index e279e6a5e..64d5748b9 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -605,6 +605,7 @@ enum ProcEvent { EvlocallabCenterbuf = 575, Evlocallabadjblur = 576, Evlocallabcutpast = 577, + Evlocallabchromacbdl = 578, NUMOFEVENTS diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index b9da88c61..48991e48d 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1074,6 +1074,7 @@ void LocallabParams::setDefaults() } threshold = 20; + chromacbdl = 0; excurve.clear (); excurve.push_back (DCT_Linear); @@ -3257,6 +3258,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_integer ("Locallab", "Threshold", locallab.threshold); } + if (!pedited || pedited->locallab.chromacbdl) { + keyFile.set_integer ("Locallab", "Chromacbdl", locallab.chromacbdl); + } + if (!pedited || pedited->locallab.stren) { keyFile.set_integer ("Locallab", "Stren", locallab.stren); } @@ -4647,7 +4652,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->locallab.expcbdl = true; } } - + if (keyFile.has_key ("Locallab", "Expexpose")) { locallab.expexpose = keyFile.get_boolean ("Locallab", "Expexpose"); @@ -5386,6 +5391,14 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Locallab", "Chromacbdl")) { + locallab.chromacbdl = keyFile.get_integer ("Locallab", "Chromacbdl"); + + if (pedited) { + pedited->locallab.chromacbdl = true; + } + } + } // load channel mixer curve @@ -10020,6 +10033,7 @@ bool ProcParams::operator== (const ProcParams& other) && locallab.lumaref == other.locallab.lumaref && locallab.vart == other.locallab.vart && locallab.threshold == other.locallab.threshold + && locallab.chromacbdl == other.locallab.chromacbdl && locallab.expcolor == other.locallab.expcolor && locallab.expexpose == other.locallab.expexpose && locallab.expvibrance == other.locallab.expvibrance diff --git a/rtengine/procparams.h b/rtengine/procparams.h index e70210c3f..cdc168dd2 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1024,6 +1024,7 @@ public: double mult[5]; double threshold; + int chromacbdl; LocallabParams (): psthreshold (0, 75, false) { diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 004456c1f..9b27dbe95 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -604,7 +604,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallabshape LUMINANCECURVE, //Evlocallabcenterbuf LUMINANCECURVE, //Evlocallabadjblur - LUMINANCECURVE //Evlocallabcutpast + LUMINANCECURVE, //Evlocallabcutpast + LUMINANCECURVE //Evlocallabchromacbdl }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index cf002572e..38820888c 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1102,7 +1102,7 @@ private: } ifstream fich (datalab, ios::in); - int maxdata = 77;//73 10011 + int maxdata = 78;//73 10011 if (fich && versionmip != 0) { std::string inser; @@ -1303,6 +1303,7 @@ private: dataspots[73][0] = 1; } + dataspots[74][0] = params.locallab.chromacbdl; dataspots[maxdata - 3][0] = 100.f * params.locallab.hueref; dataspots[maxdata - 2][0] = params.locallab.chromaref; @@ -1736,6 +1737,8 @@ private: params.locallab.cutpast = true; } + params.locallab.chromacbdl = dataspots[74][sp]; + params.locallab.hueref = ((float) dataspots[maxdata - 3][sp]) / 100.f; params.locallab.chromaref = dataspots[maxdata - 2][sp]; params.locallab.lumaref = dataspots[maxdata - 1][sp]; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index f2c664670..cb9cc0ee1 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -64,7 +64,7 @@ Locallab::Locallab (): locYT (Gtk::manage (new Adjuster (M ("TP_LOCAL_HEIGHT_T"), 0, 1500, 1, 250))), centerX (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CENTER_X"), -1000, 1000, 1, 0))), centerY (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CENTER_Y"), -1000, 1000, 1, 0))), - circrad (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CIRCRADIUS"), 4, 150, 1, 18))), + circrad (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CIRCRADIUS"), 2, 150, 1, 18))), thres (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_THRES"), 1, 35, 1, 18))), proxi (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_PROXI"), 0, 60, 1, 20))), lightness (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_LIGHTNESS"), -100, 100, 1, 0))), @@ -93,6 +93,7 @@ Locallab::Locallab (): chrrt (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CHRRT"), 0, 100, 1, 0))), sensih (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSIH"), 0, 100, 1, 19))), retrab (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_RETRAB"), 0, 10000, 1, 500))), + chromacbdl (Gtk::manage ( new Adjuster (M ("TP_LOCALLAB_CHROMACBDL"), 0, 300, 1, 0) )), threshold (Gtk::manage ( new Adjuster (M ("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 100, 1, 20) )), sensicb (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSICB"), 0, 100, 1, 19))), sharradius (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SHARRADIUS"), 42, 500, 1, 4))), @@ -552,6 +553,11 @@ Locallab::Locallab (): Gtk::HSeparator *separator3 = Gtk::manage (new Gtk::HSeparator()); cbdlBox->pack_start (*separator3, Gtk::PACK_SHRINK, 2); + chromacbdl->set_tooltip_text (M ("TP_LOCALLAB_CHROMACB_TOOLTIP")); + + chromacbdl->setAdjusterListener (this); + cbdlBox->pack_start (*chromacbdl); + threshold->setAdjusterListener (this); cbdlBox->pack_start (*threshold); @@ -1211,6 +1217,7 @@ void Locallab::neutral_pressed () multiplier[i]->resetValue (false); } + chromacbdl->resetValue (false); threshold->resetValue (false); sensicb->resetValue (false); sharradius->resetValue (false); @@ -1693,10 +1700,12 @@ bool Locallab::localComputed_ () cutpast->set_active (true); } - double intermed = 0.01 * (double) nextdatasp[74]; + chromacbdl->setValue (nextdatasp[74]); + + double intermed = 0.01 * (double) nextdatasp[75]; hueref->setValue (intermed); - chromaref->setValue (nextdatasp[75]); - lumaref->setValue (nextdatasp[76]); + chromaref->setValue (nextdatasp[76]); + lumaref->setValue (nextdatasp[77]); int *s_datc; s_datc = new int[70]; @@ -1964,7 +1973,7 @@ bool Locallab::localComputed_ () void Locallab::localChanged (int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat) { - for (int i = 2; i < 77; i++) { + for (int i = 2; i < 78; i++) { nextdatasp[i] = datasp[i][sp]; } @@ -2065,6 +2074,7 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) } threshold->setEditedState (pedited->locallab.threshold ? Edited : UnEdited); + chromacbdl->setEditedState (pedited->locallab.chromacbdl ? Edited : UnEdited); sensi->setEditedState (pedited->locallab.sensi ? Edited : UnEdited); sensih->setEditedState (pedited->locallab.sensih ? Edited : UnEdited); @@ -2282,6 +2292,7 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) } threshold->setValue (pp->locallab.threshold); + chromacbdl->setValue (pp->locallab.chromacbdl); lastavoid = pp->locallab.avoid; lastinvers = pp->locallab.invers; @@ -2681,6 +2692,7 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) } pp->locallab.threshold = threshold->getIntValue(); + pp->locallab.chromacbdl = chromacbdl->getIntValue(); pp->locallab.pastels = pastels->getIntValue(); pp->locallab.saturated = pastSatTog->get_active() ? pp->locallab.pastels : saturated->getIntValue (); @@ -2784,6 +2796,7 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) } pedited->locallab.threshold = threshold->getEditedState(); + pedited->locallab.chromacbdl = chromacbdl->getEditedState(); pedited->locallab.pastels = pastels->getEditedState (); pedited->locallab.saturated = saturated->getEditedState (); pedited->locallab.psthreshold = psThreshold->getEditedState (); @@ -3426,6 +3439,7 @@ void Locallab::setDefaults (const ProcParams * defParams, const ParamsEdited * p } threshold->setDefault (defParams->locallab.threshold); + chromacbdl->setDefault (defParams->locallab.chromacbdl); pastels->setDefault (defParams->locallab.pastels); saturated->setDefault (defParams->locallab.saturated); psThreshold->setDefault (defParams->locallab.psthreshold); @@ -3494,6 +3508,7 @@ void Locallab::setDefaults (const ProcParams * defParams, const ParamsEdited * p } threshold->setDefaultEditedState (pedited->locallab.threshold ? Edited : UnEdited); + chromacbdl->setDefaultEditedState (pedited->locallab.chromacbdl ? Edited : UnEdited); pastels->setDefaultEditedState (pedited->locallab.pastels ? Edited : UnEdited); saturated->setDefaultEditedState (pedited->locallab.saturated ? Edited : UnEdited); @@ -3562,6 +3577,7 @@ void Locallab::setDefaults (const ProcParams * defParams, const ParamsEdited * p } threshold->setDefaultEditedState (Irrelevant); + chromacbdl->setDefaultEditedState (Irrelevant); pastels->setDefaultEditedState (Irrelevant); saturated->setDefaultEditedState (Irrelevant); @@ -3753,6 +3769,8 @@ void Locallab::adjusterChanged (Adjuster * a, double newval) listener->panelChanged (Evlocallabthres, thres->getTextValue()); } else if (a == threshold) { listener->panelChanged (EvlocallabThresho, threshold->getTextValue()); + } else if (a == chromacbdl) { + listener->panelChanged (Evlocallabchromacbdl, chromacbdl->getTextValue()); } else if (a == sensicb) { listener->panelChanged (Evlocallabsensicb, sensicb->getTextValue()); } else if (a == sensibn) { @@ -3904,6 +3922,8 @@ void Locallab::trimValues (rtengine::procparams::ProcParams * pp) multiplier[i]->trimValue (pp->locallab.mult[i]); } + chromacbdl->trimValue (pp->locallab.chromacbdl); + threshold->trimValue (pp->locallab.threshold); pastels->trimValue (pp->locallab.pastels); saturated->trimValue (pp->locallab.saturated); @@ -3986,6 +4006,7 @@ void Locallab::setBatchMode (bool batchMode) } threshold->showEditedCB(); + chromacbdl->showEditedCB(); pastels->showEditedCB (); saturated->showEditedCB (); psThreshold->showEditedCB (); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 16a162c9b..0fb63c141 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -102,6 +102,7 @@ private: Adjuster* const chrrt; Adjuster* const sensih; Adjuster* const retrab; + Adjuster* const chromacbdl; Adjuster* const threshold; Adjuster* const sensicb; Adjuster* const sharradius; @@ -214,7 +215,7 @@ private: - int nextdatasp[77]; + int nextdatasp[78]; int nextlength; std::string nextstr; std::string nextstr2; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 876cdba21..86190f3f5 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -395,6 +395,7 @@ void ParamsEdited::set (bool v) } locallab.threshold = v; + locallab.chromacbdl = v; locallab.pastels = v; locallab.saturated = v; locallab.psthreshold = v; @@ -1035,6 +1036,7 @@ void ParamsEdited::initFrom (const std::vector } locallab.threshold = locallab.threshold && p.locallab.threshold == other.locallab.threshold; + locallab.chromacbdl = locallab.chromacbdl && p.locallab.chromacbdl == other.locallab.chromacbdl; locallab.pastels = locallab.pastels && p.locallab.pastels == other.locallab.pastels; locallab.saturated = locallab.saturated && p.locallab.saturated == other.locallab.saturated; locallab.psthreshold = locallab.psthreshold && p.locallab.psthreshold == other.locallab.psthreshold; @@ -2702,6 +2704,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.locallab.threshold = mods.locallab.threshold; } + if (locallab.chromacbdl) { + toEdit.locallab.chromacbdl = mods.locallab.chromacbdl; + } + if (pcvignette.enabled) { toEdit.pcvignette.enabled = mods.pcvignette.enabled; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 4627c7fca..b29709db0 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -504,6 +504,7 @@ public: bool chrrt; bool mult[5]; bool threshold; + bool chromacbdl; bool expcolor; bool expexpose; bool expvibrance;