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()) {
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,
double shcompr, double br, double contr,
const std::vector<double>& curvePoints,
const std::vector<double>& curvePoints2,
LUTu & histogram,
LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve,
LUTu & outBeforeCCurveHistogram,
ToneCurve & customToneCurve1,
ToneCurve & customToneCurve2,
int skip)
void CurveFactory::complexCurve(double ecomp, double black, double hlcompr, double hlcomprthresh,
double shcompr, double br, double contr,
const std::vector<double>& curvePoints,
const std::vector<double>& curvePoints2,
LUTu & histogram,
LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve,
LUTu & outBeforeCCurveHistogram,
ToneCurve & customToneCurve1,
ToneCurve & customToneCurve2,
int skip)
{
// 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,
double shcompr, double br, double contr,
LUTu & histogram,
LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve,
int skip)
double shcompr, double br, double contr,
LUTu & histogram,
LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve,
int skip)
{
// 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)
{
// 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) {
FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2);
ttcurve.setIdentityValue(0.);
Set(ttcurve);
HHutili = true;
HHutili = true;
} else {
Reset();
}
@ -1612,7 +1612,7 @@ void LocLHCurve::Set(const std::vector<double> &curvePoints, bool &LHutili)
FlatCurve tcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2);
tcurve.setIdentityValue(0.);
Set(tcurve);
LHutili = true;
LHutili = true;
} else {
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);
float J, C, h;
Ciecam02::xyz2jch_ciecam02float( J, C, h,
aw, fl,
x * 0.0015259022f, y * 0.0015259022f, z * 0.0015259022f,
xw, yw, zw,
c, nc, pow1, nbb, ncb, cz, d);
Ciecam02::xyz2jch_ciecam02float(J, C, h,
aw, fl,
x * 0.0015259022f, y * 0.0015259022f, z * 0.0015259022f,
xw, yw, zw,
c, nc, pow1, nbb, ncb, cz, d);
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;
b = newb;
}
rc[i] = r;
gc[i] = g;
bc[i] = b;
@ -2677,10 +2678,10 @@ void PerceptualToneCurve::BatchApply(const size_t start, const size_t end, float
C *= cmul;
Ciecam02::jch2xyz_ciecam02float( x, y, z,
J, C, h,
xw, yw, zw,
c, nc, 1, pow1, nbb, ncb, fl, cz, d, aw );
Ciecam02::jch2xyz_ciecam02float(x, y, z,
J, C, h,
xw, yw, zw,
c, nc, 1, pow1, nbb, ncb, fl, cz, d, aw);
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.
@ -2756,6 +2757,7 @@ void PerceptualToneCurve::BatchApply(const size_t start, const size_t end, float
g = newg;
b = newb;
}
rc[i] = r;
gc[i] = g;
bc[i] = b;

View File

@ -229,7 +229,7 @@ ImProcCoordinator::ImProcCoordinator()
chromar(0),
lumar(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)
{}
@ -1664,8 +1664,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
pthstr[0] = ps_str + "@";
//end local ps
//Exp curve
int sizex = params.locallab.excurve.size();
@ -1700,7 +1700,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
}
locallutili = false;
localexutili = false;
localexutili = false;
localcutili = false;
localskutili = false;
@ -2661,20 +2661,20 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
}
if (hhstr[sp].c_str() != t_curvhhref) {
// HHutili = true;
// HHutili = true;
}
std::string t_curvskinref = "3000A0B0C1000D1000E@";
std::string t_none = "0A@";
if (skinstr[sp].c_str() != t_curvskinref && skinstr[sp].c_str() != t_none) {
// localskutili = true;
// localskutili = true;
}
std::string t_curvexref = "3000A0B0C1000D1000E@";
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);
@ -2698,7 +2698,12 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
double huere, chromare, lumare, huerefblu;
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;
huer = huere;
chromar = chromare;
@ -2753,13 +2758,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
params.locallab.sobelref = INFINITY;
locallutili = false;
localexutili = false;
// locallutili = false;
localcutili = false;
localskutili = false;
// localexutili = false;
// locallutili = false;
localcutili = false;
localskutili = false;
// localexutili = false;
LHutili = false;
HHutili = false;
LHutili = false;
HHutili = false;
sps[sp] = sp;
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
//expos
int *s_datcex;
s_datcex = new int[70];
@ -3330,11 +3335,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
std::string t_curvhhref2 = "1000A0B500C350D350E166F500G350H350I333J500K350L350M500N500O350P350Q666R500S350T350U833V500W350X350Y@";
if (hhstr[sp].c_str() != t_curvhhref2) {
// HHutili = true;
// HHutili = true;
}
if (lhstr[sp].c_str() != t_curvhhref2) {
// LHutili = true;
// LHutili = true;
}
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@";
if (skinstr[sp].c_str() != t_curvskinref2 && skinstr[sp].c_str() != t_none2) {
// localskutili = true;
// localskutili = true;
}
std::string t_curvexref2 = "3000A0B0C1000D1000E@";
if (exstr[sp].c_str() != t_curvexref2 && exstr[sp].c_str() != t_none2) {
// localexutili = true;
// localexutili = true;
}
double br = 0.;
@ -4899,25 +4904,28 @@ void ImProcCoordinator::changenumberofspot(int **dataspot, int maxdata, int maxs
fich2.close() ;
}
}
bool ImProcCoordinator::getHighQualComputed() {
bool ImProcCoordinator::getHighQualComputed()
{
// this function may only be called from detail windows
if(!highQualityComputed) {
if(options.prevdemo == PD_Sidecar) {
if (!highQualityComputed) {
if (options.prevdemo == PD_Sidecar) {
// we already have high quality preview
setHighQualComputed();
} else {
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();
break;
}
}
}
}
return highQualityComputed;
}
void ImProcCoordinator::setHighQualComputed() {
void ImProcCoordinator::setHighQualComputed()
{
highQualityComputed = true;
}

View File

@ -1145,10 +1145,10 @@ private:
int **dataspots;
dataspots = new int*[maxdata];
LUTf huerefs(500, -10000.f);
LUTf sobelrefs(500, -10000.f);
LUTi centerx (500, -10000);
LUTi centery (500, -10000);
LUTf huerefs(500, -10000.f);
LUTf sobelrefs(500, -10000.f);
LUTi centerx(500, -10000);
LUTi centery(500, -10000);
for (int i = 0; i < maxdata; i++) {
dataspots[i] = new int[maxspot];
@ -1722,7 +1722,7 @@ private:
params.locallab.locY = dataspots[4][sp];
params.locallab.locYT = dataspots[5][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.lightness = dataspots[9][sp];
params.locallab.contrast = dataspots[10][sp];
@ -1983,7 +1983,7 @@ private:
params.locallab.huerefblur = ((float) dataspots[maxdata - 5][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.lumaref = dataspots[maxdata - 2][sp];
params.locallab.sobelref = sobelrefs[sp] = dataspots[maxdata - 1][sp];
@ -2119,11 +2119,11 @@ private:
std::string t_curvhhref = "1000A0B500C350D350E166F500G350H350I333J500K350L350M500N500O350P350Q666R500S350T350U833V500W350X350Y@";
if (lhstrs[sp].c_str() != t_curvhhref) {
// LHutili = true;
// LHutili = true;
}
if (hhstrs[sp].c_str() != t_curvhhref) {
// HHutili = true;
// HHutili = true;
}
@ -2136,13 +2136,13 @@ private:
std::string t_none = "0A@";
if (skinstrs[sp].c_str() != t_curvskinref && skinstrs[sp].c_str() != t_none) {
// localskutili = true;
// localskutili = true;
}
std::string t_curvexref = "3000A0B0C1000D1000E@";
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);
@ -2166,15 +2166,21 @@ private:
double huere, chromare, lumare, huerefblu;
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.hueref = huere;
params.locallab.chromaref = chromare;
params.locallab.lumaref = lumare;
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,
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();