diff --git a/rtdata/languages/default b/rtdata/languages/default index 90cc0ff77..eec87448c 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -868,6 +868,7 @@ HISTORY_MSG_612;Local - Color Structure HISTORY_MSG_613;Local - Exp Structure HISTORY_MSG_614;Local - Exp Mask H HISTORY_MSG_615;Local - Blend color +HISTORY_MSG_616;Local - Blend Exp HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction diff --git a/rtengine/curves.cc b/rtengine/curves.cc index ba6683806..492d36348 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1054,7 +1054,7 @@ void CurveFactory::complexCurve(double ecomp, double black, double hlcompr, doub //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% void CurveFactory::complexCurvelocal(double ecomp, double black, double hlcompr, double hlcomprthresh, - double shcompr, double br, double cont, LUTu & histogram, + double shcompr, double br, double cont, LUTu & histogram, double lumare, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTf & lightCurveloc, int skip) { @@ -1131,12 +1131,12 @@ void CurveFactory::complexCurvelocal(double ecomp, double black, double hlcompr, avg += lightCurveloc[i] * histogram[i]; sum += histogram[i]; } - + printf("avg=%f sum=%i lumaref=%f\n", avg/sum, sum, lumare/100.f); std::vector contrastcurvePoints; - - if (sum) { - avg /= sum; - + bool lumm = true; + if (lumm) { + // avg /= sum; + avg = lumare / 100.f; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% contrastcurvePoints.resize(9); contrastcurvePoints.at(0) = double (DCT_NURBS); diff --git a/rtengine/curves.h b/rtengine/curves.h index 2ff10434d..76439bd49 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -345,7 +345,7 @@ public: int skip = 1); - static void complexCurvelocal(double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double cont, LUTu & histogram, + static void complexCurvelocal(double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double cont, LUTu & histogram, double lumare, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTf & lightCurveloc, int skip = 1); diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 80b0aead8..e428522f2 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -949,7 +949,7 @@ void Crop::update(int todo) chromare = parent->chromarefs[sp]; lumare = parent->lumarefs[sp]; sobelre = parent->sobelrefs[sp]; - CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lhist16loc2, + CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lhist16loc2, lumare, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, sca); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 339bc0cf9..ab47ed9fd 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -813,15 +813,15 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) ipf.calc_ref(sp, nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); } - CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lhist16loc, - hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, - sca); huerblu = huerefblurs[sp] = huerefblu; huer = huerefs[sp] = huere; chromar = chromarefs[sp] = chromare; lumar = lumarefs[sp] = lumare ; sobeler = sobelrefs[sp] = sobelre; + CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lhist16loc, lumar, + hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, + sca); if (locallListener) { locallListener->refChanged(huer, lumar, chromar); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 1b84b867c..009b25b49 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -159,6 +159,7 @@ struct local_params { int chro, cont, sens, sensh, senscb, sensbn, senstm, sensex, sensexclu, sensden, senslc, senssf; float struco; float blendmacol; + float blendmaexp; float struexp; float ligh; int shamo, shdamp, shiter, senssha, sensv; @@ -475,6 +476,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float local_lightness = (float) locallab.spots.at(sp).lightness; float structcolor = (float) locallab.spots.at(sp).structcol; float blendmaskcolor = ((float) locallab.spots.at(sp).blendmaskcol) / 100.f ; + float blendmaskexpo = ((float) locallab.spots.at(sp).blendmaskexp) / 100.f ; float structexpo = (float) locallab.spots.at(sp).structexp; int local_transit = locallab.spots.at(sp).transit; double radius = (double) locallab.spots.at(sp).radius; @@ -512,6 +514,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.chro = local_chroma; lp.struco = structcolor; lp.blendmacol = blendmaskcolor; + lp.blendmaexp = blendmaskexpo; lp.struexp = structexpo; lp.sens = local_sensi; lp.sensh = local_sensih; @@ -7105,10 +7108,6 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform int begx = lp.xc - lp.lxL; int yEn = lp.yc + lp.ly; int xEn = lp.xc + lp.lx; - begx /= sk; - begy /= sk; - yEn /= sk; - xEn /= sk; //claculate histogram for area selected #ifdef _OPENMP const int numThreads = min(max(transformed->W * transformed->H / (int)histogram.getSize(), 1), omp_get_max_threads()); @@ -7125,8 +7124,6 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform for (int x = 0; x < transformed->W; x++) { int lox = cx + x; int loy = cy + y; - lox /= sk; - loy /= sk; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { int pos = (int)(original->L[y][x]); lhist16thrloc[pos]++; @@ -7304,7 +7301,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform chromaref = aveChro; lumaref = avL; - //printf("Calcref => sp=%i huere=%f chromare=%f lumare=%f \n", sp, hueref, chromaref, lumaref); + printf("Calcref => sp=%i huere=%f chromare=%f lumare=%f \n", sp, hueref, chromaref, lumaref); if (isdenoise) { delete origblur; delete blurorig; @@ -10136,7 +10133,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } //provisory fixe for contrast slider does not work at all - lp.cont = 0; + // lp.cont = 0; LabImage *bufcolorig = nullptr; LabImage *bufmaskorig = nullptr; @@ -10345,7 +10342,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } if (locccmasCurve) { - float chromask = (sqrt(SQR(bufcolorig->a[loy - begy][lox - begx]) + SQR(bufcolorig->b[loy - begy][lox - begx]))); + float chromask = 0.0001f + (sqrt(SQR(bufcolorig->a[loy - begy][lox - begx]) + SQR(bufcolorig->b[loy - begy][lox - begx]))); float chromaskr = chromask / 45000.f; valCC = float (locccmasCurve[500.f * chromaskr]); valCC = 1.f - valCC; @@ -10362,7 +10359,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (h > 1.f) { h -= 1.f; } - float chromask = (sqrt(SQR(bufcolorig->a[loy - begy][lox - begx]) + SQR(bufcolorig->b[loy - begy][lox - begx]))); + float chromask = 0.0001f + (sqrt(SQR(bufcolorig->a[loy - begy][lox - begx]) + SQR(bufcolorig->b[loy - begy][lox - begx]))); valHH = float (lochhmasCurve[500.f * h]); valHH = 1.f - valHH; sincosval.y = (bufcolorig->a[loy - begy][lox - begx]) / chromask; @@ -10372,9 +10369,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o kmaskHL = 32768.f * valHH; } - bufmaskblur->L[loy - begy][lox - begx] = kmaskL + kmaskHL; - bufmaskblur->a[loy - begy][lox - begx] = kmaskCa + kmaskHa; - bufmaskblur->b[loy - begy][lox - begx] = kmaskCb + kmaskHb; + bufmaskblur->L[loy - begy][lox - begx] = CLIP(kmaskL + kmaskHL); + bufmaskblur->a[loy - begy][lox - begx] = (kmaskCa + kmaskHa); + bufmaskblur->b[loy - begy][lox - begx] = (kmaskCb + kmaskHb); } @@ -10422,22 +10419,13 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { if(zone > 0) { - bufcolorig->L[loy - begy][lox - begx] += lp.blendmacol * bufmaskorig->L[loy - begy][lox - begx]; - bufcolorig->a[loy - begy][lox - begx] += lp.blendmacol * bufmaskorig->a[loy - begy][lox - begx]; - bufcolorig->b[loy - begy][lox - begx] += lp.blendmacol * bufmaskorig->b[loy - begy][lox - begx]; + bufcolorig->L[loy - begy][lox - begx] += CLIP(lp.blendmacol * bufmaskorig->L[loy - begy][lox - begx]); + bufcolorig->a[loy - begy][lox - begx] += (lp.blendmacol * bufmaskorig->a[loy - begy][lox - begx]); + bufcolorig->b[loy - begy][lox - begx] += (lp.blendmacol * bufmaskorig->b[loy - begy][lox - begx]); - originalmask->L[y][x] = bufcolorig->L[loy - begy][lox - begx]- (lp.blendmacol + 1.f) * bufmaskorig->L[loy - begy][lox - begx]; - originalmask->a[y][x] = bufcolorig->a[loy - begy][lox - begx]- (lp.blendmacol + 1.f) * bufmaskorig->a[loy - begy][lox - begx]; - originalmask->b[y][x] = bufcolorig->L[loy - begy][lox - begx]- (lp.blendmacol + 1.f) * bufmaskorig->b[loy - begy][lox - begx]; -/* - bufcolorig->L[loy - begy][lox - begx] -= bufmaskorig->L[loy - begy][lox - begx]; - bufcolorig->a[loy - begy][lox - begx] -= bufmaskorig->a[loy - begy][lox - begx]; - bufcolorig->b[loy - begy][lox - begx] -= bufmaskorig->b[loy - begy][lox - begx]; - - originalmask->L[y][x] = bufcolorig->L[loy - begy][lox - begx]; - originalmask->a[y][x] = bufcolorig->a[loy - begy][lox - begx]; - originalmask->b[y][x] = bufcolorig->L[loy - begy][lox - begx]; - */ + originalmask->L[y][x] = CLIP(bufcolorig->L[loy - begy][lox - begx]- (lp.blendmacol + 1.f) * bufmaskorig->L[loy - begy][lox - begx]); + originalmask->a[y][x] = (bufcolorig->a[loy - begy][lox - begx]- (lp.blendmacol + 1.f) * bufmaskorig->a[loy - begy][lox - begx]); + originalmask->b[y][x] = (bufcolorig->L[loy - begy][lox - begx]- (lp.blendmacol + 1.f) * bufmaskorig->b[loy - begy][lox - begx]); } } } @@ -10462,7 +10450,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { if(zone > 0) { - transformed->L[y][x] = bufmaskorig->L[loy - begy][lox - begx]; + transformed->L[y][x] = CLIP(bufmaskorig->L[loy - begy][lox - begx]); transformed->a[y][x] = bufmaskorig->a[loy - begy][lox - begx]; transformed->b[y][x] = bufmaskorig->b[loy - begy][lox - begx]; } @@ -10829,7 +10817,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } if (locccmasexpCurve) { - float chromask = (sqrt(SQR(bufexporig->a[loy - begy][lox - begx]) + SQR(bufexporig->b[loy - begy][lox - begx]))); + float chromask = 0.0001f + (sqrt(SQR(bufexporig->a[loy - begy][lox - begx]) + SQR(bufexporig->b[loy - begy][lox - begx]))); float chromaskr = chromask / 45000.f; valCC = float (locccmasexpCurve[500.f * chromaskr]); valCC = 1.f - valCC; @@ -10846,7 +10834,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (h > 1.f) { h -= 1.f; } - float chromask = (sqrt(SQR(bufexporig->a[loy - begy][lox - begx]) + SQR(bufexporig->b[loy - begy][lox - begx]))); + float chromask = (sqrt(SQR(bufexporig->a[loy - begy][lox - begx]) + SQR(bufexporig->b[loy - begy][lox - begx]))) + 0.0001f; valHH = float (lochhmasexpCurve[500.f * h]); valHH = 1.f - valHH; sincosval.y = (bufexporig->a[loy - begy][lox - begx]) / chromask; @@ -10856,32 +10844,13 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o kmaskHL = 32768.f * valHH; } - bufmaskblur->L[loy - begy][lox - begx] = kmaskL + kmaskHL; - bufmaskblur->a[loy - begy][lox - begx] = kmaskCa + kmaskHa; - bufmaskblur->b[loy - begy][lox - begx] = kmaskCb + kmaskHb; + bufmaskblur->L[loy - begy][lox - begx] = CLIP(kmaskL + kmaskHL); + bufmaskblur->a[loy - begy][lox - begx] = (kmaskCa + kmaskHa); + bufmaskblur->b[loy - begy][lox - begx] = (kmaskCb + kmaskHb); } - /* - if (locllmasexpCurve) { - valLL = (float)(locllmasexpCurve[500.f * (bufexporig->L[loy - begy][lox - begx]) / 32768.f]); - valLL = 1.f - valLL; - bufmaskblur->L[loy - begy][lox - begx] = 32768.f * valLL; - } - - if (locccmasexpCurve) { - float chromask = (sqrt(SQR(bufexporig->a[loy - begy][lox - begx]) + SQR(bufexporig->b[loy - begy][lox - begx]))); - float chromaskr = chromask / 45000.f; - valCC = float (locccmasexpCurve[500.f * chromaskr]); - valCC = 1.f - valCC; - sincosval.y = (bufexporig->a[loy - begy][lox - begx]) / chromask; - sincosval.x = (bufexporig->b[loy - begy][lox - begx]) / chromask; - bufmaskblur->a[loy - begy][lox - begx] = 45000.f * valCC * sincosval.y; - bufmaskblur->b[loy - begy][lox - begx] = 45000.f * valCC * sincosval.x; - } - } - */ } } @@ -10925,14 +10894,16 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - if(zone > 0) { - bufexporig->L[loy - begy][lox - begx] -= bufmaskorig->L[loy - begy][lox - begx]; - bufexporig->a[loy - begy][lox - begx] -= bufmaskorig->a[loy - begy][lox - begx]; - bufexporig->b[loy - begy][lox - begx] -= bufmaskorig->b[loy - begy][lox - begx]; - originalmask->L[y][x] = bufexporig->L[loy - begy][lox - begx]; - originalmask->a[y][x] = bufexporig->a[loy - begy][lox - begx]; - originalmask->b[y][x] = bufexporig->L[loy - begy][lox - begx]; - } + if(zone > 0) { + bufexporig->L[loy - begy][lox - begx] += CLIP(lp.blendmaexp * bufmaskorig->L[loy - begy][lox - begx]); + bufexporig->a[loy - begy][lox - begx] += (lp.blendmaexp * bufmaskorig->a[loy - begy][lox - begx]); + bufexporig->b[loy - begy][lox - begx] += (lp.blendmaexp * bufmaskorig->b[loy - begy][lox - begx]); + bufexporig->L[loy - begy][lox - begx] = CLIP( bufexporig->L[loy - begy][lox - begx]); + originalmask->L[y][x] = CLIP(bufexporig->L[loy - begy][lox - begx]- (lp.blendmaexp + 1.f) * bufmaskorig->L[loy - begy][lox - begx]); + originalmask->a[y][x] =(bufexporig->a[loy - begy][lox - begx]- (lp.blendmaexp + 1.f) * bufmaskorig->a[loy - begy][lox - begx]); + originalmask->b[y][x] =(bufexporig->L[loy - begy][lox - begx]- (lp.blendmaexp + 1.f) * bufmaskorig->b[loy - begy][lox - begx]); + + } } } } else if (lp.showmaskexpmet == 4) { @@ -10956,9 +10927,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { if(zone > 0) { - transformed->L[y][x] = bufmaskorig->L[loy - begy][lox - begx]; - transformed->a[y][x] = bufmaskorig->a[loy - begy][lox - begx]; - transformed->b[y][x] = bufmaskorig->b[loy - begy][lox - begx]; + transformed->L[y][x] = CLIP(bufmaskorig->L[loy - begy][lox - begx]); + transformed->a[y][x] = (bufmaskorig->a[loy - begy][lox - begx]); + transformed->b[y][x] = (bufmaskorig->b[loy - begy][lox - begx]); } } } @@ -10980,9 +10951,6 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - // bufexporig->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - // bufexporig->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - // bufexporig->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas bufexptemp->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas bufexptemp->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas bufexptemp->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas diff --git a/rtengine/procevents.h b/rtengine/procevents.h index f92362e97..c13f2745e 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -642,6 +642,7 @@ enum ProcEventCode { Evlocallabstructexp = 612, EvlocallabHHmaskexpshape = 613, Evlocallabblendmaskcol = 614, + Evlocallabblendmaskexp = 615, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index e42e76c95..04f960609 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2389,6 +2389,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : CCmaskexpcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, LLmaskexpcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, HHmaskexpcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, + blendmaskexp(-100), // Vibrance expvibrance(false), @@ -2529,6 +2530,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && CCmaskexpcurve == other.CCmaskexpcurve && LLmaskexpcurve == other.LLmaskexpcurve && HHmaskexpcurve == other.HHmaskexpcurve + && blendmaskexp == other.blendmaskexp // Vibrance && expvibrance == other.expvibrance && saturated == other.saturated @@ -3621,6 +3623,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskexpcurve, "Locallab", "CCmaskexpCurve_" + std::to_string(i), spot.CCmaskexpcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskexpcurve, "Locallab", "LLmaskexpCurve_" + std::to_string(i), spot.LLmaskexpcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskexpcurve, "Locallab", "HHmaskexpCurve_" + std::to_string(i), spot.HHmaskexpcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskexp, "Locallab", "Blendmaskexp_" + std::to_string(i), spot.blendmaskexp, keyFile); // Vibrance saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expvibrance, "Locallab", "Expvibrance_" + std::to_string(i), spot.expvibrance, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).saturated, "Locallab", "Saturated_" + std::to_string(i), spot.saturated, keyFile); @@ -4840,6 +4843,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "CCmaskexpCurve_" + std::to_string(i), pedited, spot.CCmaskexpcurve, spotEdited.CCmaskexpcurve); assignFromKeyfile(keyFile, "Locallab", "LLmaskexpCurve_" + std::to_string(i), pedited, spot.LLmaskexpcurve, spotEdited.LLmaskexpcurve); assignFromKeyfile(keyFile, "Locallab", "HHmaskexpCurve_" + std::to_string(i), pedited, spot.HHmaskexpcurve, spotEdited.HHmaskexpcurve); + assignFromKeyfile(keyFile, "Locallab", "Blendmaskexp_" + std::to_string(i), pedited, spot.blendmaskexp, spotEdited.blendmaskexp); // Vibrance assignFromKeyfile(keyFile, "Locallab", "Expvibrance_" + std::to_string(i), pedited, spot.expvibrance, spotEdited.expvibrance); assignFromKeyfile(keyFile, "Locallab", "Saturated_" + std::to_string(i), pedited, spot.saturated, spotEdited.saturated); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index d4e061a76..0da62de5c 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -986,6 +986,7 @@ struct LocallabParams { std::vector CCmaskexpcurve; std::vector LLmaskexpcurve; std::vector HHmaskexpcurve; + int blendmaskexp; // Vibrance bool expvibrance; int saturated; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index a3da742f4..d52933343 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -641,7 +641,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallabstructcol LUMINANCECURVE, //Evlocallabstructexp LUMINANCECURVE, //EvlocallabHHmaskexpshape - LUMINANCECURVE //Evlocallabblendmaskcol + LUMINANCECURVE, //Evlocallabblendmaskcol + LUMINANCECURVE //Evlocallabblendmaskexp }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index b17536fc2..5b8987bf2 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1088,7 +1088,7 @@ private: LUTf shtonecurveloc(65536, 0); LUTf tonecurveloc(65536, 0); LUTf lightCurveloc(32770, 0); - LUTu lhist16loc(32768, 0); + LUTu lhist16loc(32770, 0); LUTf exlocalcurve(65536, 0); // int maxspot = 1; @@ -1141,7 +1141,7 @@ private: } else { ipf.calc_ref(sp, labView, labView, 0, 0, fw, fh, 1, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); } - CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lhist16loc, + CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lhist16loc, lumare, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, 1); diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 2cb0887f7..c73fd1658 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -79,7 +79,7 @@ Locallab::Locallab(): structcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), blendmaskcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -150, 100, 1, -100))), // Exposure - expcomp(Gtk::manage(new Adjuster(M("TP_EXPOSURE_EXPCOMP"), -200, 200, 5, 0))), + expcomp(Gtk::manage(new Adjuster(M("TP_EXPOSURE_EXPCOMP"), -200, 800, 5, 0))), hlcompr(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 60))), hlcomprthresh(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 33))), black(Gtk::manage(new Adjuster(M("TP_EXPOSURE_BLACKLEVEL"), -16384, 32768, 50, 0))), @@ -87,6 +87,7 @@ Locallab::Locallab(): warm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WARM"), -100., 100., 1., 0., Gtk::manage(new RTImage("circle-blue-small.png")), Gtk::manage(new RTImage("circle-orange-small.png"))))), sensiex(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 19))), structexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), + blendmaskexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -150, 100, 1, -100))), // Vibrance saturated(Gtk::manage(new Adjuster(M("TP_VIBRANCE_SATURATED"), -100., 100., 1., 0.))), pastels(Gtk::manage(new Adjuster(M("TP_VIBRANCE_PASTELS"), -100., 100., 1., 0.))), @@ -329,7 +330,7 @@ Locallab::Locallab(): superFrame->set_label_widget(*curvactiv); ToolParamBlock* const superBox = Gtk::manage(new ToolParamBlock()); superBox->pack_start(*lightness); -// superBox->pack_start(*contrast); + superBox->pack_start(*contrast); superBox->pack_start(*chroma); superFrame->add(*superBox); colorBox->pack_start(*superFrame); @@ -377,6 +378,7 @@ Locallab::Locallab(): sensiex->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); sensiex->setAdjusterListener(this); structexp->setAdjusterListener(this); + blendmaskexp->setAdjusterListener(this); curveEditorG->setCurveListener(this); @@ -433,6 +435,7 @@ Locallab::Locallab(): maskexpBox->pack_start(*transLabels2, Gtk::PACK_SHRINK, 4); maskexpBox->pack_start(*showmaskexpMethod, Gtk::PACK_SHRINK, 0); maskexpBox->pack_start(*maskexpCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + maskexpBox->pack_start(*blendmaskexp, Gtk::PACK_SHRINK, 0); maskexpFrame->add(*maskexpBox); @@ -1528,6 +1531,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).HHmaskcurve = HHmaskshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).invers = invers->get_active(); pp->locallab.spots.at(pp->locallab.selspot).structexp = structexp->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).blendmaskexp = blendmaskexp->getIntValue(); // Exposure pp->locallab.spots.at(pp->locallab.selspot).expexpose = expexpose->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).expcomp = expcomp->getIntValue(); @@ -1712,6 +1716,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve || !CCmaskexpshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve || !LLmaskexpshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).HHmaskexpcurve = pe->locallab.spots.at(pp->locallab.selspot).HHmaskexpcurve || !HHmaskexpshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).blendmaskexp = pe->locallab.spots.at(pp->locallab.selspot).blendmaskexp || blendmaskexp->getEditedState(); // Vibrance pe->locallab.spots.at(pp->locallab.selspot).expvibrance = pe->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).saturated = pe->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState(); @@ -1856,6 +1861,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve || !CCmaskexpshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve || !LLmaskexpshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).HHmaskexpcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHmaskexpcurve || !HHmaskexpshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).blendmaskexp = pedited->locallab.spots.at(pp->locallab.selspot).blendmaskexp || blendmaskexp->getEditedState(); // Vibrance pedited->locallab.spots.at(pp->locallab.selspot).expvibrance = pedited->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).saturated = pedited->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState(); @@ -2189,6 +2195,12 @@ void Locallab::showmaskcolMethodChanged() expexpose->setEnabled(false); } + if((showmaskcolMethod->get_active_row_number() == 2 || showmaskcolMethod->get_active_row_number() == 3) && expcolor->getEnabled()) { + blendmaskcol->show(); + } else { + blendmaskcol->hide(); + } + if (getEnabled() && expcolor->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskcolMethod , showmaskcolMethod->get_active_text()); @@ -2200,10 +2212,17 @@ void Locallab::showmaskexpMethodChanged() { if((showmaskexpMethod->get_active_row_number() == 1 || showmaskexpMethod->get_active_row_number() == 2 || showmaskexpMethod->get_active_row_number() == 4 || showmaskexpMethod->get_active_row_number() == 5) && expexpose->getEnabled()) { + showmaskcolMethod->set_active(0); expcolor->setEnabled(false); } + if((showmaskexpMethod->get_active_row_number() == 2 || showmaskexpMethod->get_active_row_number() == 3) && expexpose->getEnabled()) { + blendmaskexp->show(); + } else { + blendmaskexp->hide(); + } + if (getEnabled() && expexpose->getEnabled()) { if (listener) { listener->panelChanged(EvlocallabshowmaskexpMethod , showmaskexpMethod->get_active_text()); @@ -2463,6 +2482,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe warm->setDefault((double)defSpot->warm); sensiex->setDefault((double)defSpot->sensiex); structexp->setDefault((double)defSpot->structexp); + blendmaskexp->setDefault((double)defSpot->blendmaskexp); // Vibrance saturated->setDefault((double)defSpot->saturated); pastels->setDefault((double)defSpot->pastels); @@ -2540,6 +2560,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe warm->setDefaultEditedState(Irrelevant); sensiex->setDefaultEditedState(Irrelevant); structexp->setDefaultEditedState(Irrelevant); + blendmaskexp->setDefaultEditedState(Irrelevant); // Vibrance saturated->setDefaultEditedState(Irrelevant); pastels->setDefaultEditedState(Irrelevant); @@ -2621,6 +2642,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe warm->setDefaultEditedState(defSpotState->warm ? Edited : UnEdited); sensiex->setDefaultEditedState(defSpotState->sensiex ? Edited : UnEdited); structexp->setDefaultEditedState(defSpotState->structexp ? Edited : UnEdited); + blendmaskexp->setDefaultEditedState(defSpotState->blendmaskexp ? Edited : UnEdited); // Vibrance saturated->setDefaultEditedState(defSpotState->saturated ? Edited : UnEdited); pastels->setDefaultEditedState(defSpotState->pastels ? Edited : UnEdited); @@ -2820,6 +2842,12 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == blendmaskexp) { + if (listener) { + listener->panelChanged(Evlocallabblendmaskexp, blendmaskexp->getTextValue()); + } + } + } // Vibrance @@ -3216,6 +3244,7 @@ void Locallab::setBatchMode(bool batchMode) warm->showEditedCB(); sensiex->showEditedCB(); structexp->showEditedCB(); + blendmaskexp->showEditedCB(); // Vibrance saturated->showEditedCB(); pastels->showEditedCB(); @@ -3579,6 +3608,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con CCmaskexpshape->setCurve(pp->locallab.spots.at(index).CCmaskexpcurve); LLmaskexpshape->setCurve(pp->locallab.spots.at(index).LLmaskexpcurve); HHmaskexpshape->setCurve(pp->locallab.spots.at(index).HHmaskexpcurve); + blendmaskexp->setValue(pp->locallab.spots.at(index).blendmaskexp); // Vibrance expvibrance->setEnabled(pp->locallab.spots.at(index).expvibrance); @@ -3767,6 +3797,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con CCmaskexpshape->setUnChanged(!spotState->CCmaskexpcurve); LLmaskexpshape->setUnChanged(!spotState->LLmaskexpcurve); HHmaskexpshape->setUnChanged(!spotState->HHmaskexpcurve); + blendmaskexp->setEditedState(spotState->blendmaskexp ? Edited : UnEdited); // Vibrance expvibrance->set_inconsistent(!spotState->expvibrance); @@ -3941,6 +3972,12 @@ void Locallab::updateSpecificGUIState() if (multiImage && showmaskcolMethod->get_active_text() == M("GENERAL_UNCHANGED")) { showmaskexpMethod->set_active(0); } else if((showmaskcolMethod->get_active_row_number() == 1 || showmaskcolMethod->get_active_row_number() == 2 || showmaskcolMethod->get_active_row_number() == 4 || showmaskcolMethod->get_active_row_number() == 5)) { + if((showmaskcolMethod->get_active_row_number() == 2 || showmaskcolMethod->get_active_row_number() == 3)) { + blendmaskcol->show(); + } else { + blendmaskcol->hide(); + } + showmaskexpMethod->set_active(0); expexpose->setEnabled(false); } @@ -3948,6 +3985,12 @@ void Locallab::updateSpecificGUIState() if (multiImage && showmaskexpMethod->get_active_text() == M("GENERAL_UNCHANGED")) { showmaskcolMethod->set_active(0); } else if((showmaskexpMethod->get_active_row_number() == 1 || showmaskexpMethod->get_active_row_number() == 2 || showmaskexpMethod->get_active_row_number() == 4 || showmaskexpMethod->get_active_row_number() == 5)) { + if((showmaskexpMethod->get_active_row_number() == 2 || showmaskexpMethod->get_active_row_number() == 3)) { + blendmaskexp->show(); + } else { + blendmaskexp->hide(); + } + showmaskcolMethod->set_active(0); expcolor->setEnabled(false); } diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 9605464ee..185b9544d 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -105,6 +105,7 @@ private: Adjuster* const warm; Adjuster* const sensiex; Adjuster* const structexp; + Adjuster* const blendmaskexp; // Vibrance Adjuster* const saturated; Adjuster* const pastels; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 00b05864f..8c41192c2 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -975,6 +975,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).CCmaskexpcurve = locallab.spots.at(j).CCmaskexpcurve && pSpot.CCmaskexpcurve == otherSpot.CCmaskexpcurve; locallab.spots.at(j).LLmaskexpcurve = locallab.spots.at(j).LLmaskexpcurve && pSpot.LLmaskexpcurve == otherSpot.LLmaskexpcurve; locallab.spots.at(j).HHmaskexpcurve = locallab.spots.at(j).HHmaskexpcurve && pSpot.HHmaskexpcurve == otherSpot.HHmaskexpcurve; + locallab.spots.at(j).blendmaskexp = locallab.spots.at(j).blendmaskexp && pSpot.blendmaskexp == otherSpot.blendmaskexp; // Vibrance locallab.spots.at(j).expvibrance = locallab.spots.at(j).expvibrance && pSpot.expvibrance == otherSpot.expvibrance; locallab.spots.at(j).saturated = locallab.spots.at(j).saturated && pSpot.saturated == otherSpot.saturated; @@ -2684,6 +2685,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).HHmaskexpcurve = mods.locallab.spots.at(i).HHmaskexpcurve; } + if (locallab.spots.at(i).blendmaskexp) { + toEdit.locallab.spots.at(i).blendmaskexp = mods.locallab.spots.at(i).blendmaskexp; + } + // Vibrance if (locallab.spots.at(i).expvibrance) { toEdit.locallab.spots.at(i).expvibrance = mods.locallab.spots.at(i).expvibrance; @@ -3962,6 +3967,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : CCmaskexpcurve(v), LLmaskexpcurve(v), HHmaskexpcurve(v), + blendmaskexp(v), // Vibrance expvibrance(v), saturated(v), @@ -4098,6 +4104,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) CCmaskexpcurve = v; LLmaskexpcurve = v; HHmaskexpcurve = v; + blendmaskexp = v; // Vibrance expvibrance = v; saturated = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 126059cd7..b3c0ef036 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -514,6 +514,7 @@ public: bool CCmaskexpcurve; bool LLmaskexpcurve; bool HHmaskexpcurve; + bool blendmaskexp; // Vibrance bool expvibrance; bool saturated;