Change calculation references in case of exclude spot

This commit is contained in:
Desmis 2018-02-08 07:57:28 +01:00
parent 4136a6ee03
commit abd26953a5
3 changed files with 80 additions and 64 deletions

View File

@ -477,7 +477,7 @@ void CurveFactory::curveexLocal(bool & localexutili, const std::vector<double>&
if (dCurve && !dCurve->isIdentity()) { if (dCurve && !dCurve->isIdentity()) {
needed = true; needed = true;
localexutili = true; localexutili = true;
} }
} }
@ -737,16 +737,16 @@ void CurveFactory::complexsgnCurve(bool & autili, bool & butili, bool & ccutili
} }
void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, void CurveFactory::complexCurve(double ecomp, double black, double hlcompr, double hlcomprthresh,
double shcompr, double br, double contr, double shcompr, double br, double contr,
const std::vector<double>& curvePoints, const std::vector<double>& curvePoints,
const std::vector<double>& curvePoints2, const std::vector<double>& curvePoints2,
LUTu & histogram, LUTu & histogram,
LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve,
LUTu & outBeforeCCurveHistogram, LUTu & outBeforeCCurveHistogram,
ToneCurve & customToneCurve1, ToneCurve & customToneCurve1,
ToneCurve & customToneCurve2, ToneCurve & customToneCurve2,
int skip) int skip)
{ {
// the curve shapes are defined in sRGB gamma, but the output curves will operate on linear floating point data, // the curve shapes are defined in sRGB gamma, but the output curves will operate on linear floating point data,
@ -1020,10 +1020,10 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
void CurveFactory::complexCurvelocal(double ecomp, double black, double hlcompr, double hlcomprthresh, void CurveFactory::complexCurvelocal(double ecomp, double black, double hlcompr, double hlcomprthresh,
double shcompr, double br, double contr, double shcompr, double br, double contr,
LUTu & histogram, LUTu & histogram,
LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve,
int skip) int skip)
{ {
// the curve shapes are defined in sRGB gamma, but the output curves will operate on linear floating point data, // the curve shapes are defined in sRGB gamma, but the output curves will operate on linear floating point data,
@ -1558,12 +1558,12 @@ void LocHHCurve::Set(const Curve &pCurve)
void LocHHCurve::Set(const std::vector<double> &curvePoints, bool &HHutili) void LocHHCurve::Set(const std::vector<double> &curvePoints, bool &HHutili)
{ {
// if (HHutili && !curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { // if (HHutili && !curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) {
if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) {
FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2);
ttcurve.setIdentityValue(0.); ttcurve.setIdentityValue(0.);
Set(ttcurve); Set(ttcurve);
HHutili = true; HHutili = true;
} else { } else {
Reset(); Reset();
} }
@ -1612,7 +1612,7 @@ void LocLHCurve::Set(const std::vector<double> &curvePoints, bool &LHutili)
FlatCurve tcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); FlatCurve tcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2);
tcurve.setIdentityValue(0.); tcurve.setIdentityValue(0.);
Set(tcurve); Set(tcurve);
LHutili = true; LHutili = true;
} else { } else {
Reset(); Reset();
} }
@ -2566,11 +2566,11 @@ void PerceptualToneCurve::BatchApply(const size_t start, const size_t end, float
Color::Prophotoxyz(r, g, b, x, y, z); Color::Prophotoxyz(r, g, b, x, y, z);
float J, C, h; float J, C, h;
Ciecam02::xyz2jch_ciecam02float( J, C, h, Ciecam02::xyz2jch_ciecam02float(J, C, h,
aw, fl, aw, fl,
x * 0.0015259022f, y * 0.0015259022f, z * 0.0015259022f, x * 0.0015259022f, y * 0.0015259022f, z * 0.0015259022f,
xw, yw, zw, xw, yw, zw,
c, nc, pow1, nbb, ncb, cz, d); c, nc, pow1, nbb, ncb, cz, d);
if (!isfinite(J) || !isfinite(C) || !isfinite(h)) { if (!isfinite(J) || !isfinite(C) || !isfinite(h)) {
@ -2583,6 +2583,7 @@ void PerceptualToneCurve::BatchApply(const size_t start, const size_t end, float
g = newg; g = newg;
b = newb; b = newb;
} }
rc[i] = r; rc[i] = r;
gc[i] = g; gc[i] = g;
bc[i] = b; bc[i] = b;
@ -2677,10 +2678,10 @@ void PerceptualToneCurve::BatchApply(const size_t start, const size_t end, float
C *= cmul; C *= cmul;
Ciecam02::jch2xyz_ciecam02float( x, y, z, Ciecam02::jch2xyz_ciecam02float(x, y, z,
J, C, h, J, C, h,
xw, yw, zw, xw, yw, zw,
c, nc, 1, pow1, nbb, ncb, fl, cz, d, aw ); c, nc, 1, pow1, nbb, ncb, fl, cz, d, aw);
if (!isfinite(x) || !isfinite(y) || !isfinite(z)) { if (!isfinite(x) || !isfinite(y) || !isfinite(z)) {
// can happen for colours on the rim of being outside gamut, that worked without chroma scaling but not with. Then we return only the curve's result. // can happen for colours on the rim of being outside gamut, that worked without chroma scaling but not with. Then we return only the curve's result.
@ -2756,6 +2757,7 @@ void PerceptualToneCurve::BatchApply(const size_t start, const size_t end, float
g = newg; g = newg;
b = newb; b = newb;
} }
rc[i] = r; rc[i] = r;
gc[i] = g; gc[i] = g;
bc[i] = b; bc[i] = b;

View File

@ -229,7 +229,7 @@ ImProcCoordinator::ImProcCoordinator()
chromar(0), chromar(0),
lumar(0), lumar(0),
sobeler(0), sobeler(0),
colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), lastspotdup(false), highQualityComputed (false), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), lastspotdup(false), highQualityComputed(false),
retistrsav(nullptr) retistrsav(nullptr)
{} {}
@ -1664,8 +1664,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
pthstr[0] = ps_str + "@"; pthstr[0] = ps_str + "@";
//end local ps //end local ps
//Exp curve //Exp curve
int sizex = params.locallab.excurve.size(); int sizex = params.locallab.excurve.size();
@ -1700,7 +1700,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
} }
locallutili = false; locallutili = false;
localexutili = false; localexutili = false;
localcutili = false; localcutili = false;
localskutili = false; localskutili = false;
@ -2661,20 +2661,20 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
} }
if (hhstr[sp].c_str() != t_curvhhref) { if (hhstr[sp].c_str() != t_curvhhref) {
// HHutili = true; // HHutili = true;
} }
std::string t_curvskinref = "3000A0B0C1000D1000E@"; std::string t_curvskinref = "3000A0B0C1000D1000E@";
std::string t_none = "0A@"; std::string t_none = "0A@";
if (skinstr[sp].c_str() != t_curvskinref && skinstr[sp].c_str() != t_none) { if (skinstr[sp].c_str() != t_curvskinref && skinstr[sp].c_str() != t_none) {
// localskutili = true; // localskutili = true;
} }
std::string t_curvexref = "3000A0B0C1000D1000E@"; std::string t_curvexref = "3000A0B0C1000D1000E@";
if (exstr[sp].c_str() != t_curvexref && exstr[sp].c_str() != t_none) { if (exstr[sp].c_str() != t_curvexref && exstr[sp].c_str() != t_none) {
// localexutili = true; // localexutili = true;
} }
params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili);
@ -2698,7 +2698,12 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
double huere, chromare, lumare, huerefblu; double huere, chromare, lumare, huerefblu;
double sobelre; double sobelre;
ipf.calc_ref(nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre); if (params.locallab.Exclumethod == "exc") {
ipf.calc_ref(reserv, reserv, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre);
} else {
ipf.calc_ref(nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre);
}
huerblu = huerefblu; huerblu = huerefblu;
huer = huere; huer = huere;
chromar = chromare; chromar = chromare;
@ -2753,13 +2758,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
params.locallab.sobelref = INFINITY; params.locallab.sobelref = INFINITY;
locallutili = false; locallutili = false;
localexutili = false; localexutili = false;
// locallutili = false; // locallutili = false;
localcutili = false; localcutili = false;
localskutili = false; localskutili = false;
// localexutili = false; // localexutili = false;
LHutili = false; LHutili = false;
HHutili = false; HHutili = false;
sps[sp] = sp; sps[sp] = sp;
dataspot[2][sp] = circrads[sp] = params.locallab.circrad = dataspot[2][0]; dataspot[2][sp] = circrads[sp] = params.locallab.circrad = dataspot[2][0];
@ -3301,7 +3306,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
//end local PS //end local PS
//expos //expos
int *s_datcex; int *s_datcex;
s_datcex = new int[70]; s_datcex = new int[70];
@ -3330,11 +3335,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
std::string t_curvhhref2 = "1000A0B500C350D350E166F500G350H350I333J500K350L350M500N500O350P350Q666R500S350T350U833V500W350X350Y@"; std::string t_curvhhref2 = "1000A0B500C350D350E166F500G350H350I333J500K350L350M500N500O350P350Q666R500S350T350U833V500W350X350Y@";
if (hhstr[sp].c_str() != t_curvhhref2) { if (hhstr[sp].c_str() != t_curvhhref2) {
// HHutili = true; // HHutili = true;
} }
if (lhstr[sp].c_str() != t_curvhhref2) { if (lhstr[sp].c_str() != t_curvhhref2) {
// LHutili = true; // LHutili = true;
} }
params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili);
@ -3347,13 +3352,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
std::string t_none2 = "0A@"; std::string t_none2 = "0A@";
if (skinstr[sp].c_str() != t_curvskinref2 && skinstr[sp].c_str() != t_none2) { if (skinstr[sp].c_str() != t_curvskinref2 && skinstr[sp].c_str() != t_none2) {
// localskutili = true; // localskutili = true;
} }
std::string t_curvexref2 = "3000A0B0C1000D1000E@"; std::string t_curvexref2 = "3000A0B0C1000D1000E@";
if (exstr[sp].c_str() != t_curvexref2 && exstr[sp].c_str() != t_none2) { if (exstr[sp].c_str() != t_curvexref2 && exstr[sp].c_str() != t_none2) {
// localexutili = true; // localexutili = true;
} }
double br = 0.; double br = 0.;
@ -4899,25 +4904,28 @@ void ImProcCoordinator::changenumberofspot(int **dataspot, int maxdata, int maxs
fich2.close() ; fich2.close() ;
} }
} }
bool ImProcCoordinator::getHighQualComputed() { bool ImProcCoordinator::getHighQualComputed()
{
// this function may only be called from detail windows // this function may only be called from detail windows
if(!highQualityComputed) { if (!highQualityComputed) {
if(options.prevdemo == PD_Sidecar) { if (options.prevdemo == PD_Sidecar) {
// we already have high quality preview // we already have high quality preview
setHighQualComputed(); setHighQualComputed();
} else { } else {
for (size_t i = 0; i < crops.size() - 1; ++i) { // -1, because last entry is the freshly created detail window for (size_t i = 0; i < crops.size() - 1; ++i) { // -1, because last entry is the freshly created detail window
if (crops[i]->get_skip() == 1 ) { // there is at least one crop with skip == 1 => we already have high quality preview if (crops[i]->get_skip() == 1) { // there is at least one crop with skip == 1 => we already have high quality preview
setHighQualComputed(); setHighQualComputed();
break; break;
} }
} }
} }
} }
return highQualityComputed; return highQualityComputed;
} }
void ImProcCoordinator::setHighQualComputed() { void ImProcCoordinator::setHighQualComputed()
{
highQualityComputed = true; highQualityComputed = true;
} }

View File

@ -1145,10 +1145,10 @@ private:
int **dataspots; int **dataspots;
dataspots = new int*[maxdata]; dataspots = new int*[maxdata];
LUTf huerefs(500, -10000.f); LUTf huerefs(500, -10000.f);
LUTf sobelrefs(500, -10000.f); LUTf sobelrefs(500, -10000.f);
LUTi centerx (500, -10000); LUTi centerx(500, -10000);
LUTi centery (500, -10000); LUTi centery(500, -10000);
for (int i = 0; i < maxdata; i++) { for (int i = 0; i < maxdata; i++) {
dataspots[i] = new int[maxspot]; dataspots[i] = new int[maxspot];
@ -1722,7 +1722,7 @@ private:
params.locallab.locY = dataspots[4][sp]; params.locallab.locY = dataspots[4][sp];
params.locallab.locYT = dataspots[5][sp]; params.locallab.locYT = dataspots[5][sp];
params.locallab.locXL = dataspots[6][sp]; params.locallab.locXL = dataspots[6][sp];
params.locallab.centerX = centerx[sp]= dataspots[7][sp]; params.locallab.centerX = centerx[sp] = dataspots[7][sp];
params.locallab.centerY = centery[sp] = dataspots[8][sp]; params.locallab.centerY = centery[sp] = dataspots[8][sp];
params.locallab.lightness = dataspots[9][sp]; params.locallab.lightness = dataspots[9][sp];
params.locallab.contrast = dataspots[10][sp]; params.locallab.contrast = dataspots[10][sp];
@ -1983,7 +1983,7 @@ private:
params.locallab.huerefblur = ((float) dataspots[maxdata - 5][sp]) / 100.f; params.locallab.huerefblur = ((float) dataspots[maxdata - 5][sp]) / 100.f;
params.locallab.hueref = huerefs[sp] = ((float) dataspots[maxdata - 4][sp]) / 100.f; params.locallab.hueref = huerefs[sp] = ((float) dataspots[maxdata - 4][sp]) / 100.f;
huerefs[sp] *= 100.f; huerefs[sp] *= 100.f;
params.locallab.chromaref = dataspots[maxdata - 3][sp]; params.locallab.chromaref = dataspots[maxdata - 3][sp];
params.locallab.lumaref = dataspots[maxdata - 2][sp]; params.locallab.lumaref = dataspots[maxdata - 2][sp];
params.locallab.sobelref = sobelrefs[sp] = dataspots[maxdata - 1][sp]; params.locallab.sobelref = sobelrefs[sp] = dataspots[maxdata - 1][sp];
@ -2119,11 +2119,11 @@ private:
std::string t_curvhhref = "1000A0B500C350D350E166F500G350H350I333J500K350L350M500N500O350P350Q666R500S350T350U833V500W350X350Y@"; std::string t_curvhhref = "1000A0B500C350D350E166F500G350H350I333J500K350L350M500N500O350P350Q666R500S350T350U833V500W350X350Y@";
if (lhstrs[sp].c_str() != t_curvhhref) { if (lhstrs[sp].c_str() != t_curvhhref) {
// LHutili = true; // LHutili = true;
} }
if (hhstrs[sp].c_str() != t_curvhhref) { if (hhstrs[sp].c_str() != t_curvhhref) {
// HHutili = true; // HHutili = true;
} }
@ -2136,13 +2136,13 @@ private:
std::string t_none = "0A@"; std::string t_none = "0A@";
if (skinstrs[sp].c_str() != t_curvskinref && skinstrs[sp].c_str() != t_none) { if (skinstrs[sp].c_str() != t_curvskinref && skinstrs[sp].c_str() != t_none) {
// localskutili = true; // localskutili = true;
} }
std::string t_curvexref = "3000A0B0C1000D1000E@"; std::string t_curvexref = "3000A0B0C1000D1000E@";
if (exstrs[sp].c_str() != t_curvexref && exstrs[sp].c_str() != t_none) { if (exstrs[sp].c_str() != t_curvexref && exstrs[sp].c_str() != t_none) {
// localexutili = true; // localexutili = true;
} }
CurveFactory::curveLocal(locallutili, params.locallab.llcurve, lllocalcurve, 1); CurveFactory::curveLocal(locallutili, params.locallab.llcurve, lllocalcurve, 1);
@ -2166,15 +2166,21 @@ private:
double huere, chromare, lumare, huerefblu; double huere, chromare, lumare, huerefblu;
double sobelre; double sobelre;
ipf.calc_ref(labView, labView, 0, 0, fw, fh, 1, huerefblu, huere, chromare, lumare, sobelre); if (params.locallab.Exclumethod == "exc") {
ipf.calc_ref(reservView, reservView, 0, 0, fw, fh, 1, huerefblu, huere, chromare, lumare, sobelre);
} else {
ipf.calc_ref(labView, labView, 0, 0, fw, fh, 1, huerefblu, huere, chromare, lumare, sobelre);
}
params.locallab.huerefblur = huerefblu; params.locallab.huerefblur = huerefblu;
params.locallab.hueref = huere; params.locallab.hueref = huere;
params.locallab.chromaref = chromare; params.locallab.chromaref = chromare;
params.locallab.lumaref = lumare; params.locallab.lumaref = lumare;
params.locallab.sobelref = sobelre; params.locallab.sobelref = sobelre;
//nullptr or dataspot ?? //nullptr or dataspot ??
ipf.Lab_Local(2, maxspot, sp, huerefs, sobelrefs, centerx, centery, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, ipf.Lab_Local(2, maxspot, sp, huerefs, sobelrefs, centerx, centery, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve,
LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
lllocalcurve.clear(); lllocalcurve.clear();