merge with dev

This commit is contained in:
U-PC-BUREAU\jacques
2018-11-01 17:34:21 +01:00
19 changed files with 955 additions and 92 deletions

View File

@@ -607,6 +607,66 @@ bool LocalContrastParams::operator!=(const LocalContrastParams &other) const
const double ColorToningParams::LABGRID_CORR_MAX = 12000.f;
const double ColorToningParams::LABGRID_CORR_SCALE = 3.f;
ColorToningParams::LabCorrectionRegion::LabCorrectionRegion():
a(0),
b(0),
saturation(0),
lightness(0),
hueMask{
FCT_MinMaxCPoints,
0.166666667,
1.,
0.35,
0.35,
0.8287775246,
1.,
0.35,
0.35
},
chromaticityMask{
FCT_MinMaxCPoints,
0.,
1.,
0.35,
0.35,
1.,
1.,
0.35,
0.35
},
lightnessMask{
FCT_MinMaxCPoints,
0.,
1.,
0.35,
0.35,
1.,
1.,
0.35,
0.35
}
{
}
bool ColorToningParams::LabCorrectionRegion::operator==(const LabCorrectionRegion &other) const
{
return a == other.a
&& b == other.b
&& saturation == other.saturation
&& lightness == other.lightness
&& hueMask == other.hueMask
&& chromaticityMask == other.chromaticityMask
&& lightnessMask == other.lightnessMask;
}
bool ColorToningParams::LabCorrectionRegion::operator!=(const LabCorrectionRegion &other) const
{
return !(*this == other);
}
ColorToningParams::ColorToningParams() :
enabled(false),
autosat(true),
@@ -664,7 +724,7 @@ ColorToningParams::ColorToningParams() :
1.00,
1.00
},
method("Lab"),
method("LabRegions"),
twocolor("Std"),
redlow(0.0),
greenlow(0.0),
@@ -681,7 +741,9 @@ ColorToningParams::ColorToningParams() :
labgridALow(0.0),
labgridBLow(0.0),
labgridAHigh(0.0),
labgridBHigh(0.0)
labgridBHigh(0.0),
labregions{LabCorrectionRegion()},
labregionsShowMask(-1)
{
}
@@ -717,7 +779,9 @@ bool ColorToningParams::operator ==(const ColorToningParams& other) const
&& labgridALow == other.labgridALow
&& labgridBLow == other.labgridBLow
&& labgridAHigh == other.labgridAHigh
&& labgridBHigh == other.labgridBHigh;
&& labgridBHigh == other.labgridBHigh
&& labregions == other.labregions
&& labregionsShowMask == other.labregionsShowMask;
}
bool ColorToningParams::operator !=(const ColorToningParams& other) const
@@ -2930,7 +2994,7 @@ void ProcParams::setDefaults()
sharpening = SharpeningParams();
prsharpening = SharpeningParams();
prsharpening.contrast = 0.0;
prsharpening.contrast = 15.0;
prsharpening.method = "rld";
prsharpening.deconvamount = 100;
prsharpening.deconvradius = 0.45;
@@ -3772,6 +3836,20 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->colorToning.labgridBLow, "ColorToning", "LabGridBLow", colorToning.labgridBLow, keyFile);
saveToKeyfile(!pedited || pedited->colorToning.labgridAHigh, "ColorToning", "LabGridAHigh", colorToning.labgridAHigh, keyFile);
saveToKeyfile(!pedited || pedited->colorToning.labgridBHigh, "ColorToning", "LabGridBHigh", colorToning.labgridBHigh, keyFile);
if (!pedited || pedited->colorToning.labregions) {
for (size_t j = 0; j < colorToning.labregions.size(); ++j) {
std::string n = std::to_string(j+1);
auto &l = colorToning.labregions[j];
putToKeyfile("ColorToning", Glib::ustring("LabRegionA_") + n, l.a, keyFile);
putToKeyfile("ColorToning", Glib::ustring("LabRegionB_") + n, l.b, keyFile);
putToKeyfile("ColorToning", Glib::ustring("LabRegionSaturation_") + n, l.saturation, keyFile);
putToKeyfile("ColorToning", Glib::ustring("LabRegionLightness_") + n, l.lightness, keyFile);
putToKeyfile("ColorToning", Glib::ustring("LabRegionHueMask_") + n, l.hueMask, keyFile);
putToKeyfile("ColorToning", Glib::ustring("LabRegionChromaticityMask_") + n, l.chromaticityMask, keyFile);
putToKeyfile("ColorToning", Glib::ustring("LabRegionLightnessMask_") + n, l.lightnessMask, keyFile);
}
}
saveToKeyfile(!pedited || pedited->colorToning.labregionsShowMask, "ColorToning", "LabRegionsShowMask", colorToning.labregionsShowMask, keyFile);
// Raw
saveToKeyfile(!pedited || pedited->raw.darkFrame, "RAW", "DarkFrame", relativePathIfInside(fname, fnameAbsolute, raw.dark_frame), keyFile);
@@ -5386,6 +5464,49 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
colorToning.labgridBLow *= scale;
colorToning.labgridBHigh *= scale;
}
std::vector<ColorToningParams::LabCorrectionRegion> lg;
bool found = false;
bool done = false;
for (int i = 1; !done; ++i) {
ColorToningParams::LabCorrectionRegion cur;
done = true;
std::string n = std::to_string(i);
if (assignFromKeyfile(keyFile, "ColorToning", Glib::ustring("LabRegionA_") + n, pedited, cur.a, pedited->colorToning.labregions)) {
found = true;
done = false;
}
if (assignFromKeyfile(keyFile, "ColorToning", Glib::ustring("LabRegionB_") + n, pedited, cur.b, pedited->colorToning.labregions)) {
found = true;
done = false;
}
if (assignFromKeyfile(keyFile, "ColorToning", Glib::ustring("LabRegionSaturation_") + n, pedited, cur.saturation, pedited->colorToning.labregions)) {
found = true;
done = false;
}
if (assignFromKeyfile(keyFile, "ColorToning", Glib::ustring("LabRegionLightness_") + n, pedited, cur.lightness, pedited->colorToning.labregions)) {
found = true;
done = false;
}
if (assignFromKeyfile(keyFile, "ColorToning", Glib::ustring("LabRegionHueMask_") + n, pedited, cur.hueMask, pedited->colorToning.labregions)) {
found = true;
done = false;
}
if (assignFromKeyfile(keyFile, "ColorToning", Glib::ustring("LabRegionChromaticityMask_") + n, pedited, cur.chromaticityMask, pedited->colorToning.labregions)) {
found = true;
done = false;
}
if (assignFromKeyfile(keyFile, "ColorToning", Glib::ustring("LabRegionLightnessMask_") + n, pedited, cur.lightnessMask, pedited->colorToning.labregions)) {
found = true;
done = false;
}
if (!done) {
lg.emplace_back(cur);
}
}
if (found) {
colorToning.labregions = std::move(lg);
}
assignFromKeyfile(keyFile, "ColorToning", "LabRegionsShowMask", pedited, colorToning.labregionsShowMask, pedited->colorToning.labregionsShowMask);
}
if (keyFile.has_group("RAW")) {