From b31225672ae3120cd976e24df8d3ce353320654c Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 31 May 2016 23:47:01 +0200 Subject: [PATCH] Some new improvements to speed of curve generation (mainly to speedup thumb processing in file browser) --- rtengine/curves.cc | 139 +++++++++++++++------------------- rtengine/curves.h | 9 +-- rtengine/dcrop.cc | 2 +- rtengine/diagonalcurves.cc | 2 +- rtengine/improccoordinator.cc | 34 ++------- rtengine/improccoordinator.h | 3 +- rtengine/improcfun.cc | 2 +- rtengine/improcfun.h | 2 +- rtengine/rtthumbnail.cc | 19 ++--- rtengine/simpleprocess.cc | 19 ++--- 10 files changed, 88 insertions(+), 143 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index a5214e451..95185c4c8 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -212,7 +212,7 @@ void CurveFactory::curveLightBrightColor (const std::vector& curvePoints if (!curvePoints3.empty() && curvePoints3[0] > DCT_Linear && curvePoints3[0] < DCT_Unchanged) { DiagonalCurve tcurve(curvePoints3, CURVES_MIN_POLY_POINTS / skip); - if (outBeforeCCurveHistogramC /*&& histogramCropped*/) { + if (outBeforeCCurveHistogramC) { histogramC.compressTo(outBeforeCCurveHistogramC, 48000); } @@ -227,7 +227,7 @@ void CurveFactory::curveLightBrightColor (const std::vector& curvePoints if (!curvePoints2.empty() && curvePoints2[0] > DCT_Linear && curvePoints2[0] < DCT_Unchanged) { DiagonalCurve tcurve(curvePoints2, CURVES_MIN_POLY_POINTS / skip); - if (outBeforeCCurveHistogram /*&& histogramCropped*/) { + if (outBeforeCCurveHistogram) { histNeeded = true; } @@ -243,7 +243,7 @@ void CurveFactory::curveLightBrightColor (const std::vector& curvePoints if (!curvePoints1.empty() && curvePoints1[0] > DCT_Linear && curvePoints1[0] < DCT_Unchanged) { DiagonalCurve tcurve(curvePoints1, CURVES_MIN_POLY_POINTS / skip); - if (outBeforeCCurveHistogram /*&& histogramCropped*/) { + if (outBeforeCCurveHistogram) { histNeeded = true; } @@ -261,11 +261,8 @@ void CurveFactory::curveBW ( const std::vector& curvePointsbw, const std const LUTu & histogrambw, LUTu & outBeforeCCurveHistogrambw,//for Luminance ToneCurve & customToneCurvebw1, ToneCurve & customToneCurvebw2, int skip) { + const float gamma_ = Color::sRGBGammaCurve; - constexpr float mul = 1.055; - constexpr float add = 0.055; - const float start = expf(gamma_ * logf( -add / ((1.0 / gamma_ - 1.0) * mul ))); - const float slope = mul * powf (start, 1.0 / gamma_ - 1) - add / start; outBeforeCCurveHistogrambw.clear(); bool histNeeded = false; @@ -275,12 +272,12 @@ void CurveFactory::curveBW ( const std::vector& curvePointsbw, const std if (!curvePointsbw2.empty() && curvePointsbw2[0] > DCT_Linear && curvePointsbw2[0] < DCT_Unchanged) { DiagonalCurve tcurve(curvePointsbw2, CURVES_MIN_POLY_POINTS / skip); - if (outBeforeCCurveHistogrambw /*&& histogramCropped*/) { + if (outBeforeCCurveHistogrambw) { histNeeded = true; } if (!tcurve.isIdentity()) { - customToneCurvebw2.Set(tcurve, gamma_, start, slope, mul, add); + customToneCurvebw2.Set(tcurve, gamma_); } } @@ -290,12 +287,12 @@ void CurveFactory::curveBW ( const std::vector& curvePointsbw, const std if (!curvePointsbw.empty() && curvePointsbw[0] > DCT_Linear && curvePointsbw[0] < DCT_Unchanged) { DiagonalCurve tcurve(curvePointsbw, CURVES_MIN_POLY_POINTS / skip); - if (outBeforeCCurveHistogrambw /*&& histogramCropped*/) { + if (outBeforeCCurveHistogrambw ) { histNeeded = true; } if (!tcurve.isIdentity()) { - customToneCurvebw1.Set(tcurve, gamma_, start, slope, mul, add); + customToneCurvebw1.Set(tcurve, gamma_); } } @@ -309,19 +306,18 @@ void CurveFactory::curveBW ( const std::vector& curvePointsbw, const std // add curve Lab : C=f(L) void CurveFactory::curveCL ( bool & clcutili, const std::vector& clcurvePoints, LUTf & clCurve, int skip) { - bool needed = false; + clcutili = false; std::unique_ptr dCurve; if (!clcurvePoints.empty() && clcurvePoints[0] != 0) { dCurve = std::unique_ptr(new DiagonalCurve(clcurvePoints, CURVES_MIN_POLY_POINTS / skip)); if (dCurve && !dCurve->isIdentity()) { - needed = true; clcutili = true; } } - fillCurveArray(dCurve.get(), clCurve, skip, needed); + fillCurveArray(dCurve.get(), clCurve, skip, clcutili); } void CurveFactory::mapcurve ( bool & mapcontlutili, const std::vector& mapcurvePoints, LUTf & mapcurve, int skip, const LUTu & histogram, LUTu & outBeforeCurveHistogram) @@ -415,93 +411,68 @@ void CurveFactory::curveToning ( const std::vector& curvePoints, LUTf & //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void CurveFactory::complexsgnCurve (float adjustr, bool & autili, bool & butili, bool & ccutili, bool & cclutili, double saturation, double rstprotection, +void CurveFactory::complexsgnCurve (bool & autili, bool & butili, bool & ccutili, bool & cclutili, const std::vector& acurvePoints, const std::vector& bcurvePoints, const std::vector& cccurvePoints, const std::vector& lccurvePoints, LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve, LUTf & lhskCurve, - const LUTu & histogramC, const LUTu & histogramLC, LUTu & outBeforeCCurveHistogram, LUTu & outBeforeLCurveHistogram, //for chroma int skip) { - bool needed = false; + autili = butili = ccutili = cclutili = false; std::unique_ptr dCurve; - int k = 48000; //32768*1.41 // create a curve if needed if (!acurvePoints.empty() && acurvePoints[0] != 0) { dCurve = std::unique_ptr(new DiagonalCurve(acurvePoints, CURVES_MIN_POLY_POINTS / skip)); if (dCurve && !dCurve->isIdentity()) { - needed = true; autili = true; } } - fillCurveArray(dCurve.get(), aoutCurve, skip, needed); + fillCurveArray(dCurve.get(), aoutCurve, skip, autili); dCurve = nullptr; //----------------------------------------------------- - needed = false; - if (!bcurvePoints.empty() && bcurvePoints[0] != 0) { dCurve = std::unique_ptr(new DiagonalCurve(bcurvePoints, CURVES_MIN_POLY_POINTS / skip)); if (dCurve && !dCurve->isIdentity()) { - needed = true; butili = true; } } - fillCurveArray(dCurve.get(), boutCurve, skip, needed); + fillCurveArray(dCurve.get(), boutCurve, skip, butili); dCurve = nullptr; //----------------------------------------------- - needed = false; - - if (outBeforeCCurveHistogram) { - outBeforeCCurveHistogram.clear(); - } if (!cccurvePoints.empty() && cccurvePoints[0] != 0) { dCurve = std::unique_ptr(new DiagonalCurve(cccurvePoints, CURVES_MIN_POLY_POINTS / skip)); - if (outBeforeCCurveHistogram) { - histogramC.compressTo(outBeforeCCurveHistogram, k * adjustr); - } - if (dCurve && !dCurve->isIdentity()) { - needed = true; ccutili = true; } } - fillCurveArray(dCurve.get(), satCurve, skip, needed); + fillCurveArray(dCurve.get(), satCurve, skip, ccutili); dCurve = nullptr; //---------------------------- - needed = false; - - if (outBeforeLCurveHistogram) { - outBeforeLCurveHistogram.clear(); - } if (!lccurvePoints.empty() && lccurvePoints[0] != 0) { dCurve = std::unique_ptr(new DiagonalCurve(lccurvePoints, CURVES_MIN_POLY_POINTS / skip)); - if (outBeforeLCurveHistogram) { - histogramLC.compressTo(outBeforeLCurveHistogram, k * adjustr); - } - if (dCurve && !dCurve->isIdentity()) { - needed = true; cclutili = true; } } - fillCurveArray(dCurve.get(), lhskCurve, skip, needed); + fillCurveArray(dCurve.get(), lhskCurve, skip, cclutili); + } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -512,7 +483,7 @@ SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double double shcompr, double br, double contr, procparams::ToneCurveParams::eTCModeId curveMode, const std::vector& curvePoints, procparams::ToneCurveParams::eTCModeId curveMode2, const std::vector& curvePoints2, - LUTu & histogram, LUTu & histogramCropped, + LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & customToneCurve1, @@ -624,6 +595,7 @@ SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double } + // curve without contrast LUTf dcurve(0x10000); @@ -633,9 +605,9 @@ SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double float val = 1.f / 65535.f; float val2 = simplebasecurve (val, black, 0.015 * shcompr); shCurve[0] = CLIPD(val2) / val; - val = 0.0; // gamma correction - val = gamma (val, gamma_, start, slope, mul, add); + + val = Color::gammatab_srgb[0] / 65535.f; // apply brightness curve if (brightcurve) { @@ -645,26 +617,22 @@ SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double // store result in a temporary array dcurve[0] = CLIPD(val); -#ifdef _OPENMP - #pragma omp parallel for -#endif - for (int i = 1; i < 0x10000; i++) { float val = i / 65535.f; float val2 = simplebasecurve (val, black, 0.015 * shcompr); - shCurve[i] = CLIPD(val2) / val; + shCurve[i] = val2 / val; // gamma correction - val = gamma (val, gamma_, start, slope, mul, add); + val = Color::gammatab_srgb[i] / 65535.f; // apply brightness curve if (brightcurve) { - val = brightcurve->getVal (val); // TODO: getVal(double) is very slow! Optimize with a LUTf + val = CLIPD(brightcurve->getVal (val)); // TODO: getVal(double) is very slow! Optimize with a LUTf } // store result in a temporary array - dcurve[i] = CLIPD(val); + dcurve[i] = val; } brightcurve = nullptr; @@ -711,7 +679,6 @@ SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double for (int i = 0; i <= 0xffff; i++) { dcurve[i] = contrastcurve.getVal (dcurve[i]); } - } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -724,10 +691,10 @@ SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double const DiagonalCurve tcurve(curvePoints2, CURVES_MIN_POLY_POINTS / skip); if (!tcurve.isIdentity()) { - customToneCurve2.Set(tcurve, gamma_, start, slope, mul, add); + customToneCurve2.Set(tcurve, gamma_); } - if (outBeforeCCurveHistogram /*&& histogramCropped*/) { + if (outBeforeCCurveHistogram ) { histNeeded = true; } } @@ -743,10 +710,10 @@ SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double const DiagonalCurve tcurve(curvePoints, CURVES_MIN_POLY_POINTS / skip); if (!tcurve.isIdentity()) { - customToneCurve1.Set(tcurve, gamma_, start, slope, mul, add); + customToneCurve1.Set(tcurve, gamma_); } - if (outBeforeCCurveHistogram /*&& histogramCropped*/) { + if (outBeforeCCurveHistogram) { histNeeded = true; } } @@ -797,9 +764,8 @@ void CurveFactory::complexLCurve (double br, double contr, const std::vectorgetVal (dcurve[i]); + val = tcurve->getVal (outCurve[i]); outCurve[i] = (32767.f * val); } } else { + // Skip the slow getval method if no curve is used (or an identity curve) // L values go up to 32767, last stop is for highlight overflow - for (int i = 0; i < 32768; i++) { - if (histNeeded) { - float hval = dcurve[i]; - int hi = (int)(255.f * hval); - outBeforeCCurveHistogram[hi] += histogram/*Cropped*/[i] ; - } - - outCurve[i] = 32767.f * dcurve[i]; + if(histNeeded) { + histogram.compressTo(outBeforeCCurveHistogram, 32768, outCurve); } + + outCurve *= 32767.f; + } for (int i = 32768; i < 32770; i++) { // set last two elements of lut to 32768 and 32769 to allow linear interpolation outCurve[i] = (float)i; } + } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1065,7 +1030,7 @@ void ToneCurve::Reset() } // Fill a LUT with X/Y, ranged 0xffff -void ToneCurve::Set(const Curve &pCurve, float gamma, float start, float slope, float mul, float add) +void ToneCurve::Set(const Curve &pCurve, float gamma) { lutToneCurve(65536); @@ -1073,7 +1038,21 @@ void ToneCurve::Set(const Curve &pCurve, float gamma, float start, float slope, for (int i = 0; i < 65536; i++) { lutToneCurve[i] = (float)pCurve.getVal(float(i) / 65535.f) * 65535.f; } + } else if(gamma == (float)Color::sRGBGammaCurve) { + // for sRGB gamma we can use luts, which is much faster + for (int i = 0; i < 65536; i++) { + float val = Color::gammatab_srgb[i] / 65535.f; + val = pCurve.getVal(val); + val = Color::igammatab_srgb[val * 65535.f]; + lutToneCurve[i] = val; + } + } else { + const float start = expf(gamma * logf( -0.055 / ((1.0 / gamma - 1.0) * 1.055 ))); + const float slope = 1.055 * powf (start, 1.0 / gamma - 1) - 0.055 / start; + const float mul = 1.055; + const float add = 0.055; + // apply gamma, that is 'pCurve' is defined with the given gamma and here we convert it to a curve in linear space for (int i = 0; i < 65536; i++) { float val = float(i) / 65535.f; diff --git a/rtengine/curves.h b/rtengine/curves.h index d5e1412eb..64bf3ed1a 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -278,9 +278,7 @@ public: public: static void complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, procparams::ToneCurveParams::eTCModeId curveMode, const std::vector& curvePoints, procparams::ToneCurveParams::eTCModeId curveMode2, const std::vector& curvePoints2, - - LUTu & histogram, LUTu & histogramCropped, - LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, + LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, int skip = 1); static void curveBW (const std::vector& curvePointsbw, const std::vector& curvePointsbw2, const LUTu & histogrambw, LUTu & outBeforeCCurveHistogrambw, @@ -294,9 +292,8 @@ public: static void curveToning ( const std::vector& curvePoints, LUTf & ToningCurve, int skip); - static void complexsgnCurve ( float adjustr, bool & autili, bool & butili, bool & ccutili, bool & clcutili, double saturation, double rstprotection, const std::vector& acurvePoints, + static void complexsgnCurve ( bool & autili, bool & butili, bool & ccutili, bool & clcutili, const std::vector& acurvePoints, const std::vector& bcurvePoints, const std::vector& cccurvePoints, const std::vector& lccurvePoints, LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve, LUTf & lhskCurve, - const LUTu & histogramC, const LUTu & histogramLC, LUTu & outBeforeCCurveHistogram, LUTu & outBeforeLCurveHistogram, ///for chroma int skip = 1); static void complexLCurve (double br, double contr, const std::vector& curvePoints, const LUTu & histogram, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, int skip, bool & utili); @@ -465,7 +462,7 @@ public: virtual ~ToneCurve() {}; void Reset(); - void Set(const Curve &pCurve, float gamma = 0, float start = 0, float slope = 0, float mul = 0, float add = 0); + void Set(const Curve &pCurve, float gamma = 0); operator bool (void) const { return lutToneCurve; diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 27104bde2..ca502b753 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -814,7 +814,7 @@ void Crop::update (int todo) LUTu dummy; int moderetinex; // parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); - parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy); + parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); parent->ipf.vibrance (labnCrop); if((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { diff --git a/rtengine/diagonalcurves.cc b/rtengine/diagonalcurves.cc index 19c662c0b..a5505391e 100644 --- a/rtengine/diagonalcurves.cc +++ b/rtengine/diagonalcurves.cc @@ -340,7 +340,7 @@ double DiagonalCurve::getVal (double t) const // get the hash table entry by rounding the value (previously multiplied by "hashSize") unsigned short int i = (unsigned short int)(t * hashSize); - if (i > (hashSize + 1)) { + if (UNLIKELY(i > (hashSize + 1))) { //printf("\nOVERFLOW: hash #%d is used while seeking for value %.8f, corresponding polygon's point #%d (out of %d point) x value: %.8f\n\n", i, t, hash.at(i), poly_x.size(), poly_x[hash.at(i)]); printf("\nOVERFLOW: hash #%d is used while seeking for value %.8f\n\n", i, t); return t; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 4e099dc5c..2cdd389af 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -57,9 +57,7 @@ ImProcCoordinator::ImProcCoordinator () lhist16CAM(65536), lhist16CCAM(65536), lhist16RETI(65536), - histCropped(65536), - lhist16Clad(65536), - lhist16LClad(65536), lhist16LLClad(65536), + lhist16LClad(65536), histRed(256), histRedRaw(256), histGreen(256), histGreenRaw(256), histBlue(256), histBlueRaw(256), @@ -443,7 +441,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, params.toneCurve.shcompr, params.toneCurve.brightness, params.toneCurve.contrast, params.toneCurve.curveMode, params.toneCurve.curve, params.toneCurve.curveMode2, params.toneCurve.curve2, - vhist16, histCropped, hltonecurve, shtonecurve, tonecurve, histToneCurve, customToneCurve1, customToneCurve2, scale == 1 ? 1 : 1); + vhist16, hltonecurve, shtonecurve, tonecurve, histToneCurve, customToneCurve1, customToneCurve2, scale == 1 ? 1 : 1); CurveFactory::RGBCurve (params.rgbCurves.rcurve, rCurve, scale == 1 ? 1 : 1); CurveFactory::RGBCurve (params.rgbCurves.gcurve, gCurve, scale == 1 ? 1 : 1); @@ -591,35 +589,15 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) #endif lhist16 += lhist16thr; } - utili = false; CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, lhist16, lumacurve, histLCurve, scale == 1 ? 1 : 16, utili); } if (todo & M_LUMACURVE) { - autili = false; - butili = false; - ccutili = false; - cclutili = false; - clcutili = false; CurveFactory::curveCL(clcutili, params.labCurve.clcurve, clcurve, scale == 1 ? 1 : 16); - float adjustr = 1.0f; - - /* if (params.icm.working=="ProPhoto") {adjustr = adjustbg = 1.2f;}// 1.2 instead 1.0 because it's very rare to have C>170.. - else if (params.icm.working=="Adobe RGB") {adjustr = 1.8f; adjustbg = 1.4f;} - else if (params.icm.working=="sRGB") {adjustr = 2.0f; adjustbg = 1.7f;} - else if (params.icm.working=="WideGamut") {adjustr = adjustbg = 1.2f;} - else if (params.icm.working=="Beta RGB") {adjustr = adjustbg = 1.4f;} - else if (params.icm.working=="BestRGB") {adjustr = adjustbg = 1.4f;} - else if (params.icm.working=="BruceRGB") {adjustr = 1.8f; adjustbg = 1.5f;} - */ - - lhist16LLClad.clear(); - lhist16Clad.clear(); - CurveFactory::complexsgnCurve (adjustr, autili, butili, ccutili, cclutili, params.labCurve.chromaticity, params.labCurve.rstprotection, - params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, - lhist16Clad, lhist16LLClad, histCCurve, histLLCurve, scale == 1 ? 1 : 16); + CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, + params.labCurve.lccurve, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, scale == 1 ? 1 : 16); } if (todo & (M_LUMINANCE + M_COLOR) ) { @@ -627,7 +605,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) progress ("Applying Color Boost...", 100 * readyphase / numofphases); // ipf.MSR(nprevl, nprevl->W, nprevl->H, 1); - ipf.chromiLuminanceCurve (NULL, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLLCurve, histLCurve); + histCCurve.clear(); + histLCurve.clear(); + ipf.chromiLuminanceCurve (NULL, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLCurve); ipf.vibrance(nprevl); if((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index d394f942c..428fe4922 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -110,8 +110,7 @@ protected: LUTu lhist16CAM; LUTu lhist16CCAM; LUTu lhist16RETI; - LUTu histCropped; - LUTu lhist16Clad, lhist16CLlad, lhist16LClad, lhist16LLClad; + LUTu lhist16CLlad, lhist16LClad; LUTu histRed, histRedRaw; LUTu histGreen, histGreenRaw; LUTu histBlue, histBlueRaw; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index ae7d370f3..42c1c27b6 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -5383,7 +5383,7 @@ void ImProcFunctions::luminanceCurve (LabImage* lold, LabImage* lnew, LUTf & cur -SSEFUNCTION void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve, LUTf & lhskcurve, LUTf & clcurve, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLLCurve, LUTu &histLCurve) +SSEFUNCTION void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve, LUTf & lhskcurve, LUTf & clcurve, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLCurve) { int W = lold->W; int H = lold->H; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index ea64ce4ab..20cac3325 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -254,7 +254,7 @@ public: void ciecam_02 (CieImage* ncie, double adap, int begh, int endh, int pW, int pwb, LabImage* lab, const ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, int scalecd, int rtt); - void chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLCurve, LUTu &histLurve); + void chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLurve); void vibrance (LabImage* lab);//Jacques' vibrance void colorCurve (LabImage* lold, LabImage* lnew); void sharpening (LabImage* lab, float** buffer, SharpeningParams &sharpenParam); diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 15ceee77d..4399f7f49 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1001,7 +1001,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei params.toneCurve.shcompr, bright, contr, params.toneCurve.curveMode, params.toneCurve.curve, params.toneCurve.curveMode2, params.toneCurve.curve2, - hist16, dummy, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2, 16); + hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2, 16); LUTf rCurve; LUTf gCurve; @@ -1100,23 +1100,18 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei // luminance processing // ipf.EPDToneMap(labView,0,6); - bool utili = false; + bool utili; CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, hist16, lumacurve, dummy, 16, utili); - bool clcutili = false; + bool clcutili; CurveFactory::curveCL(clcutili, params.labCurve.clcurve, clcurve, 16); - bool autili = false; - bool butili = false; - bool ccutili = false; - bool cclutili = false; - CurveFactory::complexsgnCurve (1.f, autili, butili, ccutili, cclutili, params.labCurve.chromaticity, params.labCurve.rstprotection, - params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, - dummy, dummy, dummy, dummy, - 16); + bool autili, butili, ccutili, cclutili; + CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, + params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 16); - ipf.chromiLuminanceCurve (nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy); + ipf.chromiLuminanceCurve (nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); ipf.vibrance(labView); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 951d0e6cc..1bf832bc0 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -791,7 +791,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p CurveFactory::complexCurve (expcomp, black / 65535.0, hlcompr, hlcomprthresh, params.toneCurve.shcompr, bright, contr, params.toneCurve.curveMode, params.toneCurve.curve, params.toneCurve.curveMode2, params.toneCurve.curve2, - hist16, dummy, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2 ); + hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2 ); CurveFactory::RGBCurve (params.rgbCurves.rcurve, rCurve, 1); CurveFactory::RGBCurve (params.rgbCurves.gcurve, gCurve, 1); @@ -915,22 +915,17 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } } - bool utili = false; + bool utili; CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, hist16, lumacurve, dummy, 1, utili); - bool clcutili = false; + bool clcutili; CurveFactory::curveCL(clcutili, params.labCurve.clcurve, clcurve, 1); - bool autili = false; - bool butili = false; - bool ccutili = false; - bool cclutili = false; - CurveFactory::complexsgnCurve (1.f, autili, butili, ccutili, cclutili, params.labCurve.chromaticity, params.labCurve.rstprotection, - params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, - dummy, dummy, dummy, dummy, - 1); + bool autili, butili, ccutili, cclutili; + CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, + params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 1); - ipf.chromiLuminanceCurve (NULL, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy); + ipf.chromiLuminanceCurve (NULL, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); if((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { ipf.EPDToneMap(labView, 5, 1);