From 157b42cd83493fe2844f281444208d4c77bf0da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Sat, 11 Nov 2017 20:25:13 +0100 Subject: [PATCH 01/47] Introduce `assignFromKeyfile()` and `saveToKeyfile()` --- rtengine/procparams.cc | 6758 ++++++++-------------------------------- rtengine/procparams.h | 20 +- 2 files changed, 1233 insertions(+), 5545 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 7662a9920..9ffa0a290 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -16,16 +16,22 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include + +#include + #include + +#include "curves.h" #include "procparams.h" #include "rt_math.h" -#include "curves.h" + #include "../rtgui/multilangmgr.h" -#include "../rtgui/version.h" -#include "../rtgui/ppversion.h" -#include "../rtgui/paramsedited.h" #include "../rtgui/options.h" -#include +#include "../rtgui/paramsedited.h" +#include "../rtgui/ppversion.h" +#include "../rtgui/version.h" + #define APPVERSION RTVERSION using namespace std; @@ -41,6 +47,202 @@ void avoidEmptyCurve (std::vector &curve) } } +void getFromKeyfile( + const Glib::KeyFile& keyfile, + const Glib::ustring& group_name, + const Glib::ustring& key, + int& value +) +{ + value = keyfile.get_integer(group_name, key); +} + +void getFromKeyfile( + const Glib::KeyFile& keyfile, + const Glib::ustring& group_name, + const Glib::ustring& key, + double& value +) +{ + value = keyfile.get_double(group_name, key); +} + +void getFromKeyfile( + const Glib::KeyFile& keyfile, + const Glib::ustring& group_name, + const Glib::ustring& key, + bool& value +) +{ + value = keyfile.get_boolean(group_name, key); +} + +void getFromKeyfile( + const Glib::KeyFile& keyfile, + const Glib::ustring& group_name, + const Glib::ustring& key, + Glib::ustring& value +) +{ + value = keyfile.get_string(group_name, key); +} + +void getFromKeyfile( + const Glib::KeyFile& keyfile, + const Glib::ustring& group_name, + const Glib::ustring& key, + std::vector& value +) +{ + value = keyfile.get_double_list(group_name, key); + avoidEmptyCurve(value); +} + +template +bool assignFromKeyfile( + const Glib::KeyFile& keyfile, + const Glib::ustring& group_name, + const Glib::ustring& key, + bool has_params_edited, + T& value, + bool& params_edited_value +) +{ + if (keyfile.has_key(group_name, key)) { + getFromKeyfile(keyfile, group_name, key, value); + + if (has_params_edited) { + params_edited_value = true; + } + + return true; + } + return false; +} + +template::value>::type> +bool assignFromKeyfile( + const Glib::KeyFile& keyfile, + const Glib::ustring& group_name, + const Glib::ustring& key, + bool has_params_edited, + const std::map& mapping, + T& value, + bool& params_edited_value +) +{ + if (keyfile.has_key(group_name, key)) { + Glib::ustring v; + getFromKeyfile(keyfile, group_name, key, v); + + const typename std::map::const_iterator m = mapping.find(v.c_str()); + + if (m != mapping.end()) { + value = m->second; + } else { + return false; + } + + if (has_params_edited) { + params_edited_value = true; + } + + return true; + } + return false; +} + +void putToKeyfile( + const Glib::ustring& group_name, + const Glib::ustring& key, + int value, + Glib::KeyFile& keyfile +) +{ + keyfile.set_integer(group_name, key, value); +} + +void putToKeyfile( + const Glib::ustring& group_name, + const Glib::ustring& key, + double value, + Glib::KeyFile& keyfile +) +{ + keyfile.set_double(group_name, key, value); +} + +void putToKeyfile( + const Glib::ustring& group_name, + const Glib::ustring& key, + bool value, + Glib::KeyFile& keyfile +) +{ + keyfile.set_boolean(group_name, key, value); +} + +void putToKeyfile( + const Glib::ustring& group_name, + const Glib::ustring& key, + const Glib::ustring& value, + Glib::KeyFile& keyfile +) +{ + keyfile.set_string(group_name, key, value); +} + +void putToKeyfile( + const Glib::ustring& group_name, + const Glib::ustring& key, + const std::vector& value, + Glib::KeyFile& keyfile +) +{ + const Glib::ArrayHandle list = value; + keyfile.set_double_list(group_name, key, list); +} + +template +bool saveToKeyfile( + bool save, + const Glib::ustring& group_name, + const Glib::ustring& key, + const T& value, + Glib::KeyFile& keyfile +) +{ + if (save) { + putToKeyfile(group_name, key, value, keyfile); + return true; + } + return false; +} + +template::value>::type> +bool saveToKeyfile( + bool save, + const Glib::ustring& group_name, + const Glib::ustring& key, + const std::map& mapping, + const T& value, + Glib::KeyFile& keyfile +) +{ + if (save) { + const typename std::map::const_iterator m = mapping.find(value); + + if (m != mapping.end()) { + keyfile.set_string(group_name, key, m->second); + return true; + } + } + return false; +} + +// ( *)if \((!pedited \|\| pedited->.*?)\) \{\R *keyFile\.set_integer \("(.*?)", "(.*?)", (.*?)\);\R *\}\R +// \1saveToKeyfile(\2, "\3", "\4", \5, keyFile); + } namespace rtengine @@ -1445,276 +1647,73 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_string ("Version", "AppVersion", APPVERSION); keyFile.set_integer ("Version", "Version", PPVERSION); - if (!pedited || pedited->general.rank) { - keyFile.set_integer ("General", "Rank", rank); - } - - if (!pedited || pedited->general.colorlabel) { - keyFile.set_integer ("General", "ColorLabel", colorlabel); - } - - if (!pedited || pedited->general.intrash) { - keyFile.set_boolean ("General", "InTrash", inTrash); - } - + saveToKeyfile(!pedited || pedited->general.rank, "General", "Rank", rank, keyFile); + saveToKeyfile(!pedited || pedited->general.colorlabel, "General", "ColorLabel", colorlabel, keyFile); + saveToKeyfile(!pedited || pedited->general.intrash, "General", "InTrash", inTrash, keyFile); // save tone curve - if (!pedited || pedited->toneCurve.autoexp) { - keyFile.set_boolean ("Exposure", "Auto", toneCurve.autoexp); - } - - if (!pedited || pedited->toneCurve.clip) { - keyFile.set_double ("Exposure", "Clip", toneCurve.clip); - } - - if (!pedited || pedited->toneCurve.expcomp) { - keyFile.set_double ("Exposure", "Compensation", toneCurve.expcomp); - } - - if (!pedited || pedited->toneCurve.brightness) { - keyFile.set_integer ("Exposure", "Brightness", toneCurve.brightness); - } - - if (!pedited || pedited->toneCurve.contrast) { - keyFile.set_integer ("Exposure", "Contrast", toneCurve.contrast); - } - - if (!pedited || pedited->toneCurve.saturation) { - keyFile.set_integer ("Exposure", "Saturation", toneCurve.saturation); - } - - if (!pedited || pedited->toneCurve.black) { - keyFile.set_integer ("Exposure", "Black", toneCurve.black); - } - - if (!pedited || pedited->toneCurve.hlcompr) { - keyFile.set_integer ("Exposure", "HighlightCompr", toneCurve.hlcompr); - } - - if (!pedited || pedited->toneCurve.hlcomprthresh) { - keyFile.set_integer ("Exposure", "HighlightComprThreshold", toneCurve.hlcomprthresh); - } - - if (!pedited || pedited->toneCurve.shcompr) { - keyFile.set_integer ("Exposure", "ShadowCompr", toneCurve.shcompr); - } - + saveToKeyfile(!pedited || pedited->toneCurve.autoexp, "Exposure", "Auto", toneCurve.autoexp, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.clip, "Exposure", "Clip", toneCurve.clip, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.expcomp, "Exposure", "Compensation", toneCurve.expcomp, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.brightness, "Exposure", "Brightness", toneCurve.brightness, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.contrast, "Exposure", "Contrast", toneCurve.contrast, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.saturation, "Exposure", "Saturation", toneCurve.saturation, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.black, "Exposure", "Black", toneCurve.black, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.hlcompr, "Exposure", "HighlightCompr", toneCurve.hlcompr, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.hlcomprthresh, "Exposure", "HighlightComprThreshold", toneCurve.hlcomprthresh, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.shcompr, "Exposure", "ShadowCompr", toneCurve.shcompr, keyFile); // save highlight recovery settings - if (!pedited || pedited->toneCurve.hrenabled) { - keyFile.set_boolean ("HLRecovery", "Enabled", toneCurve.hrenabled); - } + saveToKeyfile(!pedited || pedited->toneCurve.hrenabled, "HLRecovery", "Enabled", toneCurve.hrenabled, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.method, "HLRecovery", "Method", toneCurve.method, keyFile); - if (!pedited || pedited->toneCurve.method) { - keyFile.set_string ("HLRecovery", "Method", toneCurve.method); - } + const std::map tc_mapping = { + {ToneCurveParams::TC_MODE_STD, "Standard"}, + {ToneCurveParams::TC_MODE_FILMLIKE, "FilmLike"}, + {ToneCurveParams::TC_MODE_SATANDVALBLENDING, "SatAndValueBlending"}, + {ToneCurveParams::TC_MODE_WEIGHTEDSTD,"WeightedStd"}, + {ToneCurveParams::TC_MODE_LUMINANCE, "Luminance"}, + {ToneCurveParams::TC_MODE_PERCEPTUAL, "Perceptual"} + }; - if (!pedited || pedited->toneCurve.curveMode) { - Glib::ustring method; - - switch (toneCurve.curveMode) { - case (ToneCurveParams::TC_MODE_STD): - method = "Standard"; - break; - - case (ToneCurveParams::TC_MODE_FILMLIKE): - method = "FilmLike"; - break; - - case (ToneCurveParams::TC_MODE_SATANDVALBLENDING): - method = "SatAndValueBlending"; - break; - - case (ToneCurveParams::TC_MODE_WEIGHTEDSTD): - method = "WeightedStd"; - break; - - case (ToneCurveParams::TC_MODE_LUMINANCE): - method = "Luminance"; - break; - - case (ToneCurveParams::TC_MODE_PERCEPTUAL): - method = "Perceptual"; - break; - } - - keyFile.set_string ("Exposure", "CurveMode", method); - } - - if (!pedited || pedited->toneCurve.curveMode2) { - Glib::ustring method; - - switch (toneCurve.curveMode2) { - case (ToneCurveParams::TC_MODE_STD): - method = "Standard"; - break; - - case (ToneCurveParams::TC_MODE_FILMLIKE): - method = "FilmLike"; - break; - - case (ToneCurveParams::TC_MODE_SATANDVALBLENDING): - method = "SatAndValueBlending"; - break; - - case (ToneCurveParams::TC_MODE_WEIGHTEDSTD): - method = "WeightedStd"; - break; - - case (ToneCurveParams::TC_MODE_LUMINANCE): - method = "Luminance"; - break; - - case (ToneCurveParams::TC_MODE_PERCEPTUAL): - method = "Perceptual"; - break; - } - - keyFile.set_string ("Exposure", "CurveMode2", method); - } - - if (!pedited || pedited->toneCurve.curve) { - Glib::ArrayHandle tcurve = toneCurve.curve; - keyFile.set_double_list ("Exposure", "Curve", tcurve); - } - - if (!pedited || pedited->toneCurve.curve2) { - Glib::ArrayHandle tcurve = toneCurve.curve2; - keyFile.set_double_list ("Exposure", "Curve2", tcurve); - } + saveToKeyfile(!pedited || pedited->toneCurve.curveMode, "Exposure", "CurveMode", tc_mapping, toneCurve.curveMode, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.curveMode2, "Exposure", "CurveMode2", tc_mapping, toneCurve.curveMode2, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.curve, "Exposure", "Curve", toneCurve.curve, keyFile); + saveToKeyfile(!pedited || pedited->toneCurve.curve2, "Exposure", "Curve2", toneCurve.curve2, keyFile); //save retinex - if (!pedited || pedited->retinex.enabled) { - keyFile.set_boolean ("Retinex", "Enabled", retinex.enabled); - } - - if (!pedited || pedited->retinex.str) { - keyFile.set_integer ("Retinex", "Str", retinex.str); - } - - if (!pedited || pedited->retinex.scal) { - keyFile.set_integer ("Retinex", "Scal", retinex.scal); - } - - if (!pedited || pedited->retinex.iter) { - keyFile.set_integer ("Retinex", "Iter", retinex.iter); - } - - if (!pedited || pedited->retinex.grad) { - keyFile.set_integer ("Retinex", "Grad", retinex.grad); - } - - if (!pedited || pedited->retinex.grads) { - keyFile.set_integer ("Retinex", "Grads", retinex.grads); - } - - if (!pedited || pedited->retinex.gam) { - keyFile.set_double ("Retinex", "Gam", retinex.gam); - } - - if (!pedited || pedited->retinex.slope) { - keyFile.set_double ("Retinex", "Slope", retinex.slope); - } - - if (!pedited || pedited->retinex.medianmap) { - keyFile.set_boolean ("Retinex", "Median", retinex.medianmap); - } + saveToKeyfile(!pedited || pedited->retinex.enabled, "Retinex", "Enabled", retinex.enabled, keyFile); + saveToKeyfile(!pedited || pedited->retinex.str, "Retinex", "Str", retinex.str, keyFile); + saveToKeyfile(!pedited || pedited->retinex.scal, "Retinex", "Scal", retinex.scal, keyFile); + saveToKeyfile(!pedited || pedited->retinex.iter, "Retinex", "Iter", retinex.iter, keyFile); + saveToKeyfile(!pedited || pedited->retinex.grad, "Retinex", "Grad", retinex.grad, keyFile); + saveToKeyfile(!pedited || pedited->retinex.grads, "Retinex", "Grads", retinex.grads, keyFile); + saveToKeyfile(!pedited || pedited->retinex.gam, "Retinex", "Gam", retinex.gam, keyFile); + saveToKeyfile(!pedited || pedited->retinex.slope, "Retinex", "Slope", retinex.slope, keyFile); + saveToKeyfile(!pedited || pedited->retinex.medianmap, "Retinex", "Median", retinex.medianmap, keyFile); - - if (!pedited || pedited->retinex.neigh) { - keyFile.set_integer ("Retinex", "Neigh", retinex.neigh); - } - - if (!pedited || pedited->retinex.offs) { - keyFile.set_integer ("Retinex", "Offs", retinex.offs); - } - - if (!pedited || pedited->retinex.vart) { - keyFile.set_integer ("Retinex", "Vart", retinex.vart); - } - - if (!pedited || pedited->retinex.limd) { - keyFile.set_integer ("Retinex", "Limd", retinex.limd); - } - - if (!pedited || pedited->retinex.highl) { - keyFile.set_integer ("Retinex", "highl", retinex.highl); - } - - if (!pedited || pedited->retinex.skal) { - keyFile.set_integer ("Retinex", "skal", retinex.skal); - } - - if (!pedited || pedited->retinex.retinexMethod) { - keyFile.set_string ("Retinex", "RetinexMethod", retinex.retinexMethod); - } - - if (!pedited || pedited->retinex.mapMethod) { - keyFile.set_string ("Retinex", "mapMethod", retinex.mapMethod); - } - - if (!pedited || pedited->retinex.viewMethod) { - keyFile.set_string ("Retinex", "viewMethod", retinex.viewMethod); - } - - if (!pedited || pedited->retinex.retinexcolorspace) { - keyFile.set_string ("Retinex", "Retinexcolorspace", retinex.retinexcolorspace); - } - - if (!pedited || pedited->retinex.gammaretinex) { - keyFile.set_string ("Retinex", "Gammaretinex", retinex.gammaretinex); - } - - if (!pedited || pedited->retinex.cdcurve) { - Glib::ArrayHandle cdcurve = retinex.cdcurve; - keyFile.set_double_list ("Retinex", "CDCurve", cdcurve); - } - - if (!pedited || pedited->retinex.mapcurve) { - Glib::ArrayHandle mapcurve = retinex.mapcurve; - keyFile.set_double_list ("Retinex", "MAPCurve", mapcurve); - } - - if (!pedited || pedited->retinex.cdHcurve) { - Glib::ArrayHandle cdHcurve = retinex.cdHcurve; - keyFile.set_double_list ("Retinex", "CDHCurve", cdHcurve); - } - - if (!pedited || pedited->retinex.lhcurve) { - Glib::ArrayHandle lhcurve = retinex.lhcurve; - keyFile.set_double_list ("Retinex", "LHCurve", lhcurve); - } - - if (!pedited || pedited->retinex.highlights) { - keyFile.set_integer ("Retinex", "Highlights", retinex.highlights); - } - - if (!pedited || pedited->retinex.htonalwidth) { - keyFile.set_integer ("Retinex", "HighlightTonalWidth", retinex.htonalwidth); - } - - if (!pedited || pedited->retinex.shadows) { - keyFile.set_integer ("Retinex", "Shadows", retinex.shadows); - } - - if (!pedited || pedited->retinex.stonalwidth) { - keyFile.set_integer ("Retinex", "ShadowTonalWidth", retinex.stonalwidth); - } - - if (!pedited || pedited->retinex.radius) { - keyFile.set_integer ("Retinex", "Radius", retinex.radius); - } - - if (!pedited || pedited->retinex.transmissionCurve) { - Glib::ArrayHandle transmissionCurve = retinex.transmissionCurve; - keyFile.set_double_list ("Retinex", "TransmissionCurve", transmissionCurve); - } - - if (!pedited || pedited->retinex.gaintransmissionCurve) { - Glib::ArrayHandle gaintransmissionCurve = retinex.gaintransmissionCurve; - keyFile.set_double_list ("Retinex", "GainTransmissionCurve", gaintransmissionCurve); - } - + saveToKeyfile(!pedited || pedited->retinex.neigh, "Retinex", "Neigh", retinex.neigh, keyFile); + saveToKeyfile(!pedited || pedited->retinex.offs, "Retinex", "Offs", retinex.offs, keyFile); + saveToKeyfile(!pedited || pedited->retinex.vart, "Retinex", "Vart", retinex.vart, keyFile); + saveToKeyfile(!pedited || pedited->retinex.limd, "Retinex", "Limd", retinex.limd, keyFile); + saveToKeyfile(!pedited || pedited->retinex.highl, "Retinex", "highl", retinex.highl, keyFile); + saveToKeyfile(!pedited || pedited->retinex.skal, "Retinex", "skal", retinex.skal, keyFile); + saveToKeyfile(!pedited || pedited->retinex.retinexMethod, "Retinex", "RetinexMethod", retinex.retinexMethod, keyFile); + saveToKeyfile(!pedited || pedited->retinex.mapMethod, "Retinex", "mapMethod", retinex.mapMethod, keyFile); + saveToKeyfile(!pedited || pedited->retinex.viewMethod, "Retinex", "viewMethod", retinex.viewMethod, keyFile); + saveToKeyfile(!pedited || pedited->retinex.retinexcolorspace, "Retinex", "Retinexcolorspace", retinex.retinexcolorspace, keyFile); + saveToKeyfile(!pedited || pedited->retinex.gammaretinex, "Retinex", "Gammaretinex", retinex.gammaretinex, keyFile); + saveToKeyfile(!pedited || pedited->retinex.cdcurve, "Retinex", "CDCurve", retinex.cdcurve, keyFile); + saveToKeyfile(!pedited || pedited->retinex.mapcurve, "Retinex", "MAPCurve", retinex.mapcurve, keyFile); + saveToKeyfile(!pedited || pedited->retinex.cdHcurve, "Retinex", "CDHCurve", retinex.cdHcurve, keyFile); + saveToKeyfile(!pedited || pedited->retinex.lhcurve, "Retinex", "LHCurve", retinex.lhcurve, keyFile); + saveToKeyfile(!pedited || pedited->retinex.highlights, "Retinex", "Highlights", retinex.highlights, keyFile); + saveToKeyfile(!pedited || pedited->retinex.htonalwidth, "Retinex", "HighlightTonalWidth", retinex.htonalwidth, keyFile); + saveToKeyfile(!pedited || pedited->retinex.shadows, "Retinex", "Shadows", retinex.shadows, keyFile); + saveToKeyfile(!pedited || pedited->retinex.stonalwidth, "Retinex", "ShadowTonalWidth", retinex.stonalwidth, keyFile); + saveToKeyfile(!pedited || pedited->retinex.radius, "Retinex", "Radius", retinex.radius, keyFile); + saveToKeyfile(!pedited || pedited->retinex.transmissionCurve, "Retinex", "TransmissionCurve", retinex.transmissionCurve, keyFile); + saveToKeyfile(!pedited || pedited->retinex.gaintransmissionCurve, "Retinex", "GainTransmissionCurve", retinex.gaintransmissionCurve, keyFile); // save channel mixer if (!pedited || pedited->chmixer.red[0] || pedited->chmixer.red[1] || pedited->chmixer.red[2]) { Glib::ArrayHandle rmix (chmixer.red, 3, Glib::OWNERSHIP_NONE); @@ -1732,333 +1731,111 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b } //save Black & White - if (!pedited || pedited->blackwhite.enabled) { - keyFile.set_boolean ("Black & White", "Enabled", blackwhite.enabled); - } + saveToKeyfile(!pedited || pedited->blackwhite.enabled, "Black & White", "Enabled", blackwhite.enabled, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.method, "Black & White", "Method", blackwhite.method , keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.autoc, "Black & White", "Auto", blackwhite.autoc, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.enabledcc, "Black & White", "ComplementaryColors", blackwhite.enabledcc, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.setting, "Black & White", "Setting", blackwhite.setting , keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.filter, "Black & White", "Filter", blackwhite.filter , keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.mixerRed, "Black & White", "MixerRed", blackwhite.mixerRed, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.mixerOrange, "Black & White", "MixerOrange", blackwhite.mixerOrange, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.mixerYellow, "Black & White", "MixerYellow", blackwhite.mixerYellow, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.mixerGreen, "Black & White", "MixerGreen", blackwhite.mixerGreen, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.mixerCyan, "Black & White", "MixerCyan", blackwhite.mixerCyan, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.mixerBlue, "Black & White", "MixerBlue", blackwhite.mixerBlue, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.mixerMagenta, "Black & White", "MixerMagenta", blackwhite.mixerMagenta, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.mixerPurple, "Black & White", "MixerPurple", blackwhite.mixerPurple, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.gammaRed, "Black & White", "GammaRed", blackwhite.gammaRed, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.gammaGreen, "Black & White", "GammaGreen", blackwhite.gammaGreen, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.gammaBlue, "Black & White", "GammaBlue", blackwhite.gammaBlue, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.algo, "Black & White", "Algorithm", blackwhite.algo, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.luminanceCurve, "Black & White", "LuminanceCurve", blackwhite.luminanceCurve, keyFile); + saveToKeyfile( + !pedited || pedited->blackwhite.beforeCurveMode, + "Black & White", + "BeforeCurveMode", + { + {BlackWhiteParams::TC_MODE_STD_BW, "Standard"}, + {BlackWhiteParams::TC_MODE_FILMLIKE_BW, "FilmLike"}, + {BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW, "SatAndValueBlending"}, + {BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW, "WeightedStd"} - if (!pedited || pedited->blackwhite.method) { - keyFile.set_string ("Black & White", "Method", blackwhite.method ); - } - - if (!pedited || pedited->blackwhite.autoc) { - keyFile.set_boolean ("Black & White", "Auto", blackwhite.autoc); - } - - if (!pedited || pedited->blackwhite.enabledcc) { - keyFile.set_boolean ("Black & White", "ComplementaryColors", blackwhite.enabledcc); - } - - if (!pedited || pedited->blackwhite.setting) { - keyFile.set_string ("Black & White", "Setting", blackwhite.setting ); - } - - if (!pedited || pedited->blackwhite.filter) { - keyFile.set_string ("Black & White", "Filter", blackwhite.filter ); - } - - if (!pedited || pedited->blackwhite.mixerRed) { - keyFile.set_integer ("Black & White", "MixerRed", blackwhite.mixerRed); - } - - if (!pedited || pedited->blackwhite.mixerOrange) { - keyFile.set_integer ("Black & White", "MixerOrange", blackwhite.mixerOrange); - } - - if (!pedited || pedited->blackwhite.mixerYellow) { - keyFile.set_integer ("Black & White", "MixerYellow", blackwhite.mixerYellow); - } - - if (!pedited || pedited->blackwhite.mixerGreen) { - keyFile.set_integer ("Black & White", "MixerGreen", blackwhite.mixerGreen); - } - - if (!pedited || pedited->blackwhite.mixerCyan) { - keyFile.set_integer ("Black & White", "MixerCyan", blackwhite.mixerCyan); - } - - if (!pedited || pedited->blackwhite.mixerBlue) { - keyFile.set_integer ("Black & White", "MixerBlue", blackwhite.mixerBlue); - } - - if (!pedited || pedited->blackwhite.mixerMagenta) { - keyFile.set_integer ("Black & White", "MixerMagenta", blackwhite.mixerMagenta); - } - - if (!pedited || pedited->blackwhite.mixerPurple) { - keyFile.set_integer ("Black & White", "MixerPurple", blackwhite.mixerPurple); - } - - if (!pedited || pedited->blackwhite.gammaRed) { - keyFile.set_integer ("Black & White", "GammaRed", blackwhite.gammaRed); - } - - if (!pedited || pedited->blackwhite.gammaGreen) { - keyFile.set_integer ("Black & White", "GammaGreen", blackwhite.gammaGreen); - } - - if (!pedited || pedited->blackwhite.gammaBlue) { - keyFile.set_integer ("Black & White", "GammaBlue", blackwhite.gammaBlue); - } - - if (!pedited || pedited->blackwhite.algo) { - keyFile.set_string ("Black & White", "Algorithm", blackwhite.algo); - } - - if (!pedited || pedited->blackwhite.luminanceCurve) { - Glib::ArrayHandle luminanceCurve = blackwhite.luminanceCurve; - keyFile.set_double_list ("Black & White", "LuminanceCurve", luminanceCurve); - } - - if (!pedited || pedited->blackwhite.beforeCurveMode) { - Glib::ustring mode; - - switch (blackwhite.beforeCurveMode) { - case (BlackWhiteParams::TC_MODE_STD_BW): - mode = "Standard"; - break; - - case (BlackWhiteParams::TC_MODE_FILMLIKE_BW): - mode = "FilmLike"; - break; - - case (BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW): - mode = "SatAndValueBlending"; - break; - - case (BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW): - mode = "WeightedStd"; - break; - } - - keyFile.set_string ("Black & White", "BeforeCurveMode", mode); - } - - if (!pedited || pedited->blackwhite.afterCurveMode) { - Glib::ustring mode; - - switch (blackwhite.afterCurveMode) { - case (BlackWhiteParams::TC_MODE_STD_BW): - mode = "Standard"; - break; - - case (BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW): - mode = "WeightedStd"; - break; - - default: - break; - } - - keyFile.set_string ("Black & White", "AfterCurveMode", mode); - } - - if (!pedited || pedited->blackwhite.beforeCurve) { - Glib::ArrayHandle tcurvebw = blackwhite.beforeCurve; - keyFile.set_double_list ("Black & White", "BeforeCurve", tcurvebw); - } - - if (!pedited || pedited->blackwhite.afterCurve) { - Glib::ArrayHandle tcurvebw = blackwhite.afterCurve; - keyFile.set_double_list ("Black & White", "AfterCurve", tcurvebw); - } + }, + blackwhite.beforeCurveMode, + keyFile + ); + saveToKeyfile( + !pedited || pedited->blackwhite.afterCurveMode, + "Black & White", + "AfterCurveMode", + { + {BlackWhiteParams::TC_MODE_STD_BW, "Standard"}, + {BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW, "WeightedStd"} + }, + blackwhite.afterCurveMode, + keyFile + ); + saveToKeyfile(!pedited || pedited->blackwhite.beforeCurve, "Black & White", "BeforeCurve", blackwhite.beforeCurve, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.afterCurve, "Black & White", "AfterCurve", blackwhite.afterCurve, keyFile); // save luma curve - if (!pedited || pedited->labCurve.brightness) { - keyFile.set_integer ("Luminance Curve", "Brightness", labCurve.brightness); - } - - if (!pedited || pedited->labCurve.contrast) { - keyFile.set_integer ("Luminance Curve", "Contrast", labCurve.contrast); - } - - if (!pedited || pedited->labCurve.chromaticity) { - keyFile.set_integer ("Luminance Curve", "Chromaticity", labCurve.chromaticity); - } - - if (!pedited || pedited->labCurve.avoidcolorshift) { - keyFile.set_boolean ("Luminance Curve", "AvoidColorShift", labCurve.avoidcolorshift); - } - - if (!pedited || pedited->labCurve.rstprotection) { - keyFile.set_double ("Luminance Curve", "RedAndSkinTonesProtection", labCurve.rstprotection); - } - - if (!pedited || pedited->labCurve.lcredsk) { - keyFile.set_boolean ("Luminance Curve", "LCredsk", labCurve.lcredsk); - } - - if (!pedited || pedited->labCurve.lcurve) { - Glib::ArrayHandle lcurve = labCurve.lcurve; - keyFile.set_double_list ("Luminance Curve", "LCurve", lcurve); - } - - if (!pedited || pedited->labCurve.acurve) { - Glib::ArrayHandle acurve = labCurve.acurve; - keyFile.set_double_list ("Luminance Curve", "aCurve", acurve); - } - - if (!pedited || pedited->labCurve.bcurve) { - Glib::ArrayHandle bcurve = labCurve.bcurve; - keyFile.set_double_list ("Luminance Curve", "bCurve", bcurve); - } - - if (!pedited || pedited->labCurve.cccurve) { - Glib::ArrayHandle cccurve = labCurve.cccurve; - keyFile.set_double_list ("Luminance Curve", "ccCurve", cccurve); - } - - if (!pedited || pedited->labCurve.chcurve) { - Glib::ArrayHandle chcurve = labCurve.chcurve; - keyFile.set_double_list ("Luminance Curve", "chCurve", chcurve); - } - - if (!pedited || pedited->labCurve.lhcurve) { - Glib::ArrayHandle lhcurve = labCurve.lhcurve; - keyFile.set_double_list ("Luminance Curve", "lhCurve", lhcurve); - } - - if (!pedited || pedited->labCurve.hhcurve) { - Glib::ArrayHandle hhcurve = labCurve.hhcurve; - keyFile.set_double_list ("Luminance Curve", "hhCurve", hhcurve); - } - - if (!pedited || pedited->labCurve.lccurve) { - Glib::ArrayHandle lccurve = labCurve.lccurve; - keyFile.set_double_list ("Luminance Curve", "LcCurve", lccurve); - } - - if (!pedited || pedited->labCurve.clcurve) { - Glib::ArrayHandle clcurve = labCurve.clcurve; - keyFile.set_double_list ("Luminance Curve", "ClCurve", clcurve); - } - + saveToKeyfile(!pedited || pedited->labCurve.brightness, "Luminance Curve", "Brightness", labCurve.brightness, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.contrast, "Luminance Curve", "Contrast", labCurve.contrast, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.chromaticity, "Luminance Curve", "Chromaticity", labCurve.chromaticity, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.avoidcolorshift, "Luminance Curve", "AvoidColorShift", labCurve.avoidcolorshift, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.rstprotection, "Luminance Curve", "RedAndSkinTonesProtection", labCurve.rstprotection, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.lcredsk, "Luminance Curve", "LCredsk", labCurve.lcredsk, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.lcurve, "Luminance Curve", "LCurve", labCurve.lcurve, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.acurve, "Luminance Curve", "aCurve", labCurve.acurve, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.bcurve, "Luminance Curve", "bCurve", labCurve.bcurve, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.cccurve, "Luminance Curve", "ccCurve", labCurve.cccurve, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.chcurve, "Luminance Curve", "chCurve", labCurve.chcurve, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.lhcurve, "Luminance Curve", "lhCurve", labCurve.lhcurve, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.hhcurve, "Luminance Curve", "hhCurve", labCurve.hhcurve, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.lccurve, "Luminance Curve", "LcCurve", labCurve.lccurve, keyFile); + saveToKeyfile(!pedited || pedited->labCurve.clcurve, "Luminance Curve", "ClCurve", labCurve.clcurve, keyFile); // save sharpening - if (!pedited || pedited->sharpening.enabled) { - keyFile.set_boolean ("Sharpening", "Enabled", sharpening.enabled); - } - - if (!pedited || pedited->sharpening.method) { - keyFile.set_string ("Sharpening", "Method", sharpening.method); - } - - if (!pedited || pedited->sharpening.radius) { - keyFile.set_double ("Sharpening", "Radius", sharpening.radius); - } - - if (!pedited || pedited->sharpening.amount) { - keyFile.set_integer ("Sharpening", "Amount", sharpening.amount); - } - + saveToKeyfile(!pedited || pedited->sharpening.enabled, "Sharpening", "Enabled", sharpening.enabled, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.method, "Sharpening", "Method", sharpening.method, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.radius, "Sharpening", "Radius", sharpening.radius, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.amount, "Sharpening", "Amount", sharpening.amount, keyFile); if (!pedited || pedited->sharpening.threshold) { Glib::ArrayHandle thresh (sharpening.threshold.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Sharpening", "Threshold", thresh); } - if (!pedited || pedited->sharpening.edgesonly) { - keyFile.set_boolean ("Sharpening", "OnlyEdges", sharpening.edgesonly); - } - - if (!pedited || pedited->sharpening.edges_radius) { - keyFile.set_double ("Sharpening", "EdgedetectionRadius", sharpening.edges_radius); - } - - if (!pedited || pedited->sharpening.edges_tolerance) { - keyFile.set_integer ("Sharpening", "EdgeTolerance", sharpening.edges_tolerance); - } - - if (!pedited || pedited->sharpening.halocontrol) { - keyFile.set_boolean ("Sharpening", "HalocontrolEnabled", sharpening.halocontrol); - } - - if (!pedited || pedited->sharpening.halocontrol_amount) { - keyFile.set_integer ("Sharpening", "HalocontrolAmount", sharpening.halocontrol_amount); - } - - if (!pedited || pedited->sharpening.deconvradius) { - keyFile.set_double ("Sharpening", "DeconvRadius", sharpening.deconvradius); - } - - if (!pedited || pedited->sharpening.deconvamount) { - keyFile.set_integer ("Sharpening", "DeconvAmount", sharpening.deconvamount); - } - - if (!pedited || pedited->sharpening.deconvdamping) { - keyFile.set_integer ("Sharpening", "DeconvDamping", sharpening.deconvdamping); - } - - if (!pedited || pedited->sharpening.deconviter) { - keyFile.set_integer ("Sharpening", "DeconvIterations", sharpening.deconviter); - } - + saveToKeyfile(!pedited || pedited->sharpening.edgesonly, "Sharpening", "OnlyEdges", sharpening.edgesonly, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.edges_radius, "Sharpening", "EdgedetectionRadius", sharpening.edges_radius, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.edges_tolerance, "Sharpening", "EdgeTolerance", sharpening.edges_tolerance, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.halocontrol, "Sharpening", "HalocontrolEnabled", sharpening.halocontrol, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.halocontrol_amount, "Sharpening", "HalocontrolAmount", sharpening.halocontrol_amount, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.deconvradius, "Sharpening", "DeconvRadius", sharpening.deconvradius, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.deconvamount, "Sharpening", "DeconvAmount", sharpening.deconvamount, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.deconvdamping, "Sharpening", "DeconvDamping", sharpening.deconvdamping, keyFile); + saveToKeyfile(!pedited || pedited->sharpening.deconviter, "Sharpening", "DeconvIterations", sharpening.deconviter, keyFile); // save vibrance - if (!pedited || pedited->vibrance.enabled) { - keyFile.set_boolean ("Vibrance", "Enabled", vibrance.enabled); - } - - if (!pedited || pedited->vibrance.pastels) { - keyFile.set_integer ("Vibrance", "Pastels", vibrance.pastels); - } - - if (!pedited || pedited->vibrance.saturated) { - keyFile.set_integer ("Vibrance", "Saturated", vibrance.saturated); - } - + saveToKeyfile(!pedited || pedited->vibrance.enabled, "Vibrance", "Enabled", vibrance.enabled, keyFile); + saveToKeyfile(!pedited || pedited->vibrance.pastels, "Vibrance", "Pastels", vibrance.pastels, keyFile); + saveToKeyfile(!pedited || pedited->vibrance.saturated, "Vibrance", "Saturated", vibrance.saturated, keyFile); if (!pedited || pedited->vibrance.psthreshold) { Glib::ArrayHandle thresh (vibrance.psthreshold.value, 2, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Vibrance", "PSThreshold", thresh); } - if (!pedited || pedited->vibrance.protectskins) { - keyFile.set_boolean ("Vibrance", "ProtectSkins", vibrance.protectskins); - } - - if (!pedited || pedited->vibrance.avoidcolorshift) { - keyFile.set_boolean ("Vibrance", "AvoidColorShift", vibrance.avoidcolorshift); - } - - if (!pedited || pedited->vibrance.pastsattog) { - keyFile.set_boolean ("Vibrance", "PastSatTog", vibrance.pastsattog); - } - - if (!pedited || pedited->vibrance.skintonescurve) { - Glib::ArrayHandle skintonescurve = vibrance.skintonescurve; - keyFile.set_double_list ("Vibrance", "SkinTonesCurve", skintonescurve); - } - + saveToKeyfile(!pedited || pedited->vibrance.protectskins, "Vibrance", "ProtectSkins", vibrance.protectskins, keyFile); + saveToKeyfile(!pedited || pedited->vibrance.avoidcolorshift, "Vibrance", "AvoidColorShift", vibrance.avoidcolorshift, keyFile); + saveToKeyfile(!pedited || pedited->vibrance.pastsattog, "Vibrance", "PastSatTog", vibrance.pastsattog, keyFile); + saveToKeyfile(!pedited || pedited->vibrance.skintonescurve, "Vibrance", "SkinTonesCurve", vibrance.skintonescurve, keyFile); //save edge sharpening - if (!pedited || pedited->sharpenEdge.enabled) { - keyFile.set_boolean ("SharpenEdge", "Enabled", sharpenEdge.enabled); - } - - if (!pedited || pedited->sharpenEdge.passes) { - keyFile.set_integer ("SharpenEdge", "Passes", sharpenEdge.passes); - } - - if (!pedited || pedited->sharpenEdge.amount) { - keyFile.set_double ("SharpenEdge", "Strength", sharpenEdge.amount); - } - - if (!pedited || pedited->sharpenEdge.threechannels) { - keyFile.set_boolean ("SharpenEdge", "ThreeChannels", sharpenEdge.threechannels); - } - + saveToKeyfile(!pedited || pedited->sharpenEdge.enabled, "SharpenEdge", "Enabled", sharpenEdge.enabled, keyFile); + saveToKeyfile(!pedited || pedited->sharpenEdge.passes, "SharpenEdge", "Passes", sharpenEdge.passes, keyFile); + saveToKeyfile(!pedited || pedited->sharpenEdge.amount, "SharpenEdge", "Strength", sharpenEdge.amount, keyFile); + saveToKeyfile(!pedited || pedited->sharpenEdge.threechannels, "SharpenEdge", "ThreeChannels", sharpenEdge.threechannels, keyFile); //save micro-contrast sharpening - if (!pedited || pedited->sharpenMicro.enabled) { - keyFile.set_boolean ("SharpenMicro", "Enabled", sharpenMicro.enabled); - } - - if (!pedited || pedited->sharpenMicro.matrix) { - keyFile.set_boolean ("SharpenMicro", "Matrix", sharpenMicro.matrix); - } - - if (!pedited || pedited->sharpenMicro.amount) { - keyFile.set_double ("SharpenMicro", "Strength", sharpenMicro.amount); - } - - if (!pedited || pedited->sharpenMicro.uniformity) { - keyFile.set_double ("SharpenMicro", "Uniformity", sharpenMicro.uniformity); - } - + saveToKeyfile(!pedited || pedited->sharpenMicro.enabled, "SharpenMicro", "Enabled", sharpenMicro.enabled, keyFile); + saveToKeyfile(!pedited || pedited->sharpenMicro.matrix, "SharpenMicro", "Matrix", sharpenMicro.matrix, keyFile); + saveToKeyfile(!pedited || pedited->sharpenMicro.amount, "SharpenMicro", "Strength", sharpenMicro.amount, keyFile); + saveToKeyfile(!pedited || pedited->sharpenMicro.uniformity, "SharpenMicro", "Uniformity", sharpenMicro.uniformity, keyFile); /* // save colorBoost if (!pedited || pedited->colorBoost.amount) keyFile.set_integer ("Color Boost", "Amount", colorBoost.amount); @@ -2068,395 +1845,130 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b */ // save wb - if (!pedited || pedited->wb.method) { - keyFile.set_string ("White Balance", "Setting", wb.method); - } - - if (!pedited || pedited->wb.temperature) { - keyFile.set_integer ("White Balance", "Temperature", wb.temperature); - } - - if (!pedited || pedited->wb.green) { - keyFile.set_double ("White Balance", "Green", wb.green); - } - - if (!pedited || pedited->wb.equal) { - keyFile.set_double ("White Balance", "Equal", wb.equal); - } - - if (!pedited || pedited->wb.tempBias) { - keyFile.set_double ("White Balance", "TemperatureBias", wb.tempBias); - } - + saveToKeyfile(!pedited || pedited->wb.method, "White Balance", "Setting", wb.method, keyFile); + saveToKeyfile(!pedited || pedited->wb.temperature, "White Balance", "Temperature", wb.temperature, keyFile); + saveToKeyfile(!pedited || pedited->wb.green, "White Balance", "Green", wb.green, keyFile); + saveToKeyfile(!pedited || pedited->wb.equal, "White Balance", "Equal", wb.equal, keyFile); + saveToKeyfile(!pedited || pedited->wb.tempBias, "White Balance", "TemperatureBias", wb.tempBias, keyFile); /* // save colorShift if (!pedited || pedited->colorShift.a) keyFile.set_double ("Color Shift", "ChannelA", colorShift.a); if (!pedited || pedited->colorShift.b) keyFile.set_double ("Color Shift", "ChannelB", colorShift.b); */ // save colorappearance - if (!pedited || pedited->colorappearance.enabled) { - keyFile.set_boolean ("Color appearance", "Enabled", colorappearance.enabled); - } - - if (!pedited || pedited->colorappearance.degree) { - keyFile.set_integer ("Color appearance", "Degree", colorappearance.degree); - } - - if (!pedited || pedited->colorappearance.autodegree) { - keyFile.set_boolean ("Color appearance", "AutoDegree", colorappearance.autodegree); - } - - if (!pedited || pedited->colorappearance.degreeout) { - keyFile.set_integer ("Color appearance", "Degreeout", colorappearance.degreeout); - } - - if (!pedited || pedited->colorappearance.autodegreeout) { - keyFile.set_boolean ("Color appearance", "AutoDegreeout", colorappearance.autodegreeout); - } - - if (!pedited || pedited->colorappearance.surround) { - keyFile.set_string ("Color appearance", "Surround", colorappearance.surround); - } - - if (!pedited || pedited->colorappearance.surrsrc) { - keyFile.set_string ("Color appearance", "Surrsrc", colorappearance.surrsrc); - } - + saveToKeyfile(!pedited || pedited->colorappearance.enabled, "Color appearance", "Enabled", colorappearance.enabled, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.degree, "Color appearance", "Degree", colorappearance.degree, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.autodegree, "Color appearance", "AutoDegree", colorappearance.autodegree, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.degreeout, "Color appearance", "Degreeout", colorappearance.degreeout, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.autodegreeout, "Color appearance", "AutoDegreeout", colorappearance.autodegreeout, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.surround, "Color appearance", "Surround", colorappearance.surround, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.surrsrc, "Color appearance", "Surrsrc", colorappearance.surrsrc, keyFile); // if (!pedited || pedited->colorappearance.backgrd) keyFile.set_integer ("Color appearance", "Background", colorappearance.backgrd); - if (!pedited || pedited->colorappearance.adaplum) { - keyFile.set_double ("Color appearance", "AdaptLum", colorappearance.adaplum); - } - - if (!pedited || pedited->colorappearance.badpixsl) { - keyFile.set_integer ("Color appearance", "Badpixsl", colorappearance.badpixsl); - } - - if (!pedited || pedited->colorappearance.wbmodel) { - keyFile.set_string ("Color appearance", "Model", colorappearance.wbmodel); - } - - if (!pedited || pedited->colorappearance.algo) { - keyFile.set_string ("Color appearance", "Algorithm", colorappearance.algo); - } - - if (!pedited || pedited->colorappearance.jlight) { - keyFile.set_double ("Color appearance", "J-Light", colorappearance.jlight); - } - - if (!pedited || pedited->colorappearance.qbright) { - keyFile.set_double ("Color appearance", "Q-Bright", colorappearance.qbright); - } - - if (!pedited || pedited->colorappearance.chroma) { - keyFile.set_double ("Color appearance", "C-Chroma", colorappearance.chroma); - } - - if (!pedited || pedited->colorappearance.schroma) { - keyFile.set_double ("Color appearance", "S-Chroma", colorappearance.schroma); - } - - if (!pedited || pedited->colorappearance.mchroma) { - keyFile.set_double ("Color appearance", "M-Chroma", colorappearance.mchroma); - } - - if (!pedited || pedited->colorappearance.contrast) { - keyFile.set_double ("Color appearance", "J-Contrast", colorappearance.contrast); - } - - if (!pedited || pedited->colorappearance.qcontrast) { - keyFile.set_double ("Color appearance", "Q-Contrast", colorappearance.qcontrast); - } - - if (!pedited || pedited->colorappearance.colorh) { - keyFile.set_double ("Color appearance", "H-Hue", colorappearance.colorh); - } - - if (!pedited || pedited->colorappearance.rstprotection) { - keyFile.set_double ("Color appearance", "RSTProtection", colorappearance.rstprotection); - } - - if (!pedited || pedited->colorappearance.adapscen) { - keyFile.set_double ("Color appearance", "AdaptScene", colorappearance.adapscen); - } - - if (!pedited || pedited->colorappearance.autoadapscen) { - keyFile.set_boolean ("Color appearance", "AutoAdapscen", colorappearance.autoadapscen); - } - - if (!pedited || pedited->colorappearance.ybscen) { - keyFile.set_integer ("Color appearance", "YbScene", colorappearance.ybscen); - } - - if (!pedited || pedited->colorappearance.autoybscen) { - keyFile.set_boolean ("Color appearance", "Autoybscen", colorappearance.autoybscen); - } - - if (!pedited || pedited->colorappearance.surrsource) { - keyFile.set_boolean ("Color appearance", "SurrSource", colorappearance.surrsource); - } - - if (!pedited || pedited->colorappearance.gamut) { - keyFile.set_boolean ("Color appearance", "Gamut", colorappearance.gamut); - } - - if (!pedited || pedited->colorappearance.tempout) { - keyFile.set_integer ("Color appearance", "Tempout", colorappearance.tempout); - } - - if (!pedited || pedited->colorappearance.greenout) { - keyFile.set_double ("Color appearance", "Greenout", colorappearance.greenout); - } - - if (!pedited || pedited->colorappearance.tempsc) { - keyFile.set_integer ("Color appearance", "Tempsc", colorappearance.tempsc); - } - - if (!pedited || pedited->colorappearance.greensc) { - keyFile.set_double ("Color appearance", "Greensc", colorappearance.greensc); - } - - if (!pedited || pedited->colorappearance.ybout) { - keyFile.set_integer ("Color appearance", "Ybout", colorappearance.ybout); - } - + saveToKeyfile(!pedited || pedited->colorappearance.adaplum, "Color appearance", "AdaptLum", colorappearance.adaplum, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.badpixsl, "Color appearance", "Badpixsl", colorappearance.badpixsl, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.wbmodel, "Color appearance", "Model", colorappearance.wbmodel, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.algo, "Color appearance", "Algorithm", colorappearance.algo, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.jlight, "Color appearance", "J-Light", colorappearance.jlight, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.qbright, "Color appearance", "Q-Bright", colorappearance.qbright, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.chroma, "Color appearance", "C-Chroma", colorappearance.chroma, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.schroma, "Color appearance", "S-Chroma", colorappearance.schroma, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.mchroma, "Color appearance", "M-Chroma", colorappearance.mchroma, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.contrast, "Color appearance", "J-Contrast", colorappearance.contrast, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.qcontrast, "Color appearance", "Q-Contrast", colorappearance.qcontrast, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.colorh, "Color appearance", "H-Hue", colorappearance.colorh, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.rstprotection, "Color appearance", "RSTProtection", colorappearance.rstprotection, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.adapscen, "Color appearance", "AdaptScene", colorappearance.adapscen, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.autoadapscen, "Color appearance", "AutoAdapscen", colorappearance.autoadapscen, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.ybscen, "Color appearance", "YbScene", colorappearance.ybscen, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.autoybscen, "Color appearance", "Autoybscen", colorappearance.autoybscen, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.surrsource, "Color appearance", "SurrSource", colorappearance.surrsource, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.gamut, "Color appearance", "Gamut", colorappearance.gamut, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.tempout, "Color appearance", "Tempout", colorappearance.tempout, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.greenout, "Color appearance", "Greenout", colorappearance.greenout, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.tempsc, "Color appearance", "Tempsc", colorappearance.tempsc, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.greensc, "Color appearance", "Greensc", colorappearance.greensc, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.ybout, "Color appearance", "Ybout", colorappearance.ybout, keyFile); // if (!pedited || pedited->colorappearance.badpix) keyFile.set_boolean ("Color appearance", "Badpix", colorappearance.badpix); - if (!pedited || pedited->colorappearance.datacie) { - keyFile.set_boolean ("Color appearance", "Datacie", colorappearance.datacie); - } - - if (!pedited || pedited->colorappearance.tonecie) { - keyFile.set_boolean ("Color appearance", "Tonecie", colorappearance.tonecie); - } - + saveToKeyfile(!pedited || pedited->colorappearance.datacie, "Color appearance", "Datacie", colorappearance.datacie, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.tonecie, "Color appearance", "Tonecie", colorappearance.tonecie, keyFile); // if (!pedited || pedited->colorappearance.sharpcie) keyFile.set_boolean ("Color appearance", "Sharpcie", colorappearance.sharpcie); - if (!pedited || pedited->colorappearance.curveMode) { - Glib::ustring method; - switch (colorappearance.curveMode) { - case (ColorAppearanceParams::TC_MODE_LIGHT): - method = "Lightness"; - break; + const std::map ca_mapping = { + {ColorAppearanceParams::TC_MODE_LIGHT, "Lightness"}, + {ColorAppearanceParams::TC_MODE_BRIGHT, "Brightness"} + }; - case (ColorAppearanceParams::TC_MODE_BRIGHT): - method = "Brightness"; - break; - } + saveToKeyfile(!pedited || pedited->colorappearance.curveMode, "Color appearance", "CurveMode", ca_mapping, colorappearance.curveMode, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.curveMode2, "Color appearance", "CurveMode2", ca_mapping, colorappearance.curveMode2, keyFile); + saveToKeyfile( + !pedited || colorappearance.curveMode3, + "Color appearance", + "CurveMode3", + { + {ColorAppearanceParams::TC_MODE_CHROMA, "Chroma"}, + {ColorAppearanceParams::TC_MODE_SATUR, "Saturation"}, + {ColorAppearanceParams::TC_MODE_COLORF, "Colorfullness"} - keyFile.set_string ("Color appearance", "CurveMode", method); - } - - if (!pedited || pedited->colorappearance.curveMode2) { - Glib::ustring method; - - switch (colorappearance.curveMode2) { - case (ColorAppearanceParams::TC_MODE_LIGHT): - method = "Lightness"; - break; - - case (ColorAppearanceParams::TC_MODE_BRIGHT): - method = "Brightness"; - break; - } - - keyFile.set_string ("Color appearance", "CurveMode2", method); - } - - if (!pedited || pedited->colorappearance.curveMode3) { - Glib::ustring method; - - switch (colorappearance.curveMode3) { - case (ColorAppearanceParams::TC_MODE_CHROMA): - method = "Chroma"; - break; - - case (ColorAppearanceParams::TC_MODE_SATUR): - method = "Saturation"; - break; - - case (ColorAppearanceParams::TC_MODE_COLORF): - method = "Colorfullness"; - break; - - } - - keyFile.set_string ("Color appearance", "CurveMode3", method); - } - - if (!pedited || pedited->colorappearance.curve) { - Glib::ArrayHandle tcurve = colorappearance.curve; - keyFile.set_double_list ("Color appearance", "Curve", tcurve); - } - - if (!pedited || pedited->colorappearance.curve2) { - Glib::ArrayHandle tcurve = colorappearance.curve2; - keyFile.set_double_list ("Color appearance", "Curve2", tcurve); - } - - if (!pedited || pedited->colorappearance.curve3) { - Glib::ArrayHandle tcurve = colorappearance.curve3; - keyFile.set_double_list ("Color appearance", "Curve3", tcurve); - } + }, + colorappearance.curveMode3, + keyFile + ); + saveToKeyfile(!pedited || pedited->colorappearance.curve, "Color appearance", "Curve", colorappearance.curve, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.curve2, "Color appearance", "Curve2", colorappearance.curve2, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.curve3, "Color appearance", "Curve3", colorappearance.curve3, keyFile); // save impulseDenoise - if (!pedited || pedited->impulseDenoise.enabled) { - keyFile.set_boolean ("Impulse Denoising", "Enabled", impulseDenoise.enabled); - } - - if (!pedited || pedited->impulseDenoise.thresh) { - keyFile.set_integer ("Impulse Denoising", "Threshold", impulseDenoise.thresh); - } - + saveToKeyfile(!pedited || pedited->impulseDenoise.enabled, "Impulse Denoising", "Enabled", impulseDenoise.enabled, keyFile); + saveToKeyfile(!pedited || pedited->impulseDenoise.thresh, "Impulse Denoising", "Threshold", impulseDenoise.thresh, keyFile); // save defringe - if (!pedited || pedited->defringe.enabled) { - keyFile.set_boolean ("Defringing", "Enabled", defringe.enabled); - } - - if (!pedited || pedited->defringe.radius) { - keyFile.set_double ("Defringing", "Radius", defringe.radius); - } - - if (!pedited || pedited->defringe.threshold) { - keyFile.set_integer ("Defringing", "Threshold", defringe.threshold); - } - - if (!pedited || pedited->defringe.huecurve) { - Glib::ArrayHandle huecurve = defringe.huecurve; - keyFile.set_double_list ("Defringing", "HueCurve", huecurve); - } - + saveToKeyfile(!pedited || pedited->defringe.enabled, "Defringing", "Enabled", defringe.enabled, keyFile); + saveToKeyfile(!pedited || pedited->defringe.radius, "Defringing", "Radius", defringe.radius, keyFile); + saveToKeyfile(!pedited || pedited->defringe.threshold, "Defringing", "Threshold", defringe.threshold, keyFile); + saveToKeyfile(!pedited || pedited->defringe.huecurve, "Defringing", "HueCurve", defringe.huecurve, keyFile); // save dirpyrDenoise - if (!pedited || pedited->dirpyrDenoise.enabled) { - keyFile.set_boolean ("Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled); - } - - if (!pedited || pedited->dirpyrDenoise.enhance) { - keyFile.set_boolean ("Directional Pyramid Denoising", "Enhance", dirpyrDenoise.enhance); - } - - if (!pedited || pedited->dirpyrDenoise.median) { - keyFile.set_boolean ("Directional Pyramid Denoising", "Median", dirpyrDenoise.median); - } - + saveToKeyfile(!pedited || pedited->dirpyrDenoise.enabled, "Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.enhance, "Directional Pyramid Denoising", "Enhance", dirpyrDenoise.enhance, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.median, "Directional Pyramid Denoising", "Median", dirpyrDenoise.median, keyFile); // if (!pedited || pedited->dirpyrDenoise.perform) keyFile.set_boolean ("Directional Pyramid Denoising", "Perform", dirpyrDenoise.perform); - if (!pedited || pedited->dirpyrDenoise.luma) { - keyFile.set_double ("Directional Pyramid Denoising", "Luma", dirpyrDenoise.luma); - } - - if (!pedited || pedited->dirpyrDenoise.Ldetail) { - keyFile.set_double ("Directional Pyramid Denoising", "Ldetail", dirpyrDenoise.Ldetail); - } - - if (!pedited || pedited->dirpyrDenoise.chroma) { - keyFile.set_double ("Directional Pyramid Denoising", "Chroma", dirpyrDenoise.chroma); - } - - if (!pedited || pedited->dirpyrDenoise.dmethod) { - keyFile.set_string ("Directional Pyramid Denoising", "Method", dirpyrDenoise.dmethod); - } - - if (!pedited || pedited->dirpyrDenoise.Lmethod) { - keyFile.set_string ("Directional Pyramid Denoising", "LMethod", dirpyrDenoise.Lmethod); - } - + saveToKeyfile(!pedited || pedited->dirpyrDenoise.luma, "Directional Pyramid Denoising", "Luma", dirpyrDenoise.luma, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.Ldetail, "Directional Pyramid Denoising", "Ldetail", dirpyrDenoise.Ldetail, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.chroma, "Directional Pyramid Denoising", "Chroma", dirpyrDenoise.chroma, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.dmethod, "Directional Pyramid Denoising", "Method", dirpyrDenoise.dmethod, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.Lmethod, "Directional Pyramid Denoising", "LMethod", dirpyrDenoise.Lmethod, keyFile); // never save 'auto chroma preview mode' to pp3 - if (!pedited || pedited->dirpyrDenoise.Cmethod) { - if (dirpyrDenoise.Cmethod == "PRE") { - dirpyrDenoise.Cmethod = "MAN"; - } - - keyFile.set_string ("Directional Pyramid Denoising", "CMethod", dirpyrDenoise.Cmethod); + if (dirpyrDenoise.Cmethod == "PRE") { + dirpyrDenoise.Cmethod = "MAN"; } + saveToKeyfile(!pedited || pedited->dirpyrDenoise.Cmethod, "Directional Pyramid Denoising", "CMethod", dirpyrDenoise.Cmethod, keyFile); - if (!pedited || pedited->dirpyrDenoise.C2method) { - if (dirpyrDenoise.C2method == "PREV") { - dirpyrDenoise.C2method = "MANU"; - } - - keyFile.set_string ("Directional Pyramid Denoising", "C2Method", dirpyrDenoise.C2method); - } - - if (!pedited || pedited->dirpyrDenoise.smethod) { - keyFile.set_string ("Directional Pyramid Denoising", "SMethod", dirpyrDenoise.smethod); - } - - if (!pedited || pedited->dirpyrDenoise.medmethod) { - keyFile.set_string ("Directional Pyramid Denoising", "MedMethod", dirpyrDenoise.medmethod); - } - - if (!pedited || pedited->dirpyrDenoise.rgbmethod) { - keyFile.set_string ("Directional Pyramid Denoising", "RGBMethod", dirpyrDenoise.rgbmethod); - } - - if (!pedited || pedited->dirpyrDenoise.methodmed) { - keyFile.set_string ("Directional Pyramid Denoising", "MethodMed", dirpyrDenoise.methodmed); - } - - if (!pedited || pedited->dirpyrDenoise.redchro) { - keyFile.set_double ("Directional Pyramid Denoising", "Redchro", dirpyrDenoise.redchro); - } - - if (!pedited || pedited->dirpyrDenoise.bluechro) { - keyFile.set_double ("Directional Pyramid Denoising", "Bluechro", dirpyrDenoise.bluechro); - } - - if (!pedited || pedited->dirpyrDenoise.gamma) { - keyFile.set_double ("Directional Pyramid Denoising", "Gamma", dirpyrDenoise.gamma); - } - - if (!pedited || pedited->dirpyrDenoise.passes) { - keyFile.set_integer ("Directional Pyramid Denoising", "Passes", dirpyrDenoise.passes); - } - - if (!pedited || pedited->dirpyrDenoise.lcurve) { - Glib::ArrayHandle lcurve = dirpyrDenoise.lcurve; - keyFile.set_double_list ("Directional Pyramid Denoising", "LCurve", lcurve); - } - - if (!pedited || pedited->dirpyrDenoise.cccurve) { - Glib::ArrayHandle cccurve = dirpyrDenoise.cccurve; - keyFile.set_double_list ("Directional Pyramid Denoising", "CCCurve", cccurve); + if (dirpyrDenoise.C2method == "PREV") { + dirpyrDenoise.C2method = "MANU"; } + saveToKeyfile(!pedited || pedited->dirpyrDenoise.C2method, "Directional Pyramid Denoising", "C2Method", dirpyrDenoise.C2method, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.smethod, "Directional Pyramid Denoising", "SMethod", dirpyrDenoise.smethod, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.medmethod, "Directional Pyramid Denoising", "MedMethod", dirpyrDenoise.medmethod, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.rgbmethod, "Directional Pyramid Denoising", "RGBMethod", dirpyrDenoise.rgbmethod, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.methodmed, "Directional Pyramid Denoising", "MethodMed", dirpyrDenoise.methodmed, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.redchro, "Directional Pyramid Denoising", "Redchro", dirpyrDenoise.redchro, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.bluechro, "Directional Pyramid Denoising", "Bluechro", dirpyrDenoise.bluechro, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.gamma, "Directional Pyramid Denoising", "Gamma", dirpyrDenoise.gamma, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.passes, "Directional Pyramid Denoising", "Passes", dirpyrDenoise.passes, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.lcurve, "Directional Pyramid Denoising", "LCurve", dirpyrDenoise.lcurve, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrDenoise.cccurve, "Directional Pyramid Denoising", "CCCurve", dirpyrDenoise.cccurve, keyFile); // save epd. - if (!pedited || pedited->epd.enabled) { - keyFile.set_boolean ("EPD", "Enabled", epd.enabled); - } - - if (!pedited || pedited->epd.strength) { - keyFile.set_double ("EPD", "Strength", epd.strength); - } - - if (!pedited || pedited->epd.gamma) { - keyFile.set_double ("EPD", "Gamma", epd.gamma); - } - - if (!pedited || pedited->epd.edgeStopping) { - keyFile.set_double ("EPD", "EdgeStopping", epd.edgeStopping); - } - - if (!pedited || pedited->epd.scale) { - keyFile.set_double ("EPD", "Scale", epd.scale); - } - - if (!pedited || pedited->epd.reweightingIterates) { - keyFile.set_integer ("EPD", "ReweightingIterates", epd.reweightingIterates); - } - + saveToKeyfile(!pedited || pedited->epd.enabled, "EPD", "Enabled", epd.enabled, keyFile); + saveToKeyfile(!pedited || pedited->epd.strength, "EPD", "Strength", epd.strength, keyFile); + saveToKeyfile(!pedited || pedited->epd.gamma, "EPD", "Gamma", epd.gamma, keyFile); + saveToKeyfile(!pedited || pedited->epd.edgeStopping, "EPD", "EdgeStopping", epd.edgeStopping, keyFile); + saveToKeyfile(!pedited || pedited->epd.scale, "EPD", "Scale", epd.scale, keyFile); + saveToKeyfile(!pedited || pedited->epd.reweightingIterates, "EPD", "ReweightingIterates", epd.reweightingIterates, keyFile); // save fattal - if (!pedited || pedited->fattal.enabled) { - keyFile.set_boolean ("FattalToneMapping", "Enabled", fattal.enabled); - } - - if (!pedited || pedited->fattal.threshold) { - keyFile.set_integer ("FattalToneMapping", "Threshold", fattal.threshold); - } - - if (!pedited || pedited->fattal.amount) { - keyFile.set_integer ("FattalToneMapping", "Amount", fattal.amount); - } - + saveToKeyfile(!pedited || pedited->fattal.enabled, "FattalToneMapping", "Enabled", fattal.enabled, keyFile); + saveToKeyfile(!pedited || pedited->fattal.threshold, "FattalToneMapping", "Threshold", fattal.threshold, keyFile); + saveToKeyfile(!pedited || pedited->fattal.amount, "FattalToneMapping", "Amount", fattal.amount, keyFile); /* // save lumaDenoise if (!pedited || pedited->lumaDenoise.enabled) keyFile.set_boolean ("Luminance Denoising", "Enabled", lumaDenoise.enabled); @@ -2471,505 +1983,163 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b */ // save sh - if (!pedited || pedited->sh.enabled) { - keyFile.set_boolean ("Shadows & Highlights", "Enabled", sh.enabled); - } - - if (!pedited || pedited->sh.hq) { - keyFile.set_boolean ("Shadows & Highlights", "HighQuality", sh.hq); - } - - if (!pedited || pedited->sh.highlights) { - keyFile.set_integer ("Shadows & Highlights", "Highlights", sh.highlights); - } - - if (!pedited || pedited->sh.htonalwidth) { - keyFile.set_integer ("Shadows & Highlights", "HighlightTonalWidth", sh.htonalwidth); - } - - if (!pedited || pedited->sh.shadows) { - keyFile.set_integer ("Shadows & Highlights", "Shadows", sh.shadows); - } - - if (!pedited || pedited->sh.stonalwidth) { - keyFile.set_integer ("Shadows & Highlights", "ShadowTonalWidth", sh.stonalwidth); - } - - if (!pedited || pedited->sh.localcontrast) { - keyFile.set_integer ("Shadows & Highlights", "LocalContrast", sh.localcontrast); - } - - if (!pedited || pedited->sh.radius) { - keyFile.set_integer ("Shadows & Highlights", "Radius", sh.radius); - } - + saveToKeyfile(!pedited || pedited->sh.enabled, "Shadows & Highlights", "Enabled", sh.enabled, keyFile); + saveToKeyfile(!pedited || pedited->sh.hq, "Shadows & Highlights", "HighQuality", sh.hq, keyFile); + saveToKeyfile(!pedited || pedited->sh.highlights, "Shadows & Highlights", "Highlights", sh.highlights, keyFile); + saveToKeyfile(!pedited || pedited->sh.htonalwidth, "Shadows & Highlights", "HighlightTonalWidth", sh.htonalwidth, keyFile); + saveToKeyfile(!pedited || pedited->sh.shadows, "Shadows & Highlights", "Shadows", sh.shadows, keyFile); + saveToKeyfile(!pedited || pedited->sh.stonalwidth, "Shadows & Highlights", "ShadowTonalWidth", sh.stonalwidth, keyFile); + saveToKeyfile(!pedited || pedited->sh.localcontrast, "Shadows & Highlights", "LocalContrast", sh.localcontrast, keyFile); + saveToKeyfile(!pedited || pedited->sh.radius, "Shadows & Highlights", "Radius", sh.radius, keyFile); // save crop - if (!pedited || pedited->crop.enabled) { - keyFile.set_boolean ("Crop", "Enabled", crop.enabled); - } - - if (!pedited || pedited->crop.x) { - keyFile.set_integer ("Crop", "X", crop.x); - } - - if (!pedited || pedited->crop.y) { - keyFile.set_integer ("Crop", "Y", crop.y); - } - - if (!pedited || pedited->crop.w) { - keyFile.set_integer ("Crop", "W", crop.w); - } - - if (!pedited || pedited->crop.h) { - keyFile.set_integer ("Crop", "H", crop.h); - } - - if (!pedited || pedited->crop.fixratio) { - keyFile.set_boolean ("Crop", "FixedRatio", crop.fixratio); - } - - if (!pedited || pedited->crop.ratio) { - keyFile.set_string ("Crop", "Ratio", crop.ratio); - } - - if (!pedited || pedited->crop.orientation) { - keyFile.set_string ("Crop", "Orientation", crop.orientation); - } - - if (!pedited || pedited->crop.guide) { - keyFile.set_string ("Crop", "Guide", crop.guide); - } - + saveToKeyfile(!pedited || pedited->crop.enabled, "Crop", "Enabled", crop.enabled, keyFile); + saveToKeyfile(!pedited || pedited->crop.x, "Crop", "X", crop.x, keyFile); + saveToKeyfile(!pedited || pedited->crop.y, "Crop", "Y", crop.y, keyFile); + saveToKeyfile(!pedited || pedited->crop.w, "Crop", "W", crop.w, keyFile); + saveToKeyfile(!pedited || pedited->crop.h, "Crop", "H", crop.h, keyFile); + saveToKeyfile(!pedited || pedited->crop.fixratio, "Crop", "FixedRatio", crop.fixratio, keyFile); + saveToKeyfile(!pedited || pedited->crop.ratio, "Crop", "Ratio", crop.ratio, keyFile); + saveToKeyfile(!pedited || pedited->crop.orientation, "Crop", "Orientation", crop.orientation, keyFile); + saveToKeyfile(!pedited || pedited->crop.guide, "Crop", "Guide", crop.guide, keyFile); // save coarse - if (!pedited || pedited->coarse.rotate) { - keyFile.set_integer ("Coarse Transformation", "Rotate", coarse.rotate); - } - - if (!pedited || pedited->coarse.hflip) { - keyFile.set_boolean ("Coarse Transformation", "HorizontalFlip", coarse.hflip); - } - - if (!pedited || pedited->coarse.vflip) { - keyFile.set_boolean ("Coarse Transformation", "VerticalFlip", coarse.vflip); - } - + saveToKeyfile(!pedited || pedited->coarse.rotate, "Coarse Transformation", "Rotate", coarse.rotate, keyFile); + saveToKeyfile(!pedited || pedited->coarse.hflip, "Coarse Transformation", "HorizontalFlip", coarse.hflip, keyFile); + saveToKeyfile(!pedited || pedited->coarse.vflip, "Coarse Transformation", "VerticalFlip", coarse.vflip, keyFile); // save commonTrans - if (!pedited || pedited->commonTrans.autofill) { - keyFile.set_boolean ("Common Properties for Transformations", "AutoFill", commonTrans.autofill); - } - + saveToKeyfile(!pedited || pedited->commonTrans.autofill, "Common Properties for Transformations", "AutoFill", commonTrans.autofill, keyFile); // save rotate - if (!pedited || pedited->rotate.degree) { - keyFile.set_double ("Rotation", "Degree", rotate.degree); - } - + saveToKeyfile(!pedited || pedited->rotate.degree, "Rotation", "Degree", rotate.degree, keyFile); // save distortion - if (!pedited || pedited->distortion.amount) { - keyFile.set_double ("Distortion", "Amount", distortion.amount); - } - + saveToKeyfile(!pedited || pedited->distortion.amount, "Distortion", "Amount", distortion.amount, keyFile); // lens profile - if (!pedited || pedited->lensProf.lcMode) { - keyFile.set_string ("LensProfile", "LcMode", lensProf.getMethodString (lensProf.lcMode)); - } - - if (!pedited || pedited->lensProf.lcpFile) { - keyFile.set_string ("LensProfile", "LCPFile", relativePathIfInside (fname, fnameAbsolute, lensProf.lcpFile)); - } - - if (!pedited || pedited->lensProf.useDist) { - keyFile.set_boolean ("LensProfile", "UseDistortion", lensProf.useDist); - } - - if (!pedited || pedited->lensProf.useVign) { - keyFile.set_boolean ("LensProfile", "UseVignette", lensProf.useVign); - } - - if (!pedited || pedited->lensProf.useCA) { - keyFile.set_boolean ("LensProfile", "UseCA", lensProf.useCA); - } - - if (!pedited || pedited->lensProf.lfCameraMake) { - keyFile.set_string("LensProfile", "LFCameraMake", lensProf.lfCameraMake); - } - if (!pedited || pedited->lensProf.lfCameraModel) { - keyFile.set_string("LensProfile", "LFCameraModel", lensProf.lfCameraModel); - } - if (!pedited || pedited->lensProf.lfLens) { - keyFile.set_string("LensProfile", "LFLens", lensProf.lfLens); - } - + saveToKeyfile(!pedited || pedited->lensProf.lcMode, "LensProfile", "LcMode", lensProf.getMethodString (lensProf.lcMode), keyFile); + saveToKeyfile(!pedited || pedited->lensProf.lcpFile, "LensProfile", "LCPFile", relativePathIfInside (fname, fnameAbsolute, lensProf.lcpFile), keyFile); + saveToKeyfile(!pedited || pedited->lensProf.useDist, "LensProfile", "UseDistortion", lensProf.useDist, keyFile); + saveToKeyfile(!pedited || pedited->lensProf.useVign, "LensProfile", "UseVignette", lensProf.useVign, keyFile); + saveToKeyfile(!pedited || pedited->lensProf.useCA, "LensProfile", "UseCA", lensProf.useCA, keyFile); + saveToKeyfile(!pedited || pedited->lensProf.lfCameraMake, "LensProfile", "LFCameraMake", lensProf.lfCameraMake, keyFile); + saveToKeyfile(!pedited || pedited->lensProf.lfCameraModel, "LensProfile", "LFCameraModel", lensProf.lfCameraModel, keyFile); + saveToKeyfile(!pedited || pedited->lensProf.lfLens, "LensProfile", "LFLens", lensProf.lfLens, keyFile); // save perspective correction - if (!pedited || pedited->perspective.horizontal) { - keyFile.set_double ("Perspective", "Horizontal", perspective.horizontal); - } - - if (!pedited || pedited->perspective.vertical) { - keyFile.set_double ("Perspective", "Vertical", perspective.vertical); - } - + saveToKeyfile(!pedited || pedited->perspective.horizontal, "Perspective", "Horizontal", perspective.horizontal, keyFile); + saveToKeyfile(!pedited || pedited->perspective.vertical, "Perspective", "Vertical", perspective.vertical, keyFile); // save gradient - if (!pedited || pedited->gradient.enabled) { - keyFile.set_boolean ("Gradient", "Enabled", gradient.enabled); - } - - if (!pedited || pedited->gradient.degree) { - keyFile.set_double ("Gradient", "Degree", gradient.degree); - } - - if (!pedited || pedited->gradient.feather) { - keyFile.set_integer ("Gradient", "Feather", gradient.feather); - } - - if (!pedited || pedited->gradient.strength) { - keyFile.set_double ("Gradient", "Strength", gradient.strength); - } - - if (!pedited || pedited->gradient.centerX) { - keyFile.set_integer ("Gradient", "CenterX", gradient.centerX); - } - - if (!pedited || pedited->gradient.centerY) { - keyFile.set_integer ("Gradient", "CenterY", gradient.centerY); - } - + saveToKeyfile(!pedited || pedited->gradient.enabled, "Gradient", "Enabled", gradient.enabled, keyFile); + saveToKeyfile(!pedited || pedited->gradient.degree, "Gradient", "Degree", gradient.degree, keyFile); + saveToKeyfile(!pedited || pedited->gradient.feather, "Gradient", "Feather", gradient.feather, keyFile); + saveToKeyfile(!pedited || pedited->gradient.strength, "Gradient", "Strength", gradient.strength, keyFile); + saveToKeyfile(!pedited || pedited->gradient.centerX, "Gradient", "CenterX", gradient.centerX, keyFile); + saveToKeyfile(!pedited || pedited->gradient.centerY, "Gradient", "CenterY", gradient.centerY, keyFile); // save post-crop vignette - if (!pedited || pedited->pcvignette.enabled) { - keyFile.set_boolean ("PCVignette", "Enabled", pcvignette.enabled); - } - - if (!pedited || pedited->pcvignette.strength) { - keyFile.set_double ("PCVignette", "Strength", pcvignette.strength); - } - - if (!pedited || pedited->pcvignette.feather) { - keyFile.set_integer ("PCVignette", "Feather", pcvignette.feather); - } - - if (!pedited || pedited->pcvignette.roundness) { - keyFile.set_integer ("PCVignette", "Roundness", pcvignette.roundness); - } - + saveToKeyfile(!pedited || pedited->pcvignette.enabled, "PCVignette", "Enabled", pcvignette.enabled, keyFile); + saveToKeyfile(!pedited || pedited->pcvignette.strength, "PCVignette", "Strength", pcvignette.strength, keyFile); + saveToKeyfile(!pedited || pedited->pcvignette.feather, "PCVignette", "Feather", pcvignette.feather, keyFile); + saveToKeyfile(!pedited || pedited->pcvignette.roundness, "PCVignette", "Roundness", pcvignette.roundness, keyFile); // save C/A correction - if (!pedited || pedited->cacorrection.red) { - keyFile.set_double ("CACorrection", "Red", cacorrection.red); - } - - if (!pedited || pedited->cacorrection.blue) { - keyFile.set_double ("CACorrection", "Blue", cacorrection.blue); - } - + saveToKeyfile(!pedited || pedited->cacorrection.red, "CACorrection", "Red", cacorrection.red, keyFile); + saveToKeyfile(!pedited || pedited->cacorrection.blue, "CACorrection", "Blue", cacorrection.blue, keyFile); // save vignetting correction - if (!pedited || pedited->vignetting.amount) { - keyFile.set_integer ("Vignetting Correction", "Amount", vignetting.amount); - } - - if (!pedited || pedited->vignetting.radius) { - keyFile.set_integer ("Vignetting Correction", "Radius", vignetting.radius); - } - - if (!pedited || pedited->vignetting.strength) { - keyFile.set_integer ("Vignetting Correction", "Strength", vignetting.strength); - } - - if (!pedited || pedited->vignetting.centerX) { - keyFile.set_integer ("Vignetting Correction", "CenterX", vignetting.centerX); - } - - if (!pedited || pedited->vignetting.centerY) { - keyFile.set_integer ("Vignetting Correction", "CenterY", vignetting.centerY); - } - - - if (!pedited || pedited->resize.enabled) { - keyFile.set_boolean ("Resize", "Enabled", resize.enabled); - } - - if (!pedited || pedited->resize.scale) { - keyFile.set_double ("Resize", "Scale", resize.scale); - } - - if (!pedited || pedited->resize.appliesTo) { - keyFile.set_string ("Resize", "AppliesTo", resize.appliesTo); - } - - if (!pedited || pedited->resize.method) { - keyFile.set_string ("Resize", "Method", resize.method); - } - - if (!pedited || pedited->resize.dataspec) { - keyFile.set_integer ("Resize", "DataSpecified", resize.dataspec); - } - - if (!pedited || pedited->resize.width) { - keyFile.set_integer ("Resize", "Width", resize.width); - } - - if (!pedited || pedited->resize.height) { - keyFile.set_integer ("Resize", "Height", resize.height); - } - - if (!pedited || pedited->prsharpening.enabled) { - keyFile.set_boolean ("PostResizeSharpening", "Enabled", prsharpening.enabled); - } - - if (!pedited || pedited->prsharpening.method) { - keyFile.set_string ("PostResizeSharpening", "Method", prsharpening.method); - } - - if (!pedited || pedited->prsharpening.radius) { - keyFile.set_double ("PostResizeSharpening", "Radius", prsharpening.radius); - } - - if (!pedited || pedited->prsharpening.amount) { - keyFile.set_integer ("PostResizeSharpening", "Amount", prsharpening.amount); - } + saveToKeyfile(!pedited || pedited->vignetting.amount, "Vignetting Correction", "Amount", vignetting.amount, keyFile); + saveToKeyfile(!pedited || pedited->vignetting.radius, "Vignetting Correction", "Radius", vignetting.radius, keyFile); + saveToKeyfile(!pedited || pedited->vignetting.strength, "Vignetting Correction", "Strength", vignetting.strength, keyFile); + saveToKeyfile(!pedited || pedited->vignetting.centerX, "Vignetting Correction", "CenterX", vignetting.centerX, keyFile); + saveToKeyfile(!pedited || pedited->vignetting.centerY, "Vignetting Correction", "CenterY", vignetting.centerY, keyFile); + saveToKeyfile(!pedited || pedited->resize.enabled, "Resize", "Enabled", resize.enabled, keyFile); + saveToKeyfile(!pedited || pedited->resize.scale, "Resize", "Scale", resize.scale, keyFile); + saveToKeyfile(!pedited || pedited->resize.appliesTo, "Resize", "AppliesTo", resize.appliesTo, keyFile); + saveToKeyfile(!pedited || pedited->resize.method, "Resize", "Method", resize.method, keyFile); + saveToKeyfile(!pedited || pedited->resize.dataspec, "Resize", "DataSpecified", resize.dataspec, keyFile); + saveToKeyfile(!pedited || pedited->resize.width, "Resize", "Width", resize.width, keyFile); + saveToKeyfile(!pedited || pedited->resize.height, "Resize", "Height", resize.height, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.enabled, "PostResizeSharpening", "Enabled", prsharpening.enabled, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.method, "PostResizeSharpening", "Method", prsharpening.method, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.radius, "PostResizeSharpening", "Radius", prsharpening.radius, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.amount, "PostResizeSharpening", "Amount", prsharpening.amount, keyFile); if (!pedited || pedited->prsharpening.threshold) { Glib::ArrayHandle thresh (prsharpening.threshold.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("PostResizeSharpening", "Threshold", thresh); } - if (!pedited || pedited->prsharpening.edgesonly) { - keyFile.set_boolean ("PostResizeSharpening", "OnlyEdges", prsharpening.edgesonly); - } - - if (!pedited || pedited->prsharpening.edges_radius) { - keyFile.set_double ("PostResizeSharpening", "EdgedetectionRadius", prsharpening.edges_radius); - } - - if (!pedited || pedited->prsharpening.edges_tolerance) { - keyFile.set_integer ("PostResizeSharpening", "EdgeTolerance", prsharpening.edges_tolerance); - } - - if (!pedited || pedited->prsharpening.halocontrol) { - keyFile.set_boolean ("PostResizeSharpening", "HalocontrolEnabled", prsharpening.halocontrol); - } - - if (!pedited || pedited->prsharpening.halocontrol_amount) { - keyFile.set_integer ("PostResizeSharpening", "HalocontrolAmount", prsharpening.halocontrol_amount); - } - - if (!pedited || pedited->prsharpening.deconvradius) { - keyFile.set_double ("PostResizeSharpening", "DeconvRadius", prsharpening.deconvradius); - } - - if (!pedited || pedited->prsharpening.deconvamount) { - keyFile.set_integer ("PostResizeSharpening", "DeconvAmount", prsharpening.deconvamount); - } - - if (!pedited || pedited->prsharpening.deconvdamping) { - keyFile.set_integer ("PostResizeSharpening", "DeconvDamping", prsharpening.deconvdamping); - } - - if (!pedited || pedited->prsharpening.deconviter) { - keyFile.set_integer ("PostResizeSharpening", "DeconvIterations", prsharpening.deconviter); - } - + saveToKeyfile(!pedited || pedited->prsharpening.edgesonly, "PostResizeSharpening", "OnlyEdges", prsharpening.edgesonly, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.edges_radius, "PostResizeSharpening", "EdgedetectionRadius", prsharpening.edges_radius, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.edges_tolerance, "PostResizeSharpening", "EdgeTolerance", prsharpening.edges_tolerance, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.halocontrol, "PostResizeSharpening", "HalocontrolEnabled", prsharpening.halocontrol, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.halocontrol_amount, "PostResizeSharpening", "HalocontrolAmount", prsharpening.halocontrol_amount, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.deconvradius, "PostResizeSharpening", "DeconvRadius", prsharpening.deconvradius, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.deconvamount, "PostResizeSharpening", "DeconvAmount", prsharpening.deconvamount, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.deconvdamping, "PostResizeSharpening", "DeconvDamping", prsharpening.deconvdamping, keyFile); + saveToKeyfile(!pedited || pedited->prsharpening.deconviter, "PostResizeSharpening", "DeconvIterations", prsharpening.deconviter, keyFile); // save color management settings - if (!pedited || pedited->icm.input) { - keyFile.set_string ("Color Management", "InputProfile", relativePathIfInside (fname, fnameAbsolute, icm.input)); - } - - if (!pedited || pedited->icm.toneCurve) { - keyFile.set_boolean ("Color Management", "ToneCurve", icm.toneCurve); - } - - if (!pedited || pedited->icm.applyLookTable) { - keyFile.set_boolean ("Color Management", "ApplyLookTable", icm.applyLookTable); - } - - if (!pedited || pedited->icm.applyBaselineExposureOffset) { - keyFile.set_boolean ("Color Management", "ApplyBaselineExposureOffset", icm.applyBaselineExposureOffset); - } - - if (!pedited || pedited->icm.applyHueSatMap) { - keyFile.set_boolean ("Color Management", "ApplyHueSatMap", icm.applyHueSatMap); - } - - if (!pedited || pedited->icm.dcpIlluminant) { - keyFile.set_integer ("Color Management", "DCPIlluminant", icm.dcpIlluminant); - } - - if (!pedited || pedited->icm.working) { - keyFile.set_string ("Color Management", "WorkingProfile", icm.working); - } - - if (!pedited || pedited->icm.output) { - keyFile.set_string ("Color Management", "OutputProfile", icm.output); - } - - if (!pedited || pedited->icm.outputIntent) { - Glib::ustring intent; - - switch (icm.outputIntent) { - default: - case RI_PERCEPTUAL: - intent = "Perceptual"; - break; - - case RI_RELATIVE: - intent = "Relative"; - break; - - case RI_SATURATION: - intent = "Saturation"; - break; - - case RI_ABSOLUTE: - intent = "Absolute"; - break; - } - - keyFile.set_string ("Color Management", "OutputProfileIntent", intent); - } - - if (!pedited || pedited->icm.outputBPC) { - keyFile.set_boolean ("Color Management", "OutputBPC", icm.outputBPC); - } - - if (!pedited || pedited->icm.gamma) { - keyFile.set_string ("Color Management", "Gammafree", icm.gamma); - } - - if (!pedited || pedited->icm.freegamma) { - keyFile.set_boolean ("Color Management", "Freegamma", icm.freegamma); - } - - if (!pedited || pedited->icm.gampos) { - keyFile.set_double ("Color Management", "GammaValue", icm.gampos); - } - - if (!pedited || pedited->icm.slpos) { - keyFile.set_double ("Color Management", "GammaSlope", icm.slpos); - } + saveToKeyfile(!pedited || pedited->icm.input, "Color Management", "InputProfile", relativePathIfInside (fname, fnameAbsolute, icm.input), keyFile); + saveToKeyfile(!pedited || pedited->icm.toneCurve, "Color Management", "ToneCurve", icm.toneCurve, keyFile); + saveToKeyfile(!pedited || pedited->icm.applyLookTable, "Color Management", "ApplyLookTable", icm.applyLookTable, keyFile); + saveToKeyfile(!pedited || pedited->icm.applyBaselineExposureOffset, "Color Management", "ApplyBaselineExposureOffset", icm.applyBaselineExposureOffset, keyFile); + saveToKeyfile(!pedited || pedited->icm.applyHueSatMap, "Color Management", "ApplyHueSatMap", icm.applyHueSatMap, keyFile); + saveToKeyfile(!pedited || pedited->icm.dcpIlluminant, "Color Management", "DCPIlluminant", icm.dcpIlluminant, keyFile); + saveToKeyfile(!pedited || pedited->icm.working, "Color Management", "WorkingProfile", icm.working, keyFile); + saveToKeyfile(!pedited || pedited->icm.output, "Color Management", "OutputProfile", icm.output, keyFile); + saveToKeyfile( + !pedited || icm.outputIntent, + "Color Management", + "OutputProfileIntent", + { + {RI_PERCEPTUAL, "Perceptual"}, + {RI_RELATIVE, "Relative"}, + {RI_SATURATION, "Saturation"}, + {RI_ABSOLUTE, "Absolute"} + }, + icm.outputIntent, + keyFile + ); + saveToKeyfile(!pedited || pedited->icm.outputBPC, "Color Management", "OutputBPC", icm.outputBPC, keyFile); + saveToKeyfile(!pedited || pedited->icm.gamma, "Color Management", "Gammafree", icm.gamma, keyFile); + saveToKeyfile(!pedited || pedited->icm.freegamma, "Color Management", "Freegamma", icm.freegamma, keyFile); + saveToKeyfile(!pedited || pedited->icm.gampos, "Color Management", "GammaValue", icm.gampos, keyFile); + saveToKeyfile(!pedited || pedited->icm.slpos, "Color Management", "GammaSlope", icm.slpos, keyFile); // save wavelet parameters - if (!pedited || pedited->wavelet.enabled) { - keyFile.set_boolean ("Wavelet", "Enabled", wavelet.enabled); - } - - if (!pedited || pedited->wavelet.strength) { - keyFile.set_integer ("Wavelet", "Strength", wavelet.strength); - } - - if (!pedited || pedited->wavelet.balance) { - keyFile.set_integer ("Wavelet", "Balance", wavelet.balance); - } - - if (!pedited || pedited->wavelet.iter) { - keyFile.set_integer ("Wavelet", "Iter", wavelet.iter); - } - - if (!pedited || pedited->wavelet.thres) { - keyFile.set_integer ("Wavelet", "MaxLev", wavelet.thres); - } - - if (!pedited || pedited->wavelet.Tilesmethod) { - keyFile.set_string ("Wavelet", "TilesMethod", wavelet.Tilesmethod); - } - - if (!pedited || pedited->wavelet.daubcoeffmethod) { - keyFile.set_string ("Wavelet", "DaubMethod", wavelet.daubcoeffmethod); - } - - if (!pedited || pedited->wavelet.CLmethod) { - keyFile.set_string ("Wavelet", "ChoiceLevMethod", wavelet.CLmethod); - } - - if (!pedited || pedited->wavelet.Backmethod) { - keyFile.set_string ("Wavelet", "BackMethod", wavelet.Backmethod); - } - - if (!pedited || pedited->wavelet.Lmethod) { - keyFile.set_string ("Wavelet", "LevMethod", wavelet.Lmethod); - } - - if (!pedited || pedited->wavelet.Dirmethod) { - keyFile.set_string ("Wavelet", "DirMethod", wavelet.Dirmethod); - } - - if (!pedited || pedited->wavelet.greenhigh) { - keyFile.set_integer ("Wavelet", "CBgreenhigh", wavelet.greenhigh); - } - - if (!pedited || pedited->wavelet.greenmed) { - keyFile.set_integer ("Wavelet", "CBgreenmed", wavelet.greenmed); - } - - if (!pedited || pedited->wavelet.greenlow) { - keyFile.set_integer ("Wavelet", "CBgreenlow", wavelet.greenlow); - } - - if (!pedited || pedited->wavelet.bluehigh) { - keyFile.set_integer ("Wavelet", "CBbluehigh", wavelet.bluehigh); - } - - if (!pedited || pedited->wavelet.bluemed) { - keyFile.set_integer ("Wavelet", "CBbluemed", wavelet.bluemed); - } - - if (!pedited || pedited->wavelet.bluelow) { - keyFile.set_integer ("Wavelet", "CBbluelow", wavelet.bluelow); - } - - if (!pedited || pedited->wavelet.expcontrast) { - keyFile.set_boolean ("Wavelet", "Expcontrast", wavelet.expcontrast); - } - - if (!pedited || pedited->wavelet.expchroma) { - keyFile.set_boolean ("Wavelet", "Expchroma", wavelet.expchroma); - } - - if (!pedited || pedited->wavelet.expedge) { - keyFile.set_boolean ("Wavelet", "Expedge", wavelet.expedge); - } - - if (!pedited || pedited->wavelet.expresid) { - keyFile.set_boolean ("Wavelet", "Expresid", wavelet.expresid); - } - - if (!pedited || pedited->wavelet.expfinal) { - keyFile.set_boolean ("Wavelet", "Expfinal", wavelet.expfinal); - } - - if (!pedited || pedited->wavelet.exptoning) { - keyFile.set_boolean ("Wavelet", "Exptoning", wavelet.exptoning); - } - - if (!pedited || pedited->wavelet.expnoise) { - keyFile.set_boolean ("Wavelet", "Expnoise", wavelet.expnoise); - } - + saveToKeyfile(!pedited || pedited->wavelet.enabled, "Wavelet", "Enabled", wavelet.enabled, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.strength, "Wavelet", "Strength", wavelet.strength, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.balance, "Wavelet", "Balance", wavelet.balance, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.iter, "Wavelet", "Iter", wavelet.iter, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.thres, "Wavelet", "MaxLev", wavelet.thres, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.Tilesmethod, "Wavelet", "TilesMethod", wavelet.Tilesmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.daubcoeffmethod, "Wavelet", "DaubMethod", wavelet.daubcoeffmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.CLmethod, "Wavelet", "ChoiceLevMethod", wavelet.CLmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.Backmethod, "Wavelet", "BackMethod", wavelet.Backmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.Lmethod, "Wavelet", "LevMethod", wavelet.Lmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.Dirmethod, "Wavelet", "DirMethod", wavelet.Dirmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.greenhigh, "Wavelet", "CBgreenhigh", wavelet.greenhigh, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.greenmed, "Wavelet", "CBgreenmed", wavelet.greenmed, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.greenlow, "Wavelet", "CBgreenlow", wavelet.greenlow, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.bluehigh, "Wavelet", "CBbluehigh", wavelet.bluehigh, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.bluemed, "Wavelet", "CBbluemed", wavelet.bluemed, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.bluelow, "Wavelet", "CBbluelow", wavelet.bluelow, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.expcontrast, "Wavelet", "Expcontrast", wavelet.expcontrast, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.expchroma, "Wavelet", "Expchroma", wavelet.expchroma, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.expedge, "Wavelet", "Expedge", wavelet.expedge, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.expresid, "Wavelet", "Expresid", wavelet.expresid, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.expfinal, "Wavelet", "Expfinal", wavelet.expfinal, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.exptoning, "Wavelet", "Exptoning", wavelet.exptoning, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.expnoise, "Wavelet", "Expnoise", wavelet.expnoise, keyFile); for (int i = 0; i < 9; i++) { std::stringstream ss; ss << "Contrast" << (i + 1); - if (!pedited || pedited->wavelet.c[i]) { - keyFile.set_integer ("Wavelet", ss.str(), wavelet.c[i]); - } - } + saveToKeyfile(!pedited || pedited->wavelet.c[i], "Wavelet", ss.str(), wavelet.c[i], keyFile); } for (int i = 0; i < 9; i++) { std::stringstream ss; ss << "Chroma" << (i + 1); - if (!pedited || pedited->wavelet.ch[i]) { - keyFile.set_integer ("Wavelet", ss.str(), wavelet.ch[i]); - } - } - - if (!pedited || pedited->wavelet.sup) { - keyFile.set_integer ("Wavelet", "ContExtra", wavelet.sup); - } - - if (!pedited || pedited->wavelet.HSmethod) { - keyFile.set_string ("Wavelet", "HSMethod", wavelet.HSmethod); - } + saveToKeyfile(!pedited || pedited->wavelet.ch[i], "Wavelet", ss.str(), wavelet.ch[i], keyFile); } + saveToKeyfile(!pedited || pedited->wavelet.sup, "Wavelet", "ContExtra", wavelet.sup, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.HSmethod, "Wavelet", "HSMethod", wavelet.HSmethod, keyFile); if (!pedited || pedited->wavelet.hllev) { Glib::ArrayHandle thresh (wavelet.hllev.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "HLRange", thresh); @@ -3005,76 +2175,23 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_double_list ("Wavelet", "Level3noise", thresh); } - - if (!pedited || pedited->wavelet.threshold) { - keyFile.set_integer ("Wavelet", "ThresholdHighlight", wavelet.threshold); - } - - if (!pedited || pedited->wavelet.threshold2) { - keyFile.set_integer ("Wavelet", "ThresholdShadow", wavelet.threshold2); - } - - if (!pedited || pedited->wavelet.edgedetect) { - keyFile.set_integer ("Wavelet", "Edgedetect", wavelet.edgedetect); - } - - if (!pedited || pedited->wavelet.edgedetectthr) { - keyFile.set_integer ("Wavelet", "Edgedetectthr", wavelet.edgedetectthr); - } - - if (!pedited || pedited->wavelet.edgedetectthr2) { - keyFile.set_integer ("Wavelet", "EdgedetectthrHi", wavelet.edgedetectthr2); - } - - if (!pedited || pedited->wavelet.edgesensi) { - keyFile.set_integer ("Wavelet", "Edgesensi", wavelet.edgesensi); - } - - if (!pedited || pedited->wavelet.edgeampli) { - keyFile.set_integer ("Wavelet", "Edgeampli", wavelet.edgeampli); - } - - if (!pedited || pedited->wavelet.chroma) { - keyFile.set_integer ("Wavelet", "ThresholdChroma", wavelet.chroma); - } - - if (!pedited || pedited->wavelet.CHmethod) { - keyFile.set_string ("Wavelet", "CHromaMethod", wavelet.CHmethod); - } - - if (!pedited || pedited->wavelet.Medgreinf) { - keyFile.set_string ("Wavelet", "Medgreinf", wavelet.Medgreinf); - } - - if (!pedited || pedited->wavelet.CHSLmethod) { - keyFile.set_string ("Wavelet", "CHSLromaMethod", wavelet.CHSLmethod); - } - - if (!pedited || pedited->wavelet.EDmethod) { - keyFile.set_string ("Wavelet", "EDMethod", wavelet.EDmethod); - } - - if (!pedited || pedited->wavelet.NPmethod) { - keyFile.set_string ("Wavelet", "NPMethod", wavelet.NPmethod); - } - - if (!pedited || pedited->wavelet.BAmethod) { - keyFile.set_string ("Wavelet", "BAMethod", wavelet.BAmethod); - } - - if (!pedited || pedited->wavelet.TMmethod) { - keyFile.set_string ("Wavelet", "TMMethod", wavelet.TMmethod); - } - - if (!pedited || pedited->wavelet.chro) { - keyFile.set_integer ("Wavelet", "ChromaLink", wavelet.chro); - } - - if (!pedited || pedited->wavelet.ccwcurve) { - Glib::ArrayHandle ccwcurve = wavelet.ccwcurve; - keyFile.set_double_list ("Wavelet", "ContrastCurve", ccwcurve); - } - + saveToKeyfile(!pedited || pedited->wavelet.threshold, "Wavelet", "ThresholdHighlight", wavelet.threshold, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.threshold2, "Wavelet", "ThresholdShadow", wavelet.threshold2, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgedetect, "Wavelet", "Edgedetect", wavelet.edgedetect, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgedetectthr, "Wavelet", "Edgedetectthr", wavelet.edgedetectthr, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgedetectthr2, "Wavelet", "EdgedetectthrHi", wavelet.edgedetectthr2, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgesensi, "Wavelet", "Edgesensi", wavelet.edgesensi, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgeampli, "Wavelet", "Edgeampli", wavelet.edgeampli, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.chroma, "Wavelet", "ThresholdChroma", wavelet.chroma, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.CHmethod, "Wavelet", "CHromaMethod", wavelet.CHmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.Medgreinf, "Wavelet", "Medgreinf", wavelet.Medgreinf, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.CHSLmethod, "Wavelet", "CHSLromaMethod", wavelet.CHSLmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.EDmethod, "Wavelet", "EDMethod", wavelet.EDmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.NPmethod, "Wavelet", "NPMethod", wavelet.NPmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.BAmethod, "Wavelet", "BAMethod", wavelet.BAmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.TMmethod, "Wavelet", "TMMethod", wavelet.TMmethod, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.chro, "Wavelet", "ChromaLink", wavelet.chro, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.ccwcurve, "Wavelet", "ContrastCurve", wavelet.ccwcurve, keyFile); if (!pedited || pedited->wavelet.pastlev) { Glib::ArrayHandle thresh (wavelet.pastlev.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "Pastlev", thresh); @@ -3085,167 +2202,61 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_integer_list ("Wavelet", "Satlev", thresh); } - if (!pedited || pedited->wavelet.opacityCurveRG) { - Glib::ArrayHandle curve = wavelet.opacityCurveRG; - keyFile.set_double_list ("Wavelet", "OpacityCurveRG", curve); - } - - if (!pedited || pedited->wavelet.opacityCurveBY) { - Glib::ArrayHandle curve = wavelet.opacityCurveBY; - keyFile.set_double_list ("Wavelet", "OpacityCurveBY", curve); - } - - if (!pedited || pedited->wavelet.opacityCurveW) { - Glib::ArrayHandle curve = wavelet.opacityCurveW; - keyFile.set_double_list ("Wavelet", "OpacityCurveW", curve); - } - - if (!pedited || pedited->wavelet.opacityCurveWL) { - Glib::ArrayHandle curve = wavelet.opacityCurveWL; - keyFile.set_double_list ("Wavelet", "OpacityCurveWL", curve); - } - - if (!pedited || pedited->wavelet.hhcurve) { - Glib::ArrayHandle curve = wavelet.hhcurve; - keyFile.set_double_list ("Wavelet", "HHcurve", curve); - } - - if (!pedited || pedited->wavelet.Chcurve) { - Glib::ArrayHandle curve = wavelet.Chcurve; - keyFile.set_double_list ("Wavelet", "CHcurve", curve); - } - - if (!pedited || pedited->wavelet.wavclCurve) { - Glib::ArrayHandle wavclCurve = wavelet.wavclCurve; - keyFile.set_double_list ("Wavelet", "WavclCurve", wavclCurve); - } - - - if (!pedited || pedited->wavelet.median) { - keyFile.set_boolean ("Wavelet", "Median", wavelet.median); - } - - if (!pedited || pedited->wavelet.medianlev) { - keyFile.set_boolean ("Wavelet", "Medianlev", wavelet.medianlev); - } - - if (!pedited || pedited->wavelet.linkedg) { - keyFile.set_boolean ("Wavelet", "Linkedg", wavelet.linkedg); - } - - if (!pedited || pedited->wavelet.cbenab) { - keyFile.set_boolean ("Wavelet", "CBenab", wavelet.cbenab); - } - - if (!pedited || pedited->wavelet.lipst) { - keyFile.set_boolean ("Wavelet", "Lipst", wavelet.lipst); - } + saveToKeyfile(!pedited || pedited->wavelet.opacityCurveRG, "Wavelet", "OpacityCurveRG", wavelet.opacityCurveRG, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.opacityCurveBY, "Wavelet", "OpacityCurveBY", wavelet.opacityCurveBY, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.opacityCurveW, "Wavelet", "OpacityCurveW", wavelet.opacityCurveW, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.opacityCurveWL, "Wavelet", "OpacityCurveWL", wavelet.opacityCurveWL, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.hhcurve, "Wavelet", "HHcurve", wavelet.hhcurve, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.Chcurve, "Wavelet", "CHcurve", wavelet.Chcurve, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.wavclCurve, "Wavelet", "WavclCurve", wavelet.wavclCurve, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.median, "Wavelet", "Median", wavelet.median, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.medianlev, "Wavelet", "Medianlev", wavelet.medianlev, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.linkedg, "Wavelet", "Linkedg", wavelet.linkedg, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.cbenab, "Wavelet", "CBenab", wavelet.cbenab, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.lipst, "Wavelet", "Lipst", wavelet.lipst, keyFile); // if (!pedited || pedited->wavelet.edgreinf) keyFile.set_boolean ("Wavelet", "Edgreinf", wavelet.edgreinf); - if (!pedited || pedited->wavelet.skinprotect) { - keyFile.set_double ("Wavelet", "Skinprotect", wavelet.skinprotect); - } - + saveToKeyfile(!pedited || pedited->wavelet.skinprotect, "Wavelet", "Skinprotect", wavelet.skinprotect, keyFile); if (!pedited || pedited->wavelet.hueskin) { Glib::ArrayHandle thresh (wavelet.hueskin.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "Hueskin", thresh); } - if (!pedited || pedited->wavelet.edgrad) { - keyFile.set_integer ("Wavelet", "Edgrad", wavelet.edgrad); - } - - if (!pedited || pedited->wavelet.edgval) { - keyFile.set_integer ("Wavelet", "Edgval", wavelet.edgval); - } - - if (!pedited || pedited->wavelet.edgthresh) { - keyFile.set_integer ("Wavelet", "ThrEdg", wavelet.edgthresh); - } - + saveToKeyfile(!pedited || pedited->wavelet.edgrad, "Wavelet", "Edgrad", wavelet.edgrad, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgval, "Wavelet", "Edgval", wavelet.edgval, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgthresh, "Wavelet", "ThrEdg", wavelet.edgthresh, keyFile); // if (!pedited || pedited->wavelet.strength) keyFile.set_integer ("Wavelet", "Strength", wavelet.strength); // if (!pedited || pedited->wavelet.balance) keyFile.set_integer ("Wavelet", "Balance", wavelet.balance); - if (!pedited || pedited->wavelet.avoid) { - keyFile.set_boolean ("Wavelet", "AvoidColorShift", wavelet.avoid); - } - - if (!pedited || pedited->wavelet.tmr) { - keyFile.set_boolean ("Wavelet", "TMr", wavelet.tmr); - } - - if (!pedited || pedited->wavelet.rescon) { - keyFile.set_integer ("Wavelet", "ResidualcontShadow", wavelet.rescon); - } - - if (!pedited || pedited->wavelet.resconH) { - keyFile.set_integer ("Wavelet", "ResidualcontHighlight", wavelet.resconH); - } - - if (!pedited || pedited->wavelet.thr) { - keyFile.set_integer ("Wavelet", "ThresholdResidShadow", wavelet.thr); - } - - if (!pedited || pedited->wavelet.thrH) { - keyFile.set_integer ("Wavelet", "ThresholdResidHighLight", wavelet.thrH); - } - - if (!pedited || pedited->wavelet.reschro) { - keyFile.set_integer ("Wavelet", "Residualchroma", wavelet.reschro); - } - - if (!pedited || pedited->wavelet.tmrs) { - keyFile.set_double ("Wavelet", "ResidualTM", wavelet.tmrs); - } - - if (!pedited || pedited->wavelet.gamma) { - keyFile.set_double ("Wavelet", "Residualgamma", wavelet.gamma); - } - - if (!pedited || pedited->wavelet.sky) { - keyFile.set_double ("Wavelet", "HueRangeResidual", wavelet.sky); - } - + saveToKeyfile(!pedited || pedited->wavelet.avoid, "Wavelet", "AvoidColorShift", wavelet.avoid, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.tmr, "Wavelet", "TMr", wavelet.tmr, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.rescon, "Wavelet", "ResidualcontShadow", wavelet.rescon, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.resconH, "Wavelet", "ResidualcontHighlight", wavelet.resconH, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.thr, "Wavelet", "ThresholdResidShadow", wavelet.thr, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.thrH, "Wavelet", "ThresholdResidHighLight", wavelet.thrH, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.reschro, "Wavelet", "Residualchroma", wavelet.reschro, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.tmrs, "Wavelet", "ResidualTM", wavelet.tmrs, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.gamma, "Wavelet", "Residualgamma", wavelet.gamma, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.sky, "Wavelet", "HueRangeResidual", wavelet.sky, keyFile); if (!pedited || pedited->wavelet.hueskin2) { Glib::ArrayHandle thresh (wavelet.hueskin2.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "HueRange", thresh); } - if (!pedited || pedited->wavelet.contrast) { - keyFile.set_integer ("Wavelet", "Contrast", wavelet.contrast); - } - + saveToKeyfile(!pedited || pedited->wavelet.contrast, "Wavelet", "Contrast", wavelet.contrast, keyFile); // save directional pyramid wavelet parameters - if (!pedited || pedited->dirpyrequalizer.enabled) { - keyFile.set_boolean ("Directional Pyramid Equalizer", "Enabled", dirpyrequalizer.enabled); - } - - if (!pedited || pedited->dirpyrequalizer.gamutlab) { - keyFile.set_boolean ("Directional Pyramid Equalizer", "Gamutlab", dirpyrequalizer.gamutlab); - } - - if (!pedited || pedited->dirpyrequalizer.cbdlMethod) { - keyFile.set_string ("Directional Pyramid Equalizer", "cbdlMethod", dirpyrequalizer.cbdlMethod); - } - + saveToKeyfile(!pedited || pedited->dirpyrequalizer.enabled, "Directional Pyramid Equalizer", "Enabled", dirpyrequalizer.enabled, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrequalizer.gamutlab, "Directional Pyramid Equalizer", "Gamutlab", dirpyrequalizer.gamutlab, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrequalizer.cbdlMethod, "Directional Pyramid Equalizer", "cbdlMethod", dirpyrequalizer.cbdlMethod, keyFile); for (int i = 0; i < 6; i++) { std::stringstream ss; ss << "Mult" << i; - if (!pedited || pedited->dirpyrequalizer.mult[i]) { - keyFile.set_double ("Directional Pyramid Equalizer", ss.str(), dirpyrequalizer.mult[i]); - } - } - - if (!pedited || pedited->dirpyrequalizer.threshold) { - keyFile.set_double ("Directional Pyramid Equalizer", "Threshold", dirpyrequalizer.threshold); - } - - if (!pedited || pedited->dirpyrequalizer.skinprotect) { - keyFile.set_double ("Directional Pyramid Equalizer", "Skinprotect", dirpyrequalizer.skinprotect); - } + saveToKeyfile(!pedited || pedited->dirpyrequalizer.mult[i], "Directional Pyramid Equalizer", ss.str(), dirpyrequalizer.mult[i], keyFile); } + saveToKeyfile(!pedited || pedited->dirpyrequalizer.threshold, "Directional Pyramid Equalizer", "Threshold", dirpyrequalizer.threshold, keyFile); + saveToKeyfile(!pedited || pedited->dirpyrequalizer.skinprotect, "Directional Pyramid Equalizer", "Skinprotect", dirpyrequalizer.skinprotect, keyFile); // if (!pedited || pedited->dirpyrequalizer.algo) keyFile.set_string ("Directional Pyramid Equalizer", "Algorithm", dirpyrequalizer.algo); if (!pedited || pedited->dirpyrequalizer.hueskin) { Glib::ArrayHandle thresh (dirpyrequalizer.hueskin.value, 4, Glib::OWNERSHIP_NONE); @@ -3253,145 +2264,41 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b } // save hsv wavelet parameters - if (!pedited || pedited->hsvequalizer.hcurve) { - Glib::ArrayHandle hcurve = hsvequalizer.hcurve; - keyFile.set_double_list ("HSV Equalizer", "HCurve", hcurve); - } - - if (!pedited || pedited->hsvequalizer.scurve) { - Glib::ArrayHandle scurve = hsvequalizer.scurve; - keyFile.set_double_list ("HSV Equalizer", "SCurve", scurve); - } - - if (!pedited || pedited->hsvequalizer.vcurve) { - Glib::ArrayHandle vcurve = hsvequalizer.vcurve; - keyFile.set_double_list ("HSV Equalizer", "VCurve", vcurve); - } - + saveToKeyfile(!pedited || pedited->hsvequalizer.hcurve, "HSV Equalizer", "HCurve", hsvequalizer.hcurve, keyFile); + saveToKeyfile(!pedited || pedited->hsvequalizer.scurve, "HSV Equalizer", "SCurve", hsvequalizer.scurve, keyFile); + saveToKeyfile(!pedited || pedited->hsvequalizer.vcurve, "HSV Equalizer", "VCurve", hsvequalizer.vcurve, keyFile); //save film simulation parameters - if ( !pedited || pedited->filmSimulation.enabled ) { - keyFile.set_boolean ( "Film Simulation", "Enabled", filmSimulation.enabled ); - } - - if ( !pedited || pedited->filmSimulation.clutFilename ) { - keyFile.set_string ( "Film Simulation", "ClutFilename", filmSimulation.clutFilename ); - } - - if ( !pedited || pedited->filmSimulation.strength ) { - keyFile.set_integer ( "Film Simulation", "Strength", filmSimulation.strength ); - } - - - if (!pedited || pedited->rgbCurves.lumamode) { - keyFile.set_boolean ("RGB Curves", "LumaMode", rgbCurves.lumamode); - } - - if (!pedited || pedited->rgbCurves.rcurve) { - Glib::ArrayHandle RGBrcurve = rgbCurves.rcurve; - keyFile.set_double_list ("RGB Curves", "rCurve", RGBrcurve); - } - - if (!pedited || pedited->rgbCurves.gcurve) { - Glib::ArrayHandle RGBgcurve = rgbCurves.gcurve; - keyFile.set_double_list ("RGB Curves", "gCurve", RGBgcurve); - } - - if (!pedited || pedited->rgbCurves.bcurve) { - Glib::ArrayHandle RGBbcurve = rgbCurves.bcurve; - keyFile.set_double_list ("RGB Curves", "bCurve", RGBbcurve); - } + saveToKeyfile(!pedited || pedited->filmSimulation.enabled, "Film Simulation", "Enabled", filmSimulation.enabled, keyFile); + saveToKeyfile(!pedited || pedited->filmSimulation.clutFilename, "Film Simulation", "ClutFilename", filmSimulation.clutFilename, keyFile); + saveToKeyfile(!pedited || pedited->filmSimulation.strength, "Film Simulation", "Strength", filmSimulation.strength, keyFile); + saveToKeyfile(!pedited || pedited->rgbCurves.lumamode, "RGB Curves", "LumaMode", rgbCurves.lumamode, keyFile); + saveToKeyfile(!pedited || pedited->rgbCurves.rcurve, "RGB Curves", "rCurve", rgbCurves.rcurve, keyFile); + saveToKeyfile(!pedited || pedited->rgbCurves.gcurve, "RGB Curves", "gCurve", rgbCurves.gcurve, keyFile); + saveToKeyfile(!pedited || pedited->rgbCurves.bcurve, "RGB Curves", "bCurve", rgbCurves.bcurve, keyFile); // save Color Toning - if (!pedited || pedited->colorToning.enabled) { - keyFile.set_boolean ("ColorToning", "Enabled", colorToning.enabled); - } - - if (!pedited || pedited->colorToning.method) { - keyFile.set_string ("ColorToning", "Method", colorToning.method); - } - - if (!pedited || pedited->colorToning.lumamode) { - keyFile.set_boolean ("ColorToning", "Lumamode", colorToning.lumamode); - } - - if (!pedited || pedited->colorToning.twocolor) { - keyFile.set_string ("ColorToning", "Twocolor", colorToning.twocolor); - } - - if (!pedited || pedited->colorToning.redlow) { - keyFile.set_double ("ColorToning", "Redlow", colorToning.redlow); - } - - if (!pedited || pedited->colorToning.greenlow) { - keyFile.set_double ("ColorToning", "Greenlow", colorToning.greenlow); - } - - if (!pedited || pedited->colorToning.bluelow) { - keyFile.set_double ("ColorToning", "Bluelow", colorToning.bluelow); - } - - if (!pedited || pedited->colorToning.satlow) { - keyFile.set_double ("ColorToning", "Satlow", colorToning.satlow); - } - - if (!pedited || pedited->colorToning.balance) { - keyFile.set_integer ("ColorToning", "Balance", colorToning.balance); - } - - if (!pedited || pedited->colorToning.sathigh) { - keyFile.set_double ("ColorToning", "Sathigh", colorToning.sathigh); - } - - if (!pedited || pedited->colorToning.redmed) { - keyFile.set_double ("ColorToning", "Redmed", colorToning.redmed); - } - - if (!pedited || pedited->colorToning.greenmed) { - keyFile.set_double ("ColorToning", "Greenmed", colorToning.greenmed); - } - - if (!pedited || pedited->colorToning.bluemed) { - keyFile.set_double ("ColorToning", "Bluemed", colorToning.bluemed); - } - - if (!pedited || pedited->colorToning.redhigh) { - keyFile.set_double ("ColorToning", "Redhigh", colorToning.redhigh); - } - - if (!pedited || pedited->colorToning.greenhigh) { - keyFile.set_double ("ColorToning", "Greenhigh", colorToning.greenhigh); - } - - if (!pedited || pedited->colorToning.bluehigh) { - keyFile.set_double ("ColorToning", "Bluehigh", colorToning.bluehigh); - } - - if (!pedited || pedited->colorToning.autosat) { - keyFile.set_boolean ("ColorToning", "Autosat", colorToning.autosat); - } - - if (!pedited || pedited->colorToning.opacityCurve) { - Glib::ArrayHandle curve = colorToning.opacityCurve; - keyFile.set_double_list ("ColorToning", "OpacityCurve", curve); - } - - if (!pedited || pedited->colorToning.colorCurve) { - Glib::ArrayHandle curve = colorToning.colorCurve; - keyFile.set_double_list ("ColorToning", "ColorCurve", curve); - } - - if (!pedited || pedited->colorToning.satprotectionthreshold) { - keyFile.set_integer ("ColorToning", "SatProtectionThreshold", colorToning.satProtectionThreshold ); - } - - if (!pedited || pedited->colorToning.saturatedopacity) { - keyFile.set_integer ("ColorToning", "SaturatedOpacity", colorToning.saturatedOpacity ); - } - - if (!pedited || pedited->colorToning.strength) { - keyFile.set_integer ("ColorToning", "Strength", colorToning.strength ); - } - + saveToKeyfile(!pedited || pedited->colorToning.enabled, "ColorToning", "Enabled", colorToning.enabled, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.method, "ColorToning", "Method", colorToning.method, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.lumamode, "ColorToning", "Lumamode", colorToning.lumamode, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.twocolor, "ColorToning", "Twocolor", colorToning.twocolor, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.redlow, "ColorToning", "Redlow", colorToning.redlow, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.greenlow, "ColorToning", "Greenlow", colorToning.greenlow, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.bluelow, "ColorToning", "Bluelow", colorToning.bluelow, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.satlow, "ColorToning", "Satlow", colorToning.satlow, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.balance, "ColorToning", "Balance", colorToning.balance, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.sathigh, "ColorToning", "Sathigh", colorToning.sathigh, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.redmed, "ColorToning", "Redmed", colorToning.redmed, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.greenmed, "ColorToning", "Greenmed", colorToning.greenmed, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.bluemed, "ColorToning", "Bluemed", colorToning.bluemed, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.redhigh, "ColorToning", "Redhigh", colorToning.redhigh, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.greenhigh, "ColorToning", "Greenhigh", colorToning.greenhigh, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.bluehigh, "ColorToning", "Bluehigh", colorToning.bluehigh, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.autosat, "ColorToning", "Autosat", colorToning.autosat, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.opacityCurve, "ColorToning", "OpacityCurve", colorToning.opacityCurve, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.colorCurve, "ColorToning", "ColorCurve", colorToning.colorCurve, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.satprotectionthreshold, "ColorToning", "SatProtectionThreshold", colorToning.satProtectionThreshold , keyFile); + saveToKeyfile(!pedited || pedited->colorToning.saturatedopacity, "ColorToning", "SaturatedOpacity", colorToning.saturatedOpacity , keyFile); + saveToKeyfile(!pedited || pedited->colorToning.strength, "ColorToning", "Strength", colorToning.strength , keyFile); if (!pedited || pedited->colorToning.hlColSat) { Glib::ArrayHandle thresh (colorToning.hlColSat.value, 2, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("ColorToning", "HighlightsColorSaturation", thresh); @@ -3402,275 +2309,75 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_integer_list ("ColorToning", "ShadowsColorSaturation", thresh); } - if (!pedited || pedited->colorToning.clcurve) { - Glib::ArrayHandle clcurve = colorToning.clcurve; - keyFile.set_double_list ("ColorToning", "ClCurve", clcurve); - } - - if (!pedited || pedited->colorToning.cl2curve) { - Glib::ArrayHandle cl2curve = colorToning.cl2curve; - keyFile.set_double_list ("ColorToning", "Cl2Curve", cl2curve); - } - + saveToKeyfile(!pedited || pedited->colorToning.clcurve, "ColorToning", "ClCurve", colorToning.clcurve, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.cl2curve, "ColorToning", "Cl2Curve", colorToning.cl2curve, keyFile); // save raw parameters - if (!pedited || pedited->raw.darkFrame) { - keyFile.set_string ("RAW", "DarkFrame", relativePathIfInside (fname, fnameAbsolute, raw.dark_frame) ); - } - - if (!pedited || pedited->raw.dfAuto) { - keyFile.set_boolean ("RAW", "DarkFrameAuto", raw.df_autoselect ); - } - - if (!pedited || pedited->raw.ff_file) { - keyFile.set_string ("RAW", "FlatFieldFile", relativePathIfInside (fname, fnameAbsolute, raw.ff_file) ); - } - - if (!pedited || pedited->raw.ff_AutoSelect) { - keyFile.set_boolean ("RAW", "FlatFieldAutoSelect", raw.ff_AutoSelect ); - } - - if (!pedited || pedited->raw.ff_BlurRadius) { - keyFile.set_integer ("RAW", "FlatFieldBlurRadius", raw.ff_BlurRadius ); - } - - if (!pedited || pedited->raw.ff_BlurType) { - keyFile.set_string ("RAW", "FlatFieldBlurType", raw.ff_BlurType ); - } - - if (!pedited || pedited->raw.ff_AutoClipControl) { - keyFile.set_boolean ("RAW", "FlatFieldAutoClipControl", raw.ff_AutoClipControl ); - } - - if (!pedited || pedited->raw.ff_clipControl) { - keyFile.set_boolean ("RAW", "FlatFieldClipControl", raw.ff_clipControl ); - } - - if (!pedited || pedited->raw.caCorrection) { - keyFile.set_boolean ("RAW", "CA", raw.ca_autocorrect ); - } - - if (!pedited || pedited->raw.caRed) { - keyFile.set_double ("RAW", "CARed", raw.cared ); - } - - if (!pedited || pedited->raw.caBlue) { - keyFile.set_double ("RAW", "CABlue", raw.cablue ); - } - - if (!pedited || pedited->raw.hotPixelFilter) { - keyFile.set_boolean ("RAW", "HotPixelFilter", raw.hotPixelFilter ); - } - - if (!pedited || pedited->raw.deadPixelFilter) { - keyFile.set_boolean ("RAW", "DeadPixelFilter", raw.deadPixelFilter ); - } - - if (!pedited || pedited->raw.hotDeadPixelThresh) { - keyFile.set_integer ("RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh ); - } - - if (!pedited || pedited->raw.bayersensor.method) { - keyFile.set_string ("RAW Bayer", "Method", raw.bayersensor.method ); - } - - if (!pedited || pedited->raw.bayersensor.imageNum) { - keyFile.set_integer ("RAW Bayer", "ImageNum", raw.bayersensor.imageNum + 1 ); - } - - if (!pedited || pedited->raw.bayersensor.ccSteps) { - keyFile.set_integer ("RAW Bayer", "CcSteps", raw.bayersensor.ccSteps); - } - - if (!pedited || pedited->raw.bayersensor.exBlack0) { - keyFile.set_double ("RAW Bayer", "PreBlack0", raw.bayersensor.black0 ); - } - - if (!pedited || pedited->raw.bayersensor.exBlack1) { - keyFile.set_double ("RAW Bayer", "PreBlack1", raw.bayersensor.black1 ); - } - - if (!pedited || pedited->raw.bayersensor.exBlack2) { - keyFile.set_double ("RAW Bayer", "PreBlack2", raw.bayersensor.black2 ); - } - - if (!pedited || pedited->raw.bayersensor.exBlack3) { - keyFile.set_double ("RAW Bayer", "PreBlack3", raw.bayersensor.black3 ); - } - - if (!pedited || pedited->raw.bayersensor.exTwoGreen) { - keyFile.set_boolean ("RAW Bayer", "PreTwoGreen", raw.bayersensor.twogreen ); - } - - if (!pedited || pedited->raw.bayersensor.linenoise) { - keyFile.set_integer ("RAW Bayer", "LineDenoise", raw.bayersensor.linenoise); - } - - if (!pedited || pedited->raw.bayersensor.greenEq) { - keyFile.set_integer ("RAW Bayer", "GreenEqThreshold", raw.bayersensor.greenthresh); - } - - if (!pedited || pedited->raw.bayersensor.dcbIterations) { - keyFile.set_integer ("RAW Bayer", "DCBIterations", raw.bayersensor.dcb_iterations ); - } - - if (!pedited || pedited->raw.bayersensor.dcbEnhance) { - keyFile.set_boolean ("RAW Bayer", "DCBEnhance", raw.bayersensor.dcb_enhance ); - } - - if (!pedited || pedited->raw.bayersensor.lmmseIterations) { - keyFile.set_integer ("RAW Bayer", "LMMSEIterations", raw.bayersensor.lmmse_iterations ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftMotion) { - keyFile.set_integer ("RAW Bayer", "PixelShiftMotion", raw.bayersensor.pixelShiftMotion ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrection) { - keyFile.set_integer ("RAW Bayer", "PixelShiftMotionCorrection", raw.bayersensor.pixelShiftMotionCorrection ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod) { - keyFile.set_integer ("RAW Bayer", "PixelShiftMotionCorrectionMethod", raw.bayersensor.pixelShiftMotionCorrectionMethod ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorGreen) { - keyFile.set_double ("RAW Bayer", "pixelShiftStddevFactorGreen", raw.bayersensor.pixelShiftStddevFactorGreen ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorRed) { - keyFile.set_double ("RAW Bayer", "pixelShiftStddevFactorRed", raw.bayersensor.pixelShiftStddevFactorRed ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorBlue) { - keyFile.set_double ("RAW Bayer", "pixelShiftStddevFactorBlue", raw.bayersensor.pixelShiftStddevFactorBlue ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftEperIso) { - keyFile.set_double ("RAW Bayer", "PixelShiftEperIso", raw.bayersensor.pixelShiftEperIso ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftNreadIso) { - keyFile.set_double ("RAW Bayer", "PixelShiftNreadIso", raw.bayersensor.pixelShiftNreadIso ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftPrnu) { - keyFile.set_double ("RAW Bayer", "PixelShiftPrnu", raw.bayersensor.pixelShiftPrnu ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftSigma) { - keyFile.set_double ("RAW Bayer", "PixelShiftSigma", raw.bayersensor.pixelShiftSigma ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftSum) { - keyFile.set_double ("RAW Bayer", "PixelShiftSum", raw.bayersensor.pixelShiftSum ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftRedBlueWeight) { - keyFile.set_double ("RAW Bayer", "PixelShiftRedBlueWeight", raw.bayersensor.pixelShiftRedBlueWeight ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftShowMotion) { - keyFile.set_boolean ("RAW Bayer", "PixelShiftShowMotion", raw.bayersensor.pixelShiftShowMotion ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly) { - keyFile.set_boolean ("RAW Bayer", "PixelShiftShowMotionMaskOnly", raw.bayersensor.pixelShiftShowMotionMaskOnly ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftAutomatic) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftAutomatic", raw.bayersensor.pixelShiftAutomatic ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftNonGreenHorizontal) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftNonGreenHorizontal", raw.bayersensor.pixelShiftNonGreenHorizontal ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftNonGreenVertical) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftNonGreenVertical", raw.bayersensor.pixelShiftNonGreenVertical ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftHoleFill) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftHoleFill", raw.bayersensor.pixelShiftHoleFill ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftMedian) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftMedian", raw.bayersensor.pixelShiftMedian ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftMedian3) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftMedian3", raw.bayersensor.pixelShiftMedian3 ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftGreen) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftGreen", raw.bayersensor.pixelShiftGreen ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftBlur) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftBlur", raw.bayersensor.pixelShiftBlur ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftSmooth) { - keyFile.set_double ("RAW Bayer", "pixelShiftSmoothFactor", raw.bayersensor.pixelShiftSmoothFactor ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftExp0) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftExp0", raw.bayersensor.pixelShiftExp0 ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftLmmse) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftLmmse", raw.bayersensor.pixelShiftLmmse ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftEqualBright) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftEqualBright", raw.bayersensor.pixelShiftEqualBright ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftEqualBrightChannel) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftEqualBrightChannel", raw.bayersensor.pixelShiftEqualBrightChannel ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftNonGreenCross", raw.bayersensor.pixelShiftNonGreenCross ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross2) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftNonGreenCross2", raw.bayersensor.pixelShiftNonGreenCross2 ); - } - - if (!pedited || pedited->raw.bayersensor.pixelShiftNonGreenAmaze) { - keyFile.set_boolean ("RAW Bayer", "pixelShiftNonGreenAmaze", raw.bayersensor.pixelShiftNonGreenAmaze ); - } - - if (!pedited || pedited->raw.xtranssensor.method) { - keyFile.set_string ("RAW X-Trans", "Method", raw.xtranssensor.method ); - } - - if (!pedited || pedited->raw.xtranssensor.ccSteps) { - keyFile.set_integer ("RAW X-Trans", "CcSteps", raw.xtranssensor.ccSteps); - } - - if (!pedited || pedited->raw.xtranssensor.exBlackRed) { - keyFile.set_double ("RAW X-Trans", "PreBlackRed", raw.xtranssensor.blackred ); - } - - if (!pedited || pedited->raw.xtranssensor.exBlackGreen) { - keyFile.set_double ("RAW X-Trans", "PreBlackGreen", raw.xtranssensor.blackgreen ); - } - - if (!pedited || pedited->raw.xtranssensor.exBlackBlue) { - keyFile.set_double ("RAW X-Trans", "PreBlackBlue", raw.xtranssensor.blackblue ); - } - + saveToKeyfile(!pedited || pedited->raw.darkFrame, "RAW", "DarkFrame", relativePathIfInside (fname, fnameAbsolute, raw.dark_frame) , keyFile); + saveToKeyfile(!pedited || pedited->raw.dfAuto, "RAW", "DarkFrameAuto", raw.df_autoselect , keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_file, "RAW", "FlatFieldFile", relativePathIfInside (fname, fnameAbsolute, raw.ff_file) , keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_AutoSelect, "RAW", "FlatFieldAutoSelect", raw.ff_AutoSelect , keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_BlurRadius, "RAW", "FlatFieldBlurRadius", raw.ff_BlurRadius , keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_BlurType, "RAW", "FlatFieldBlurType", raw.ff_BlurType , keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_AutoClipControl, "RAW", "FlatFieldAutoClipControl", raw.ff_AutoClipControl , keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_clipControl, "RAW", "FlatFieldClipControl", raw.ff_clipControl , keyFile); + saveToKeyfile(!pedited || pedited->raw.caCorrection, "RAW", "CA", raw.ca_autocorrect , keyFile); + saveToKeyfile(!pedited || pedited->raw.caRed, "RAW", "CARed", raw.cared , keyFile); + saveToKeyfile(!pedited || pedited->raw.caBlue, "RAW", "CABlue", raw.cablue , keyFile); + saveToKeyfile(!pedited || pedited->raw.hotPixelFilter, "RAW", "HotPixelFilter", raw.hotPixelFilter , keyFile); + saveToKeyfile(!pedited || pedited->raw.deadPixelFilter, "RAW", "DeadPixelFilter", raw.deadPixelFilter , keyFile); + saveToKeyfile(!pedited || pedited->raw.hotDeadPixelThresh, "RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.method, "RAW Bayer", "Method", raw.bayersensor.method , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.imageNum, "RAW Bayer", "ImageNum", raw.bayersensor.imageNum + 1 , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.ccSteps, "RAW Bayer", "CcSteps", raw.bayersensor.ccSteps, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack0, "RAW Bayer", "PreBlack0", raw.bayersensor.black0 , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack1, "RAW Bayer", "PreBlack1", raw.bayersensor.black1 , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack2, "RAW Bayer", "PreBlack2", raw.bayersensor.black2 , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack3, "RAW Bayer", "PreBlack3", raw.bayersensor.black3 , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exTwoGreen, "RAW Bayer", "PreTwoGreen", raw.bayersensor.twogreen , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.linenoise, "RAW Bayer", "LineDenoise", raw.bayersensor.linenoise, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.greenEq, "RAW Bayer", "GreenEqThreshold", raw.bayersensor.greenthresh, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbIterations, "RAW Bayer", "DCBIterations", raw.bayersensor.dcb_iterations , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbEnhance, "RAW Bayer", "DCBEnhance", raw.bayersensor.dcb_enhance , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.lmmseIterations, "RAW Bayer", "LMMSEIterations", raw.bayersensor.lmmse_iterations , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotion, "RAW Bayer", "PixelShiftMotion", raw.bayersensor.pixelShiftMotion , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrection, "RAW Bayer", "PixelShiftMotionCorrection", raw.bayersensor.pixelShiftMotionCorrection , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod, "RAW Bayer", "PixelShiftMotionCorrectionMethod", raw.bayersensor.pixelShiftMotionCorrectionMethod , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorGreen, "RAW Bayer", "pixelShiftStddevFactorGreen", raw.bayersensor.pixelShiftStddevFactorGreen , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorRed, "RAW Bayer", "pixelShiftStddevFactorRed", raw.bayersensor.pixelShiftStddevFactorRed , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorBlue, "RAW Bayer", "pixelShiftStddevFactorBlue", raw.bayersensor.pixelShiftStddevFactorBlue , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEperIso, "RAW Bayer", "PixelShiftEperIso", raw.bayersensor.pixelShiftEperIso , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNreadIso, "RAW Bayer", "PixelShiftNreadIso", raw.bayersensor.pixelShiftNreadIso , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftPrnu, "RAW Bayer", "PixelShiftPrnu", raw.bayersensor.pixelShiftPrnu , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSigma, "RAW Bayer", "PixelShiftSigma", raw.bayersensor.pixelShiftSigma , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSum, "RAW Bayer", "PixelShiftSum", raw.bayersensor.pixelShiftSum , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftRedBlueWeight, "RAW Bayer", "PixelShiftRedBlueWeight", raw.bayersensor.pixelShiftRedBlueWeight , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotion, "RAW Bayer", "PixelShiftShowMotion", raw.bayersensor.pixelShiftShowMotion , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly, "RAW Bayer", "PixelShiftShowMotionMaskOnly", raw.bayersensor.pixelShiftShowMotionMaskOnly , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftAutomatic, "RAW Bayer", "pixelShiftAutomatic", raw.bayersensor.pixelShiftAutomatic , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenHorizontal, "RAW Bayer", "pixelShiftNonGreenHorizontal", raw.bayersensor.pixelShiftNonGreenHorizontal , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenVertical, "RAW Bayer", "pixelShiftNonGreenVertical", raw.bayersensor.pixelShiftNonGreenVertical , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftHoleFill, "RAW Bayer", "pixelShiftHoleFill", raw.bayersensor.pixelShiftHoleFill , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian, "RAW Bayer", "pixelShiftMedian", raw.bayersensor.pixelShiftMedian , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian3, "RAW Bayer", "pixelShiftMedian3", raw.bayersensor.pixelShiftMedian3 , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftGreen, "RAW Bayer", "pixelShiftGreen", raw.bayersensor.pixelShiftGreen , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftBlur, "RAW Bayer", "pixelShiftBlur", raw.bayersensor.pixelShiftBlur , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSmooth, "RAW Bayer", "pixelShiftSmoothFactor", raw.bayersensor.pixelShiftSmoothFactor , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftExp0, "RAW Bayer", "pixelShiftExp0", raw.bayersensor.pixelShiftExp0 , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftLmmse, "RAW Bayer", "pixelShiftLmmse", raw.bayersensor.pixelShiftLmmse , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBright, "RAW Bayer", "pixelShiftEqualBright", raw.bayersensor.pixelShiftEqualBright , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBrightChannel, "RAW Bayer", "pixelShiftEqualBrightChannel", raw.bayersensor.pixelShiftEqualBrightChannel , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross, "RAW Bayer", "pixelShiftNonGreenCross", raw.bayersensor.pixelShiftNonGreenCross , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross2, "RAW Bayer", "pixelShiftNonGreenCross2", raw.bayersensor.pixelShiftNonGreenCross2 , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenAmaze, "RAW Bayer", "pixelShiftNonGreenAmaze", raw.bayersensor.pixelShiftNonGreenAmaze , keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.method, "RAW X-Trans", "Method", raw.xtranssensor.method , keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.ccSteps, "RAW X-Trans", "CcSteps", raw.xtranssensor.ccSteps, keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackRed, "RAW X-Trans", "PreBlackRed", raw.xtranssensor.blackred , keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackGreen, "RAW X-Trans", "PreBlackGreen", raw.xtranssensor.blackgreen , keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackBlue, "RAW X-Trans", "PreBlackBlue", raw.xtranssensor.blackblue , keyFile); // save raw exposition - if (!pedited || pedited->raw.exPos) { - keyFile.set_double ("RAW", "PreExposure", raw.expos ); - } - - if (!pedited || pedited->raw.exPreser) { - keyFile.set_double ("RAW", "PrePreserv", raw.preser ); - } - + saveToKeyfile(!pedited || pedited->raw.exPos, "RAW", "PreExposure", raw.expos , keyFile); + saveToKeyfile(!pedited || pedited->raw.exPreser, "RAW", "PrePreserv", raw.preser , keyFile); // save exif change list if (!pedited || pedited->exif) { for (ExifPairs::const_iterator i = exif.begin(); i != exif.end(); ++i) { @@ -3780,200 +2487,52 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } if (keyFile.has_group ("General")) { - if (keyFile.has_key ("General", "Rank")) { - rank = keyFile.get_integer ("General", "Rank"); - - if (pedited) { - pedited->general.rank = true; - } - } - - if (keyFile.has_key ("General", "ColorLabel")) { - colorlabel = keyFile.get_integer ("General", "ColorLabel"); - - if (pedited) { - pedited->general.colorlabel = true; - } - } - - if (keyFile.has_key ("General", "InTrash")) { - inTrash = keyFile.get_boolean ("General", "InTrash"); - - if (pedited) { - pedited->general.intrash = true; - } - } + assignFromKeyfile(keyFile, "General", "Rank", pedited, rank, pedited->general.rank); + assignFromKeyfile(keyFile, "General", "ColorLabel", pedited, colorlabel, pedited->general.colorlabel); + assignFromKeyfile(keyFile, "General", "InTrash", pedited, inTrash, pedited->general.intrash); } if (keyFile.has_group ("Exposure")) { if (ppVersion < PPVERSION_AEXP) { toneCurve.autoexp = false; // prevent execution of autoexp when opening file created with earlier verions of autoexp algorithm - } else if (keyFile.has_key ("Exposure", "Auto")) { - toneCurve.autoexp = keyFile.get_boolean ("Exposure", "Auto"); - - if (pedited) { - pedited->toneCurve.autoexp = true; - } + } else { + assignFromKeyfile(keyFile, "Exposure", "Auto", pedited, toneCurve.autoexp, pedited->toneCurve.autoexp); } - - if (keyFile.has_key ("Exposure", "Clip")) { - toneCurve.clip = keyFile.get_double ("Exposure", "Clip"); - - if (pedited) { - pedited->toneCurve.clip = true; - } - } - - if (keyFile.has_key ("Exposure", "Compensation")) { - toneCurve.expcomp = keyFile.get_double ("Exposure", "Compensation"); - - if (pedited) { - pedited->toneCurve.expcomp = true; - } - } - - if (keyFile.has_key ("Exposure", "Brightness")) { - toneCurve.brightness = keyFile.get_integer ("Exposure", "Brightness"); - - if (pedited) { - pedited->toneCurve.brightness = true; - } - } - - if (keyFile.has_key ("Exposure", "Contrast")) { - toneCurve.contrast = keyFile.get_integer ("Exposure", "Contrast"); - - if (pedited) { - pedited->toneCurve.contrast = true; - } - } - - if (keyFile.has_key ("Exposure", "Saturation")) { - toneCurve.saturation = keyFile.get_integer ("Exposure", "Saturation"); - - if (pedited) { - pedited->toneCurve.saturation = true; - } - } - - if (keyFile.has_key ("Exposure", "Black")) { - toneCurve.black = keyFile.get_integer ("Exposure", "Black"); - - if (pedited) { - pedited->toneCurve.black = true; - } - } - - if (keyFile.has_key ("Exposure", "HighlightCompr")) { - toneCurve.hlcompr = keyFile.get_integer ("Exposure", "HighlightCompr"); - - if (pedited) { - pedited->toneCurve.hlcompr = true; - } - } - - if (keyFile.has_key ("Exposure", "HighlightComprThreshold")) { - toneCurve.hlcomprthresh = keyFile.get_integer ("Exposure", "HighlightComprThreshold"); - - if (pedited) { - pedited->toneCurve.hlcomprthresh = true; - } - } - - if (keyFile.has_key ("Exposure", "ShadowCompr")) { - toneCurve.shcompr = keyFile.get_integer ("Exposure", "ShadowCompr"); - - if (pedited) { - pedited->toneCurve.shcompr = true; - } - } - + assignFromKeyfile(keyFile, "Exposure", "Clip", pedited, toneCurve.clip, pedited->toneCurve.clip); + assignFromKeyfile(keyFile, "Exposure", "Compensation", pedited, toneCurve.expcomp, pedited->toneCurve.expcomp); + assignFromKeyfile(keyFile, "Exposure", "Brightness", pedited, toneCurve.brightness, pedited->toneCurve.brightness); + assignFromKeyfile(keyFile, "Exposure", "Contrast", pedited, toneCurve.contrast, pedited->toneCurve.contrast); + assignFromKeyfile(keyFile, "Exposure", "Saturation", pedited, toneCurve.saturation, pedited->toneCurve.saturation); + assignFromKeyfile(keyFile, "Exposure", "Black", pedited, toneCurve.black, pedited->toneCurve.black); + assignFromKeyfile(keyFile, "Exposure", "HighlightCompr", pedited, toneCurve.hlcompr, pedited->toneCurve.hlcompr); + assignFromKeyfile(keyFile, "Exposure", "HighlightComprThreshold", pedited, toneCurve.hlcomprthresh, pedited->toneCurve.hlcomprthresh); + assignFromKeyfile(keyFile, "Exposure", "ShadowCompr", pedited, toneCurve.shcompr, pedited->toneCurve.shcompr); // load highlight recovery settings if (toneCurve.shcompr > 100) { toneCurve.shcompr = 100; // older pp3 files can have values above 100. } - if (keyFile.has_key ("Exposure", "CurveMode")) { - Glib::ustring sMode = keyFile.get_string ("Exposure", "CurveMode"); + const std::map tc_mapping = { + {"Standard", ToneCurveParams::TC_MODE_STD}, + {"FilmLike", ToneCurveParams::TC_MODE_FILMLIKE}, + {"SatAndValueBlending", ToneCurveParams::TC_MODE_SATANDVALBLENDING}, + {"WeightedStd", ToneCurveParams::TC_MODE_WEIGHTEDSTD}, + {"Luminance", ToneCurveParams::TC_MODE_LUMINANCE}, + {"Perceptual", ToneCurveParams::TC_MODE_PERCEPTUAL} + }; - if (sMode == "Standard") { - toneCurve.curveMode = ToneCurveParams::TC_MODE_STD; - } else if (sMode == "FilmLike") { - toneCurve.curveMode = ToneCurveParams::TC_MODE_FILMLIKE; - } else if (sMode == "SatAndValueBlending") { - toneCurve.curveMode = ToneCurveParams::TC_MODE_SATANDVALBLENDING; - } else if (sMode == "WeightedStd") { - toneCurve.curveMode = ToneCurveParams::TC_MODE_WEIGHTEDSTD; - } else if (sMode == "Luminance") { - toneCurve.curveMode = ToneCurveParams::TC_MODE_LUMINANCE; - } else if (sMode == "Perceptual") { - toneCurve.curveMode = ToneCurveParams::TC_MODE_PERCEPTUAL; - } - - if (pedited) { - pedited->toneCurve.curveMode = true; - } - } - - if (keyFile.has_key ("Exposure", "CurveMode2")) { - Glib::ustring sMode = keyFile.get_string ("Exposure", "CurveMode2"); - - if (sMode == "Standard") { - toneCurve.curveMode2 = ToneCurveParams::TC_MODE_STD; - } else if (sMode == "FilmLike") { - toneCurve.curveMode2 = ToneCurveParams::TC_MODE_FILMLIKE; - } else if (sMode == "SatAndValueBlending") { - toneCurve.curveMode2 = ToneCurveParams::TC_MODE_SATANDVALBLENDING; - } else if (sMode == "WeightedStd") { - toneCurve.curveMode2 = ToneCurveParams::TC_MODE_WEIGHTEDSTD; - } else if (sMode == "Luminance") { - toneCurve.curveMode2 = ToneCurveParams::TC_MODE_LUMINANCE; - } else if (sMode == "Perceptual") { - toneCurve.curveMode2 = ToneCurveParams::TC_MODE_PERCEPTUAL; - } - - if (pedited) { - pedited->toneCurve.curveMode2 = true; - } - } + assignFromKeyfile(keyFile, "Exposure", "CurveMode", pedited, tc_mapping, toneCurve.curveMode, pedited->toneCurve.curveMode); + assignFromKeyfile(keyFile, "Exposure", "CurveMode2", pedited, tc_mapping, toneCurve.curveMode, pedited->toneCurve.curveMode); if (ppVersion > 200) { - if (keyFile.has_key ("Exposure", "Curve")) { - toneCurve.curve = keyFile.get_double_list ("Exposure", "Curve"); - avoidEmptyCurve (toneCurve.curve); - - if (pedited) { - pedited->toneCurve.curve = true; - } - } - - if (keyFile.has_key ("Exposure", "Curve2")) { - toneCurve.curve2 = keyFile.get_double_list ("Exposure", "Curve2"); - avoidEmptyCurve (toneCurve.curve2); - - if (pedited) { - pedited->toneCurve.curve2 = true; - } - } + assignFromKeyfile(keyFile, "Exposure", "Curve", pedited, toneCurve.curve, pedited->toneCurve.curve); + assignFromKeyfile(keyFile, "Exposure", "Curve2", pedited, toneCurve.curve2, pedited->toneCurve.curve2); } } if (keyFile.has_group ("HLRecovery")) { - if (keyFile.has_key ("HLRecovery", "Enabled")) { - toneCurve.hrenabled = keyFile.get_boolean ("HLRecovery", "Enabled"); - - if (pedited) { - pedited->toneCurve.hrenabled = true; - } - } - - if (keyFile.has_key ("HLRecovery", "Method")) { - toneCurve.method = keyFile.get_string ("HLRecovery", "Method"); - - if (pedited) { - pedited->toneCurve.method = true; - } - } + assignFromKeyfile(keyFile, "HLRecovery", "Enabled", pedited, toneCurve.hrenabled, pedited->toneCurve.hrenabled); + assignFromKeyfile(keyFile, "HLRecovery", "Method", pedited, toneCurve.method, pedited->toneCurve.method); } // load channel mixer curve @@ -3999,511 +2558,113 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) // load black & white if (keyFile.has_group ("Black & White")) { - if (keyFile.has_key ("Black & White", "Enabled")) { - blackwhite.enabled = keyFile.get_boolean ("Black & White", "Enabled"); + assignFromKeyfile(keyFile, "Black & White", "Enabled", pedited, blackwhite.enabled, pedited->blackwhite.enabled); + assignFromKeyfile(keyFile, "Black & White", "Method", pedited, blackwhite.method, pedited->blackwhite.method); + assignFromKeyfile(keyFile, "Black & White", "Auto", pedited, blackwhite.autoc, pedited->blackwhite.autoc); + assignFromKeyfile(keyFile, "Black & White", "ComplementaryColors", pedited, blackwhite.enabledcc, pedited->blackwhite.enabledcc); + assignFromKeyfile(keyFile, "Black & White", "MixerRed", pedited, blackwhite.mixerRed, pedited->blackwhite.mixerRed); + assignFromKeyfile(keyFile, "Black & White", "MixerOrange", pedited, blackwhite.mixerOrange, pedited->blackwhite.mixerOrange); + assignFromKeyfile(keyFile, "Black & White", "MixerYellow", pedited, blackwhite.mixerYellow, pedited->blackwhite.mixerYellow); + assignFromKeyfile(keyFile, "Black & White", "MixerGreen", pedited, blackwhite.mixerGreen, pedited->blackwhite.mixerGreen); + assignFromKeyfile(keyFile, "Black & White", "MixerCyan", pedited, blackwhite.mixerCyan, pedited->blackwhite.mixerCyan); + assignFromKeyfile(keyFile, "Black & White", "MixerBlue", pedited, blackwhite.mixerBlue, pedited->blackwhite.mixerBlue); + assignFromKeyfile(keyFile, "Black & White", "MixerMagenta", pedited, blackwhite.mixerMagenta, pedited->blackwhite.mixerMagenta); + assignFromKeyfile(keyFile, "Black & White", "MixerPurple", pedited, blackwhite.mixerPurple, pedited->blackwhite.mixerPurple); + assignFromKeyfile(keyFile, "Black & White", "GammaRed", pedited, blackwhite.gammaRed, pedited->blackwhite.gammaRed); + assignFromKeyfile(keyFile, "Black & White", "GammaGreen", pedited, blackwhite.gammaGreen, pedited->blackwhite.gammaGreen); + assignFromKeyfile(keyFile, "Black & White", "GammaBlue", pedited, blackwhite.gammaBlue, pedited->blackwhite.gammaBlue); + assignFromKeyfile(keyFile, "Black & White", "Filter", pedited, blackwhite.filter, pedited->blackwhite.filter); + assignFromKeyfile(keyFile, "Black & White", "Setting", pedited, blackwhite.setting, pedited->blackwhite.setting); + assignFromKeyfile(keyFile, "Black & White", "LuminanceCurve", pedited, blackwhite.luminanceCurve, pedited->blackwhite.luminanceCurve); - if (pedited) { - pedited->blackwhite.enabled = true; - } - } + assignFromKeyfile(keyFile, "Black & White", "BeforeCurve", pedited, blackwhite.beforeCurve, pedited->blackwhite.beforeCurve); - if (keyFile.has_key ("Black & White", "Method")) { - blackwhite.method = keyFile.get_string ("Black & White", "Method"); + assignFromKeyfile(keyFile, "Black & White", "Algorithm", pedited, blackwhite.algo, pedited->blackwhite.algo); + assignFromKeyfile( + keyFile, + "Black & White", + "BeforeCurveMode", + pedited, + { + {"Standard", BlackWhiteParams::TC_MODE_STD_BW}, + {"FilmLike", BlackWhiteParams::TC_MODE_FILMLIKE_BW}, + {"SatAndValueBlending", BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW}, + {"WeightedStd", BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW} + }, + blackwhite.beforeCurveMode, + pedited->blackwhite.beforeCurveMode + ); - if (pedited) { - pedited->blackwhite.method = true; - } - } - - if (keyFile.has_key ("Black & White", "Auto")) { - blackwhite.autoc = keyFile.get_boolean ("Black & White", "Auto"); - - if (pedited) { - pedited->blackwhite.autoc = true; - } - } - - if (keyFile.has_key ("Black & White", "ComplementaryColors")) { - blackwhite.enabledcc = keyFile.get_boolean ("Black & White", "ComplementaryColors"); - - if (pedited) { - pedited->blackwhite.enabledcc = true; - } - } - - if (keyFile.has_key ("Black & White", "MixerRed")) { - blackwhite.mixerRed = keyFile.get_integer ("Black & White", "MixerRed"); - - if (pedited) { - pedited->blackwhite.mixerRed = true; - } - } - - if (keyFile.has_key ("Black & White", "MixerOrange")) { - blackwhite.mixerOrange = keyFile.get_integer ("Black & White", "MixerOrange"); - - if (pedited) { - pedited->blackwhite.mixerOrange = true; - } - } - - if (keyFile.has_key ("Black & White", "MixerYellow")) { - blackwhite.mixerYellow = keyFile.get_integer ("Black & White", "MixerYellow"); - - if (pedited) { - pedited->blackwhite.mixerYellow = true; - } - } - - if (keyFile.has_key ("Black & White", "MixerGreen")) { - blackwhite.mixerGreen = keyFile.get_integer ("Black & White", "MixerGreen"); - - if (pedited) { - pedited->blackwhite.mixerGreen = true; - } - } - - if (keyFile.has_key ("Black & White", "MixerCyan")) { - blackwhite.mixerCyan = keyFile.get_integer ("Black & White", "MixerCyan"); - - if (pedited) { - pedited->blackwhite.mixerCyan = true; - } - } - - if (keyFile.has_key ("Black & White", "MixerBlue")) { - blackwhite.mixerBlue = keyFile.get_integer ("Black & White", "MixerBlue"); - - if (pedited) { - pedited->blackwhite.mixerBlue = true; - } - } - - if (keyFile.has_key ("Black & White", "MixerMagenta")) { - blackwhite.mixerMagenta = keyFile.get_integer ("Black & White", "MixerMagenta"); - - if (pedited) { - pedited->blackwhite.mixerMagenta = true; - } - } - - if (keyFile.has_key ("Black & White", "MixerPurple")) { - blackwhite.mixerPurple = keyFile.get_integer ("Black & White", "MixerPurple"); - - if (pedited) { - pedited->blackwhite.mixerPurple = true; - } - } - - if (keyFile.has_key ("Black & White", "GammaRed")) { - blackwhite.gammaRed = keyFile.get_integer ("Black & White", "GammaRed"); - - if (pedited) { - pedited->blackwhite.gammaRed = true; - } - } - - if (keyFile.has_key ("Black & White", "GammaGreen")) { - blackwhite.gammaGreen = keyFile.get_integer ("Black & White", "GammaGreen"); - - if (pedited) { - pedited->blackwhite.gammaGreen = true; - } - } - - if (keyFile.has_key ("Black & White", "GammaBlue")) { - blackwhite.gammaBlue = keyFile.get_integer ("Black & White", "GammaBlue"); - - if (pedited) { - pedited->blackwhite.gammaBlue = true; - } - } - - if (keyFile.has_key ("Black & White", "Filter")) { - blackwhite.filter = keyFile.get_string ("Black & White", "Filter"); - - if (pedited) { - pedited->blackwhite.filter = true; - } - } - - if (keyFile.has_key ("Black & White", "Setting")) { - blackwhite.setting = keyFile.get_string ("Black & White", "Setting"); - - if (pedited) { - pedited->blackwhite.setting = true; - } - } - - if (keyFile.has_key ("Black & White", "LuminanceCurve")) { - blackwhite.luminanceCurve = keyFile.get_double_list ("Black & White", "LuminanceCurve"); - avoidEmptyCurve (blackwhite.luminanceCurve); - - if (pedited) { - pedited->blackwhite.luminanceCurve = true; - } - } - - if (keyFile.has_key ("Black & White", "BeforeCurve")) { - blackwhite.beforeCurve = keyFile.get_double_list ("Black & White", "BeforeCurve"); - avoidEmptyCurve (blackwhite.beforeCurve); - - if (pedited) { - pedited->blackwhite.beforeCurve = true; - } - } - - if (keyFile.has_key ("Black & White", "Algorithm")) { - blackwhite.algo = keyFile.get_string ("Black & White", "Algorithm"); - - if (pedited) { - pedited->blackwhite.algo = true; - } - } - - if (keyFile.has_key ("Black & White", "BeforeCurveMode")) { - Glib::ustring sMode = keyFile.get_string ("Black & White", "BeforeCurveMode"); - - if (sMode == "Standard") { - blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_STD_BW; - } else if (sMode == "FilmLike") { - blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_FILMLIKE_BW; - } else if (sMode == "SatAndValueBlending") { - blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW; - } else if (sMode == "WeightedStd") { - blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW; - } - - if (pedited) { - pedited->blackwhite.beforeCurveMode = true; - } - } - - if (keyFile.has_key ("Black & White", "AfterCurve")) { - blackwhite.afterCurve = keyFile.get_double_list ("Black & White", "AfterCurve"); - avoidEmptyCurve (blackwhite.afterCurve); - - if (pedited) { - pedited->blackwhite.afterCurve = true; - } - } - - if (keyFile.has_key ("Black & White", "AfterCurveMode")) { - Glib::ustring sMode2 = keyFile.get_string ("Black & White", "AfterCurveMode"); - - if (sMode2 == "Standard") { - blackwhite.afterCurveMode = BlackWhiteParams::TC_MODE_STD_BW; - } else if (sMode2 == "WeightedStd") { - blackwhite.afterCurveMode = BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW; - } - - if (pedited) { - pedited->blackwhite.afterCurveMode = true; - } - } + assignFromKeyfile(keyFile, "Black & White", "AfterCurve", pedited, blackwhite.afterCurve, pedited->blackwhite.afterCurve); + assignFromKeyfile( + keyFile, + "Black & White", + "AfterCurveMode", + pedited, + { + {"Standard", BlackWhiteParams::TC_MODE_STD_BW}, + {"WeightedStd", BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW} + }, + blackwhite.afterCurveMode, + pedited->blackwhite.afterCurveMode + ); } //load retinex if (keyFile.has_group ("Retinex")) { - - if (keyFile.has_key ("Retinex", "Median")) { - retinex.medianmap = keyFile.get_boolean ("Retinex", "Median"); - - if (pedited) { - pedited->retinex.medianmap = true; - } - } - - if (keyFile.has_key ("Retinex", "RetinexMethod")) { - retinex.retinexMethod = keyFile.get_string ("Retinex", "RetinexMethod"); - - if (pedited) { - pedited->retinex.retinexMethod = true; - } - } - - if (keyFile.has_key ("Retinex", "mapMethod")) { - retinex.mapMethod = keyFile.get_string ("Retinex", "mapMethod"); - - if (pedited) { - pedited->retinex.mapMethod = true; - } - } - - if (keyFile.has_key ("Retinex", "viewMethod")) { - retinex.viewMethod = keyFile.get_string ("Retinex", "viewMethod"); - - if (pedited) { - pedited->retinex.viewMethod = true; - } - } - - - if (keyFile.has_key ("Retinex", "Retinexcolorspace")) { - retinex.retinexcolorspace = keyFile.get_string ("Retinex", "Retinexcolorspace"); - - if (pedited) { - pedited->retinex.retinexcolorspace = true; - } - } - - if (keyFile.has_key ("Retinex", "Gammaretinex")) { - retinex.gammaretinex = keyFile.get_string ("Retinex", "Gammaretinex"); - - if (pedited) { - pedited->retinex.gammaretinex = true; - } - } - - if (keyFile.has_key ("Retinex", "Enabled")) { - retinex.enabled = keyFile.get_boolean ("Retinex", "Enabled"); - - if (pedited) { - pedited->retinex.enabled = true; - } - } - - if (keyFile.has_key ("Retinex", "Neigh")) { - retinex.neigh = keyFile.get_integer ("Retinex", "Neigh"); - - if (pedited) { - pedited->retinex.neigh = true; - } - } - - if (keyFile.has_key ("Retinex", "Str")) { - retinex.str = keyFile.get_integer ("Retinex", "Str"); - - if (pedited) { - pedited->retinex.str = true; - } - } - - if (keyFile.has_key ("Retinex", "Scal")) { - retinex.scal = keyFile.get_integer ("Retinex", "Scal"); - - if (pedited) { - pedited->retinex.scal = true; - } - } - - if (keyFile.has_key ("Retinex", "Iter")) { - retinex.iter = keyFile.get_integer ("Retinex", "Iter"); - - if (pedited) { - pedited->retinex.iter = true; - } - } - - if (keyFile.has_key ("Retinex", "Grad")) { - retinex.grad = keyFile.get_integer ("Retinex", "Grad"); - - if (pedited) { - pedited->retinex.grad = true; - } - } - - if (keyFile.has_key ("Retinex", "Grads")) { - retinex.grads = keyFile.get_integer ("Retinex", "Grads"); - - if (pedited) { - pedited->retinex.grads = true; - } - } - - if (keyFile.has_key ("Retinex", "Gam")) { - retinex.gam = keyFile.get_double ("Retinex", "Gam"); - - if (pedited) { - pedited->retinex.gam = true; - } - } - - if (keyFile.has_key ("Retinex", "Slope")) { - retinex.slope = keyFile.get_double ("Retinex", "Slope"); - - if (pedited) { - pedited->retinex.slope = true; - } - } - - if (keyFile.has_key ("Retinex", "Offs")) { - retinex.offs = keyFile.get_integer ("Retinex", "Offs"); - - if (pedited) { - pedited->retinex.offs = true; - } - } - - if (keyFile.has_key ("Retinex", "Vart")) { - retinex.vart = keyFile.get_integer ("Retinex", "Vart"); - - if (pedited) { - pedited->retinex.vart = true; - } - } - - if (keyFile.has_key ("Retinex", "Limd")) { - retinex.limd = keyFile.get_integer ("Retinex", "Limd"); - - if (pedited) { - pedited->retinex.limd = true; - } - } - - if (keyFile.has_key ("Retinex", "highl")) { - retinex.highl = keyFile.get_integer ("Retinex", "highl"); - - if (pedited) { - pedited->retinex.highl = true; - } - } - - if (keyFile.has_key ("Retinex", "skal")) { - retinex.skal = keyFile.get_integer ("Retinex", "skal"); - - if (pedited) { - pedited->retinex.skal = true; - } - } - - if (keyFile.has_key ("Retinex", "CDCurve")) { - retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve"); - avoidEmptyCurve (retinex.cdcurve); - - if (pedited) { - pedited->retinex.cdcurve = true; - } - } - - if (keyFile.has_key ("Retinex", "MAPCurve")) { - retinex.mapcurve = keyFile.get_double_list ("Retinex", "MAPCurve"); - avoidEmptyCurve (retinex.mapcurve); - - if (pedited) { - pedited->retinex.mapcurve = true; - } - } - - if (keyFile.has_key ("Retinex", "CDHCurve")) { - retinex.cdHcurve = keyFile.get_double_list ("Retinex", "CDHCurve"); - avoidEmptyCurve (retinex.cdHcurve); - - if (pedited) { - pedited->retinex.cdHcurve = true; - } - } - - if (keyFile.has_key ("Retinex", "LHCurve")) { - retinex.lhcurve = keyFile.get_double_list ("Retinex", "LHCurve"); - avoidEmptyCurve (retinex.lhcurve); - - if (pedited) { - pedited->retinex.lhcurve = true; - } - } - - if (keyFile.has_key ("Retinex", "Highlights")) { - retinex.highlights = keyFile.get_integer ("Retinex", "Highlights"); - - if (pedited) { - pedited->retinex.highlights = true; - } - } - - if (keyFile.has_key ("Retinex", "HighlightTonalWidth")) { - retinex.htonalwidth = keyFile.get_integer ("Retinex", "HighlightTonalWidth"); - - if (pedited) { - pedited->retinex.htonalwidth = true; - } - } - - if (keyFile.has_key ("Retinex", "Shadows")) { - retinex.shadows = keyFile.get_integer ("Retinex", "Shadows"); - - if (pedited) { - pedited->retinex.shadows = true; - } - } - - if (keyFile.has_key ("Retinex", "ShadowTonalWidth")) { - retinex.stonalwidth = keyFile.get_integer ("Retinex", "ShadowTonalWidth"); - - if (pedited) { - pedited->retinex.stonalwidth = true; - } - } - - - if (keyFile.has_key ("Retinex", "Radius")) { - retinex.radius = keyFile.get_integer ("Retinex", "Radius"); - - if (pedited) { - pedited->retinex.radius = true; - } - } - - - if (keyFile.has_key ("Retinex", "TransmissionCurve")) { - retinex.transmissionCurve = keyFile.get_double_list ("Retinex", "TransmissionCurve"); - avoidEmptyCurve (retinex.transmissionCurve); - - if (pedited) { - pedited->retinex.transmissionCurve = true; - } - } - - - if (keyFile.has_key ("Retinex", "GainTransmissionCurve")) { - retinex.gaintransmissionCurve = keyFile.get_double_list ("Retinex", "GainTransmissionCurve"); - avoidEmptyCurve (retinex.gaintransmissionCurve); - - if (pedited) { - pedited->retinex.gaintransmissionCurve = true; - } - } - + assignFromKeyfile(keyFile, "Retinex", "Median", pedited, retinex.medianmap, pedited->retinex.medianmap); + assignFromKeyfile(keyFile, "Retinex", "RetinexMethod", pedited, retinex.retinexMethod, pedited->retinex.retinexMethod); + assignFromKeyfile(keyFile, "Retinex", "mapMethod", pedited, retinex.mapMethod, pedited->retinex.mapMethod); + assignFromKeyfile(keyFile, "Retinex", "viewMethod", pedited, retinex.viewMethod, pedited->retinex.viewMethod); + + assignFromKeyfile(keyFile, "Retinex", "Retinexcolorspace", pedited, retinex.retinexcolorspace, pedited->retinex.retinexcolorspace); + assignFromKeyfile(keyFile, "Retinex", "Gammaretinex", pedited, retinex.gammaretinex, pedited->retinex.gammaretinex); + assignFromKeyfile(keyFile, "Retinex", "Enabled", pedited, retinex.enabled, pedited->retinex.enabled); + assignFromKeyfile(keyFile, "Retinex", "Neigh", pedited, retinex.neigh, pedited->retinex.neigh); + assignFromKeyfile(keyFile, "Retinex", "Str", pedited, retinex.str, pedited->retinex.str); + assignFromKeyfile(keyFile, "Retinex", "Scal", pedited, retinex.scal, pedited->retinex.scal); + assignFromKeyfile(keyFile, "Retinex", "Iter", pedited, retinex.iter, pedited->retinex.iter); + assignFromKeyfile(keyFile, "Retinex", "Grad", pedited, retinex.grad, pedited->retinex.grad); + assignFromKeyfile(keyFile, "Retinex", "Grads", pedited, retinex.grads, pedited->retinex.grads); + assignFromKeyfile(keyFile, "Retinex", "Gam", pedited, retinex.gam, pedited->retinex.gam); + assignFromKeyfile(keyFile, "Retinex", "Slope", pedited, retinex.slope, pedited->retinex.slope); + assignFromKeyfile(keyFile, "Retinex", "Offs", pedited, retinex.offs, pedited->retinex.offs); + assignFromKeyfile(keyFile, "Retinex", "Vart", pedited, retinex.vart, pedited->retinex.vart); + assignFromKeyfile(keyFile, "Retinex", "Limd", pedited, retinex.limd, pedited->retinex.limd); + assignFromKeyfile(keyFile, "Retinex", "highl", pedited, retinex.highl, pedited->retinex.highl); + assignFromKeyfile(keyFile, "Retinex", "skal", pedited, retinex.skal, pedited->retinex.skal); + assignFromKeyfile(keyFile, "Retinex", "CDCurve", pedited, retinex.cdcurve, pedited->retinex.cdcurve); + + assignFromKeyfile(keyFile, "Retinex", "MAPCurve", pedited, retinex.mapcurve, pedited->retinex.mapcurve); + + assignFromKeyfile(keyFile, "Retinex", "CDHCurve", pedited, retinex.cdHcurve, pedited->retinex.cdHcurve); + + assignFromKeyfile(keyFile, "Retinex", "LHCurve", pedited, retinex.lhcurve, pedited->retinex.lhcurve); + + assignFromKeyfile(keyFile, "Retinex", "Highlights", pedited, retinex.highlights, pedited->retinex.highlights); + assignFromKeyfile(keyFile, "Retinex", "HighlightTonalWidth", pedited, retinex.htonalwidth, pedited->retinex.htonalwidth); + assignFromKeyfile(keyFile, "Retinex", "Shadows", pedited, retinex.shadows, pedited->retinex.shadows); + assignFromKeyfile(keyFile, "Retinex", "ShadowTonalWidth", pedited, retinex.stonalwidth, pedited->retinex.stonalwidth); + + assignFromKeyfile(keyFile, "Retinex", "Radius", pedited, retinex.radius, pedited->retinex.radius); + + assignFromKeyfile(keyFile, "Retinex", "TransmissionCurve", pedited, retinex.transmissionCurve, pedited->retinex.transmissionCurve); + + + assignFromKeyfile(keyFile, "Retinex", "GainTransmissionCurve", pedited, retinex.gaintransmissionCurve, pedited->retinex.gaintransmissionCurve); } // load luma curve if (keyFile.has_group ("Luminance Curve")) { - if (keyFile.has_key ("Luminance Curve", "Brightness")) { - labCurve.brightness = keyFile.get_integer ("Luminance Curve", "Brightness"); - - if (pedited) { - pedited->labCurve.brightness = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "Contrast")) { - labCurve.contrast = keyFile.get_integer ("Luminance Curve", "Contrast"); - - if (pedited) { - pedited->labCurve.contrast = true; - } - } - + assignFromKeyfile(keyFile, "Luminance Curve", "Brightness", pedited, labCurve.brightness, pedited->labCurve.brightness); + assignFromKeyfile(keyFile, "Luminance Curve", "Contrast", pedited, labCurve.contrast, pedited->labCurve.contrast); if (ppVersion < 303) { // transform Saturation into Chromaticity // if Saturation == 0, should we set BWToning on? - if (keyFile.has_key ("Luminance Curve", "Saturation")) { - labCurve.chromaticity = keyFile.get_integer ("Luminance Curve", "Saturation"); - - if (pedited) { - pedited->labCurve.chromaticity = true; - } - } - + assignFromKeyfile(keyFile, "Luminance Curve", "Saturation", pedited, labCurve.chromaticity, pedited->labCurve.chromaticity); // transform AvoidColorClipping into AvoidColorShift - if (keyFile.has_key ("Luminance Curve", "AvoidColorClipping")) { - labCurve.avoidcolorshift = keyFile.get_boolean ("Luminance Curve", "AvoidColorClipping"); - - if (pedited) { - pedited->labCurve.avoidcolorshift = true; - } - } + assignFromKeyfile(keyFile, "Luminance Curve", "AvoidColorClipping", pedited, labCurve.avoidcolorshift, pedited->labCurve.avoidcolorshift); } else { if (keyFile.has_key ("Luminance Curve", "Chromaticity")) { labCurve.chromaticity = keyFile.get_integer ("Luminance Curve", "Chromaticity"); @@ -4517,31 +2678,11 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Luminance Curve", "AvoidColorShift")) { - labCurve.avoidcolorshift = keyFile.get_boolean ("Luminance Curve", "AvoidColorShift"); - - if (pedited) { - pedited->labCurve.avoidcolorshift = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "RedAndSkinTonesProtection")) { - labCurve.rstprotection = keyFile.get_double ("Luminance Curve", "RedAndSkinTonesProtection"); - - if (pedited) { - pedited->labCurve.rstprotection = true; - } - } - } - - if (keyFile.has_key ("Luminance Curve", "LCredsk")) { - labCurve.lcredsk = keyFile.get_boolean ("Luminance Curve", "LCredsk"); - - if (pedited) { - pedited->labCurve.lcredsk = true; - } + assignFromKeyfile(keyFile, "Luminance Curve", "AvoidColorShift", pedited, labCurve.avoidcolorshift, pedited->labCurve.avoidcolorshift); + assignFromKeyfile(keyFile, "Luminance Curve", "RedAndSkinTonesProtection", pedited, labCurve.rstprotection, pedited->labCurve.rstprotection); } + assignFromKeyfile(keyFile, "Luminance Curve", "LCredsk", pedited, labCurve.lcredsk, pedited->labCurve.lcredsk); if (ppVersion < 314) // Backward compatibility: If BWtoning is true, Chromaticity has to be set to -100, which will produce the same effect @@ -4556,115 +2697,23 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Luminance Curve", "LCurve")) { - labCurve.lcurve = keyFile.get_double_list ("Luminance Curve", "LCurve"); - avoidEmptyCurve (labCurve.lcurve); - - if (pedited) { - pedited->labCurve.lcurve = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "aCurve")) { - labCurve.acurve = keyFile.get_double_list ("Luminance Curve", "aCurve"); - avoidEmptyCurve (labCurve.acurve); - - if (pedited) { - pedited->labCurve.acurve = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "bCurve")) { - labCurve.bcurve = keyFile.get_double_list ("Luminance Curve", "bCurve"); - avoidEmptyCurve (labCurve.bcurve); - - if (pedited) { - pedited->labCurve.bcurve = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "ccCurve")) { - labCurve.cccurve = keyFile.get_double_list ("Luminance Curve", "ccCurve"); - avoidEmptyCurve (labCurve.cccurve); - - if (pedited) { - pedited->labCurve.cccurve = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "chCurve")) { - labCurve.chcurve = keyFile.get_double_list ("Luminance Curve", "chCurve"); - avoidEmptyCurve (labCurve.chcurve); - - if (pedited) { - pedited->labCurve.chcurve = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "lhCurve")) { - labCurve.lhcurve = keyFile.get_double_list ("Luminance Curve", "lhCurve"); - avoidEmptyCurve (labCurve.lhcurve); - - if (pedited) { - pedited->labCurve.lhcurve = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "hhCurve")) { - labCurve.hhcurve = keyFile.get_double_list ("Luminance Curve", "hhCurve"); - avoidEmptyCurve (labCurve.hhcurve); - - if (pedited) { - pedited->labCurve.hhcurve = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "LcCurve")) { - labCurve.lccurve = keyFile.get_double_list ("Luminance Curve", "LcCurve"); - avoidEmptyCurve (labCurve.lccurve); - - if (pedited) { - pedited->labCurve.lccurve = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "ClCurve")) { - labCurve.clcurve = keyFile.get_double_list ("Luminance Curve", "ClCurve"); - avoidEmptyCurve (labCurve.clcurve); - - if (pedited) { - pedited->labCurve.clcurve = true; - } - } + assignFromKeyfile(keyFile, "Luminance Curve", "LCurve", pedited, labCurve.lcurve, pedited->labCurve.lcurve); + assignFromKeyfile(keyFile, "Luminance Curve", "aCurve", pedited, labCurve.acurve, pedited->labCurve.acurve); + assignFromKeyfile(keyFile, "Luminance Curve", "bCurve", pedited, labCurve.bcurve, pedited->labCurve.bcurve); + assignFromKeyfile(keyFile, "Luminance Curve", "ccCurve", pedited, labCurve.cccurve, pedited->labCurve.cccurve); + assignFromKeyfile(keyFile, "Luminance Curve", "chCurve", pedited, labCurve.chcurve, pedited->labCurve.chcurve); + assignFromKeyfile(keyFile, "Luminance Curve", "lhCurve", pedited, labCurve.lhcurve, pedited->labCurve.lhcurve); + assignFromKeyfile(keyFile, "Luminance Curve", "hhCurve", pedited, labCurve.hhcurve, pedited->labCurve.hhcurve); + assignFromKeyfile(keyFile, "Luminance Curve", "LcCurve", pedited, labCurve.lccurve, pedited->labCurve.lccurve); + assignFromKeyfile(keyFile, "Luminance Curve", "ClCurve", pedited, labCurve.clcurve, pedited->labCurve.clcurve); } // load sharpening if (keyFile.has_group ("Sharpening")) { - if (keyFile.has_key ("Sharpening", "Enabled")) { - sharpening.enabled = keyFile.get_boolean ("Sharpening", "Enabled"); - - if (pedited) { - pedited->sharpening.enabled = true; - } - } - - if (keyFile.has_key ("Sharpening", "Radius")) { - sharpening.radius = keyFile.get_double ("Sharpening", "Radius"); - - if (pedited) { - pedited->sharpening.radius = true; - } - } - - if (keyFile.has_key ("Sharpening", "Amount")) { - sharpening.amount = keyFile.get_integer ("Sharpening", "Amount"); - - if (pedited) { - pedited->sharpening.amount = true; - } - } - + assignFromKeyfile(keyFile, "Sharpening", "Enabled", pedited, sharpening.enabled, pedited->sharpening.enabled); + assignFromKeyfile(keyFile, "Sharpening", "Radius", pedited, sharpening.radius, pedited->sharpening.radius); + assignFromKeyfile(keyFile, "Sharpening", "Amount", pedited, sharpening.amount, pedited->sharpening.amount); if (keyFile.has_key ("Sharpening", "Threshold")) { if (ppVersion < 302) { int thresh = min (keyFile.get_integer ("Sharpening", "Threshold"), 2000); @@ -4682,183 +2731,39 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Sharpening", "OnlyEdges")) { - sharpening.edgesonly = keyFile.get_boolean ("Sharpening", "OnlyEdges"); - - if (pedited) { - pedited->sharpening.edgesonly = true; - } - } - - if (keyFile.has_key ("Sharpening", "EdgedetectionRadius")) { - sharpening.edges_radius = keyFile.get_double ("Sharpening", "EdgedetectionRadius"); - - if (pedited) { - pedited->sharpening.edges_radius = true; - } - } - - if (keyFile.has_key ("Sharpening", "EdgeTolerance")) { - sharpening.edges_tolerance = keyFile.get_integer ("Sharpening", "EdgeTolerance"); - - if (pedited) { - pedited->sharpening.edges_tolerance = true; - } - } - - if (keyFile.has_key ("Sharpening", "HalocontrolEnabled")) { - sharpening.halocontrol = keyFile.get_boolean ("Sharpening", "HalocontrolEnabled"); - - if (pedited) { - pedited->sharpening.halocontrol = true; - } - } - - if (keyFile.has_key ("Sharpening", "HalocontrolAmount")) { - sharpening.halocontrol_amount = keyFile.get_integer ("Sharpening", "HalocontrolAmount"); - - if (pedited) { - pedited->sharpening.halocontrol_amount = true; - } - } - - if (keyFile.has_key ("Sharpening", "Method")) { - sharpening.method = keyFile.get_string ("Sharpening", "Method"); - - if (pedited) { - pedited->sharpening.method = true; - } - } - - if (keyFile.has_key ("Sharpening", "DeconvRadius")) { - sharpening.deconvradius = keyFile.get_double ("Sharpening", "DeconvRadius"); - - if (pedited) { - pedited->sharpening.deconvradius = true; - } - } - - if (keyFile.has_key ("Sharpening", "DeconvAmount")) { - sharpening.deconvamount = keyFile.get_integer ("Sharpening", "DeconvAmount"); - - if (pedited) { - pedited->sharpening.deconvamount = true; - } - } - - if (keyFile.has_key ("Sharpening", "DeconvDamping")) { - sharpening.deconvdamping = keyFile.get_integer ("Sharpening", "DeconvDamping"); - - if (pedited) { - pedited->sharpening.deconvdamping = true; - } - } - - if (keyFile.has_key ("Sharpening", "DeconvIterations")) { - sharpening.deconviter = keyFile.get_integer ("Sharpening", "DeconvIterations"); - - if (pedited) { - pedited->sharpening.deconviter = true; - } - } + assignFromKeyfile(keyFile, "Sharpening", "OnlyEdges", pedited, sharpening.edgesonly, pedited->sharpening.edgesonly); + assignFromKeyfile(keyFile, "Sharpening", "EdgedetectionRadius", pedited, sharpening.edges_radius, pedited->sharpening.edges_radius); + assignFromKeyfile(keyFile, "Sharpening", "EdgeTolerance", pedited, sharpening.edges_tolerance, pedited->sharpening.edges_tolerance); + assignFromKeyfile(keyFile, "Sharpening", "HalocontrolEnabled", pedited, sharpening.halocontrol, pedited->sharpening.halocontrol); + assignFromKeyfile(keyFile, "Sharpening", "HalocontrolAmount", pedited, sharpening.halocontrol_amount, pedited->sharpening.halocontrol_amount); + assignFromKeyfile(keyFile, "Sharpening", "Method", pedited, sharpening.method, pedited->sharpening.method); + assignFromKeyfile(keyFile, "Sharpening", "DeconvRadius", pedited, sharpening.deconvradius, pedited->sharpening.deconvradius); + assignFromKeyfile(keyFile, "Sharpening", "DeconvAmount", pedited, sharpening.deconvamount, pedited->sharpening.deconvamount); + assignFromKeyfile(keyFile, "Sharpening", "DeconvDamping", pedited, sharpening.deconvdamping, pedited->sharpening.deconvdamping); + assignFromKeyfile(keyFile, "Sharpening", "DeconvIterations", pedited, sharpening.deconviter, pedited->sharpening.deconviter); } // load edge sharpening if (keyFile.has_group ("SharpenEdge")) { - if (keyFile.has_key ("SharpenEdge", "Enabled")) { - sharpenEdge.enabled = keyFile.get_boolean ("SharpenEdge", "Enabled"); - - if (pedited) { - pedited->sharpenEdge.enabled = true; - } - } - - if (keyFile.has_key ("SharpenEdge", "Passes")) { - sharpenEdge.passes = keyFile.get_integer ("SharpenEdge", "Passes"); - - if (pedited) { - pedited->sharpenEdge.passes = true; - } - } - - if (keyFile.has_key ("SharpenEdge", "Strength")) { - sharpenEdge.amount = keyFile.get_double ("SharpenEdge", "Strength"); - - if (pedited) { - pedited->sharpenEdge.amount = true; - } - } - - if (keyFile.has_key ("SharpenEdge", "ThreeChannels")) { - sharpenEdge.threechannels = keyFile.get_boolean ("SharpenEdge", "ThreeChannels"); - - if (pedited) { - pedited->sharpenEdge.threechannels = true; - } - } + assignFromKeyfile(keyFile, "SharpenEdge", "Enabled", pedited, sharpenEdge.enabled, pedited->sharpenEdge.enabled); + assignFromKeyfile(keyFile, "SharpenEdge", "Passes", pedited, sharpenEdge.passes, pedited->sharpenEdge.passes); + assignFromKeyfile(keyFile, "SharpenEdge", "Strength", pedited, sharpenEdge.amount, pedited->sharpenEdge.amount); + assignFromKeyfile(keyFile, "SharpenEdge", "ThreeChannels", pedited, sharpenEdge.threechannels, pedited->sharpenEdge.threechannels); } // load micro-contrast sharpening if (keyFile.has_group ("SharpenMicro")) { - if (keyFile.has_key ("SharpenMicro", "Enabled")) { - sharpenMicro.enabled = keyFile.get_boolean ("SharpenMicro", "Enabled"); - - if (pedited) { - pedited->sharpenMicro.enabled = true; - } - } - - if (keyFile.has_key ("SharpenMicro", "Matrix")) { - sharpenMicro.matrix = keyFile.get_boolean ("SharpenMicro", "Matrix"); - - if (pedited) { - pedited->sharpenMicro.matrix = true; - } - } - - if (keyFile.has_key ("SharpenMicro", "Strength")) { - sharpenMicro.amount = keyFile.get_double ("SharpenMicro", "Strength"); - - if (pedited) { - pedited->sharpenMicro.amount = true; - } - } - - if (keyFile.has_key ("SharpenMicro", "Uniformity")) { - sharpenMicro.uniformity = keyFile.get_double ("SharpenMicro", "Uniformity"); - - if (pedited) { - pedited->sharpenMicro.uniformity = true; - } - } + assignFromKeyfile(keyFile, "SharpenMicro", "Enabled", pedited, sharpenMicro.enabled, pedited->sharpenMicro.enabled); + assignFromKeyfile(keyFile, "SharpenMicro", "Matrix", pedited, sharpenMicro.matrix, pedited->sharpenMicro.matrix); + assignFromKeyfile(keyFile, "SharpenMicro", "Strength", pedited, sharpenMicro.amount, pedited->sharpenMicro.amount); + assignFromKeyfile(keyFile, "SharpenMicro", "Uniformity", pedited, sharpenMicro.uniformity, pedited->sharpenMicro.uniformity); } // load vibrance if (keyFile.has_group ("Vibrance")) { - if (keyFile.has_key ("Vibrance", "Enabled")) { - vibrance.enabled = keyFile.get_boolean ("Vibrance", "Enabled"); - - if (pedited) { - pedited->vibrance.enabled = true; - } - } - - if (keyFile.has_key ("Vibrance", "Pastels")) { - vibrance.pastels = keyFile.get_integer ("Vibrance", "Pastels"); - - if (pedited) { - pedited->vibrance.pastels = true; - } - } - - if (keyFile.has_key ("Vibrance", "Saturated")) { - vibrance.saturated = keyFile.get_integer ("Vibrance", "Saturated"); - - if (pedited) { - pedited->vibrance.saturated = true; - } - } - + assignFromKeyfile(keyFile, "Vibrance", "Enabled", pedited, vibrance.enabled, pedited->vibrance.enabled); + assignFromKeyfile(keyFile, "Vibrance", "Pastels", pedited, vibrance.pastels, pedited->vibrance.pastels); + assignFromKeyfile(keyFile, "Vibrance", "Saturated", pedited, vibrance.saturated, pedited->vibrance.saturated); if (keyFile.has_key ("Vibrance", "PSThreshold")) { if (ppVersion < 302) { int thresh = keyFile.get_integer ("Vibrance", "PSThreshold"); @@ -4876,38 +2781,10 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Vibrance", "ProtectSkins")) { - vibrance.protectskins = keyFile.get_boolean ("Vibrance", "ProtectSkins"); - - if (pedited) { - pedited->vibrance.protectskins = true; - } - } - - if (keyFile.has_key ("Vibrance", "AvoidColorShift")) { - vibrance.avoidcolorshift = keyFile.get_boolean ("Vibrance", "AvoidColorShift"); - - if (pedited) { - pedited->vibrance.avoidcolorshift = true; - } - } - - if (keyFile.has_key ("Vibrance", "PastSatTog")) { - vibrance.pastsattog = keyFile.get_boolean ("Vibrance", "PastSatTog"); - - if (pedited) { - pedited->vibrance.pastsattog = true; - } - } - - if (keyFile.has_key ("Vibrance", "SkinTonesCurve")) { - vibrance.skintonescurve = keyFile.get_double_list ("Vibrance", "SkinTonesCurve"); - avoidEmptyCurve (vibrance.skintonescurve); - - if (pedited) { - pedited->vibrance.skintonescurve = true; - } - } + assignFromKeyfile(keyFile, "Vibrance", "ProtectSkins", pedited, vibrance.protectskins, pedited->vibrance.protectskins); + assignFromKeyfile(keyFile, "Vibrance", "AvoidColorShift", pedited, vibrance.avoidcolorshift, pedited->vibrance.avoidcolorshift); + assignFromKeyfile(keyFile, "Vibrance", "PastSatTog", pedited, vibrance.pastsattog, pedited->vibrance.pastsattog); + assignFromKeyfile(keyFile, "Vibrance", "SkinTonesCurve", pedited, vibrance.skintonescurve, pedited->vibrance.skintonescurve); } // load colorBoost @@ -4927,45 +2804,11 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) // load wb if (keyFile.has_group ("White Balance")) { - if (keyFile.has_key ("White Balance", "Setting")) { - wb.method = keyFile.get_string ("White Balance", "Setting"); - - if (pedited) { - pedited->wb.method = true; - } - } - - if (keyFile.has_key ("White Balance", "Temperature")) { - wb.temperature = keyFile.get_integer ("White Balance", "Temperature"); - - if (pedited) { - pedited->wb.temperature = true; - } - } - - if (keyFile.has_key ("White Balance", "Green")) { - wb.green = keyFile.get_double ("White Balance", "Green"); - - if (pedited) { - pedited->wb.green = true; - } - } - - if (keyFile.has_key ("White Balance", "Equal")) { - wb.equal = keyFile.get_double ("White Balance", "Equal"); - - if (pedited) { - pedited->wb.equal = true; - } - } - - if (keyFile.has_key ("White Balance", "TemperatureBias")) { - wb.tempBias = keyFile.get_double ("White Balance", "TemperatureBias"); - - if (pedited) { - pedited->wb.tempBias = true; - } - } + assignFromKeyfile(keyFile, "White Balance", "Setting", pedited, wb.method, pedited->wb.method); + assignFromKeyfile(keyFile, "White Balance", "Temperature", pedited, wb.temperature, pedited->wb.temperature); + assignFromKeyfile(keyFile, "White Balance", "Green", pedited, wb.green, pedited->wb.green); + assignFromKeyfile(keyFile, "White Balance", "Equal", pedited, wb.equal, pedited->wb.equal); + assignFromKeyfile(keyFile, "White Balance", "TemperatureBias", pedited, wb.tempBias, pedited->wb.tempBias); } // load colorShift @@ -4976,22 +2819,8 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) // load defringe if (keyFile.has_group ("Defringing")) { - if (keyFile.has_key ("Defringing", "Enabled")) { - defringe.enabled = keyFile.get_boolean ("Defringing", "Enabled"); - - if (pedited) { - pedited->defringe.enabled = true; - } - } - - if (keyFile.has_key ("Defringing", "Radius")) { - defringe.radius = keyFile.get_double ("Defringing", "Radius"); - - if (pedited) { - pedited->defringe.radius = true; - } - } - + assignFromKeyfile(keyFile, "Defringing", "Enabled", pedited, defringe.enabled, pedited->defringe.enabled); + assignFromKeyfile(keyFile, "Defringing", "Radius", pedited, defringe.radius, pedited->defringe.radius); if (keyFile.has_key ("Defringing", "Threshold")) { defringe.threshold = (float)keyFile.get_integer ("Defringing", "Threshold"); @@ -5004,631 +2833,139 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) defringe.threshold = sqrt (defringe.threshold * 33.f / 5.f); } - if (keyFile.has_key ("Defringing", "HueCurve")) { - defringe.huecurve = keyFile.get_double_list ("Defringing", "HueCurve"); - avoidEmptyCurve (defringe.huecurve); - - if (pedited) { - pedited->defringe.huecurve = true; - } - } + assignFromKeyfile(keyFile, "Defringing", "HueCurve", pedited, defringe.huecurve, pedited->defringe.huecurve); } // load colorappearance if (keyFile.has_group ("Color appearance")) { - if (keyFile.has_key ("Color appearance", "Enabled")) { - colorappearance.enabled = keyFile.get_boolean ("Color appearance", "Enabled"); + assignFromKeyfile(keyFile, "Color appearance", "Enabled", pedited, colorappearance.enabled, pedited->colorappearance.enabled); + assignFromKeyfile(keyFile, "Color appearance", "Degree", pedited, colorappearance.degree, pedited->colorappearance.degree); + assignFromKeyfile(keyFile, "Color appearance", "AutoDegree", pedited, colorappearance.autodegree, pedited->colorappearance.autodegree); + assignFromKeyfile(keyFile, "Color appearance", "Degreeout", pedited, colorappearance.degreeout, pedited->colorappearance.degreeout); - if (pedited) { - pedited->colorappearance.enabled = true; - } - } - - if (keyFile.has_key ("Color appearance", "Degree")) { - colorappearance.degree = keyFile.get_integer ("Color appearance", "Degree"); - - if (pedited) { - pedited->colorappearance.degree = true; - } - } - - if (keyFile.has_key ("Color appearance", "AutoDegree")) { - colorappearance.autodegree = keyFile.get_boolean ("Color appearance", "AutoDegree"); - - if (pedited) { - pedited->colorappearance.autodegree = true; - } - } - - if (keyFile.has_key ("Color appearance", "Degreeout")) { - colorappearance.degreeout = keyFile.get_integer ("Color appearance", "Degreeout"); - - if (pedited) { - pedited->colorappearance.degreeout = true; - } - } - - if (keyFile.has_key ("Color appearance", "AutoDegreeout")) { - colorappearance.autodegreeout = keyFile.get_boolean ("Color appearance", "AutoDegreeout"); - - if (pedited) { - pedited->colorappearance.autodegreeout = true; - } - } - - if (keyFile.has_key ("Color appearance", "Surround")) { - colorappearance.surround = keyFile.get_string ("Color appearance", "Surround"); - - if (pedited) { - pedited->colorappearance.surround = true; - } - } - - if (keyFile.has_key ("Color appearance", "Surrsrc")) { - colorappearance.surrsrc = keyFile.get_string ("Color appearance", "Surrsrc"); - - if (pedited) { - pedited->colorappearance.surrsrc = true; - } - } + assignFromKeyfile(keyFile, "Color appearance", "AutoDegreeout", pedited, colorappearance.autodegreeout, pedited->colorappearance.autodegreeout); + assignFromKeyfile(keyFile, "Color appearance", "Surround", pedited, colorappearance.surround, pedited->colorappearance.surround); + assignFromKeyfile(keyFile, "Color appearance", "Surrsrc", pedited, colorappearance.surrsrc, pedited->colorappearance.surrsrc); // if (keyFile.has_key ("Color appearance", "Background")) {colorappearance.backgrd = keyFile.get_integer ("Color appearance", "Background"); if (pedited) pedited->colorappearance.backgrd = true; } - if (keyFile.has_key ("Color appearance", "AdaptLum")) { - colorappearance.adaplum = keyFile.get_double ("Color appearance", "AdaptLum"); + assignFromKeyfile(keyFile, "Color appearance", "AdaptLum", pedited, colorappearance.adaplum, pedited->colorappearance.adaplum); + assignFromKeyfile(keyFile, "Color appearance", "Badpixsl", pedited, colorappearance.badpixsl, pedited->colorappearance.badpixsl); + assignFromKeyfile(keyFile, "Color appearance", "Model", pedited, colorappearance.wbmodel, pedited->colorappearance.wbmodel); + assignFromKeyfile(keyFile, "Color appearance", "Algorithm", pedited, colorappearance.algo, pedited->colorappearance.algo); + assignFromKeyfile(keyFile, "Color appearance", "J-Light", pedited, colorappearance.jlight, pedited->colorappearance.jlight); + assignFromKeyfile(keyFile, "Color appearance", "Q-Bright", pedited, colorappearance.qbright, pedited->colorappearance.qbright); + assignFromKeyfile(keyFile, "Color appearance", "C-Chroma", pedited, colorappearance.chroma, pedited->colorappearance.chroma); + assignFromKeyfile(keyFile, "Color appearance", "S-Chroma", pedited, colorappearance.schroma, pedited->colorappearance.schroma); + assignFromKeyfile(keyFile, "Color appearance", "M-Chroma", pedited, colorappearance.mchroma, pedited->colorappearance.mchroma); + assignFromKeyfile(keyFile, "Color appearance", "RSTProtection", pedited, colorappearance.rstprotection, pedited->colorappearance.rstprotection); + assignFromKeyfile(keyFile, "Color appearance", "J-Contrast", pedited, colorappearance.contrast, pedited->colorappearance.contrast); + assignFromKeyfile(keyFile, "Color appearance", "Q-Contrast", pedited, colorappearance.qcontrast, pedited->colorappearance.qcontrast); + assignFromKeyfile(keyFile, "Color appearance", "H-Hue", pedited, colorappearance.colorh, pedited->colorappearance.colorh); + assignFromKeyfile(keyFile, "Color appearance", "AdaptScene", pedited, colorappearance.adapscen, pedited->colorappearance.adapscen); + assignFromKeyfile(keyFile, "Color appearance", "AutoAdapscen", pedited, colorappearance.autoadapscen, pedited->colorappearance.autoadapscen); + assignFromKeyfile(keyFile, "Color appearance", "YbScene", pedited, colorappearance.ybscen, pedited->colorappearance.ybscen); + assignFromKeyfile(keyFile, "Color appearance", "Autoybscen", pedited, colorappearance.autoybscen, pedited->colorappearance.autoybscen); + assignFromKeyfile(keyFile, "Color appearance", "SurrSource", pedited, colorappearance.surrsource, pedited->colorappearance.surrsource); + assignFromKeyfile(keyFile, "Color appearance", "Gamut", pedited, colorappearance.gamut, pedited->colorappearance.gamut); + assignFromKeyfile(keyFile, "Color appearance", "Tempout", pedited, colorappearance.tempout, pedited->colorappearance.tempout); + assignFromKeyfile(keyFile, "Color appearance", "Greenout", pedited, colorappearance.greenout, pedited->colorappearance.greenout); + assignFromKeyfile(keyFile, "Color appearance", "Tempsc", pedited, colorappearance.tempsc, pedited->colorappearance.tempsc); - if (pedited) { - pedited->colorappearance.adaplum = true; - } - } - - if (keyFile.has_key ("Color appearance", "Badpixsl")) { - colorappearance.badpixsl = keyFile.get_integer ("Color appearance", "Badpixsl"); - - if (pedited) { - pedited->colorappearance.badpixsl = true; - } - } - - if (keyFile.has_key ("Color appearance", "Model")) { - colorappearance.wbmodel = keyFile.get_string ("Color appearance", "Model"); - - if (pedited) { - pedited->colorappearance.wbmodel = true; - } - } - - if (keyFile.has_key ("Color appearance", "Algorithm")) { - colorappearance.algo = keyFile.get_string ("Color appearance", "Algorithm"); - - if (pedited) { - pedited->colorappearance.algo = true; - } - } - - if (keyFile.has_key ("Color appearance", "J-Light")) { - colorappearance.jlight = keyFile.get_double ("Color appearance", "J-Light"); - - if (pedited) { - pedited->colorappearance.jlight = true; - } - } - - if (keyFile.has_key ("Color appearance", "Q-Bright")) { - colorappearance.qbright = keyFile.get_double ("Color appearance", "Q-Bright"); - - if (pedited) { - pedited->colorappearance.qbright = true; - } - } - - if (keyFile.has_key ("Color appearance", "C-Chroma")) { - colorappearance.chroma = keyFile.get_double ("Color appearance", "C-Chroma"); - - if (pedited) { - pedited->colorappearance.chroma = true; - } - } - - if (keyFile.has_key ("Color appearance", "S-Chroma")) { - colorappearance.schroma = keyFile.get_double ("Color appearance", "S-Chroma"); - - if (pedited) { - pedited->colorappearance.schroma = true; - } - } - - if (keyFile.has_key ("Color appearance", "M-Chroma")) { - colorappearance.mchroma = keyFile.get_double ("Color appearance", "M-Chroma"); - - if (pedited) { - pedited->colorappearance.mchroma = true; - } - } - - if (keyFile.has_key ("Color appearance", "RSTProtection")) { - colorappearance.rstprotection = keyFile.get_double ("Color appearance", "RSTProtection"); - - if (pedited) { - pedited->colorappearance.rstprotection = true; - } - } - - if (keyFile.has_key ("Color appearance", "J-Contrast")) { - colorappearance.contrast = keyFile.get_double ("Color appearance", "J-Contrast"); - - if (pedited) { - pedited->colorappearance.contrast = true; - } - } - - if (keyFile.has_key ("Color appearance", "Q-Contrast")) { - colorappearance.qcontrast = keyFile.get_double ("Color appearance", "Q-Contrast"); - - if (pedited) { - pedited->colorappearance.qcontrast = true; - } - } - - if (keyFile.has_key ("Color appearance", "H-Hue")) { - colorappearance.colorh = keyFile.get_double ("Color appearance", "H-Hue"); - - if (pedited) { - pedited->colorappearance.colorh = true; - } - } - - if (keyFile.has_key ("Color appearance", "AdaptScene")) { - colorappearance.adapscen = keyFile.get_double ("Color appearance", "AdaptScene"); - - if (pedited) { - pedited->colorappearance.adapscen = true; - } - } - - if (keyFile.has_key ("Color appearance", "AutoAdapscen")) { - colorappearance.autoadapscen = keyFile.get_boolean ("Color appearance", "AutoAdapscen"); - - if (pedited) { - pedited->colorappearance.autoadapscen = true; - } - } - - if (keyFile.has_key ("Color appearance", "YbScene")) { - colorappearance.ybscen = keyFile.get_integer ("Color appearance", "YbScene"); - - if (pedited) { - pedited->colorappearance.ybscen = true; - } - } - - if (keyFile.has_key ("Color appearance", "Autoybscen")) { - colorappearance.autoybscen = keyFile.get_boolean ("Color appearance", "Autoybscen"); - - if (pedited) { - pedited->colorappearance.autoybscen = true; - } - } - - if (keyFile.has_key ("Color appearance", "SurrSource")) { - colorappearance.surrsource = keyFile.get_boolean ("Color appearance", "SurrSource"); - - if (pedited) { - pedited->colorappearance.surrsource = true; - } - } - - if (keyFile.has_key ("Color appearance", "Gamut")) { - colorappearance.gamut = keyFile.get_boolean ("Color appearance", "Gamut"); - - if (pedited) { - pedited->colorappearance.gamut = true; - } - } - - if (keyFile.has_key ("Color appearance", "Tempout")) { - colorappearance.tempout = keyFile.get_integer ("Color appearance", "Tempout"); - - if (pedited) { - pedited->colorappearance.tempout = true; - } - } - - if (keyFile.has_key ("Color appearance", "Greenout")) { - colorappearance.greenout = keyFile.get_double ("Color appearance", "Greenout"); - - if (pedited) { - pedited->colorappearance.greenout = true; - } - } - - if (keyFile.has_key ("Color appearance", "Tempsc")) { - colorappearance.tempsc = keyFile.get_integer ("Color appearance", "Tempsc"); - - if (pedited) { - pedited->colorappearance.tempsc = true; - } - } - - if (keyFile.has_key ("Color appearance", "Greensc")) { - colorappearance.greensc = keyFile.get_double ("Color appearance", "Greensc"); - - if (pedited) { - pedited->colorappearance.greensc = true; - } - } - - if (keyFile.has_key ("Color appearance", "Ybout")) { - colorappearance.ybout = keyFile.get_integer ("Color appearance", "Ybout"); - - if (pedited) { - pedited->colorappearance.ybout = true; - } - } + assignFromKeyfile(keyFile, "Color appearance", "Greensc", pedited, colorappearance.greensc, pedited->colorappearance.greensc); + assignFromKeyfile(keyFile, "Color appearance", "Ybout", pedited, colorappearance.ybout, pedited->colorappearance.ybout); // if (keyFile.has_key ("Color appearance", "Badpix")) {colorappearance.badpix = keyFile.get_boolean ("Color appearance", "Badpix"); if (pedited) pedited->colorappearance.badpix = true; } - if (keyFile.has_key ("Color appearance", "Datacie")) { - colorappearance.datacie = keyFile.get_boolean ("Color appearance", "Datacie"); - - if (pedited) { - pedited->colorappearance.datacie = true; - } - } - - if (keyFile.has_key ("Color appearance", "Tonecie")) { - colorappearance.tonecie = keyFile.get_boolean ("Color appearance", "Tonecie"); - - if (pedited) { - pedited->colorappearance.tonecie = true; - } - } - + assignFromKeyfile(keyFile, "Color appearance", "Datacie", pedited, colorappearance.datacie, pedited->colorappearance.datacie); + assignFromKeyfile(keyFile, "Color appearance", "Tonecie", pedited, colorappearance.tonecie, pedited->colorappearance.tonecie); // if (keyFile.has_key ("Color appearance", "Sharpcie")) {colorappearance.sharpcie = keyFile.get_boolean ("Color appearance", "Sharpcie"); if (pedited) pedited->colorappearance.sharpcie = true; } - if (keyFile.has_key ("Color appearance", "CurveMode")) { - Glib::ustring sMode = keyFile.get_string ("Color appearance", "CurveMode"); - if (sMode == "Lightness") { - colorappearance.curveMode = ColorAppearanceParams::TC_MODE_LIGHT; - } else if (sMode == "Brightness") { - colorappearance.curveMode = ColorAppearanceParams::TC_MODE_BRIGHT; - } + const std::map tc_mapping = { + {"Lightness", ColorAppearanceParams::TC_MODE_LIGHT}, + {"Brightness", ColorAppearanceParams::TC_MODE_BRIGHT} + }; + assignFromKeyfile(keyFile, "Color appearance", "CurveMode", pedited, tc_mapping, colorappearance.curveMode, pedited->colorappearance.curveMode); + assignFromKeyfile(keyFile, "Color appearance", "CurveMode2", pedited, tc_mapping, colorappearance.curveMode2, pedited->colorappearance.curveMode2); - if (pedited) { - pedited->colorappearance.curveMode = true; - } - } - - if (keyFile.has_key ("Color appearance", "CurveMode2")) { - Glib::ustring sMode = keyFile.get_string ("Color appearance", "CurveMode2"); - - if (sMode == "Lightness") { - colorappearance.curveMode2 = ColorAppearanceParams::TC_MODE_LIGHT; - } else if (sMode == "Brightness") { - colorappearance.curveMode2 = ColorAppearanceParams::TC_MODE_BRIGHT; - } - - if (pedited) { - pedited->colorappearance.curveMode2 = true; - } - } - - if (keyFile.has_key ("Color appearance", "CurveMode3")) { - Glib::ustring sMode = keyFile.get_string ("Color appearance", "CurveMode3"); - - if (sMode == "Chroma") { - colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_CHROMA; - } else if (sMode == "Saturation") { - colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_SATUR; - } else if (sMode == "Colorfullness") { - colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_COLORF; - } - - if (pedited) { - pedited->colorappearance.curveMode3 = true; - } - } + assignFromKeyfile( + keyFile, + "Color appearance", + "CurveMode3", + pedited, + { + {"Chroma", ColorAppearanceParams::TC_MODE_CHROMA}, + {"Saturation", ColorAppearanceParams::TC_MODE_SATUR}, + {"Colorfullness", ColorAppearanceParams::TC_MODE_COLORF} + }, + colorappearance.curveMode3, + pedited->colorappearance.curveMode3 + ); if (ppVersion > 200) { - if (keyFile.has_key ("Color appearance", "Curve")) { - colorappearance.curve = keyFile.get_double_list ("Color appearance", "Curve"); - avoidEmptyCurve (colorappearance.curve); - - if (pedited) { - pedited->colorappearance.curve = true; - } - } - - if (keyFile.has_key ("Color appearance", "Curve2")) { - colorappearance.curve2 = keyFile.get_double_list ("Color appearance", "Curve2"); - avoidEmptyCurve (colorappearance.curve2); - - if (pedited) { - pedited->colorappearance.curve2 = true; - } - } - - if (keyFile.has_key ("Color appearance", "Curve3")) { - colorappearance.curve3 = keyFile.get_double_list ("Color appearance", "Curve3"); - avoidEmptyCurve (colorappearance.curve3); - - if (pedited) { - pedited->colorappearance.curve3 = true; - } - } + assignFromKeyfile(keyFile, "Color appearance", "Curve", pedited, colorappearance.curve, pedited->colorappearance.curve); + assignFromKeyfile(keyFile, "Color appearance", "Curve2", pedited, colorappearance.curve2, pedited->colorappearance.curve2); + assignFromKeyfile(keyFile, "Color appearance", "Curve3", pedited, colorappearance.curve3, pedited->colorappearance.curve3); } } // load impulseDenoise if (keyFile.has_group ("Impulse Denoising")) { - if (keyFile.has_key ("Impulse Denoising", "Enabled")) { - impulseDenoise.enabled = keyFile.get_boolean ("Impulse Denoising", "Enabled"); - - if (pedited) { - pedited->impulseDenoise.enabled = true; - } - } - - if (keyFile.has_key ("Impulse Denoising", "Threshold")) { - impulseDenoise.thresh = keyFile.get_integer ("Impulse Denoising", "Threshold"); - - if (pedited) { - pedited->impulseDenoise.thresh = true; - } - } + assignFromKeyfile(keyFile, "Impulse Denoising", "Enabled", pedited, impulseDenoise.enabled, pedited->impulseDenoise.enabled); + assignFromKeyfile(keyFile, "Impulse Denoising", "Threshold", pedited, impulseDenoise.thresh, pedited->impulseDenoise.thresh); } // load dirpyrDenoise if (keyFile.has_group ("Directional Pyramid Denoising")) {//TODO: No longer an accurate description for FT denoise - if (keyFile.has_key ("Directional Pyramid Denoising", "Enabled")) { - dirpyrDenoise.enabled = keyFile.get_boolean ("Directional Pyramid Denoising", "Enabled"); - - if (pedited) { - pedited->dirpyrDenoise.enabled = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Enhance")) { - dirpyrDenoise.enhance = keyFile.get_boolean ("Directional Pyramid Denoising", "Enhance"); - - if (pedited) { - pedited->dirpyrDenoise.enhance = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Median")) { - dirpyrDenoise.median = keyFile.get_boolean ("Directional Pyramid Denoising", "Median"); - - if (pedited) { - pedited->dirpyrDenoise.median = true; - } - } - + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Enabled", pedited, dirpyrDenoise.enabled, pedited->dirpyrDenoise.enabled); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Enhance", pedited, dirpyrDenoise.enhance, pedited->dirpyrDenoise.enhance); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Median", pedited, dirpyrDenoise.median, pedited->dirpyrDenoise.median); // if (keyFile.has_key ("Directional Pyramid Denoising", "Perform")) { dirpyrDenoise.perform = keyFile.get_boolean ("Directional Pyramid Denoising", "Perform"); if (pedited) pedited->dirpyrDenoise.perform = true; } - if (keyFile.has_key ("Directional Pyramid Denoising", "Luma")) { - dirpyrDenoise.luma = keyFile.get_double ("Directional Pyramid Denoising", "Luma"); - - if (pedited) { - pedited->dirpyrDenoise.luma = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Ldetail")) { - dirpyrDenoise.Ldetail = keyFile.get_double ("Directional Pyramid Denoising", "Ldetail"); - - if (pedited) { - pedited->dirpyrDenoise.Ldetail = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Chroma")) { - dirpyrDenoise.chroma = keyFile.get_double ("Directional Pyramid Denoising", "Chroma"); - - if (pedited) { - pedited->dirpyrDenoise.chroma = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Method")) { - dirpyrDenoise.dmethod = keyFile.get_string ("Directional Pyramid Denoising", "Method"); - - if (pedited) { - pedited->dirpyrDenoise.dmethod = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "LMethod")) { - dirpyrDenoise.Lmethod = keyFile.get_string ("Directional Pyramid Denoising", "LMethod"); - - if (pedited) { - pedited->dirpyrDenoise.Lmethod = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "CMethod")) { - dirpyrDenoise.Cmethod = keyFile.get_string ("Directional Pyramid Denoising", "CMethod"); - - if (pedited) { - pedited->dirpyrDenoise.Cmethod = true; - } - } - + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Luma", pedited, dirpyrDenoise.luma, pedited->dirpyrDenoise.luma); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Ldetail", pedited, dirpyrDenoise.Ldetail, pedited->dirpyrDenoise.Ldetail); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Chroma", pedited, dirpyrDenoise.chroma, pedited->dirpyrDenoise.chroma); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Method", pedited, dirpyrDenoise.dmethod, pedited->dirpyrDenoise.dmethod); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "LMethod", pedited, dirpyrDenoise.Lmethod, pedited->dirpyrDenoise.Lmethod); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "CMethod", pedited, dirpyrDenoise.Cmethod, pedited->dirpyrDenoise.Cmethod); // never load 'auto chroma preview mode' from pp3 if (dirpyrDenoise.Cmethod == "PRE") { dirpyrDenoise.Cmethod = "MAN"; } - if (keyFile.has_key ("Directional Pyramid Denoising", "C2Method")) { - dirpyrDenoise.C2method = keyFile.get_string ("Directional Pyramid Denoising", "C2Method"); - - if (pedited) { - pedited->dirpyrDenoise.C2method = true; - } - } - + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "C2Method", pedited, dirpyrDenoise.C2method, pedited->dirpyrDenoise.C2method); if (dirpyrDenoise.C2method == "PREV") { dirpyrDenoise.C2method = "MANU"; } - if (keyFile.has_key ("Directional Pyramid Denoising", "SMethod")) { - dirpyrDenoise.smethod = keyFile.get_string ("Directional Pyramid Denoising", "SMethod"); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "SMethod", pedited, dirpyrDenoise.smethod, pedited->dirpyrDenoise.smethod); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "MedMethod", pedited, dirpyrDenoise.medmethod, pedited->dirpyrDenoise.medmethod); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "MethodMed", pedited, dirpyrDenoise.methodmed, pedited->dirpyrDenoise.methodmed); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "RGBMethod", pedited, dirpyrDenoise.rgbmethod, pedited->dirpyrDenoise.rgbmethod); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "LCurve", pedited, dirpyrDenoise.lcurve, pedited->dirpyrDenoise.lcurve); - if (pedited) { - pedited->dirpyrDenoise.smethod = true; - } - } + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "CCCurve", pedited, dirpyrDenoise.cccurve, pedited->dirpyrDenoise.cccurve); - if (keyFile.has_key ("Directional Pyramid Denoising", "MedMethod")) { - dirpyrDenoise.medmethod = keyFile.get_string ("Directional Pyramid Denoising", "MedMethod"); - - if (pedited) { - pedited->dirpyrDenoise.medmethod = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "MethodMed")) { - dirpyrDenoise.methodmed = keyFile.get_string ("Directional Pyramid Denoising", "MethodMed"); - - if (pedited) { - pedited->dirpyrDenoise.methodmed = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "RGBMethod")) { - dirpyrDenoise.rgbmethod = keyFile.get_string ("Directional Pyramid Denoising", "RGBMethod"); - - if (pedited) { - pedited->dirpyrDenoise.rgbmethod = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "LCurve")) { - dirpyrDenoise.lcurve = keyFile.get_double_list ("Directional Pyramid Denoising", "LCurve"); - avoidEmptyCurve (dirpyrDenoise.lcurve); - - if (pedited) { - pedited->dirpyrDenoise.lcurve = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "CCCurve")) { - dirpyrDenoise.cccurve = keyFile.get_double_list ("Directional Pyramid Denoising", "CCCurve"); - avoidEmptyCurve (dirpyrDenoise.cccurve); - - if (pedited) { - pedited->dirpyrDenoise.cccurve = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Redchro")) { - dirpyrDenoise.redchro = keyFile.get_double ("Directional Pyramid Denoising", "Redchro"); - - if (pedited) { - pedited->dirpyrDenoise.redchro = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Bluechro")) { - dirpyrDenoise.bluechro = keyFile.get_double ("Directional Pyramid Denoising", "Bluechro"); - - if (pedited) { - pedited->dirpyrDenoise.bluechro = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Gamma")) { - dirpyrDenoise.gamma = keyFile.get_double ("Directional Pyramid Denoising", "Gamma"); - - if (pedited) { - pedited->dirpyrDenoise.gamma = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Denoising", "Passes")) { - dirpyrDenoise.passes = keyFile.get_integer ("Directional Pyramid Denoising", "Passes"); - - if (pedited) { - pedited->dirpyrDenoise.passes = true; - } - } + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Redchro", pedited, dirpyrDenoise.redchro, pedited->dirpyrDenoise.redchro); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Bluechro", pedited, dirpyrDenoise.bluechro, pedited->dirpyrDenoise.bluechro); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Gamma", pedited, dirpyrDenoise.gamma, pedited->dirpyrDenoise.gamma); + assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Passes", pedited, dirpyrDenoise.passes, pedited->dirpyrDenoise.passes); } //Load EPD. if (keyFile.has_group ("EPD")) { - if (keyFile.has_key ("EPD", "Enabled")) { - epd.enabled = keyFile.get_boolean ("EPD", "Enabled"); - - if (pedited) { - pedited->epd.enabled = true; - } - } - - if (keyFile.has_key ("EPD", "Strength")) { - epd.strength = keyFile.get_double ("EPD", "Strength"); - - if (pedited) { - pedited->epd.strength = true; - } - } - - if (keyFile.has_key ("EPD", "Gamma")) { - epd.gamma = keyFile.get_double ("EPD", "Gamma"); - - if (pedited) { - pedited->epd.gamma = true; - } - } - - if (keyFile.has_key ("EPD", "EdgeStopping")) { - epd.edgeStopping = keyFile.get_double ("EPD", "EdgeStopping"); - - if (pedited) { - pedited->epd.edgeStopping = true; - } - } - - if (keyFile.has_key ("EPD", "Scale")) { - epd.scale = keyFile.get_double ("EPD", "Scale"); - - if (pedited) { - pedited->epd.scale = true; - } - } - - if (keyFile.has_key ("EPD", "ReweightingIterates")) { - epd.reweightingIterates = keyFile.get_integer ("EPD", "ReweightingIterates"); - - if (pedited) { - pedited->epd.reweightingIterates = true; - } - } + assignFromKeyfile(keyFile, "EPD", "Enabled", pedited, epd.enabled, pedited->epd.enabled); + assignFromKeyfile(keyFile, "EPD", "Strength", pedited, epd.strength, pedited->epd.strength); + assignFromKeyfile(keyFile, "EPD", "Gamma", pedited, epd.gamma, pedited->epd.gamma); + assignFromKeyfile(keyFile, "EPD", "EdgeStopping", pedited, epd.edgeStopping, pedited->epd.edgeStopping); + assignFromKeyfile(keyFile, "EPD", "Scale", pedited, epd.scale, pedited->epd.scale); + assignFromKeyfile(keyFile, "EPD", "ReweightingIterates", pedited, epd.reweightingIterates, pedited->epd.reweightingIterates); } //Load FattalToneMapping if (keyFile.has_group ("FattalToneMapping")) { - if (keyFile.has_key ("FattalToneMapping", "Enabled")) { - fattal.enabled = keyFile.get_boolean ("FattalToneMapping", "Enabled"); - - if (pedited) { - pedited->fattal.enabled = true; - } - } - - if (keyFile.has_key ("FattalToneMapping", "Threshold")) { - fattal.threshold = keyFile.get_double ("FattalToneMapping", "Threshold"); - - if (pedited) { - pedited->fattal.threshold = true; - } - } - - if (keyFile.has_key ("FattalToneMapping", "Amount")) { - fattal.amount = keyFile.get_double ("FattalToneMapping", "Amount"); - - if (pedited) { - pedited->fattal.amount = true; - } - } - } + assignFromKeyfile(keyFile, "FattalToneMapping", "Enabled", pedited, fattal.enabled, pedited->fattal.enabled); + assignFromKeyfile(keyFile, "FattalToneMapping", "Threshold", pedited, fattal.threshold, pedited->fattal.threshold); + assignFromKeyfile(keyFile, "FattalToneMapping", "Amount", pedited, fattal.amount, pedited->fattal.amount); + } // load lumaDenoise /*if (keyFile.has_group ("Luminance Denoising")) { @@ -5647,97 +2984,21 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) // load sh if (keyFile.has_group ("Shadows & Highlights")) { - if (keyFile.has_key ("Shadows & Highlights", "Enabled")) { - sh.enabled = keyFile.get_boolean ("Shadows & Highlights", "Enabled"); - - if (pedited) { - pedited->sh.enabled = true; - } - } - - if (keyFile.has_key ("Shadows & Highlights", "HighQuality")) { - sh.hq = keyFile.get_boolean ("Shadows & Highlights", "HighQuality"); - - if (pedited) { - pedited->sh.hq = true; - } - } - - if (keyFile.has_key ("Shadows & Highlights", "Highlights")) { - sh.highlights = keyFile.get_integer ("Shadows & Highlights", "Highlights"); - - if (pedited) { - pedited->sh.highlights = true; - } - } - - if (keyFile.has_key ("Shadows & Highlights", "HighlightTonalWidth")) { - sh.htonalwidth = keyFile.get_integer ("Shadows & Highlights", "HighlightTonalWidth"); - - if (pedited) { - pedited->sh.htonalwidth = true; - } - } - - if (keyFile.has_key ("Shadows & Highlights", "Shadows")) { - sh.shadows = keyFile.get_integer ("Shadows & Highlights", "Shadows"); - - if (pedited) { - pedited->sh.shadows = true; - } - } - - if (keyFile.has_key ("Shadows & Highlights", "ShadowTonalWidth")) { - sh.stonalwidth = keyFile.get_integer ("Shadows & Highlights", "ShadowTonalWidth"); - - if (pedited) { - pedited->sh.stonalwidth = true; - } - } - - if (keyFile.has_key ("Shadows & Highlights", "LocalContrast")) { - sh.localcontrast = keyFile.get_integer ("Shadows & Highlights", "LocalContrast"); - - if (pedited) { - pedited->sh.localcontrast = true; - } - } - - if (keyFile.has_key ("Shadows & Highlights", "Radius")) { - sh.radius = keyFile.get_integer ("Shadows & Highlights", "Radius"); - - if (pedited) { - pedited->sh.radius = true; - } - } + assignFromKeyfile(keyFile, "Shadows & Highlights", "Enabled", pedited, sh.enabled, pedited->sh.enabled); + assignFromKeyfile(keyFile, "Shadows & Highlights", "HighQuality", pedited, sh.hq, pedited->sh.hq); + assignFromKeyfile(keyFile, "Shadows & Highlights", "Highlights", pedited, sh.highlights, pedited->sh.highlights); + assignFromKeyfile(keyFile, "Shadows & Highlights", "HighlightTonalWidth", pedited, sh.htonalwidth, pedited->sh.htonalwidth); + assignFromKeyfile(keyFile, "Shadows & Highlights", "Shadows", pedited, sh.shadows, pedited->sh.shadows); + assignFromKeyfile(keyFile, "Shadows & Highlights", "ShadowTonalWidth", pedited, sh.stonalwidth, pedited->sh.stonalwidth); + assignFromKeyfile(keyFile, "Shadows & Highlights", "LocalContrast", pedited, sh.localcontrast, pedited->sh.localcontrast); + assignFromKeyfile(keyFile, "Shadows & Highlights", "Radius", pedited, sh.radius, pedited->sh.radius); } // load crop if (keyFile.has_group ("Crop")) { - if (keyFile.has_key ("Crop", "Enabled")) { - crop.enabled = keyFile.get_boolean ("Crop", "Enabled"); - - if (pedited) { - pedited->crop.enabled = true; - } - } - - if (keyFile.has_key ("Crop", "X")) { - crop.x = keyFile.get_integer ("Crop", "X"); - - if (pedited) { - pedited->crop.x = true; - } - } - - if (keyFile.has_key ("Crop", "Y")) { - crop.y = keyFile.get_integer ("Crop", "Y"); - - if (pedited) { - pedited->crop.y = true; - } - } - + assignFromKeyfile(keyFile, "Crop", "Enabled", pedited, crop.enabled, pedited->crop.enabled); + assignFromKeyfile(keyFile, "Crop", "X", pedited, crop.x, pedited->crop.x); + assignFromKeyfile(keyFile, "Crop", "Y", pedited, crop.y, pedited->crop.y); if (keyFile.has_key ("Crop", "W")) { crop.w = std::max (keyFile.get_integer ("Crop", "W"), 1); @@ -5754,22 +3015,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Crop", "FixedRatio")) { - crop.fixratio = keyFile.get_boolean ("Crop", "FixedRatio"); - - if (pedited) { - pedited->crop.fixratio = true; - } - } - - if (keyFile.has_key ("Crop", "Ratio")) { - crop.ratio = keyFile.get_string ("Crop", "Ratio"); - - if (pedited) { - pedited->crop.ratio = true; - } - -//backwards compatibility for crop.ratio + assignFromKeyfile(keyFile, "Crop", "FixedRatio", pedited, crop.fixratio, pedited->crop.fixratio); + if (assignFromKeyfile(keyFile, "Crop", "Ratio", pedited, crop.ratio, pedited->crop.ratio)) { + //backwards compatibility for crop.ratio if (crop.ratio == "DIN") { crop.ratio = "1.414 - DIN EN ISO 216"; } @@ -5782,82 +3030,30 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) crop.ratio = "11:17 - Tabloid"; } } - - if (keyFile.has_key ("Crop", "Orientation")) { - crop.orientation = keyFile.get_string ("Crop", "Orientation"); - - if (pedited) { - pedited->crop.orientation = true; - } - } - - if (keyFile.has_key ("Crop", "Guide")) { - crop.guide = keyFile.get_string ("Crop", "Guide"); - - if (pedited) { - pedited->crop.guide = true; - } - } + assignFromKeyfile(keyFile, "Crop", "Orientation", pedited, crop.orientation, pedited->crop.orientation); + assignFromKeyfile(keyFile, "Crop", "Guide", pedited, crop.guide, pedited->crop.guide); } // load coarse if (keyFile.has_group ("Coarse Transformation")) { - if (keyFile.has_key ("Coarse Transformation", "Rotate")) { - coarse.rotate = keyFile.get_integer ("Coarse Transformation", "Rotate"); - - if (pedited) { - pedited->coarse.rotate = true; - } - } - - if (keyFile.has_key ("Coarse Transformation", "HorizontalFlip")) { - coarse.hflip = keyFile.get_boolean ("Coarse Transformation", "HorizontalFlip"); - - if (pedited) { - pedited->coarse.hflip = true; - } - } - - if (keyFile.has_key ("Coarse Transformation", "VerticalFlip")) { - coarse.vflip = keyFile.get_boolean ("Coarse Transformation", "VerticalFlip"); - - if (pedited) { - pedited->coarse.vflip = true; - } - } + assignFromKeyfile(keyFile, "Coarse Transformation", "Rotate", pedited, coarse.rotate, pedited->coarse.rotate); + assignFromKeyfile(keyFile, "Coarse Transformation", "HorizontalFlip", pedited, coarse.hflip, pedited->coarse.hflip); + assignFromKeyfile(keyFile, "Coarse Transformation", "VerticalFlip", pedited, coarse.vflip, pedited->coarse.vflip); } // load rotate if (keyFile.has_group ("Rotation")) { - if (keyFile.has_key ("Rotation", "Degree")) { - rotate.degree = keyFile.get_double ("Rotation", "Degree"); - - if (pedited) { - pedited->rotate.degree = true; - } - } + assignFromKeyfile(keyFile, "Rotation", "Degree", pedited, rotate.degree, pedited->rotate.degree); } // load commonTrans if (keyFile.has_group ("Common Properties for Transformations")) { - if (keyFile.has_key ("Common Properties for Transformations", "AutoFill")) { - commonTrans.autofill = keyFile.get_boolean ("Common Properties for Transformations", "AutoFill"); - - if (pedited) { - pedited->commonTrans.autofill = true; - } - } + assignFromKeyfile(keyFile, "Common Properties for Transformations", "AutoFill", pedited, commonTrans.autofill, pedited->commonTrans.autofill); } // load distortion if (keyFile.has_group ("Distortion")) { - if (keyFile.has_key ("Distortion", "Amount")) { - distortion.amount = keyFile.get_double ("Distortion", "Amount"); - - if (pedited) { - pedited->distortion.amount = true; - } - } + assignFromKeyfile(keyFile, "Distortion", "Amount", pedited, distortion.amount, pedited->distortion.amount); } // lens profile @@ -5882,30 +3078,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("LensProfile", "UseDistortion")) { - lensProf.useDist = keyFile.get_boolean ("LensProfile", "UseDistortion"); - - if (pedited) { - pedited->lensProf.useDist = true; - } - } - - if (keyFile.has_key ("LensProfile", "UseVignette")) { - lensProf.useVign = keyFile.get_boolean ("LensProfile", "UseVignette"); - - if (pedited) { - pedited->lensProf.useVign = true; - } - } - - if (keyFile.has_key ("LensProfile", "UseCA")) { - lensProf.useCA = keyFile.get_boolean ("LensProfile", "UseCA"); - - if (pedited) { - pedited->lensProf.useCA = true; - } - } - + assignFromKeyfile(keyFile, "LensProfile", "UseDistortion", pedited, lensProf.useDist, pedited->lensProf.useDist); + assignFromKeyfile(keyFile, "LensProfile", "UseVignette", pedited, lensProf.useVign, pedited->lensProf.useVign); + assignFromKeyfile(keyFile, "LensProfile", "UseCA", pedited, lensProf.useCA, pedited->lensProf.useCA); if (keyFile.has_key("LensProfile", "LFCameraMake")) { lensProf.lfCameraMake = keyFile.get_string("LensProfile", "LFCameraMake"); if (pedited) { @@ -5930,255 +3105,58 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) // load perspective correction if (keyFile.has_group ("Perspective")) { - if (keyFile.has_key ("Perspective", "Horizontal")) { - perspective.horizontal = keyFile.get_double ("Perspective", "Horizontal"); - - if (pedited) { - pedited->perspective.horizontal = true; - } - } - - if (keyFile.has_key ("Perspective", "Vertical")) { - perspective.vertical = keyFile.get_double ("Perspective", "Vertical"); - - if (pedited) { - pedited->perspective.vertical = true; - } - } + assignFromKeyfile(keyFile, "Perspective", "Horizontal", pedited, perspective.horizontal, pedited->perspective.horizontal); + assignFromKeyfile(keyFile, "Perspective", "Vertical", pedited, perspective.vertical, pedited->perspective.vertical); } // load gradient if (keyFile.has_group ("Gradient")) { - if (keyFile.has_key ("Gradient", "Enabled")) { - gradient.enabled = keyFile.get_boolean ("Gradient", "Enabled"); - - if (pedited) { - pedited->gradient.enabled = true; - } - } - - if (keyFile.has_key ("Gradient", "Degree")) { - gradient.degree = keyFile.get_double ("Gradient", "Degree"); - - if (pedited) { - pedited->gradient.degree = true; - } - } - - if (keyFile.has_key ("Gradient", "Feather")) { - gradient.feather = keyFile.get_integer ("Gradient", "Feather"); - - if (pedited) { - pedited->gradient.feather = true; - } - } - - if (keyFile.has_key ("Gradient", "Strength")) { - gradient.strength = keyFile.get_double ("Gradient", "Strength"); - - if (pedited) { - pedited->gradient.strength = true; - } - } - - if (keyFile.has_key ("Gradient", "CenterX")) { - gradient.centerX = keyFile.get_integer ("Gradient", "CenterX"); - - if (pedited) { - pedited->gradient.centerX = true; - } - } - - if (keyFile.has_key ("Gradient", "CenterY")) { - gradient.centerY = keyFile.get_integer ("Gradient", "CenterY"); - - if (pedited) { - pedited->gradient.centerY = true; - } - } + assignFromKeyfile(keyFile, "Gradient", "Enabled", pedited, gradient.enabled, pedited->gradient.enabled); + assignFromKeyfile(keyFile, "Gradient", "Degree", pedited, gradient.degree, pedited->gradient.degree); + assignFromKeyfile(keyFile, "Gradient", "Feather", pedited, gradient.feather, pedited->gradient.feather); + assignFromKeyfile(keyFile, "Gradient", "Strength", pedited, gradient.strength, pedited->gradient.strength); + assignFromKeyfile(keyFile, "Gradient", "CenterX", pedited, gradient.centerX, pedited->gradient.centerX); + assignFromKeyfile(keyFile, "Gradient", "CenterY", pedited, gradient.centerY, pedited->gradient.centerY); } if (keyFile.has_group ("PCVignette")) { - if (keyFile.has_key ("PCVignette", "Enabled")) { - pcvignette.enabled = keyFile.get_boolean ("PCVignette", "Enabled"); - - if (pedited) { - pedited->pcvignette.enabled = true; - } - } - - if (keyFile.has_key ("PCVignette", "Strength")) { - pcvignette.strength = keyFile.get_double ("PCVignette", "Strength"); - - if (pedited) { - pedited->pcvignette.strength = true; - } - } - - if (keyFile.has_key ("PCVignette", "Feather")) { - pcvignette.feather = keyFile.get_integer ("PCVignette", "Feather"); - - if (pedited) { - pedited->pcvignette.feather = true; - } - } - - if (keyFile.has_key ("PCVignette", "Roundness")) { - pcvignette.roundness = keyFile.get_integer ("PCVignette", "Roundness"); - - if (pedited) { - pedited->pcvignette.roundness = true; - } - } + assignFromKeyfile(keyFile, "PCVignette", "Enabled", pedited, pcvignette.enabled, pedited->pcvignette.enabled); + assignFromKeyfile(keyFile, "PCVignette", "Strength", pedited, pcvignette.strength, pedited->pcvignette.strength); + assignFromKeyfile(keyFile, "PCVignette", "Feather", pedited, pcvignette.feather, pedited->pcvignette.feather); + assignFromKeyfile(keyFile, "PCVignette", "Roundness", pedited, pcvignette.roundness, pedited->pcvignette.roundness); } // load c/a correction if (keyFile.has_group ("CACorrection")) { - if (keyFile.has_key ("CACorrection", "Red")) { - cacorrection.red = keyFile.get_double ("CACorrection", "Red"); - - if (pedited) { - pedited->cacorrection.red = true; - } - } - - if (keyFile.has_key ("CACorrection", "Blue")) { - cacorrection.blue = keyFile.get_double ("CACorrection", "Blue"); - - if (pedited) { - pedited->cacorrection.blue = true; - } - } + assignFromKeyfile(keyFile, "CACorrection", "Red", pedited, cacorrection.red, pedited->cacorrection.red); + assignFromKeyfile(keyFile, "CACorrection", "Blue", pedited, cacorrection.blue, pedited->cacorrection.blue); } // load vignetting correction if (keyFile.has_group ("Vignetting Correction")) { - if (keyFile.has_key ("Vignetting Correction", "Amount")) { - vignetting.amount = keyFile.get_integer ("Vignetting Correction", "Amount"); - - if (pedited) { - pedited->vignetting.amount = true; - } - } - - if (keyFile.has_key ("Vignetting Correction", "Radius")) { - vignetting.radius = keyFile.get_integer ("Vignetting Correction", "Radius"); - - if (pedited) { - pedited->vignetting.radius = true; - } - } - - if (keyFile.has_key ("Vignetting Correction", "Strength")) { - vignetting.strength = keyFile.get_integer ("Vignetting Correction", "Strength"); - - if (pedited) { - pedited->vignetting.strength = true; - } - } - - if (keyFile.has_key ("Vignetting Correction", "CenterX")) { - vignetting.centerX = keyFile.get_integer ("Vignetting Correction", "CenterX"); - - if (pedited) { - pedited->vignetting.centerX = true; - } - } - - if (keyFile.has_key ("Vignetting Correction", "CenterY")) { - vignetting.centerY = keyFile.get_integer ("Vignetting Correction", "CenterY"); - - if (pedited) { - pedited->vignetting.centerY = true; - } - } + assignFromKeyfile(keyFile, "Vignetting Correction", "Amount", pedited, vignetting.amount, pedited->vignetting.amount); + assignFromKeyfile(keyFile, "Vignetting Correction", "Radius", pedited, vignetting.radius, pedited->vignetting.radius); + assignFromKeyfile(keyFile, "Vignetting Correction", "Strength", pedited, vignetting.strength, pedited->vignetting.strength); + assignFromKeyfile(keyFile, "Vignetting Correction", "CenterX", pedited, vignetting.centerX, pedited->vignetting.centerX); + assignFromKeyfile(keyFile, "Vignetting Correction", "CenterY", pedited, vignetting.centerY, pedited->vignetting.centerY); } // load resize settings if (keyFile.has_group ("Resize")) { - if (keyFile.has_key ("Resize", "Enabled")) { - resize.enabled = keyFile.get_boolean ("Resize", "Enabled"); - - if (pedited) { - pedited->resize.enabled = true; - } - } - - if (keyFile.has_key ("Resize", "Scale")) { - resize.scale = keyFile.get_double ("Resize", "Scale"); - - if (pedited) { - pedited->resize.scale = true; - } - } - - if (keyFile.has_key ("Resize", "AppliesTo")) { - resize.appliesTo = keyFile.get_string ("Resize", "AppliesTo"); - - if (pedited) { - pedited->resize.appliesTo = true; - } - } - - if (keyFile.has_key ("Resize", "Method")) { - resize.method = keyFile.get_string ("Resize", "Method"); - - if (pedited) { - pedited->resize.method = true; - } - } - - if (keyFile.has_key ("Resize", "DataSpecified")) { - resize.dataspec = keyFile.get_integer ("Resize", "DataSpecified"); - - if (pedited) { - pedited->resize.dataspec = true; - } - } - - if (keyFile.has_key ("Resize", "Width")) { - resize.width = keyFile.get_integer ("Resize", "Width"); - - if (pedited) { - pedited->resize.width = true; - } - } - - if (keyFile.has_key ("Resize", "Height")) { - resize.height = keyFile.get_integer ("Resize", "Height"); - - if (pedited) { - pedited->resize.height = true; - } - } + assignFromKeyfile(keyFile, "Resize", "Enabled", pedited, resize.enabled, pedited->resize.enabled); + assignFromKeyfile(keyFile, "Resize", "Scale", pedited, resize.scale, pedited->resize.scale); + assignFromKeyfile(keyFile, "Resize", "AppliesTo", pedited, resize.appliesTo, pedited->resize.appliesTo); + assignFromKeyfile(keyFile, "Resize", "Method", pedited, resize.method, pedited->resize.method); + assignFromKeyfile(keyFile, "Resize", "DataSpecified", pedited, resize.dataspec, pedited->resize.dataspec); + assignFromKeyfile(keyFile, "Resize", "Width", pedited, resize.width, pedited->resize.width); + assignFromKeyfile(keyFile, "Resize", "Height", pedited, resize.height, pedited->resize.height); } // load post resize sharpening if (keyFile.has_group ("PostResizeSharpening")) { - if (keyFile.has_key ("PostResizeSharpening", "Enabled")) { - prsharpening.enabled = keyFile.get_boolean ("PostResizeSharpening", "Enabled"); - - if (pedited) { - pedited->prsharpening.enabled = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "Radius")) { - prsharpening.radius = keyFile.get_double ("PostResizeSharpening", "Radius"); - - if (pedited) { - pedited->prsharpening.radius = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "Amount")) { - prsharpening.amount = keyFile.get_integer ("PostResizeSharpening", "Amount"); - - if (pedited) { - pedited->prsharpening.amount = true; - } - } - + assignFromKeyfile(keyFile, "PostResizeSharpening", "Enabled", pedited, prsharpening.enabled, pedited->prsharpening.enabled); + assignFromKeyfile(keyFile, "PostResizeSharpening", "Radius", pedited, prsharpening.radius, pedited->prsharpening.radius); + assignFromKeyfile(keyFile, "PostResizeSharpening", "Amount", pedited, prsharpening.amount, pedited->prsharpening.amount); if (keyFile.has_key ("PostResizeSharpening", "Threshold")) { if (ppVersion < 302) { int thresh = min (keyFile.get_integer ("PostResizeSharpening", "Threshold"), 2000); @@ -6196,85 +3174,16 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("PostResizeSharpening", "OnlyEdges")) { - prsharpening.edgesonly = keyFile.get_boolean ("PostResizeSharpening", "OnlyEdges"); - - if (pedited) { - pedited->prsharpening.edgesonly = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "EdgedetectionRadius")) { - prsharpening.edges_radius = keyFile.get_double ("PostResizeSharpening", "EdgedetectionRadius"); - - if (pedited) { - pedited->prsharpening.edges_radius = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "EdgeTolerance")) { - prsharpening.edges_tolerance = keyFile.get_integer ("PostResizeSharpening", "EdgeTolerance"); - - if (pedited) { - pedited->prsharpening.edges_tolerance = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "HalocontrolEnabled")) { - prsharpening.halocontrol = keyFile.get_boolean ("PostResizeSharpening", "HalocontrolEnabled"); - - if (pedited) { - pedited->prsharpening.halocontrol = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "HalocontrolAmount")) { - prsharpening.halocontrol_amount = keyFile.get_integer ("PostResizeSharpening", "HalocontrolAmount"); - - if (pedited) { - pedited->prsharpening.halocontrol_amount = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "Method")) { - prsharpening.method = keyFile.get_string ("PostResizeSharpening", "Method"); - - if (pedited) { - pedited->prsharpening.method = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "DeconvRadius")) { - prsharpening.deconvradius = keyFile.get_double ("PostResizeSharpening", "DeconvRadius"); - - if (pedited) { - pedited->prsharpening.deconvradius = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "DeconvAmount")) { - prsharpening.deconvamount = keyFile.get_integer ("PostResizeSharpening", "DeconvAmount"); - - if (pedited) { - pedited->prsharpening.deconvamount = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "DeconvDamping")) { - prsharpening.deconvdamping = keyFile.get_integer ("PostResizeSharpening", "DeconvDamping"); - - if (pedited) { - pedited->prsharpening.deconvdamping = true; - } - } - - if (keyFile.has_key ("PostResizeSharpening", "DeconvIterations")) { - prsharpening.deconviter = keyFile.get_integer ("PostResizeSharpening", "DeconvIterations"); - - if (pedited) { - pedited->prsharpening.deconviter = true; - } - } + assignFromKeyfile(keyFile, "PostResizeSharpening", "OnlyEdges", pedited, prsharpening.edgesonly, pedited->prsharpening.edgesonly); + assignFromKeyfile(keyFile, "PostResizeSharpening", "EdgedetectionRadius", pedited, prsharpening.edges_radius, pedited->prsharpening.edges_radius); + assignFromKeyfile(keyFile, "PostResizeSharpening", "EdgeTolerance", pedited, prsharpening.edges_tolerance, pedited->prsharpening.edges_tolerance); + assignFromKeyfile(keyFile, "PostResizeSharpening", "HalocontrolEnabled", pedited, prsharpening.halocontrol, pedited->prsharpening.halocontrol); + assignFromKeyfile(keyFile, "PostResizeSharpening", "HalocontrolAmount", pedited, prsharpening.halocontrol_amount, pedited->prsharpening.halocontrol_amount); + assignFromKeyfile(keyFile, "PostResizeSharpening", "Method", pedited, prsharpening.method, pedited->prsharpening.method); + assignFromKeyfile(keyFile, "PostResizeSharpening", "DeconvRadius", pedited, prsharpening.deconvradius, pedited->prsharpening.deconvradius); + assignFromKeyfile(keyFile, "PostResizeSharpening", "DeconvAmount", pedited, prsharpening.deconvamount, pedited->prsharpening.deconvamount); + assignFromKeyfile(keyFile, "PostResizeSharpening", "DeconvDamping", pedited, prsharpening.deconvdamping, pedited->prsharpening.deconvdamping); + assignFromKeyfile(keyFile, "PostResizeSharpening", "DeconvIterations", pedited, prsharpening.deconviter, pedited->prsharpening.deconviter); } // load color management settings @@ -6287,62 +3196,13 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Color Management", "ToneCurve")) { - icm.toneCurve = keyFile.get_boolean ("Color Management", "ToneCurve"); - - if (pedited) { - pedited->icm.toneCurve = true; - } - } - - if (keyFile.has_key ("Color Management", "ApplyLookTable")) { - icm.applyLookTable = keyFile.get_boolean ("Color Management", "ApplyLookTable"); - - if (pedited) { - pedited->icm.applyLookTable = true; - } - } - - if (keyFile.has_key ("Color Management", "ApplyBaselineExposureOffset")) { - icm.applyBaselineExposureOffset = keyFile.get_boolean ("Color Management", "ApplyBaselineExposureOffset"); - - if (pedited) { - pedited->icm.applyBaselineExposureOffset = true; - } - } - - if (keyFile.has_key ("Color Management", "ApplyHueSatMap")) { - icm.applyHueSatMap = keyFile.get_boolean ("Color Management", "ApplyHueSatMap"); - - if (pedited) { - pedited->icm.applyHueSatMap = true; - } - } - - if (keyFile.has_key ("Color Management", "DCPIlluminant")) { - icm.dcpIlluminant = keyFile.get_integer ("Color Management", "DCPIlluminant"); - - if (pedited) { - pedited->icm.dcpIlluminant = true; - } - } - - if (keyFile.has_key ("Color Management", "WorkingProfile")) { - icm.working = keyFile.get_string ("Color Management", "WorkingProfile"); - - if (pedited) { - pedited->icm.working = true; - } - } - - if (keyFile.has_key ("Color Management", "OutputProfile")) { - icm.output = keyFile.get_string ("Color Management", "OutputProfile"); - - if (pedited) { - pedited->icm.output = true; - } - } - + assignFromKeyfile(keyFile, "Color Management", "ToneCurve", pedited, icm.toneCurve, pedited->icm.toneCurve); + assignFromKeyfile(keyFile, "Color Management", "ApplyLookTable", pedited, icm.applyLookTable, pedited->icm.applyLookTable); + assignFromKeyfile(keyFile, "Color Management", "ApplyBaselineExposureOffset", pedited, icm.applyBaselineExposureOffset, pedited->icm.applyBaselineExposureOffset); + assignFromKeyfile(keyFile, "Color Management", "ApplyHueSatMap", pedited, icm.applyHueSatMap, pedited->icm.applyHueSatMap); + assignFromKeyfile(keyFile, "Color Management", "DCPIlluminant", pedited, icm.dcpIlluminant, pedited->icm.dcpIlluminant); + assignFromKeyfile(keyFile, "Color Management", "WorkingProfile", pedited, icm.working, pedited->icm.working); + assignFromKeyfile(keyFile, "Color Management", "OutputProfile", pedited, icm.output, pedited->icm.output); if (keyFile.has_key ("Color Management", "OutputProfileIntent")) { Glib::ustring intent = keyFile.get_string ("Color Management", "OutputProfileIntent"); @@ -6361,554 +3221,85 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Color Management", "OutputBPC")) { - icm.outputBPC = keyFile.get_boolean ("Color Management", "OutputBPC"); - - if (pedited) { - pedited->icm.outputBPC = true; - } - } - - if (keyFile.has_key ("Color Management", "Gammafree")) { - icm.gamma = keyFile.get_string ("Color Management", "Gammafree"); - - if (pedited) { - pedited->icm.gamfree = true; - } - } - - if (keyFile.has_key ("Color Management", "Freegamma")) { - icm.freegamma = keyFile.get_boolean ("Color Management", "Freegamma"); - - if (pedited) { - pedited->icm.freegamma = true; - } - } - - if (keyFile.has_key ("Color Management", "GammaValue")) { - icm.gampos = keyFile.get_double ("Color Management", "GammaValue"); - - if (pedited) { - pedited->icm.gampos = true; - } - } - - if (keyFile.has_key ("Color Management", "GammaSlope")) { - icm.slpos = keyFile.get_double ("Color Management", "GammaSlope"); - - if (pedited) { - pedited->icm.slpos = true; - } - } - + assignFromKeyfile(keyFile, "Color Management", "OutputBPC", pedited, icm.outputBPC, pedited->icm.outputBPC); + assignFromKeyfile(keyFile, "Color Management", "Gammafree", pedited, icm.gamma, pedited->icm.gamfree); + assignFromKeyfile(keyFile, "Color Management", "Freegamma", pedited, icm.freegamma, pedited->icm.freegamma); + assignFromKeyfile(keyFile, "Color Management", "GammaValue", pedited, icm.gampos, pedited->icm.gampos); + assignFromKeyfile(keyFile, "Color Management", "GammaSlope", pedited, icm.slpos, pedited->icm.slpos); } // load wavelet wavelet parameters if (keyFile.has_group ("Wavelet")) { - if (keyFile.has_key ("Wavelet", "Enabled")) { - wavelet.enabled = keyFile.get_boolean ("Wavelet", "Enabled"); - - if (pedited) { - pedited->wavelet.enabled = true; - } - } - - if (keyFile.has_key ("Wavelet", "Strength")) { - wavelet.strength = keyFile.get_integer ("Wavelet", "Strength"); - - if (pedited) { - pedited->wavelet.strength = true; - } - } - - if (keyFile.has_key ("Wavelet", "Balance")) { - wavelet.balance = keyFile.get_integer ("Wavelet", "Balance"); - - if (pedited) { - pedited->wavelet.balance = true; - } - } - - if (keyFile.has_key ("Wavelet", "Iter")) { - wavelet.iter = keyFile.get_integer ("Wavelet", "Iter"); - - if (pedited) { - pedited->wavelet.iter = true; - } - } - - if (keyFile.has_key ("Wavelet", "Median")) { - wavelet.median = keyFile.get_boolean ("Wavelet", "Median"); - - if (pedited) { - pedited->wavelet.median = true; - } - } - - if (keyFile.has_key ("Wavelet", "Medianlev")) { - wavelet.medianlev = keyFile.get_boolean ("Wavelet", "Medianlev"); - - if (pedited) { - pedited->wavelet.medianlev = true; - } - } - - if (keyFile.has_key ("Wavelet", "Linkedg")) { - wavelet.linkedg = keyFile.get_boolean ("Wavelet", "Linkedg"); - - if (pedited) { - pedited->wavelet.linkedg = true; - } - } - - if (keyFile.has_key ("Wavelet", "CBenab")) { - wavelet.cbenab = keyFile.get_boolean ("Wavelet", "CBenab"); - - if (pedited) { - pedited->wavelet.cbenab = true; - } - } - - if (keyFile.has_key ("Wavelet", "CBgreenhigh")) { - wavelet.greenhigh = keyFile.get_integer ("Wavelet", "CBgreenhigh"); - - if (pedited) { - pedited->wavelet.greenhigh = true; - } - } - - if (keyFile.has_key ("Wavelet", "CBgreenmed")) { - wavelet.greenmed = keyFile.get_integer ("Wavelet", "CBgreenmed"); - - if (pedited) { - pedited->wavelet.greenmed = true; - } - } - - if (keyFile.has_key ("Wavelet", "CBgreenlow")) { - wavelet.greenlow = keyFile.get_integer ("Wavelet", "CBgreenlow"); - - if (pedited) { - pedited->wavelet.greenlow = true; - } - } - - if (keyFile.has_key ("Wavelet", "CBbluehigh")) { - wavelet.bluehigh = keyFile.get_integer ("Wavelet", "CBbluehigh"); - - if (pedited) { - pedited->wavelet.bluehigh = true; - } - } - - if (keyFile.has_key ("Wavelet", "CBbluemed")) { - wavelet.bluemed = keyFile.get_integer ("Wavelet", "CBbluemed"); - - if (pedited) { - pedited->wavelet.bluemed = true; - } - } - - if (keyFile.has_key ("Wavelet", "CBbluelow")) { - wavelet.bluelow = keyFile.get_integer ("Wavelet", "CBbluelow"); - - if (pedited) { - pedited->wavelet.bluelow = true; - } - } - + assignFromKeyfile(keyFile, "Wavelet", "Enabled", pedited, wavelet.enabled, pedited->wavelet.enabled); + assignFromKeyfile(keyFile, "Wavelet", "Strength", pedited, wavelet.strength, pedited->wavelet.strength); + assignFromKeyfile(keyFile, "Wavelet", "Balance", pedited, wavelet.balance, pedited->wavelet.balance); + assignFromKeyfile(keyFile, "Wavelet", "Iter", pedited, wavelet.iter, pedited->wavelet.iter); + assignFromKeyfile(keyFile, "Wavelet", "Median", pedited, wavelet.median, pedited->wavelet.median); + assignFromKeyfile(keyFile, "Wavelet", "Medianlev", pedited, wavelet.medianlev, pedited->wavelet.medianlev); + assignFromKeyfile(keyFile, "Wavelet", "Linkedg", pedited, wavelet.linkedg, pedited->wavelet.linkedg); + assignFromKeyfile(keyFile, "Wavelet", "CBenab", pedited, wavelet.cbenab, pedited->wavelet.cbenab); + assignFromKeyfile(keyFile, "Wavelet", "CBgreenhigh", pedited, wavelet.greenhigh, pedited->wavelet.greenhigh); + assignFromKeyfile(keyFile, "Wavelet", "CBgreenmed", pedited, wavelet.greenmed, pedited->wavelet.greenmed); + assignFromKeyfile(keyFile, "Wavelet", "CBgreenlow", pedited, wavelet.greenlow, pedited->wavelet.greenlow); + assignFromKeyfile(keyFile, "Wavelet", "CBbluehigh", pedited, wavelet.bluehigh, pedited->wavelet.bluehigh); + assignFromKeyfile(keyFile, "Wavelet", "CBbluemed", pedited, wavelet.bluemed, pedited->wavelet.bluemed); + assignFromKeyfile(keyFile, "Wavelet", "CBbluelow", pedited, wavelet.bluelow, pedited->wavelet.bluelow); // if (keyFile.has_key ("Wavelet", "Edgreinf")) {wavelet.edgreinf = keyFile.get_boolean ("Wavelet", "Edgreinf");if (pedited) pedited->wavelet.edgreinf = true;} - if (keyFile.has_key ("Wavelet", "Lipst")) { - wavelet.lipst = keyFile.get_boolean ("Wavelet", "Lipst"); - - if (pedited) { - pedited->wavelet.lipst = true; - } - } - - if (keyFile.has_key ("Wavelet", "AvoidColorShift")) { - wavelet.avoid = keyFile.get_boolean ("Wavelet", "AvoidColorShift"); - - if (pedited) { - pedited->wavelet.avoid = true; - } - } - - if (keyFile.has_key ("Wavelet", "TMr")) { - wavelet.tmr = keyFile.get_boolean ("Wavelet", "TMr"); - - if (pedited) { - pedited->wavelet.tmr = true; - } - } - - if (keyFile.has_key ("Wavelet", "LevMethod")) { - wavelet.Lmethod = keyFile.get_string ("Wavelet", "LevMethod"); - - if (pedited) { - pedited->wavelet.Lmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "ChoiceLevMethod")) { - wavelet.CLmethod = keyFile.get_string ("Wavelet", "ChoiceLevMethod"); - - if (pedited) { - pedited->wavelet.CLmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "BackMethod")) { - wavelet.Backmethod = keyFile.get_string ("Wavelet", "BackMethod"); - - if (pedited) { - pedited->wavelet.Backmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "TilesMethod")) { - wavelet.Tilesmethod = keyFile.get_string ("Wavelet", "TilesMethod"); - - if (pedited) { - pedited->wavelet.Tilesmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "DaubMethod")) { - wavelet.daubcoeffmethod = keyFile.get_string ("Wavelet", "DaubMethod"); - - if (pedited) { - pedited->wavelet.daubcoeffmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "CHromaMethod")) { - wavelet.CHmethod = keyFile.get_string ("Wavelet", "CHromaMethod"); - - if (pedited) { - pedited->wavelet.CHmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "Medgreinf")) { - wavelet.Medgreinf = keyFile.get_string ("Wavelet", "Medgreinf"); - - if (pedited) { - pedited->wavelet.Medgreinf = true; - } - } - - if (keyFile.has_key ("Wavelet", "CHSLromaMethod")) { - wavelet.CHSLmethod = keyFile.get_string ("Wavelet", "CHSLromaMethod"); - - if (pedited) { - pedited->wavelet.CHSLmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "EDMethod")) { - wavelet.EDmethod = keyFile.get_string ("Wavelet", "EDMethod"); - - if (pedited) { - pedited->wavelet.EDmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "NPMethod")) { - wavelet.NPmethod = keyFile.get_string ("Wavelet", "NPMethod"); - - if (pedited) { - pedited->wavelet.NPmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "BAMethod")) { - wavelet.BAmethod = keyFile.get_string ("Wavelet", "BAMethod"); - - if (pedited) { - pedited->wavelet.BAmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "TMMethod")) { - wavelet.TMmethod = keyFile.get_string ("Wavelet", "TMMethod"); - - if (pedited) { - pedited->wavelet.TMmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "HSMethod")) { - wavelet.HSmethod = keyFile.get_string ("Wavelet", "HSMethod"); - - if (pedited) { - pedited->wavelet.HSmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "DirMethod")) { - wavelet.Dirmethod = keyFile.get_string ("Wavelet", "DirMethod"); - - if (pedited) { - pedited->wavelet.Dirmethod = true; - } - } - - if (keyFile.has_key ("Wavelet", "ResidualcontShadow")) { - wavelet.rescon = keyFile.get_integer ("Wavelet", "ResidualcontShadow"); - - if (pedited) { - pedited->wavelet.rescon = true; - } - } - - if (keyFile.has_key ("Wavelet", "ResidualcontHighlight")) { - wavelet.resconH = keyFile.get_integer ("Wavelet", "ResidualcontHighlight"); - - if (pedited) { - pedited->wavelet.resconH = true; - } - } - - if (keyFile.has_key ("Wavelet", "Residualchroma")) { - wavelet.reschro = keyFile.get_integer ("Wavelet", "Residualchroma"); - - if (pedited) { - pedited->wavelet.reschro = true; - } - } - - if (keyFile.has_key ("Wavelet", "ResidualTM")) { - wavelet.tmrs = keyFile.get_double ("Wavelet", "ResidualTM"); - - if (pedited) { - pedited->wavelet.tmrs = true; - } - } - - if (keyFile.has_key ("Wavelet", "Residualgamma")) { - wavelet.gamma = keyFile.get_double ("Wavelet", "Residualgamma"); - - if (pedited) { - pedited->wavelet.gamma = true; - } - } - - if (keyFile.has_key ("Wavelet", "ContExtra")) { - wavelet.sup = keyFile.get_integer ("Wavelet", "ContExtra"); - - if (pedited) { - pedited->wavelet.sup = true; - } - } - - if (keyFile.has_key ("Wavelet", "HueRangeResidual")) { - wavelet.sky = keyFile.get_double ("Wavelet", "HueRangeResidual"); - - if (pedited) { - pedited->wavelet.sky = true; - } - } - - if (keyFile.has_key ("Wavelet", "MaxLev")) { - wavelet.thres = keyFile.get_integer ("Wavelet", "MaxLev"); - - if (pedited) { - pedited->wavelet.thres = true; - } - } - - if (keyFile.has_key ("Wavelet", "ThresholdHighLight")) { - wavelet.threshold = keyFile.get_integer ("Wavelet", "ThresholdHighLight"); - - if (pedited) { - pedited->wavelet.threshold = true; - } - } - - if (keyFile.has_key ("Wavelet", "ThresholdShadow")) { - wavelet.threshold2 = keyFile.get_integer ("Wavelet", "ThresholdShadow"); - - if (pedited) { - pedited->wavelet.threshold2 = true; - } - } - - if (keyFile.has_key ("Wavelet", "Edgedetect")) { - wavelet.edgedetect = keyFile.get_integer ("Wavelet", "Edgedetect"); - - if (pedited) { - pedited->wavelet.edgedetect = true; - } - } - - if (keyFile.has_key ("Wavelet", "Edgedetectthr")) { - wavelet.edgedetectthr = keyFile.get_integer ("Wavelet", "Edgedetectthr"); - - if (pedited) { - pedited->wavelet.edgedetectthr = true; - } - } - - if (keyFile.has_key ("Wavelet", "EdgedetectthrHi")) { - wavelet.edgedetectthr2 = keyFile.get_integer ("Wavelet", "EdgedetectthrHi"); - - if (pedited) { - pedited->wavelet.edgedetectthr2 = true; - } - } - - if (keyFile.has_key ("Wavelet", "Edgesensi")) { - wavelet.edgesensi = keyFile.get_integer ("Wavelet", "Edgesensi"); - - if (pedited) { - pedited->wavelet.edgesensi = true; - } - } - - if (keyFile.has_key ("Wavelet", "Edgeampli")) { - wavelet.edgeampli = keyFile.get_integer ("Wavelet", "Edgeampli"); - - if (pedited) { - pedited->wavelet.edgeampli = true; - } - } - - if (keyFile.has_key ("Wavelet", "ThresholdChroma")) { - wavelet.chroma = keyFile.get_integer ("Wavelet", "ThresholdChroma"); - - if (pedited) { - pedited->wavelet.chroma = true; - } - } - - if (keyFile.has_key ("Wavelet", "ChromaLink")) { - wavelet.chro = keyFile.get_integer ("Wavelet", "ChromaLink"); - - if (pedited) { - pedited->wavelet.chro = true; - } - } - - if (keyFile.has_key ("Wavelet", "Contrast")) { - wavelet.contrast = keyFile.get_integer ("Wavelet", "Contrast"); - - if (pedited) { - pedited->wavelet.contrast = true; - } - } - - if (keyFile.has_key ("Wavelet", "Edgrad")) { - wavelet.edgrad = keyFile.get_integer ("Wavelet", "Edgrad"); - - if (pedited) { - pedited->wavelet.edgrad = true; - } - } - - if (keyFile.has_key ("Wavelet", "Edgval")) { - wavelet.edgval = keyFile.get_integer ("Wavelet", "Edgval"); - - if (pedited) { - pedited->wavelet.edgval = true; - } - } - - if (keyFile.has_key ("Wavelet", "ThrEdg")) { - wavelet.edgthresh = keyFile.get_integer ("Wavelet", "ThrEdg"); - - if (pedited) { - pedited->wavelet.edgthresh = true; - } - } - - if (keyFile.has_key ("Wavelet", "ThresholdResidShadow")) { - wavelet.thr = keyFile.get_integer ("Wavelet", "ThresholdResidShadow"); - - if (pedited) { - pedited->wavelet.thr = true; - } - } - - if (keyFile.has_key ("Wavelet", "ThresholdResidHighLight")) { - wavelet.thrH = keyFile.get_integer ("Wavelet", "ThresholdResidHighLight"); - - if (pedited) { - pedited->wavelet.thrH = true; - } - } - - if (keyFile.has_key ("Wavelet", "ContrastCurve")) { - wavelet.ccwcurve = keyFile.get_double_list ("Wavelet", "ContrastCurve"); - avoidEmptyCurve (wavelet.ccwcurve); - - if (pedited) { - pedited->wavelet.ccwcurve = true; - } - } - - if (keyFile.has_key ("Wavelet", "OpacityCurveRG")) { - wavelet.opacityCurveRG = keyFile.get_double_list ("Wavelet", "OpacityCurveRG"); - avoidEmptyCurve (wavelet.opacityCurveRG); - - if (pedited) { - pedited->wavelet.opacityCurveRG = true; - } - } - - if (keyFile.has_key ("Wavelet", "OpacityCurveBY")) { - wavelet.opacityCurveBY = keyFile.get_double_list ("Wavelet", "OpacityCurveBY"); - avoidEmptyCurve (wavelet.opacityCurveBY); - - if (pedited) { - pedited->wavelet.opacityCurveBY = true; - } - } - - if (keyFile.has_key ("Wavelet", "OpacityCurveW")) { - wavelet.opacityCurveW = keyFile.get_double_list ("Wavelet", "OpacityCurveW"); - avoidEmptyCurve (wavelet.opacityCurveW); - - if (pedited) { - pedited->wavelet.opacityCurveW = true; - } - } - - if (keyFile.has_key ("Wavelet", "OpacityCurveWL")) { - wavelet.opacityCurveWL = keyFile.get_double_list ("Wavelet", "OpacityCurveWL"); - avoidEmptyCurve (wavelet.opacityCurveWL); - - if (pedited) { - pedited->wavelet.opacityCurveWL = true; - } - } - - if (keyFile.has_key ("Wavelet", "HHcurve")) { - wavelet.hhcurve = keyFile.get_double_list ("Wavelet", "HHcurve"); - avoidEmptyCurve (wavelet.hhcurve); - - if (pedited) { - pedited->wavelet.hhcurve = true; - } - } - - if (keyFile.has_key ("Wavelet", "CHcurve")) { - wavelet.Chcurve = keyFile.get_double_list ("Wavelet", "CHcurve"); - avoidEmptyCurve (wavelet.Chcurve); - - if (pedited) { - pedited->wavelet.Chcurve = true; - } - } - - if (keyFile.has_key ("Wavelet", "WavclCurve")) { - wavelet.wavclCurve = keyFile.get_double_list ("Wavelet", "WavclCurve"); - avoidEmptyCurve (wavelet.wavclCurve); - - if (pedited) { - pedited->wavelet.wavclCurve = true; - } - } + assignFromKeyfile(keyFile, "Wavelet", "Lipst", pedited, wavelet.lipst, pedited->wavelet.lipst); + assignFromKeyfile(keyFile, "Wavelet", "AvoidColorShift", pedited, wavelet.avoid, pedited->wavelet.avoid); + assignFromKeyfile(keyFile, "Wavelet", "TMr", pedited, wavelet.tmr, pedited->wavelet.tmr); + assignFromKeyfile(keyFile, "Wavelet", "LevMethod", pedited, wavelet.Lmethod, pedited->wavelet.Lmethod); + assignFromKeyfile(keyFile, "Wavelet", "ChoiceLevMethod", pedited, wavelet.CLmethod, pedited->wavelet.CLmethod); + assignFromKeyfile(keyFile, "Wavelet", "BackMethod", pedited, wavelet.Backmethod, pedited->wavelet.Backmethod); + assignFromKeyfile(keyFile, "Wavelet", "TilesMethod", pedited, wavelet.Tilesmethod, pedited->wavelet.Tilesmethod); + assignFromKeyfile(keyFile, "Wavelet", "DaubMethod", pedited, wavelet.daubcoeffmethod, pedited->wavelet.daubcoeffmethod); + assignFromKeyfile(keyFile, "Wavelet", "CHromaMethod", pedited, wavelet.CHmethod, pedited->wavelet.CHmethod); + assignFromKeyfile(keyFile, "Wavelet", "Medgreinf", pedited, wavelet.Medgreinf, pedited->wavelet.Medgreinf); + assignFromKeyfile(keyFile, "Wavelet", "CHSLromaMethod", pedited, wavelet.CHSLmethod, pedited->wavelet.CHSLmethod); + assignFromKeyfile(keyFile, "Wavelet", "EDMethod", pedited, wavelet.EDmethod, pedited->wavelet.EDmethod); + assignFromKeyfile(keyFile, "Wavelet", "NPMethod", pedited, wavelet.NPmethod, pedited->wavelet.NPmethod); + assignFromKeyfile(keyFile, "Wavelet", "BAMethod", pedited, wavelet.BAmethod, pedited->wavelet.BAmethod); + assignFromKeyfile(keyFile, "Wavelet", "TMMethod", pedited, wavelet.TMmethod, pedited->wavelet.TMmethod); + assignFromKeyfile(keyFile, "Wavelet", "HSMethod", pedited, wavelet.HSmethod, pedited->wavelet.HSmethod); + assignFromKeyfile(keyFile, "Wavelet", "DirMethod", pedited, wavelet.Dirmethod, pedited->wavelet.Dirmethod); + assignFromKeyfile(keyFile, "Wavelet", "ResidualcontShadow", pedited, wavelet.rescon, pedited->wavelet.rescon); + assignFromKeyfile(keyFile, "Wavelet", "ResidualcontHighlight", pedited, wavelet.resconH, pedited->wavelet.resconH); + assignFromKeyfile(keyFile, "Wavelet", "Residualchroma", pedited, wavelet.reschro, pedited->wavelet.reschro); + assignFromKeyfile(keyFile, "Wavelet", "ResidualTM", pedited, wavelet.tmrs, pedited->wavelet.tmrs); + assignFromKeyfile(keyFile, "Wavelet", "Residualgamma", pedited, wavelet.gamma, pedited->wavelet.gamma); + assignFromKeyfile(keyFile, "Wavelet", "ContExtra", pedited, wavelet.sup, pedited->wavelet.sup); + assignFromKeyfile(keyFile, "Wavelet", "HueRangeResidual", pedited, wavelet.sky, pedited->wavelet.sky); + assignFromKeyfile(keyFile, "Wavelet", "MaxLev", pedited, wavelet.thres, pedited->wavelet.thres); + assignFromKeyfile(keyFile, "Wavelet", "ThresholdHighLight", pedited, wavelet.threshold, pedited->wavelet.threshold); + assignFromKeyfile(keyFile, "Wavelet", "ThresholdShadow", pedited, wavelet.threshold2, pedited->wavelet.threshold2); + assignFromKeyfile(keyFile, "Wavelet", "Edgedetect", pedited, wavelet.edgedetect, pedited->wavelet.edgedetect); + assignFromKeyfile(keyFile, "Wavelet", "Edgedetectthr", pedited, wavelet.edgedetectthr, pedited->wavelet.edgedetectthr); + assignFromKeyfile(keyFile, "Wavelet", "EdgedetectthrHi", pedited, wavelet.edgedetectthr2, pedited->wavelet.edgedetectthr2); + assignFromKeyfile(keyFile, "Wavelet", "Edgesensi", pedited, wavelet.edgesensi, pedited->wavelet.edgesensi); + assignFromKeyfile(keyFile, "Wavelet", "Edgeampli", pedited, wavelet.edgeampli, pedited->wavelet.edgeampli); + assignFromKeyfile(keyFile, "Wavelet", "ThresholdChroma", pedited, wavelet.chroma, pedited->wavelet.chroma); + assignFromKeyfile(keyFile, "Wavelet", "ChromaLink", pedited, wavelet.chro, pedited->wavelet.chro); + assignFromKeyfile(keyFile, "Wavelet", "Contrast", pedited, wavelet.contrast, pedited->wavelet.contrast); + assignFromKeyfile(keyFile, "Wavelet", "Edgrad", pedited, wavelet.edgrad, pedited->wavelet.edgrad); + assignFromKeyfile(keyFile, "Wavelet", "Edgval", pedited, wavelet.edgval, pedited->wavelet.edgval); + assignFromKeyfile(keyFile, "Wavelet", "ThrEdg", pedited, wavelet.edgthresh, pedited->wavelet.edgthresh); + assignFromKeyfile(keyFile, "Wavelet", "ThresholdResidShadow", pedited, wavelet.thr, pedited->wavelet.thr); + assignFromKeyfile(keyFile, "Wavelet", "ThresholdResidHighLight", pedited, wavelet.thrH, pedited->wavelet.thrH); + assignFromKeyfile(keyFile, "Wavelet", "ContrastCurve", pedited, wavelet.ccwcurve, pedited->wavelet.ccwcurve); + + assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveRG", pedited, wavelet.opacityCurveRG, pedited->wavelet.opacityCurveRG); + + assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveBY", pedited, wavelet.opacityCurveBY, pedited->wavelet.opacityCurveBY); + + assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveW", pedited, wavelet.opacityCurveW, pedited->wavelet.opacityCurveW); + + assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveWL", pedited, wavelet.opacityCurveWL, pedited->wavelet.opacityCurveWL); + + assignFromKeyfile(keyFile, "Wavelet", "HHcurve", pedited, wavelet.hhcurve, pedited->wavelet.hhcurve); + + assignFromKeyfile(keyFile, "Wavelet", "CHcurve", pedited, wavelet.Chcurve, pedited->wavelet.Chcurve); + + assignFromKeyfile(keyFile, "Wavelet", "WavclCurve", pedited, wavelet.wavclCurve, pedited->wavelet.wavclCurve); if (keyFile.has_key ("Wavelet", "Hueskin")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Hueskin"); @@ -7044,30 +3435,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } - if (keyFile.has_key ("Wavelet", "Skinprotect")) { - wavelet.skinprotect = keyFile.get_double ("Wavelet", "Skinprotect"); - - if (pedited) { - pedited->wavelet.skinprotect = true; - } - } - - if (keyFile.has_key ("Wavelet", "Expcontrast")) { - wavelet.expcontrast = keyFile.get_boolean ("Wavelet", "Expcontrast"); - - if (pedited) { - pedited->wavelet.expcontrast = true; - } - } - - if (keyFile.has_key ("Wavelet", "Expchroma")) { - wavelet.expchroma = keyFile.get_boolean ("Wavelet", "Expchroma"); - - if (pedited) { - pedited->wavelet.expchroma = true; - } - } - + assignFromKeyfile(keyFile, "Wavelet", "Skinprotect", pedited, wavelet.skinprotect, pedited->wavelet.skinprotect); + assignFromKeyfile(keyFile, "Wavelet", "Expcontrast", pedited, wavelet.expcontrast, pedited->wavelet.expcontrast); + assignFromKeyfile(keyFile, "Wavelet", "Expchroma", pedited, wavelet.expchroma, pedited->wavelet.expchroma); for (int i = 0; i < 9; i ++) { std::stringstream ss; ss << "Contrast" << (i + 1); @@ -7094,76 +3464,20 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Wavelet", "Expedge")) { - wavelet.expedge = keyFile.get_boolean ("Wavelet", "Expedge"); - - if (pedited) { - pedited->wavelet.expedge = true; - } - } - - if (keyFile.has_key ("Wavelet", "Expresid")) { - wavelet.expresid = keyFile.get_boolean ("Wavelet", "Expresid"); - - if (pedited) { - pedited->wavelet.expresid = true; - } - } - - if (keyFile.has_key ("Wavelet", "Expfinal")) { - wavelet.expfinal = keyFile.get_boolean ("Wavelet", "Expfinal"); - - if (pedited) { - pedited->wavelet.expfinal = true; - } - } - - if (keyFile.has_key ("Wavelet", "Exptoning")) { - wavelet.exptoning = keyFile.get_boolean ("Wavelet", "Exptoning"); - - if (pedited) { - pedited->wavelet.exptoning = true; - } - } - - if (keyFile.has_key ("Wavelet", "Expnoise")) { - wavelet.expnoise = keyFile.get_boolean ("Wavelet", "Expnoise"); - - if (pedited) { - pedited->wavelet.expnoise = true; - } - } - + assignFromKeyfile(keyFile, "Wavelet", "Expedge", pedited, wavelet.expedge, pedited->wavelet.expedge); + assignFromKeyfile(keyFile, "Wavelet", "Expresid", pedited, wavelet.expresid, pedited->wavelet.expresid); + assignFromKeyfile(keyFile, "Wavelet", "Expfinal", pedited, wavelet.expfinal, pedited->wavelet.expfinal); + assignFromKeyfile(keyFile, "Wavelet", "Exptoning", pedited, wavelet.exptoning, pedited->wavelet.exptoning); + assignFromKeyfile(keyFile, "Wavelet", "Expnoise", pedited, wavelet.expnoise, pedited->wavelet.expnoise); } // load directional pyramid equalizer parameters if (keyFile.has_group ("Directional Pyramid Equalizer")) { - if (keyFile.has_key ("Directional Pyramid Equalizer", "Enabled")) { - dirpyrequalizer.enabled = keyFile.get_boolean ("Directional Pyramid Equalizer", "Enabled"); - - if (pedited) { - pedited->dirpyrequalizer.enabled = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Equalizer", "Gamutlab")) { - dirpyrequalizer.gamutlab = keyFile.get_boolean ("Directional Pyramid Equalizer", "Gamutlab"); - - if (pedited) { - pedited->dirpyrequalizer.gamutlab = true; - } - } - - - if (keyFile.has_key ("Directional Pyramid Equalizer", "cbdlMethod")) { - dirpyrequalizer.cbdlMethod = keyFile.get_string ("Directional Pyramid Equalizer", "cbdlMethod"); - - if (pedited) { - pedited->dirpyrequalizer.cbdlMethod = true; - } - } + assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "Enabled", pedited, dirpyrequalizer.enabled, pedited->dirpyrequalizer.enabled); + assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "Gamutlab", pedited, dirpyrequalizer.gamutlab, pedited->dirpyrequalizer.gamutlab); + assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "cbdlMethod", pedited, dirpyrequalizer.cbdlMethod, pedited->dirpyrequalizer.cbdlMethod); // if (keyFile.has_key ("Directional Pyramid Equalizer", "Algorithm")) { dirpyrequalizer.algo = keyFile.get_string ("Directional Pyramid Equalizer", "Algorithm"); if (pedited) pedited->dirpyrequalizer.algo = true; } if (keyFile.has_key ("Directional Pyramid Equalizer", "Hueskin")) { @@ -7216,21 +3530,8 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Directional Pyramid Equalizer", "Threshold")) { - dirpyrequalizer.threshold = keyFile.get_double ("Directional Pyramid Equalizer", "Threshold"); - - if (pedited) { - pedited->dirpyrequalizer.threshold = true; - } - } - - if (keyFile.has_key ("Directional Pyramid Equalizer", "Skinprotect")) { - dirpyrequalizer.skinprotect = keyFile.get_double ("Directional Pyramid Equalizer", "Skinprotect"); - - if (pedited) { - pedited->dirpyrequalizer.skinprotect = true; - } - } + assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "Threshold", pedited, dirpyrequalizer.threshold, pedited->dirpyrequalizer.threshold); + assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "Skinprotect", pedited, dirpyrequalizer.skinprotect, pedited->dirpyrequalizer.skinprotect); } } @@ -7268,157 +3569,38 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) // load HSV wavelet parameters if (keyFile.has_group ("HSV Equalizer")) { if (ppVersion >= 300) { - if (keyFile.has_key ("HSV Equalizer", "HCurve")) { - hsvequalizer.hcurve = keyFile.get_double_list ("HSV Equalizer", "HCurve"); - avoidEmptyCurve (hsvequalizer.hcurve); + assignFromKeyfile(keyFile, "HSV Equalizer", "HCurve", pedited, hsvequalizer.hcurve, pedited->hsvequalizer.hcurve); - if (pedited) { - pedited->hsvequalizer.hcurve = true; - } - } + assignFromKeyfile(keyFile, "HSV Equalizer", "SCurve", pedited, hsvequalizer.scurve, pedited->hsvequalizer.scurve); - if (keyFile.has_key ("HSV Equalizer", "SCurve")) { - hsvequalizer.scurve = keyFile.get_double_list ("HSV Equalizer", "SCurve"); - avoidEmptyCurve (hsvequalizer.scurve); - - if (pedited) { - pedited->hsvequalizer.scurve = true; - } - } - - if (keyFile.has_key ("HSV Equalizer", "VCurve")) { - hsvequalizer.vcurve = keyFile.get_double_list ("HSV Equalizer", "VCurve"); - avoidEmptyCurve (hsvequalizer.vcurve); - - if (pedited) { - pedited->hsvequalizer.vcurve = true; - } - } + assignFromKeyfile(keyFile, "HSV Equalizer", "VCurve", pedited, hsvequalizer.vcurve, pedited->hsvequalizer.vcurve); } } // load RGB curves if (keyFile.has_group ("RGB Curves")) { - if (keyFile.has_key ("RGB Curves", "LumaMode")) { - rgbCurves.lumamode = keyFile.get_boolean ("RGB Curves", "LumaMode"); + assignFromKeyfile(keyFile, "RGB Curves", "LumaMode", pedited, rgbCurves.lumamode, pedited->rgbCurves.lumamode); + assignFromKeyfile(keyFile, "RGB Curves", "rCurve", pedited, rgbCurves.rcurve, pedited->rgbCurves.rcurve); - if (pedited) { - pedited->rgbCurves.lumamode = true; - } - } + assignFromKeyfile(keyFile, "RGB Curves", "gCurve", pedited, rgbCurves.gcurve, pedited->rgbCurves.gcurve); - if (keyFile.has_key ("RGB Curves", "rCurve")) { - rgbCurves.rcurve = keyFile.get_double_list ("RGB Curves", "rCurve"); - avoidEmptyCurve (rgbCurves.rcurve); - - if (pedited) { - pedited->rgbCurves.rcurve = true; - } - } - - if (keyFile.has_key ("RGB Curves", "gCurve")) { - rgbCurves.gcurve = keyFile.get_double_list ("RGB Curves", "gCurve"); - avoidEmptyCurve (rgbCurves.gcurve); - - if (pedited) { - pedited->rgbCurves.gcurve = true; - } - } - - if (keyFile.has_key ("RGB Curves", "bCurve")) { - rgbCurves.bcurve = keyFile.get_double_list ("RGB Curves", "bCurve"); - avoidEmptyCurve (rgbCurves.bcurve); - - if (pedited) { - pedited->rgbCurves.bcurve = true; - } - } + assignFromKeyfile(keyFile, "RGB Curves", "bCurve", pedited, rgbCurves.bcurve, pedited->rgbCurves.bcurve); } // load Color Toning if (keyFile.has_group ("ColorToning")) { - if (keyFile.has_key ("ColorToning", "Enabled")) { - colorToning.enabled = keyFile.get_boolean ("ColorToning", "Enabled"); + assignFromKeyfile(keyFile, "ColorToning", "Enabled", pedited, colorToning.enabled, pedited->colorToning.enabled); + assignFromKeyfile(keyFile, "ColorToning", "Method", pedited, colorToning.method, pedited->colorToning.method); + assignFromKeyfile(keyFile, "ColorToning", "Lumamode", pedited, colorToning.lumamode, pedited->colorToning.lumamode); + assignFromKeyfile(keyFile, "ColorToning", "Twocolor", pedited, colorToning.twocolor, pedited->colorToning.twocolor); + assignFromKeyfile(keyFile, "ColorToning", "OpacityCurve", pedited, colorToning.opacityCurve, pedited->colorToning.opacityCurve); - if (pedited) { - pedited->colorToning.enabled = true; - } - } - - if (keyFile.has_key ("ColorToning", "Method")) { - colorToning.method = keyFile.get_string ("ColorToning", "Method"); - - if (pedited) { - pedited->colorToning.method = true; - } - } - - if (keyFile.has_key ("ColorToning", "Lumamode")) { - colorToning.lumamode = keyFile.get_boolean ("ColorToning", "Lumamode"); - - if (pedited) { - pedited->colorToning.lumamode = true; - } - } - - if (keyFile.has_key ("ColorToning", "Twocolor")) { - colorToning.twocolor = keyFile.get_string ("ColorToning", "Twocolor"); - - if (pedited) { - pedited->colorToning.twocolor = true; - } - } - - if (keyFile.has_key ("ColorToning", "OpacityCurve")) { - colorToning.opacityCurve = keyFile.get_double_list ("ColorToning", "OpacityCurve"); - avoidEmptyCurve (colorToning.opacityCurve); - - if (pedited) { - pedited->colorToning.opacityCurve = true; - } - } - - if (keyFile.has_key ("ColorToning", "ColorCurve")) { - colorToning.colorCurve = keyFile.get_double_list ("ColorToning", "ColorCurve"); - avoidEmptyCurve (colorToning.colorCurve); - - if (pedited) { - pedited->colorToning.colorCurve = true; - } - } - - if (keyFile.has_key ("ColorToning", "Autosat")) { - colorToning.autosat = keyFile.get_boolean ("ColorToning", "Autosat"); - - if (pedited) { - pedited->colorToning.autosat = true; - } - } - - if (keyFile.has_key ("ColorToning", "SatProtectionThreshold")) { - colorToning.satProtectionThreshold = keyFile.get_integer ("ColorToning", "SatProtectionThreshold"); - - if (pedited) { - pedited->colorToning.satprotectionthreshold = true; - } - } - - if (keyFile.has_key ("ColorToning", "SaturatedOpacity")) { - colorToning.saturatedOpacity = keyFile.get_integer ("ColorToning", "SaturatedOpacity"); - - if (pedited) { - pedited->colorToning.saturatedopacity = true; - } - } - - if (keyFile.has_key ("ColorToning", "Strength")) { - colorToning.strength = keyFile.get_integer ("ColorToning", "Strength"); - - if (pedited) { - pedited->colorToning.strength = true; - } - } + assignFromKeyfile(keyFile, "ColorToning", "ColorCurve", pedited, colorToning.colorCurve, pedited->colorToning.colorCurve); + assignFromKeyfile(keyFile, "ColorToning", "Autosat", pedited, colorToning.autosat, pedited->colorToning.autosat); + assignFromKeyfile(keyFile, "ColorToning", "SatProtectionThreshold", pedited, colorToning.satProtectionThreshold, pedited->colorToning.satprotectionthreshold); + assignFromKeyfile(keyFile, "ColorToning", "SaturatedOpacity", pedited, colorToning.saturatedOpacity, pedited->colorToning.saturatedopacity); + assignFromKeyfile(keyFile, "ColorToning", "Strength", pedited, colorToning.strength, pedited->colorToning.strength); if (keyFile.has_key ("ColorToning", "HighlightsColorSaturation")) { const std::vector thresh = keyFile.get_integer_list ("ColorToning", "HighlightsColorSaturation"); @@ -7443,119 +3625,22 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("ColorToning", "ClCurve")) { - colorToning.clcurve = keyFile.get_double_list ("ColorToning", "ClCurve"); - avoidEmptyCurve (colorToning.clcurve); + assignFromKeyfile(keyFile, "ColorToning", "ClCurve", pedited, colorToning.clcurve, pedited->colorToning.clcurve); - if (pedited) { - pedited->colorToning.clcurve = true; - } - } + assignFromKeyfile(keyFile, "ColorToning", "Cl2Curve", pedited, colorToning.cl2curve, pedited->colorToning.cl2curve); - if (keyFile.has_key ("ColorToning", "Cl2Curve")) { - colorToning.cl2curve = keyFile.get_double_list ("ColorToning", "Cl2Curve"); - avoidEmptyCurve (colorToning.cl2curve); - - if (pedited) { - pedited->colorToning.cl2curve = true; - } - } - - if (keyFile.has_key ("ColorToning", "Redlow")) { - colorToning.redlow = keyFile.get_double ("ColorToning", "Redlow"); - - if (pedited) { - pedited->colorToning.redlow = true; - } - } - - if (keyFile.has_key ("ColorToning", "Greenlow")) { - colorToning.greenlow = keyFile.get_double ("ColorToning", "Greenlow"); - - if (pedited) { - pedited->colorToning.greenlow = true; - } - } - - if (keyFile.has_key ("ColorToning", "Bluelow")) { - colorToning.bluelow = keyFile.get_double ("ColorToning", "Bluelow"); - - if (pedited) { - pedited->colorToning.bluelow = true; - } - } - - if (keyFile.has_key ("ColorToning", "Satlow")) { - colorToning.satlow = keyFile.get_double ("ColorToning", "Satlow"); - - if (pedited) { - pedited->colorToning.satlow = true; - } - } - - if (keyFile.has_key ("ColorToning", "Balance")) { - colorToning.balance = keyFile.get_integer ("ColorToning", "Balance"); - - if (pedited) { - pedited->colorToning.balance = true; - } - } - - if (keyFile.has_key ("ColorToning", "Sathigh")) { - colorToning.sathigh = keyFile.get_double ("ColorToning", "Sathigh"); - - if (pedited) { - pedited->colorToning.sathigh = true; - } - } - - if (keyFile.has_key ("ColorToning", "Redmed")) { - colorToning.redmed = keyFile.get_double ("ColorToning", "Redmed"); - - if (pedited) { - pedited->colorToning.redmed = true; - } - } - - if (keyFile.has_key ("ColorToning", "Greenmed")) { - colorToning.greenmed = keyFile.get_double ("ColorToning", "Greenmed"); - - if (pedited) { - pedited->colorToning.greenmed = true; - } - } - - if (keyFile.has_key ("ColorToning", "Bluemed")) { - colorToning.bluemed = keyFile.get_double ("ColorToning", "Bluemed"); - - if (pedited) { - pedited->colorToning.bluemed = true; - } - } - - if (keyFile.has_key ("ColorToning", "Redhigh")) { - colorToning.redhigh = keyFile.get_double ("ColorToning", "Redhigh"); - - if (pedited) { - pedited->colorToning.redhigh = true; - } - } - - if (keyFile.has_key ("ColorToning", "Greenhigh")) { - colorToning.greenhigh = keyFile.get_double ("ColorToning", "Greenhigh"); - - if (pedited) { - pedited->colorToning.greenhigh = true; - } - } - - if (keyFile.has_key ("ColorToning", "Bluehigh")) { - colorToning.bluehigh = keyFile.get_double ("ColorToning", "Bluehigh"); - - if (pedited) { - pedited->colorToning.bluehigh = true; - } - } + assignFromKeyfile(keyFile, "ColorToning", "Redlow", pedited, colorToning.redlow, pedited->colorToning.redlow); + assignFromKeyfile(keyFile, "ColorToning", "Greenlow", pedited, colorToning.greenlow, pedited->colorToning.greenlow); + assignFromKeyfile(keyFile, "ColorToning", "Bluelow", pedited, colorToning.bluelow, pedited->colorToning.bluelow); + assignFromKeyfile(keyFile, "ColorToning", "Satlow", pedited, colorToning.satlow, pedited->colorToning.satlow); + assignFromKeyfile(keyFile, "ColorToning", "Balance", pedited, colorToning.balance, pedited->colorToning.balance); + assignFromKeyfile(keyFile, "ColorToning", "Sathigh", pedited, colorToning.sathigh, pedited->colorToning.sathigh); + assignFromKeyfile(keyFile, "ColorToning", "Redmed", pedited, colorToning.redmed, pedited->colorToning.redmed); + assignFromKeyfile(keyFile, "ColorToning", "Greenmed", pedited, colorToning.greenmed, pedited->colorToning.greenmed); + assignFromKeyfile(keyFile, "ColorToning", "Bluemed", pedited, colorToning.bluemed, pedited->colorToning.bluemed); + assignFromKeyfile(keyFile, "ColorToning", "Redhigh", pedited, colorToning.redhigh, pedited->colorToning.redhigh); + assignFromKeyfile(keyFile, "ColorToning", "Greenhigh", pedited, colorToning.greenhigh, pedited->colorToning.greenhigh); + assignFromKeyfile(keyFile, "ColorToning", "Bluehigh", pedited, colorToning.bluehigh, pedited->colorToning.bluehigh); } // load raw settings @@ -7681,39 +3766,11 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("RAW", "PreExposure")) { - raw.expos = keyFile.get_double ("RAW", "PreExposure"); - - if (pedited) { - pedited->raw.exPos = true; - } - } - - if (keyFile.has_key ("RAW", "PrePreserv")) { - raw.preser = keyFile.get_double ("RAW", "PrePreserv"); - - if (pedited) { - pedited->raw.exPreser = true; - } - } - + assignFromKeyfile(keyFile, "RAW", "PreExposure", pedited, raw.expos, pedited->raw.exPos); + assignFromKeyfile(keyFile, "RAW", "PrePreserv", pedited, raw.preser, pedited->raw.exPreser); if (ppVersion < 320) { - if (keyFile.has_key ("RAW", "Method")) { - raw.bayersensor.method = keyFile.get_string ("RAW", "Method"); - - if (pedited) { - pedited->raw.bayersensor.method = true; - } - } - - if (keyFile.has_key ("RAW", "CcSteps")) { - raw.bayersensor.ccSteps = keyFile.get_integer ("RAW", "CcSteps"); - - if (pedited) { - pedited->raw.bayersensor.ccSteps = true; - } - } - + assignFromKeyfile(keyFile, "RAW", "Method", pedited, raw.bayersensor.method, pedited->raw.bayersensor.method); + assignFromKeyfile(keyFile, "RAW", "CcSteps", pedited, raw.bayersensor.ccSteps, pedited->raw.bayersensor.ccSteps); if (keyFile.has_key ("RAW", "LineDenoise")) { raw.bayersensor.linenoise = keyFile.get_integer ("RAW", "LineDenoise" ); @@ -7722,92 +3779,22 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("RAW", "GreenEqThreshold")) { - raw.bayersensor.greenthresh = keyFile.get_integer ("RAW", "GreenEqThreshold"); - - if (pedited) { - pedited->raw.bayersensor.greenEq = true; - } - } - - if (keyFile.has_key ("RAW", "DCBIterations")) { - raw.bayersensor.dcb_iterations = keyFile.get_integer ("RAW", "DCBIterations"); - - if (pedited) { - pedited->raw.bayersensor.dcbIterations = true; - } - } - - if (keyFile.has_key ("RAW", "DCBEnhance")) { - raw.bayersensor.dcb_enhance = keyFile.get_boolean ("RAW", "DCBEnhance"); - - if (pedited) { - pedited->raw.bayersensor.dcbEnhance = true; - } - } - - if (keyFile.has_key ("RAW", "LMMSEIterations")) { - raw.bayersensor.lmmse_iterations = keyFile.get_integer ("RAW", "LMMSEIterations"); - - if (pedited) { - pedited->raw.bayersensor.lmmseIterations = true; - } - } - - if (keyFile.has_key ("RAW", "PreBlackzero")) { - raw.bayersensor.black0 = keyFile.get_double ("RAW", "PreBlackzero"); - - if (pedited) { - pedited->raw.bayersensor.exBlack0 = true; - } - } - - if (keyFile.has_key ("RAW", "PreBlackone")) { - raw.bayersensor.black1 = keyFile.get_double ("RAW", "PreBlackone"); - - if (pedited) { - pedited->raw.bayersensor.exBlack1 = true; - } - } - - if (keyFile.has_key ("RAW", "PreBlacktwo")) { - raw.bayersensor.black2 = keyFile.get_double ("RAW", "PreBlacktwo"); - - if (pedited) { - pedited->raw.bayersensor.exBlack2 = true; - } - } - - if (keyFile.has_key ("RAW", "PreBlackthree")) { - raw.bayersensor.black3 = keyFile.get_double ("RAW", "PreBlackthree"); - - if (pedited) { - pedited->raw.bayersensor.exBlack3 = true; - } - } - - if (keyFile.has_key ("RAW", "PreTwoGreen")) { - raw.bayersensor.twogreen = keyFile.get_boolean ("RAW", "PreTwoGreen"); - - if (pedited) { - pedited->raw.bayersensor.exTwoGreen = true; - } - } - + assignFromKeyfile(keyFile, "RAW", "GreenEqThreshold", pedited, raw.bayersensor.greenthresh, pedited->raw.bayersensor.greenEq); + assignFromKeyfile(keyFile, "RAW", "DCBIterations", pedited, raw.bayersensor.dcb_iterations, pedited->raw.bayersensor.dcbIterations); + assignFromKeyfile(keyFile, "RAW", "DCBEnhance", pedited, raw.bayersensor.dcb_enhance, pedited->raw.bayersensor.dcbEnhance); + assignFromKeyfile(keyFile, "RAW", "LMMSEIterations", pedited, raw.bayersensor.lmmse_iterations, pedited->raw.bayersensor.lmmseIterations); + assignFromKeyfile(keyFile, "RAW", "PreBlackzero", pedited, raw.bayersensor.black0, pedited->raw.bayersensor.exBlack0); + assignFromKeyfile(keyFile, "RAW", "PreBlackone", pedited, raw.bayersensor.black1, pedited->raw.bayersensor.exBlack1); + assignFromKeyfile(keyFile, "RAW", "PreBlacktwo", pedited, raw.bayersensor.black2, pedited->raw.bayersensor.exBlack2); + assignFromKeyfile(keyFile, "RAW", "PreBlackthree", pedited, raw.bayersensor.black3, pedited->raw.bayersensor.exBlack3); + assignFromKeyfile(keyFile, "RAW", "PreTwoGreen", pedited, raw.bayersensor.twogreen, pedited->raw.bayersensor.exTwoGreen); //if (keyFile.has_key ("RAW", "ALLEnhance")) { raw.bayersensor.all_enhance = keyFile.get_boolean("RAW", "ALLEnhance"); if (pedited) pedited->raw.bayersensor.allEnhance = true; } } } // load Bayer sensors' raw settings if (keyFile.has_group ("RAW Bayer")) { - if (keyFile.has_key ("RAW Bayer", "Method")) { - raw.bayersensor.method = keyFile.get_string ("RAW Bayer", "Method"); - - if (pedited) { - pedited->raw.bayersensor.method = true; - } - } - + assignFromKeyfile(keyFile, "RAW Bayer", "Method", pedited, raw.bayersensor.method, pedited->raw.bayersensor.method); if (keyFile.has_key ("RAW Bayer", "ImageNum")) { raw.bayersensor.imageNum = keyFile.get_integer ("RAW Bayer", "ImageNum") - 1; @@ -7816,54 +3803,12 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("RAW Bayer", "CcSteps")) { - raw.bayersensor.ccSteps = keyFile.get_integer ("RAW Bayer", "CcSteps"); - - if (pedited) { - pedited->raw.bayersensor.ccSteps = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PreBlack0")) { - raw.bayersensor.black0 = keyFile.get_double ("RAW Bayer", "PreBlack0"); - - if (pedited) { - pedited->raw.bayersensor.exBlack0 = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PreBlack1")) { - raw.bayersensor.black1 = keyFile.get_double ("RAW Bayer", "PreBlack1"); - - if (pedited) { - pedited->raw.bayersensor.exBlack1 = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PreBlack2")) { - raw.bayersensor.black2 = keyFile.get_double ("RAW Bayer", "PreBlack2"); - - if (pedited) { - pedited->raw.bayersensor.exBlack2 = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PreBlack3")) { - raw.bayersensor.black3 = keyFile.get_double ("RAW Bayer", "PreBlack3"); - - if (pedited) { - pedited->raw.bayersensor.exBlack3 = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PreTwoGreen")) { - raw.bayersensor.twogreen = keyFile.get_boolean ("RAW Bayer", "PreTwoGreen"); - - if (pedited) { - pedited->raw.bayersensor.exTwoGreen = true; - } - } - + assignFromKeyfile(keyFile, "RAW Bayer", "CcSteps", pedited, raw.bayersensor.ccSteps, pedited->raw.bayersensor.ccSteps); + assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack0", pedited, raw.bayersensor.black0, pedited->raw.bayersensor.exBlack0); + assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack1", pedited, raw.bayersensor.black1, pedited->raw.bayersensor.exBlack1); + assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack2", pedited, raw.bayersensor.black2, pedited->raw.bayersensor.exBlack2); + assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack3", pedited, raw.bayersensor.black3, pedited->raw.bayersensor.exBlack3); + assignFromKeyfile(keyFile, "RAW Bayer", "PreTwoGreen", pedited, raw.bayersensor.twogreen, pedited->raw.bayersensor.exTwoGreen); if (keyFile.has_key ("RAW Bayer", "LineDenoise")) { raw.bayersensor.linenoise = keyFile.get_integer ("RAW Bayer", "LineDenoise" ); @@ -7872,46 +3817,11 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("RAW Bayer", "GreenEqThreshold")) { - raw.bayersensor.greenthresh = keyFile.get_integer ("RAW Bayer", "GreenEqThreshold"); - - if (pedited) { - pedited->raw.bayersensor.greenEq = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "DCBIterations")) { - raw.bayersensor.dcb_iterations = keyFile.get_integer ("RAW Bayer", "DCBIterations"); - - if (pedited) { - pedited->raw.bayersensor.dcbIterations = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "DCBEnhance")) { - raw.bayersensor.dcb_enhance = keyFile.get_boolean ("RAW Bayer", "DCBEnhance"); - - if (pedited) { - pedited->raw.bayersensor.dcbEnhance = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "LMMSEIterations")) { - raw.bayersensor.lmmse_iterations = keyFile.get_integer ("RAW Bayer", "LMMSEIterations"); - - if (pedited) { - pedited->raw.bayersensor.lmmseIterations = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftMotion")) { - raw.bayersensor.pixelShiftMotion = keyFile.get_integer ("RAW Bayer", "PixelShiftMotion"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftMotion = true; - } - } - + assignFromKeyfile(keyFile, "RAW Bayer", "GreenEqThreshold", pedited, raw.bayersensor.greenthresh, pedited->raw.bayersensor.greenEq); + assignFromKeyfile(keyFile, "RAW Bayer", "DCBIterations", pedited, raw.bayersensor.dcb_iterations, pedited->raw.bayersensor.dcbIterations); + assignFromKeyfile(keyFile, "RAW Bayer", "DCBEnhance", pedited, raw.bayersensor.dcb_enhance, pedited->raw.bayersensor.dcbEnhance); + assignFromKeyfile(keyFile, "RAW Bayer", "LMMSEIterations", pedited, raw.bayersensor.lmmse_iterations, pedited->raw.bayersensor.lmmseIterations); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftMotion", pedited, raw.bayersensor.pixelShiftMotion, pedited->raw.bayersensor.pixelShiftMotion); if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrection")) { raw.bayersensor.pixelShiftMotionCorrection = (RAWParams::BayerSensor::ePSMotionCorrection)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrection"); @@ -7928,264 +3838,42 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("RAW Bayer", "pixelShiftStddevFactorGreen")) { - raw.bayersensor.pixelShiftStddevFactorGreen = keyFile.get_double ("RAW Bayer", "pixelShiftStddevFactorGreen"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftStddevFactorGreen = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftStddevFactorRed")) { - raw.bayersensor.pixelShiftStddevFactorRed = keyFile.get_double ("RAW Bayer", "pixelShiftStddevFactorRed"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftStddevFactorRed = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftStddevFactorBlue")) { - raw.bayersensor.pixelShiftStddevFactorBlue = keyFile.get_double ("RAW Bayer", "pixelShiftStddevFactorBlue"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftStddevFactorBlue = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftEperIso")) { - raw.bayersensor.pixelShiftEperIso = keyFile.get_double ("RAW Bayer", "PixelShiftEperIso"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftEperIso = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftNreadIso")) { - raw.bayersensor.pixelShiftNreadIso = keyFile.get_double ("RAW Bayer", "PixelShiftNreadIso"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftNreadIso = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftPrnu")) { - raw.bayersensor.pixelShiftPrnu = keyFile.get_double ("RAW Bayer", "PixelShiftPrnu"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftPrnu = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftSigma")) { - raw.bayersensor.pixelShiftSigma = keyFile.get_double ("RAW Bayer", "PixelShiftSigma"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftSigma = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftSum")) { - raw.bayersensor.pixelShiftSum = keyFile.get_double ("RAW Bayer", "PixelShiftSum"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftSum = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftRedBlueWeight")) { - raw.bayersensor.pixelShiftRedBlueWeight = keyFile.get_double ("RAW Bayer", "PixelShiftRedBlueWeight"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftRedBlueWeight = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftShowMotion")) { - raw.bayersensor.pixelShiftShowMotion = keyFile.get_boolean ("RAW Bayer", "PixelShiftShowMotion"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftShowMotion = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "PixelShiftShowMotionMaskOnly")) { - raw.bayersensor.pixelShiftShowMotionMaskOnly = keyFile.get_boolean ("RAW Bayer", "PixelShiftShowMotionMaskOnly"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftAutomatic")) { - raw.bayersensor.pixelShiftAutomatic = keyFile.get_boolean ("RAW Bayer", "pixelShiftAutomatic"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftAutomatic = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftNonGreenHorizontal")) { - raw.bayersensor.pixelShiftNonGreenHorizontal = keyFile.get_boolean ("RAW Bayer", "pixelShiftNonGreenHorizontal"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftNonGreenHorizontal = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftNonGreenVertical")) { - raw.bayersensor.pixelShiftNonGreenVertical = keyFile.get_boolean ("RAW Bayer", "pixelShiftNonGreenVertical"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftNonGreenVertical = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftHoleFill")) { - raw.bayersensor.pixelShiftHoleFill = keyFile.get_boolean ("RAW Bayer", "pixelShiftHoleFill"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftHoleFill = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftMedian")) { - raw.bayersensor.pixelShiftMedian = keyFile.get_boolean ("RAW Bayer", "pixelShiftMedian"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftMedian = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftMedian3")) { - raw.bayersensor.pixelShiftMedian3 = keyFile.get_boolean ("RAW Bayer", "pixelShiftMedian3"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftMedian3 = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftGreen")) { - raw.bayersensor.pixelShiftGreen = keyFile.get_boolean ("RAW Bayer", "pixelShiftGreen"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftGreen = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftBlur")) { - raw.bayersensor.pixelShiftBlur = keyFile.get_boolean ("RAW Bayer", "pixelShiftBlur"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftBlur = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftSmoothFactor")) { - raw.bayersensor.pixelShiftSmoothFactor = keyFile.get_double ("RAW Bayer", "pixelShiftSmoothFactor"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftSmooth = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftExp0")) { - raw.bayersensor.pixelShiftExp0 = keyFile.get_boolean ("RAW Bayer", "pixelShiftExp0"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftExp0 = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftLmmse")) { - raw.bayersensor.pixelShiftLmmse = keyFile.get_boolean ("RAW Bayer", "pixelShiftLmmse"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftLmmse = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftEqualBright")) { - raw.bayersensor.pixelShiftEqualBright = keyFile.get_boolean ("RAW Bayer", "pixelShiftEqualBright"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftEqualBright = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftEqualBrightChannel")) { - raw.bayersensor.pixelShiftEqualBrightChannel = keyFile.get_boolean ("RAW Bayer", "pixelShiftEqualBrightChannel"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftEqualBrightChannel = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftNonGreenCross")) { - raw.bayersensor.pixelShiftNonGreenCross = keyFile.get_boolean ("RAW Bayer", "pixelShiftNonGreenCross"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftNonGreenCross = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftNonGreenCross2")) { - raw.bayersensor.pixelShiftNonGreenCross2 = keyFile.get_boolean ("RAW Bayer", "pixelShiftNonGreenCross2"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftNonGreenCross2 = true; - } - } - - if (keyFile.has_key ("RAW Bayer", "pixelShiftNonGreenAmaze")) { - raw.bayersensor.pixelShiftNonGreenAmaze = keyFile.get_boolean ("RAW Bayer", "pixelShiftNonGreenAmaze"); - - if (pedited) { - pedited->raw.bayersensor.pixelShiftNonGreenAmaze = true; - } - } + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorGreen", pedited, raw.bayersensor.pixelShiftStddevFactorGreen, pedited->raw.bayersensor.pixelShiftStddevFactorGreen); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorRed", pedited, raw.bayersensor.pixelShiftStddevFactorRed, pedited->raw.bayersensor.pixelShiftStddevFactorRed); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorBlue", pedited, raw.bayersensor.pixelShiftStddevFactorBlue, pedited->raw.bayersensor.pixelShiftStddevFactorBlue); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftEperIso", pedited, raw.bayersensor.pixelShiftEperIso, pedited->raw.bayersensor.pixelShiftEperIso); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftNreadIso", pedited, raw.bayersensor.pixelShiftNreadIso, pedited->raw.bayersensor.pixelShiftNreadIso); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftPrnu", pedited, raw.bayersensor.pixelShiftPrnu, pedited->raw.bayersensor.pixelShiftPrnu); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftSigma", pedited, raw.bayersensor.pixelShiftSigma, pedited->raw.bayersensor.pixelShiftSigma); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftSum", pedited, raw.bayersensor.pixelShiftSum, pedited->raw.bayersensor.pixelShiftSum); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftRedBlueWeight", pedited, raw.bayersensor.pixelShiftRedBlueWeight, pedited->raw.bayersensor.pixelShiftRedBlueWeight); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftShowMotion", pedited, raw.bayersensor.pixelShiftShowMotion, pedited->raw.bayersensor.pixelShiftShowMotion); + assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftShowMotionMaskOnly", pedited, raw.bayersensor.pixelShiftShowMotionMaskOnly, pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftAutomatic", pedited, raw.bayersensor.pixelShiftAutomatic, pedited->raw.bayersensor.pixelShiftAutomatic); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftNonGreenHorizontal", pedited, raw.bayersensor.pixelShiftNonGreenHorizontal, pedited->raw.bayersensor.pixelShiftNonGreenHorizontal); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftNonGreenVertical", pedited, raw.bayersensor.pixelShiftNonGreenVertical, pedited->raw.bayersensor.pixelShiftNonGreenVertical); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftHoleFill", pedited, raw.bayersensor.pixelShiftHoleFill, pedited->raw.bayersensor.pixelShiftHoleFill); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftMedian", pedited, raw.bayersensor.pixelShiftMedian, pedited->raw.bayersensor.pixelShiftMedian); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftMedian3", pedited, raw.bayersensor.pixelShiftMedian3, pedited->raw.bayersensor.pixelShiftMedian3); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftGreen", pedited, raw.bayersensor.pixelShiftGreen, pedited->raw.bayersensor.pixelShiftGreen); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftBlur", pedited, raw.bayersensor.pixelShiftBlur, pedited->raw.bayersensor.pixelShiftBlur); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftSmoothFactor", pedited, raw.bayersensor.pixelShiftSmoothFactor, pedited->raw.bayersensor.pixelShiftSmooth); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftExp0", pedited, raw.bayersensor.pixelShiftExp0, pedited->raw.bayersensor.pixelShiftExp0); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftLmmse", pedited, raw.bayersensor.pixelShiftLmmse, pedited->raw.bayersensor.pixelShiftLmmse); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftEqualBright", pedited, raw.bayersensor.pixelShiftEqualBright, pedited->raw.bayersensor.pixelShiftEqualBright); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftEqualBrightChannel", pedited, raw.bayersensor.pixelShiftEqualBrightChannel, pedited->raw.bayersensor.pixelShiftEqualBrightChannel); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftNonGreenCross", pedited, raw.bayersensor.pixelShiftNonGreenCross, pedited->raw.bayersensor.pixelShiftNonGreenCross); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftNonGreenCross2", pedited, raw.bayersensor.pixelShiftNonGreenCross2, pedited->raw.bayersensor.pixelShiftNonGreenCross2); + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftNonGreenAmaze", pedited, raw.bayersensor.pixelShiftNonGreenAmaze, pedited->raw.bayersensor.pixelShiftNonGreenAmaze); } // load X-Trans sensors' raw settings if (keyFile.has_group ("RAW X-Trans")) { - if (keyFile.has_key ("RAW X-Trans", "Method")) { - raw.xtranssensor.method = keyFile.get_string ("RAW X-Trans", "Method"); - - if (pedited) { - pedited->raw.xtranssensor.method = true; - } - } - - if (keyFile.has_key ("RAW X-Trans", "CcSteps")) { - raw.xtranssensor.ccSteps = keyFile.get_integer ("RAW X-Trans", "CcSteps"); - - if (pedited) { - pedited->raw.xtranssensor.ccSteps = true; - } - } - - if (keyFile.has_key ("RAW X-Trans", "PreBlackRed")) { - raw.xtranssensor.blackred = keyFile.get_double ("RAW X-Trans", "PreBlackRed"); - - if (pedited) { - pedited->raw.xtranssensor.exBlackRed = true; - } - } - - if (keyFile.has_key ("RAW X-Trans", "PreBlackGreen")) { - raw.xtranssensor.blackgreen = keyFile.get_double ("RAW X-Trans", "PreBlackGreen"); - - if (pedited) { - pedited->raw.xtranssensor.exBlackGreen = true; - } - } - - if (keyFile.has_key ("RAW X-Trans", "PreBlackBlue")) { - raw.xtranssensor.blackblue = keyFile.get_double ("RAW X-Trans", "PreBlackBlue"); - - if (pedited) { - pedited->raw.xtranssensor.exBlackBlue = true; - } - } + assignFromKeyfile(keyFile, "RAW X-Trans", "Method", pedited, raw.xtranssensor.method, pedited->raw.xtranssensor.method); + assignFromKeyfile(keyFile, "RAW X-Trans", "CcSteps", pedited, raw.xtranssensor.ccSteps, pedited->raw.xtranssensor.ccSteps); + assignFromKeyfile(keyFile, "RAW X-Trans", "PreBlackRed", pedited, raw.xtranssensor.blackred, pedited->raw.xtranssensor.exBlackRed); + assignFromKeyfile(keyFile, "RAW X-Trans", "PreBlackGreen", pedited, raw.xtranssensor.blackgreen, pedited->raw.xtranssensor.exBlackGreen); + assignFromKeyfile(keyFile, "RAW X-Trans", "PreBlackBlue", pedited, raw.xtranssensor.blackblue, pedited->raw.xtranssensor.exBlackBlue); } // load exif change settings diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c69df915b..c3b74e70b 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -745,12 +745,12 @@ public: bool enabled; int threshold; int amount; - + FattalToneMappingParams() { setDefaults(); } - + void setDefaults() { enabled = false; @@ -1107,12 +1107,12 @@ public: bool medianlev; bool linkedg; bool cbenab; - double greenlow; - double bluelow; - double greenmed; - double bluemed; - double greenhigh; - double bluehigh; + int greenlow; + int bluelow; + int greenmed; + int bluemed; + int greenhigh; + int bluehigh; bool lipst; // bool edgreinf; @@ -1427,8 +1427,8 @@ public: DirPyrEqualizerParams dirpyrequalizer; ///< directional pyramid wavelet parameters HSVEqualizerParams hsvequalizer; ///< hsv wavelet parameters FilmSimulationParams filmSimulation; ///< film simulation parameters - char rank; ///< Custom image quality ranking - char colorlabel; ///< Custom color label + int rank; ///< Custom image quality ranking + int colorlabel; ///< Custom color label bool inTrash; ///< Marks deleted image Glib::ustring appVersion; ///< Version of the application that generated the parameters int ppVersion; ///< Version of the PP file from which the parameters have been read From c702e5d847686374aca1d1e9713033435bbe43be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Sat, 11 Nov 2017 21:11:57 +0100 Subject: [PATCH 02/47] Additional manual cleanups to `ProcParams::(save|load)()` --- rtengine/procparams.cc | 419 +++++++++++---------------------------- rtgui/darkframe.cc | 4 +- rtgui/paramsedited.cc | 34 ++-- rtgui/paramsedited.h | 10 +- rtgui/partialpastedlg.cc | 10 +- rtgui/preprocess.cc | 2 +- rtgui/rawcacorrection.cc | 16 +- 7 files changed, 149 insertions(+), 346 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 9ffa0a290..c00f45f14 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1633,7 +1633,6 @@ static Glib::ustring relativePathIfInside (const Glib::ustring &procparams_fname int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, bool fnameAbsolute, ParamsEdited* pedited) { - if (fname.empty () && fname2.empty ()) { return 0; } @@ -1641,16 +1640,17 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::ustring sPParams; try { - Glib::KeyFile keyFile; +// Version keyFile.set_string ("Version", "AppVersion", APPVERSION); keyFile.set_integer ("Version", "Version", PPVERSION); saveToKeyfile(!pedited || pedited->general.rank, "General", "Rank", rank, keyFile); saveToKeyfile(!pedited || pedited->general.colorlabel, "General", "ColorLabel", colorlabel, keyFile); saveToKeyfile(!pedited || pedited->general.intrash, "General", "InTrash", inTrash, keyFile); -// save tone curve + +// Tone curve saveToKeyfile(!pedited || pedited->toneCurve.autoexp, "Exposure", "Auto", toneCurve.autoexp, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.clip, "Exposure", "Clip", toneCurve.clip, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.expcomp, "Exposure", "Compensation", toneCurve.expcomp, keyFile); @@ -1661,7 +1661,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->toneCurve.hlcompr, "Exposure", "HighlightCompr", toneCurve.hlcompr, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.hlcomprthresh, "Exposure", "HighlightComprThreshold", toneCurve.hlcomprthresh, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.shcompr, "Exposure", "ShadowCompr", toneCurve.shcompr, keyFile); -// save highlight recovery settings + +// Highlight recovery saveToKeyfile(!pedited || pedited->toneCurve.hrenabled, "HLRecovery", "Enabled", toneCurve.hrenabled, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.method, "HLRecovery", "Method", toneCurve.method, keyFile); @@ -1679,8 +1680,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->toneCurve.curve, "Exposure", "Curve", toneCurve.curve, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.curve2, "Exposure", "Curve2", toneCurve.curve2, keyFile); -//save retinex +// Retinex saveToKeyfile(!pedited || pedited->retinex.enabled, "Retinex", "Enabled", retinex.enabled, keyFile); saveToKeyfile(!pedited || pedited->retinex.str, "Retinex", "Str", retinex.str, keyFile); saveToKeyfile(!pedited || pedited->retinex.scal, "Retinex", "Scal", retinex.scal, keyFile); @@ -1714,7 +1715,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->retinex.radius, "Retinex", "Radius", retinex.radius, keyFile); saveToKeyfile(!pedited || pedited->retinex.transmissionCurve, "Retinex", "TransmissionCurve", retinex.transmissionCurve, keyFile); saveToKeyfile(!pedited || pedited->retinex.gaintransmissionCurve, "Retinex", "GainTransmissionCurve", retinex.gaintransmissionCurve, keyFile); -// save channel mixer + +// Channel mixer if (!pedited || pedited->chmixer.red[0] || pedited->chmixer.red[1] || pedited->chmixer.red[2]) { Glib::ArrayHandle rmix (chmixer.red, 3, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Channel Mixer", "Red", rmix); @@ -1730,7 +1732,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_integer_list ("Channel Mixer", "Blue", bmix); } -//save Black & White +// Black & White saveToKeyfile(!pedited || pedited->blackwhite.enabled, "Black & White", "Enabled", blackwhite.enabled, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.method, "Black & White", "Method", blackwhite.method , keyFile); saveToKeyfile(!pedited || pedited->blackwhite.autoc, "Black & White", "Auto", blackwhite.autoc, keyFile); @@ -1778,7 +1780,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b ); saveToKeyfile(!pedited || pedited->blackwhite.beforeCurve, "Black & White", "BeforeCurve", blackwhite.beforeCurve, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.afterCurve, "Black & White", "AfterCurve", blackwhite.afterCurve, keyFile); -// save luma curve + +// Luma curve saveToKeyfile(!pedited || pedited->labCurve.brightness, "Luminance Curve", "Brightness", labCurve.brightness, keyFile); saveToKeyfile(!pedited || pedited->labCurve.contrast, "Luminance Curve", "Contrast", labCurve.contrast, keyFile); saveToKeyfile(!pedited || pedited->labCurve.chromaticity, "Luminance Curve", "Chromaticity", labCurve.chromaticity, keyFile); @@ -1794,7 +1797,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->labCurve.hhcurve, "Luminance Curve", "hhCurve", labCurve.hhcurve, keyFile); saveToKeyfile(!pedited || pedited->labCurve.lccurve, "Luminance Curve", "LcCurve", labCurve.lccurve, keyFile); saveToKeyfile(!pedited || pedited->labCurve.clcurve, "Luminance Curve", "ClCurve", labCurve.clcurve, keyFile); -// save sharpening + +// Sharpening saveToKeyfile(!pedited || pedited->sharpening.enabled, "Sharpening", "Enabled", sharpening.enabled, keyFile); saveToKeyfile(!pedited || pedited->sharpening.method, "Sharpening", "Method", sharpening.method, keyFile); saveToKeyfile(!pedited || pedited->sharpening.radius, "Sharpening", "Radius", sharpening.radius, keyFile); @@ -1813,7 +1817,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->sharpening.deconvamount, "Sharpening", "DeconvAmount", sharpening.deconvamount, keyFile); saveToKeyfile(!pedited || pedited->sharpening.deconvdamping, "Sharpening", "DeconvDamping", sharpening.deconvdamping, keyFile); saveToKeyfile(!pedited || pedited->sharpening.deconviter, "Sharpening", "DeconvIterations", sharpening.deconviter, keyFile); -// save vibrance + +// Vibrance saveToKeyfile(!pedited || pedited->vibrance.enabled, "Vibrance", "Enabled", vibrance.enabled, keyFile); saveToKeyfile(!pedited || pedited->vibrance.pastels, "Vibrance", "Pastels", vibrance.pastels, keyFile); saveToKeyfile(!pedited || pedited->vibrance.saturated, "Vibrance", "Saturated", vibrance.saturated, keyFile); @@ -1826,36 +1831,39 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->vibrance.avoidcolorshift, "Vibrance", "AvoidColorShift", vibrance.avoidcolorshift, keyFile); saveToKeyfile(!pedited || pedited->vibrance.pastsattog, "Vibrance", "PastSatTog", vibrance.pastsattog, keyFile); saveToKeyfile(!pedited || pedited->vibrance.skintonescurve, "Vibrance", "SkinTonesCurve", vibrance.skintonescurve, keyFile); -//save edge sharpening + +// Edge sharpening saveToKeyfile(!pedited || pedited->sharpenEdge.enabled, "SharpenEdge", "Enabled", sharpenEdge.enabled, keyFile); saveToKeyfile(!pedited || pedited->sharpenEdge.passes, "SharpenEdge", "Passes", sharpenEdge.passes, keyFile); saveToKeyfile(!pedited || pedited->sharpenEdge.amount, "SharpenEdge", "Strength", sharpenEdge.amount, keyFile); saveToKeyfile(!pedited || pedited->sharpenEdge.threechannels, "SharpenEdge", "ThreeChannels", sharpenEdge.threechannels, keyFile); -//save micro-contrast sharpening + +// Micro-contrast sharpening saveToKeyfile(!pedited || pedited->sharpenMicro.enabled, "SharpenMicro", "Enabled", sharpenMicro.enabled, keyFile); saveToKeyfile(!pedited || pedited->sharpenMicro.matrix, "SharpenMicro", "Matrix", sharpenMicro.matrix, keyFile); saveToKeyfile(!pedited || pedited->sharpenMicro.amount, "SharpenMicro", "Strength", sharpenMicro.amount, keyFile); saveToKeyfile(!pedited || pedited->sharpenMicro.uniformity, "SharpenMicro", "Uniformity", sharpenMicro.uniformity, keyFile); /* - // save colorBoost + // colorBoost if (!pedited || pedited->colorBoost.amount) keyFile.set_integer ("Color Boost", "Amount", colorBoost.amount); if (!pedited || pedited->colorBoost.avoidclip) keyFile.set_boolean ("Color Boost", "AvoidColorClipping", colorBoost.avoidclip); if (!pedited || pedited->colorBoost.enable_saturationlimiter) keyFile.set_boolean ("Color Boost", "SaturationLimiter", colorBoost.enable_saturationlimiter); if (!pedited || pedited->colorBoost.saturationlimit) keyFile.set_double ("Color Boost", "SaturationLimit", colorBoost.saturationlimit); */ - // save wb + // wb saveToKeyfile(!pedited || pedited->wb.method, "White Balance", "Setting", wb.method, keyFile); saveToKeyfile(!pedited || pedited->wb.temperature, "White Balance", "Temperature", wb.temperature, keyFile); saveToKeyfile(!pedited || pedited->wb.green, "White Balance", "Green", wb.green, keyFile); saveToKeyfile(!pedited || pedited->wb.equal, "White Balance", "Equal", wb.equal, keyFile); saveToKeyfile(!pedited || pedited->wb.tempBias, "White Balance", "TemperatureBias", wb.tempBias, keyFile); /* - // save colorShift + // colorShift if (!pedited || pedited->colorShift.a) keyFile.set_double ("Color Shift", "ChannelA", colorShift.a); if (!pedited || pedited->colorShift.b) keyFile.set_double ("Color Shift", "ChannelB", colorShift.b); */ -// save colorappearance + +// Colorappearance saveToKeyfile(!pedited || pedited->colorappearance.enabled, "Color appearance", "Enabled", colorappearance.enabled, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.degree, "Color appearance", "Degree", colorappearance.degree, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.autodegree, "Color appearance", "AutoDegree", colorappearance.autodegree, keyFile); @@ -1918,16 +1926,17 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorappearance.curve2, "Color appearance", "Curve2", colorappearance.curve2, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.curve3, "Color appearance", "Curve3", colorappearance.curve3, keyFile); - -// save impulseDenoise +// Impulse denoise saveToKeyfile(!pedited || pedited->impulseDenoise.enabled, "Impulse Denoising", "Enabled", impulseDenoise.enabled, keyFile); saveToKeyfile(!pedited || pedited->impulseDenoise.thresh, "Impulse Denoising", "Threshold", impulseDenoise.thresh, keyFile); -// save defringe + +// Defringe saveToKeyfile(!pedited || pedited->defringe.enabled, "Defringing", "Enabled", defringe.enabled, keyFile); saveToKeyfile(!pedited || pedited->defringe.radius, "Defringing", "Radius", defringe.radius, keyFile); saveToKeyfile(!pedited || pedited->defringe.threshold, "Defringing", "Threshold", defringe.threshold, keyFile); saveToKeyfile(!pedited || pedited->defringe.huecurve, "Defringing", "HueCurve", defringe.huecurve, keyFile); -// save dirpyrDenoise + +// Directional pyramid denoising saveToKeyfile(!pedited || pedited->dirpyrDenoise.enabled, "Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.enhance, "Directional Pyramid Denoising", "Enhance", dirpyrDenoise.enhance, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.median, "Directional Pyramid Denoising", "Median", dirpyrDenoise.median, keyFile); @@ -1958,31 +1967,33 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->dirpyrDenoise.passes, "Directional Pyramid Denoising", "Passes", dirpyrDenoise.passes, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.lcurve, "Directional Pyramid Denoising", "LCurve", dirpyrDenoise.lcurve, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.cccurve, "Directional Pyramid Denoising", "CCCurve", dirpyrDenoise.cccurve, keyFile); -// save epd. + +// EPD saveToKeyfile(!pedited || pedited->epd.enabled, "EPD", "Enabled", epd.enabled, keyFile); saveToKeyfile(!pedited || pedited->epd.strength, "EPD", "Strength", epd.strength, keyFile); saveToKeyfile(!pedited || pedited->epd.gamma, "EPD", "Gamma", epd.gamma, keyFile); saveToKeyfile(!pedited || pedited->epd.edgeStopping, "EPD", "EdgeStopping", epd.edgeStopping, keyFile); saveToKeyfile(!pedited || pedited->epd.scale, "EPD", "Scale", epd.scale, keyFile); saveToKeyfile(!pedited || pedited->epd.reweightingIterates, "EPD", "ReweightingIterates", epd.reweightingIterates, keyFile); -// save fattal + +// Fattal saveToKeyfile(!pedited || pedited->fattal.enabled, "FattalToneMapping", "Enabled", fattal.enabled, keyFile); saveToKeyfile(!pedited || pedited->fattal.threshold, "FattalToneMapping", "Threshold", fattal.threshold, keyFile); saveToKeyfile(!pedited || pedited->fattal.amount, "FattalToneMapping", "Amount", fattal.amount, keyFile); /* - // save lumaDenoise + // lumaDenoise if (!pedited || pedited->lumaDenoise.enabled) keyFile.set_boolean ("Luminance Denoising", "Enabled", lumaDenoise.enabled); if (!pedited || pedited->lumaDenoise.radius) keyFile.set_double ("Luminance Denoising", "Radius", lumaDenoise.radius); if (!pedited || pedited->lumaDenoise.edgetolerance) keyFile.set_integer ("Luminance Denoising", "EdgeTolerance", lumaDenoise.edgetolerance); */ /* - // save colorDenoise + // colorDenoise //if (!pedited || pedited->colorDenoise.enabled) keyFile.set_boolean ("Chrominance Denoising", "Enabled", colorDenoise.enabled); if (!pedited || pedited->colorDenoise.amount) keyFile.set_integer ("Chrominance Denoising", "Amount", colorDenoise.amount); */ -// save sh +// Shadows & highlights saveToKeyfile(!pedited || pedited->sh.enabled, "Shadows & Highlights", "Enabled", sh.enabled, keyFile); saveToKeyfile(!pedited || pedited->sh.hq, "Shadows & Highlights", "HighQuality", sh.hq, keyFile); saveToKeyfile(!pedited || pedited->sh.highlights, "Shadows & Highlights", "Highlights", sh.highlights, keyFile); @@ -1991,7 +2002,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->sh.stonalwidth, "Shadows & Highlights", "ShadowTonalWidth", sh.stonalwidth, keyFile); saveToKeyfile(!pedited || pedited->sh.localcontrast, "Shadows & Highlights", "LocalContrast", sh.localcontrast, keyFile); saveToKeyfile(!pedited || pedited->sh.radius, "Shadows & Highlights", "Radius", sh.radius, keyFile); -// save crop + +// Crop saveToKeyfile(!pedited || pedited->crop.enabled, "Crop", "Enabled", crop.enabled, keyFile); saveToKeyfile(!pedited || pedited->crop.x, "Crop", "X", crop.x, keyFile); saveToKeyfile(!pedited || pedited->crop.y, "Crop", "Y", crop.y, keyFile); @@ -2001,17 +2013,22 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->crop.ratio, "Crop", "Ratio", crop.ratio, keyFile); saveToKeyfile(!pedited || pedited->crop.orientation, "Crop", "Orientation", crop.orientation, keyFile); saveToKeyfile(!pedited || pedited->crop.guide, "Crop", "Guide", crop.guide, keyFile); -// save coarse + +// Coarse transformation saveToKeyfile(!pedited || pedited->coarse.rotate, "Coarse Transformation", "Rotate", coarse.rotate, keyFile); saveToKeyfile(!pedited || pedited->coarse.hflip, "Coarse Transformation", "HorizontalFlip", coarse.hflip, keyFile); saveToKeyfile(!pedited || pedited->coarse.vflip, "Coarse Transformation", "VerticalFlip", coarse.vflip, keyFile); -// save commonTrans + +// Common properties for transformations saveToKeyfile(!pedited || pedited->commonTrans.autofill, "Common Properties for Transformations", "AutoFill", commonTrans.autofill, keyFile); -// save rotate + +// Rotation saveToKeyfile(!pedited || pedited->rotate.degree, "Rotation", "Degree", rotate.degree, keyFile); -// save distortion + +// Distortion saveToKeyfile(!pedited || pedited->distortion.amount, "Distortion", "Amount", distortion.amount, keyFile); -// lens profile + +// Lens profile saveToKeyfile(!pedited || pedited->lensProf.lcMode, "LensProfile", "LcMode", lensProf.getMethodString (lensProf.lcMode), keyFile); saveToKeyfile(!pedited || pedited->lensProf.lcpFile, "LensProfile", "LCPFile", relativePathIfInside (fname, fnameAbsolute, lensProf.lcpFile), keyFile); saveToKeyfile(!pedited || pedited->lensProf.useDist, "LensProfile", "UseDistortion", lensProf.useDist, keyFile); @@ -2020,31 +2037,37 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->lensProf.lfCameraMake, "LensProfile", "LFCameraMake", lensProf.lfCameraMake, keyFile); saveToKeyfile(!pedited || pedited->lensProf.lfCameraModel, "LensProfile", "LFCameraModel", lensProf.lfCameraModel, keyFile); saveToKeyfile(!pedited || pedited->lensProf.lfLens, "LensProfile", "LFLens", lensProf.lfLens, keyFile); -// save perspective correction + +// Perspective correction saveToKeyfile(!pedited || pedited->perspective.horizontal, "Perspective", "Horizontal", perspective.horizontal, keyFile); saveToKeyfile(!pedited || pedited->perspective.vertical, "Perspective", "Vertical", perspective.vertical, keyFile); -// save gradient + +// Gradient saveToKeyfile(!pedited || pedited->gradient.enabled, "Gradient", "Enabled", gradient.enabled, keyFile); saveToKeyfile(!pedited || pedited->gradient.degree, "Gradient", "Degree", gradient.degree, keyFile); saveToKeyfile(!pedited || pedited->gradient.feather, "Gradient", "Feather", gradient.feather, keyFile); saveToKeyfile(!pedited || pedited->gradient.strength, "Gradient", "Strength", gradient.strength, keyFile); saveToKeyfile(!pedited || pedited->gradient.centerX, "Gradient", "CenterX", gradient.centerX, keyFile); saveToKeyfile(!pedited || pedited->gradient.centerY, "Gradient", "CenterY", gradient.centerY, keyFile); -// save post-crop vignette + +// Post-crop vignette saveToKeyfile(!pedited || pedited->pcvignette.enabled, "PCVignette", "Enabled", pcvignette.enabled, keyFile); saveToKeyfile(!pedited || pedited->pcvignette.strength, "PCVignette", "Strength", pcvignette.strength, keyFile); saveToKeyfile(!pedited || pedited->pcvignette.feather, "PCVignette", "Feather", pcvignette.feather, keyFile); saveToKeyfile(!pedited || pedited->pcvignette.roundness, "PCVignette", "Roundness", pcvignette.roundness, keyFile); -// save C/A correction + +// C/A correction saveToKeyfile(!pedited || pedited->cacorrection.red, "CACorrection", "Red", cacorrection.red, keyFile); saveToKeyfile(!pedited || pedited->cacorrection.blue, "CACorrection", "Blue", cacorrection.blue, keyFile); -// save vignetting correction + +// Vignetting correction saveToKeyfile(!pedited || pedited->vignetting.amount, "Vignetting Correction", "Amount", vignetting.amount, keyFile); saveToKeyfile(!pedited || pedited->vignetting.radius, "Vignetting Correction", "Radius", vignetting.radius, keyFile); saveToKeyfile(!pedited || pedited->vignetting.strength, "Vignetting Correction", "Strength", vignetting.strength, keyFile); saveToKeyfile(!pedited || pedited->vignetting.centerX, "Vignetting Correction", "CenterX", vignetting.centerX, keyFile); saveToKeyfile(!pedited || pedited->vignetting.centerY, "Vignetting Correction", "CenterY", vignetting.centerY, keyFile); +// Resize saveToKeyfile(!pedited || pedited->resize.enabled, "Resize", "Enabled", resize.enabled, keyFile); saveToKeyfile(!pedited || pedited->resize.scale, "Resize", "Scale", resize.scale, keyFile); saveToKeyfile(!pedited || pedited->resize.appliesTo, "Resize", "AppliesTo", resize.appliesTo, keyFile); @@ -2052,6 +2075,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->resize.dataspec, "Resize", "DataSpecified", resize.dataspec, keyFile); saveToKeyfile(!pedited || pedited->resize.width, "Resize", "Width", resize.width, keyFile); saveToKeyfile(!pedited || pedited->resize.height, "Resize", "Height", resize.height, keyFile); + +// Post resize sharpening saveToKeyfile(!pedited || pedited->prsharpening.enabled, "PostResizeSharpening", "Enabled", prsharpening.enabled, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.method, "PostResizeSharpening", "Method", prsharpening.method, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.radius, "PostResizeSharpening", "Radius", prsharpening.radius, keyFile); @@ -2060,7 +2085,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::ArrayHandle thresh (prsharpening.threshold.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("PostResizeSharpening", "Threshold", thresh); } - saveToKeyfile(!pedited || pedited->prsharpening.edgesonly, "PostResizeSharpening", "OnlyEdges", prsharpening.edgesonly, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.edges_radius, "PostResizeSharpening", "EdgedetectionRadius", prsharpening.edges_radius, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.edges_tolerance, "PostResizeSharpening", "EdgeTolerance", prsharpening.edges_tolerance, keyFile); @@ -2071,7 +2095,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->prsharpening.deconvdamping, "PostResizeSharpening", "DeconvDamping", prsharpening.deconvdamping, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.deconviter, "PostResizeSharpening", "DeconvIterations", prsharpening.deconviter, keyFile); -// save color management settings +// Color management saveToKeyfile(!pedited || pedited->icm.input, "Color Management", "InputProfile", relativePathIfInside (fname, fnameAbsolute, icm.input), keyFile); saveToKeyfile(!pedited || pedited->icm.toneCurve, "Color Management", "ToneCurve", icm.toneCurve, keyFile); saveToKeyfile(!pedited || pedited->icm.applyLookTable, "Color Management", "ApplyLookTable", icm.applyLookTable, keyFile); @@ -2100,8 +2124,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->icm.gampos, "Color Management", "GammaValue", icm.gampos, keyFile); saveToKeyfile(!pedited || pedited->icm.slpos, "Color Management", "GammaSlope", icm.slpos, keyFile); - -// save wavelet parameters +// Wavelet saveToKeyfile(!pedited || pedited->wavelet.enabled, "Wavelet", "Enabled", wavelet.enabled, keyFile); saveToKeyfile(!pedited || pedited->wavelet.strength, "Wavelet", "Strength", wavelet.strength, keyFile); saveToKeyfile(!pedited || pedited->wavelet.balance, "Wavelet", "Balance", wavelet.balance, keyFile); @@ -2144,37 +2167,30 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::ArrayHandle thresh (wavelet.hllev.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "HLRange", thresh); } - if (!pedited || pedited->wavelet.bllev) { Glib::ArrayHandle thresh (wavelet.bllev.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "SHRange", thresh); } - if (!pedited || pedited->wavelet.edgcont) { Glib::ArrayHandle thresh (wavelet.edgcont.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "Edgcont", thresh); } - if (!pedited || pedited->wavelet.level0noise) { Glib::ArrayHandle thresh (wavelet.level0noise.value, 2, Glib::OWNERSHIP_NONE); keyFile.set_double_list ("Wavelet", "Level0noise", thresh); } - if (!pedited || pedited->wavelet.level1noise) { Glib::ArrayHandle thresh (wavelet.level1noise.value, 2, Glib::OWNERSHIP_NONE); keyFile.set_double_list ("Wavelet", "Level1noise", thresh); } - if (!pedited || pedited->wavelet.level2noise) { Glib::ArrayHandle thresh (wavelet.level2noise.value, 2, Glib::OWNERSHIP_NONE); keyFile.set_double_list ("Wavelet", "Level2noise", thresh); } - if (!pedited || pedited->wavelet.level3noise) { Glib::ArrayHandle thresh (wavelet.level3noise.value, 2, Glib::OWNERSHIP_NONE); keyFile.set_double_list ("Wavelet", "Level3noise", thresh); } - saveToKeyfile(!pedited || pedited->wavelet.threshold, "Wavelet", "ThresholdHighlight", wavelet.threshold, keyFile); saveToKeyfile(!pedited || pedited->wavelet.threshold2, "Wavelet", "ThresholdShadow", wavelet.threshold2, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgedetect, "Wavelet", "Edgedetect", wavelet.edgedetect, keyFile); @@ -2201,7 +2217,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::ArrayHandle thresh (wavelet.satlev.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "Satlev", thresh); } - saveToKeyfile(!pedited || pedited->wavelet.opacityCurveRG, "Wavelet", "OpacityCurveRG", wavelet.opacityCurveRG, keyFile); saveToKeyfile(!pedited || pedited->wavelet.opacityCurveBY, "Wavelet", "OpacityCurveBY", wavelet.opacityCurveBY, keyFile); saveToKeyfile(!pedited || pedited->wavelet.opacityCurveW, "Wavelet", "OpacityCurveW", wavelet.opacityCurveW, keyFile); @@ -2209,7 +2224,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->wavelet.hhcurve, "Wavelet", "HHcurve", wavelet.hhcurve, keyFile); saveToKeyfile(!pedited || pedited->wavelet.Chcurve, "Wavelet", "CHcurve", wavelet.Chcurve, keyFile); saveToKeyfile(!pedited || pedited->wavelet.wavclCurve, "Wavelet", "WavclCurve", wavelet.wavclCurve, keyFile); - saveToKeyfile(!pedited || pedited->wavelet.median, "Wavelet", "Median", wavelet.median, keyFile); saveToKeyfile(!pedited || pedited->wavelet.medianlev, "Wavelet", "Medianlev", wavelet.medianlev, keyFile); saveToKeyfile(!pedited || pedited->wavelet.linkedg, "Wavelet", "Linkedg", wavelet.linkedg, keyFile); @@ -2221,13 +2235,11 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::ArrayHandle thresh (wavelet.hueskin.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "Hueskin", thresh); } - saveToKeyfile(!pedited || pedited->wavelet.edgrad, "Wavelet", "Edgrad", wavelet.edgrad, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgval, "Wavelet", "Edgval", wavelet.edgval, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgthresh, "Wavelet", "ThrEdg", wavelet.edgthresh, keyFile); // if (!pedited || pedited->wavelet.strength) keyFile.set_integer ("Wavelet", "Strength", wavelet.strength); // if (!pedited || pedited->wavelet.balance) keyFile.set_integer ("Wavelet", "Balance", wavelet.balance); - saveToKeyfile(!pedited || pedited->wavelet.avoid, "Wavelet", "AvoidColorShift", wavelet.avoid, keyFile); saveToKeyfile(!pedited || pedited->wavelet.tmr, "Wavelet", "TMr", wavelet.tmr, keyFile); saveToKeyfile(!pedited || pedited->wavelet.rescon, "Wavelet", "ResidualcontShadow", wavelet.rescon, keyFile); @@ -2242,10 +2254,9 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::ArrayHandle thresh (wavelet.hueskin2.value, 4, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("Wavelet", "HueRange", thresh); } - saveToKeyfile(!pedited || pedited->wavelet.contrast, "Wavelet", "Contrast", wavelet.contrast, keyFile); -// save directional pyramid wavelet parameters +// Directional pyramid equalizer saveToKeyfile(!pedited || pedited->dirpyrequalizer.enabled, "Directional Pyramid Equalizer", "Enabled", dirpyrequalizer.enabled, keyFile); saveToKeyfile(!pedited || pedited->dirpyrequalizer.gamutlab, "Directional Pyramid Equalizer", "Gamutlab", dirpyrequalizer.gamutlab, keyFile); saveToKeyfile(!pedited || pedited->dirpyrequalizer.cbdlMethod, "Directional Pyramid Equalizer", "cbdlMethod", dirpyrequalizer.cbdlMethod, keyFile); @@ -2263,11 +2274,12 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_integer_list ("Directional Pyramid Equalizer", "Hueskin", thresh); } -// save hsv wavelet parameters +// HSV Equalizer saveToKeyfile(!pedited || pedited->hsvequalizer.hcurve, "HSV Equalizer", "HCurve", hsvequalizer.hcurve, keyFile); saveToKeyfile(!pedited || pedited->hsvequalizer.scurve, "HSV Equalizer", "SCurve", hsvequalizer.scurve, keyFile); saveToKeyfile(!pedited || pedited->hsvequalizer.vcurve, "HSV Equalizer", "VCurve", hsvequalizer.vcurve, keyFile); -//save film simulation parameters + +// Film simulation saveToKeyfile(!pedited || pedited->filmSimulation.enabled, "Film Simulation", "Enabled", filmSimulation.enabled, keyFile); saveToKeyfile(!pedited || pedited->filmSimulation.clutFilename, "Film Simulation", "ClutFilename", filmSimulation.clutFilename, keyFile); saveToKeyfile(!pedited || pedited->filmSimulation.strength, "Film Simulation", "Strength", filmSimulation.strength, keyFile); @@ -2276,7 +2288,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->rgbCurves.rcurve, "RGB Curves", "rCurve", rgbCurves.rcurve, keyFile); saveToKeyfile(!pedited || pedited->rgbCurves.gcurve, "RGB Curves", "gCurve", rgbCurves.gcurve, keyFile); saveToKeyfile(!pedited || pedited->rgbCurves.bcurve, "RGB Curves", "bCurve", rgbCurves.bcurve, keyFile); -// save Color Toning + +// Color toning saveToKeyfile(!pedited || pedited->colorToning.enabled, "ColorToning", "Enabled", colorToning.enabled, keyFile); saveToKeyfile(!pedited || pedited->colorToning.method, "ColorToning", "Method", colorToning.method, keyFile); saveToKeyfile(!pedited || pedited->colorToning.lumamode, "ColorToning", "Lumamode", colorToning.lumamode, keyFile); @@ -2308,24 +2321,24 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::ArrayHandle thresh (colorToning.shadowsColSat.value, 2, Glib::OWNERSHIP_NONE); keyFile.set_integer_list ("ColorToning", "ShadowsColorSaturation", thresh); } - saveToKeyfile(!pedited || pedited->colorToning.clcurve, "ColorToning", "ClCurve", colorToning.clcurve, keyFile); saveToKeyfile(!pedited || pedited->colorToning.cl2curve, "ColorToning", "Cl2Curve", colorToning.cl2curve, keyFile); -// save raw parameters + +// Raw saveToKeyfile(!pedited || pedited->raw.darkFrame, "RAW", "DarkFrame", relativePathIfInside (fname, fnameAbsolute, raw.dark_frame) , keyFile); - saveToKeyfile(!pedited || pedited->raw.dfAuto, "RAW", "DarkFrameAuto", raw.df_autoselect , keyFile); + saveToKeyfile(!pedited || pedited->raw.df_autoselect, "RAW", "DarkFrameAuto", raw.df_autoselect , keyFile); saveToKeyfile(!pedited || pedited->raw.ff_file, "RAW", "FlatFieldFile", relativePathIfInside (fname, fnameAbsolute, raw.ff_file) , keyFile); saveToKeyfile(!pedited || pedited->raw.ff_AutoSelect, "RAW", "FlatFieldAutoSelect", raw.ff_AutoSelect , keyFile); saveToKeyfile(!pedited || pedited->raw.ff_BlurRadius, "RAW", "FlatFieldBlurRadius", raw.ff_BlurRadius , keyFile); saveToKeyfile(!pedited || pedited->raw.ff_BlurType, "RAW", "FlatFieldBlurType", raw.ff_BlurType , keyFile); saveToKeyfile(!pedited || pedited->raw.ff_AutoClipControl, "RAW", "FlatFieldAutoClipControl", raw.ff_AutoClipControl , keyFile); saveToKeyfile(!pedited || pedited->raw.ff_clipControl, "RAW", "FlatFieldClipControl", raw.ff_clipControl , keyFile); - saveToKeyfile(!pedited || pedited->raw.caCorrection, "RAW", "CA", raw.ca_autocorrect , keyFile); - saveToKeyfile(!pedited || pedited->raw.caRed, "RAW", "CARed", raw.cared , keyFile); - saveToKeyfile(!pedited || pedited->raw.caBlue, "RAW", "CABlue", raw.cablue , keyFile); + saveToKeyfile(!pedited || pedited->raw.ca_autocorrect, "RAW", "CA", raw.ca_autocorrect , keyFile); + saveToKeyfile(!pedited || pedited->raw.cared, "RAW", "CARed", raw.cared , keyFile); + saveToKeyfile(!pedited || pedited->raw.cablue, "RAW", "CABlue", raw.cablue , keyFile); saveToKeyfile(!pedited || pedited->raw.hotPixelFilter, "RAW", "HotPixelFilter", raw.hotPixelFilter , keyFile); saveToKeyfile(!pedited || pedited->raw.deadPixelFilter, "RAW", "DeadPixelFilter", raw.deadPixelFilter , keyFile); - saveToKeyfile(!pedited || pedited->raw.hotDeadPixelThresh, "RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh , keyFile); + saveToKeyfile(!pedited || pedited->raw.hotdeadpix_thresh, "RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh , keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.method, "RAW Bayer", "Method", raw.bayersensor.method , keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.imageNum, "RAW Bayer", "ImageNum", raw.bayersensor.imageNum + 1 , keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.ccSteps, "RAW Bayer", "CcSteps", raw.bayersensor.ccSteps, keyFile); @@ -2375,17 +2388,18 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackGreen, "RAW X-Trans", "PreBlackGreen", raw.xtranssensor.blackgreen , keyFile); saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackBlue, "RAW X-Trans", "PreBlackBlue", raw.xtranssensor.blackblue , keyFile); -// save raw exposition +// Raw exposition saveToKeyfile(!pedited || pedited->raw.exPos, "RAW", "PreExposure", raw.expos , keyFile); saveToKeyfile(!pedited || pedited->raw.exPreser, "RAW", "PrePreserv", raw.preser , keyFile); -// save exif change list + +// EXIF change list if (!pedited || pedited->exif) { for (ExifPairs::const_iterator i = exif.begin(); i != exif.end(); ++i) { keyFile.set_string ("Exif", i->first, i->second); } } -// save iptc change list +// IPTC change list if (!pedited || pedited->iptc) { for (IPTCPairs::const_iterator i = iptc.begin(); i != iptc.end(); ++i) { Glib::ArrayHandle values = i->second; @@ -2471,8 +2485,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) fclose (f); - // load tonecurve: - ppVersion = PPVERSION; appVersion = APPVERSION; @@ -2507,7 +2519,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Exposure", "HighlightCompr", pedited, toneCurve.hlcompr, pedited->toneCurve.hlcompr); assignFromKeyfile(keyFile, "Exposure", "HighlightComprThreshold", pedited, toneCurve.hlcomprthresh, pedited->toneCurve.hlcomprthresh); assignFromKeyfile(keyFile, "Exposure", "ShadowCompr", pedited, toneCurve.shcompr, pedited->toneCurve.shcompr); -// load highlight recovery settings if (toneCurve.shcompr > 100) { toneCurve.shcompr = 100; // older pp3 files can have values above 100. } @@ -2535,7 +2546,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "HLRecovery", "Method", pedited, toneCurve.method, pedited->toneCurve.method); } - // load channel mixer curve if (keyFile.has_group ("Channel Mixer")) { if (keyFile.has_key ("Channel Mixer", "Red") && keyFile.has_key ("Channel Mixer", "Green") && keyFile.has_key ("Channel Mixer", "Blue")) { const std::vector rmix = keyFile.get_integer_list ("Channel Mixer", "Red"); @@ -2556,7 +2566,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } -// load black & white if (keyFile.has_group ("Black & White")) { assignFromKeyfile(keyFile, "Black & White", "Enabled", pedited, blackwhite.enabled, pedited->blackwhite.enabled); assignFromKeyfile(keyFile, "Black & White", "Method", pedited, blackwhite.method, pedited->blackwhite.method); @@ -2610,7 +2619,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) ); } -//load retinex if (keyFile.has_group ("Retinex")) { assignFromKeyfile(keyFile, "Retinex", "Median", pedited, retinex.medianmap, pedited->retinex.medianmap); assignFromKeyfile(keyFile, "Retinex", "RetinexMethod", pedited, retinex.retinexMethod, pedited->retinex.retinexMethod); @@ -2655,7 +2663,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } -// load luma curve if (keyFile.has_group ("Luminance Curve")) { assignFromKeyfile(keyFile, "Luminance Curve", "Brightness", pedited, labCurve.brightness, pedited->labCurve.brightness); assignFromKeyfile(keyFile, "Luminance Curve", "Contrast", pedited, labCurve.contrast, pedited->labCurve.contrast); @@ -2709,7 +2716,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } -// load sharpening if (keyFile.has_group ("Sharpening")) { assignFromKeyfile(keyFile, "Sharpening", "Enabled", pedited, sharpening.enabled, pedited->sharpening.enabled); assignFromKeyfile(keyFile, "Sharpening", "Radius", pedited, sharpening.radius, pedited->sharpening.radius); @@ -2743,7 +2749,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Sharpening", "DeconvIterations", pedited, sharpening.deconviter, pedited->sharpening.deconviter); } -// load edge sharpening if (keyFile.has_group ("SharpenEdge")) { assignFromKeyfile(keyFile, "SharpenEdge", "Enabled", pedited, sharpenEdge.enabled, pedited->sharpenEdge.enabled); assignFromKeyfile(keyFile, "SharpenEdge", "Passes", pedited, sharpenEdge.passes, pedited->sharpenEdge.passes); @@ -2751,7 +2756,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "SharpenEdge", "ThreeChannels", pedited, sharpenEdge.threechannels, pedited->sharpenEdge.threechannels); } -// load micro-contrast sharpening if (keyFile.has_group ("SharpenMicro")) { assignFromKeyfile(keyFile, "SharpenMicro", "Enabled", pedited, sharpenMicro.enabled, pedited->sharpenMicro.enabled); assignFromKeyfile(keyFile, "SharpenMicro", "Matrix", pedited, sharpenMicro.matrix, pedited->sharpenMicro.matrix); @@ -2759,7 +2763,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "SharpenMicro", "Uniformity", pedited, sharpenMicro.uniformity, pedited->sharpenMicro.uniformity); } -// load vibrance if (keyFile.has_group ("Vibrance")) { assignFromKeyfile(keyFile, "Vibrance", "Enabled", pedited, vibrance.enabled, pedited->vibrance.enabled); assignFromKeyfile(keyFile, "Vibrance", "Pastels", pedited, vibrance.pastels, pedited->vibrance.pastels); @@ -2802,7 +2805,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) if (keyFile.has_key ("Color Boost", "SaturationLimit")) { colorBoost.saturationlimit = keyFile.get_double ("Color Boost", "SaturationLimit"); if (pedited) pedited->colorBoost.saturationlimit = true; } }*/ - // load wb if (keyFile.has_group ("White Balance")) { assignFromKeyfile(keyFile, "White Balance", "Setting", pedited, wb.method, pedited->wb.method); assignFromKeyfile(keyFile, "White Balance", "Temperature", pedited, wb.temperature, pedited->wb.temperature); @@ -2817,7 +2819,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) if (keyFile.has_key ("Color Shift", "ChannelB")) { colorShift.b = keyFile.get_double ("Color Shift", "ChannelB"); if (pedited) pedited->colorShift.b = true; } }*/ - // load defringe if (keyFile.has_group ("Defringing")) { assignFromKeyfile(keyFile, "Defringing", "Enabled", pedited, defringe.enabled, pedited->defringe.enabled); assignFromKeyfile(keyFile, "Defringing", "Radius", pedited, defringe.radius, pedited->defringe.radius); @@ -2836,7 +2837,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Defringing", "HueCurve", pedited, defringe.huecurve, pedited->defringe.huecurve); } -// load colorappearance if (keyFile.has_group ("Color appearance")) { assignFromKeyfile(keyFile, "Color appearance", "Enabled", pedited, colorappearance.enabled, pedited->colorappearance.enabled); assignFromKeyfile(keyFile, "Color appearance", "Degree", pedited, colorappearance.degree, pedited->colorappearance.degree); @@ -2908,13 +2908,11 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } -// load impulseDenoise if (keyFile.has_group ("Impulse Denoising")) { assignFromKeyfile(keyFile, "Impulse Denoising", "Enabled", pedited, impulseDenoise.enabled, pedited->impulseDenoise.enabled); assignFromKeyfile(keyFile, "Impulse Denoising", "Threshold", pedited, impulseDenoise.thresh, pedited->impulseDenoise.thresh); } -// load dirpyrDenoise if (keyFile.has_group ("Directional Pyramid Denoising")) {//TODO: No longer an accurate description for FT denoise assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Enabled", pedited, dirpyrDenoise.enabled, pedited->dirpyrDenoise.enabled); assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Enhance", pedited, dirpyrDenoise.enhance, pedited->dirpyrDenoise.enhance); @@ -2950,7 +2948,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Passes", pedited, dirpyrDenoise.passes, pedited->dirpyrDenoise.passes); } -//Load EPD. if (keyFile.has_group ("EPD")) { assignFromKeyfile(keyFile, "EPD", "Enabled", pedited, epd.enabled, pedited->epd.enabled); assignFromKeyfile(keyFile, "EPD", "Strength", pedited, epd.strength, pedited->epd.strength); @@ -2960,7 +2957,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "EPD", "ReweightingIterates", pedited, epd.reweightingIterates, pedited->epd.reweightingIterates); } -//Load FattalToneMapping if (keyFile.has_group ("FattalToneMapping")) { assignFromKeyfile(keyFile, "FattalToneMapping", "Enabled", pedited, fattal.enabled, pedited->fattal.enabled); assignFromKeyfile(keyFile, "FattalToneMapping", "Threshold", pedited, fattal.threshold, pedited->fattal.threshold); @@ -2982,7 +2978,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) if (keyFile.has_key ("Chrominance Denoising", "Amount")) { colorDenoise.amount = keyFile.get_integer ("Chrominance Denoising", "Amount"); if (pedited) pedited->colorDenoise.amount = true; } }*/ - // load sh if (keyFile.has_group ("Shadows & Highlights")) { assignFromKeyfile(keyFile, "Shadows & Highlights", "Enabled", pedited, sh.enabled, pedited->sh.enabled); assignFromKeyfile(keyFile, "Shadows & Highlights", "HighQuality", pedited, sh.hq, pedited->sh.hq); @@ -2994,7 +2989,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Shadows & Highlights", "Radius", pedited, sh.radius, pedited->sh.radius); } -// load crop if (keyFile.has_group ("Crop")) { assignFromKeyfile(keyFile, "Crop", "Enabled", pedited, crop.enabled, pedited->crop.enabled); assignFromKeyfile(keyFile, "Crop", "X", pedited, crop.x, pedited->crop.x); @@ -3034,29 +3028,24 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Crop", "Guide", pedited, crop.guide, pedited->crop.guide); } -// load coarse if (keyFile.has_group ("Coarse Transformation")) { assignFromKeyfile(keyFile, "Coarse Transformation", "Rotate", pedited, coarse.rotate, pedited->coarse.rotate); assignFromKeyfile(keyFile, "Coarse Transformation", "HorizontalFlip", pedited, coarse.hflip, pedited->coarse.hflip); assignFromKeyfile(keyFile, "Coarse Transformation", "VerticalFlip", pedited, coarse.vflip, pedited->coarse.vflip); } -// load rotate if (keyFile.has_group ("Rotation")) { assignFromKeyfile(keyFile, "Rotation", "Degree", pedited, rotate.degree, pedited->rotate.degree); } -// load commonTrans if (keyFile.has_group ("Common Properties for Transformations")) { assignFromKeyfile(keyFile, "Common Properties for Transformations", "AutoFill", pedited, commonTrans.autofill, pedited->commonTrans.autofill); } -// load distortion if (keyFile.has_group ("Distortion")) { assignFromKeyfile(keyFile, "Distortion", "Amount", pedited, distortion.amount, pedited->distortion.amount); } -// lens profile if (keyFile.has_group ("LensProfile")) { if (keyFile.has_key ("LensProfile", "LcMode")) { lensProf.lcMode = lensProf.getMethodNumber (keyFile.get_string ("LensProfile", "LcMode")); @@ -3103,13 +3092,11 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } -// load perspective correction if (keyFile.has_group ("Perspective")) { assignFromKeyfile(keyFile, "Perspective", "Horizontal", pedited, perspective.horizontal, pedited->perspective.horizontal); assignFromKeyfile(keyFile, "Perspective", "Vertical", pedited, perspective.vertical, pedited->perspective.vertical); } -// load gradient if (keyFile.has_group ("Gradient")) { assignFromKeyfile(keyFile, "Gradient", "Enabled", pedited, gradient.enabled, pedited->gradient.enabled); assignFromKeyfile(keyFile, "Gradient", "Degree", pedited, gradient.degree, pedited->gradient.degree); @@ -3126,13 +3113,11 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "PCVignette", "Roundness", pedited, pcvignette.roundness, pedited->pcvignette.roundness); } -// load c/a correction if (keyFile.has_group ("CACorrection")) { assignFromKeyfile(keyFile, "CACorrection", "Red", pedited, cacorrection.red, pedited->cacorrection.red); assignFromKeyfile(keyFile, "CACorrection", "Blue", pedited, cacorrection.blue, pedited->cacorrection.blue); } -// load vignetting correction if (keyFile.has_group ("Vignetting Correction")) { assignFromKeyfile(keyFile, "Vignetting Correction", "Amount", pedited, vignetting.amount, pedited->vignetting.amount); assignFromKeyfile(keyFile, "Vignetting Correction", "Radius", pedited, vignetting.radius, pedited->vignetting.radius); @@ -3141,7 +3126,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Vignetting Correction", "CenterY", pedited, vignetting.centerY, pedited->vignetting.centerY); } -// load resize settings if (keyFile.has_group ("Resize")) { assignFromKeyfile(keyFile, "Resize", "Enabled", pedited, resize.enabled, pedited->resize.enabled); assignFromKeyfile(keyFile, "Resize", "Scale", pedited, resize.scale, pedited->resize.scale); @@ -3152,7 +3136,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Resize", "Height", pedited, resize.height, pedited->resize.height); } -// load post resize sharpening if (keyFile.has_group ("PostResizeSharpening")) { assignFromKeyfile(keyFile, "PostResizeSharpening", "Enabled", pedited, prsharpening.enabled, pedited->prsharpening.enabled); assignFromKeyfile(keyFile, "PostResizeSharpening", "Radius", pedited, prsharpening.radius, pedited->prsharpening.radius); @@ -3186,7 +3169,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "PostResizeSharpening", "DeconvIterations", pedited, prsharpening.deconviter, pedited->prsharpening.deconviter); } -// load color management settings if (keyFile.has_group ("Color Management")) { if (keyFile.has_key ("Color Management", "InputProfile")) { icm.input = expandRelativePath (fname, "file:", keyFile.get_string ("Color Management", "InputProfile")); @@ -3228,7 +3210,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color Management", "GammaSlope", pedited, icm.slpos, pedited->icm.slpos); } -// load wavelet wavelet parameters if (keyFile.has_group ("Wavelet")) { assignFromKeyfile(keyFile, "Wavelet", "Enabled", pedited, wavelet.enabled, pedited->wavelet.enabled); assignFromKeyfile(keyFile, "Wavelet", "Strength", pedited, wavelet.strength, pedited->wavelet.strength); @@ -3286,21 +3267,13 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "ThresholdResidShadow", pedited, wavelet.thr, pedited->wavelet.thr); assignFromKeyfile(keyFile, "Wavelet", "ThresholdResidHighLight", pedited, wavelet.thrH, pedited->wavelet.thrH); assignFromKeyfile(keyFile, "Wavelet", "ContrastCurve", pedited, wavelet.ccwcurve, pedited->wavelet.ccwcurve); - assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveRG", pedited, wavelet.opacityCurveRG, pedited->wavelet.opacityCurveRG); - assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveBY", pedited, wavelet.opacityCurveBY, pedited->wavelet.opacityCurveBY); - assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveW", pedited, wavelet.opacityCurveW, pedited->wavelet.opacityCurveW); - assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveWL", pedited, wavelet.opacityCurveWL, pedited->wavelet.opacityCurveWL); - assignFromKeyfile(keyFile, "Wavelet", "HHcurve", pedited, wavelet.hhcurve, pedited->wavelet.hhcurve); - assignFromKeyfile(keyFile, "Wavelet", "CHcurve", pedited, wavelet.Chcurve, pedited->wavelet.Chcurve); - assignFromKeyfile(keyFile, "Wavelet", "WavclCurve", pedited, wavelet.wavclCurve, pedited->wavelet.wavclCurve); - if (keyFile.has_key ("Wavelet", "Hueskin")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Hueskin"); @@ -3312,7 +3285,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.hueskin = true; } } - if (keyFile.has_key ("Wavelet", "HueRange")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "HueRange"); @@ -3324,7 +3296,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.hueskin2 = true; } } - if (keyFile.has_key ("Wavelet", "HLRange")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "HLRange"); @@ -3336,7 +3307,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.hllev = true; } } - if (keyFile.has_key ("Wavelet", "SHRange")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "SHRange"); @@ -3348,7 +3318,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.bllev = true; } } - if (keyFile.has_key ("Wavelet", "Edgcont")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Edgcont"); @@ -3360,7 +3329,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.edgcont = true; } } - if (keyFile.has_key ("Wavelet", "Level0noise")) { const std::vector thresh = keyFile.get_double_list ("Wavelet", "Level0noise"); @@ -3372,7 +3340,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.level0noise = true; } } - if (keyFile.has_key ("Wavelet", "Level1noise")) { const std::vector thresh = keyFile.get_double_list ("Wavelet", "Level1noise"); @@ -3384,7 +3351,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.level1noise = true; } } - if (keyFile.has_key ("Wavelet", "Level2noise")) { const std::vector thresh = keyFile.get_double_list ("Wavelet", "Level2noise"); @@ -3396,7 +3362,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.level2noise = true; } } - if (keyFile.has_key ("Wavelet", "Level3noise")) { const std::vector thresh = keyFile.get_double_list ("Wavelet", "Level3noise"); @@ -3408,8 +3373,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.level3noise = true; } } - - if (keyFile.has_key ("Wavelet", "Pastlev")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Pastlev"); @@ -3421,7 +3384,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.pastlev = true; } } - if (keyFile.has_key ("Wavelet", "Satlev")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Satlev"); @@ -3433,8 +3395,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.satlev = true; } } - - assignFromKeyfile(keyFile, "Wavelet", "Skinprotect", pedited, wavelet.skinprotect, pedited->wavelet.skinprotect); assignFromKeyfile(keyFile, "Wavelet", "Expcontrast", pedited, wavelet.expcontrast, pedited->wavelet.expcontrast); assignFromKeyfile(keyFile, "Wavelet", "Expchroma", pedited, wavelet.expchroma, pedited->wavelet.expchroma); @@ -3450,7 +3410,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } } - for (int i = 0; i < 9; i ++) { std::stringstream ss; ss << "Chroma" << (i + 1); @@ -3463,22 +3422,17 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } } - assignFromKeyfile(keyFile, "Wavelet", "Expedge", pedited, wavelet.expedge, pedited->wavelet.expedge); assignFromKeyfile(keyFile, "Wavelet", "Expresid", pedited, wavelet.expresid, pedited->wavelet.expresid); assignFromKeyfile(keyFile, "Wavelet", "Expfinal", pedited, wavelet.expfinal, pedited->wavelet.expfinal); assignFromKeyfile(keyFile, "Wavelet", "Exptoning", pedited, wavelet.exptoning, pedited->wavelet.exptoning); assignFromKeyfile(keyFile, "Wavelet", "Expnoise", pedited, wavelet.expnoise, pedited->wavelet.expnoise); - } -// load directional pyramid equalizer parameters if (keyFile.has_group ("Directional Pyramid Equalizer")) { assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "Enabled", pedited, dirpyrequalizer.enabled, pedited->dirpyrequalizer.enabled); assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "Gamutlab", pedited, dirpyrequalizer.gamutlab, pedited->dirpyrequalizer.gamutlab); - assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "cbdlMethod", pedited, dirpyrequalizer.cbdlMethod, pedited->dirpyrequalizer.cbdlMethod); - // if (keyFile.has_key ("Directional Pyramid Equalizer", "Algorithm")) { dirpyrequalizer.algo = keyFile.get_string ("Directional Pyramid Equalizer", "Algorithm"); if (pedited) pedited->dirpyrequalizer.algo = true; } if (keyFile.has_key ("Directional Pyramid Equalizer", "Hueskin")) { const std::vector thresh = keyFile.get_integer_list ("Directional Pyramid Equalizer", "Hueskin"); @@ -3491,7 +3445,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->dirpyrequalizer.hueskin = true; } } - if (ppVersion < 316) { for (int i = 0; i < 5; i ++) { std::stringstream ss; @@ -3535,68 +3488,44 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } -// load CLUT parameters - if ( keyFile.has_group ( "Film Simulation" ) ) { - if ( keyFile.has_key ( "Film Simulation", "Enabled" ) ) { - filmSimulation.enabled = keyFile.get_boolean ( "Film Simulation", "Enabled" ); - - if ( pedited ) { - pedited->filmSimulation.enabled = true; - } - } - - if ( keyFile.has_key ( "Film Simulation", "ClutFilename" ) ) { - filmSimulation.clutFilename = keyFile.get_string ( "Film Simulation", "ClutFilename" ); - - if ( pedited ) { - pedited->filmSimulation.clutFilename = true; - } - } - - if ( keyFile.has_key ( "Film Simulation", "Strength" ) ) { + if (keyFile.has_group ("Film Simulation")) { + assignFromKeyfile(keyFile, "Film Simulation", "Enabled", pedited, filmSimulation.enabled, pedited->filmSimulation.enabled); + assignFromKeyfile(keyFile, "Film Simulation", "ClutFilename", pedited, filmSimulation.clutFilename, pedited->filmSimulation.clutFilename); + if (keyFile.has_key ("Film Simulation", "Strength")) { if (ppVersion < 321) { - filmSimulation.strength = int (keyFile.get_double ( "Film Simulation", "Strength" ) * 100 + 0.1); + filmSimulation.strength = keyFile.get_double ("Film Simulation", "Strength") * 100 + 0.1; } else { - filmSimulation.strength = keyFile.get_integer ( "Film Simulation", "Strength" ); + filmSimulation.strength = keyFile.get_integer ("Film Simulation", "Strength"); } - if ( pedited ) { + if (pedited) { pedited->filmSimulation.strength = true; } } } -// load HSV wavelet parameters if (keyFile.has_group ("HSV Equalizer")) { if (ppVersion >= 300) { assignFromKeyfile(keyFile, "HSV Equalizer", "HCurve", pedited, hsvequalizer.hcurve, pedited->hsvequalizer.hcurve); - assignFromKeyfile(keyFile, "HSV Equalizer", "SCurve", pedited, hsvequalizer.scurve, pedited->hsvequalizer.scurve); - assignFromKeyfile(keyFile, "HSV Equalizer", "VCurve", pedited, hsvequalizer.vcurve, pedited->hsvequalizer.vcurve); } } -// load RGB curves if (keyFile.has_group ("RGB Curves")) { assignFromKeyfile(keyFile, "RGB Curves", "LumaMode", pedited, rgbCurves.lumamode, pedited->rgbCurves.lumamode); assignFromKeyfile(keyFile, "RGB Curves", "rCurve", pedited, rgbCurves.rcurve, pedited->rgbCurves.rcurve); - assignFromKeyfile(keyFile, "RGB Curves", "gCurve", pedited, rgbCurves.gcurve, pedited->rgbCurves.gcurve); - assignFromKeyfile(keyFile, "RGB Curves", "bCurve", pedited, rgbCurves.bcurve, pedited->rgbCurves.bcurve); } -// load Color Toning if (keyFile.has_group ("ColorToning")) { assignFromKeyfile(keyFile, "ColorToning", "Enabled", pedited, colorToning.enabled, pedited->colorToning.enabled); assignFromKeyfile(keyFile, "ColorToning", "Method", pedited, colorToning.method, pedited->colorToning.method); assignFromKeyfile(keyFile, "ColorToning", "Lumamode", pedited, colorToning.lumamode, pedited->colorToning.lumamode); assignFromKeyfile(keyFile, "ColorToning", "Twocolor", pedited, colorToning.twocolor, pedited->colorToning.twocolor); assignFromKeyfile(keyFile, "ColorToning", "OpacityCurve", pedited, colorToning.opacityCurve, pedited->colorToning.opacityCurve); - assignFromKeyfile(keyFile, "ColorToning", "ColorCurve", pedited, colorToning.colorCurve, pedited->colorToning.colorCurve); - assignFromKeyfile(keyFile, "ColorToning", "Autosat", pedited, colorToning.autosat, pedited->colorToning.autosat); assignFromKeyfile(keyFile, "ColorToning", "SatProtectionThreshold", pedited, colorToning.satProtectionThreshold, pedited->colorToning.satprotectionthreshold); assignFromKeyfile(keyFile, "ColorToning", "SaturatedOpacity", pedited, colorToning.saturatedOpacity, pedited->colorToning.saturatedopacity); @@ -3612,7 +3541,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->colorToning.hlColSat = true; } } - if (keyFile.has_key ("ColorToning", "ShadowsColorSaturation")) { const std::vector thresh = keyFile.get_integer_list ("ColorToning", "ShadowsColorSaturation"); @@ -3624,11 +3552,8 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->colorToning.shadowsColSat = true; } } - assignFromKeyfile(keyFile, "ColorToning", "ClCurve", pedited, colorToning.clcurve, pedited->colorToning.clcurve); - assignFromKeyfile(keyFile, "ColorToning", "Cl2Curve", pedited, colorToning.cl2curve, pedited->colorToning.cl2curve); - assignFromKeyfile(keyFile, "ColorToning", "Redlow", pedited, colorToning.redlow, pedited->colorToning.redlow); assignFromKeyfile(keyFile, "ColorToning", "Greenlow", pedited, colorToning.greenlow, pedited->colorToning.greenlow); assignFromKeyfile(keyFile, "ColorToning", "Bluelow", pedited, colorToning.bluelow, pedited->colorToning.bluelow); @@ -3643,7 +3568,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "ColorToning", "Bluehigh", pedited, colorToning.bluehigh, pedited->colorToning.bluehigh); } -// load raw settings if (keyFile.has_group ("RAW")) { if (keyFile.has_key ("RAW", "DarkFrame")) { raw.dark_frame = expandRelativePath (fname, "", keyFile.get_string ("RAW", "DarkFrame" )); @@ -3652,15 +3576,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.darkFrame = true; } } - - if (keyFile.has_key ("RAW", "DarkFrameAuto")) { - raw.df_autoselect = keyFile.get_boolean ("RAW", "DarkFrameAuto" ); - - if (pedited) { - pedited->raw.dfAuto = true; - } - } - + assignFromKeyfile(keyFile, "RAW", "DarkFrameAuto", pedited, raw.df_autoselect, pedited->raw.df_autoselect); if (keyFile.has_key ("RAW", "FlatFieldFile")) { raw.ff_file = expandRelativePath (fname, "", keyFile.get_string ("RAW", "FlatFieldFile" )); @@ -3668,117 +3584,27 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.ff_file = true; } } - - if (keyFile.has_key ("RAW", "FlatFieldAutoSelect")) { - raw.ff_AutoSelect = keyFile.get_boolean ("RAW", "FlatFieldAutoSelect" ); - - if (pedited) { - pedited->raw.ff_AutoSelect = true; - } - } - - if (keyFile.has_key ("RAW", "FlatFieldBlurRadius")) { - raw.ff_BlurRadius = keyFile.get_integer ("RAW", "FlatFieldBlurRadius" ); - - if (pedited) { - pedited->raw.ff_BlurRadius = true; - } - } - - if (keyFile.has_key ("RAW", "FlatFieldBlurType")) { - raw.ff_BlurType = keyFile.get_string ("RAW", "FlatFieldBlurType" ); - - if (pedited) { - pedited->raw.ff_BlurType = true; - } - } - - if (keyFile.has_key ("RAW", "FlatFieldAutoClipControl")) { - raw.ff_AutoClipControl = keyFile.get_boolean ("RAW", "FlatFieldAutoClipControl" ); - - if (pedited) { - pedited->raw.ff_AutoClipControl = true; - } - } - - if (keyFile.has_key ("RAW", "FlatFieldClipControl")) { - raw.ff_clipControl = keyFile.get_boolean ("RAW", "FlatFieldClipControl" ); - - if (pedited) { - pedited->raw.ff_clipControl = true; - } - } - - if (keyFile.has_key ("RAW", "CA")) { - raw.ca_autocorrect = keyFile.get_boolean ("RAW", "CA" ); - - if (pedited) { - pedited->raw.caCorrection = true; - } - } - - if (keyFile.has_key ("RAW", "CARed")) { - raw.cared = keyFile.get_double ("RAW", "CARed" ); - - if (pedited) { - pedited->raw.caRed = true; - } - } - - if (keyFile.has_key ("RAW", "CABlue")) { - raw.cablue = keyFile.get_double ("RAW", "CABlue" ); - - if (pedited) { - pedited->raw.caBlue = true; - } - } - -// for compatibility to elder pp3 versions - if (keyFile.has_key ("RAW", "HotDeadPixels")) { - raw.deadPixelFilter = raw.hotPixelFilter = keyFile.get_boolean ("RAW", "HotDeadPixels" ); - - if (pedited) { - pedited->raw.hotPixelFilter = pedited->raw.deadPixelFilter = true; - } - } - - if (keyFile.has_key ("RAW", "HotPixelFilter")) { - raw.hotPixelFilter = keyFile.get_boolean ("RAW", "HotPixelFilter" ); - - if (pedited) { - pedited->raw.hotPixelFilter = true; - } - } - - if (keyFile.has_key ("RAW", "DeadPixelFilter")) { - raw.deadPixelFilter = keyFile.get_boolean ("RAW", "DeadPixelFilter" ); - - if (pedited) { - pedited->raw.deadPixelFilter = true; - } - } - - if (keyFile.has_key ("RAW", "HotDeadPixelThresh")) { - raw.hotdeadpix_thresh = keyFile.get_integer ("RAW", "HotDeadPixelThresh" ); - - if (pedited) { - pedited->raw.hotDeadPixelThresh = true; - } - } - + assignFromKeyfile(keyFile, "RAW", "FlatFieldAutoSelect", pedited, raw.ff_AutoSelect, pedited->raw.ff_AutoSelect); + assignFromKeyfile(keyFile, "RAW", "FlatFieldBlurRadius", pedited, raw.ff_BlurRadius, pedited->raw.ff_BlurRadius); + assignFromKeyfile(keyFile, "RAW", "FlatFieldBlurType", pedited, raw.ff_BlurType, pedited->raw.ff_BlurType); + assignFromKeyfile(keyFile, "RAW", "FlatFieldAutoClipControl", pedited, raw.ff_AutoClipControl, pedited->raw.ff_AutoClipControl); + assignFromKeyfile(keyFile, "RAW", "FlatFieldClipControl", pedited, raw.ff_clipControl, pedited->raw.ff_clipControl); + assignFromKeyfile(keyFile, "RAW", "CA", pedited, raw.ca_autocorrect, pedited->raw.ca_autocorrect); + assignFromKeyfile(keyFile, "RAW", "CARed", pedited, raw.cared, pedited->raw.cared); + assignFromKeyfile(keyFile, "RAW", "CABlue", pedited, raw.cablue, pedited->raw.cablue); + // For compatibility to elder pp3 versions + assignFromKeyfile(keyFile, "RAW", "HotDeadPixels", pedited, raw.hotPixelFilter, pedited->raw.hotPixelFilter); + raw.deadPixelFilter = raw.hotPixelFilter; + pedited->raw.deadPixelFilter = pedited->raw.hotPixelFilter; + assignFromKeyfile(keyFile, "RAW", "HotPixelFilter", pedited, raw.hotPixelFilter, pedited->raw.hotPixelFilter); + assignFromKeyfile(keyFile, "RAW", "DeadPixelFilter", pedited, raw.deadPixelFilter, pedited->raw.deadPixelFilter); + assignFromKeyfile(keyFile, "RAW", "HotDeadPixelThresh", pedited, raw.hotdeadpix_thresh, pedited->raw.hotdeadpix_thresh); assignFromKeyfile(keyFile, "RAW", "PreExposure", pedited, raw.expos, pedited->raw.exPos); assignFromKeyfile(keyFile, "RAW", "PrePreserv", pedited, raw.preser, pedited->raw.exPreser); if (ppVersion < 320) { assignFromKeyfile(keyFile, "RAW", "Method", pedited, raw.bayersensor.method, pedited->raw.bayersensor.method); assignFromKeyfile(keyFile, "RAW", "CcSteps", pedited, raw.bayersensor.ccSteps, pedited->raw.bayersensor.ccSteps); - if (keyFile.has_key ("RAW", "LineDenoise")) { - raw.bayersensor.linenoise = keyFile.get_integer ("RAW", "LineDenoise" ); - - if (pedited) { - pedited->raw.bayersensor.linenoise = true; - } - } - + assignFromKeyfile(keyFile, "RAW", "LineDenoise", pedited, raw.bayersensor.linenoise, pedited->raw.bayersensor.linenoise); assignFromKeyfile(keyFile, "RAW", "GreenEqThreshold", pedited, raw.bayersensor.greenthresh, pedited->raw.bayersensor.greenEq); assignFromKeyfile(keyFile, "RAW", "DCBIterations", pedited, raw.bayersensor.dcb_iterations, pedited->raw.bayersensor.dcbIterations); assignFromKeyfile(keyFile, "RAW", "DCBEnhance", pedited, raw.bayersensor.dcb_enhance, pedited->raw.bayersensor.dcbEnhance); @@ -3792,7 +3618,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } -// load Bayer sensors' raw settings if (keyFile.has_group ("RAW Bayer")) { assignFromKeyfile(keyFile, "RAW Bayer", "Method", pedited, raw.bayersensor.method, pedited->raw.bayersensor.method); if (keyFile.has_key ("RAW Bayer", "ImageNum")) { @@ -3802,21 +3627,13 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.bayersensor.imageNum = true; } } - assignFromKeyfile(keyFile, "RAW Bayer", "CcSteps", pedited, raw.bayersensor.ccSteps, pedited->raw.bayersensor.ccSteps); assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack0", pedited, raw.bayersensor.black0, pedited->raw.bayersensor.exBlack0); assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack1", pedited, raw.bayersensor.black1, pedited->raw.bayersensor.exBlack1); assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack2", pedited, raw.bayersensor.black2, pedited->raw.bayersensor.exBlack2); assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack3", pedited, raw.bayersensor.black3, pedited->raw.bayersensor.exBlack3); assignFromKeyfile(keyFile, "RAW Bayer", "PreTwoGreen", pedited, raw.bayersensor.twogreen, pedited->raw.bayersensor.exTwoGreen); - if (keyFile.has_key ("RAW Bayer", "LineDenoise")) { - raw.bayersensor.linenoise = keyFile.get_integer ("RAW Bayer", "LineDenoise" ); - - if (pedited) { - pedited->raw.bayersensor.linenoise = true; - } - } - + assignFromKeyfile(keyFile, "RAW Bayer", "LineDenoise", pedited, raw.bayersensor.linenoise, pedited->raw.bayersensor.linenoise); assignFromKeyfile(keyFile, "RAW Bayer", "GreenEqThreshold", pedited, raw.bayersensor.greenthresh, pedited->raw.bayersensor.greenEq); assignFromKeyfile(keyFile, "RAW Bayer", "DCBIterations", pedited, raw.bayersensor.dcb_iterations, pedited->raw.bayersensor.dcbIterations); assignFromKeyfile(keyFile, "RAW Bayer", "DCBEnhance", pedited, raw.bayersensor.dcb_enhance, pedited->raw.bayersensor.dcbEnhance); @@ -3829,7 +3646,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.bayersensor.pixelShiftMotionCorrection = true; } } - if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrectionMethod")) { raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::ePSMotionCorrectionMethod)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrectionMethod"); @@ -3837,7 +3653,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod = true; } } - assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorGreen", pedited, raw.bayersensor.pixelShiftStddevFactorGreen, pedited->raw.bayersensor.pixelShiftStddevFactorGreen); assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorRed", pedited, raw.bayersensor.pixelShiftStddevFactorRed, pedited->raw.bayersensor.pixelShiftStddevFactorRed); assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorBlue", pedited, raw.bayersensor.pixelShiftStddevFactorBlue, pedited->raw.bayersensor.pixelShiftStddevFactorBlue); @@ -3867,7 +3682,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftNonGreenAmaze", pedited, raw.bayersensor.pixelShiftNonGreenAmaze, pedited->raw.bayersensor.pixelShiftNonGreenAmaze); } -// load X-Trans sensors' raw settings if (keyFile.has_group ("RAW X-Trans")) { assignFromKeyfile(keyFile, "RAW X-Trans", "Method", pedited, raw.xtranssensor.method, pedited->raw.xtranssensor.method); assignFromKeyfile(keyFile, "RAW X-Trans", "CcSteps", pedited, raw.xtranssensor.ccSteps, pedited->raw.xtranssensor.ccSteps); @@ -3876,13 +3690,11 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "RAW X-Trans", "PreBlackBlue", pedited, raw.xtranssensor.blackblue, pedited->raw.xtranssensor.exBlackBlue); } - // load exif change settings if (keyFile.has_group ("Exif")) { std::vector keys = keyFile.get_keys ("Exif"); - for (int i = 0; i < (int)keys.size(); i++) { - Glib::ustring tmpStr = keyFile.get_string ("Exif", keys[i]); - exif[keys[i]] = keyFile.get_string ("Exif", keys[i]); + for (const auto& key : keyFile.get_keys("Exif")) { + exif[key] = keyFile.get_string ("Exif", key); if (pedited) { pedited->exif = true; @@ -3903,12 +3715,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) * i.e. they don't merge */ if (keyFile.has_group ("IPTC")) { - std::vector keys = keyFile.get_keys ("IPTC"); - IPTCPairs::iterator element; - - for (unsigned int i = 0; i < keys.size(); i++) { + for (const auto& key : keyFile.get_keys("IPTC")) { // does this key already exist? - element = iptc.find (keys[i]); + const IPTCPairs::iterator element = iptc.find(key); if (element != iptc.end()) { // it already exist so we cleanup the values @@ -3916,13 +3725,8 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } // TODO: look out if merging Keywords and SupplementalCategories from the procparams chain would be interesting - std::vector currIptc = keyFile.get_string_list ("IPTC", keys[i]); - - for ( - std::vector::iterator currLoadedTagValue = currIptc.begin(); - currLoadedTagValue != currIptc.end(); - ++currLoadedTagValue) { - iptc[keys[i]].push_back (currLoadedTagValue->data()); + for (const auto& currLoadedTagValue : keyFile.get_string_list ("IPTC", key)) { + iptc[key].push_back (currLoadedTagValue); } if (pedited) { @@ -3931,7 +3735,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - return 0; } catch (const Glib::Error& e) { printf ("-->%s\n", e.what().c_str()); diff --git a/rtgui/darkframe.cc b/rtgui/darkframe.cc index ab9156d7d..9f1f61d18 100644 --- a/rtgui/darkframe.cc +++ b/rtgui/darkframe.cc @@ -77,7 +77,7 @@ void DarkFrame::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi dfAuto->set_active( pp->raw.df_autoselect ); if(pedited ) { - dfAuto->set_inconsistent(!pedited->raw.dfAuto ); + dfAuto->set_inconsistent(!pedited->raw.df_autoselect ); } if (Glib::file_test (pp->raw.dark_frame, Glib::FILE_TEST_EXISTS)) { @@ -152,7 +152,7 @@ void DarkFrame::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedit if (pedited) { pedited->raw.darkFrame = dfChanged; - pedited->raw.dfAuto = !dfAuto->get_inconsistent(); + pedited->raw.df_autoselect = !dfAuto->get_inconsistent(); } } diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index dc1a65b64..62643221a 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -423,14 +423,14 @@ void ParamsEdited::set (bool v) raw.xtranssensor.exBlackRed = v; raw.xtranssensor.exBlackGreen = v; raw.xtranssensor.exBlackBlue = v; - raw.caCorrection = v; - raw.caBlue = v; - raw.caRed = v; + raw.ca_autocorrect = v; + raw.cablue = v; + raw.cared = v; raw.hotPixelFilter = v; raw.deadPixelFilter = v; - raw.hotDeadPixelThresh = v; + raw.hotdeadpix_thresh = v; raw.darkFrame = v; - raw.dfAuto = v; + raw.df_autoselect = v; raw.ff_file = v; raw.ff_AutoSelect = v; raw.ff_BlurRadius = v; @@ -965,14 +965,14 @@ void ParamsEdited::initFrom (const std::vector raw.xtranssensor.exBlackRed = raw.xtranssensor.exBlackRed && p.raw.xtranssensor.blackred == other.raw.xtranssensor.blackred; raw.xtranssensor.exBlackGreen = raw.xtranssensor.exBlackGreen && p.raw.xtranssensor.blackgreen == other.raw.xtranssensor.blackgreen; raw.xtranssensor.exBlackBlue = raw.xtranssensor.exBlackBlue && p.raw.xtranssensor.blackblue == other.raw.xtranssensor.blackblue; - raw.caCorrection = raw.caCorrection && p.raw.ca_autocorrect == other.raw.ca_autocorrect; - raw.caRed = raw.caRed && p.raw.cared == other.raw.cared; - raw.caBlue = raw.caBlue && p.raw.cablue == other.raw.cablue; + raw.ca_autocorrect = raw.ca_autocorrect && p.raw.ca_autocorrect == other.raw.ca_autocorrect; + raw.cared = raw.cared && p.raw.cared == other.raw.cared; + raw.cablue = raw.cablue && p.raw.cablue == other.raw.cablue; raw.hotPixelFilter = raw.hotPixelFilter && p.raw.hotPixelFilter == other.raw.hotPixelFilter; raw.deadPixelFilter = raw.deadPixelFilter && p.raw.deadPixelFilter == other.raw.deadPixelFilter; - raw.hotDeadPixelThresh = raw.hotDeadPixelThresh && p.raw.hotdeadpix_thresh == other.raw.hotdeadpix_thresh; + raw.hotdeadpix_thresh = raw.hotdeadpix_thresh && p.raw.hotdeadpix_thresh == other.raw.hotdeadpix_thresh; raw.darkFrame = raw.darkFrame && p.raw.dark_frame == other.raw.dark_frame; - raw.dfAuto = raw.dfAuto && p.raw.df_autoselect == other.raw.df_autoselect; + raw.df_autoselect = raw.df_autoselect && p.raw.df_autoselect == other.raw.df_autoselect; raw.ff_file = raw.ff_file && p.raw.ff_file == other.raw.ff_file; raw.ff_AutoSelect = raw.ff_AutoSelect && p.raw.ff_AutoSelect == other.raw.ff_AutoSelect; raw.ff_BlurRadius = raw.ff_BlurRadius && p.raw.ff_BlurRadius == other.raw.ff_BlurRadius; @@ -2571,15 +2571,15 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.raw.xtranssensor.blackblue = dontforceSet && options.baBehav[ADDSET_RAWEXPOS_BLACKS] ? toEdit.raw.xtranssensor.blackblue + mods.raw.xtranssensor.blackblue : mods.raw.xtranssensor.blackblue; } - if (raw.caCorrection) { + if (raw.ca_autocorrect) { toEdit.raw.ca_autocorrect = mods.raw.ca_autocorrect; } - if (raw.caRed) { + if (raw.cared) { toEdit.raw.cared = dontforceSet && options.baBehav[ADDSET_RAWCACORR] ? toEdit.raw.cared + mods.raw.cared : mods.raw.cared; } - if (raw.caBlue) { + if (raw.cablue) { toEdit.raw.cablue = dontforceSet && options.baBehav[ADDSET_RAWCACORR] ? toEdit.raw.cablue + mods.raw.cablue : mods.raw.cablue; } @@ -2599,7 +2599,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.raw.deadPixelFilter = mods.raw.deadPixelFilter; } - if (raw.hotDeadPixelThresh) { + if (raw.hotdeadpix_thresh) { toEdit.raw.hotdeadpix_thresh = mods.raw.hotdeadpix_thresh; } @@ -2607,7 +2607,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.raw.dark_frame = mods.raw.dark_frame; } - if (raw.dfAuto) { + if (raw.df_autoselect) { toEdit.raw.df_autoselect = mods.raw.df_autoselect; } @@ -3062,8 +3062,8 @@ bool RAWParamsEdited::XTransSensor::isUnchanged() const bool RAWParamsEdited::isUnchanged() const { - return bayersensor.isUnchanged() && xtranssensor.isUnchanged() && caCorrection && caRed && caBlue && hotPixelFilter && deadPixelFilter && hotDeadPixelThresh && darkFrame - && dfAuto && ff_file && ff_AutoSelect && ff_BlurRadius && ff_BlurType && exPos && exPreser && ff_AutoClipControl && ff_clipControl; + return bayersensor.isUnchanged() && xtranssensor.isUnchanged() && ca_autocorrect && cared && cablue && hotPixelFilter && deadPixelFilter && hotdeadpix_thresh && darkFrame + && df_autoselect && ff_file && ff_AutoSelect && ff_BlurRadius && ff_BlurType && exPos && exPreser && ff_AutoClipControl && ff_clipControl; } bool LensProfParamsEdited::isUnchanged() const diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 4d205b1f5..587c89af7 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -764,14 +764,14 @@ public: BayerSensor bayersensor; XTransSensor xtranssensor; - bool caCorrection; - bool caRed; - bool caBlue; + bool ca_autocorrect; + bool cared; + bool cablue; bool hotPixelFilter; bool deadPixelFilter; - bool hotDeadPixelThresh; + bool hotdeadpix_thresh; bool darkFrame; - bool dfAuto; + bool df_autoselect; bool ff_file; bool ff_AutoSelect; bool ff_BlurRadius; diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 7d91e0172..6683bc57b 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -943,12 +943,12 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param } if (!raw_ca_autocorrect->get_active ()) { - filterPE.raw.caCorrection = falsePE.raw.caCorrection; + filterPE.raw.ca_autocorrect = falsePE.raw.ca_autocorrect; } if (!raw_caredblue->get_active ()) { - filterPE.raw.caRed = falsePE.raw.caRed; - filterPE.raw.caBlue = falsePE.raw.caBlue; + filterPE.raw.cared = falsePE.raw.cared; + filterPE.raw.cablue = falsePE.raw.cablue; } if (!raw_hotpix_filt->get_active ()) { @@ -960,7 +960,7 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param } if (!raw_deadpix_filt->get_active () && !raw_hotpix_filt->get_active ()) { - filterPE.raw.hotDeadPixelThresh = falsePE.raw.hotDeadPixelThresh; + filterPE.raw.hotdeadpix_thresh = falsePE.raw.hotdeadpix_thresh; } if (!df_file->get_active ()) { @@ -968,7 +968,7 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param } if (!df_AutoSelect->get_active ()) { - filterPE.raw.dfAuto = falsePE.raw.dfAuto; + filterPE.raw.df_autoselect = falsePE.raw.df_autoselect; } if (!ff_file->get_active ()) { diff --git a/rtgui/preprocess.cc b/rtgui/preprocess.cc index 44d054214..02e0ff220 100644 --- a/rtgui/preprocess.cc +++ b/rtgui/preprocess.cc @@ -81,7 +81,7 @@ void PreProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedi pp->raw.hotdeadpix_thresh = hdThreshold->getIntValue(); if (pedited) { - pedited->raw.hotDeadPixelThresh = hdThreshold->getEditedState (); + pedited->raw.hotdeadpix_thresh = hdThreshold->getEditedState (); pedited->raw.hotPixelFilter = !hotPixel->get_inconsistent(); pedited->raw.deadPixelFilter = !deadPixel->get_inconsistent(); } diff --git a/rtgui/rawcacorrection.cc b/rtgui/rawcacorrection.cc index ca3b1a970..75c60a7a2 100644 --- a/rtgui/rawcacorrection.cc +++ b/rtgui/rawcacorrection.cc @@ -61,9 +61,9 @@ void RAWCACorr::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi disableListener (); if(pedited ) { - caAutocorrect->setEdited(pedited->raw.caCorrection); - caRed->setEditedState( pedited->raw.caRed ? Edited : UnEdited ); - caBlue->setEditedState( pedited->raw.caBlue ? Edited : UnEdited ); + caAutocorrect->setEdited(pedited->raw.ca_autocorrect); + caRed->setEditedState( pedited->raw.cared ? Edited : UnEdited ); + caBlue->setEditedState( pedited->raw.cablue ? Edited : UnEdited ); } // disable Red and Blue sliders when caAutocorrect is enabled @@ -84,9 +84,9 @@ void RAWCACorr::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedit pp->raw.cablue = caBlue->getValue(); if (pedited) { - pedited->raw.caCorrection = !caAutocorrect->get_inconsistent(); - pedited->raw.caRed = caRed->getEditedState (); - pedited->raw.caBlue = caBlue->getEditedState (); + pedited->raw.ca_autocorrect = !caAutocorrect->get_inconsistent(); + pedited->raw.cared = caRed->getEditedState (); + pedited->raw.cablue = caBlue->getEditedState (); } } @@ -132,8 +132,8 @@ void RAWCACorr::setDefaults(const rtengine::procparams::ProcParams* defParams, c caBlue->setDefault( defParams->raw.cablue); if (pedited) { - caRed->setDefaultEditedState( pedited->raw.caRed ? Edited : UnEdited); - caBlue->setDefaultEditedState( pedited->raw.caBlue ? Edited : UnEdited); + caRed->setDefaultEditedState( pedited->raw.cared ? Edited : UnEdited); + caBlue->setDefaultEditedState( pedited->raw.cablue ? Edited : UnEdited); } else { caRed->setDefaultEditedState( Irrelevant ); caBlue->setDefaultEditedState( Irrelevant ); From aa414fca416c557f29a117c97d15691b20c8b676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Mon, 13 Nov 2017 22:00:27 +0100 Subject: [PATCH 03/47] Clean `rtengine::procparams::Threshold` --- rtengine/improcfun.cc | 44 +++--- rtengine/ipvibrance.cc | 4 +- rtengine/ipwavelet.cc | 72 ++++----- rtengine/procparams.cc | 120 +++++---------- rtengine/procparams.h | 290 ++++++++++++++++++------------------- rtgui/thresholdadjuster.cc | 12 +- rtgui/thresholdselector.h | 16 +- 7 files changed, 257 insertions(+), 301 deletions(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 516e0ee9d..829384cc6 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -1268,10 +1268,10 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh //if(params->dirpyrequalizer.enabled) if(execsharp) { if (params->dirpyrequalizer.enabled) { if (params->dirpyrequalizer.gamutlab /*&& execsharp*/) { - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; + float b_l = static_cast (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.0f; + float t_l = static_cast (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; + float b_r = static_cast (params->dirpyrequalizer.hueskin.getBottomRight()) / 100.0f; + float t_r = static_cast (params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; float artifact = (float) settings->artifact_cbdl; @@ -1312,10 +1312,10 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh // if (params->dirpyrequalizer.algo=="FI") choice=0; // else if(params->dirpyrequalizer.algo=="LA") choice=1; if (rtt == 1) { - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; + float b_l = static_cast (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.0f; + float t_l = static_cast (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; + float b_r = static_cast (params->dirpyrequalizer.hueskin.getBottomRight()) / 100.0f; + float t_r = static_cast (params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; int choice = 0; //not disabled in case of ! always 0 dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, true, params->dirpyrequalizer.gamutlab, b_l, t_l, t_r, b_r, choice, scale); //contrast by detail adapted to CIECAM } @@ -2707,10 +2707,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int //if(params->dirpyrequalizer.enabled) if(execsharp) { if (params->dirpyrequalizer.enabled) { if (params->dirpyrequalizer.gamutlab /*&& execsharp*/) { //remove artifacts by gaussian blur - skin control - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; + float b_l = static_cast (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.0f; + float t_l = static_cast (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; + float b_r = static_cast (params->dirpyrequalizer.hueskin.getBottomRight()) / 100.0f; + float t_r = static_cast (params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; float artifact = (float) settings->artifact_cbdl; if (artifact > 6.f) { @@ -2761,10 +2761,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int // else if(params->dirpyrequalizer.algo=="LA") choice=1; if (rtt == 1) { - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; + float b_l = static_cast (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.0f; + float t_l = static_cast (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; + float b_r = static_cast (params->dirpyrequalizer.hueskin.getBottomRight()) / 100.0f; + float t_r = static_cast (params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; int choice = 0; // I have not suppress this statement in case of !! always to 0 lab->deleteLab(); dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, true, params->dirpyrequalizer.gamutlab, b_l, t_l, t_r, b_r, choice, scale); //contrast by detail adapted to CIECAM @@ -3337,8 +3337,8 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer float RedHigh = (100.f + float (params->colorToning.redhigh)) / 100.f; //printf("RedH=%f\n",RedHigh); float GreenHigh = (100.f + float (params->colorToning.greenhigh)) / 100.f; float BlueHigh = (100.f + float (params->colorToning.bluehigh)) / 100.f; - float SatLow = float (params->colorToning.shadowsColSat.value[0]) / 100.f; - float SatHigh = float (params->colorToning.hlColSat.value[0]) / 100.f; + float SatLow = float (params->colorToning.shadowsColSat.getBottom()) / 100.f; + float SatHigh = float (params->colorToning.hlColSat.getBottom()) / 100.f; float Balan = float (params->colorToning.balance); @@ -6512,10 +6512,10 @@ void ImProcFunctions::badpixlab (LabImage* lab, double rad, int thr, int mode, f void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale) { if (params->dirpyrequalizer.enabled && lab->W >= 8 && lab->H >= 8) { - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; + float b_l = static_cast (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.0f; + float t_l = static_cast (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; + float b_r = static_cast (params->dirpyrequalizer.hueskin.getBottomRight()) / 100.0f; + float t_r = static_cast (params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; int choice = 0; //I have not disabled this statement in case of ! always 0 // if (params->dirpyrequalizer.algo=="FI") choice=0; // else if(params->dirpyrequalizer.algo=="LA") choice=1; diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc index 68efd1aea..f17d5d9b1 100644 --- a/rtengine/ipvibrance.cc +++ b/rtengine/ipvibrance.cc @@ -126,7 +126,7 @@ void ImProcFunctions::vibrance (LabImage* lab) const float chromaPastel = float (params->vibrance.pastels) / 100.0f; const float chromaSatur = float (params->vibrance.saturated) / 100.0f; const float p00 = 0.07f; - const float limitpastelsatur = (static_cast (params->vibrance.psthreshold.value[ThresholdSelector::TS_TOPLEFT]) / 100.0f) * (1.0f - p00) + p00; + const float limitpastelsatur = (static_cast(params->vibrance.psthreshold.getTopLeft()) / 100.0f) * (1.0f - p00) + p00; const float maxdp = (limitpastelsatur - p00) / 4.0f; const float maxds = (1.0 - limitpastelsatur) / 4.0f; const float p0 = p00 + maxdp; @@ -135,7 +135,7 @@ void ImProcFunctions::vibrance (LabImage* lab) const float s0 = limitpastelsatur + maxds; const float s1 = limitpastelsatur + 2.0f * maxds; const float s2 = limitpastelsatur + 3.0f * maxds; - const float transitionweighting = static_cast (params->vibrance.psthreshold.value[ThresholdSelector::TS_BOTTOMLEFT]) / 100.0f; + const float transitionweighting = static_cast(params->vibrance.psthreshold.getBottomLeft()) / 100.0f; float chromamean = 0.0f; if (chromaPastel != chromaSatur) { diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index dd2a32e10..e228b2de6 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -432,56 +432,56 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int cp.thH = float(waparams.thrH); cp.sky = waparams.sky; //skin - cp.b_l = static_cast(params->wavelet.hueskin.value[0]) / 100.0f; - cp.t_l = static_cast(params->wavelet.hueskin.value[1]) / 100.0f; - cp.b_r = static_cast(params->wavelet.hueskin.value[2]) / 100.0f; - cp.t_r = static_cast(params->wavelet.hueskin.value[3]) / 100.0f; + cp.b_l = static_cast(params->wavelet.hueskin.getBottomLeft()) / 100.0f; + cp.t_l = static_cast(params->wavelet.hueskin.getTopLeft()) / 100.0f; + cp.b_r = static_cast(params->wavelet.hueskin.getBottomRight()) / 100.0f; + cp.t_r = static_cast(params->wavelet.hueskin.getTopRight()) / 100.0f; - cp.b_ly = static_cast(params->wavelet.hueskin2.value[0]) / 100.0f; - cp.t_ly = static_cast(params->wavelet.hueskin2.value[1]) / 100.0f; - cp.b_ry = static_cast(params->wavelet.hueskin2.value[2]) / 100.0f; - cp.t_ry = static_cast(params->wavelet.hueskin2.value[3]) / 100.0f; + cp.b_ly = static_cast(params->wavelet.hueskin2.getBottomLeft()) / 100.0f; + cp.t_ly = static_cast(params->wavelet.hueskin2.getTopLeft()) / 100.0f; + cp.b_ry = static_cast(params->wavelet.hueskin2.getBottomRight()) / 100.0f; + cp.t_ry = static_cast(params->wavelet.hueskin2.getTopRight()) / 100.0f; cp.numlevH = params->wavelet.threshold; //shadows - cp.b_lsl = static_cast(params->wavelet.bllev.value[0]); - cp.t_lsl = static_cast(params->wavelet.bllev.value[1]); - cp.b_rsl = static_cast(params->wavelet.bllev.value[2]); - cp.t_rsl = static_cast(params->wavelet.bllev.value[3]); + cp.b_lsl = static_cast(params->wavelet.bllev.getBottomLeft()); + cp.t_lsl = static_cast(params->wavelet.bllev.getTopLeft()); + cp.b_rsl = static_cast(params->wavelet.bllev.getBottomRight()); + cp.t_rsl = static_cast(params->wavelet.bllev.getTopRight()); cp.numlevS = params->wavelet.threshold2; int maxlevS = 9 - cp.numlevH; cp.numlevS = MIN(cp.numlevS, maxlevS); //printf("levHigh=%d levShad=%d\n",cp.numlevH,cp.numlevS); //highlight - cp.b_lhl = static_cast(params->wavelet.hllev.value[0]); - cp.t_lhl = static_cast(params->wavelet.hllev.value[1]); - cp.b_rhl = static_cast(params->wavelet.hllev.value[2]); - cp.t_rhl = static_cast(params->wavelet.hllev.value[3]); + cp.b_lhl = static_cast(params->wavelet.hllev.getBottomLeft()); + cp.t_lhl = static_cast(params->wavelet.hllev.getTopLeft()); + cp.b_rhl = static_cast(params->wavelet.hllev.getBottomRight()); + cp.t_rhl = static_cast(params->wavelet.hllev.getTopRight()); //printf("BL=%f TL=%f BR=%f TR=%f\n",cp.b_lhl,cp.t_lhl,cp.b_rhl,cp.t_rhl); //pastel - cp.b_lpast = static_cast(params->wavelet.pastlev.value[0]); - cp.t_lpast = static_cast(params->wavelet.pastlev.value[1]); - cp.b_rpast = static_cast(params->wavelet.pastlev.value[2]); - cp.t_rpast = static_cast(params->wavelet.pastlev.value[3]); + cp.b_lpast = static_cast(params->wavelet.pastlev.getBottomLeft()); + cp.t_lpast = static_cast(params->wavelet.pastlev.getTopLeft()); + cp.b_rpast = static_cast(params->wavelet.pastlev.getBottomRight()); + cp.t_rpast = static_cast(params->wavelet.pastlev.getTopRight()); //saturated - cp.b_lsat = static_cast(params->wavelet.satlev.value[0]); - cp.t_lsat = static_cast(params->wavelet.satlev.value[1]); - cp.b_rsat = static_cast(params->wavelet.satlev.value[2]); - cp.t_rsat = static_cast(params->wavelet.satlev.value[3]); + cp.b_lsat = static_cast(params->wavelet.satlev.getBottomLeft()); + cp.t_lsat = static_cast(params->wavelet.satlev.getTopLeft()); + cp.b_rsat = static_cast(params->wavelet.satlev.getBottomRight()); + cp.t_rsat = static_cast(params->wavelet.satlev.getTopRight()); //edge local contrast - cp.edg_low = static_cast(params->wavelet.edgcont.value[0]); - cp.edg_mean = static_cast(params->wavelet.edgcont.value[1]); - cp.edg_max = static_cast(params->wavelet.edgcont.value[2]); - cp.edg_sd = static_cast(params->wavelet.edgcont.value[3]); + cp.edg_low = static_cast(params->wavelet.edgcont.getBottomLeft()); + cp.edg_mean = static_cast(params->wavelet.edgcont.getTopLeft()); + cp.edg_max = static_cast(params->wavelet.edgcont.getBottomRight()); + cp.edg_sd = static_cast(params->wavelet.edgcont.getTopRight()); //level noise - cp.lev0s = static_cast(params->wavelet.level0noise.value[0]); - cp.lev0n = static_cast(params->wavelet.level0noise.value[1]); - cp.lev1s = static_cast(params->wavelet.level1noise.value[0]); - cp.lev1n = static_cast(params->wavelet.level1noise.value[1]); - cp.lev2s = static_cast(params->wavelet.level2noise.value[0]); - cp.lev2n = static_cast(params->wavelet.level2noise.value[1]); - cp.lev3s = static_cast(params->wavelet.level3noise.value[0]); - cp.lev3n = static_cast(params->wavelet.level3noise.value[1]); + cp.lev0s = static_cast(params->wavelet.level0noise.getBottom()); + cp.lev0n = static_cast(params->wavelet.level0noise.getTop()); + cp.lev1s = static_cast(params->wavelet.level1noise.getBottom()); + cp.lev1n = static_cast(params->wavelet.level1noise.getTop()); + cp.lev2s = static_cast(params->wavelet.level2noise.getBottom()); + cp.lev2n = static_cast(params->wavelet.level2noise.getTop()); + cp.lev3s = static_cast(params->wavelet.level3noise.getBottom()); + cp.lev3n = static_cast(params->wavelet.level3noise.getTop()); cp.detectedge = params->wavelet.medianlev; //printf("low=%f mean=%f sd=%f max=%f\n",cp.edg_low,cp.edg_mean,cp.edg_sd,cp.edg_max); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index c00f45f14..365cbc32a 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -192,6 +192,17 @@ void putToKeyfile( keyfile.set_string(group_name, key, value); } +void putToKeyfile( + const Glib::ustring& group_name, + const Glib::ustring& key, + const std::vector& value, + Glib::KeyFile& keyfile +) +{ + const Glib::ArrayHandle list = value; + keyfile.set_integer_list(group_name, key, list); +} + void putToKeyfile( const Glib::ustring& group_name, const Glib::ustring& key, @@ -729,7 +740,7 @@ void ColorToningParams::mixerToCurve (std::vector &colorCurve, std::vect void ColorToningParams::slidersToCurve (std::vector &colorCurve, std::vector &opacityCurve) const { - if (hlColSat.value[0] == 0 && shadowsColSat.value[0] == 0) { // if both opacity are null, set both curves to Linear + if (hlColSat.getBottom() == 0 && shadowsColSat.getBottom() == 0) { // if both opacity are null, set both curves to Linear colorCurve.resize (1); colorCurve.at (0) = FCT_Linear; opacityCurve.resize (1); @@ -740,22 +751,22 @@ void ColorToningParams::slidersToCurve (std::vector &colorCurve, std::ve colorCurve.resize (9); colorCurve.at (0) = FCT_MinMaxCPoints; colorCurve.at (1) = 0.26 + 0.12 * double (balance) / 100.; - colorCurve.at (2) = double (shadowsColSat.value[1]) / 360.; + colorCurve.at (2) = double (shadowsColSat.getTop()) / 360.; colorCurve.at (3) = 0.35; colorCurve.at (4) = 0.35; colorCurve.at (5) = 0.64 + 0.12 * double (balance) / 100.; - colorCurve.at (6) = double (hlColSat.value[1]) / 360.; + colorCurve.at (6) = double (hlColSat.getTop()) / 360.; colorCurve.at (7) = 0.35; colorCurve.at (8) = 0.35; opacityCurve.resize (9); opacityCurve.at (0) = FCT_MinMaxCPoints; opacityCurve.at (1) = colorCurve.at (1); - opacityCurve.at (2) = double (shadowsColSat.value[0]) / 100.; + opacityCurve.at (2) = double (shadowsColSat.getBottom()) / 100.; opacityCurve.at (3) = 0.35; opacityCurve.at (4) = 0.35; opacityCurve.at (5) = colorCurve.at (5); - opacityCurve.at (6) = double (hlColSat.value[0]) / 100.; + opacityCurve.at (6) = double (hlColSat.getBottom()) / 100.; opacityCurve.at (7) = 0.35; opacityCurve.at (8) = 0.35; } @@ -1803,11 +1814,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->sharpening.method, "Sharpening", "Method", sharpening.method, keyFile); saveToKeyfile(!pedited || pedited->sharpening.radius, "Sharpening", "Radius", sharpening.radius, keyFile); saveToKeyfile(!pedited || pedited->sharpening.amount, "Sharpening", "Amount", sharpening.amount, keyFile); - if (!pedited || pedited->sharpening.threshold) { - Glib::ArrayHandle thresh (sharpening.threshold.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Sharpening", "Threshold", thresh); - } - + saveToKeyfile(!pedited || pedited->sharpening.threshold, "Sharpening", "Threshold", sharpening.threshold.toVector(), keyFile); saveToKeyfile(!pedited || pedited->sharpening.edgesonly, "Sharpening", "OnlyEdges", sharpening.edgesonly, keyFile); saveToKeyfile(!pedited || pedited->sharpening.edges_radius, "Sharpening", "EdgedetectionRadius", sharpening.edges_radius, keyFile); saveToKeyfile(!pedited || pedited->sharpening.edges_tolerance, "Sharpening", "EdgeTolerance", sharpening.edges_tolerance, keyFile); @@ -1822,11 +1829,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->vibrance.enabled, "Vibrance", "Enabled", vibrance.enabled, keyFile); saveToKeyfile(!pedited || pedited->vibrance.pastels, "Vibrance", "Pastels", vibrance.pastels, keyFile); saveToKeyfile(!pedited || pedited->vibrance.saturated, "Vibrance", "Saturated", vibrance.saturated, keyFile); - if (!pedited || pedited->vibrance.psthreshold) { - Glib::ArrayHandle thresh (vibrance.psthreshold.value, 2, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Vibrance", "PSThreshold", thresh); - } - + saveToKeyfile(!pedited || pedited->vibrance.psthreshold, "Vibrance", "PSThreshold", vibrance.psthreshold.toVector(), keyFile); saveToKeyfile(!pedited || pedited->vibrance.protectskins, "Vibrance", "ProtectSkins", vibrance.protectskins, keyFile); saveToKeyfile(!pedited || pedited->vibrance.avoidcolorshift, "Vibrance", "AvoidColorShift", vibrance.avoidcolorshift, keyFile); saveToKeyfile(!pedited || pedited->vibrance.pastsattog, "Vibrance", "PastSatTog", vibrance.pastsattog, keyFile); @@ -2081,10 +2084,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->prsharpening.method, "PostResizeSharpening", "Method", prsharpening.method, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.radius, "PostResizeSharpening", "Radius", prsharpening.radius, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.amount, "PostResizeSharpening", "Amount", prsharpening.amount, keyFile); - if (!pedited || pedited->prsharpening.threshold) { - Glib::ArrayHandle thresh (prsharpening.threshold.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("PostResizeSharpening", "Threshold", thresh); - } + saveToKeyfile(!pedited || pedited->prsharpening.threshold, "PostResizeSharpening", "Threshold", prsharpening.threshold.toVector(), keyFile); saveToKeyfile(!pedited || pedited->prsharpening.edgesonly, "PostResizeSharpening", "OnlyEdges", prsharpening.edgesonly, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.edges_radius, "PostResizeSharpening", "EdgedetectionRadius", prsharpening.edges_radius, keyFile); saveToKeyfile(!pedited || pedited->prsharpening.edges_tolerance, "PostResizeSharpening", "EdgeTolerance", prsharpening.edges_tolerance, keyFile); @@ -2163,34 +2163,13 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->wavelet.sup, "Wavelet", "ContExtra", wavelet.sup, keyFile); saveToKeyfile(!pedited || pedited->wavelet.HSmethod, "Wavelet", "HSMethod", wavelet.HSmethod, keyFile); - if (!pedited || pedited->wavelet.hllev) { - Glib::ArrayHandle thresh (wavelet.hllev.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Wavelet", "HLRange", thresh); - } - if (!pedited || pedited->wavelet.bllev) { - Glib::ArrayHandle thresh (wavelet.bllev.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Wavelet", "SHRange", thresh); - } - if (!pedited || pedited->wavelet.edgcont) { - Glib::ArrayHandle thresh (wavelet.edgcont.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Wavelet", "Edgcont", thresh); - } - if (!pedited || pedited->wavelet.level0noise) { - Glib::ArrayHandle thresh (wavelet.level0noise.value, 2, Glib::OWNERSHIP_NONE); - keyFile.set_double_list ("Wavelet", "Level0noise", thresh); - } - if (!pedited || pedited->wavelet.level1noise) { - Glib::ArrayHandle thresh (wavelet.level1noise.value, 2, Glib::OWNERSHIP_NONE); - keyFile.set_double_list ("Wavelet", "Level1noise", thresh); - } - if (!pedited || pedited->wavelet.level2noise) { - Glib::ArrayHandle thresh (wavelet.level2noise.value, 2, Glib::OWNERSHIP_NONE); - keyFile.set_double_list ("Wavelet", "Level2noise", thresh); - } - if (!pedited || pedited->wavelet.level3noise) { - Glib::ArrayHandle thresh (wavelet.level3noise.value, 2, Glib::OWNERSHIP_NONE); - keyFile.set_double_list ("Wavelet", "Level3noise", thresh); - } + saveToKeyfile(!pedited || pedited->wavelet.hllev, "Wavelet", "HLRange", wavelet.hllev.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->wavelet.bllev, "Wavelet", "SHRange", wavelet.bllev.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgcont, "Wavelet", "Edgcont", wavelet.edgcont.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->wavelet.level0noise, "Wavelet", "Level0noise", wavelet.level0noise.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->wavelet.level1noise, "Wavelet", "Level1noise", wavelet.level1noise.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->wavelet.level2noise, "Wavelet", "Level2noise", wavelet.level2noise.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->wavelet.level3noise, "Wavelet", "Level3noise", wavelet.level3noise.toVector(), keyFile); saveToKeyfile(!pedited || pedited->wavelet.threshold, "Wavelet", "ThresholdHighlight", wavelet.threshold, keyFile); saveToKeyfile(!pedited || pedited->wavelet.threshold2, "Wavelet", "ThresholdShadow", wavelet.threshold2, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgedetect, "Wavelet", "Edgedetect", wavelet.edgedetect, keyFile); @@ -2208,15 +2187,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->wavelet.TMmethod, "Wavelet", "TMMethod", wavelet.TMmethod, keyFile); saveToKeyfile(!pedited || pedited->wavelet.chro, "Wavelet", "ChromaLink", wavelet.chro, keyFile); saveToKeyfile(!pedited || pedited->wavelet.ccwcurve, "Wavelet", "ContrastCurve", wavelet.ccwcurve, keyFile); - if (!pedited || pedited->wavelet.pastlev) { - Glib::ArrayHandle thresh (wavelet.pastlev.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Wavelet", "Pastlev", thresh); - } - - if (!pedited || pedited->wavelet.satlev) { - Glib::ArrayHandle thresh (wavelet.satlev.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Wavelet", "Satlev", thresh); - } + saveToKeyfile(!pedited || pedited->wavelet.pastlev, "Wavelet", "Pastlev", wavelet.pastlev.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->wavelet.satlev, "Wavelet", "Satlev", wavelet.satlev.toVector(), keyFile); saveToKeyfile(!pedited || pedited->wavelet.opacityCurveRG, "Wavelet", "OpacityCurveRG", wavelet.opacityCurveRG, keyFile); saveToKeyfile(!pedited || pedited->wavelet.opacityCurveBY, "Wavelet", "OpacityCurveBY", wavelet.opacityCurveBY, keyFile); saveToKeyfile(!pedited || pedited->wavelet.opacityCurveW, "Wavelet", "OpacityCurveW", wavelet.opacityCurveW, keyFile); @@ -2231,10 +2203,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->wavelet.lipst, "Wavelet", "Lipst", wavelet.lipst, keyFile); // if (!pedited || pedited->wavelet.edgreinf) keyFile.set_boolean ("Wavelet", "Edgreinf", wavelet.edgreinf); saveToKeyfile(!pedited || pedited->wavelet.skinprotect, "Wavelet", "Skinprotect", wavelet.skinprotect, keyFile); - if (!pedited || pedited->wavelet.hueskin) { - Glib::ArrayHandle thresh (wavelet.hueskin.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Wavelet", "Hueskin", thresh); - } + saveToKeyfile(!pedited || pedited->wavelet.hueskin, "Wavelet", "Hueskin", wavelet.hueskin.toVector(), keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgrad, "Wavelet", "Edgrad", wavelet.edgrad, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgval, "Wavelet", "Edgval", wavelet.edgval, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgthresh, "Wavelet", "ThrEdg", wavelet.edgthresh, keyFile); @@ -2250,10 +2219,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->wavelet.tmrs, "Wavelet", "ResidualTM", wavelet.tmrs, keyFile); saveToKeyfile(!pedited || pedited->wavelet.gamma, "Wavelet", "Residualgamma", wavelet.gamma, keyFile); saveToKeyfile(!pedited || pedited->wavelet.sky, "Wavelet", "HueRangeResidual", wavelet.sky, keyFile); - if (!pedited || pedited->wavelet.hueskin2) { - Glib::ArrayHandle thresh (wavelet.hueskin2.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Wavelet", "HueRange", thresh); - } + saveToKeyfile(!pedited || pedited->wavelet.hueskin2, "Wavelet", "HueRange", wavelet.hueskin2.toVector(), keyFile); saveToKeyfile(!pedited || pedited->wavelet.contrast, "Wavelet", "Contrast", wavelet.contrast, keyFile); // Directional pyramid equalizer @@ -2264,15 +2230,12 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b std::stringstream ss; ss << "Mult" << i; - saveToKeyfile(!pedited || pedited->dirpyrequalizer.mult[i], "Directional Pyramid Equalizer", ss.str(), dirpyrequalizer.mult[i], keyFile); } - + saveToKeyfile(!pedited || pedited->dirpyrequalizer.mult[i], "Directional Pyramid Equalizer", ss.str(), dirpyrequalizer.mult[i], keyFile); + } saveToKeyfile(!pedited || pedited->dirpyrequalizer.threshold, "Directional Pyramid Equalizer", "Threshold", dirpyrequalizer.threshold, keyFile); saveToKeyfile(!pedited || pedited->dirpyrequalizer.skinprotect, "Directional Pyramid Equalizer", "Skinprotect", dirpyrequalizer.skinprotect, keyFile); // if (!pedited || pedited->dirpyrequalizer.algo) keyFile.set_string ("Directional Pyramid Equalizer", "Algorithm", dirpyrequalizer.algo); - if (!pedited || pedited->dirpyrequalizer.hueskin) { - Glib::ArrayHandle thresh (dirpyrequalizer.hueskin.value, 4, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("Directional Pyramid Equalizer", "Hueskin", thresh); - } + saveToKeyfile(!pedited || pedited->dirpyrequalizer.hueskin, "Directional Pyramid Equalizer", "Hueskin", dirpyrequalizer.hueskin.toVector(), keyFile); // HSV Equalizer saveToKeyfile(!pedited || pedited->hsvequalizer.hcurve, "HSV Equalizer", "HCurve", hsvequalizer.hcurve, keyFile); @@ -2309,18 +2272,11 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorToning.autosat, "ColorToning", "Autosat", colorToning.autosat, keyFile); saveToKeyfile(!pedited || pedited->colorToning.opacityCurve, "ColorToning", "OpacityCurve", colorToning.opacityCurve, keyFile); saveToKeyfile(!pedited || pedited->colorToning.colorCurve, "ColorToning", "ColorCurve", colorToning.colorCurve, keyFile); - saveToKeyfile(!pedited || pedited->colorToning.satprotectionthreshold, "ColorToning", "SatProtectionThreshold", colorToning.satProtectionThreshold , keyFile); - saveToKeyfile(!pedited || pedited->colorToning.saturatedopacity, "ColorToning", "SaturatedOpacity", colorToning.saturatedOpacity , keyFile); - saveToKeyfile(!pedited || pedited->colorToning.strength, "ColorToning", "Strength", colorToning.strength , keyFile); - if (!pedited || pedited->colorToning.hlColSat) { - Glib::ArrayHandle thresh (colorToning.hlColSat.value, 2, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("ColorToning", "HighlightsColorSaturation", thresh); - } - - if (!pedited || pedited->colorToning.shadowsColSat) { - Glib::ArrayHandle thresh (colorToning.shadowsColSat.value, 2, Glib::OWNERSHIP_NONE); - keyFile.set_integer_list ("ColorToning", "ShadowsColorSaturation", thresh); - } + saveToKeyfile(!pedited || pedited->colorToning.satprotectionthreshold, "ColorToning", "SatProtectionThreshold", colorToning.satProtectionThreshold, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.saturatedopacity, "ColorToning", "SaturatedOpacity", colorToning.saturatedOpacity, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.strength, "ColorToning", "Strength", colorToning.strength, keyFile); + saveToKeyfile(!pedited || pedited->colorToning.hlColSat, "ColorToning", "HighlightsColorSaturation", colorToning.hlColSat.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->colorToning.shadowsColSat, "ColorToning", "ShadowsColorSaturation", colorToning.shadowsColSat.toVector(), keyFile); saveToKeyfile(!pedited || pedited->colorToning.clcurve, "ColorToning", "ClCurve", colorToning.clcurve, keyFile); saveToKeyfile(!pedited || pedited->colorToning.cl2curve, "ColorToning", "Cl2Curve", colorToning.cl2curve, keyFile); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c3b74e70b..62aab66bd 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -16,19 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PROCPARAMS_H_ -#define _PROCPARAMS_H_ +#pragma once -#include -#include #include +#include #include +#include #include #include -#include "LUT.h" #include "coord.h" +#include "LUT.h" class ParamsEdited; @@ -36,15 +35,15 @@ namespace rtengine { class ColorGradientCurve; -class OpacityCurve; class NoiseCurve; +class OpacityCurve; +class RetinexgaintransmissionCurve; +class RetinextransmissionCurve; class WavCurve; -class WavOpacityCurveRG; class WavOpacityCurveBY; +class WavOpacityCurveRG; class WavOpacityCurveW; class WavOpacityCurveWL; -class RetinextransmissionCurve; -class RetinexgaintransmissionCurve; enum RenderingIntent { RI_PERCEPTUAL = INTENT_PERCEPTUAL, @@ -57,196 +56,198 @@ enum RenderingIntent { namespace procparams { -template -class Threshold +template +class Threshold final { public: - T value[4]; - -protected: - bool initEq1; - bool _isDouble; - -public: - Threshold (T bottom, T top, bool startAtOne) + Threshold(T _bottom, T _top, bool _start_at_one) : + Threshold(_bottom, _top, 0, 0, _start_at_one, false) { - initEq1 = startAtOne; - value[0] = bottom; - value[1] = top; - value[2] = T (0); - value[3] = T (0); - _isDouble = false; } - Threshold (T bottomLeft, T topLeft, T bottomRight, T topRight, bool startAtOne) + Threshold(T _bottom_left, T _top_left, T _bottom_right, T _top_right, bool _start_at_one) : + Threshold(_bottom_left, _top_left, _bottom_right, _top_right, _start_at_one, true) { - initEq1 = startAtOne; - value[0] = bottomLeft; - value[1] = topLeft; - value[2] = bottomRight; - value[3] = topRight; - _isDouble = true; } - // for convenience, since 'values' is public - void setValues (T bottom, T top) + template + typename std::enable_if::value, bool>::type operator ==(const Threshold& rhs) const { - value[0] = bottom; - value[1] = top; + if (is_double) { + return + std::fabs (bottom_left - rhs.bottom_left) < 1e-10 + && std::fabs (top_left - rhs.top_left) < 1e-10 + && std::fabs (bottom_right - rhs.bottom_right) < 1e-10 + && std::fabs (top_right - rhs.top_right) < 1e-10; + } else { + return + std::fabs (bottom_left - rhs.bottom_left) < 1e-10 + && std::fabs (top_left - rhs.top_left) < 1e-10; + } } - // for convenience, since 'values' is public - void setValues (T bottomLeft, T topLeft, T bottomRight, T topRight) + template + typename std::enable_if::value, bool>::type operator ==(const Threshold& rhs) const { - value[0] = bottomLeft; - value[1] = topLeft; - value[2] = bottomRight; - value[3] = topRight; + if (is_double) { + return + bottom_left == rhs.bottom_left + && top_left == rhs.top_left + && bottom_right == rhs.bottom_right + && top_right == rhs.top_right; + } else { + return + bottom_left == rhs.bottom_left + && top_left == rhs.top_left; + } + } + + T getBottom() const + { + return bottom_left; + } + + T getTop() const + { + return top_left; + } + + T getBottomLeft() const + { + return bottom_left; + } + + T getTopLeft() const + { + return top_left; + } + + T getBottomRight() const + { + return bottom_right; + } + + T getTopRight() const + { + return top_right; + } + + void setValues(T bottom, T top) + { + bottom_left = bottom; + top_left = top; + } + + void setValues(T bottom_left, T top_left, T bottom_right, T top_right) + { + this->bottom_left = bottom_left; + this->top_left = top_left; + this->bottom_right = bottom_right; + this->top_right = top_right; } bool isDouble() const { - return _isDouble; + return is_double; + } + + std::vector toVector() const + { + if (is_double) { + return { + bottom_left, + top_left, + bottom_right, + top_right + }; + } else { + return { + bottom_left, + top_left + }; + } } // RT: Type of the returned value // RV: Type of the value on the X axis // RV2: Type of the maximum value on the Y axis template - RT multiply (RV x, RV2 yMax) const + RT multiply (RV x, RV2 y_max) const { - double val = double (x); + const double val = x; - if (initEq1) { - if (_isDouble) { - if (val == double (value[2]) && double (value[2]) == double (value[3])) - // this handle the special case where the 2 right values are the same, then bottom one is sent back, + if (init_eql) { + if (is_double) { + if (val == static_cast(bottom_right) && static_cast(bottom_right) == static_cast(top_right)) { + // This handles the special case where the 2 right values are the same, then bottom one is sent back, // useful if one wants to keep the bottom value even beyond the x max bound - { - return RT (0.); + return 0; } - if (val >= double (value[3])) { - return RT (yMax); + if (val >= static_cast(top_right)) { + return y_max; } - if (val > double (value[2])) { - return RT (double (yMax) * (val - double (value[2])) / (double (value[3]) - double (value[2]))); + if (val > static_cast(bottom_right)) { + return static_cast(y_max * (val - static_cast(bottom_right)) / (static_cast(top_right) - static_cast(bottom_right))); } } - if (val >= double (value[0])) { - return RT (0); + if (val >= static_cast(bottom_left)) { + return 0; } - if (val > double (value[1])) { - return RT (double (yMax) * (1. - (val - double (value[0])) / (double (value[1]) - double (value[0])))); + if (val > static_cast(top_left)) { + return static_cast(y_max * (1. - (val - static_cast(bottom_left)) / (static_cast(top_left) - static_cast(bottom_left)))); } - return RT (yMax); + return y_max; } else { - if (_isDouble) { - if (val == double (value[2]) && double (value[2]) == double (value[3])) - // this handle the special case where the 2 right values are the same, then top one is sent back, + if (is_double) { + if (val == static_cast(bottom_right) && static_cast(bottom_right) == static_cast(top_right)) { + // This handles the special case where the 2 right values are the same, then top one is sent back, // useful if one wants to keep the top value even beyond the x max bound - { - return RT (yMax); + return y_max; } - if (val >= double (value[2])) { - return RT (0); + if (val >= static_cast(bottom_right)) { + return 0; } - if (val > double (value[3])) { - return RT (double (yMax) * (1. - (val - double (value[3])) / (double (value[2]) - double (value[3])))); + if (val > static_cast(top_right)) { + return static_cast(y_max * (1.0 - (val - static_cast(top_right)) / (static_cast(bottom_right) - static_cast(top_right)))); } } - if (val >= double (value[1])) { - return RT (yMax); + if (val >= static_cast(top_left)) { + return y_max; } - if (val > double (value[0])) { - return RT (double (yMax) * (val - double (value[0])) / (double (value[1]) - double (value[0]))); + if (val > static_cast(bottom_left)) { + return static_cast(y_max * (val - static_cast(bottom_left)) / (static_cast(top_left) - static_cast(bottom_left))); } - return RT (0); + return 0; } } - // RT: Type of the returned value - // RV: Type of the value on the X axis - /*template - RT getRatio(RV val) const { - double val = double(val); - if (initEq1) { - if (_isDouble) { // assuming that simple thresholds will be more frequent - if (val >= double(value[3])) - return RT(1); - if (val > double(value[2])) - return (val-double(value[2]))/(double(value[3])-double(value[2])); - } - if (val >= double(value[1])) - return RT(0); - if (val > double(value[0])) - return 1.-(val-double(value[0]))/(double(value[1])-double(value[0])); - return RT(1); - } - else { - if (_isDouble) { // assuming that simple thresholds will be more frequent - if (val >= double(value[3])) - return RT(0); - if (val > double(value[2])) - return 1.-(val-double(value[2]))/(double(value[3])-double(value[2])); - } - if (val >= double(value[1])) - return RT(1); - if (val > double(value[0])) - return (val-double(value[0]))/(double(value[1])-double(value[0])); - return RT(0); - } - }*/ - - Threshold& operator = (const Threshold &rhs) +private: + Threshold(T _bottom_left, T _top_left, T _bottom_right, T _top_right, bool _start_at_one, bool _is_double) : + bottom_left(_bottom_left), + top_left(_top_left), + bottom_right(_bottom_right), + top_right(_top_right), + init_eql(_start_at_one), + is_double(_is_double) { - value[0] = rhs.value[0]; - value[1] = rhs.value[1]; - value[2] = rhs.value[2]; - value[3] = rhs.value[3]; - initEq1 = rhs.initEq1; - _isDouble = rhs._isDouble; - return *this; } - template - typename std::enable_if::value, bool>::type operator == (const Threshold &rhs) const - { - if (_isDouble) { - return std::fabs (value[0] - rhs.value[0]) < 1e-10 - && std::fabs (value[1] - rhs.value[1]) < 1e-10 - && std::fabs (value[2] - rhs.value[2]) < 1e-10 - && std::fabs (value[3] - rhs.value[3]) < 1e-10; - } else { - return std::fabs (value[0] - rhs.value[0]) < 1e-10 - && std::fabs (value[1] - rhs.value[1]) < 1e-10; - } - } - - template - typename std::enable_if::value, bool>::type operator == (const Threshold &rhs) const - { - if (_isDouble) { - return - value[0] == rhs.value[0] - && value[1] == rhs.value[1] - && value[2] == rhs.value[2] - && value[3] == rhs.value[3]; - } else { - return - value[0] == rhs.value[0] - && value[1] == rhs.value[1]; - } - } + T bottom_left; + T top_left; + T bottom_right; + T top_right; + bool init_eql; + bool is_double; }; /** @@ -1535,4 +1536,3 @@ public: } } -#endif diff --git a/rtgui/thresholdadjuster.cc b/rtgui/thresholdadjuster.cc index 754205e2e..7afd128b5 100644 --- a/rtgui/thresholdadjuster.cc +++ b/rtgui/thresholdadjuster.cc @@ -341,20 +341,20 @@ void ThresholdAdjuster::sendToListener () rtengine::procparams::Threshold t = tSelector.getPositions(); if (tSelector.isDouble()) { - adjusterListener->adjusterChanged (this, t.value[0], t.value[1], t.value[2], t.value[3]); - adjusterListener->adjusterChanged2 (this, t.value[0], t.value[1], t.value[2], t.value[3]); + adjusterListener->adjusterChanged (this, t.getBottomLeft(), t.getTopLeft(), t.getBottomRight(), t.getTopRight()); + adjusterListener->adjusterChanged2 (this, t.getBottomLeft(), t.getTopLeft(), t.getBottomRight(), t.getTopRight()); } else { - adjusterListener->adjusterChanged (this, t.value[0], t.value[1]); + adjusterListener->adjusterChanged (this, t.getBottomLeft(), t.getTopLeft()); } } else { // if precision is equal to 0, then we assume that the listener is waiting for integers rtengine::procparams::Threshold t = tSelector.getPositions(); if (tSelector.isDouble()) { - adjusterListener->adjusterChanged (this, t.value[0], t.value[1], t.value[2], t.value[3]); - adjusterListener->adjusterChanged2 (this, t.value[0], t.value[1], t.value[2], t.value[3]); + adjusterListener->adjusterChanged (this, t.getBottomLeft(), t.getTopLeft(), t.getBottomRight(), t.getTopRight()); + adjusterListener->adjusterChanged2 (this, t.getBottomLeft(), t.getTopLeft(), t.getBottomRight(), t.getTopRight()); } else { - adjusterListener->adjusterChanged (this, t.value[0], t.value[1]); + adjusterListener->adjusterChanged (this, t.getBottomLeft(), t.getTopLeft()); } } } diff --git a/rtgui/thresholdselector.h b/rtgui/thresholdselector.h index f6caa4302..32b423e64 100644 --- a/rtgui/thresholdselector.h +++ b/rtgui/thresholdselector.h @@ -138,12 +138,12 @@ public: template void setDefaults (const rtengine::procparams::Threshold &t) { - defPos[TS_BOTTOMLEFT] = double(t.value[0]); // should we use shapeValue() ? - defPos[TS_TOPLEFT] = double(t.value[1]); + defPos[TS_BOTTOMLEFT] = double(t.getBottomLeft()); // should we use shapeValue() ? + defPos[TS_TOPLEFT] = double(t.getTopLeft()); if (doubleThresh) { - defPos[TS_BOTTOMRIGHT] = double(t.value[2]); - defPos[TS_TOPRIGHT] = double(t.value[3]); + defPos[TS_BOTTOMRIGHT] = double(t.getBottomRight()); + defPos[TS_TOPRIGHT] = double(t.getTopRight()); } } void setDefaults (double bottom, double top); @@ -151,12 +151,12 @@ public: template void setPositions (const rtengine::procparams::Threshold &tValues) { - positions[TS_BOTTOMLEFT] = static_cast(tValues.value[TS_BOTTOMLEFT]); - positions[TS_TOPLEFT] = static_cast(tValues.value[TS_TOPLEFT]); + positions[TS_BOTTOMLEFT] = static_cast(tValues.getBottomLeft()); + positions[TS_TOPLEFT] = static_cast(tValues.getTopLeft()); if (tValues.isDouble()) { - positions[TS_BOTTOMRIGHT] = static_cast(tValues.value[TS_BOTTOMRIGHT]); - positions[TS_TOPRIGHT] = static_cast(tValues.value[TS_TOPRIGHT]); + positions[TS_BOTTOMRIGHT] = static_cast(tValues.getBottomRight()); + positions[TS_TOPRIGHT] = static_cast(tValues.getTopRight()); } updateTooltip(); From 02d6187cd880cd3b1a3804610e0e33ec181e9db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Tue, 14 Nov 2017 21:20:07 +0100 Subject: [PATCH 04/47] `procparams.h` cleanup - Part 1 TODO: - Part 2 (obviously :wink:) - Remove `setDefaults()` in favour of c'tor --- rtengine/curves.cc | 4 +- rtengine/curves.h | 2 +- rtengine/improcfun.cc | 114 +++++------ rtengine/procparams.cc | 287 ++++++++++++++++----------- rtengine/procparams.h | 406 +++++++++++---------------------------- rtengine/utils.h | 2 +- rtgui/colorappearance.cc | 20 +- rtgui/dirpyrdenoise.cc | 4 +- rtgui/tonecurve.cc | 28 +-- rtgui/whitebalance.cc | 196 ++++++++++--------- rtgui/whitebalance.h | 8 +- 11 files changed, 486 insertions(+), 585 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 3096f19f4..8ece458e7 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -482,8 +482,8 @@ void CurveFactory::complexsgnCurve (bool & autili, bool & butili, bool & ccutil SSEFUNCTION void CurveFactory::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, + procparams::ToneCurveParams::Mode curveMode, const std::vector& curvePoints, + procparams::ToneCurveParams::Mode curveMode2, const std::vector& curvePoints2, LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, diff --git a/rtengine/curves.h b/rtengine/curves.h index c20b78772..413531471 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -281,7 +281,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, + procparams::ToneCurveParams::Mode curveMode, const std::vector& curvePoints, procparams::ToneCurveParams::Mode curveMode2, const std::vector& curvePoints2, LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, int skip = 1); diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 829384cc6..bc5bafca0 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -440,11 +440,11 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } // extracting datas from 'params' to avoid cache flush (to be confirmed) - ColorAppearanceParams::eTCModeId curveMode = params->colorappearance.curveMode; - ColorAppearanceParams::eTCModeId curveMode2 = params->colorappearance.curveMode2; + ColorAppearanceParams::TCMode curveMode = params->colorappearance.curveMode; + ColorAppearanceParams::TCMode curveMode2 = params->colorappearance.curveMode2; bool hasColCurve1 = bool (customColCurve1); bool hasColCurve2 = bool (customColCurve2); - ColorAppearanceParams::eCTCModeId curveMode3 = params->colorappearance.curveMode3; + ColorAppearanceParams::CTCMode curveMode3 = params->colorappearance.curveMode3; bool hasColCurve3 = bool (customColCurve3); @@ -805,7 +805,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve1) {//curve 1 with Lightness and Brightness - if (curveMode == ColorAppearanceParams::TC_MODE_LIGHT) { + if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { /* float Jj=(float) Jpro*327.68; float Jold=Jj; const Lightcurve& userColCurve = static_cast(customColCurve1); @@ -843,7 +843,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } t1L = true; - } else if (curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) { + } else if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { //attention! Brightness curves are open - unlike Lightness or Lab or RGB==> rendering and algoritms will be different float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qanc = Qpro; @@ -891,7 +891,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve2) {//curve 2 with Lightness and Brightness - if (curveMode2 == ColorAppearanceParams::TC_MODE_LIGHT) { + if (curveMode2 == ColorAppearanceParams::TCMode::LIGHT) { float Jj = (float) Jpro * 327.68; float Jold = Jj; /* @@ -934,7 +934,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh Jpro = 1.; } - } else if (curveMode2 == ColorAppearanceParams::TC_MODE_BRIGHT) { // + } else if (curveMode2 == ColorAppearanceParams::TCMode::BRIGHT) { // float Qanc = Qpro; float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qq = (float) Qpro * 327.68f * (1.f / coef); @@ -992,7 +992,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { double parsat = 0.8; //0.68; double coef = 327.68 / parsat; float Cc = (float) Cpro * coef; @@ -1016,7 +1016,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } // Cpro=Cc/coef; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { // + } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { // double parsat = 0.8; //0.6 double coef = 327.68 / parsat; float Ss = (float) spro * coef; @@ -1036,7 +1036,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh Cpro = (spro * spro * Qpro) / (10000.0); c1s = 1; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_COLORF) { // + } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { // double parsat = 0.8; //0.68; double coef = 327.68 / parsat; float Mm = (float) Mpro * coef; @@ -1121,21 +1121,21 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh int libr = 0; int colch = 0; - if (curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) { + if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { brli = 70.0; libr = 1; - } else if (curveMode == ColorAppearanceParams::TC_MODE_LIGHT) { + } else if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { brli = 327.; libr = 0; } - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { chsacol = 400.;//327.; colch = 0; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { chsacol = 450.0; colch = 1; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_COLORF) { + } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { chsacol = 400.;//327.0; colch = 2; } @@ -1390,21 +1390,21 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh int libr = 0; int colch = 0; - if (curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) { + if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { brli = 70.0; libr = 1; - } else if (curveMode == ColorAppearanceParams::TC_MODE_LIGHT) { + } else if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { brli = 327.; libr = 0; } - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { chsacol = 400.;//327.; colch = 0; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { chsacol = 450.0; colch = 1; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_COLORF) { + } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { chsacol = 400.;//327.0; colch = 2; } @@ -1765,14 +1765,14 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int const float rstprotection = 100. - params->colorappearance.rstprotection; // extracting datas from 'params' to avoid cache flush (to be confirmed) - const ColorAppearanceParams::eTCModeId curveMode = params->colorappearance.curveMode; + const ColorAppearanceParams::TCMode curveMode = params->colorappearance.curveMode; const bool hasColCurve1 = bool (customColCurve1); - const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TC_MODE_LIGHT; + const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TCMode::LIGHT; - const ColorAppearanceParams::eTCModeId curveMode2 = params->colorappearance.curveMode2; + const ColorAppearanceParams::TCMode curveMode2 = params->colorappearance.curveMode2; const bool hasColCurve2 = bool (customColCurve2); - const ColorAppearanceParams::eCTCModeId curveMode3 = params->colorappearance.curveMode3; + const ColorAppearanceParams::CTCMode curveMode3 = params->colorappearance.curveMode3; const bool hasColCurve3 = bool (customColCurve3); bool needJ = (alg == 0 || alg == 1 || alg == 3); @@ -2226,7 +2226,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve1) {//curve 1 with Lightness and Brightness - if (curveMode == ColorAppearanceParams::TC_MODE_LIGHT) { + if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { float Jj = (float) Jpro * 327.68f; float Jold = Jj; float Jold100 = (float) Jpro; @@ -2255,7 +2255,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int if (Jpro < 1.f) { Jpro = 1.f; } - } else if (curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) { + } else if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { //attention! Brightness curves are open - unlike Lightness or Lab or RGB==> rendering and algoritms will be different float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qanc = Qpro; @@ -2299,7 +2299,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve2) {//curve 2 with Lightness and Brightness - if (curveMode2 == ColorAppearanceParams::TC_MODE_LIGHT) { + if (curveMode2 == ColorAppearanceParams::TCMode::LIGHT) { float Jj = (float) Jpro * 327.68f; float Jold = Jj; float Jold100 = (float) Jpro; @@ -2337,7 +2337,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Jpro = 1.f; } - } else if (curveMode2 == ColorAppearanceParams::TC_MODE_BRIGHT) { // + } else if (curveMode2 == ColorAppearanceParams::TCMode::BRIGHT) { // float Qanc = Qpro; float coef = ((aw + 4.f) * (4.f / c)) / 100.f; @@ -2394,7 +2394,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Cc = (float) Cpro * coef; @@ -2417,7 +2417,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Cpro = 50.f; } */ - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { // + } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { // float parsat = 0.8f; //0.6 float coef = 327.68f / parsat; float Ss = (float) spro * coef; @@ -2434,7 +2434,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Color::skinredfloat (Jpro, hpro, Ss, Sold, dred, protect_red, sk, rstprotection, ko, spro); Qpro = ( 4.0f / c ) * sqrtf ( Jpro / 100.0f ) * ( aw + 4.0f ) ; Cpro = (spro * spro * Qpro) / (10000.0f); - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_COLORF) { // + } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { // float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Mm = (float) Mpro * coef; @@ -2504,10 +2504,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int float colch; //update histogram - if (curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) { + if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { brli = 70.0f; libr = Q; //40.0 to 100.0 approximative factor for Q - 327 for J - } else { /*if(curveMode == ColorAppearanceParams::TC_MODE_LIGHT)*/ + } else { /*if(curveMode == ColorAppearanceParams::TCMode::LIGHT)*/ brli = 327.f; libr = J; //327 for J } @@ -2515,13 +2515,13 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int posl = (int) (libr * brli); hist16JCAM[posl]++; - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { chsacol = 400.f;//327 colch = C; //450.0 approximative factor for s 320 for M - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { chsacol = 450.0f; colch = s; - } else { /*if(curveMode3 == ColorAppearanceParams::TC_MODE_COLORF)*/ + } else { /*if(curveMode3 == ColorAppearanceParams::CTCMode::COLORF)*/ chsacol = 400.0f;//327 colch = M; } @@ -2857,10 +2857,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int float libr; float colch; - if (curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) { + if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { brli = 70.0f; libr = ncie->Q_p[i][j]; //40.0 to 100.0 approximative factor for Q - 327 for J - } else { /*if(curveMode == ColorAppearanceParams::TC_MODE_LIGHT)*/ + } else { /*if(curveMode == ColorAppearanceParams::TCMode::LIGHT)*/ brli = 327.f; libr = ncie->J_p[i][j]; //327 for J } @@ -2868,13 +2868,13 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int posl = (int) (libr * brli); hist16JCAM[posl]++; - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { chsacol = 400.f;//327.f; colch = ncie_C_p; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { chsacol = 450.0f; colch = 100.f * sqrtf (ncie_C_p / ncie->Q_p[i][j]); - } else { /*if(curveMode3 == ColorAppearanceParams::TC_MODE_COLORF)*/ + } else { /*if(curveMode3 == ColorAppearanceParams::CTCMode::COLORF)*/ chsacol = 400.f;//327.0f; colch = ncie->M_p[i][j]; } @@ -3270,8 +3270,8 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer const float hlrange = 65536.0 - shoulder; const bool isProPhoto = (params->icm.working == "ProPhoto"); // extracting datas from 'params' to avoid cache flush (to be confirmed) - ToneCurveParams::eTCModeId curveMode = params->toneCurve.curveMode; - ToneCurveParams::eTCModeId curveMode2 = params->toneCurve.curveMode2; + ToneCurveParams::Mode curveMode = params->toneCurve.curveMode; + ToneCurveParams::Mode curveMode2 = params->toneCurve.curveMode2; bool highlight = params->toneCurve.hrenabled;//Get the value if "highlight reconstruction" is activated bool hasToneCurve1 = bool (customToneCurve1); bool hasToneCurve2 = bool (customToneCurve2); @@ -3283,12 +3283,12 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer PerceptualToneCurveState ptc1ApplyState, ptc2ApplyState; - if (hasToneCurve1 && curveMode == ToneCurveParams::TC_MODE_PERCEPTUAL) { + if (hasToneCurve1 && curveMode == ToneCurveParams::Mode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.initApplyState (ptc1ApplyState, params->icm.working); } - if (hasToneCurve2 && curveMode2 == ToneCurveParams::TC_MODE_PERCEPTUAL) { + if (hasToneCurve2 && curveMode2 == ToneCurveParams::Mode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.initApplyState (ptc2ApplyState, params->icm.working); } @@ -3641,21 +3641,21 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (hasToneCurve1) { - if (curveMode == ToneCurveParams::TC_MODE_STD) { // Standard + if (curveMode == ToneCurveParams::Mode::STD) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const StandardToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::TC_MODE_FILMLIKE) { // Adobe like + } else if (curveMode == ToneCurveParams::Mode::FILMLIKE) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const AdobeToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::TC_MODE_SATANDVALBLENDING) { // apply the curve on the saturation and value channels + } else if (curveMode == ToneCurveParams::Mode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const SatAndValueBlendingToneCurve& userToneCurve = static_cast (customToneCurve1); @@ -3665,7 +3665,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::TC_MODE_WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted + } else if (curveMode == ToneCurveParams::Mode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3676,7 +3676,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::TC_MODE_LUMINANCE) { // apply the curve to the luminance channel + } else if (curveMode == ToneCurveParams::Mode::LUMINANCE) { // apply the curve to the luminance channel const LuminanceToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3687,7 +3687,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::TC_MODE_PERCEPTUAL) { // apply curve while keeping color appearance constant + } else if (curveMode == ToneCurveParams::Mode::PERCEPTUAL) { // apply curve while keeping color appearance constant const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3712,28 +3712,28 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (hasToneCurve2) { - if (curveMode2 == ToneCurveParams::TC_MODE_STD) { // Standard + if (curveMode2 == ToneCurveParams::Mode::STD) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const StandardToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::TC_MODE_FILMLIKE) { // Adobe like + } else if (curveMode2 == ToneCurveParams::Mode::FILMLIKE) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const AdobeToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::TC_MODE_SATANDVALBLENDING) { // apply the curve on the saturation and value channels + } else if (curveMode2 == ToneCurveParams::Mode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const SatAndValueBlendingToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::TC_MODE_WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted + } else if (curveMode2 == ToneCurveParams::Mode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3741,7 +3741,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::TC_MODE_LUMINANCE) { // apply the curve to the luminance channel + } else if (curveMode2 == ToneCurveParams::Mode::LUMINANCE) { // apply the curve to the luminance channel const LuminanceToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3749,7 +3749,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::TC_MODE_PERCEPTUAL) { // apply curve while keeping color appearance constant + } else if (curveMode2 == ToneCurveParams::Mode::PERCEPTUAL) { // apply curve while keeping color appearance constant const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 365cbc32a..c064f5366 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -265,12 +265,47 @@ const int br = (int) options.rtSettings.bot_right; const int tl = (int) options.rtSettings.top_left; const int bl = (int) options.rtSettings.bot_left; -const char *LensProfParams::methodstring[static_cast(LensProfParams::LcMode::LCP) + 1u] = {"none", "lfauto", "lfmanual", "lcp"}; const char *RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::numMethods] = {"amaze", "igv", "lmmse", "eahd", "hphd", "vng4", "dcb", "ahd", "fast", "mono", "none", "pixelshift" }; const char *RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::numMethods] = {"3-pass (best)", "1-pass (medium)", "fast", "mono", "none" }; const char *RAWParams::ff_BlurTypestring[RAWParams::numFlatFileBlurTypes] = {/*"Parametric",*/ "Area Flatfield", "Vertical Flatfield", "Horizontal Flatfield", "V+H Flatfield"}; -std::vector WBParams::wbEntries; + +const std::vector WBParams::wbEntries = { + {"Camera", WBEntry::Type::CAMERA, M ("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f}, + {"Auto", WBEntry::Type::AUTO, M ("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f}, + {"Daylight", WBEntry::Type::DAYLIGHT, M ("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f}, + {"Cloudy", WBEntry::Type::CLOUDY, M ("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f}, + {"Shade", WBEntry::Type::SHADE, M ("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f}, + {"Water 1", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER1"), 35000, 0.3f, 1.1f, 0.f}, + {"Water 2", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER2"), 48000, 0.63f, 1.38f, 0.f}, + {"Tungsten", WBEntry::Type::TUNGSTEN, M ("TP_WBALANCE_TUNGSTEN"), 2856, 1.f, 1.f, 0.f}, + {"Fluo F1", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO1"), 6430, 1.f, 1.f, 0.f}, + {"Fluo F2", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO2"), 4230, 1.f, 1.f, 0.f}, + {"Fluo F3", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO3"), 3450, 1.f, 1.f, 0.f}, + {"Fluo F4", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO4"), 2940, 1.f, 1.f, 0.f}, + {"Fluo F5", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO5"), 6350, 1.f, 1.f, 0.f}, + {"Fluo F6", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO6"), 4150, 1.f, 1.f, 0.f}, + {"Fluo F7", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO7"), 6500, 1.f, 1.f, 0.f}, + {"Fluo F8", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO8"), 5020, 1.f, 1.f, 0.f}, + {"Fluo F9", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO9"), 4330, 1.f, 1.f, 0.f}, + {"Fluo F10", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO10"), 5300, 1.f, 1.f, 0.f}, + {"Fluo F11", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO11"), 4000, 1.f, 1.f, 0.f}, + {"Fluo F12", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO12"), 3000, 1.f, 1.f, 0.f}, + {"HMI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_HMI"), 4800, 1.f, 1.f, 0.f}, + {"GTI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_GTI"), 5000, 1.f, 1.f, 0.f}, + {"JudgeIII Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_JUDGEIII"), 5100, 1.f, 1.f, 0.f}, + {"Solux Lamp 3500K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX35"), 3480, 1.f, 1.f, 0.f}, + {"Solux Lamp 4100K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX41"), 3930, 1.f, 1.f, 0.f}, + {"Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47"), 4700, 1.f, 1.f, 0.f}, + {"NG Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47_NG"), 4480, 1.f, 1.f, 0.f}, + {"LED LSI Lumelex 2040", WBEntry::Type::LED, M ("TP_WBALANCE_LED_LSI"), 2970, 1.f, 1.f, 0.f}, + {"LED CRS SP12 WWMR16", WBEntry::Type::LED, M ("TP_WBALANCE_LED_CRS"), 3050, 1.f, 1.f, 0.f}, + {"Flash 5500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH55"), 5500, 1.f, 1.f, 0.f}, + {"Flash 6000K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH60"), 6000, 1.f, 1.f, 0.f}, + {"Flash 6500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH65"), 6500, 1.f, 1.f, 0.f}, + // Should remain the last one + {"Custom", WBEntry::Type::CUSTOM, M ("TP_WBALANCE_CUSTOM"), 0, 1.f, 1.f, 0.f} +}; bool ToneCurveParams::HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw) { @@ -281,50 +316,14 @@ bool ToneCurveParams::HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGre return histRedRaw[255] > 50 || histGreenRaw[255] > 50 || histBlueRaw[255] > 50 || histRedRaw[0] > 50 || histGreenRaw[0] > 50 || histBlueRaw[0] > 50; } -void WBParams::init() +CropParams::CropParams() : + enabled(false), + x(0), + y(0), + w(0), + h(0), + fixratio(false) { - // Creation of the different methods and its associated temperature value - wbEntries.push_back (new WBEntry ("Camera", WBT_CAMERA, M ("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Auto", WBT_AUTO, M ("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Daylight", WBT_DAYLIGHT, M ("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Cloudy", WBT_CLOUDY, M ("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Shade", WBT_SHADE, M ("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Water 1", WBT_WATER, M ("TP_WBALANCE_WATER1"), 35000, 0.3f, 1.1f, 0.f)); - wbEntries.push_back (new WBEntry ("Water 2", WBT_WATER, M ("TP_WBALANCE_WATER2"), 48000, 0.63f, 1.38f, 0.f)); - wbEntries.push_back (new WBEntry ("Tungsten", WBT_TUNGSTEN, M ("TP_WBALANCE_TUNGSTEN"), 2856, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F1", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO1"), 6430, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F2", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO2"), 4230, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F3", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO3"), 3450, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F4", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO4"), 2940, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F5", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO5"), 6350, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F6", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO6"), 4150, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F7", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO7"), 6500, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F8", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO8"), 5020, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F9", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO9"), 4330, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F10", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO10"), 5300, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F11", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO11"), 4000, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Fluo F12", WBT_FLUORESCENT, M ("TP_WBALANCE_FLUO12"), 3000, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("HMI Lamp", WBT_LAMP, M ("TP_WBALANCE_HMI"), 4800, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("GTI Lamp", WBT_LAMP, M ("TP_WBALANCE_GTI"), 5000, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("JudgeIII Lamp", WBT_LAMP, M ("TP_WBALANCE_JUDGEIII"), 5100, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Solux Lamp 3500K", WBT_LAMP, M ("TP_WBALANCE_SOLUX35"), 3480, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Solux Lamp 4100K", WBT_LAMP, M ("TP_WBALANCE_SOLUX41"), 3930, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Solux Lamp 4700K", WBT_LAMP, M ("TP_WBALANCE_SOLUX47"), 4700, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("NG Solux Lamp 4700K", WBT_LAMP, M ("TP_WBALANCE_SOLUX47_NG"), 4480, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("LED LSI Lumelex 2040", WBT_LED, M ("TP_WBALANCE_LED_LSI"), 2970, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("LED CRS SP12 WWMR16", WBT_LED, M ("TP_WBALANCE_LED_CRS"), 3050, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Flash 5500K", WBT_FLASH, M ("TP_WBALANCE_FLASH55"), 5500, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Flash 6000K", WBT_FLASH, M ("TP_WBALANCE_FLASH60"), 6000, 1.f, 1.f, 0.f)); - wbEntries.push_back (new WBEntry ("Flash 6500K", WBT_FLASH, M ("TP_WBALANCE_FLASH65"), 6500, 1.f, 1.f, 0.f)); - // Should remain the last one - wbEntries.push_back (new WBEntry ("Custom", WBT_CUSTOM, M ("TP_WBALANCE_CUSTOM"), 0, 1.f, 1.f, 0.f)); -} - -void WBParams::cleanup() -{ - for (unsigned int i = 0; i < wbEntries.size(); i++) { - delete wbEntries[i]; - } } // Maps crop to resized width (e.g. smaller previews) @@ -360,6 +359,7 @@ void RetinexParams::getDefaulttransmissionCurve (std::vector &curve) curve.at (i) = v[i - 1]; } } + void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) { double v[16] = { 0.00, 0.1, 0.35, 0.00, @@ -1045,41 +1045,32 @@ DirPyrDenoiseParams::DirPyrDenoiseParams () setDefaults (); } -void DirPyrDenoiseParams::getDefaultNoisCurve (std::vector &curve) -{ - double v[8] = { 0.05, 0.15, 0.35, 0.35, - 0.55, 0.04, 0.35, 0.35 - }; - curve.resize (9); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - -void DirPyrDenoiseParams::getDefaultCCCurve (std::vector &curve) -{ - // double v[8]= { 0.15, 0.00,0.35,0.35, - // 0.60, 0.05,0.35,0.35}; - double v[8] = { 0.05, 0.50, 0.35, 0.35, - 0.35, 0.05, 0.35, 0.35 - }; - - curve.resize (9); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - - void DirPyrDenoiseParams::setDefaults() { - getDefaultNoisCurve (lcurve); - getDefaultCCCurve (cccurve); + lcurve = { + static_cast(FCT_MinMaxCPoints), + 0.05, + 0.15, + 0.35, + 0.35, + 0.55, + 0.04, + 0.35, + 0.35 + }; + + cccurve = { + static_cast(FCT_MinMaxCPoints), + 0.05, + 0.50, + 0.35, + 0.35, + 0.35, + 0.05, + 0.35, + 0.35 + }; enabled = false; enhance = false; @@ -1109,6 +1100,23 @@ void DirPyrDenoiseParams::getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) con cCurve.Set (this->cccurve); } +FattalToneMappingParams::FattalToneMappingParams() +{ + setDefaults(); +} + +void FattalToneMappingParams::setDefaults() +{ + enabled = false; + threshold = 0; + amount = 0; +} + +ToneCurveParams::ToneCurveParams() +{ + setDefaults(); +} + void ToneCurveParams::setDefaults() { autoexp = false; @@ -1125,12 +1133,17 @@ void ToneCurveParams::setDefaults() curve.push_back (DCT_Linear); curve2.clear (); curve2.push_back (DCT_Linear); - curveMode = ToneCurveParams::TC_MODE_STD; - curveMode2 = ToneCurveParams::TC_MODE_STD; + curveMode = ToneCurveParams::Mode::STD; + curveMode2 = ToneCurveParams::Mode::STD; hrenabled = false; method = "Blend"; } +LensProfParams::LensProfParams() +{ + setDefaults(); +} + void LensProfParams::setDefaults() { lcMode = LcMode::NONE; @@ -1142,12 +1155,64 @@ void LensProfParams::setDefaults() lfLens = ""; } +bool LensProfParams::useLensfun() const +{ + return lcMode == LcMode::LENSFUNAUTOMATCH || lcMode == LcMode::LENSFUNMANUAL; +} + +bool LensProfParams::lfAutoMatch() const +{ + return lcMode == LcMode::LENSFUNAUTOMATCH; +} + +bool LensProfParams::useLcp() const +{ + return lcMode == LcMode::LCP && lcpFile.length() > 0; +} + +bool LensProfParams::lfManual() const +{ + return lcMode == LcMode::LENSFUNMANUAL; +} + +const std::vector& LensProfParams::getMethodStrings() const +{ + static const std::vector method_strings = { + "none", + "lfauto", + "lfmanual", + "lcp" + }; + return method_strings; +} + +Glib::ustring LensProfParams::getMethodString(LcMode mode) const +{ + return getMethodStrings()[toUnderlying(mode)]; +} + +LensProfParams::LcMode LensProfParams::getMethodNumber(const Glib::ustring& mode) const +{ + for (std::vector::size_type i = 0; i < getMethodStrings().size(); ++i) { + if (getMethodStrings()[i] == mode) { + return static_cast(i); + } + } + return LcMode::NONE; +} + +CoarseTransformParams::CoarseTransformParams() +{ + setDefaults(); +} + void CoarseTransformParams::setDefaults() { rotate = 0; hflip = false; vflip = false; } + void RAWParams::BayerSensor::setPixelShiftDefaults() { pixelShiftMotion = 0; @@ -1249,14 +1314,10 @@ ProcParams::ProcParams () void ProcParams::init () { - - WBParams::init(); } void ProcParams::cleanup () { - - WBParams::cleanup(); } ProcParams* ProcParams::create () @@ -1401,11 +1462,11 @@ void ProcParams::setDefaults () colorappearance.curve.push_back (DCT_Linear); colorappearance.curve2.clear (); colorappearance.curve2.push_back (DCT_Linear); - colorappearance.curveMode = ColorAppearanceParams::TC_MODE_LIGHT; - colorappearance.curveMode2 = ColorAppearanceParams::TC_MODE_LIGHT; + colorappearance.curveMode = ColorAppearanceParams::TCMode::LIGHT; + colorappearance.curveMode2 = ColorAppearanceParams::TCMode::LIGHT; colorappearance.curve3.clear (); colorappearance.curve3.push_back (DCT_Linear); - colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_CHROMA; + colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::CHROMA; colorappearance.tempout = 5000; colorappearance.greenout = 1.0; colorappearance.ybout = 18; @@ -1677,13 +1738,13 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->toneCurve.hrenabled, "HLRecovery", "Enabled", toneCurve.hrenabled, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.method, "HLRecovery", "Method", toneCurve.method, keyFile); - const std::map tc_mapping = { - {ToneCurveParams::TC_MODE_STD, "Standard"}, - {ToneCurveParams::TC_MODE_FILMLIKE, "FilmLike"}, - {ToneCurveParams::TC_MODE_SATANDVALBLENDING, "SatAndValueBlending"}, - {ToneCurveParams::TC_MODE_WEIGHTEDSTD,"WeightedStd"}, - {ToneCurveParams::TC_MODE_LUMINANCE, "Luminance"}, - {ToneCurveParams::TC_MODE_PERCEPTUAL, "Perceptual"} + const std::map tc_mapping = { + {ToneCurveParams::Mode::STD, "Standard"}, + {ToneCurveParams::Mode::FILMLIKE, "FilmLike"}, + {ToneCurveParams::Mode::SATANDVALBLENDING, "SatAndValueBlending"}, + {ToneCurveParams::Mode::WEIGHTEDSTD,"WeightedStd"}, + {ToneCurveParams::Mode::LUMINANCE, "Luminance"}, + {ToneCurveParams::Mode::PERCEPTUAL, "Perceptual"} }; saveToKeyfile(!pedited || pedited->toneCurve.curveMode, "Exposure", "CurveMode", tc_mapping, toneCurve.curveMode, keyFile); @@ -1904,21 +1965,21 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorappearance.tonecie, "Color appearance", "Tonecie", colorappearance.tonecie, keyFile); // if (!pedited || pedited->colorappearance.sharpcie) keyFile.set_boolean ("Color appearance", "Sharpcie", colorappearance.sharpcie); - const std::map ca_mapping = { - {ColorAppearanceParams::TC_MODE_LIGHT, "Lightness"}, - {ColorAppearanceParams::TC_MODE_BRIGHT, "Brightness"} + const std::map ca_mapping = { + {ColorAppearanceParams::TCMode::LIGHT, "Lightness"}, + {ColorAppearanceParams::TCMode::BRIGHT, "Brightness"} }; saveToKeyfile(!pedited || pedited->colorappearance.curveMode, "Color appearance", "CurveMode", ca_mapping, colorappearance.curveMode, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.curveMode2, "Color appearance", "CurveMode2", ca_mapping, colorappearance.curveMode2, keyFile); saveToKeyfile( - !pedited || colorappearance.curveMode3, + !pedited || pedited->colorappearance.curveMode3, "Color appearance", "CurveMode3", { - {ColorAppearanceParams::TC_MODE_CHROMA, "Chroma"}, - {ColorAppearanceParams::TC_MODE_SATUR, "Saturation"}, - {ColorAppearanceParams::TC_MODE_COLORF, "Colorfullness"} + {ColorAppearanceParams::CTCMode::CHROMA, "Chroma"}, + {ColorAppearanceParams::CTCMode::SATUR, "Saturation"}, + {ColorAppearanceParams::CTCMode::COLORF, "Colorfullness"} }, colorappearance.curveMode3, @@ -2479,13 +2540,13 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) toneCurve.shcompr = 100; // older pp3 files can have values above 100. } - const std::map tc_mapping = { - {"Standard", ToneCurveParams::TC_MODE_STD}, - {"FilmLike", ToneCurveParams::TC_MODE_FILMLIKE}, - {"SatAndValueBlending", ToneCurveParams::TC_MODE_SATANDVALBLENDING}, - {"WeightedStd", ToneCurveParams::TC_MODE_WEIGHTEDSTD}, - {"Luminance", ToneCurveParams::TC_MODE_LUMINANCE}, - {"Perceptual", ToneCurveParams::TC_MODE_PERCEPTUAL} + const std::map tc_mapping = { + {"Standard", ToneCurveParams::Mode::STD}, + {"FilmLike", ToneCurveParams::Mode::FILMLIKE}, + {"SatAndValueBlending", ToneCurveParams::Mode::SATANDVALBLENDING}, + {"WeightedStd", ToneCurveParams::Mode::WEIGHTEDSTD}, + {"Luminance", ToneCurveParams::Mode::LUMINANCE}, + {"Perceptual", ToneCurveParams::Mode::PERCEPTUAL} }; assignFromKeyfile(keyFile, "Exposure", "CurveMode", pedited, tc_mapping, toneCurve.curveMode, pedited->toneCurve.curveMode); @@ -2835,9 +2896,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color appearance", "Tonecie", pedited, colorappearance.tonecie, pedited->colorappearance.tonecie); // if (keyFile.has_key ("Color appearance", "Sharpcie")) {colorappearance.sharpcie = keyFile.get_boolean ("Color appearance", "Sharpcie"); if (pedited) pedited->colorappearance.sharpcie = true; } - const std::map tc_mapping = { - {"Lightness", ColorAppearanceParams::TC_MODE_LIGHT}, - {"Brightness", ColorAppearanceParams::TC_MODE_BRIGHT} + const std::map tc_mapping = { + {"Lightness", ColorAppearanceParams::TCMode::LIGHT}, + {"Brightness", ColorAppearanceParams::TCMode::BRIGHT} }; assignFromKeyfile(keyFile, "Color appearance", "CurveMode", pedited, tc_mapping, colorappearance.curveMode, pedited->colorappearance.curveMode); assignFromKeyfile(keyFile, "Color appearance", "CurveMode2", pedited, tc_mapping, colorappearance.curveMode2, pedited->colorappearance.curveMode2); @@ -2848,9 +2909,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) "CurveMode3", pedited, { - {"Chroma", ColorAppearanceParams::TC_MODE_CHROMA}, - {"Saturation", ColorAppearanceParams::TC_MODE_SATUR}, - {"Colorfullness", ColorAppearanceParams::TC_MODE_COLORF} + {"Chroma", ColorAppearanceParams::CTCMode::CHROMA}, + {"Saturation", ColorAppearanceParams::CTCMode::SATUR}, + {"Colorfullness", ColorAppearanceParams::CTCMode::COLORF} }, colorappearance.curveMode3, pedited->colorappearance.curveMode3 diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 62aab66bd..20c9db026 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -253,18 +253,14 @@ private: /** * Parameters of the tone curve */ -class ToneCurveParams -{ - -public: - - enum eTCModeId { - TC_MODE_STD, // Standard modes, the curve is applied on all component individually - TC_MODE_WEIGHTEDSTD, // Weighted standard mode - TC_MODE_FILMLIKE, // Film-like mode, as defined in Adobe's reference code - TC_MODE_SATANDVALBLENDING, // Modify the Saturation and Value channel - TC_MODE_LUMINANCE, // Modify the Luminance channel with coefficients from Rec 709's - TC_MODE_PERCEPTUAL // Keep color appearance constant using perceptual modeling +struct ToneCurveParams { + enum class Mode { + STD, // Standard modes, the curve is applied on all component individually + WEIGHTEDSTD, // Weighted standard mode + FILMLIKE, // Film-like mode, as defined in Adobe's reference code + SATANDVALBLENDING, // Modify the Saturation and Value channel + LUMINANCE, // Modify the Luminance channel with coefficients from Rec 709's + PERCEPTUAL // Keep color appearance constant using perceptual modeling }; bool autoexp; @@ -274,8 +270,8 @@ public: double expcomp; std::vector curve; std::vector curve2; - eTCModeId curveMode; - eTCModeId curveMode2; + Mode curveMode; + Mode curveMode2; int brightness; int black; int contrast; @@ -284,20 +280,17 @@ public: int hlcompr; // Highlight Recovery's compression int hlcomprthresh; // Highlight Recovery's threshold - ToneCurveParams () - { - setDefaults(); - } + ToneCurveParams(); + void setDefaults(); - static bool HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw); + static bool HLReconstructionNecessary(LUTu& histRedRaw, LUTu& histGreenRaw, LUTu& histBlueRaw); }; + /** * Parameters of Retinex */ -class RetinexParams +struct RetinexParams { - -public: bool enabled; std::vector cdcurve; std::vector cdHcurve; @@ -330,23 +323,22 @@ public: int highl; int skal; bool medianmap; - RetinexParams (); + + RetinexParams(); void setDefaults(); - void getCurves (RetinextransmissionCurve &transmissionCurveLUT, RetinexgaintransmissionCurve &gaintransmissionCurveLUT) const; + void getCurves(RetinextransmissionCurve& transmissionCurveLUT, RetinexgaintransmissionCurve& gaintransmissionCurveLUT) const; - static void getDefaultgaintransmissionCurve (std::vector &curve); + static void getDefaultgaintransmissionCurve (std::vector& curve); - static void getDefaulttransmissionCurve (std::vector &curve); + static void getDefaulttransmissionCurve (std::vector& curve); }; /** * Parameters of the luminance curve */ -class LCurveParams +struct LCurveParams { - -public: std::vector lcurve; std::vector acurve; std::vector bcurve; @@ -367,10 +359,7 @@ public: /** * Parameters of the RGB curves */ -class RGBCurvesParams -{ - -public: +struct RGBCurvesParams { bool lumamode; std::vector rcurve; std::vector gcurve; @@ -381,10 +370,7 @@ public: * Parameters of the Color Toning */ -class ColorToningParams -{ - -public: +struct ColorToningParams { bool enabled; bool autosat; std::vector opacityCurve; @@ -429,28 +415,26 @@ public: double sathigh; bool lumamode; - ColorToningParams (); + ColorToningParams(); void setDefaults(); // SHOULD BE GENERALIZED TO ALL CLASSES! - /// @brief Transform the mixer values to their curve equivalences - void mixerToCurve (std::vector &colorCurve, std::vector &opacityCurve) const; - /// @brief Specifically transform the sliders values to their curve equivalences - void slidersToCurve (std::vector &colorCurve, std::vector &opacityCurve) const; - /// @brief Fill the ColorGradientCurve and OpacityCurve LUTf from the control points curve or sliders value - void getCurves (ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3], bool &opautili) const; - static void getDefaultColorCurve (std::vector &curve); - static void getDefaultOpacityCurve (std::vector &curve); - static void getDefaultCLCurve (std::vector &curve); - static void getDefaultCL2Curve (std::vector &curve); + /// @brief Transform the mixer values to their curve equivalences + void mixerToCurve(std::vector& colorCurve, std::vector& opacityCurve) const; + /// @brief Specifically transform the sliders values to their curve equivalences + void slidersToCurve(std::vector& colorCurve, std::vector& opacityCurve) const; + /// @brief Fill the ColorGradientCurve and OpacityCurve LUTf from the control points curve or sliders value + void getCurves(ColorGradientCurve& colorCurveLUT, OpacityCurve& opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3], bool& opautili) const; + + static void getDefaultColorCurve(std::vector& curve); + static void getDefaultOpacityCurve(std::vector& curve); + static void getDefaultCLCurve(std::vector& curve); + static void getDefaultCL2Curve(std::vector& curve); }; /** * Parameters of the sharpening */ -class SharpeningParams -{ - -public: +struct SharpeningParams { bool enabled; double radius; int amount; @@ -468,17 +452,15 @@ public: SharpeningParams(); }; -class SharpenEdgeParams -{ -public: + +struct SharpenEdgeParams { bool enabled; int passes; double amount; bool threechannels; }; -class SharpenMicroParams -{ -public: + +struct SharpenMicroParams { bool enabled; bool matrix; double amount; @@ -488,10 +470,7 @@ public: /** * Parameters of the vibrance */ -class VibranceParams -{ - -public: +struct VibranceParams { bool enabled; int pastels; int saturated; @@ -504,83 +483,57 @@ public: VibranceParams(); }; -/** - * Parameters of the color boost - */ -/*class ColorBoostParams { - - public: - int amount; - bool avoidclip; - bool enable_saturationlimiter; - double saturationlimit; -};*/ - /** * Parameters of the white balance adjustments */ +struct WBEntry { + enum class Type { + CAMERA, + AUTO, + DAYLIGHT, + CLOUDY, + SHADE, + WATER, + TUNGSTEN, + FLUORESCENT, + LAMP, + FLASH, + LED, + // CUSTOM one must remain the last one! + CUSTOM + }; -enum WBTypes { - WBT_CAMERA, - WBT_AUTO, - WBT_DAYLIGHT, - WBT_CLOUDY, - WBT_SHADE, - WBT_WATER, - WBT_TUNGSTEN, - WBT_FLUORESCENT, - WBT_LAMP, - WBT_FLASH, - WBT_LED, - // WBT_CUSTOM one must remain the last one! - WBT_CUSTOM -}; - -class WBEntry -{ -public: Glib::ustring ppLabel; - enum WBTypes type; + Type type; Glib::ustring GUILabel; int temperature; double green; double equal; double tempBias; - - WBEntry (const Glib::ustring &p, enum WBTypes t, const Glib::ustring &l, int temp, double green, double equal, double bias) : ppLabel (p), type (t), GUILabel (l), temperature (temp), green (green), equal (equal), tempBias (bias) {}; }; -class WBParams -{ - -public: - static std::vector wbEntries; +struct WBParams { + static const std::vector wbEntries; Glib::ustring method; int temperature; double green; double equal; double tempBias; - - static void init(); - static void cleanup(); }; /** * Parameters of colorappearance */ -class ColorAppearanceParams -{ - -public: - enum eTCModeId { - TC_MODE_LIGHT, // Lightness mode - TC_MODE_BRIGHT, // Brightness mode +struct ColorAppearanceParams { + enum class TCMode { + LIGHT, // Lightness mode + BRIGHT, // Brightness mode }; - enum eCTCModeId { - TC_MODE_CHROMA, // chroma mode - TC_MODE_SATUR, // saturation mode - TC_MODE_COLORF, // colorfullness mode + enum class CTCMode { + CHROMA, // chroma mode + SATUR, // saturation mode + COLORF, // colorfullness mode }; bool enabled; @@ -591,9 +544,9 @@ public: std::vector curve; std::vector curve2; std::vector curve3; - eTCModeId curveMode; - eTCModeId curveMode2; - eCTCModeId curveMode3; + TCMode curveMode; + TCMode curveMode2; + CTCMode curveMode3; Glib::ustring surround; Glib::ustring surrsrc; @@ -625,50 +578,12 @@ public: double greenout; int tempsc; double greensc; - - // bool sharpcie; }; -/** - * Parameters of the color shift - */ -/*class ColorShiftParams { - - public: - double a; - double b; -};*/ - -/** - * Parameters of the luminance denoising - */ -/*class LumaDenoiseParams { - - public: - bool enabled; - double radius; - int edgetolerance; -};*/ - -/** - * Parameters of the color denoising - */ -/*class ColorDenoiseParams { - - public: - bool enabled; - int edgetolerance; - bool edgesensitive; - int amount; -};*/ - /** * Parameters of defringing */ -class DefringeParams -{ - -public: +struct DefringeParams { bool enabled; double radius; float threshold; @@ -678,10 +593,7 @@ public: /** * Parameters of impulse denoising */ -class ImpulseDenoiseParams -{ - -public: +struct ImpulseDenoiseParams { bool enabled; int thresh; @@ -690,10 +602,7 @@ public: /** * Parameters of the directional pyramid denoising */ -class DirPyrDenoiseParams -{ - -public: +struct DirPyrDenoiseParams { std::vector lcurve; std::vector cccurve; @@ -718,19 +627,14 @@ public: Glib::ustring rgbmethod; int passes; - DirPyrDenoiseParams (); + DirPyrDenoiseParams(); void setDefaults(); // SHOULD BE GENERALIZED TO ALL CLASSES! - void getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) const; - - static void getDefaultNoisCurve (std::vector &curve); - static void getDefaultCCCurve (std::vector &curve); + void getCurves(NoiseCurve& lCurve, NoiseCurve& cCurve) const; }; -//EPD related parameters. -class EPDParams -{ -public: +// EPD related parameters. +struct EPDParams { bool enabled; double strength; double gamma; @@ -739,34 +643,20 @@ public: int reweightingIterates; }; - // Fattal02 Tone-Mapping parameters -class FattalToneMappingParams { -public: +struct FattalToneMappingParams { bool enabled; int threshold; int amount; - FattalToneMappingParams() - { - setDefaults(); - } - - void setDefaults() - { - enabled = false; - threshold = 0; - amount = 0; - } + FattalToneMappingParams(); + void setDefaults(); }; /** * Parameters of the shadow/highlight enhancement */ -class SHParams -{ - -public: +struct SHParams { bool enabled; bool hq; int highlights; @@ -780,10 +670,7 @@ public: /** * Parameters of the cropping */ -class CropParams -{ - -public: +struct CropParams { bool enabled; int x; int y; @@ -794,63 +681,45 @@ public: Glib::ustring orientation; Glib::ustring guide; - CropParams() : enabled (false), x (0), y (0), w (0), h (0), fixratio (false) {}; - void mapToResized (int resizedWidth, int resizedHeight, int scale, int &x1, int &x2, int &y1, int &y2) const; + CropParams(); + void mapToResized (int resizedWidth, int resizedHeight, int scale, int& x1, int& x2, int& y1, int& y2) const; }; /** * Parameters of the coarse transformations like 90 deg rotations and h/v flipping */ -class CoarseTransformParams -{ - -public: +struct CoarseTransformParams { int rotate; bool hflip; bool vflip; - CoarseTransformParams() - { - setDefaults(); - } + CoarseTransformParams(); void setDefaults(); }; /** * Common transformation parameters */ -class CommonTransformParams -{ - -public: +struct CommonTransformParams { bool autofill; }; /** * Parameters of the rotation */ -class RotateParams -{ - -public: +struct RotateParams { double degree; }; /** * Parameters of the distortion correction */ -class DistortionParams -{ - -public: +struct DistortionParams { double amount; }; // Lens profile correction parameters -class LensProfParams -{ - -public: +struct LensProfParams { enum class LcMode { NONE, // No lens correction LENSFUNAUTOMATCH, // Lens correction using auto matched lensfun database entry @@ -858,7 +727,6 @@ public: LCP // Lens correction using lcp file }; - static const char *methodstring[static_cast(LcMode::LCP) + 1u]; LcMode lcMode; Glib::ustring lcpFile; bool useDist, useVign, useCA; @@ -866,56 +734,24 @@ public: Glib::ustring lfCameraModel; Glib::ustring lfLens; - LensProfParams() - { - setDefaults(); - } + LensProfParams(); void setDefaults(); - bool useLensfun() const - { - return lcMode == LcMode::LENSFUNAUTOMATCH || lcMode == LcMode::LENSFUNMANUAL; - } + bool useLensfun() const; + bool lfAutoMatch() const; + bool useLcp() const; + bool lfManual() const; - bool lfAutoMatch() const - { - return lcMode == LcMode::LENSFUNAUTOMATCH; - } - - bool useLcp() const - { - return lcMode == LcMode::LCP && lcpFile.length() > 0; - } - - bool lfManual() const - { - return lcMode == LcMode::LENSFUNMANUAL; - } - - Glib::ustring getMethodString(LcMode mode) const - { - return methodstring[static_cast(mode)]; - } - - LcMode getMethodNumber(const Glib::ustring &mode) const - { - for(size_t i = 0; i <= static_cast(LcMode::LCP); ++i) { - if(methodstring[i] == mode) { - return static_cast(i); - } - } - return LcMode::NONE; - } + const std::vector& getMethodStrings() const; + Glib::ustring getMethodString(LcMode mode) const; + LcMode getMethodNumber(const Glib::ustring& mode) const; }; /** * Parameters of the perspective correction */ -class PerspectiveParams -{ - -public: +struct PerspectiveParams { double horizontal; double vertical; }; @@ -923,10 +759,7 @@ public: /** * Parameters of the gradient filter */ -class GradientParams -{ - -public: +struct GradientParams { bool enabled; double degree; int feather; @@ -938,10 +771,7 @@ public: /** * Parameters of the post-crop vignette filter */ -class PCVignetteParams -{ - -public: +struct PCVignetteParams { bool enabled; double strength; int feather; @@ -951,10 +781,7 @@ public: /** * Parameters of the vignetting correction */ -class VignettingParams -{ - -public: +struct VignettingParams { int amount; int radius; int strength; @@ -965,10 +792,7 @@ public: /** * Parameters of the color mixer */ -class ChannelMixerParams -{ - -public: +struct ChannelMixerParams { int red[3]; int green[3]; int blue[3]; @@ -1185,12 +1009,12 @@ public: WaveletParams (); void setDefaults(); - void getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG, WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const; - static void getDefaultCCWCurve (std::vector &curve); - static void getDefaultOpacityCurveRG (std::vector &curve); - static void getDefaultOpacityCurveBY (std::vector &curve); - static void getDefaultOpacityCurveW (std::vector &curve); - static void getDefaultOpacityCurveWL (std::vector &curve); + void getCurves (WavCurve& cCurve, WavOpacityCurveRG& opacityCurveLUTRG, WavOpacityCurveBY& opacityCurveLUTBY, WavOpacityCurveW& opacityCurveLUTW, WavOpacityCurveWL& opacityCurveLUTWL) const; + static void getDefaultCCWCurve (std::vector& curve); + static void getDefaultOpacityCurveRG (std::vector& curve); + static void getDefaultOpacityCurveBY (std::vector& curve); + static void getDefaultOpacityCurveW (std::vector& curve); + static void getDefaultOpacityCurveWL (std::vector& curve); }; @@ -1420,7 +1244,7 @@ public: CACorrParams cacorrection; ///< Lens c/a correction parameters VignettingParams vignetting; ///< Lens vignetting correction parameters ChannelMixerParams chmixer; ///< Channel mixer parameters - BlackWhiteParams blackwhite; ///< Black & White parameters + BlackWhiteParams blackwhite; ///< Black& White parameters ResizeParams resize; ///< Resize parameters ColorManagementParams icm; ///< profiles/color spaces used during the image processing RAWParams raw; ///< RAW parameters before demosaicing @@ -1455,14 +1279,14 @@ public: * @param pedited pointer to a ParamsEdited object (optional) to store which values has to be saved * @return Error code (=0 if all supplied filenames where created correctly) */ - int save (const Glib::ustring &fname, const Glib::ustring &fname2 = "", bool fnameAbsolute = true, ParamsEdited* pedited = nullptr); + int save (const Glib::ustring& fname, const Glib::ustring& fname2 = "", bool fnameAbsolute = true, ParamsEdited* pedited = nullptr); /** * Loads the parameters from a file. * @param fname the name of the file * @params pedited pointer to a ParamsEdited object (optional) to store which values has been loaded * @return Error code (=0 if no error) */ - int load (const Glib::ustring &fname, ParamsEdited* pedited = nullptr); + int load (const Glib::ustring& fname, ParamsEdited* pedited = nullptr); /** Creates a new instance of ProcParams. * @return a pointer to the new ProcParams instance. */ @@ -1484,7 +1308,7 @@ private: * @param content the text to write * @return Error code (=0 if no error) * */ - int write (const Glib::ustring &fname, const Glib::ustring &content) const; + int write (const Glib::ustring& fname, const Glib::ustring& content) const; }; @@ -1514,7 +1338,7 @@ public: PartialProfile (const ProcParams* pp, const ParamsEdited* pe = nullptr); void deleteInstance (); void clearGeneral (); - int load (const Glib::ustring &fName); + int load (const Glib::ustring& fName); void set (bool v); const void applyTo (ProcParams *destParams) const ; }; diff --git a/rtengine/utils.h b/rtengine/utils.h index 9c56ad0a0..5730c2544 100644 --- a/rtengine/utils.h +++ b/rtengine/utils.h @@ -38,7 +38,7 @@ void hflip(unsigned char* img, int w, int h); void vflip(unsigned char* img, int w, int h); template -typename std::underlying_type::type toUnderlying(ENUM value) +constexpr typename std::underlying_type::type toUnderlying(ENUM value) { return static_cast::type>(value); } diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 91f58f42e..7d8eb7de4 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -799,9 +799,9 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) shape->setCurve (pp->colorappearance.curve); shape2->setCurve (pp->colorappearance.curve2); shape3->setCurve (pp->colorappearance.curve3); - toneCurveMode->set_active (pp->colorappearance.curveMode); - toneCurveMode2->set_active (pp->colorappearance.curveMode2); - toneCurveMode3->set_active (pp->colorappearance.curveMode3); + toneCurveMode->set_active (toUnderlying(pp->colorappearance.curveMode)); + toneCurveMode2->set_active (toUnderlying(pp->colorappearance.curveMode2)); + toneCurveMode3->set_active (toUnderlying(pp->colorappearance.curveMode3)); curveMode3Changed(); // This will set the correct sensitive state of depending Adjusters if (pedited) { @@ -1044,27 +1044,27 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = toneCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->colorappearance.curveMode = ColorAppearanceParams::TC_MODE_LIGHT; + pp->colorappearance.curveMode = ColorAppearanceParams::TCMode::LIGHT; } else if (tcMode == 1) { - pp->colorappearance.curveMode = ColorAppearanceParams::TC_MODE_BRIGHT; + pp->colorappearance.curveMode = ColorAppearanceParams::TCMode::BRIGHT; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->colorappearance.curveMode2 = ColorAppearanceParams::TC_MODE_LIGHT; + pp->colorappearance.curveMode2 = ColorAppearanceParams::TCMode::LIGHT; } else if (tcMode == 1) { - pp->colorappearance.curveMode2 = ColorAppearanceParams::TC_MODE_BRIGHT; + pp->colorappearance.curveMode2 = ColorAppearanceParams::TCMode::BRIGHT; } int tcMode3 = toneCurveMode3->get_active_row_number(); if (tcMode3 == 0) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_CHROMA; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::CHROMA; } else if (tcMode3 == 1) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_SATUR; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::SATUR; } else if (tcMode3 == 2) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_COLORF; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::COLORF; } if (pedited) { diff --git a/rtgui/dirpyrdenoise.cc b/rtgui/dirpyrdenoise.cc index 168a9df03..2a90f183e 100644 --- a/rtgui/dirpyrdenoise.cc +++ b/rtgui/dirpyrdenoise.cc @@ -61,7 +61,7 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP NoiscurveEditorG = new CurveEditorGroup (options.lastDenoiseCurvesDir, M("TP_DIRPYRDENOISE_LCURVE")); //curveEditorG = new CurveEditorGroup (options.lastLabCurvesDir); NoiscurveEditorG->setCurveListener (this); - rtengine::DirPyrDenoiseParams::getDefaultNoisCurve(defaultCurve); + defaultCurve = rtengine::DirPyrDenoiseParams().lcurve; lshape = static_cast(NoiscurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); lshape->setIdentityValue(0.); lshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); @@ -145,7 +145,7 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP CCcurveEditorG = new CurveEditorGroup (options.lastDenoiseCurvesDir, M("TP_DIRPYRDENOISE_CCCURVE")); CCcurveEditorG->setCurveListener (this); - rtengine::DirPyrDenoiseParams::getDefaultCCCurve(defaultCurve); + defaultCurve = rtengine::DirPyrDenoiseParams().cccurve; ccshape = static_cast(CCcurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); ccshape->setIdentityValue(0.); ccshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 28dcf9f3d..558b0fe6b 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -223,8 +223,8 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) shape->setCurve (pp->toneCurve.curve); shape2->setCurve (pp->toneCurve.curve2); - toneCurveMode->set_active(pp->toneCurve.curveMode); - toneCurveMode2->set_active(pp->toneCurve.curveMode2); + toneCurveMode->set_active(rtengine::toUnderlying(pp->toneCurve.curveMode)); + toneCurveMode2->set_active(rtengine::toUnderlying(pp->toneCurve.curveMode2)); if (pedited) { expcomp->setEditedState (pedited->toneCurve.expcomp ? Edited : UnEdited); @@ -314,33 +314,33 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = toneCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_STD; + pp->toneCurve.curveMode = ToneCurveParams::Mode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_WEIGHTEDSTD; + pp->toneCurve.curveMode = ToneCurveParams::Mode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_FILMLIKE; + pp->toneCurve.curveMode = ToneCurveParams::Mode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_SATANDVALBLENDING; + pp->toneCurve.curveMode = ToneCurveParams::Mode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_LUMINANCE; + pp->toneCurve.curveMode = ToneCurveParams::Mode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_PERCEPTUAL; + pp->toneCurve.curveMode = ToneCurveParams::Mode::PERCEPTUAL; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_STD; + pp->toneCurve.curveMode2 = ToneCurveParams::Mode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_WEIGHTEDSTD; + pp->toneCurve.curveMode2 = ToneCurveParams::Mode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_FILMLIKE; + pp->toneCurve.curveMode2 = ToneCurveParams::Mode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_SATANDVALBLENDING; + pp->toneCurve.curveMode2 = ToneCurveParams::Mode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_LUMINANCE; + pp->toneCurve.curveMode2 = ToneCurveParams::Mode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_PERCEPTUAL; + pp->toneCurve.curveMode2 = ToneCurveParams::Mode::PERCEPTUAL; } if (pedited) { diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index d16dafa08..fc6a880f3 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -34,7 +34,7 @@ using namespace rtengine; using namespace rtengine::procparams; -Glib::RefPtr WhiteBalance::wbPixbufs[rtengine::procparams::WBT_CUSTOM + 1]; +Glib::RefPtr WhiteBalance::wbPixbufs[toUnderlying(WBEntry::Type::CUSTOM) + 1]; /* Glib::RefPtr WhiteBalance::wbCameraPB, WhiteBalance::wbAutoPB, WhiteBalance::wbSunPB, WhiteBalance::wbTungstenPB, WhiteBalance::wbCloudyPB, WhiteBalance::wbShadePB, WhiteBalance::wbFluorescentPB, WhiteBalance::wbLampPB, @@ -43,24 +43,24 @@ Glib::RefPtr WhiteBalance::wbCameraPB, WhiteBalance::wbAutoPB, Whit void WhiteBalance::init () { - wbPixbufs[WBT_CAMERA] = RTImage::createFromFile ("wb-camera.png"); - wbPixbufs[WBT_AUTO] = RTImage::createFromFile ("wb-auto.png"); - wbPixbufs[WBT_DAYLIGHT] = RTImage::createFromFile ("wb-sun.png"); - wbPixbufs[WBT_CLOUDY] = RTImage::createFromFile ("wb-cloudy.png"); - wbPixbufs[WBT_SHADE] = RTImage::createFromFile ("wb-shade.png"); - wbPixbufs[WBT_WATER] = RTImage::createFromFile ("wb-water.png"); -// wbPixbufs[WBT_WATER2] = RTImage::createFromFile ("wb-water.png"); - wbPixbufs[WBT_TUNGSTEN] = RTImage::createFromFile ("wb-tungsten.png"); - wbPixbufs[WBT_FLUORESCENT] = RTImage::createFromFile ("wb-fluorescent.png"); - wbPixbufs[WBT_LAMP] = RTImage::createFromFile ("wb-lamp.png"); - wbPixbufs[WBT_FLASH] = RTImage::createFromFile ("wb-flash.png"); - wbPixbufs[WBT_LED] = RTImage::createFromFile ("wb-led.png"); - wbPixbufs[WBT_CUSTOM] = RTImage::createFromFile ("wb-custom.png"); + wbPixbufs[toUnderlying(WBEntry::Type::CAMERA)] = RTImage::createFromFile ("wb-camera.png"); + wbPixbufs[toUnderlying(WBEntry::Type::AUTO)] = RTImage::createFromFile ("wb-auto.png"); + wbPixbufs[toUnderlying(WBEntry::Type::DAYLIGHT)] = RTImage::createFromFile ("wb-sun.png"); + wbPixbufs[toUnderlying(WBEntry::Type::CLOUDY)] = RTImage::createFromFile ("wb-cloudy.png"); + wbPixbufs[toUnderlying(WBEntry::Type::SHADE)] = RTImage::createFromFile ("wb-shade.png"); + wbPixbufs[toUnderlying(WBEntry::Type::WATER)] = RTImage::createFromFile ("wb-water.png"); +// wbPixbufs[WBEntry::Type::WATER2] = RTImage::createFromFile ("wb-water.png"); + wbPixbufs[toUnderlying(WBEntry::Type::TUNGSTEN)] = RTImage::createFromFile ("wb-tungsten.png"); + wbPixbufs[toUnderlying(WBEntry::Type::FLUORESCENT)] = RTImage::createFromFile ("wb-fluorescent.png"); + wbPixbufs[toUnderlying(WBEntry::Type::LAMP)] = RTImage::createFromFile ("wb-lamp.png"); + wbPixbufs[toUnderlying(WBEntry::Type::FLASH)] = RTImage::createFromFile ("wb-flash.png"); + wbPixbufs[toUnderlying(WBEntry::Type::LED)] = RTImage::createFromFile ("wb-led.png"); + wbPixbufs[toUnderlying(WBEntry::Type::CUSTOM)] = RTImage::createFromFile ("wb-custom.png"); } void WhiteBalance::cleanup () { - for (unsigned int i = 0; i < WBT_CUSTOM + 1; i++) { + for (unsigned int i = 0; i < toUnderlying(WBEntry::Type::CUSTOM) + 1; i++) { wbPixbufs[i].reset(); } } @@ -163,68 +163,68 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB // Assign the model to the Combobox method->set_model(refTreeModel); - enum WBTypes oldType = WBParams::wbEntries[0]->type; - enum WBTypes currType; + WBEntry::Type oldType = WBParams::wbEntries[0].type; + WBEntry::Type currType; Gtk::TreeModel::Row row, childrow; for (unsigned int i = 0; i < WBParams::wbEntries.size(); i++) { - if (oldType != (currType = WBParams::wbEntries[i]->type)) { + if (oldType != (currType = WBParams::wbEntries[i].type)) { // New entry type - if (currType == WBT_FLUORESCENT) { + if (currType == WBEntry::Type::FLUORESCENT) { // Creating the Fluorescent subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_FLUO_HEADER"); row[methodColumns.colId] = i + 100; } - if (currType == WBT_WATER) { + if (currType == WBEntry::Type::WATER) { // Creating the under water subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_WATER_HEADER"); row[methodColumns.colId] = i + 100; } - if (currType == WBT_LAMP) { + if (currType == WBEntry::Type::LAMP) { // Creating the Lamp subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_LAMP_HEADER"); row[methodColumns.colId] = i + 100; } - if (currType == WBT_LED) { + if (currType == WBEntry::Type::LED) { // Creating the LED subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_LED_HEADER"); row[methodColumns.colId] = i + 100; } - if (currType == WBT_FLASH) { + if (currType == WBEntry::Type::FLASH) { // Creating the Flash subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_FLASH_HEADER"); row[methodColumns.colId] = i + 100; } } - if (currType == WBT_FLUORESCENT - || currType == WBT_LAMP - || currType == WBT_WATER - || currType == WBT_FLASH - || currType == WBT_LED + if (currType == WBEntry::Type::FLUORESCENT + || currType == WBEntry::Type::LAMP + || currType == WBEntry::Type::WATER + || currType == WBEntry::Type::FLASH + || currType == WBEntry::Type::LED ) { childrow = *(refTreeModel->append(row.children())); - childrow[methodColumns.colIcon] = wbPixbufs[currType]; - childrow[methodColumns.colLabel] = WBParams::wbEntries[i]->GUILabel; + childrow[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + childrow[methodColumns.colLabel] = WBParams::wbEntries[i].GUILabel; childrow[methodColumns.colId] = i; } else { row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; - row[methodColumns.colLabel] = WBParams::wbEntries[i]->GUILabel; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colLabel] = WBParams::wbEntries[i].GUILabel; row[methodColumns.colId] = i; } @@ -362,12 +362,24 @@ void WhiteBalance::adjusterChanged (Adjuster* a, double newval) } Glib::ustring colLabel = row[methodColumns.colLabel]; - WBEntry* ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI); - WBEntry* wbCustom = findWBEntry ("Custom", WBLT_PP); + const std::pair ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI); + const std::pair wbCustom = findWBEntry ("Custom", WBLT_PP); - if (!ppMethod || (ppMethod->ppLabel != wbCustom->ppLabel && !((a == equal || a == tempBias) && ppMethod->type == WBT_AUTO)) ) { + if ( + !ppMethod.first + || ( + ppMethod.second.ppLabel != wbCustom.second.ppLabel + && !( + ( + a == equal + || a == tempBias + ) + && ppMethod.second.type == WBEntry::Type::AUTO + ) + ) + ) { methconn.block(true); - opt = setActiveMethod(wbCustom->GUILabel); + opt = setActiveMethod(wbCustom.second.GUILabel); tempBias->set_sensitive(false); cache_customWB (tVal, gVal); @@ -429,12 +441,12 @@ void WhiteBalance::optChanged () tempBias->setEditedState (UnEdited); } else { unsigned int methodId = findWBEntryId (row[methodColumns.colLabel], WBLT_GUI); - WBEntry* currMethod = WBParams::wbEntries[methodId]; + const WBEntry& currMethod = WBParams::wbEntries[methodId]; - tempBias->set_sensitive(currMethod->type == WBT_AUTO); + tempBias->set_sensitive(currMethod.type == WBEntry::Type::AUTO); - switch (currMethod->type) { - case WBT_CAMERA: + switch (currMethod.type) { + case WBEntry::Type::CAMERA: if (wbp) { double ctemp, cgreen; wbp->getCamWB (ctemp, cgreen); @@ -451,7 +463,7 @@ void WhiteBalance::optChanged () break; - case WBT_AUTO: + case WBEntry::Type::AUTO: if (wbp) { if (batchMode) { temp->setEditedState (UnEdited); @@ -464,7 +476,7 @@ void WhiteBalance::optChanged () break; - case WBT_CUSTOM: + case WBEntry::Type::CUSTOM: if (custom_temp > 0) { temp->setValue (temp->getAddMode() ? 0.0 : custom_temp); green->setValue (green->getAddMode() ? 0.0 : custom_green); @@ -484,19 +496,19 @@ void WhiteBalance::optChanged () break; /* All other solution are the default cases - case WBT_DAYLIGHT: - case WBT_CLOUDY: - case WBT_SHADE: - case WBT_TUNGSTEN: - case WBT_FLUORESCENT: - case WBT_LAMP: - case WBT_FLASH: - case WBT_LED:*/ + case WBEntry::Type::DAYLIGHT: + case WBEntry::Type::CLOUDY: + case WBEntry::Type::SHADE: + case WBEntry::Type::TUNGSTEN: + case WBEntry::Type::FLUORESCENT: + case WBEntry::Type::LAMP: + case WBEntry::Type::FLASH: + case WBEntry::Type::LED:*/ default: // recall custom WB settings if it exists, set to 1.0 otherwise - temp->setValue ( temp->getAddMode() ? 0.0 : (double)(currMethod->temperature)); - green->setValue (green->getAddMode() ? 0.0 : (double)(currMethod->green)); - equal->setValue (equal->getAddMode() ? 0.0 : (double)(currMethod->equal)); + temp->setValue ( temp->getAddMode() ? 0.0 : (double)(currMethod.temperature)); + green->setValue (green->getAddMode() ? 0.0 : (double)(currMethod.green)); + equal->setValue (equal->getAddMode() ? 0.0 : (double)(currMethod.equal)); if (batchMode) { temp->setEditedState (Edited); @@ -551,17 +563,21 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) if (pedited && !pedited->wb.method) { opt = setActiveMethod(M("GENERAL_UNCHANGED")); } else { - WBEntry* wbValues = findWBEntry(pp->wb.method, WBLT_PP); + const WBEntry& wbValues = + [this, pp]() -> const WBEntry& + { + const std::pair res = findWBEntry(pp->wb.method, WBLT_PP); + return + !res.first + ? findWBEntry("Camera", WBLT_PP).second + : res.second; + }(); - if (!wbValues) { - wbValues = findWBEntry("Camera", WBLT_PP); - } - - opt = setActiveMethod(wbValues->GUILabel); + opt = setActiveMethod(wbValues.GUILabel); // temperature is reset to the associated temperature, or 0.0 if addMode is set. - switch (wbValues->type) { - case WBT_CUSTOM: + switch (wbValues.type) { + case WBEntry::Type::CUSTOM: temp->setValue (temp->getAddMode() ? 0.0 : pp->wb.temperature); green->setValue (green->getAddMode() ? 0.0 : pp->wb.green); equal->setValue (equal->getAddMode() ? 0.0 : pp->wb.equal); @@ -578,7 +594,7 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) break; - case WBT_CAMERA: + case WBEntry::Type::CAMERA: if (wbp) { double ctemp = -1.0; double cgreen = -1.0; @@ -600,7 +616,7 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) break; - case WBT_AUTO: + case WBEntry::Type::AUTO: // the equalizer's value is restored for the AutoWB equal->setValue (equal->getAddMode() ? 0.0 : pp->wb.equal); tempBias->setValue (tempBias->getAddMode() ? 0.0 : pp->wb.tempBias); @@ -620,18 +636,18 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) /* All those types are the "default" case: - case WBT_DAYLIGHT: - case WBT_CLOUDY: - case WBT_SHADE: - case WBT_TUNGSTEN: - case WBT_FLUORESCENT: - case WBT_LAMP: - case WBT_FLASH: - case WBT_LED: + case WBEntry::Type::DAYLIGHT: + case WBEntry::Type::CLOUDY: + case WBEntry::Type::SHADE: + case WBEntry::Type::TUNGSTEN: + case WBEntry::Type::FLUORESCENT: + case WBEntry::Type::LAMP: + case WBEntry::Type::FLASH: + case WBEntry::Type::LED: */ default: // Set the associated temperature, or 0.0 if in ADD mode - temp->setValue(temp->getAddMode() ? 0.0 : (double)wbValues->temperature); + temp->setValue(temp->getAddMode() ? 0.0 : (double)wbValues.temperature); // Set the stored temperature, or 0.0 if in ADD mode green->setValue(green->getAddMode() ? 0.0 : pp->wb.green); equal->setValue(equal->getAddMode() ? 0.0 : pp->wb.equal); @@ -648,7 +664,7 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) break; } - tempBias->set_sensitive(wbValues->type == WBT_AUTO); + tempBias->set_sensitive(wbValues.type == WBEntry::Type::AUTO); } methconn.block (false); @@ -668,10 +684,10 @@ void WhiteBalance::write (ProcParams* pp, ParamsEdited* pedited) pedited->wb.method = row[methodColumns.colLabel] != M("GENERAL_UNCHANGED"); } - WBEntry* ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI); + const std::pair ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI); - if (ppMethod) { - pp->wb.method = ppMethod->ppLabel; + if (ppMethod.first) { + pp->wb.method = ppMethod.second.ppLabel; } pp->wb.temperature = temp->getIntValue (); @@ -739,10 +755,10 @@ void WhiteBalance::setWB (int vtemp, double vgreen) { methconn.block(true); - WBEntry *wbValues = findWBEntry("Custom", WBLT_PP); + const std::pair wbValues = findWBEntry("Custom", WBLT_PP); temp->setValue (vtemp); green->setValue (vgreen); - opt = setActiveMethod(wbValues->GUILabel); + opt = setActiveMethod(wbValues.second.GUILabel); cache_customWB (vtemp, vgreen); // sequence in which this call is made is important; must be before "method->set_active (2);" cache_customEqual(equal->getValue()); temp->setEditedState (Edited); @@ -792,10 +808,10 @@ void WhiteBalance::cache_customWB(int temp, double green) cache_customGreen (green); } -unsigned int WhiteBalance::findWBEntryId (const Glib::ustring &label, enum WB_LabelType lblType) +unsigned int WhiteBalance::findWBEntryId (const Glib::ustring& label, enum WB_LabelType lblType) { for (unsigned int i = 0; i < WBParams::wbEntries.size(); i++) { - if (label == (lblType == WBLT_GUI ? WBParams::wbEntries[i]->GUILabel : WBParams::wbEntries[i]->ppLabel)) { + if (label == (lblType == WBLT_GUI ? WBParams::wbEntries[i].GUILabel : WBParams::wbEntries[i].ppLabel)) { return i; } } @@ -803,15 +819,15 @@ unsigned int WhiteBalance::findWBEntryId (const Glib::ustring &label, enum WB_La return 0; // default to camera wb } -WBEntry* WhiteBalance::findWBEntry (Glib::ustring label, enum WB_LabelType lblType) +std::pair WhiteBalance::findWBEntry(const Glib::ustring& label, enum WB_LabelType lblType) { - for (unsigned int i = 0; i < WBParams::wbEntries.size(); i++) { - if (label == (lblType == WBLT_GUI ? WBParams::wbEntries[i]->GUILabel : WBParams::wbEntries[i]->ppLabel)) { - return WBParams::wbEntries[i]; + for (unsigned int i = 0; i < WBParams::wbEntries.size(); ++i) { + if (label == (lblType == WBLT_GUI ? WBParams::wbEntries[i].GUILabel : WBParams::wbEntries[i].ppLabel)) { + return {true, WBParams::wbEntries[i]}; } } - return nullptr; + return {false, WBParams::wbEntries[0]}; } int WhiteBalance::_setActiveMethod(Glib::ustring &label, Gtk::TreeModel::Children &children) diff --git a/rtgui/whitebalance.h b/rtgui/whitebalance.h index 7366e55b5..d1fafcea3 100644 --- a/rtgui/whitebalance.h +++ b/rtgui/whitebalance.h @@ -57,7 +57,7 @@ protected: } }; - static Glib::RefPtr wbPixbufs[rtengine::procparams::WBT_CUSTOM + 1]; + static Glib::RefPtr wbPixbufs[rtengine::toUnderlying(rtengine::procparams::WBEntry::Type::CUSTOM) + 1]; Glib::RefPtr refTreeModel; MethodColumns methodColumns; MyComboBox* method; @@ -85,9 +85,9 @@ protected: int setActiveMethod (Glib::ustring label); int _setActiveMethod (Glib::ustring &label, Gtk::TreeModel::Children &children); - Gtk::TreeModel::Row getActiveMethod (); - unsigned int findWBEntryId (const Glib::ustring &label, enum WB_LabelType lblType = WBLT_GUI); - rtengine::procparams::WBEntry* findWBEntry (Glib::ustring label, enum WB_LabelType lblType = WBLT_GUI); + Gtk::TreeModel::Row getActiveMethod(); + unsigned int findWBEntryId (const Glib::ustring& label, enum WB_LabelType lblType = WBLT_GUI); + std::pair findWBEntry (const Glib::ustring& label, enum WB_LabelType lblType = WBLT_GUI); public: From e0f7c1358b3964f4ff406392dafd0af3225485a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Fri, 17 Nov 2017 17:05:46 +0100 Subject: [PATCH 05/47] `procparams.h` cleanup - Part 2 TODO: - Add c'tors and find all defaults - Remove `setDefaults()` in favour of c'tors - Add `operator ==()` to `struct`s --- rtengine/amaze_demosaic_RT.cc | 2 +- rtengine/curves.cc | 4 +- rtengine/curves.h | 2 +- rtengine/demosaic_algos.cc | 20 +- rtengine/fast_demo.cc | 2 +- rtengine/improccoordinator.cc | 8 +- rtengine/improcfun.cc | 122 +-- rtengine/pixelshift.cc | 6 +- rtengine/previewimage.cc | 4 +- rtengine/procparams.cc | 1415 +++++++++++++++++---------------- rtengine/procparams.h | 208 +++-- rtengine/rawimagesource.cc | 50 +- rtengine/simpleprocess.cc | 12 +- rtgui/bayerprocess.cc | 59 +- rtgui/blackwhite.cc | 14 +- rtgui/colorappearance.cc | 14 +- rtgui/cropwindow.cc | 2 +- rtgui/exportpanel.cc | 32 +- rtgui/flatfield.cc | 24 +- rtgui/tonecurve.cc | 24 +- rtgui/whitebalance.cc | 26 +- rtgui/xtransprocess.cc | 33 +- 22 files changed, 1069 insertions(+), 1014 deletions(-) diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc index 3cb0ee8de..433769b7a 100644 --- a/rtengine/amaze_demosaic_RT.cc +++ b/rtengine/amaze_demosaic_RT.cc @@ -45,7 +45,7 @@ SSEFUNCTION void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, volatile double progress = 0.0; if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::amaze])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE))); plistener->setProgress (0.0); } diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 8ece458e7..6dfa640fc 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -482,8 +482,8 @@ void CurveFactory::complexsgnCurve (bool & autili, bool & butili, bool & ccutil SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, - procparams::ToneCurveParams::Mode curveMode, const std::vector& curvePoints, - procparams::ToneCurveParams::Mode curveMode2, const std::vector& curvePoints2, + procparams::ToneCurveParams::TcMode curveMode, const std::vector& curvePoints, + procparams::ToneCurveParams::TcMode curveMode2, const std::vector& curvePoints2, LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, diff --git a/rtengine/curves.h b/rtengine/curves.h index 413531471..0ae322e82 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -281,7 +281,7 @@ public: public: static void complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, - procparams::ToneCurveParams::Mode curveMode, const std::vector& curvePoints, procparams::ToneCurveParams::Mode curveMode2, const std::vector& curvePoints2, + procparams::ToneCurveParams::TcMode curveMode, const std::vector& curvePoints, procparams::ToneCurveParams::TcMode curveMode2, const std::vector& curvePoints2, LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, int skip = 1); diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 6a5b8eba8..f5fbe5e8f 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -65,7 +65,7 @@ extern const Settings* settings; void RawImageSource::eahd_demosaic () { if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::eahd])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::EAHD))); plistener->setProgress (0.0); } @@ -494,7 +494,7 @@ void RawImageSource::hphd_green (float** hpmap) void RawImageSource::hphd_demosaic () { if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::hphd])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::HPHD))); plistener->setProgress (0.0); } @@ -595,7 +595,7 @@ void RawImageSource::vng4_demosaic () const bool plistenerActive = plistener; if (plistenerActive) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::vng4])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::VNG4))); plistener->setProgress (progress); } @@ -893,7 +893,7 @@ void RawImageSource::ppg_demosaic() if (plistener) { // looks like ppg isn't supported anymore - //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::ppg])); + //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::ppg))); plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), "xxx")); plistener->setProgress (0.0); } @@ -1201,7 +1201,7 @@ void RawImageSource::jdl_interpolate_omp() // from "Lassus" if (plistener) { // this function seems to be unused - //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::jdl])); + //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::jdl))); plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), "xxx")); plistener->setProgress (0.0); } @@ -1397,7 +1397,7 @@ SSEFUNCTION void RawImageSource::lmmse_interpolate_omp(int winw, int winh, array } if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::lmmse])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::LMMSE))); plistener->setProgress (0.0); } @@ -1975,7 +1975,7 @@ SSEFUNCTION void RawImageSource::igv_interpolate(int winw, int winh) border_interpolate2(winw, winh, 7); if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::igv])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::IGV))); plistener->setProgress (0.0); } @@ -2364,7 +2364,7 @@ void RawImageSource::igv_interpolate(int winw, int winh) border_interpolate2(winw, winh, 7); if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::igv])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::IGV))); plistener->setProgress (0.0); } @@ -2639,7 +2639,7 @@ void RawImageSource::ahd_demosaic(int winx, int winy, int winw, int winh) const float d65_white[3] = { 0.950456, 1, 1.088754 }; if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::ahd])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AHD))); plistener->setProgress (0.0); } @@ -3702,7 +3702,7 @@ BENCHFUN double currentProgress = 0.0; if(plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::dcb])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCB))); plistener->setProgress (currentProgress); } diff --git a/rtengine/fast_demo.cc b/rtengine/fast_demo.cc index 12286d9f1..b57bab90e 100644 --- a/rtengine/fast_demo.cc +++ b/rtengine/fast_demo.cc @@ -62,7 +62,7 @@ SSEFUNCTION void RawImageSource::fast_demosaic(int winx, int winy, int winw, int //int winw=W, winh=H; if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST))); plistener->setProgress (progress); } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index dffd9572e..f5687a08a 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -167,14 +167,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if ( !highDetailNeeded ) { // if below 100% magnification, take a fast path - if (rp.bayersensor.method != RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none] && rp.bayersensor.method != RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono]) { - rp.bayersensor.method = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast]; + if (rp.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) && rp.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE)) { + rp.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST); } //bayerrp.all_enhance = false; - if (rp.xtranssensor.method != RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::none] && rp.xtranssensor.method != RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono]) { - rp.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast]; + if (rp.xtranssensor.method != RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) && rp.xtranssensor.method != RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) { + rp.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST); } rp.bayersensor.ccSteps = 0; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index bc5bafca0..7685a4d10 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -440,11 +440,11 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } // extracting datas from 'params' to avoid cache flush (to be confirmed) - ColorAppearanceParams::TCMode curveMode = params->colorappearance.curveMode; - ColorAppearanceParams::TCMode curveMode2 = params->colorappearance.curveMode2; + ColorAppearanceParams::TcMode curveMode = params->colorappearance.curveMode; + ColorAppearanceParams::TcMode curveMode2 = params->colorappearance.curveMode2; bool hasColCurve1 = bool (customColCurve1); bool hasColCurve2 = bool (customColCurve2); - ColorAppearanceParams::CTCMode curveMode3 = params->colorappearance.curveMode3; + ColorAppearanceParams::CtcMode curveMode3 = params->colorappearance.curveMode3; bool hasColCurve3 = bool (customColCurve3); @@ -805,7 +805,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve1) {//curve 1 with Lightness and Brightness - if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { /* float Jj=(float) Jpro*327.68; float Jold=Jj; const Lightcurve& userColCurve = static_cast(customColCurve1); @@ -843,7 +843,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } t1L = true; - } else if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { //attention! Brightness curves are open - unlike Lightness or Lab or RGB==> rendering and algoritms will be different float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qanc = Qpro; @@ -891,7 +891,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve2) {//curve 2 with Lightness and Brightness - if (curveMode2 == ColorAppearanceParams::TCMode::LIGHT) { + if (curveMode2 == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68; float Jold = Jj; /* @@ -934,7 +934,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh Jpro = 1.; } - } else if (curveMode2 == ColorAppearanceParams::TCMode::BRIGHT) { // + } else if (curveMode2 == ColorAppearanceParams::TcMode::BRIGHT) { // float Qanc = Qpro; float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qq = (float) Qpro * 327.68f * (1.f / coef); @@ -992,7 +992,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { double parsat = 0.8; //0.68; double coef = 327.68 / parsat; float Cc = (float) Cpro * coef; @@ -1016,7 +1016,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } // Cpro=Cc/coef; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { // double parsat = 0.8; //0.6 double coef = 327.68 / parsat; float Ss = (float) spro * coef; @@ -1036,7 +1036,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh Cpro = (spro * spro * Qpro) / (10000.0); c1s = 1; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { // double parsat = 0.8; //0.68; double coef = 327.68 / parsat; float Mm = (float) Mpro * coef; @@ -1121,21 +1121,21 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh int libr = 0; int colch = 0; - if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0; libr = 1; - } else if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { brli = 327.; libr = 0; } - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.;//327.; colch = 0; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0; colch = 1; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { chsacol = 400.;//327.0; colch = 2; } @@ -1390,21 +1390,21 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh int libr = 0; int colch = 0; - if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0; libr = 1; - } else if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { brli = 327.; libr = 0; } - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.;//327.; colch = 0; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0; colch = 1; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { chsacol = 400.;//327.0; colch = 2; } @@ -1765,14 +1765,14 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int const float rstprotection = 100. - params->colorappearance.rstprotection; // extracting datas from 'params' to avoid cache flush (to be confirmed) - const ColorAppearanceParams::TCMode curveMode = params->colorappearance.curveMode; + const ColorAppearanceParams::TcMode curveMode = params->colorappearance.curveMode; const bool hasColCurve1 = bool (customColCurve1); - const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TCMode::LIGHT; + const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TcMode::LIGHT; - const ColorAppearanceParams::TCMode curveMode2 = params->colorappearance.curveMode2; + const ColorAppearanceParams::TcMode curveMode2 = params->colorappearance.curveMode2; const bool hasColCurve2 = bool (customColCurve2); - const ColorAppearanceParams::CTCMode curveMode3 = params->colorappearance.curveMode3; + const ColorAppearanceParams::CtcMode curveMode3 = params->colorappearance.curveMode3; const bool hasColCurve3 = bool (customColCurve3); bool needJ = (alg == 0 || alg == 1 || alg == 3); @@ -2226,7 +2226,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve1) {//curve 1 with Lightness and Brightness - if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68f; float Jold = Jj; float Jold100 = (float) Jpro; @@ -2255,7 +2255,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int if (Jpro < 1.f) { Jpro = 1.f; } - } else if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { //attention! Brightness curves are open - unlike Lightness or Lab or RGB==> rendering and algoritms will be different float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qanc = Qpro; @@ -2299,7 +2299,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve2) {//curve 2 with Lightness and Brightness - if (curveMode2 == ColorAppearanceParams::TCMode::LIGHT) { + if (curveMode2 == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68f; float Jold = Jj; float Jold100 = (float) Jpro; @@ -2337,7 +2337,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Jpro = 1.f; } - } else if (curveMode2 == ColorAppearanceParams::TCMode::BRIGHT) { // + } else if (curveMode2 == ColorAppearanceParams::TcMode::BRIGHT) { // float Qanc = Qpro; float coef = ((aw + 4.f) * (4.f / c)) / 100.f; @@ -2394,7 +2394,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Cc = (float) Cpro * coef; @@ -2417,7 +2417,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Cpro = 50.f; } */ - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { // float parsat = 0.8f; //0.6 float coef = 327.68f / parsat; float Ss = (float) spro * coef; @@ -2434,7 +2434,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Color::skinredfloat (Jpro, hpro, Ss, Sold, dred, protect_red, sk, rstprotection, ko, spro); Qpro = ( 4.0f / c ) * sqrtf ( Jpro / 100.0f ) * ( aw + 4.0f ) ; Cpro = (spro * spro * Qpro) / (10000.0f); - } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { // float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Mm = (float) Mpro * coef; @@ -2504,7 +2504,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int float colch; //update histogram - if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0f; libr = Q; //40.0 to 100.0 approximative factor for Q - 327 for J } else { /*if(curveMode == ColorAppearanceParams::TCMode::LIGHT)*/ @@ -2515,10 +2515,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int posl = (int) (libr * brli); hist16JCAM[posl]++; - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.f;//327 colch = C; //450.0 approximative factor for s 320 for M - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0f; colch = s; } else { /*if(curveMode3 == ColorAppearanceParams::CTCMode::COLORF)*/ @@ -2857,7 +2857,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int float libr; float colch; - if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0f; libr = ncie->Q_p[i][j]; //40.0 to 100.0 approximative factor for Q - 327 for J } else { /*if(curveMode == ColorAppearanceParams::TCMode::LIGHT)*/ @@ -2868,10 +2868,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int posl = (int) (libr * brli); hist16JCAM[posl]++; - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.f;//327.f; colch = ncie_C_p; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0f; colch = 100.f * sqrtf (ncie_C_p / ncie->Q_p[i][j]); } else { /*if(curveMode3 == ColorAppearanceParams::CTCMode::COLORF)*/ @@ -3270,25 +3270,25 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer const float hlrange = 65536.0 - shoulder; const bool isProPhoto = (params->icm.working == "ProPhoto"); // extracting datas from 'params' to avoid cache flush (to be confirmed) - ToneCurveParams::Mode curveMode = params->toneCurve.curveMode; - ToneCurveParams::Mode curveMode2 = params->toneCurve.curveMode2; + ToneCurveParams::TcMode curveMode = params->toneCurve.curveMode; + ToneCurveParams::TcMode curveMode2 = params->toneCurve.curveMode2; bool highlight = params->toneCurve.hrenabled;//Get the value if "highlight reconstruction" is activated bool hasToneCurve1 = bool (customToneCurve1); bool hasToneCurve2 = bool (customToneCurve2); - BlackWhiteParams::eTCModeId beforeCurveMode = params->blackwhite.beforeCurveMode; - BlackWhiteParams::eTCModeId afterCurveMode = params->blackwhite.afterCurveMode; + BlackWhiteParams::TcMode beforeCurveMode = params->blackwhite.beforeCurveMode; + BlackWhiteParams::TcMode afterCurveMode = params->blackwhite.afterCurveMode; bool hasToneCurvebw1 = bool (customToneCurvebw1); bool hasToneCurvebw2 = bool (customToneCurvebw2); PerceptualToneCurveState ptc1ApplyState, ptc2ApplyState; - if (hasToneCurve1 && curveMode == ToneCurveParams::Mode::PERCEPTUAL) { + if (hasToneCurve1 && curveMode == ToneCurveParams::TcMode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.initApplyState (ptc1ApplyState, params->icm.working); } - if (hasToneCurve2 && curveMode2 == ToneCurveParams::Mode::PERCEPTUAL) { + if (hasToneCurve2 && curveMode2 == ToneCurveParams::TcMode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.initApplyState (ptc2ApplyState, params->icm.working); } @@ -3641,21 +3641,21 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (hasToneCurve1) { - if (curveMode == ToneCurveParams::Mode::STD) { // Standard + if (curveMode == ToneCurveParams::TcMode::STD) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const StandardToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::FILMLIKE) { // Adobe like + } else if (curveMode == ToneCurveParams::TcMode::FILMLIKE) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const AdobeToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels + } else if (curveMode == ToneCurveParams::TcMode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const SatAndValueBlendingToneCurve& userToneCurve = static_cast (customToneCurve1); @@ -3665,7 +3665,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted + } else if (curveMode == ToneCurveParams::TcMode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3676,7 +3676,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::LUMINANCE) { // apply the curve to the luminance channel + } else if (curveMode == ToneCurveParams::TcMode::LUMINANCE) { // apply the curve to the luminance channel const LuminanceToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3687,7 +3687,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::PERCEPTUAL) { // apply curve while keeping color appearance constant + } else if (curveMode == ToneCurveParams::TcMode::PERCEPTUAL) { // apply curve while keeping color appearance constant const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3712,28 +3712,28 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (hasToneCurve2) { - if (curveMode2 == ToneCurveParams::Mode::STD) { // Standard + if (curveMode2 == ToneCurveParams::TcMode::STD) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const StandardToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::FILMLIKE) { // Adobe like + } else if (curveMode2 == ToneCurveParams::TcMode::FILMLIKE) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const AdobeToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels + } else if (curveMode2 == ToneCurveParams::TcMode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const SatAndValueBlendingToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted + } else if (curveMode2 == ToneCurveParams::TcMode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3741,7 +3741,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::LUMINANCE) { // apply the curve to the luminance channel + } else if (curveMode2 == ToneCurveParams::TcMode::LUMINANCE) { // apply the curve to the luminance channel const LuminanceToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3749,7 +3749,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::PERCEPTUAL) { // apply curve while keeping color appearance constant + } else if (curveMode2 == ToneCurveParams::TcMode::PERCEPTUAL) { // apply curve while keeping color appearance constant const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -4212,21 +4212,21 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer //black and white if (blackwhite) { if (hasToneCurvebw1) { - if (beforeCurveMode == BlackWhiteParams::TC_MODE_STD_BW) { // Standard + if (beforeCurveMode == BlackWhiteParams::TcMode::STD_BW) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const StandardToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); userToneCurvebw.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_FILMLIKE_BW) { // Adobe like + } else if (beforeCurveMode == BlackWhiteParams::TcMode::FILMLIKE_BW) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const AdobeToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); userToneCurvebw.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW) { // apply the curve on the saturation and value channels + } else if (beforeCurveMode == BlackWhiteParams::TcMode::SATANDVALBLENDING_BW) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const SatAndValueBlendingToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); @@ -4236,7 +4236,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurvebw.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted + } else if (beforeCurveMode == BlackWhiteParams::TcMode::WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const WeightedStdToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); @@ -4672,7 +4672,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer if (hasToneCurvebw2) { - if (afterCurveMode == BlackWhiteParams::TC_MODE_STD_BW) { // Standard + if (afterCurveMode == BlackWhiteParams::TcMode::STD_BW) { // Standard #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 5) #endif @@ -4683,7 +4683,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (tmpImage->r (i, j), tmpImage->g (i, j), tmpImage->b (i, j)); } } - } else if (afterCurveMode == BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted + } else if (afterCurveMode == BlackWhiteParams::TcMode::WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 5) #endif diff --git a/rtengine/pixelshift.cc b/rtengine/pixelshift.cc index 5a7e88f1c..256aaaf63 100644 --- a/rtengine/pixelshift.cc +++ b/rtengine/pixelshift.cc @@ -311,11 +311,11 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA bayerParams.pixelShiftAutomatic = true; - if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Automatic) { + if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::PSMotionCorrectionMethod::AUTO) { bool pixelShiftEqualBright = bayerParams.pixelShiftEqualBright; bayerParams.setPixelShiftDefaults(); bayerParams.pixelShiftEqualBright = pixelShiftEqualBright; - } else if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Off) { + } else if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::PSMotionCorrectionMethod::OFF) { bayerParams.pixelShiftAutomatic = false; bayerParams.pixelShiftShowMotion = false; } @@ -506,7 +506,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA static const float ePerIsoK70 = 0.5f; if(plistener) { - plistener->setProgressStr(Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::pixelshift])); + plistener->setProgressStr(Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT))); plistener->setProgress(0.0); } diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index e6703aed5..536fdb616 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -108,10 +108,10 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext rawImage.getFullSize (fw, fh, TR_NONE); PreviewProps pp (0, 0, fw, fh, 1); params.icm.input = Glib::ustring("(embedded)"); - params.raw.bayersensor.method = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast]; + params.raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST); params.raw.deadPixelFilter = false; params.raw.ca_autocorrect = false; - params.raw.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast]; + params.raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST); rawImage.preprocess(params.raw, params.lensProf, params.coarse); rawImage.demosaic(params.raw); Imagefloat image(fw, fh); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index c064f5366..5494aecdd 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -32,14 +32,62 @@ #include "../rtgui/ppversion.h" #include "../rtgui/version.h" -#define APPVERSION RTVERSION - using namespace std; extern Options options; namespace { +Glib::ustring expandRelativePath (const Glib::ustring &procparams_fname, const Glib::ustring &prefix, Glib::ustring embedded_fname) +{ + if (embedded_fname == "" || !Glib::path_is_absolute (procparams_fname)) { + return embedded_fname; + } + + if (prefix != "") { + if (embedded_fname.length() < prefix.length() || embedded_fname.substr (0, prefix.length()) != prefix) { + return embedded_fname; + } + + embedded_fname = embedded_fname.substr (prefix.length()); + } + + if (Glib::path_is_absolute (embedded_fname)) { + return prefix + embedded_fname; + } + + Glib::ustring absPath = prefix + Glib::path_get_dirname (procparams_fname) + G_DIR_SEPARATOR_S + embedded_fname; + return absPath; +} + +Glib::ustring relativePathIfInside (const Glib::ustring &procparams_fname, bool fnameAbsolute, Glib::ustring embedded_fname) +{ + if (fnameAbsolute || embedded_fname == "" || !Glib::path_is_absolute (procparams_fname)) { + return embedded_fname; + } + + Glib::ustring prefix = ""; + + if (embedded_fname.length() > 5 && embedded_fname.substr (0, 5) == "file:") { + embedded_fname = embedded_fname.substr (5); + prefix = "file:"; + } + + if (!Glib::path_is_absolute (embedded_fname)) { + return prefix + embedded_fname; + } + + Glib::ustring dir1 = Glib::path_get_dirname (procparams_fname) + G_DIR_SEPARATOR_S; + Glib::ustring dir2 = Glib::path_get_dirname (embedded_fname) + G_DIR_SEPARATOR_S; + + if (dir2.substr (0, dir1.length()) != dir1) { + // it's in a different directory, ie not inside + return prefix + embedded_fname; + } + + return prefix + embedded_fname.substr (dir1.length()); +} + void avoidEmptyCurve (std::vector &curve) { if (curve.empty()) { @@ -251,61 +299,81 @@ bool saveToKeyfile( return false; } -// ( *)if \((!pedited \|\| pedited->.*?)\) \{\R *keyFile\.set_integer \("(.*?)", "(.*?)", (.*?)\);\R *\}\R -// \1saveToKeyfile(\2, "\3", "\4", \5, keyFile); +const int tr = options.rtSettings.top_right; +const int br = options.rtSettings.bot_right; +const int tl = options.rtSettings.top_left; +const int bl = options.rtSettings.bot_left; } namespace rtengine { + namespace procparams { -const int tr = (int) options.rtSettings.top_right; -const int br = (int) options.rtSettings.bot_right; -const int tl = (int) options.rtSettings.top_left; -const int bl = (int) options.rtSettings.bot_left; -const char *RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::numMethods] = {"amaze", "igv", "lmmse", "eahd", "hphd", "vng4", "dcb", "ahd", "fast", "mono", "none", "pixelshift" }; -const char *RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::numMethods] = {"3-pass (best)", "1-pass (medium)", "fast", "mono", "none" }; +bool operator ==(const rtengine::procparams::WaveletParams& a, const rtengine::procparams::WaveletParams& b) +{ + if (a.enabled != b.enabled) { + return false; + } -const char *RAWParams::ff_BlurTypestring[RAWParams::numFlatFileBlurTypes] = {/*"Parametric",*/ "Area Flatfield", "Vertical Flatfield", "Horizontal Flatfield", "V+H Flatfield"}; + for (int i = 0; i < 9; i++) { + if (a.c[i] != b.c[i]) { + return false; + } + } -const std::vector WBParams::wbEntries = { - {"Camera", WBEntry::Type::CAMERA, M ("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f}, - {"Auto", WBEntry::Type::AUTO, M ("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f}, - {"Daylight", WBEntry::Type::DAYLIGHT, M ("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f}, - {"Cloudy", WBEntry::Type::CLOUDY, M ("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f}, - {"Shade", WBEntry::Type::SHADE, M ("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f}, - {"Water 1", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER1"), 35000, 0.3f, 1.1f, 0.f}, - {"Water 2", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER2"), 48000, 0.63f, 1.38f, 0.f}, - {"Tungsten", WBEntry::Type::TUNGSTEN, M ("TP_WBALANCE_TUNGSTEN"), 2856, 1.f, 1.f, 0.f}, - {"Fluo F1", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO1"), 6430, 1.f, 1.f, 0.f}, - {"Fluo F2", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO2"), 4230, 1.f, 1.f, 0.f}, - {"Fluo F3", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO3"), 3450, 1.f, 1.f, 0.f}, - {"Fluo F4", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO4"), 2940, 1.f, 1.f, 0.f}, - {"Fluo F5", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO5"), 6350, 1.f, 1.f, 0.f}, - {"Fluo F6", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO6"), 4150, 1.f, 1.f, 0.f}, - {"Fluo F7", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO7"), 6500, 1.f, 1.f, 0.f}, - {"Fluo F8", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO8"), 5020, 1.f, 1.f, 0.f}, - {"Fluo F9", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO9"), 4330, 1.f, 1.f, 0.f}, - {"Fluo F10", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO10"), 5300, 1.f, 1.f, 0.f}, - {"Fluo F11", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO11"), 4000, 1.f, 1.f, 0.f}, - {"Fluo F12", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO12"), 3000, 1.f, 1.f, 0.f}, - {"HMI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_HMI"), 4800, 1.f, 1.f, 0.f}, - {"GTI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_GTI"), 5000, 1.f, 1.f, 0.f}, - {"JudgeIII Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_JUDGEIII"), 5100, 1.f, 1.f, 0.f}, - {"Solux Lamp 3500K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX35"), 3480, 1.f, 1.f, 0.f}, - {"Solux Lamp 4100K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX41"), 3930, 1.f, 1.f, 0.f}, - {"Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47"), 4700, 1.f, 1.f, 0.f}, - {"NG Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47_NG"), 4480, 1.f, 1.f, 0.f}, - {"LED LSI Lumelex 2040", WBEntry::Type::LED, M ("TP_WBALANCE_LED_LSI"), 2970, 1.f, 1.f, 0.f}, - {"LED CRS SP12 WWMR16", WBEntry::Type::LED, M ("TP_WBALANCE_LED_CRS"), 3050, 1.f, 1.f, 0.f}, - {"Flash 5500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH55"), 5500, 1.f, 1.f, 0.f}, - {"Flash 6000K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH60"), 6000, 1.f, 1.f, 0.f}, - {"Flash 6500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH65"), 6500, 1.f, 1.f, 0.f}, - // Should remain the last one - {"Custom", WBEntry::Type::CUSTOM, M ("TP_WBALANCE_CUSTOM"), 0, 1.f, 1.f, 0.f} -}; + for (int i = 0; i < 9; i++) { + if (a.ch[i] != b.ch[i]) { + return false; + } + } + + return true; +} + +bool operator ==(const rtengine::procparams::DirPyrEqualizerParams& a, const rtengine::procparams::DirPyrEqualizerParams& b) +{ + if (a.enabled != b.enabled) { + return false; + } + + for (int i = 0; i < 6; i++) { + if (a.mult[i] != b.mult[i]) { + return false; + } + } + + return a.threshold == b.threshold; +} + +ToneCurveParams::ToneCurveParams() +{ + setDefaults(); +} + +void ToneCurveParams::setDefaults() +{ + autoexp = false; + clip = 0.02; + expcomp = 0; + brightness = 0; + contrast = 0; + saturation = 0; + black = 0; + hlcompr = 0; + hlcomprthresh = 33; + shcompr = 50; + curve.clear (); + curve.push_back (DCT_Linear); + curve2.clear (); + curve2.push_back (DCT_Linear); + curveMode = ToneCurveParams::TcMode::STD; + curveMode2 = ToneCurveParams::TcMode::STD; + hrenabled = false; + method = "Blend"; +} bool ToneCurveParams::HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw) { @@ -316,68 +384,11 @@ bool ToneCurveParams::HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGre return histRedRaw[255] > 50 || histGreenRaw[255] > 50 || histBlueRaw[255] > 50 || histRedRaw[0] > 50 || histGreenRaw[0] > 50 || histBlueRaw[0] > 50; } -CropParams::CropParams() : - enabled(false), - x(0), - y(0), - w(0), - h(0), - fixratio(false) -{ -} - -// Maps crop to resized width (e.g. smaller previews) -void CropParams::mapToResized (int resizedWidth, int resizedHeight, int scale, int &x1, int &x2, int &y1, int &y2) const -{ - x1 = 0, x2 = resizedWidth, y1 = 0, y2 = resizedHeight; - - if (enabled) { - x1 = min (resizedWidth - 1, max (0, x / scale)); - y1 = min (resizedHeight - 1, max (0, y / scale)); - x2 = min (resizedWidth, max (0, (x + w) / scale)); - y2 = min (resizedHeight, max (0, (y + h) / scale)); - } -} - RetinexParams::RetinexParams () { setDefaults (); } -void RetinexParams::getDefaulttransmissionCurve (std::vector &curve) -{ - double v[12] = { 0.00, 0.50, 0.35, 0.35, - 0.60, 0.75, 0.35, 0.35, - 1.00, 0.50, 0.35, 0.35, - }; - - - curve.resize (13); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - -void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) -{ - double v[16] = { 0.00, 0.1, 0.35, 0.00, - 0.25, 0.25, 0.35, 0.35, - 0.70, 0.25, 0.35, 0.35, - 1.00, 0.1, 0.00, 0.00 - }; - - - curve.resize (17); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - - void RetinexParams::setDefaults() { enabled = false; @@ -427,33 +438,15 @@ void RetinexParams::getCurves (RetinextransmissionCurve &transmissionCurveLUT, R } -ColorToningParams::ColorToningParams () : hlColSat (60, 80, false), shadowsColSat (80, 208, false) +void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) { - setDefaults(); -} - -void ColorToningParams::getDefaultColorCurve (std::vector &curve) -{ - double v[8] = { 0.050, 0.62, 0.25, 0.25, - 0.585, 0.11, 0.25, 0.25 - }; - - curve.resize (9); - curve.at (0) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - - -void ColorToningParams::getDefaultOpacityCurve (std::vector &curve) -{ - double v[16] = { 0.00, 0.3, 0.35, 0.00, - 0.25, 0.8, 0.35, 0.35, - 0.70, 0.8, 0.35, 0.35, - 1.00, 0.3, 0.00, 0.00 + double v[16] = { 0.00, 0.1, 0.35, 0.00, + 0.25, 0.25, 0.35, 0.35, + 0.70, 0.25, 0.35, 0.35, + 1.00, 0.1, 0.00, 0.00 }; + + curve.resize (17); curve.at (0 ) = double (FCT_MinMaxCPoints); @@ -462,34 +455,27 @@ void ColorToningParams::getDefaultOpacityCurve (std::vector &curve) } } -void ColorToningParams::getDefaultCLCurve (std::vector &curve) -{ - double v[6] = { 0.00, 0.00, - 0.35, 0.65, - 1.00, 1.00 - }; - curve.resize (7); - curve.at (0) = double (DCT_NURBS); +void RetinexParams::getDefaulttransmissionCurve (std::vector &curve) +{ + double v[12] = { 0.00, 0.50, 0.35, 0.35, + 0.60, 0.75, 0.35, 0.35, + 1.00, 0.50, 0.35, 0.35, + }; + + + curve.resize (13); + curve.at (0 ) = double (FCT_MinMaxCPoints); for (size_t i = 1; i < curve.size(); ++i) { curve.at (i) = v[i - 1]; } } -void ColorToningParams::getDefaultCL2Curve (std::vector &curve) +// Maps crop to resized width (e.g. smaller previews) +ColorToningParams::ColorToningParams () : hlColSat (60, 80, false), shadowsColSat (80, 208, false) { - double v[6] = { 0.00, 0.00, - 0.35, 0.65, - 1.00, 1.00 - }; - - curve.resize (7); - curve.at (0) = double (DCT_NURBS); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } + setDefaults(); } void ColorToningParams::setDefaults() @@ -808,6 +794,66 @@ void ColorToningParams::getCurves (ColorGradientCurve &colorCurveLUT, OpacityCur } } +void ColorToningParams::getDefaultColorCurve (std::vector &curve) +{ + double v[8] = { 0.050, 0.62, 0.25, 0.25, + 0.585, 0.11, 0.25, 0.25 + }; + + curve.resize (9); + curve.at (0) = double (FCT_MinMaxCPoints); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at (i) = v[i - 1]; + } +} + + +void ColorToningParams::getDefaultOpacityCurve (std::vector &curve) +{ + double v[16] = { 0.00, 0.3, 0.35, 0.00, + 0.25, 0.8, 0.35, 0.35, + 0.70, 0.8, 0.35, 0.35, + 1.00, 0.3, 0.00, 0.00 + }; + curve.resize (17); + curve.at (0 ) = double (FCT_MinMaxCPoints); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at (i) = v[i - 1]; + } +} + +void ColorToningParams::getDefaultCLCurve (std::vector &curve) +{ + double v[6] = { 0.00, 0.00, + 0.35, 0.65, + 1.00, 1.00 + }; + + curve.resize (7); + curve.at (0) = double (DCT_NURBS); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at (i) = v[i - 1]; + } +} + +void ColorToningParams::getDefaultCL2Curve (std::vector &curve) +{ + double v[6] = { 0.00, 0.00, + 0.35, 0.65, + 1.00, 1.00 + }; + + curve.resize (7); + curve.at (0) = double (DCT_NURBS); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at (i) = v[i - 1]; + } +} + SharpeningParams::SharpeningParams() : enabled (false), radius (0.5), @@ -822,8 +868,8 @@ SharpeningParams::SharpeningParams() : deconvradius (0.75), deconviter (30), deconvdamping (20) -{}; - +{ +} VibranceParams::VibranceParams() : enabled (false), @@ -833,10 +879,244 @@ VibranceParams::VibranceParams() : protectskins (false), avoidcolorshift (true), pastsattog (true) -{}; +{ +} -//WaveletParams::WaveletParams (): hueskin(-5, 25, 170, 120, false), hueskin2(-260, -250, -130, -140, false), hllev(50, 75, 100, 98, false), bllev(0, 2, 50, 25, false), pastlev(0, 2, 30, 20, false), satlev(30, 45, 130, 100, false), edgcont(0, 20, 100, 75, false){ +const std::vector& WBParams::getWbEntries() +{ + static const std::vector wb_entries = { + {"Camera", WBEntry::Type::CAMERA, M ("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f}, + {"Auto", WBEntry::Type::AUTO, M ("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f}, + {"Daylight", WBEntry::Type::DAYLIGHT, M ("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f}, + {"Cloudy", WBEntry::Type::CLOUDY, M ("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f}, + {"Shade", WBEntry::Type::SHADE, M ("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f}, + {"Water 1", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER1"), 35000, 0.3f, 1.1f, 0.f}, + {"Water 2", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER2"), 48000, 0.63f, 1.38f, 0.f}, + {"Tungsten", WBEntry::Type::TUNGSTEN, M ("TP_WBALANCE_TUNGSTEN"), 2856, 1.f, 1.f, 0.f}, + {"Fluo F1", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO1"), 6430, 1.f, 1.f, 0.f}, + {"Fluo F2", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO2"), 4230, 1.f, 1.f, 0.f}, + {"Fluo F3", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO3"), 3450, 1.f, 1.f, 0.f}, + {"Fluo F4", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO4"), 2940, 1.f, 1.f, 0.f}, + {"Fluo F5", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO5"), 6350, 1.f, 1.f, 0.f}, + {"Fluo F6", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO6"), 4150, 1.f, 1.f, 0.f}, + {"Fluo F7", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO7"), 6500, 1.f, 1.f, 0.f}, + {"Fluo F8", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO8"), 5020, 1.f, 1.f, 0.f}, + {"Fluo F9", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO9"), 4330, 1.f, 1.f, 0.f}, + {"Fluo F10", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO10"), 5300, 1.f, 1.f, 0.f}, + {"Fluo F11", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO11"), 4000, 1.f, 1.f, 0.f}, + {"Fluo F12", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO12"), 3000, 1.f, 1.f, 0.f}, + {"HMI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_HMI"), 4800, 1.f, 1.f, 0.f}, + {"GTI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_GTI"), 5000, 1.f, 1.f, 0.f}, + {"JudgeIII Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_JUDGEIII"), 5100, 1.f, 1.f, 0.f}, + {"Solux Lamp 3500K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX35"), 3480, 1.f, 1.f, 0.f}, + {"Solux Lamp 4100K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX41"), 3930, 1.f, 1.f, 0.f}, + {"Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47"), 4700, 1.f, 1.f, 0.f}, + {"NG Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47_NG"), 4480, 1.f, 1.f, 0.f}, + {"LED LSI Lumelex 2040", WBEntry::Type::LED, M ("TP_WBALANCE_LED_LSI"), 2970, 1.f, 1.f, 0.f}, + {"LED CRS SP12 WWMR16", WBEntry::Type::LED, M ("TP_WBALANCE_LED_CRS"), 3050, 1.f, 1.f, 0.f}, + {"Flash 5500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH55"), 5500, 1.f, 1.f, 0.f}, + {"Flash 6000K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH60"), 6000, 1.f, 1.f, 0.f}, + {"Flash 6500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH65"), 6500, 1.f, 1.f, 0.f}, + // Should remain the last one + {"Custom", WBEntry::Type::CUSTOM, M ("TP_WBALANCE_CUSTOM"), 0, 1.f, 1.f, 0.f} + }; + + return wb_entries; +} + +DirPyrDenoiseParams::DirPyrDenoiseParams () +{ + setDefaults (); +} + +void DirPyrDenoiseParams::setDefaults() +{ + + lcurve = { + static_cast(FCT_MinMaxCPoints), + 0.05, + 0.15, + 0.35, + 0.35, + 0.55, + 0.04, + 0.35, + 0.35 + }; + + cccurve = { + static_cast(FCT_MinMaxCPoints), + 0.05, + 0.50, + 0.35, + 0.35, + 0.35, + 0.05, + 0.35, + 0.35 + }; + + enabled = false; + enhance = false; + median = false; + perform = false; + luma = 0; + passes = 1; + dmethod = "Lab"; + Lmethod = "SLI";//"CUR";// SLIDER method with value 0 is set as default, while the default Lcurve is populated via getDefaultNoisCurve and can be switched to by the user + Cmethod = "MAN"; + C2method = "AUTO"; + smethod = "shal"; + medmethod = "soft"; + methodmed = "none"; + rgbmethod = "soft"; + Ldetail = 0; + chroma = 15; + redchro = 0; + bluechro = 0; + gamma = 1.7; + perform = false; +} + +void DirPyrDenoiseParams::getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) const +{ + lCurve.Set (this->lcurve); + cCurve.Set (this->cccurve); +} + +FattalToneMappingParams::FattalToneMappingParams() +{ + setDefaults(); +} + +void FattalToneMappingParams::setDefaults() +{ + enabled = false; + threshold = 0; + amount = 0; +} + +CropParams::CropParams() : + enabled(false), + x(0), + y(0), + w(0), + h(0), + fixratio(false) +{ +} + +void CropParams::mapToResized (int resizedWidth, int resizedHeight, int scale, int &x1, int &x2, int &y1, int &y2) const +{ + x1 = 0, x2 = resizedWidth, y1 = 0, y2 = resizedHeight; + + if (enabled) { + x1 = min (resizedWidth - 1, max (0, x / scale)); + y1 = min (resizedHeight - 1, max (0, y / scale)); + x2 = min (resizedWidth, max (0, (x + w) / scale)); + y2 = min (resizedHeight, max (0, (y + h) / scale)); + } +} + +CoarseTransformParams::CoarseTransformParams() +{ + setDefaults(); +} + +void CoarseTransformParams::setDefaults() +{ + rotate = 0; + hflip = false; + vflip = false; +} + +LensProfParams::LensProfParams() +{ + setDefaults(); +} + +void LensProfParams::setDefaults() +{ + lcMode = LcMode::NONE; + lcpFile = ""; + useDist = useVign = true; + useCA = false; + lfCameraMake = ""; + lfCameraModel = ""; + lfLens = ""; +} + +bool LensProfParams::useLensfun() const +{ + return lcMode == LcMode::LENSFUNAUTOMATCH || lcMode == LcMode::LENSFUNMANUAL; +} + +bool LensProfParams::lfAutoMatch() const +{ + return lcMode == LcMode::LENSFUNAUTOMATCH; +} + +bool LensProfParams::useLcp() const +{ + return lcMode == LcMode::LCP && lcpFile.length() > 0; +} + +bool LensProfParams::lfManual() const +{ + return lcMode == LcMode::LENSFUNMANUAL; +} + +const std::vector& LensProfParams::getMethodStrings() const +{ + static const std::vector method_strings = { + "none", + "lfauto", + "lfmanual", + "lcp" + }; + return method_strings; +} + +Glib::ustring LensProfParams::getMethodString(LcMode mode) const +{ + return getMethodStrings()[toUnderlying(mode)]; +} + +LensProfParams::LcMode LensProfParams::getMethodNumber(const Glib::ustring& mode) const +{ + for (std::vector::size_type i = 0; i < getMethodStrings().size(); ++i) { + if (getMethodStrings()[i] == mode) { + return static_cast(i); + } + } + return LcMode::NONE; +} + +const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring ("No ICM: sRGB output"); + +ColorManagementParams::ColorManagementParams() +{ + setDefaults(); +} + +void ColorManagementParams::setDefaults() +{ + input = "(cameraICC)"; + toneCurve = false; + applyLookTable = false; + applyBaselineExposureOffset = true; + applyHueSatMap = true; + dcpIlluminant = 0; + working = "ProPhoto"; + output = "RT_sRGB"; + outputIntent = RI_RELATIVE; + outputBPC = true; + gamma = "default"; + gampos = 2.22; + slpos = 4.5; + freegamma = false; +} WaveletParams::WaveletParams() : hueskin ( -5, 25, 170, 120, false), @@ -855,94 +1135,6 @@ WaveletParams::WaveletParams() : setDefaults (); } -void WaveletParams::getDefaultOpacityCurveRG (std::vector &curve) -{ - double v[8] = { 0.0, 0.50, 0.35, 0.35, - 1.00, 0.50, 0.35, 0.35 - }; - - curve.resize (9); - curve.at (0) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} -void WaveletParams::getDefaultOpacityCurveBY (std::vector &curve) -{ - double v[8] = { 0.0, 0.50, 0.35, 0.35, - 1.00, 0.50, 0.35, 0.35 - }; - - curve.resize (9); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - - -void WaveletParams::getDefaultOpacityCurveW (std::vector &curve) -{ - double v[16] = { 0.00, 0.35, 0.35, 0.00, - 0.35, 0.75, 0.35, 0.35, - 0.60, 0.75, 0.35, 0.35, - 1.00, 0.35, 0.00, 0.00 - }; - curve.resize (17); - curve.at (0) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - -void WaveletParams::getDefaultOpacityCurveWL (std::vector &curve) -{ - double v[8] = { 0.0, 0.50, 0.35, 0.35, - 1.00, 0.50, 0.35, 0.35 - }; - - /*double v[12]={ 0.00, 0.53, 0.35, 0.00, - 0.42, 0.53, 0.35, 0.35, - 1.00, 0.15, 0.00, 0.00 }; - */ - curve.resize (9); - curve.at (0) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - - -void WaveletParams::getDefaultCCWCurve (std::vector &curve) -{ - double v[12] = { 0.0, 0.25, 0.35, 0.35, - 0.50, 0.75, 0.35, 0.35, - 0.90, 0.0, 0.35, 0.35 - }; - - curve.resize (13); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } - -} - -void WaveletParams::getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG, WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const -{ - cCurve.Set (this->ccwcurve); - opacityCurveLUTRG.Set (this->opacityCurveRG); - opacityCurveLUTBY.Set (this->opacityCurveBY); - opacityCurveLUTW.Set (this->opacityCurveW); - opacityCurveLUTWL.Set (this->opacityCurveWL); - -} - void WaveletParams::setDefaults() { getDefaultCCWCurve (ccwcurve); @@ -1039,185 +1231,128 @@ void WaveletParams::setDefaults() } - -DirPyrDenoiseParams::DirPyrDenoiseParams () +void WaveletParams::getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG, WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const { - setDefaults (); + cCurve.Set (this->ccwcurve); + opacityCurveLUTRG.Set (this->opacityCurveRG); + opacityCurveLUTBY.Set (this->opacityCurveBY); + opacityCurveLUTW.Set (this->opacityCurveW); + opacityCurveLUTWL.Set (this->opacityCurveWL); + } -void DirPyrDenoiseParams::setDefaults() +void WaveletParams::getDefaultCCWCurve (std::vector &curve) { - - lcurve = { + curve = { static_cast(FCT_MinMaxCPoints), - 0.05, - 0.15, + 0.0, + 0.25, 0.35, 0.35, - 0.55, - 0.04, + 0.50, + 0.75, + 0.35, + 0.35, + 0.90, + 0.0, 0.35, 0.35 }; - cccurve = { +} + +void WaveletParams::getDefaultOpacityCurveRG (std::vector &curve) +{ + curve = { static_cast(FCT_MinMaxCPoints), - 0.05, + 0.0, 0.50, 0.35, 0.35, - 0.35, - 0.05, + 1.00, + 0.50, 0.35, 0.35 }; - - enabled = false; - enhance = false; - median = false; - perform = false; - luma = 0; - passes = 1; - dmethod = "Lab"; - Lmethod = "SLI";//"CUR";// SLIDER method with value 0 is set as default, while the default Lcurve is populated via getDefaultNoisCurve and can be switched to by the user - Cmethod = "MAN"; - C2method = "AUTO"; - smethod = "shal"; - medmethod = "soft"; - methodmed = "none"; - rgbmethod = "soft"; - Ldetail = 0; - chroma = 15; - redchro = 0; - bluechro = 0; - gamma = 1.7; - perform = false; } -void DirPyrDenoiseParams::getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) const +void WaveletParams::getDefaultOpacityCurveBY (std::vector &curve) { - lCurve.Set (this->lcurve); - cCurve.Set (this->cccurve); -} - -FattalToneMappingParams::FattalToneMappingParams() -{ - setDefaults(); -} - -void FattalToneMappingParams::setDefaults() -{ - enabled = false; - threshold = 0; - amount = 0; -} - -ToneCurveParams::ToneCurveParams() -{ - setDefaults(); -} - -void ToneCurveParams::setDefaults() -{ - autoexp = false; - clip = 0.02; - expcomp = 0; - brightness = 0; - contrast = 0; - saturation = 0; - black = 0; - hlcompr = 0; - hlcomprthresh = 33; - shcompr = 50; - curve.clear (); - curve.push_back (DCT_Linear); - curve2.clear (); - curve2.push_back (DCT_Linear); - curveMode = ToneCurveParams::Mode::STD; - curveMode2 = ToneCurveParams::Mode::STD; - hrenabled = false; - method = "Blend"; -} - -LensProfParams::LensProfParams() -{ - setDefaults(); -} - -void LensProfParams::setDefaults() -{ - lcMode = LcMode::NONE; - lcpFile = ""; - useDist = useVign = true; - useCA = false; - lfCameraMake = ""; - lfCameraModel = ""; - lfLens = ""; -} - -bool LensProfParams::useLensfun() const -{ - return lcMode == LcMode::LENSFUNAUTOMATCH || lcMode == LcMode::LENSFUNMANUAL; -} - -bool LensProfParams::lfAutoMatch() const -{ - return lcMode == LcMode::LENSFUNAUTOMATCH; -} - -bool LensProfParams::useLcp() const -{ - return lcMode == LcMode::LCP && lcpFile.length() > 0; -} - -bool LensProfParams::lfManual() const -{ - return lcMode == LcMode::LENSFUNMANUAL; -} - -const std::vector& LensProfParams::getMethodStrings() const -{ - static const std::vector method_strings = { - "none", - "lfauto", - "lfmanual", - "lcp" + curve = { + static_cast(FCT_MinMaxCPoints), + 0.0, + 0.50, + 0.35, + 0.35, + 1.00, + 0.50, + 0.35, + 0.35 }; - return method_strings; } -Glib::ustring LensProfParams::getMethodString(LcMode mode) const + +void WaveletParams::getDefaultOpacityCurveW (std::vector &curve) { - return getMethodStrings()[toUnderlying(mode)]; + curve = { + static_cast(FCT_MinMaxCPoints), + 0.00, + 0.35, + 0.35, + 0.00, + 0.35, + 0.75, + 0.35, + 0.35, + 0.60, + 0.75, + 0.35, + 0.35, + 1.00, + 0.35, + 0.00, + 0.00 + }; } -LensProfParams::LcMode LensProfParams::getMethodNumber(const Glib::ustring& mode) const +void WaveletParams::getDefaultOpacityCurveWL (std::vector &curve) { - for (std::vector::size_type i = 0; i < getMethodStrings().size(); ++i) { - if (getMethodStrings()[i] == mode) { - return static_cast(i); - } - } - return LcMode::NONE; + curve = { + static_cast(FCT_MinMaxCPoints), + 0.0, + 0.50, + 0.35, + 0.35, + 1.00, + 0.50, + 0.35, + 0.35 + }; } -CoarseTransformParams::CoarseTransformParams() + +DirPyrEqualizerParams::DirPyrEqualizerParams() : + hueskin (20, 80, 2000, 1200, false) +{ +} + +FilmSimulationParams::FilmSimulationParams() { setDefaults(); } -void CoarseTransformParams::setDefaults() +void FilmSimulationParams::setDefaults() { - rotate = 0; - hflip = false; - vflip = false; + enabled = false; + clutFilename = Glib::ustring(); + strength = 100; } void RAWParams::BayerSensor::setPixelShiftDefaults() { pixelShiftMotion = 0; - pixelShiftMotionCorrection = RAWParams::BayerSensor::Grid3x3New; - pixelShiftMotionCorrectionMethod = RAWParams::BayerSensor::Automatic; + pixelShiftMotionCorrection = RAWParams::BayerSensor::PSMotionCorrection::GRID_3X3_NEW; + pixelShiftMotionCorrectionMethod = RAWParams::BayerSensor::PSMotionCorrectionMethod::AUTO; pixelShiftStddevFactorGreen = 5.0; pixelShiftStddevFactorRed = 5.0; pixelShiftStddevFactorBlue = 5.0; @@ -1245,9 +1380,55 @@ void RAWParams::BayerSensor::setPixelShiftDefaults() pixelShiftNonGreenAmaze = false; } +const std::vector& RAWParams::BayerSensor::getMethodStrings() +{ + static const std::vector method_strings { + "amaze", + "igv", + "lmmse", + "eahd", + "hphd", + "vng4", + "dcb", + "ahd", + "fast", + "mono", + "none", + "pixelshift" + }; + return method_strings; +} + +Glib::ustring RAWParams::BayerSensor::getMethodString(Method method) +{ + return getMethodStrings()[toUnderlying(method)]; +} + +const std::vector& RAWParams::XTransSensor::getMethodStrings() +{ + static const std::vector method_strings { + "3-pass (best)", + "1-pass (medium)", + "fast", + "mono", + "none" + }; + return method_strings; +} + +Glib::ustring RAWParams::XTransSensor::getMethodString(Method method) +{ + return getMethodStrings()[toUnderlying(method)]; +} + +RAWParams::RAWParams() +{ + setDefaults(); +} + void RAWParams::setDefaults() { - bayersensor.method = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::amaze]; + bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE); bayersensor.imageNum = 0; bayersensor.ccSteps = 0; bayersensor.dcb_iterations = 2; @@ -1262,7 +1443,7 @@ void RAWParams::setDefaults() bayersensor.linenoise = 0; bayersensor.greenthresh = 0; - xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::threePass]; + xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::THREE_PASS); xtranssensor.ccSteps = 0; xtranssensor.blackred = 0.0; xtranssensor.blackgreen = 0.0; @@ -1273,7 +1454,7 @@ void RAWParams::setDefaults() df_autoselect = false; ff_AutoSelect = false; ff_BlurRadius = 32; - ff_BlurType = RAWParams::ff_BlurTypestring[RAWParams::area_ff]; + ff_BlurType = RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::AREA); ff_AutoClipControl = false; ff_clipControl = 0; cared = 0; @@ -1288,22 +1469,20 @@ void RAWParams::setDefaults() } -void ColorManagementParams::setDefaults() +const std::vector& RAWParams::getFlatFieldBlurTypeStrings() { - input = "(cameraICC)"; - toneCurve = false; - applyLookTable = false; - applyBaselineExposureOffset = true; - applyHueSatMap = true; - dcpIlluminant = 0; - working = "ProPhoto"; - output = "RT_sRGB"; - outputIntent = RI_RELATIVE; - outputBPC = true; - gamma = "default"; - gampos = 2.22; - slpos = 4.5; - freegamma = false; + static const std::vector blur_type_strings { + "Area Flatfield", + "Vertical Flatfield", + "Horizontal Flatfield", + "V+H Flatfield" + }; + return blur_type_strings; +} + +Glib::ustring RAWParams::getFlatFieldBlurTypeString(FlatFieldBlurType type) +{ + return getFlatFieldBlurTypeStrings()[toUnderlying(type)]; } ProcParams::ProcParams () @@ -1312,26 +1491,6 @@ ProcParams::ProcParams () setDefaults (); } -void ProcParams::init () -{ -} - -void ProcParams::cleanup () -{ -} - -ProcParams* ProcParams::create () -{ - - return new ProcParams(); -} - -void ProcParams::destroy (ProcParams* pp) -{ - - delete pp; -} - void ProcParams::setDefaults () { @@ -1462,11 +1621,11 @@ void ProcParams::setDefaults () colorappearance.curve.push_back (DCT_Linear); colorappearance.curve2.clear (); colorappearance.curve2.push_back (DCT_Linear); - colorappearance.curveMode = ColorAppearanceParams::TCMode::LIGHT; - colorappearance.curveMode2 = ColorAppearanceParams::TCMode::LIGHT; + colorappearance.curveMode = ColorAppearanceParams::TcMode::LIGHT; + colorappearance.curveMode2 = ColorAppearanceParams::TcMode::LIGHT; colorappearance.curve3.clear (); colorappearance.curve3.push_back (DCT_Linear); - colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::CHROMA; + colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::CHROMA; colorappearance.tempout = 5000; colorappearance.greenout = 1.0; colorappearance.ybout = 18; @@ -1602,10 +1761,10 @@ void ProcParams::setDefaults () blackwhite.setting = "NormalContrast"; blackwhite.beforeCurve.clear (); blackwhite.beforeCurve.push_back (DCT_Linear); - blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_STD_BW; + blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::STD_BW; blackwhite.afterCurve.clear (); blackwhite.afterCurve.push_back (DCT_Linear); - blackwhite.afterCurveMode = BlackWhiteParams::TC_MODE_STD_BW; + blackwhite.afterCurveMode = BlackWhiteParams::TcMode::STD_BW; blackwhite.algo = "SP"; resize.enabled = false; @@ -1653,56 +1812,6 @@ void ProcParams::setDefaults () ppVersion = PPVERSION; } -static Glib::ustring expandRelativePath (const Glib::ustring &procparams_fname, const Glib::ustring &prefix, Glib::ustring embedded_fname) -{ - if (embedded_fname == "" || !Glib::path_is_absolute (procparams_fname)) { - return embedded_fname; - } - - if (prefix != "") { - if (embedded_fname.length() < prefix.length() || embedded_fname.substr (0, prefix.length()) != prefix) { - return embedded_fname; - } - - embedded_fname = embedded_fname.substr (prefix.length()); - } - - if (Glib::path_is_absolute (embedded_fname)) { - return prefix + embedded_fname; - } - - Glib::ustring absPath = prefix + Glib::path_get_dirname (procparams_fname) + G_DIR_SEPARATOR_S + embedded_fname; - return absPath; -} - -static Glib::ustring relativePathIfInside (const Glib::ustring &procparams_fname, bool fnameAbsolute, Glib::ustring embedded_fname) -{ - if (fnameAbsolute || embedded_fname == "" || !Glib::path_is_absolute (procparams_fname)) { - return embedded_fname; - } - - Glib::ustring prefix = ""; - - if (embedded_fname.length() > 5 && embedded_fname.substr (0, 5) == "file:") { - embedded_fname = embedded_fname.substr (5); - prefix = "file:"; - } - - if (!Glib::path_is_absolute (embedded_fname)) { - return prefix + embedded_fname; - } - - Glib::ustring dir1 = Glib::path_get_dirname (procparams_fname) + G_DIR_SEPARATOR_S; - Glib::ustring dir2 = Glib::path_get_dirname (embedded_fname) + G_DIR_SEPARATOR_S; - - if (dir2.substr (0, dir1.length()) != dir1) { - // it's in a different directory, ie not inside - return prefix + embedded_fname; - } - - return prefix + embedded_fname.substr (dir1.length()); -} - int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, bool fnameAbsolute, ParamsEdited* pedited) { if (fname.empty () && fname2.empty ()) { @@ -1715,7 +1824,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::KeyFile keyFile; // Version - keyFile.set_string ("Version", "AppVersion", APPVERSION); + keyFile.set_string ("Version", "AppVersion", RTVERSION); keyFile.set_integer ("Version", "Version", PPVERSION); saveToKeyfile(!pedited || pedited->general.rank, "General", "Rank", rank, keyFile); @@ -1738,13 +1847,13 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->toneCurve.hrenabled, "HLRecovery", "Enabled", toneCurve.hrenabled, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.method, "HLRecovery", "Method", toneCurve.method, keyFile); - const std::map tc_mapping = { - {ToneCurveParams::Mode::STD, "Standard"}, - {ToneCurveParams::Mode::FILMLIKE, "FilmLike"}, - {ToneCurveParams::Mode::SATANDVALBLENDING, "SatAndValueBlending"}, - {ToneCurveParams::Mode::WEIGHTEDSTD,"WeightedStd"}, - {ToneCurveParams::Mode::LUMINANCE, "Luminance"}, - {ToneCurveParams::Mode::PERCEPTUAL, "Perceptual"} + const std::map tc_mapping = { + {ToneCurveParams::TcMode::STD, "Standard"}, + {ToneCurveParams::TcMode::FILMLIKE, "FilmLike"}, + {ToneCurveParams::TcMode::SATANDVALBLENDING, "SatAndValueBlending"}, + {ToneCurveParams::TcMode::WEIGHTEDSTD,"WeightedStd"}, + {ToneCurveParams::TcMode::LUMINANCE, "Luminance"}, + {ToneCurveParams::TcMode::PERCEPTUAL, "Perceptual"} }; saveToKeyfile(!pedited || pedited->toneCurve.curveMode, "Exposure", "CurveMode", tc_mapping, toneCurve.curveMode, keyFile); @@ -1806,11 +1915,11 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b // Black & White saveToKeyfile(!pedited || pedited->blackwhite.enabled, "Black & White", "Enabled", blackwhite.enabled, keyFile); - saveToKeyfile(!pedited || pedited->blackwhite.method, "Black & White", "Method", blackwhite.method , keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.method, "Black & White", "Method", blackwhite.method, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.autoc, "Black & White", "Auto", blackwhite.autoc, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.enabledcc, "Black & White", "ComplementaryColors", blackwhite.enabledcc, keyFile); - saveToKeyfile(!pedited || pedited->blackwhite.setting, "Black & White", "Setting", blackwhite.setting , keyFile); - saveToKeyfile(!pedited || pedited->blackwhite.filter, "Black & White", "Filter", blackwhite.filter , keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.setting, "Black & White", "Setting", blackwhite.setting, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.filter, "Black & White", "Filter", blackwhite.filter, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.mixerRed, "Black & White", "MixerRed", blackwhite.mixerRed, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.mixerOrange, "Black & White", "MixerOrange", blackwhite.mixerOrange, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.mixerYellow, "Black & White", "MixerYellow", blackwhite.mixerYellow, keyFile); @@ -1829,10 +1938,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b "Black & White", "BeforeCurveMode", { - {BlackWhiteParams::TC_MODE_STD_BW, "Standard"}, - {BlackWhiteParams::TC_MODE_FILMLIKE_BW, "FilmLike"}, - {BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW, "SatAndValueBlending"}, - {BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW, "WeightedStd"} + {BlackWhiteParams::TcMode::STD_BW, "Standard"}, + {BlackWhiteParams::TcMode::FILMLIKE_BW, "FilmLike"}, + {BlackWhiteParams::TcMode::SATANDVALBLENDING_BW, "SatAndValueBlending"}, + {BlackWhiteParams::TcMode::WEIGHTEDSTD_BW, "WeightedStd"} }, blackwhite.beforeCurveMode, @@ -1843,8 +1952,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b "Black & White", "AfterCurveMode", { - {BlackWhiteParams::TC_MODE_STD_BW, "Standard"}, - {BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW, "WeightedStd"} + {BlackWhiteParams::TcMode::STD_BW, "Standard"}, + {BlackWhiteParams::TcMode::WEIGHTEDSTD_BW, "WeightedStd"} }, blackwhite.afterCurveMode, @@ -1965,9 +2074,9 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorappearance.tonecie, "Color appearance", "Tonecie", colorappearance.tonecie, keyFile); // if (!pedited || pedited->colorappearance.sharpcie) keyFile.set_boolean ("Color appearance", "Sharpcie", colorappearance.sharpcie); - const std::map ca_mapping = { - {ColorAppearanceParams::TCMode::LIGHT, "Lightness"}, - {ColorAppearanceParams::TCMode::BRIGHT, "Brightness"} + const std::map ca_mapping = { + {ColorAppearanceParams::TcMode::LIGHT, "Lightness"}, + {ColorAppearanceParams::TcMode::BRIGHT, "Brightness"} }; saveToKeyfile(!pedited || pedited->colorappearance.curveMode, "Color appearance", "CurveMode", ca_mapping, colorappearance.curveMode, keyFile); @@ -1977,9 +2086,9 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b "Color appearance", "CurveMode3", { - {ColorAppearanceParams::CTCMode::CHROMA, "Chroma"}, - {ColorAppearanceParams::CTCMode::SATUR, "Saturation"}, - {ColorAppearanceParams::CTCMode::COLORF, "Colorfullness"} + {ColorAppearanceParams::CtcMode::CHROMA, "Chroma"}, + {ColorAppearanceParams::CtcMode::SATUR, "Saturation"}, + {ColorAppearanceParams::CtcMode::COLORF, "Colorfullness"} }, colorappearance.curveMode3, @@ -2214,13 +2323,15 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b std::stringstream ss; ss << "Contrast" << (i + 1); - saveToKeyfile(!pedited || pedited->wavelet.c[i], "Wavelet", ss.str(), wavelet.c[i], keyFile); } + saveToKeyfile(!pedited || pedited->wavelet.c[i], "Wavelet", ss.str(), wavelet.c[i], keyFile); + } for (int i = 0; i < 9; i++) { std::stringstream ss; ss << "Chroma" << (i + 1); - saveToKeyfile(!pedited || pedited->wavelet.ch[i], "Wavelet", ss.str(), wavelet.ch[i], keyFile); } + saveToKeyfile(!pedited || pedited->wavelet.ch[i], "Wavelet", ss.str(), wavelet.ch[i], keyFile); + } saveToKeyfile(!pedited || pedited->wavelet.sup, "Wavelet", "ContExtra", wavelet.sup, keyFile); saveToKeyfile(!pedited || pedited->wavelet.HSmethod, "Wavelet", "HSMethod", wavelet.HSmethod, keyFile); @@ -2342,72 +2453,72 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorToning.cl2curve, "ColorToning", "Cl2Curve", colorToning.cl2curve, keyFile); // Raw - saveToKeyfile(!pedited || pedited->raw.darkFrame, "RAW", "DarkFrame", relativePathIfInside (fname, fnameAbsolute, raw.dark_frame) , keyFile); - saveToKeyfile(!pedited || pedited->raw.df_autoselect, "RAW", "DarkFrameAuto", raw.df_autoselect , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_file, "RAW", "FlatFieldFile", relativePathIfInside (fname, fnameAbsolute, raw.ff_file) , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_AutoSelect, "RAW", "FlatFieldAutoSelect", raw.ff_AutoSelect , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_BlurRadius, "RAW", "FlatFieldBlurRadius", raw.ff_BlurRadius , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_BlurType, "RAW", "FlatFieldBlurType", raw.ff_BlurType , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_AutoClipControl, "RAW", "FlatFieldAutoClipControl", raw.ff_AutoClipControl , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_clipControl, "RAW", "FlatFieldClipControl", raw.ff_clipControl , keyFile); - saveToKeyfile(!pedited || pedited->raw.ca_autocorrect, "RAW", "CA", raw.ca_autocorrect , keyFile); - saveToKeyfile(!pedited || pedited->raw.cared, "RAW", "CARed", raw.cared , keyFile); - saveToKeyfile(!pedited || pedited->raw.cablue, "RAW", "CABlue", raw.cablue , keyFile); - saveToKeyfile(!pedited || pedited->raw.hotPixelFilter, "RAW", "HotPixelFilter", raw.hotPixelFilter , keyFile); - saveToKeyfile(!pedited || pedited->raw.deadPixelFilter, "RAW", "DeadPixelFilter", raw.deadPixelFilter , keyFile); - saveToKeyfile(!pedited || pedited->raw.hotdeadpix_thresh, "RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.method, "RAW Bayer", "Method", raw.bayersensor.method , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.imageNum, "RAW Bayer", "ImageNum", raw.bayersensor.imageNum + 1 , keyFile); + saveToKeyfile(!pedited || pedited->raw.darkFrame, "RAW", "DarkFrame", relativePathIfInside (fname, fnameAbsolute, raw.dark_frame), keyFile); + saveToKeyfile(!pedited || pedited->raw.df_autoselect, "RAW", "DarkFrameAuto", raw.df_autoselect, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_file, "RAW", "FlatFieldFile", relativePathIfInside (fname, fnameAbsolute, raw.ff_file), keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_AutoSelect, "RAW", "FlatFieldAutoSelect", raw.ff_AutoSelect, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_BlurRadius, "RAW", "FlatFieldBlurRadius", raw.ff_BlurRadius, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_BlurType, "RAW", "FlatFieldBlurType", raw.ff_BlurType, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_AutoClipControl, "RAW", "FlatFieldAutoClipControl", raw.ff_AutoClipControl, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_clipControl, "RAW", "FlatFieldClipControl", raw.ff_clipControl, keyFile); + saveToKeyfile(!pedited || pedited->raw.ca_autocorrect, "RAW", "CA", raw.ca_autocorrect, keyFile); + saveToKeyfile(!pedited || pedited->raw.cared, "RAW", "CARed", raw.cared, keyFile); + saveToKeyfile(!pedited || pedited->raw.cablue, "RAW", "CABlue", raw.cablue, keyFile); + saveToKeyfile(!pedited || pedited->raw.hotPixelFilter, "RAW", "HotPixelFilter", raw.hotPixelFilter, keyFile); + saveToKeyfile(!pedited || pedited->raw.deadPixelFilter, "RAW", "DeadPixelFilter", raw.deadPixelFilter, keyFile); + saveToKeyfile(!pedited || pedited->raw.hotdeadpix_thresh, "RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.method, "RAW Bayer", "Method", raw.bayersensor.method, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.imageNum, "RAW Bayer", "ImageNum", raw.bayersensor.imageNum + 1, keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.ccSteps, "RAW Bayer", "CcSteps", raw.bayersensor.ccSteps, keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack0, "RAW Bayer", "PreBlack0", raw.bayersensor.black0 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack1, "RAW Bayer", "PreBlack1", raw.bayersensor.black1 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack2, "RAW Bayer", "PreBlack2", raw.bayersensor.black2 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack3, "RAW Bayer", "PreBlack3", raw.bayersensor.black3 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exTwoGreen, "RAW Bayer", "PreTwoGreen", raw.bayersensor.twogreen , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack0, "RAW Bayer", "PreBlack0", raw.bayersensor.black0, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack1, "RAW Bayer", "PreBlack1", raw.bayersensor.black1, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack2, "RAW Bayer", "PreBlack2", raw.bayersensor.black2, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack3, "RAW Bayer", "PreBlack3", raw.bayersensor.black3, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exTwoGreen, "RAW Bayer", "PreTwoGreen", raw.bayersensor.twogreen, keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.linenoise, "RAW Bayer", "LineDenoise", raw.bayersensor.linenoise, keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.greenEq, "RAW Bayer", "GreenEqThreshold", raw.bayersensor.greenthresh, keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbIterations, "RAW Bayer", "DCBIterations", raw.bayersensor.dcb_iterations , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbEnhance, "RAW Bayer", "DCBEnhance", raw.bayersensor.dcb_enhance , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.lmmseIterations, "RAW Bayer", "LMMSEIterations", raw.bayersensor.lmmse_iterations , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotion, "RAW Bayer", "PixelShiftMotion", raw.bayersensor.pixelShiftMotion , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrection, "RAW Bayer", "PixelShiftMotionCorrection", raw.bayersensor.pixelShiftMotionCorrection , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod, "RAW Bayer", "PixelShiftMotionCorrectionMethod", raw.bayersensor.pixelShiftMotionCorrectionMethod , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorGreen, "RAW Bayer", "pixelShiftStddevFactorGreen", raw.bayersensor.pixelShiftStddevFactorGreen , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorRed, "RAW Bayer", "pixelShiftStddevFactorRed", raw.bayersensor.pixelShiftStddevFactorRed , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorBlue, "RAW Bayer", "pixelShiftStddevFactorBlue", raw.bayersensor.pixelShiftStddevFactorBlue , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEperIso, "RAW Bayer", "PixelShiftEperIso", raw.bayersensor.pixelShiftEperIso , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNreadIso, "RAW Bayer", "PixelShiftNreadIso", raw.bayersensor.pixelShiftNreadIso , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftPrnu, "RAW Bayer", "PixelShiftPrnu", raw.bayersensor.pixelShiftPrnu , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSigma, "RAW Bayer", "PixelShiftSigma", raw.bayersensor.pixelShiftSigma , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSum, "RAW Bayer", "PixelShiftSum", raw.bayersensor.pixelShiftSum , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftRedBlueWeight, "RAW Bayer", "PixelShiftRedBlueWeight", raw.bayersensor.pixelShiftRedBlueWeight , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotion, "RAW Bayer", "PixelShiftShowMotion", raw.bayersensor.pixelShiftShowMotion , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly, "RAW Bayer", "PixelShiftShowMotionMaskOnly", raw.bayersensor.pixelShiftShowMotionMaskOnly , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftAutomatic, "RAW Bayer", "pixelShiftAutomatic", raw.bayersensor.pixelShiftAutomatic , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenHorizontal, "RAW Bayer", "pixelShiftNonGreenHorizontal", raw.bayersensor.pixelShiftNonGreenHorizontal , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenVertical, "RAW Bayer", "pixelShiftNonGreenVertical", raw.bayersensor.pixelShiftNonGreenVertical , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftHoleFill, "RAW Bayer", "pixelShiftHoleFill", raw.bayersensor.pixelShiftHoleFill , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian, "RAW Bayer", "pixelShiftMedian", raw.bayersensor.pixelShiftMedian , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian3, "RAW Bayer", "pixelShiftMedian3", raw.bayersensor.pixelShiftMedian3 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftGreen, "RAW Bayer", "pixelShiftGreen", raw.bayersensor.pixelShiftGreen , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftBlur, "RAW Bayer", "pixelShiftBlur", raw.bayersensor.pixelShiftBlur , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSmooth, "RAW Bayer", "pixelShiftSmoothFactor", raw.bayersensor.pixelShiftSmoothFactor , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftExp0, "RAW Bayer", "pixelShiftExp0", raw.bayersensor.pixelShiftExp0 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftLmmse, "RAW Bayer", "pixelShiftLmmse", raw.bayersensor.pixelShiftLmmse , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBright, "RAW Bayer", "pixelShiftEqualBright", raw.bayersensor.pixelShiftEqualBright , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBrightChannel, "RAW Bayer", "pixelShiftEqualBrightChannel", raw.bayersensor.pixelShiftEqualBrightChannel , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross, "RAW Bayer", "pixelShiftNonGreenCross", raw.bayersensor.pixelShiftNonGreenCross , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross2, "RAW Bayer", "pixelShiftNonGreenCross2", raw.bayersensor.pixelShiftNonGreenCross2 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenAmaze, "RAW Bayer", "pixelShiftNonGreenAmaze", raw.bayersensor.pixelShiftNonGreenAmaze , keyFile); - saveToKeyfile(!pedited || pedited->raw.xtranssensor.method, "RAW X-Trans", "Method", raw.xtranssensor.method , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbIterations, "RAW Bayer", "DCBIterations", raw.bayersensor.dcb_iterations, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbEnhance, "RAW Bayer", "DCBEnhance", raw.bayersensor.dcb_enhance, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.lmmseIterations, "RAW Bayer", "LMMSEIterations", raw.bayersensor.lmmse_iterations, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotion, "RAW Bayer", "PixelShiftMotion", raw.bayersensor.pixelShiftMotion, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrection, "RAW Bayer", "PixelShiftMotionCorrection", toUnderlying(raw.bayersensor.pixelShiftMotionCorrection), keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod, "RAW Bayer", "PixelShiftMotionCorrectionMethod", toUnderlying(raw.bayersensor.pixelShiftMotionCorrectionMethod), keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorGreen, "RAW Bayer", "pixelShiftStddevFactorGreen", raw.bayersensor.pixelShiftStddevFactorGreen, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorRed, "RAW Bayer", "pixelShiftStddevFactorRed", raw.bayersensor.pixelShiftStddevFactorRed, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorBlue, "RAW Bayer", "pixelShiftStddevFactorBlue", raw.bayersensor.pixelShiftStddevFactorBlue, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEperIso, "RAW Bayer", "PixelShiftEperIso", raw.bayersensor.pixelShiftEperIso, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNreadIso, "RAW Bayer", "PixelShiftNreadIso", raw.bayersensor.pixelShiftNreadIso, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftPrnu, "RAW Bayer", "PixelShiftPrnu", raw.bayersensor.pixelShiftPrnu, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSigma, "RAW Bayer", "PixelShiftSigma", raw.bayersensor.pixelShiftSigma, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSum, "RAW Bayer", "PixelShiftSum", raw.bayersensor.pixelShiftSum, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftRedBlueWeight, "RAW Bayer", "PixelShiftRedBlueWeight", raw.bayersensor.pixelShiftRedBlueWeight, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotion, "RAW Bayer", "PixelShiftShowMotion", raw.bayersensor.pixelShiftShowMotion, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly, "RAW Bayer", "PixelShiftShowMotionMaskOnly", raw.bayersensor.pixelShiftShowMotionMaskOnly, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftAutomatic, "RAW Bayer", "pixelShiftAutomatic", raw.bayersensor.pixelShiftAutomatic, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenHorizontal, "RAW Bayer", "pixelShiftNonGreenHorizontal", raw.bayersensor.pixelShiftNonGreenHorizontal, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenVertical, "RAW Bayer", "pixelShiftNonGreenVertical", raw.bayersensor.pixelShiftNonGreenVertical, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftHoleFill, "RAW Bayer", "pixelShiftHoleFill", raw.bayersensor.pixelShiftHoleFill, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian, "RAW Bayer", "pixelShiftMedian", raw.bayersensor.pixelShiftMedian, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian3, "RAW Bayer", "pixelShiftMedian3", raw.bayersensor.pixelShiftMedian3, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftGreen, "RAW Bayer", "pixelShiftGreen", raw.bayersensor.pixelShiftGreen, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftBlur, "RAW Bayer", "pixelShiftBlur", raw.bayersensor.pixelShiftBlur, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSmooth, "RAW Bayer", "pixelShiftSmoothFactor", raw.bayersensor.pixelShiftSmoothFactor, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftExp0, "RAW Bayer", "pixelShiftExp0", raw.bayersensor.pixelShiftExp0, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftLmmse, "RAW Bayer", "pixelShiftLmmse", raw.bayersensor.pixelShiftLmmse, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBright, "RAW Bayer", "pixelShiftEqualBright", raw.bayersensor.pixelShiftEqualBright, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBrightChannel, "RAW Bayer", "pixelShiftEqualBrightChannel", raw.bayersensor.pixelShiftEqualBrightChannel, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross, "RAW Bayer", "pixelShiftNonGreenCross", raw.bayersensor.pixelShiftNonGreenCross, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross2, "RAW Bayer", "pixelShiftNonGreenCross2", raw.bayersensor.pixelShiftNonGreenCross2, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenAmaze, "RAW Bayer", "pixelShiftNonGreenAmaze", raw.bayersensor.pixelShiftNonGreenAmaze, keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.method, "RAW X-Trans", "Method", raw.xtranssensor.method, keyFile); saveToKeyfile(!pedited || pedited->raw.xtranssensor.ccSteps, "RAW X-Trans", "CcSteps", raw.xtranssensor.ccSteps, keyFile); - saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackRed, "RAW X-Trans", "PreBlackRed", raw.xtranssensor.blackred , keyFile); - saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackGreen, "RAW X-Trans", "PreBlackGreen", raw.xtranssensor.blackgreen , keyFile); - saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackBlue, "RAW X-Trans", "PreBlackBlue", raw.xtranssensor.blackblue , keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackRed, "RAW X-Trans", "PreBlackRed", raw.xtranssensor.blackred, keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackGreen, "RAW X-Trans", "PreBlackGreen", raw.xtranssensor.blackgreen, keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackBlue, "RAW X-Trans", "PreBlackBlue", raw.xtranssensor.blackblue, keyFile); // Raw exposition - saveToKeyfile(!pedited || pedited->raw.exPos, "RAW", "PreExposure", raw.expos , keyFile); - saveToKeyfile(!pedited || pedited->raw.exPreser, "RAW", "PrePreserv", raw.preser , keyFile); + saveToKeyfile(!pedited || pedited->raw.exPos, "RAW", "PreExposure", raw.expos, keyFile); + saveToKeyfile(!pedited || pedited->raw.exPreser, "RAW", "PrePreserv", raw.preser, keyFile); // EXIF change list if (!pedited || pedited->exif) { @@ -2445,26 +2556,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b } } -int ProcParams::write (const Glib::ustring &fname, const Glib::ustring &content) const -{ - - int error = 0; - - if (fname.length()) { - FILE *f; - f = g_fopen (fname.c_str (), "wt"); - - if (f == nullptr) { - error = 1; - } else { - fprintf (f, "%s", content.c_str()); - fclose (f); - } - } - - return error; -} - int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) { setlocale (LC_NUMERIC, "C"); // to set decimal point to "." @@ -2503,7 +2594,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) fclose (f); ppVersion = PPVERSION; - appVersion = APPVERSION; + appVersion = RTVERSION; if (keyFile.has_group ("Version")) { if (keyFile.has_key ("Version", "AppVersion")) { @@ -2540,13 +2631,13 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) toneCurve.shcompr = 100; // older pp3 files can have values above 100. } - const std::map tc_mapping = { - {"Standard", ToneCurveParams::Mode::STD}, - {"FilmLike", ToneCurveParams::Mode::FILMLIKE}, - {"SatAndValueBlending", ToneCurveParams::Mode::SATANDVALBLENDING}, - {"WeightedStd", ToneCurveParams::Mode::WEIGHTEDSTD}, - {"Luminance", ToneCurveParams::Mode::LUMINANCE}, - {"Perceptual", ToneCurveParams::Mode::PERCEPTUAL} + const std::map tc_mapping = { + {"Standard", ToneCurveParams::TcMode::STD}, + {"FilmLike", ToneCurveParams::TcMode::FILMLIKE}, + {"SatAndValueBlending", ToneCurveParams::TcMode::SATANDVALBLENDING}, + {"WeightedStd", ToneCurveParams::TcMode::WEIGHTEDSTD}, + {"Luminance", ToneCurveParams::TcMode::LUMINANCE}, + {"Perceptual", ToneCurveParams::TcMode::PERCEPTUAL} }; assignFromKeyfile(keyFile, "Exposure", "CurveMode", pedited, tc_mapping, toneCurve.curveMode, pedited->toneCurve.curveMode); @@ -2612,10 +2703,10 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) "BeforeCurveMode", pedited, { - {"Standard", BlackWhiteParams::TC_MODE_STD_BW}, - {"FilmLike", BlackWhiteParams::TC_MODE_FILMLIKE_BW}, - {"SatAndValueBlending", BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW}, - {"WeightedStd", BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW} + {"Standard", BlackWhiteParams::TcMode::STD_BW}, + {"FilmLike", BlackWhiteParams::TcMode::FILMLIKE_BW}, + {"SatAndValueBlending", BlackWhiteParams::TcMode::SATANDVALBLENDING_BW}, + {"WeightedStd", BlackWhiteParams::TcMode::WEIGHTEDSTD_BW} }, blackwhite.beforeCurveMode, pedited->blackwhite.beforeCurveMode @@ -2628,8 +2719,8 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) "AfterCurveMode", pedited, { - {"Standard", BlackWhiteParams::TC_MODE_STD_BW}, - {"WeightedStd", BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW} + {"Standard", BlackWhiteParams::TcMode::STD_BW}, + {"WeightedStd", BlackWhiteParams::TcMode::WEIGHTEDSTD_BW} }, blackwhite.afterCurveMode, pedited->blackwhite.afterCurveMode @@ -2896,9 +2987,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color appearance", "Tonecie", pedited, colorappearance.tonecie, pedited->colorappearance.tonecie); // if (keyFile.has_key ("Color appearance", "Sharpcie")) {colorappearance.sharpcie = keyFile.get_boolean ("Color appearance", "Sharpcie"); if (pedited) pedited->colorappearance.sharpcie = true; } - const std::map tc_mapping = { - {"Lightness", ColorAppearanceParams::TCMode::LIGHT}, - {"Brightness", ColorAppearanceParams::TCMode::BRIGHT} + const std::map tc_mapping = { + {"Lightness", ColorAppearanceParams::TcMode::LIGHT}, + {"Brightness", ColorAppearanceParams::TcMode::BRIGHT} }; assignFromKeyfile(keyFile, "Color appearance", "CurveMode", pedited, tc_mapping, colorappearance.curveMode, pedited->colorappearance.curveMode); assignFromKeyfile(keyFile, "Color appearance", "CurveMode2", pedited, tc_mapping, colorappearance.curveMode2, pedited->colorappearance.curveMode2); @@ -2909,9 +3000,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) "CurveMode3", pedited, { - {"Chroma", ColorAppearanceParams::CTCMode::CHROMA}, - {"Saturation", ColorAppearanceParams::CTCMode::SATUR}, - {"Colorfullness", ColorAppearanceParams::CTCMode::COLORF} + {"Chroma", ColorAppearanceParams::CtcMode::CHROMA}, + {"Saturation", ColorAppearanceParams::CtcMode::SATUR}, + {"Colorfullness", ColorAppearanceParams::CtcMode::COLORF} }, colorappearance.curveMode3, pedited->colorappearance.curveMode3 @@ -3657,14 +3748,14 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "RAW Bayer", "LMMSEIterations", pedited, raw.bayersensor.lmmse_iterations, pedited->raw.bayersensor.lmmseIterations); assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftMotion", pedited, raw.bayersensor.pixelShiftMotion, pedited->raw.bayersensor.pixelShiftMotion); if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrection")) { - raw.bayersensor.pixelShiftMotionCorrection = (RAWParams::BayerSensor::ePSMotionCorrection)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrection"); + raw.bayersensor.pixelShiftMotionCorrection = (RAWParams::BayerSensor::PSMotionCorrection)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrection"); if (pedited) { pedited->raw.bayersensor.pixelShiftMotionCorrection = true; } } if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrectionMethod")) { - raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::ePSMotionCorrectionMethod)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrectionMethod"); + raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::PSMotionCorrectionMethod)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrectionMethod"); if (pedited) { pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod = true; @@ -3766,58 +3857,20 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) return 0; } -const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring ("No ICM: sRGB output"); - -bool operator== (const WaveletParams & a, const WaveletParams & b) +ProcParams* ProcParams::create () { - if (a.enabled != b.enabled) { - return false; - } - for (int i = 0; i < 9; i++) { - if (a.c[i] != b.c[i]) { - return false; - } - } - - for (int i = 0; i < 9; i++) { - if (a.ch[i] != b.ch[i]) { - return false; - } - } - - return true; + return new ProcParams(); } - - -bool operator== (const DirPyrEqualizerParams & a, const DirPyrEqualizerParams & b) +void ProcParams::destroy (ProcParams* pp) { - if (a.enabled != b.enabled) { - return false; - } - for (int i = 0; i < 6; i++) { - if (a.mult[i] != b.mult[i]) { - return false; - } - } - - return a.threshold == b.threshold; + delete pp; } -/*bool operator==(const ExifPairs& a, const ExifPairs& b) { - - return a.field == b.field && a.value == b.value; -} - -bool operator==(const IPTCPairs& a, const IPTCPairs& b) { - - return a.field == b.field && a.values == b.values; -}*/ bool ProcParams::operator== (const ProcParams& other) { - return toneCurve.curve == other.toneCurve.curve && toneCurve.curve2 == other.toneCurve.curve2 @@ -4293,7 +4346,35 @@ bool ProcParams::operator== (const ProcParams& other) bool ProcParams::operator!= (const ProcParams& other) { - return ! (*this == other); + return !(*this == other); +} + +void ProcParams::init () +{ +} + +void ProcParams::cleanup () +{ +} + +int ProcParams::write (const Glib::ustring &fname, const Glib::ustring &content) const +{ + + int error = 0; + + if (fname.length()) { + FILE *f; + f = g_fopen (fname.c_str (), "wt"); + + if (f == nullptr) { + error = 1; + } else { + fprintf (f, "%s", content.c_str()); + fclose (f); + } + } + + return error; } PartialProfile::PartialProfile (bool createInstance, bool paramsEditedValue) @@ -4337,6 +4418,28 @@ PartialProfile::PartialProfile (const ProcParams* pp, const ParamsEdited* pe) } } +void PartialProfile::deleteInstance () +{ + if (pparams) { + delete pparams; + pparams = nullptr; + } + + if (pedited) { + delete pedited; + pedited = nullptr; + } +} + +void PartialProfile::clearGeneral () +{ + if (pedited) { + pedited->general.colorlabel = false; + pedited->general.intrash = false; + pedited->general.rank = false; + } +} + int PartialProfile::load (const Glib::ustring &fName) { if (!pparams) { @@ -4356,29 +4459,14 @@ int PartialProfile::load (const Glib::ustring &fName) } } -void PartialProfile::deleteInstance () -{ - if (pparams) { - delete pparams; - pparams = nullptr; - } - - if (pedited) { - delete pedited; - pedited = nullptr; - } -} - /* * Set the all values of the General section to false * in order to preserve them in applyTo */ -void PartialProfile::clearGeneral () +void PartialProfile::set (bool v) { if (pedited) { - pedited->general.colorlabel = false; - pedited->general.intrash = false; - pedited->general.rank = false; + pedited->set (v); } } @@ -4389,13 +4477,6 @@ const void PartialProfile::applyTo (ProcParams *destParams) const } } -void PartialProfile::set (bool v) -{ - if (pedited) { - pedited->set (v); - } } } -} - diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 20c9db026..09dc6b07d 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -28,6 +28,7 @@ #include "coord.h" #include "LUT.h" +#include "utils.h" class ParamsEdited; @@ -254,7 +255,7 @@ private: * Parameters of the tone curve */ struct ToneCurveParams { - enum class Mode { + enum class TcMode { STD, // Standard modes, the curve is applied on all component individually WEIGHTEDSTD, // Weighted standard mode FILMLIKE, // Film-like mode, as defined in Adobe's reference code @@ -270,8 +271,8 @@ struct ToneCurveParams { double expcomp; std::vector curve; std::vector curve2; - Mode curveMode; - Mode curveMode2; + TcMode curveMode; + TcMode curveMode2; int brightness; int black; int contrast; @@ -519,18 +520,20 @@ struct WBParams { double green; double equal; double tempBias; + + static const std::vector& getWbEntries(); }; /** * Parameters of colorappearance */ struct ColorAppearanceParams { - enum class TCMode { + enum class TcMode { LIGHT, // Lightness mode BRIGHT, // Brightness mode }; - enum class CTCMode { + enum class CtcMode { CHROMA, // chroma mode SATUR, // saturation mode COLORF, // colorfullness mode @@ -544,9 +547,9 @@ struct ColorAppearanceParams { std::vector curve; std::vector curve2; std::vector curve3; - TCMode curveMode; - TCMode curveMode2; - CTCMode curveMode3; + TcMode curveMode; + TcMode curveMode2; + CtcMode curveMode3; Glib::ustring surround; Glib::ustring surrsrc; @@ -798,21 +801,18 @@ struct ChannelMixerParams { int blue[3]; }; -class BlackWhiteParams -{ - -public: - enum eTCModeId { - TC_MODE_STD_BW, // Standard modes, the curve is applied on all component individually - TC_MODE_WEIGHTEDSTD_BW, // Weighted standard mode - TC_MODE_FILMLIKE_BW, // Film-like mode, as defined in Adobe's reference code - TC_MODE_SATANDVALBLENDING_BW // Modify the Saturation and Value channel +struct BlackWhiteParams { + enum class TcMode { + STD_BW, // Standard modes, the curve is applied on all component individually + WEIGHTEDSTD_BW, // Weighted standard mode + FILMLIKE_BW, // Film-like mode, as defined in Adobe's reference code + SATANDVALBLENDING_BW // Modify the Saturation and Value channel }; std::vector beforeCurve; - eTCModeId beforeCurveMode; + TcMode beforeCurveMode; std::vector afterCurve; - eTCModeId afterCurveMode; + TcMode afterCurveMode; Glib::ustring algo; std::vector luminanceCurve; @@ -838,32 +838,15 @@ public: /** * Parameters of the c/a correction */ -class CACorrParams -{ - -public: +struct CACorrParams { double red; double blue; }; -/** - * Parameters of the highlight recovery - */ -/* -class HRecParams { - - public: - bool enabled; - Glib::ustring method; -}; -*/ /** * Parameters of the resizing */ -class ResizeParams -{ - -public: +struct ResizeParams { bool enabled; double scale; Glib::ustring appliesTo; @@ -876,10 +859,7 @@ public: /** * Parameters of the color spaces used during the processing */ -class ColorManagementParams -{ - -public: +struct ColorManagementParams { Glib::ustring input; bool toneCurve; bool applyLookTable; @@ -897,10 +877,7 @@ public: double slpos; bool freegamma; - ColorManagementParams() - { - setDefaults(); - } + ColorManagementParams(); void setDefaults(); }; @@ -912,14 +889,11 @@ typedef std::map ExifPairs; /** * The IPTC key/value pairs */ -typedef std::map > IPTCPairs; +typedef std::map> IPTCPairs; -class WaveletParams -{ - -public: - std::vector ccwcurve; +struct WaveletParams { + std::vector ccwcurve; std::vector opacityCurveRG; std::vector opacityCurveBY; std::vector opacityCurveW; @@ -940,7 +914,6 @@ public: int bluehigh; bool lipst; - // bool edgreinf; bool avoid; bool tmr; int strength; @@ -1006,44 +979,35 @@ public: Threshold level2noise; Threshold level3noise; - - WaveletParams (); + WaveletParams(); void setDefaults(); - void getCurves (WavCurve& cCurve, WavOpacityCurveRG& opacityCurveLUTRG, WavOpacityCurveBY& opacityCurveLUTBY, WavOpacityCurveW& opacityCurveLUTW, WavOpacityCurveWL& opacityCurveLUTWL) const; + void getCurves(WavCurve& cCurve, WavOpacityCurveRG& opacityCurveLUTRG, WavOpacityCurveBY& opacityCurveLUTBY, WavOpacityCurveW& opacityCurveLUTW, WavOpacityCurveWL& opacityCurveLUTWL) const; static void getDefaultCCWCurve (std::vector& curve); static void getDefaultOpacityCurveRG (std::vector& curve); static void getDefaultOpacityCurveBY (std::vector& curve); static void getDefaultOpacityCurveW (std::vector& curve); static void getDefaultOpacityCurveWL (std::vector& curve); - }; - /** * Directional pyramid equalizer params */ -class DirPyrEqualizerParams -{ - -public: +struct DirPyrEqualizerParams { bool enabled; bool gamutlab; double mult[6]; double threshold; double skinprotect; Threshold hueskin; - //Glib::ustring algo; Glib::ustring cbdlMethod; - DirPyrEqualizerParams() : hueskin (20, 80, 2000, 1200, false) {}; + + DirPyrEqualizerParams(); }; /** * HSV equalizer params */ -class HSVEqualizerParams -{ - -public: +struct HSVEqualizerParams { std::vector hcurve; std::vector scurve; std::vector vcurve; @@ -1058,45 +1022,48 @@ struct FilmSimulationParams { Glib::ustring clutFilename; int strength; - FilmSimulationParams() - { - setDefaults(); - } - - void setDefaults() - { - enabled = false; - clutFilename = Glib::ustring(); - strength = 100; - } + FilmSimulationParams(); + void setDefaults(); }; /** * Parameters for RAW demosaicing, common to all sensor type */ -class RAWParams -{ - -public: +struct RAWParams { /** * Parameters for RAW demosaicing specific to Bayer sensors */ - class BayerSensor - { - public: - //enum eMethod{ eahd,hphd,vng4,dcb,amaze,ahd,IGV_noise,fast, - //numMethods }; // This MUST be the last enum - enum eMethod { amaze, igv, lmmse, eahd, hphd, vng4, dcb, ahd, fast, mono, none, pixelshift, - numMethods - }; // This MUST be the last enum - enum ePSMotionCorrection { - Grid1x1, Grid1x2, Grid3x3, Grid5x5, Grid7x7, Grid3x3New + struct BayerSensor { + enum class Method { + AMAZE, + IGV, + LMMSE, + EAHD, + HPHD, + VNG4, + DCB, + AHD, + FAST, + MONO, + NONE, + PIXELSHIFT }; - enum ePSMotionCorrectionMethod { - Off, Automatic, Custom + + enum class PSMotionCorrection { + GRID_1X1, + GRID_1X2, + GRID_3X3, + GRID_5X5, + GRID_7X7, + GRID_3X3_NEW + }; + + enum class PSMotionCorrectionMethod { + OFF, + AUTO, + CUSTOM }; - static const char *methodstring[numMethods]; Glib::ustring method; int imageNum; @@ -1111,8 +1078,8 @@ public: int dcb_iterations; int lmmse_iterations; int pixelShiftMotion; - ePSMotionCorrection pixelShiftMotionCorrection; - ePSMotionCorrectionMethod pixelShiftMotionCorrectionMethod; + PSMotionCorrection pixelShiftMotionCorrection; + PSMotionCorrectionMethod pixelShiftMotionCorrectionMethod; double pixelShiftStddevFactorGreen; double pixelShiftStddevFactorRed; double pixelShiftStddevFactorBlue; @@ -1141,38 +1108,44 @@ public: bool pixelShiftNonGreenCross2; bool pixelShiftNonGreenAmaze; bool dcb_enhance; - //bool all_enhance; void setPixelShiftDefaults(); + static const std::vector& getMethodStrings(); + static Glib::ustring getMethodString(Method method); }; /** * Parameters for RAW demosaicing specific to X-Trans sensors */ - class XTransSensor - { - public: - enum eMethod { threePass, onePass, fast, mono, none, - numMethods - }; // This MUST be the last enum - static const char *methodstring[numMethods]; + struct XTransSensor { + enum class Method { + THREE_PASS, + ONE_PASS, + FAST, + MONO, + NONE + }; Glib::ustring method; int ccSteps; double blackred; double blackgreen; double blackblue; - }; + + static const std::vector& getMethodStrings(); + static Glib::ustring getMethodString(Method method); + }; BayerSensor bayersensor; ///< RAW parameters for Bayer sensors XTransSensor xtranssensor; ///< RAW parameters for X-Trans sensors - enum eFlatFileBlurType { /*parametric,*/area_ff, v_ff, h_ff, vh_ff, - numFlatFileBlurTypes - }; // This MUST be the last enum - - static const char *ff_BlurTypestring[numFlatFileBlurTypes]; + enum class FlatFieldBlurType { + AREA, + V, + H, + VH, + }; Glib::ustring dark_frame; bool df_autoselect; @@ -1196,11 +1169,11 @@ public: bool deadPixelFilter; int hotdeadpix_thresh; - RAWParams() - { - setDefaults(); - } + RAWParams(); void setDefaults(); + + static const std::vector& getFlatFieldBlurTypeStrings(); + static Glib::ustring getFlatFieldBlurTypeString(FlatFieldBlurType type); }; /** @@ -1348,7 +1321,8 @@ public: * and automatically delete them in the destructor. This class has been mostly created * to be used with vectors, which use the default constructor/destructor */ -class AutoPartialProfile : public PartialProfile +class AutoPartialProfile : + public PartialProfile { public: AutoPartialProfile() : PartialProfile (true) {} diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 6ab9076aa..998d5e72e 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -650,8 +650,8 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima const float new_pre_mul[4] = { ri->get_pre_mul(0) / rm, ri->get_pre_mul(1) / gm, ri->get_pre_mul(2) / bm, ri->get_pre_mul(3) / gm }; float new_scale_mul[4]; - bool isMono = (ri->getSensorType() == ST_FUJI_XTRANS && raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono]) - || (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono]); + bool isMono = (ri->getSensorType() == ST_FUJI_XTRANS && raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) + || (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE)); float gain = calculate_scale_mul(new_scale_mul, new_pre_mul, c_white, cblacksom, isMono, ri->get_colors()); rm = new_scale_mul[0] / scale_mul[0] * gain; gm = new_scale_mul[1] / scale_mul[1] * gain; @@ -1921,7 +1921,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } // check if it is an olympus E camera or green equilibration is enabled. If yes, compute G channel pre-compensation factors - if ( ri->getSensorType() == ST_BAYER && (raw.bayersensor.greenthresh || (((idata->getMake().size() >= 7 && idata->getMake().substr(0, 7) == "OLYMPUS" && idata->getModel()[0] == 'E') || (idata->getMake().size() >= 9 && idata->getMake().substr(0, 9) == "Panasonic")) && raw.bayersensor.method != RAWParams::BayerSensor::methodstring[ RAWParams::BayerSensor::vng4])) ) { + if ( ri->getSensorType() == ST_BAYER && (raw.bayersensor.greenthresh || (((idata->getMake().size() >= 7 && idata->getMake().substr(0, 7) == "OLYMPUS" && idata->getModel()[0] == 'E') || (idata->getMake().size() >= 9 && idata->getMake().substr(0, 9) == "Panasonic")) && raw.bayersensor.method != RAWParams::BayerSensor::getMethodString( RAWParams::BayerSensor::Method::VNG4))) ) { // global correction if(numFrames == 4) { for(int i = 0; i < 4; ++i) { @@ -2027,27 +2027,27 @@ void RawImageSource::demosaic(const RAWParams &raw) t1.set(); if (ri->getSensorType() == ST_BAYER) { - if ( raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::hphd] ) { + if ( raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::HPHD) ) { hphd_demosaic (); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::vng4] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::VNG4) ) { vng4_demosaic (); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::ahd] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AHD) ) { ahd_demosaic (0, 0, W, H); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::amaze] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE) ) { amaze_demosaic_RT (0, 0, W, H, rawData, red, green, blue); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::pixelshift] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT) ) { pixelshift(0, 0, W, H, raw.bayersensor, currFrame, ri->get_model(), raw.expos); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::dcb] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCB) ) { dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::eahd]) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::EAHD)) { eahd_demosaic (); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::igv]) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::IGV)) { igv_interpolate(W, H); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::lmmse]) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::LMMSE)) { lmmse_interpolate_omp(W, H, rawData, red, green, blue, raw.bayersensor.lmmse_iterations); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST) ) { fast_demosaic (0, 0, W, H); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) ) { nodemosaic(true); } else { nodemosaic(false); @@ -2056,13 +2056,13 @@ void RawImageSource::demosaic(const RAWParams &raw) //if (raw.all_enhance) refinement_lassus(); } else if (ri->getSensorType() == ST_FUJI_XTRANS) { - if (raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast] ) { + if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST) ) { fast_xtrans_interpolate(); - } else if (raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::onePass]) { + } else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::ONE_PASS)) { xtrans_interpolate(1, false); - } else if (raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::threePass] ) { + } else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::THREE_PASS) ) { xtrans_interpolate(3, true); - } else if(raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono] ) { + } else if(raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) ) { nodemosaic(true); } else { nodemosaic(false); @@ -2803,14 +2803,14 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile BS += BS & 1; //function call to cfabloxblur - if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::v_ff]) { + if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::V)) { cfaboxblur(riFlatFile, cfablur, 2 * BS, 0); - } else if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::h_ff]) { + } else if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::H)) { cfaboxblur(riFlatFile, cfablur, 0, 2 * BS); - } else if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::vh_ff]) { + } else if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::VH)) { //slightly more complicated blur if trying to correct both vertical and horizontal anomalies cfaboxblur(riFlatFile, cfablur, BS, BS); //first do area blur to correct vignette - } else { //(raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::area_ff]) + } else { //(raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::area_ff)) cfaboxblur(riFlatFile, cfablur, BS, BS); } @@ -3008,7 +3008,7 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile } } - if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::vh_ff]) { + if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::VH)) { float *cfablur1 = (float (*)) malloc (H * W * sizeof * cfablur1); float *cfablur2 = (float (*)) malloc (H * W * sizeof * cfablur2); //slightly more complicated blur if trying to correct both vertical and horizontal anomalies @@ -3429,7 +3429,7 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R black_lev[2] = raw.bayersensor.black2; //B black_lev[3] = raw.bayersensor.black3; //G2 - isMono = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono] == raw.bayersensor.method; + isMono = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) == raw.bayersensor.method; } else if (getSensorType() == ST_FUJI_XTRANS) { black_lev[0] = raw.xtranssensor.blackred; //R @@ -3437,7 +3437,7 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R black_lev[2] = raw.xtranssensor.blackblue; //B black_lev[3] = raw.xtranssensor.blackgreen; //G2 (set, only used with a Bayer filter) - isMono = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono] == raw.xtranssensor.method; + isMono = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) == raw.xtranssensor.method; } for(int i = 0; i < 4 ; i++) { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index c8d45acf8..844f8fb39 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1483,16 +1483,12 @@ private: params.defringe.radius); adjust_radius (defaultparams.sh.radius, scale_factor, params.sh.radius); - if (params.raw.xtranssensor.method == - procparams::RAWParams::XTransSensor::methodstring[ - procparams::RAWParams::XTransSensor::threePass]) { - params.raw.xtranssensor.method = - procparams::RAWParams::XTransSensor::methodstring[ - procparams::RAWParams::XTransSensor::onePass]; + if (params.raw.xtranssensor.method == procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::THREE_PASS)) { + params.raw.xtranssensor.method = procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::ONE_PASS); } - if (params.raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::pixelshift]) { - params.raw.bayersensor.method = procparams::RAWParams::BayerSensor::methodstring[params.raw.bayersensor.pixelShiftLmmse ? procparams::RAWParams::BayerSensor::lmmse : procparams::RAWParams::BayerSensor::amaze]; + if (params.raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT)) { + params.raw.bayersensor.method = procparams::RAWParams::BayerSensor::getMethodString(params.raw.bayersensor.pixelShiftLmmse ? procparams::RAWParams::BayerSensor::Method::LMMSE : procparams::RAWParams::BayerSensor::Method::AMAZE); } } diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index d5a728a97..9df7c106d 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -29,8 +29,8 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); method = Gtk::manage (new MyComboBoxText ()); - for( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - method->append(M("TP_RAW_" + Glib::ustring(procparams::RAWParams::BayerSensor::methodstring[i]).uppercase())); + for(const auto method_string : procparams::RAWParams::BayerSensor::getMethodStrings()) { + method->append(M("TP_RAW_" + Glib::ustring(method_string).uppercase())); } method->set_active(0); @@ -112,7 +112,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA pixelShiftMotionMethod->append(M("TP_RAW_PIXELSHIFTMM_OFF")); pixelShiftMotionMethod->append(M("TP_RAW_PIXELSHIFTMM_AUTO")); pixelShiftMotionMethod->append(M("TP_RAW_PIXELSHIFTMM_CUSTOM")); - pixelShiftMotionMethod->set_active(RAWParams::BayerSensor::ePSMotionCorrectionMethod::Automatic); + pixelShiftMotionMethod->set_active(toUnderlying(RAWParams::BayerSensor::PSMotionCorrectionMethod::AUTO)); pixelShiftMotionMethod->show(); hb3->pack_start(*pixelShiftMotionMethod); pixelShiftFrame->pack_start(*hb3); @@ -347,11 +347,11 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params pixelShiftMotionCorrection->block (true); #endif - method->set_active(procparams::RAWParams::BayerSensor::numMethods); + method->set_active(std::numeric_limits::max()); imageNumber->set_active(pp->raw.bayersensor.imageNum); - for( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - if( pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[i]) { + for (size_t i = 0; i < procparams::RAWParams::BayerSensor::getMethodStrings().size(); ++i) { + if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodStrings()[i]) { method->set_active(i); oldMethod = i; break; @@ -452,7 +452,7 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params #endif if(!pedited->raw.bayersensor.method) { - method->set_active(procparams::RAWParams::BayerSensor::numMethods); // No name + method->set_active(std::numeric_limits::max()); // No name } if(!pedited->raw.bayersensor.imageNum) { imageNumber->set_active_text(M("GENERAL_UNCHANGED")); @@ -468,21 +468,21 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params } if (!batchMode) { - if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::dcb] || - method->get_active_row_number() == procparams::RAWParams::BayerSensor::numMethods) { + if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCB) || + method->get_active_row_number() == std::numeric_limits::max()) { dcbOptions->show(); } else { dcbOptions->hide(); } - if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::lmmse] || - method->get_active_row_number() == procparams::RAWParams::BayerSensor::numMethods) { + if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::LMMSE) || + method->get_active_row_number() == std::numeric_limits::max()) { lmmseOptions->show(); } else { lmmseOptions->hide(); } - if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::pixelshift] || - method->get_active_row_number() == procparams::RAWParams::BayerSensor::numMethods) { - if(pp->raw.bayersensor.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Custom) { + if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT) || + method->get_active_row_number() == std::numeric_limits::max()) { + if(pp->raw.bayersensor.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::PSMotionCorrectionMethod::CUSTOM) { pixelShiftOptions->show(); } else { pixelShiftOptions->hide(); @@ -493,9 +493,9 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params } // Flase color suppression is applied to all demozaicing method, so don't hide anything - /*if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::eahd] || - pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::hphd] || - pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::vng4]) + /*if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::EAHD) || + pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::HPHD) || + pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::VNG4)) ccSteps->show(); else ccSteps->hide();*/ @@ -520,7 +520,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe pp->raw.bayersensor.dcb_enhance = dcbEnhance->getLastActive (); //pp->raw.bayersensor.all_enhance = allEnhance->getLastActive (); pp->raw.bayersensor.lmmse_iterations = lmmseIterations->getIntValue(); - pp->raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::ePSMotionCorrectionMethod)pixelShiftMotionMethod->get_active_row_number(); + pp->raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::PSMotionCorrectionMethod)pixelShiftMotionMethod->get_active_row_number(); pp->raw.bayersensor.pixelShiftEperIso = pixelShiftEperIso->getValue(); pp->raw.bayersensor.pixelShiftSigma = pixelShiftSigma->getValue(); pp->raw.bayersensor.pixelShiftShowMotion = pixelShiftShowMotion->getLastActive (); @@ -554,8 +554,8 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe #endif int currentRow = method->get_active_row_number(); - if( currentRow >= 0 && currentRow < procparams::RAWParams::BayerSensor::numMethods) { - pp->raw.bayersensor.method = procparams::RAWParams::BayerSensor::methodstring[currentRow]; + if( currentRow >= 0 && currentRow < std::numeric_limits::max()) { + pp->raw.bayersensor.method = procparams::RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method(currentRow)); } currentRow = imageNumber->get_active_row_number(); @@ -566,7 +566,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe if (pedited) { pedited->raw.bayersensor.ccSteps = ccSteps->getEditedState (); - pedited->raw.bayersensor.method = method->get_active_row_number() != procparams::RAWParams::BayerSensor::numMethods; + pedited->raw.bayersensor.method = method->get_active_row_number() != std::numeric_limits::max(); pedited->raw.bayersensor.imageNum = imageNumber->get_active_text() != M("GENERAL_UNCHANGED"); pedited->raw.bayersensor.dcbIterations = dcbIterations->getEditedState (); pedited->raw.bayersensor.dcbEnhance = !dcbEnhance->get_inconsistent(); @@ -610,7 +610,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe void BayerProcess::setBatchMode(bool batchMode) { method->append (M("GENERAL_UNCHANGED")); - method->set_active(procparams::RAWParams::BayerSensor::numMethods); // No name + method->set_active(std::numeric_limits::max()); // No name #ifdef PIXELSHIFTDEV pixelShiftMotionCorrection->append (M("GENERAL_UNCHANGED")); pixelShiftMotionCorrection->set_active_text (M("GENERAL_UNCHANGED")); @@ -750,22 +750,23 @@ void BayerProcess::psMotionCorrectionChanged () void BayerProcess::methodChanged () { - int curSelection = method->get_active_row_number(); + const int curSelection = method->get_active_row_number(); + const RAWParams::BayerSensor::Method method = RAWParams::BayerSensor::Method(curSelection); if (!batchMode) { - if ( curSelection == procparams::RAWParams::BayerSensor::dcb) { + if (method == procparams::RAWParams::BayerSensor::Method::DCB) { dcbOptions->show(); } else { dcbOptions->hide(); } - if ( curSelection == procparams::RAWParams::BayerSensor::lmmse) { + if (method == procparams::RAWParams::BayerSensor::Method::LMMSE) { lmmseOptions->show(); } else { lmmseOptions->hide(); } - if ( curSelection == procparams::RAWParams::BayerSensor::pixelshift) { + if (method == procparams::RAWParams::BayerSensor::Method::PIXELSHIFT) { if(pixelShiftMotionMethod->get_active_row_number() == 2) { pixelShiftOptions->show(); } else { @@ -780,10 +781,10 @@ void BayerProcess::methodChanged () Glib::ustring methodName = ""; bool ppreq = false; - if( curSelection >= 0 && curSelection < procparams::RAWParams::BayerSensor::numMethods) { - methodName = procparams::RAWParams::BayerSensor::methodstring[curSelection]; + if (curSelection >= 0 && curSelection < std::numeric_limits::max()) { + methodName = procparams::RAWParams::BayerSensor::getMethodString(method); - if (curSelection == procparams::RAWParams::BayerSensor::mono || oldMethod == procparams::RAWParams::BayerSensor::mono) { + if (method == procparams::RAWParams::BayerSensor::Method::MONO || RAWParams::BayerSensor::Method(oldMethod) == procparams::RAWParams::BayerSensor::Method::MONO) { ppreq = true; } } diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index efa960a81..2b410846f 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -500,7 +500,7 @@ void BlackWhite::read (const ProcParams* pp, const ParamsEdited* pedited) mixerPurple->setValue (pp->blackwhite.mixerPurple); luminanceCurve->setCurve (pp->blackwhite.luminanceCurve); beforeCurve->setCurve (pp->blackwhite.beforeCurve); - beforeCurveMode->set_active(pp->blackwhite.beforeCurveMode); + beforeCurveMode->set_active(toUnderlying(pp->blackwhite.beforeCurveMode)); afterCurve->setCurve (pp->blackwhite.afterCurve); // afterCurveMode->set_active(pp->blackwhite.afterCurveMode); @@ -583,18 +583,18 @@ void BlackWhite::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = beforeCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_STD_BW; + pp->blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::STD_BW; } else if (tcMode == 1) { - pp->blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW; + pp->blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::WEIGHTEDSTD_BW; } else if (tcMode == 2) { - pp->blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_FILMLIKE_BW; + pp->blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::FILMLIKE_BW; } else if (tcMode == 3) { - pp->blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW; + pp->blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::SATANDVALBLENDING_BW; } // tcMode = afterCurveMode->get_active_row_number(); -// if (tcMode == 0) pp->blackwhite.afterCurveMode = BlackWhiteParams::TC_MODE_STD_BW; - // else if (tcMode == 1) pp->blackwhite.afterCurveMode = BlackWhiteParams::TC_MODE_WEIGHTEDSTD; +// if (tcMode == 0) pp->blackwhite.afterCurveMode = BlackWhiteParams::TCMode::STD_BW; + // else if (tcMode == 1) pp->blackwhite.afterCurveMode = BlackWhiteParams::TCMode::WEIGHTEDSTD; if (pedited) { pedited->blackwhite.enabled = !get_inconsistent(); diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 7d8eb7de4..7a31ae39f 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -1044,27 +1044,27 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = toneCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->colorappearance.curveMode = ColorAppearanceParams::TCMode::LIGHT; + pp->colorappearance.curveMode = ColorAppearanceParams::TcMode::LIGHT; } else if (tcMode == 1) { - pp->colorappearance.curveMode = ColorAppearanceParams::TCMode::BRIGHT; + pp->colorappearance.curveMode = ColorAppearanceParams::TcMode::BRIGHT; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->colorappearance.curveMode2 = ColorAppearanceParams::TCMode::LIGHT; + pp->colorappearance.curveMode2 = ColorAppearanceParams::TcMode::LIGHT; } else if (tcMode == 1) { - pp->colorappearance.curveMode2 = ColorAppearanceParams::TCMode::BRIGHT; + pp->colorappearance.curveMode2 = ColorAppearanceParams::TcMode::BRIGHT; } int tcMode3 = toneCurveMode3->get_active_row_number(); if (tcMode3 == 0) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::CHROMA; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::CHROMA; } else if (tcMode3 == 1) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::SATUR; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::SATUR; } else if (tcMode3 == 2) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::COLORF; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::COLORF; } if (pedited) { diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 4e5e885ea..f4510682e 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -1047,7 +1047,7 @@ void CropWindow::pointerMoved (int bstate, int x, int y) if(ipc) { procparams::ProcParams params; ipc->getParams(¶ms); - if(params.raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none] || params.raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::none]) { + if(params.raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) || params.raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) { ImageSource *isrc = static_cast(ipc->getInitialImage()); isrc->getRawValues(mx, my, params.coarse.rotate, rval, gval, bval); } diff --git a/rtgui/exportpanel.cc b/rtgui/exportpanel.cc index 7fdc3ae50..144a107d5 100644 --- a/rtgui/exportpanel.cc +++ b/rtgui/exportpanel.cc @@ -68,8 +68,8 @@ ExportPanel::ExportPanel () : listener (nullptr) hb_raw_bayer_method->pack_start (*Gtk::manage (new Gtk::Label ( M ("EXPORT_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); raw_bayer_method = Gtk::manage (new MyComboBoxText ()); - for ( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - raw_bayer_method->append (procparams::RAWParams::BayerSensor::methodstring[i]); + for (const auto method_string : RAWParams::BayerSensor::getMethodStrings()) { + raw_bayer_method->append(method_string); } raw_bayer_method->set_active (0); @@ -91,8 +91,8 @@ ExportPanel::ExportPanel () : listener (nullptr) hb_raw_xtrans_method->pack_start (*Gtk::manage (new Gtk::Label ( M ("EXPORT_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); raw_xtrans_method = Gtk::manage (new MyComboBoxText ()); - for ( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) { - raw_xtrans_method->append (procparams::RAWParams::XTransSensor::methodstring[i]); + for (const auto method_string : RAWParams::XTransSensor::getMethodStrings()) { + raw_xtrans_method->append(method_string); } raw_xtrans_method->set_active (0); @@ -275,15 +275,15 @@ void ExportPanel::SaveSettingsAsDefault() //saving Bayer demosaic_method int currentRow = raw_bayer_method->get_active_row_number(); - if ( currentRow >= 0 && currentRow < procparams::RAWParams::BayerSensor::numMethods) { - FE_OPT_STORE_ (options.fastexport_raw_bayer_method, procparams::RAWParams::BayerSensor::methodstring[currentRow]); + if (currentRow >= 0 && currentRow < std::numeric_limits::max()) { + FE_OPT_STORE_ (options.fastexport_raw_bayer_method, procparams::RAWParams::BayerSensor::getMethodStrings()[currentRow]); } //saving X-Trans demosaic_method currentRow = raw_xtrans_method->get_active_row_number(); - if ( currentRow >= 0 && currentRow < procparams::RAWParams::XTransSensor::numMethods) { - FE_OPT_STORE_ (options.fastexport_raw_xtrans_method, procparams::RAWParams::XTransSensor::methodstring[currentRow]); + if (currentRow >= 0 && currentRow < std::numeric_limits::max()) { + FE_OPT_STORE_ (options.fastexport_raw_xtrans_method, procparams::RAWParams::XTransSensor::getMethodStrings()[currentRow]); } // options.fastexport_icm_input = icm_input ; @@ -337,20 +337,20 @@ void ExportPanel::LoadDefaultSettings() bypass_raw_ff->set_active (options.fastexport_bypass_raw_ff ); // Bayer demosaic method - raw_bayer_method->set_active (procparams::RAWParams::BayerSensor::numMethods); + raw_bayer_method->set_active(std::numeric_limits::max()); - for ( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) - if ( options.fastexport_raw_bayer_method == procparams::RAWParams::BayerSensor::methodstring[i]) { - raw_bayer_method->set_active (i); + for (size_t i = 0; i < RAWParams::BayerSensor::getMethodStrings().size(); ++i) + if (options.fastexport_raw_bayer_method == procparams::RAWParams::BayerSensor::getMethodStrings()[i]) { + raw_bayer_method->set_active(i); break; } // X-Trans demosaic method - raw_xtrans_method->set_active (procparams::RAWParams::XTransSensor::numMethods); + raw_xtrans_method->set_active(std::numeric_limits::max()); - for ( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) - if ( options.fastexport_raw_xtrans_method == procparams::RAWParams::XTransSensor::methodstring[i]) { - raw_xtrans_method->set_active (i); + for (size_t i = 0; i < procparams::RAWParams::XTransSensor::getMethodStrings().size(); ++i) + if (options.fastexport_raw_xtrans_method == procparams::RAWParams::XTransSensor::getMethodStrings()[i]) { + raw_xtrans_method->set_active(i); break; } diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 5b52ce9d2..2b57aa470 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -111,13 +111,14 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi flatFieldBlurTypeconn.block (true); //flatFieldBlurType - for( size_t i = 0; i < procparams::RAWParams::numFlatFileBlurTypes; i++) - if( pp->raw.ff_BlurType == procparams::RAWParams::ff_BlurTypestring[i]) { + for (size_t i = 0; i < procparams::RAWParams::getFlatFieldBlurTypeStrings().size(); ++i) { + if (pp->raw.ff_BlurType == procparams::RAWParams::getFlatFieldBlurTypeStrings()[i]) { flatFieldBlurType->set_active(i); break; } + } - if (multiImage || pp->raw.ff_BlurType == procparams::RAWParams::ff_BlurTypestring[procparams::RAWParams::area_ff]) { + if (multiImage || pp->raw.ff_BlurType == procparams::RAWParams::getFlatFieldBlurTypeString(procparams::RAWParams::FlatFieldBlurType::AREA)) { flatFieldClipControl->show(); } else { flatFieldClipControl->hide(); @@ -135,7 +136,7 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi flatFieldClipControl->setAutoInconsistent(multiImage && !pedited->raw.ff_AutoClipControl); if( !pedited->raw.ff_BlurType ) { - flatFieldBlurType->set_active(procparams::RAWParams::numFlatFileBlurTypes); // No name + flatFieldBlurType->set_active(std::numeric_limits::max()); // No name } } @@ -216,8 +217,8 @@ void FlatField::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedit int currentRow = flatFieldBlurType->get_active_row_number(); - if( currentRow >= 0 && currentRow < procparams::RAWParams::numFlatFileBlurTypes) { - pp->raw.ff_BlurType = procparams::RAWParams::ff_BlurTypestring[currentRow]; + if( currentRow >= 0 && currentRow < std::numeric_limits::max()) { + pp->raw.ff_BlurType = procparams::RAWParams::getFlatFieldBlurTypeStrings()[currentRow]; } if (pedited) { @@ -226,7 +227,7 @@ void FlatField::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedit pedited->raw.ff_BlurRadius = flatFieldBlurRadius->getEditedState (); pedited->raw.ff_clipControl = flatFieldClipControl->getEditedState (); pedited->raw.ff_AutoClipControl = !flatFieldClipControl->getAutoInconsistent(); - pedited->raw.ff_BlurType = flatFieldBlurType->get_active_row_number() != procparams::RAWParams::numFlatFileBlurTypes; + pedited->raw.ff_BlurType = flatFieldBlurType->get_active_row_number() != std::numeric_limits::max(); } } @@ -336,15 +337,16 @@ void FlatField::flatFieldFile_Reset() void FlatField::flatFieldBlurTypeChanged () { - int curSelection = flatFieldBlurType->get_active_row_number(); + const int curSelection = flatFieldBlurType->get_active_row_number(); + const RAWParams::FlatFieldBlurType blur_type = RAWParams::FlatFieldBlurType(curSelection); - Glib::ustring s = ""; + Glib::ustring s; - if( curSelection >= 0 && curSelection < procparams::RAWParams::numFlatFileBlurTypes) { + if (curSelection >= 0 && curSelection < std::numeric_limits::max()) { s = flatFieldBlurType->get_active_text(); } - if (multiImage || curSelection == procparams::RAWParams::area_ff) { + if (multiImage || blur_type == procparams::RAWParams::FlatFieldBlurType::AREA) { flatFieldClipControl->show(); } else { flatFieldClipControl->hide(); diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 558b0fe6b..a9dd35466 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -314,33 +314,33 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = toneCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::STD; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::WEIGHTEDSTD; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::FILMLIKE; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::SATANDVALBLENDING; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::LUMINANCE; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::PERCEPTUAL; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::PERCEPTUAL; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::STD; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::WEIGHTEDSTD; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::FILMLIKE; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::SATANDVALBLENDING; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::LUMINANCE; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::PERCEPTUAL; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::PERCEPTUAL; } if (pedited) { diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index fc6a880f3..7dbc02b4e 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -163,12 +163,12 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB // Assign the model to the Combobox method->set_model(refTreeModel); - WBEntry::Type oldType = WBParams::wbEntries[0].type; + WBEntry::Type oldType = WBParams::getWbEntries()[0].type; WBEntry::Type currType; Gtk::TreeModel::Row row, childrow; - for (unsigned int i = 0; i < WBParams::wbEntries.size(); i++) { - if (oldType != (currType = WBParams::wbEntries[i].type)) { + for (unsigned int i = 0; i < WBParams::getWbEntries().size(); i++) { + if (oldType != (currType = WBParams::getWbEntries()[i].type)) { // New entry type if (currType == WBEntry::Type::FLUORESCENT) { // Creating the Fluorescent subcategory header @@ -219,12 +219,12 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB ) { childrow = *(refTreeModel->append(row.children())); childrow[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; - childrow[methodColumns.colLabel] = WBParams::wbEntries[i].GUILabel; + childrow[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; childrow[methodColumns.colId] = i; } else { row = *(refTreeModel->append()); row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; - row[methodColumns.colLabel] = WBParams::wbEntries[i].GUILabel; + row[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; row[methodColumns.colId] = i; } @@ -441,7 +441,7 @@ void WhiteBalance::optChanged () tempBias->setEditedState (UnEdited); } else { unsigned int methodId = findWBEntryId (row[methodColumns.colLabel], WBLT_GUI); - const WBEntry& currMethod = WBParams::wbEntries[methodId]; + const WBEntry& currMethod = WBParams::getWbEntries()[methodId]; tempBias->set_sensitive(currMethod.type == WBEntry::Type::AUTO); @@ -740,7 +740,7 @@ void WhiteBalance::setBatchMode (bool batchMode) equal->showEditedCB (); tempBias->showEditedCB (); Gtk::TreeModel::Row row = *(refTreeModel->append()); - row[methodColumns.colId] = WBParams::wbEntries.size(); + row[methodColumns.colId] = WBParams::getWbEntries().size(); row[methodColumns.colLabel] = M("GENERAL_UNCHANGED"); } @@ -810,8 +810,8 @@ void WhiteBalance::cache_customWB(int temp, double green) unsigned int WhiteBalance::findWBEntryId (const Glib::ustring& label, enum WB_LabelType lblType) { - for (unsigned int i = 0; i < WBParams::wbEntries.size(); i++) { - if (label == (lblType == WBLT_GUI ? WBParams::wbEntries[i].GUILabel : WBParams::wbEntries[i].ppLabel)) { + for (unsigned int i = 0; i < WBParams::getWbEntries().size(); i++) { + if (label == (lblType == WBLT_GUI ? WBParams::getWbEntries()[i].GUILabel : WBParams::getWbEntries()[i].ppLabel)) { return i; } } @@ -821,13 +821,13 @@ unsigned int WhiteBalance::findWBEntryId (const Glib::ustring& label, enum WB_La std::pair WhiteBalance::findWBEntry(const Glib::ustring& label, enum WB_LabelType lblType) { - for (unsigned int i = 0; i < WBParams::wbEntries.size(); ++i) { - if (label == (lblType == WBLT_GUI ? WBParams::wbEntries[i].GUILabel : WBParams::wbEntries[i].ppLabel)) { - return {true, WBParams::wbEntries[i]}; + for (unsigned int i = 0; i < WBParams::getWbEntries().size(); ++i) { + if (label == (lblType == WBLT_GUI ? WBParams::getWbEntries()[i].GUILabel : WBParams::getWbEntries()[i].ppLabel)) { + return {true, WBParams::getWbEntries()[i]}; } } - return {false, WBParams::wbEntries[0]}; + return {false, WBParams::getWbEntries()[0]}; } int WhiteBalance::_setActiveMethod(Glib::ustring &label, Gtk::TreeModel::Children &children) diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index 453f0a53d..bf986202f 100644 --- a/rtgui/xtransprocess.cc +++ b/rtgui/xtransprocess.cc @@ -29,11 +29,11 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); method = Gtk::manage (new MyComboBoxText ()); - for( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) { + for (const auto method_string : RAWParams::XTransSensor::getMethodStrings()) { const std::string langKey = - [i]() -> std::string + [method_string]() -> std::string { - const std::string str(procparams::RAWParams::XTransSensor::methodstring[i]); + const std::string str(method_string); std::string res; for (const auto& c : str) { @@ -83,10 +83,10 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param disableListener (); methodconn.block (true); - method->set_active(procparams::RAWParams::XTransSensor::numMethods); + method->set_active(std::numeric_limits::max()); - for( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) - if( pp->raw.xtranssensor.method == procparams::RAWParams::XTransSensor::methodstring[i]) { + for (size_t i = 0; i < RAWParams::XTransSensor::getMethodStrings().size(); ++i) + if( pp->raw.xtranssensor.method == RAWParams::XTransSensor::getMethodStrings()[i]) { method->set_active(i); oldSelection = i; break; @@ -96,7 +96,7 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param ccSteps->setEditedState (pedited->raw.xtranssensor.ccSteps ? Edited : UnEdited); if( !pedited->raw.xtranssensor.method ) { - method->set_active(procparams::RAWParams::XTransSensor::numMethods); // No name + method->set_active(std::numeric_limits::max()); // No name } } @@ -113,12 +113,12 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p int currentRow = method->get_active_row_number(); - if( currentRow >= 0 && currentRow < procparams::RAWParams::XTransSensor::numMethods) { - pp->raw.xtranssensor.method = procparams::RAWParams::XTransSensor::methodstring[currentRow]; + if (currentRow >= 0 && currentRow < std::numeric_limits::max()) { + pp->raw.xtranssensor.method = procparams::RAWParams::XTransSensor::getMethodStrings()[currentRow]; } if (pedited) { - pedited->raw.xtranssensor.method = method->get_active_row_number() != procparams::RAWParams::XTransSensor::numMethods; + pedited->raw.xtranssensor.method = method->get_active_row_number() != std::numeric_limits::max(); pedited->raw.xtranssensor.ccSteps = ccSteps->getEditedState (); } } @@ -126,7 +126,7 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p void XTransProcess::setBatchMode(bool batchMode) { method->append (M("GENERAL_UNCHANGED")); - method->set_active(procparams::RAWParams::XTransSensor::numMethods); // No name + method->set_active(std::numeric_limits::max()); // No name ToolPanel::setBatchMode (batchMode); ccSteps->showEditedCB (); } @@ -153,15 +153,16 @@ void XTransProcess::adjusterChanged (Adjuster* a, double newval) void XTransProcess::methodChanged () { - int curSelection = method->get_active_row_number(); + const int curSelection = method->get_active_row_number(); + const RAWParams::XTransSensor::Method method = RAWParams::XTransSensor::Method(curSelection); - Glib::ustring methodName = ""; + Glib::ustring methodName; bool ppreq = false; - if( curSelection >= 0 && curSelection < procparams::RAWParams::XTransSensor::numMethods) { - methodName = procparams::RAWParams::XTransSensor::methodstring[curSelection]; + if (curSelection >= 0 && curSelection < std::numeric_limits::max()) { + methodName = RAWParams::XTransSensor::getMethodStrings()[curSelection]; - if (curSelection == procparams::RAWParams::XTransSensor::mono || oldSelection == procparams::RAWParams::XTransSensor::mono) { + if (method == RAWParams::XTransSensor::Method::NONE || RAWParams::XTransSensor::Method(oldSelection) == RAWParams::XTransSensor::Method::NONE) { ppreq = true; } } From 0a9d81bc7f8db488dfae559f59fb8731f88556c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Fri, 17 Nov 2017 17:19:40 +0100 Subject: [PATCH 06/47] Fix wrong *Sensor::Method::NONE for MONO substitution --- rtengine/procparams.cc | 19 +------------------ rtengine/rawimagesource.cc | 12 ++++++------ rtgui/xtransprocess.cc | 2 +- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 5494aecdd..92db5f34a 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + #include #include @@ -437,7 +438,6 @@ void RetinexParams::getCurves (RetinextransmissionCurve &transmissionCurveLUT, R } - void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) { double v[16] = { 0.00, 0.1, 0.35, 0.00, @@ -446,7 +446,6 @@ void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) 1.00, 0.1, 0.00, 0.00 }; - curve.resize (17); curve.at (0 ) = double (FCT_MinMaxCPoints); @@ -455,7 +454,6 @@ void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) } } - void RetinexParams::getDefaulttransmissionCurve (std::vector &curve) { double v[12] = { 0.00, 0.50, 0.35, 0.35, @@ -463,7 +461,6 @@ void RetinexParams::getDefaulttransmissionCurve (std::vector &curve) 1.00, 0.50, 0.35, 0.35, }; - curve.resize (13); curve.at (0 ) = double (FCT_MinMaxCPoints); @@ -655,15 +652,10 @@ void ColorToningParams::mixerToCurve (std::vector &colorCurve, std::vect high[0] = high[1] = high[2] = 1.f; } - - - const double xPosLow = 0.1; const double xPosMed = 0.4; const double xPosHigh = 0.7; - - colorCurve.resize ( medSat != 0.f ? 13 : 9 ); colorCurve.at (0) = FCT_MinMaxCPoints; opacityCurve.resize (13); @@ -808,7 +800,6 @@ void ColorToningParams::getDefaultColorCurve (std::vector &curve) } } - void ColorToningParams::getDefaultOpacityCurve (std::vector &curve) { double v[16] = { 0.00, 0.3, 0.35, 0.00, @@ -882,7 +873,6 @@ VibranceParams::VibranceParams() : { } - const std::vector& WBParams::getWbEntries() { static const std::vector wb_entries = { @@ -1291,7 +1281,6 @@ void WaveletParams::getDefaultOpacityCurveBY (std::vector &curve) }; } - void WaveletParams::getDefaultOpacityCurveW (std::vector &curve) { curve = { @@ -1330,7 +1319,6 @@ void WaveletParams::getDefaultOpacityCurveWL (std::vector &curve) }; } - DirPyrEqualizerParams::DirPyrEqualizerParams() : hueskin (20, 80, 2000, 1200, false) { @@ -1721,7 +1709,6 @@ void ProcParams::setDefaults () cacorrection.red = 0; cacorrection.blue = 0; - vignetting.amount = 0; vignetting.radius = 50; vignetting.strength = 1; @@ -1781,7 +1768,6 @@ void ProcParams::setDefaults () dirpyrequalizer.gamutlab = false; dirpyrequalizer.cbdlMethod = "bef"; - for (int i = 0; i < 6; i ++) { dirpyrequalizer.mult[i] = 1.0; } @@ -1873,7 +1859,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->retinex.slope, "Retinex", "Slope", retinex.slope, keyFile); saveToKeyfile(!pedited || pedited->retinex.medianmap, "Retinex", "Median", retinex.medianmap, keyFile); - saveToKeyfile(!pedited || pedited->retinex.neigh, "Retinex", "Neigh", retinex.neigh, keyFile); saveToKeyfile(!pedited || pedited->retinex.offs, "Retinex", "Offs", retinex.offs, keyFile); saveToKeyfile(!pedited || pedited->retinex.vart, "Retinex", "Vart", retinex.vart, keyFile); @@ -2766,11 +2751,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Retinex", "TransmissionCurve", pedited, retinex.transmissionCurve, pedited->retinex.transmissionCurve); - assignFromKeyfile(keyFile, "Retinex", "GainTransmissionCurve", pedited, retinex.gaintransmissionCurve, pedited->retinex.gaintransmissionCurve); } - if (keyFile.has_group ("Luminance Curve")) { assignFromKeyfile(keyFile, "Luminance Curve", "Brightness", pedited, labCurve.brightness, pedited->labCurve.brightness); assignFromKeyfile(keyFile, "Luminance Curve", "Contrast", pedited, labCurve.contrast, pedited->labCurve.contrast); diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 998d5e72e..7cc231cf5 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -650,8 +650,8 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima const float new_pre_mul[4] = { ri->get_pre_mul(0) / rm, ri->get_pre_mul(1) / gm, ri->get_pre_mul(2) / bm, ri->get_pre_mul(3) / gm }; float new_scale_mul[4]; - bool isMono = (ri->getSensorType() == ST_FUJI_XTRANS && raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) - || (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE)); + bool isMono = (ri->getSensorType() == ST_FUJI_XTRANS && raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::MONO)) + || (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::MONO)); float gain = calculate_scale_mul(new_scale_mul, new_pre_mul, c_white, cblacksom, isMono, ri->get_colors()); rm = new_scale_mul[0] / scale_mul[0] * gain; gm = new_scale_mul[1] / scale_mul[1] * gain; @@ -2047,7 +2047,7 @@ void RawImageSource::demosaic(const RAWParams &raw) lmmse_interpolate_omp(W, H, rawData, red, green, blue, raw.bayersensor.lmmse_iterations); } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST) ) { fast_demosaic (0, 0, W, H); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::MONO) ) { nodemosaic(true); } else { nodemosaic(false); @@ -2062,7 +2062,7 @@ void RawImageSource::demosaic(const RAWParams &raw) xtrans_interpolate(1, false); } else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::THREE_PASS) ) { xtrans_interpolate(3, true); - } else if(raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) ) { + } else if(raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::MONO) ) { nodemosaic(true); } else { nodemosaic(false); @@ -3429,7 +3429,7 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R black_lev[2] = raw.bayersensor.black2; //B black_lev[3] = raw.bayersensor.black3; //G2 - isMono = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) == raw.bayersensor.method; + isMono = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::MONO) == raw.bayersensor.method; } else if (getSensorType() == ST_FUJI_XTRANS) { black_lev[0] = raw.xtranssensor.blackred; //R @@ -3437,7 +3437,7 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R black_lev[2] = raw.xtranssensor.blackblue; //B black_lev[3] = raw.xtranssensor.blackgreen; //G2 (set, only used with a Bayer filter) - isMono = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) == raw.xtranssensor.method; + isMono = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::MONO) == raw.xtranssensor.method; } for(int i = 0; i < 4 ; i++) { diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index bf986202f..9e0c94ea0 100644 --- a/rtgui/xtransprocess.cc +++ b/rtgui/xtransprocess.cc @@ -162,7 +162,7 @@ void XTransProcess::methodChanged () if (curSelection >= 0 && curSelection < std::numeric_limits::max()) { methodName = RAWParams::XTransSensor::getMethodStrings()[curSelection]; - if (method == RAWParams::XTransSensor::Method::NONE || RAWParams::XTransSensor::Method(oldSelection) == RAWParams::XTransSensor::Method::NONE) { + if (method == RAWParams::XTransSensor::Method::MONO || RAWParams::XTransSensor::Method(oldSelection) == RAWParams::XTransSensor::Method::MONO) { ppreq = true; } } From 05505803ae81f18aae3e3c46e949d85cc8c9d1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Sat, 18 Nov 2017 19:07:23 +0100 Subject: [PATCH 07/47] C'tor init for `(ToneCurve|Retinex|LCurve|ColorToning)Params` --- rtengine/procparams.cc | 433 ++++++++++++++++++++--------------------- rtengine/procparams.h | 17 +- rtgui/colortoning.cc | 15 +- rtgui/retinex.cc | 8 +- 4 files changed, 226 insertions(+), 247 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 92db5f34a..8e25f50bf 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -349,86 +349,119 @@ bool operator ==(const rtengine::procparams::DirPyrEqualizerParams& a, const rte return a.threshold == b.threshold; } -ToneCurveParams::ToneCurveParams() +ToneCurveParams::ToneCurveParams() : + autoexp(false), + clip(0.02), + hrenabled(false), + method("Blend"), + expcomp(0), + curve{ + DCT_Linear + }, + curve2{ + DCT_Linear + }, + curveMode(ToneCurveParams::TcMode::STD), + curveMode2(ToneCurveParams::TcMode::STD), + brightness(0), + black(0), + contrast(0), + saturation(0), + shcompr(50), + hlcompr(0), + hlcomprthresh(33) { - setDefaults(); } -void ToneCurveParams::setDefaults() +bool ToneCurveParams::HLReconstructionNecessary(const LUTu& histRedRaw, const LUTu& histGreenRaw, const LUTu& histBlueRaw) { - autoexp = false; - clip = 0.02; - expcomp = 0; - brightness = 0; - contrast = 0; - saturation = 0; - black = 0; - hlcompr = 0; - hlcomprthresh = 33; - shcompr = 50; - curve.clear (); - curve.push_back (DCT_Linear); - curve2.clear (); - curve2.push_back (DCT_Linear); - curveMode = ToneCurveParams::TcMode::STD; - curveMode2 = ToneCurveParams::TcMode::STD; - hrenabled = false; - method = "Blend"; -} - -bool ToneCurveParams::HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw) -{ - if (options.rtSettings.verbose) - printf ("histRedRaw[ 0]=%07d, histGreenRaw[ 0]=%07d, histBlueRaw[ 0]=%07d\nhistRedRaw[255]=%07d, histGreenRaw[255]=%07d, histBlueRaw[255]=%07d\n", + if (options.rtSettings.verbose) { + printf("histRedRaw[ 0]=%07d, histGreenRaw[ 0]=%07d, histBlueRaw[ 0]=%07d\nhistRedRaw[255]=%07d, histGreenRaw[255]=%07d, histBlueRaw[255]=%07d\n", histRedRaw[0], histGreenRaw[0], histBlueRaw[0], histRedRaw[255], histGreenRaw[255], histBlueRaw[255]); + } - return histRedRaw[255] > 50 || histGreenRaw[255] > 50 || histBlueRaw[255] > 50 || histRedRaw[0] > 50 || histGreenRaw[0] > 50 || histBlueRaw[0] > 50; + return + histRedRaw[255] > 50 + || histGreenRaw[255] > 50 + || histBlueRaw[255] > 50 + || histRedRaw[0] > 50 + || histGreenRaw[0] > 50 + || histBlueRaw[0] > 50; } -RetinexParams::RetinexParams () +RetinexParams::RetinexParams() : + enabled(false), + cdcurve{ + DCT_Linear + }, + cdHcurve{ + DCT_Linear + }, + lhcurve{ + DCT_Linear + }, + transmissionCurve{ + FCT_MinMaxCPoints, + 0.00, + 0.50, + 0.35, + 0.35, + 0.60, + 0.75, + 0.35, + 0.35, + 1.00, + 0.50, + 0.35, + 0.35 + }, + gaintransmissionCurve{ + FCT_MinMaxCPoints, + 0.00, + 0.1, + 0.35, + 0.00, + 0.25, + 0.25, + 0.35, + 0.35, + 0.70, + 0.25, + 0.35, + 0.35, + 1.00, + 0.1, + 0.00, + 0.00 + }, + mapcurve{ + DCT_Linear + }, + str(20), + scal(3), + iter(1), + grad(1), + grads(1), + gam(1.30), + slope(3.), + neigh(80), + offs(0), + highlights(0), + htonalwidth(80), + shadows(0), + stonalwidth(80), + radius(40), + retinexMethod("high"), + retinexcolorspace("Lab"), + gammaretinex("none"), + mapMethod("none"), + viewMethod("none"), + vart(200), + limd(8), + highl(4), + skal(3), + medianmap(false) { - setDefaults (); -} - -void RetinexParams::setDefaults() -{ - enabled = false; - str = 20; - scal = 3; - iter = 1; - grad = 1; - grads = 1; - gam = 1.30; - slope = 3.; - neigh = 80; - offs = 0; - vart = 200; - limd = 8; - highl = 4; - highlights = 0; - htonalwidth = 80; - shadows = 0; - stonalwidth = 80; - radius = 40; - - skal = 3; - retinexMethod = "high"; - mapMethod = "none"; - viewMethod = "none"; - retinexcolorspace = "Lab"; - gammaretinex = "none"; - medianmap = false; - cdcurve.clear(); - cdcurve.push_back (DCT_Linear); - cdHcurve.clear(); - cdHcurve.push_back (DCT_Linear); - lhcurve.clear(); - lhcurve.push_back (DCT_Linear); - mapcurve.clear(); - mapcurve.push_back (DCT_Linear); - getDefaultgaintransmissionCurve (gaintransmissionCurve); - - getDefaulttransmissionCurve (transmissionCurve); } void RetinexParams::getCurves (RetinextransmissionCurve &transmissionCurveLUT, RetinexgaintransmissionCurve &gaintransmissionCurveLUT) const @@ -438,73 +471,115 @@ void RetinexParams::getCurves (RetinextransmissionCurve &transmissionCurveLUT, R } -void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) +LCurveParams::LCurveParams() : + lcurve{ + DCT_Linear + }, + acurve{ + DCT_Linear + }, + bcurve{ + DCT_Linear + }, + cccurve{ + DCT_Linear + }, + chcurve{ + FCT_Linear + }, + lhcurve{ + FCT_Linear + }, + hhcurve{ + FCT_Linear + }, + lccurve{ + DCT_Linear + }, + clcurve{ + DCT_Linear + }, + brightness(0), + contrast(0), + chromaticity(0), + avoidcolorshift(false), + rstprotection(0), + lcredsk(true) { - double v[16] = { 0.00, 0.1, 0.35, 0.00, - 0.25, 0.25, 0.35, 0.35, - 0.70, 0.25, 0.35, 0.35, - 1.00, 0.1, 0.00, 0.00 - }; - - curve.resize (17); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } } -void RetinexParams::getDefaulttransmissionCurve (std::vector &curve) +ColorToningParams::ColorToningParams () : + enabled(false), + autosat(true), + opacityCurve{ + FCT_MinMaxCPoints, + 0.00, + 0.3, + 0.35, + 0.00, + 0.25, + 0.8, + 0.35, + 0.35, + 0.70, + 0.8, + 0.35, + 0.35, + 1.00, + 0.3, + 0.00, + 0.00 + }, + colorCurve{ + FCT_MinMaxCPoints, + 0.050, + 0.62, + 0.25, + 0.25, + 0.585, + 0.11, + 0.25, + 0.25 + }, + satProtectionThreshold(30), + saturatedOpacity(80), + strength(50), + balance(0), + hlColSat(60, 80, false), + shadowsColSat (80, 208, false), + clcurve{ + DCT_NURBS, + 0.00, + 0.00, + 0.35, + 0.65, + 1.00, + 1.00 + }, + cl2curve{ + DCT_NURBS, + 0.00, + 0.00, + 0.35, + 0.65, + 1.00, + 1.00 + }, + method("Lab"), + twocolor("Std"), + redlow(0.0), + greenlow(0.0), + bluelow(0.0), + redmed(0.0), + greenmed(0.0), + bluemed(0.0), + redhigh(0.0), + greenhigh(0.0), + bluehigh(0.0), + satlow(0.0), + sathigh(0.0), + lumamode(true) { - double v[12] = { 0.00, 0.50, 0.35, 0.35, - 0.60, 0.75, 0.35, 0.35, - 1.00, 0.50, 0.35, 0.35, - }; - - curve.resize (13); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - -// Maps crop to resized width (e.g. smaller previews) -ColorToningParams::ColorToningParams () : hlColSat (60, 80, false), shadowsColSat (80, 208, false) -{ - setDefaults(); -} - -void ColorToningParams::setDefaults() -{ - enabled = false; - autosat = true; - method = "Lab"; - - getDefaultColorCurve (colorCurve); - getDefaultOpacityCurve (opacityCurve); - getDefaultCLCurve (clcurve); - getDefaultCL2Curve (cl2curve); - - hlColSat.setValues (60, 80); - shadowsColSat.setValues (80, 208); - balance = 0; - satProtectionThreshold = 30; - saturatedOpacity = 80; - strength = 50; - lumamode = true; - twocolor = "Std"; - redlow = 0.0; - greenlow = 0.0; - bluelow = 0.0; - satlow = 0.0; - sathigh = 0.0; - redmed = 0.0; - greenmed = 0.0; - bluemed = 0.0; - redhigh = 0.0; - greenhigh = 0.0; - bluehigh = 0.0; } void ColorToningParams::mixerToCurve (std::vector &colorCurve, std::vector &opacityCurve) const @@ -786,65 +861,6 @@ void ColorToningParams::getCurves (ColorGradientCurve &colorCurveLUT, OpacityCur } } -void ColorToningParams::getDefaultColorCurve (std::vector &curve) -{ - double v[8] = { 0.050, 0.62, 0.25, 0.25, - 0.585, 0.11, 0.25, 0.25 - }; - - curve.resize (9); - curve.at (0) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - -void ColorToningParams::getDefaultOpacityCurve (std::vector &curve) -{ - double v[16] = { 0.00, 0.3, 0.35, 0.00, - 0.25, 0.8, 0.35, 0.35, - 0.70, 0.8, 0.35, 0.35, - 1.00, 0.3, 0.00, 0.00 - }; - curve.resize (17); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - -void ColorToningParams::getDefaultCLCurve (std::vector &curve) -{ - double v[6] = { 0.00, 0.00, - 0.35, 0.65, - 1.00, 1.00 - }; - - curve.resize (7); - curve.at (0) = double (DCT_NURBS); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - -void ColorToningParams::getDefaultCL2Curve (std::vector &curve) -{ - double v[6] = { 0.00, 0.00, - 0.35, 0.65, - 1.00, 1.00 - }; - - curve.resize (7); - curve.at (0) = double (DCT_NURBS); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - SharpeningParams::SharpeningParams() : enabled (false), radius (0.5), @@ -1481,34 +1497,9 @@ ProcParams::ProcParams () void ProcParams::setDefaults () { + toneCurve = ToneCurveParams(); - toneCurve.setDefaults(); - - labCurve.brightness = 0; - labCurve.contrast = 0; - labCurve.chromaticity = 0; - labCurve.avoidcolorshift = false; - labCurve.lcredsk = true; - labCurve.rstprotection = 0; - labCurve.lcurve.clear (); - labCurve.lcurve.push_back (DCT_Linear); - labCurve.acurve.clear (); - labCurve.acurve.push_back (DCT_Linear); - labCurve.bcurve.clear (); - labCurve.bcurve.push_back (DCT_Linear); - labCurve.cccurve.clear (); - labCurve.cccurve.push_back (DCT_Linear); - labCurve.chcurve.clear (); - labCurve.chcurve.push_back (FCT_Linear); - labCurve.lhcurve.clear (); - labCurve.lhcurve.push_back (FCT_Linear); - labCurve.hhcurve.clear (); - labCurve.hhcurve.push_back (FCT_Linear); - - labCurve.lccurve.clear (); - labCurve.lccurve.push_back (DCT_Linear); - labCurve.clcurve.clear (); - labCurve.clcurve.push_back (DCT_Linear); + labCurve = LCurveParams(); rgbCurves.lumamode = false; rgbCurves.rcurve.clear (); @@ -1518,7 +1509,7 @@ void ProcParams::setDefaults () rgbCurves.bcurve.clear (); rgbCurves.bcurve.push_back (DCT_Linear); - colorToning.setDefaults(); + colorToning = ColorToningParams(); sharpenEdge.enabled = false; sharpenEdge.passes = 2; diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 09dc6b07d..77965156f 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -283,8 +283,7 @@ struct ToneCurveParams { ToneCurveParams(); - void setDefaults(); - static bool HLReconstructionNecessary(LUTu& histRedRaw, LUTu& histGreenRaw, LUTu& histBlueRaw); + static bool HLReconstructionNecessary(const LUTu& histRedRaw, const LUTu& histGreenRaw, const LUTu& histBlueRaw); }; /** @@ -326,12 +325,8 @@ struct RetinexParams bool medianmap; RetinexParams(); - void setDefaults(); + void getCurves(RetinextransmissionCurve& transmissionCurveLUT, RetinexgaintransmissionCurve& gaintransmissionCurveLUT) const; - - static void getDefaultgaintransmissionCurve (std::vector& curve); - - static void getDefaulttransmissionCurve (std::vector& curve); }; @@ -355,6 +350,8 @@ struct LCurveParams bool avoidcolorshift; double rstprotection; bool lcredsk; + + LCurveParams(); }; /** @@ -417,7 +414,6 @@ struct ColorToningParams { bool lumamode; ColorToningParams(); - void setDefaults(); // SHOULD BE GENERALIZED TO ALL CLASSES! /// @brief Transform the mixer values to their curve equivalences void mixerToCurve(std::vector& colorCurve, std::vector& opacityCurve) const; @@ -425,11 +421,6 @@ struct ColorToningParams { void slidersToCurve(std::vector& colorCurve, std::vector& opacityCurve) const; /// @brief Fill the ColorGradientCurve and OpacityCurve LUTf from the control points curve or sliders value void getCurves(ColorGradientCurve& colorCurveLUT, OpacityCurve& opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3], bool& opautili) const; - - static void getDefaultColorCurve(std::vector& curve); - static void getDefaultOpacityCurve(std::vector& curve); - static void getDefaultCLCurve(std::vector& curve); - static void getDefaultCL2Curve(std::vector& curve); }; /** diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index 786030a73..c5d9252cd 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -54,14 +54,14 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR colorShape->setLeftBarBgGradient(milestones); + const ColorToningParams default_params; + // luminance gradient milestones.clear(); milestones.push_back( GradientMilestone(0., 0., 0., 0.) ); milestones.push_back( GradientMilestone(1., 1., 1., 1.) ); colorShape->setBottomBarBgGradient(milestones); - std::vector defaultCurve; - rtengine::ColorToningParams::getDefaultColorCurve(defaultCurve); - colorShape->setResetCurve(FCT_MinMaxCPoints, defaultCurve); + colorShape->setResetCurve(FCT_MinMaxCPoints, default_params.colorCurve); // This will add the reset button at the end of the curveType buttons colorCurveEditorG->curveListComplete(); @@ -88,10 +88,9 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR opacityCurveEditorG = new CurveEditorGroup (options.lastColorToningCurvesDir, M("TP_COLORTONING_OPACITY")); opacityCurveEditorG->setCurveListener (this); - rtengine::ColorToningParams::getDefaultOpacityCurve(defaultCurve); opacityShape = static_cast(opacityCurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); opacityShape->setIdentityValue(0.); - opacityShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShape->setResetCurve(FlatCurveType(default_params.opacityCurve.at(0)), default_params.opacityCurve); opacityShape->setBottomBarBgGradient(milestones); // This will add the reset button at the end of the curveType buttons @@ -107,9 +106,8 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR clCurveEditorG = new CurveEditorGroup (options.lastColorToningCurvesDir, M("TP_COLORTONING_CHROMAC")); clCurveEditorG->setCurveListener (this); - rtengine::ColorToningParams::getDefaultCLCurve(defaultCurve); clshape = static_cast(clCurveEditorG->addCurve(CT_Diagonal, M("TP_COLORTONING_AB"), irg, false)); - clshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + clshape->setResetCurve(DiagonalCurveType(default_params.clcurve.at(0)), default_params.clcurve); clshape->setTooltip(M("TP_COLORTONING_CURVEEDITOR_CL_TOOLTIP")); clshape->setLeftBarColorProvider(this, 1); @@ -127,9 +125,8 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR cl2CurveEditorG = new CurveEditorGroup (options.lastColorToningCurvesDir, M("TP_COLORTONING_CHROMAC")); cl2CurveEditorG->setCurveListener (this); - rtengine::ColorToningParams::getDefaultCL2Curve(defaultCurve); cl2shape = static_cast(cl2CurveEditorG->addCurve(CT_Diagonal, M("TP_COLORTONING_BY"), iby, false)); - cl2shape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + cl2shape->setResetCurve(DiagonalCurveType(default_params.cl2curve.at(0)), default_params.cl2curve); cl2shape->setTooltip(M("TP_COLORTONING_CURVEEDITOR_CL_TOOLTIP")); cl2shape->setLeftBarColorProvider(this, 1); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index bf88a85e4..320c91fd5 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -380,14 +380,15 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL") Gtk::Grid *tranGrid = Gtk::manage (new Gtk::Grid()); setExpandAlignProperties (tranGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + const RetinexParams default_params; + // Transmission map curve transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M ("TP_RETINEX_TRANSMISSION")); setExpandAlignProperties (transmissionCurveEditorG, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); transmissionCurveEditorG->setCurveListener (this); - rtengine::RetinexParams::getDefaulttransmissionCurve (defaultCurve); transmissionShape = static_cast (transmissionCurveEditorG->addCurve (CT_Flat, "", nullptr, false, false)); transmissionShape->setIdentityValue (0.); - transmissionShape->setResetCurve (FlatCurveType (defaultCurve.at (0)), defaultCurve); + transmissionShape->setResetCurve (FlatCurveType (default_params.transmissionCurve.at (0)), default_params.transmissionCurve); // transmissionShape->setBottomBarBgGradient(milestones); transmissionCurveEditorG->curveListComplete(); transmissionCurveEditorG->set_tooltip_markup (M ("TP_RETINEX_TRANSMISSION_TOOLTIP")); @@ -439,10 +440,9 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL") gaintransmissionCurve = new CurveEditorGroup (options.lastRetinexDir, M ("TP_RETINEX_GAINTRANSMISSION")); setExpandAlignProperties (gaintransmissionCurve, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); gaintransmissionCurve->setCurveListener (this); - rtengine::RetinexParams::getDefaultgaintransmissionCurve (defaultCurve); gaintransmissionShape = static_cast (gaintransmissionCurve->addCurve (CT_Flat, "", nullptr, false, false)); gaintransmissionShape->setIdentityValue (0.); - gaintransmissionShape->setResetCurve (FlatCurveType (defaultCurve.at (0)), defaultCurve); + gaintransmissionShape->setResetCurve (FlatCurveType (default_params.gaintransmissionCurve.at (0)), default_params.gaintransmissionCurve); //gaintransmissionShape->setBottomBarBgGradient(milestones); gaintransmissionCurve->set_tooltip_markup (M ("TP_RETINEX_GAINTRANSMISSION_TOOLTIP")); gaintransmissionCurve->curveListComplete(); From 6410f0579935b1a4075f617871c6d7da5d9c3a77 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sat, 18 Nov 2017 23:45:30 +0100 Subject: [PATCH 08/47] Integrated the RCD demosaic method by Luis Sanz Rodriguez Original code at https://github.com/LuisSR/RCD-Demosaicing --- rtdata/languages/default | 1 + rtengine/demosaic_algos.cc | 280 +++++++++++++++++++++++++++++++++++++ rtengine/procparams.cc | 2 +- rtengine/procparams.h | 2 +- rtengine/rawimagesource.cc | 2 + rtengine/rawimagesource.h | 1 + 6 files changed, 286 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 8320a351b..ba9a11466 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1788,6 +1788,7 @@ TP_RAW_PIXELSHIFTSMOOTH_TOOLTIP;Smooth transitions between areas with motion and TP_RAW_PIXELSHIFTSTDDEVFACTORBLUE;StdDev factor Blue TP_RAW_PIXELSHIFTSTDDEVFACTORGREEN;StdDev factor Green TP_RAW_PIXELSHIFTSTDDEVFACTORRED;StdDev factor Red +TP_RAW_RCD;RCD TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 88d369969..61258fca2 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -3927,6 +3927,286 @@ void RawImageSource::cielab (const float (*rgb)[3], float* l, float* a, float *b } } + +/** +* RATIO CORRECTED DEMOSAICING +* Luis Sanz Rodriguez (luis.sanz.rodriguez(at)gmail(dot)com) +* +* Release 2.2 @ 171117 +*/ +void RawImageSource::rcd_demosaic() +{ + // RT --------------------------------------------------------------------- + if (plistener) { + plistener->setProgressStr(Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), "rcd")); + plistener->setProgress(0); + } + + int width = W, height = H; + + std::vector cfa(width * height); + std::vector> rgb(width * height); + +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int row = 0; row < height; row++) { + for (int col = 0, indx = row * width + col; col < width; col++, indx++) { + int c = FC(row, col); + cfa[indx] = rgb[indx][c] = CLIP(rawData[row][col]) / 65535.f; + } + } + + if (plistener) { + plistener->setProgress(0.05); + } + // ------------------------------------------------------------------------ +/* RT + int row, col, indx, c; +*/ + int w1 = width, w2 = 2 * width, w3 = 3 * width, w4 = 4 * width; + + //Tolerance to avoid dividing by zero + static const float eps = 1e-5, epssq = 1e-10; + +/* RT + //Gradients + float N_Grad, E_Grad, W_Grad, S_Grad, NW_Grad, NE_Grad, SW_Grad, SE_Grad; + + //Pixel estimation + float N_Est, E_Est, W_Est, S_Est, NW_Est, NE_Est, SW_Est, SE_Est, V_Est, H_Est, P_Est, Q_Est; + + //Directional discrimination + //float V_Stat, H_Stat, P_Stat, Q_Stat; + float VH_Central_Value, VH_Neighbour_Value, PQ_Central_Value, PQ_Neighbour_Value; +*/ + float ( *VH_Dir ), ( *VH_Disc ), ( *PQ_Dir ), ( *PQ_Disc ); + + //Low pass filter + float ( *lpf ); + + + /** + * STEP 1: Find cardinal and diagonal interpolation directions + */ + + VH_Dir = ( float ( * ) ) calloc( width * height, sizeof *VH_Dir ); //merror ( VH_Dir, "rcd_demosaicing_171117()" ); + PQ_Dir = ( float ( * ) ) calloc( width * height, sizeof *PQ_Dir ); //merror ( PQ_Dir, "rcd_demosaicing_171117()" ); + +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int row = 4; row < height - 4; row++ ) { + for (int col = 4, indx = row * width + col; col < width - 4; col++, indx++ ) { + + //Calculate h/v local discrimination + float V_Stat = epssq - 18.0f * cfa[indx] * cfa[indx - w1] - 18.0f * cfa[indx] * cfa[indx + w1] - 36.0f * cfa[indx] * cfa[indx - w2] - 36.0f * cfa[indx] * cfa[indx + w2] + 18.0f * cfa[indx] * cfa[indx - w3] + 18.0f * cfa[indx] * cfa[indx + w3] - 2.0f * cfa[indx] * cfa[indx - w4] - 2.0f * cfa[indx] * cfa[indx + w4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1] * cfa[indx + w1] - 12.0f * cfa[indx - w1] * cfa[indx - w2] + 24.0f * cfa[indx - w1] * cfa[indx + w2] - 38.0f * cfa[indx - w1] * cfa[indx - w3] + 16.0f * cfa[indx - w1] * cfa[indx + w3] + 12.0f * cfa[indx - w1] * cfa[indx - w4] - 6.0f * cfa[indx - w1] * cfa[indx + w4] + 46.0f * cfa[indx - w1] * cfa[indx - w1] + 24.0f * cfa[indx + w1] * cfa[indx - w2] - 12.0f * cfa[indx + w1] * cfa[indx + w2] + 16.0f * cfa[indx + w1] * cfa[indx - w3] - 38.0f * cfa[indx + w1] * cfa[indx + w3] - 6.0f * cfa[indx + w1] * cfa[indx - w4] + 12.0f * cfa[indx + w1] * cfa[indx + w4] + 46.0f * cfa[indx + w1] * cfa[indx + w1] + 14.0f * cfa[indx - w2] * cfa[indx + w2] - 12.0f * cfa[indx - w2] * cfa[indx + w3] - 2.0f * cfa[indx - w2] * cfa[indx - w4] + 2.0f * cfa[indx - w2] * cfa[indx + w4] + 11.0f * cfa[indx - w2] * cfa[indx - w2] - 12.0f * cfa[indx + w2] * cfa[indx - w3] + 2.0f * cfa[indx + w2] * cfa[indx - w4] - 2.0f * cfa[indx + w2] * cfa[indx + w4] + 11.0f * cfa[indx + w2] * cfa[indx + w2] + 2.0f * cfa[indx - w3] * cfa[indx + w3] - 6.0f * cfa[indx - w3] * cfa[indx - w4] + 10.0f * cfa[indx - w3] * cfa[indx - w3] - 6.0f * cfa[indx + w3] * cfa[indx + w4] + 10.0f * cfa[indx + w3] * cfa[indx + w3] + 1.0f * cfa[indx - w4] * cfa[indx - w4] + 1.0f * cfa[indx + w4] * cfa[indx + w4]; + float H_Stat = epssq - 18.0f * cfa[indx] * cfa[indx - 1] - 18.0f * cfa[indx] * cfa[indx + 1] - 36.0f * cfa[indx] * cfa[indx - 2] - 36.0f * cfa[indx] * cfa[indx + 2] + 18.0f * cfa[indx] * cfa[indx - 3] + 18.0f * cfa[indx] * cfa[indx + 3] - 2.0f * cfa[indx] * cfa[indx - 4] - 2.0f * cfa[indx] * cfa[indx + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - 1] * cfa[indx + 1] - 12.0f * cfa[indx - 1] * cfa[indx - 2] + 24.0f * cfa[indx - 1] * cfa[indx + 2] - 38.0f * cfa[indx - 1] * cfa[indx - 3] + 16.0f * cfa[indx - 1] * cfa[indx + 3] + 12.0f * cfa[indx - 1] * cfa[indx - 4] - 6.0f * cfa[indx - 1] * cfa[indx + 4] + 46.0f * cfa[indx - 1] * cfa[indx - 1] + 24.0f * cfa[indx + 1] * cfa[indx - 2] - 12.0f * cfa[indx + 1] * cfa[indx + 2] + 16.0f * cfa[indx + 1] * cfa[indx - 3] - 38.0f * cfa[indx + 1] * cfa[indx + 3] - 6.0f * cfa[indx + 1] * cfa[indx - 4] + 12.0f * cfa[indx + 1] * cfa[indx + 4] + 46.0f * cfa[indx + 1] * cfa[indx + 1] + 14.0f * cfa[indx - 2] * cfa[indx + 2] - 12.0f * cfa[indx - 2] * cfa[indx + 3] - 2.0f * cfa[indx - 2] * cfa[indx - 4] + 2.0f * cfa[indx - 2] * cfa[indx + 4] + 11.0f * cfa[indx - 2] * cfa[indx - 2] - 12.0f * cfa[indx + 2] * cfa[indx - 3] + 2.0f * cfa[indx + 2] * cfa[indx - 4] - 2.0f * cfa[indx + 2] * cfa[indx + 4] + 11.0f * cfa[indx + 2] * cfa[indx + 2] + 2.0f * cfa[indx - 3] * cfa[indx + 3] - 6.0f * cfa[indx - 3] * cfa[indx - 4] + 10.0f * cfa[indx - 3] * cfa[indx - 3] - 6.0f * cfa[indx + 3] * cfa[indx + 4] + 10.0f * cfa[indx + 3] * cfa[indx + 3] + 1.0f * cfa[indx - 4] * cfa[indx - 4] + 1.0f * cfa[indx + 4] * cfa[indx + 4]; + + VH_Dir[indx] = V_Stat / (V_Stat + H_Stat); + + //Calculate m/p local discrimination + float P_Stat = epssq - 18.0f * cfa[indx] * cfa[indx - w1 - 1] - 18.0f * cfa[indx] * cfa[indx + w1 + 1] - 36.0f * cfa[indx] * cfa[indx - w2 - 2] - 36.0f * cfa[indx] * cfa[indx + w2 + 2] + 18.0f * cfa[indx] * cfa[indx - w3 - 3] + 18.0f * cfa[indx] * cfa[indx + w3 + 3] - 2.0f * cfa[indx] * cfa[indx - w4 - 4] - 2.0f * cfa[indx] * cfa[indx + w4 + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1 - 1] * cfa[indx + w1 + 1] - 12.0f * cfa[indx - w1 - 1] * cfa[indx - w2 - 2] + 24.0f * cfa[indx - w1 - 1] * cfa[indx + w2 + 2] - 38.0f * cfa[indx - w1 - 1] * cfa[indx - w3 - 3] + 16.0f * cfa[indx - w1 - 1] * cfa[indx + w3 + 3] + 12.0f * cfa[indx - w1 - 1] * cfa[indx - w4 - 4] - 6.0f * cfa[indx - w1 - 1] * cfa[indx + w4 + 4] + 46.0f * cfa[indx - w1 - 1] * cfa[indx - w1 - 1] + 24.0f * cfa[indx + w1 + 1] * cfa[indx - w2 - 2] - 12.0f * cfa[indx + w1 + 1] * cfa[indx + w2 + 2] + 16.0f * cfa[indx + w1 + 1] * cfa[indx - w3 - 3] - 38.0f * cfa[indx + w1 + 1] * cfa[indx + w3 + 3] - 6.0f * cfa[indx + w1 + 1] * cfa[indx - w4 - 4] + 12.0f * cfa[indx + w1 + 1] * cfa[indx + w4 + 4] + 46.0f * cfa[indx + w1 + 1] * cfa[indx + w1 + 1] + 14.0f * cfa[indx - w2 - 2] * cfa[indx + w2 + 2] - 12.0f * cfa[indx - w2 - 2] * cfa[indx + w3 + 3] - 2.0f * cfa[indx - w2 - 2] * cfa[indx - w4 - 4] + 2.0f * cfa[indx - w2 - 2] * cfa[indx + w4 + 4] + 11.0f * cfa[indx - w2 - 2] * cfa[indx - w2 - 2] - 12.0f * cfa[indx + w2 + 2] * cfa[indx - w3 - 3] + 2 * cfa[indx + w2 + 2] * cfa[indx - w4 - 4] - 2.0f * cfa[indx + w2 + 2] * cfa[indx + w4 + 4] + 11.0f * cfa[indx + w2 + 2] * cfa[indx + w2 + 2] + 2.0f * cfa[indx - w3 - 3] * cfa[indx + w3 + 3] - 6.0f * cfa[indx - w3 - 3] * cfa[indx - w4 - 4] + 10.0f * cfa[indx - w3 - 3] * cfa[indx - w3 - 3] - 6.0f * cfa[indx + w3 + 3] * cfa[indx + w4 + 4] + 10.0f * cfa[indx + w3 + 3] * cfa[indx + w3 + 3] + 1.0f * cfa[indx - w4 - 4] * cfa[indx - w4 - 4] + 1.0f * cfa[indx + w4 + 4] * cfa[indx + w4 + 4]; + float Q_Stat = epssq - 18.0f * cfa[indx] * cfa[indx + w1 - 1] - 18.0f * cfa[indx] * cfa[indx - w1 + 1] - 36.0f * cfa[indx] * cfa[indx + w2 - 2] - 36.0f * cfa[indx] * cfa[indx - w2 + 2] + 18.0f * cfa[indx] * cfa[indx + w3 - 3] + 18.0f * cfa[indx] * cfa[indx - w3 + 3] - 2.0f * cfa[indx] * cfa[indx + w4 - 4] - 2.0f * cfa[indx] * cfa[indx - w4 + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx + w1 - 1] * cfa[indx - w1 + 1] - 12.0f * cfa[indx + w1 - 1] * cfa[indx + w2 - 2] + 24.0f * cfa[indx + w1 - 1] * cfa[indx - w2 + 2] - 38.0f * cfa[indx + w1 - 1] * cfa[indx + w3 - 3] + 16.0f * cfa[indx + w1 - 1] * cfa[indx - w3 + 3] + 12.0f * cfa[indx + w1 - 1] * cfa[indx + w4 - 4] - 6.0f * cfa[indx + w1 - 1] * cfa[indx - w4 + 4] + 46.0f * cfa[indx + w1 - 1] * cfa[indx + w1 - 1] + 24.0f * cfa[indx - w1 + 1] * cfa[indx + w2 - 2] - 12.0f * cfa[indx - w1 + 1] * cfa[indx - w2 + 2] + 16.0f * cfa[indx - w1 + 1] * cfa[indx + w3 - 3] - 38.0f * cfa[indx - w1 + 1] * cfa[indx - w3 + 3] - 6.0f * cfa[indx - w1 + 1] * cfa[indx + w4 - 4] + 12.0f * cfa[indx - w1 + 1] * cfa[indx - w4 + 4] + 46.0f * cfa[indx - w1 + 1] * cfa[indx - w1 + 1] + 14.0f * cfa[indx + w2 - 2] * cfa[indx - w2 + 2] - 12.0f * cfa[indx + w2 - 2] * cfa[indx - w3 + 3] - 2.0f * cfa[indx + w2 - 2] * cfa[indx + w4 - 4] + 2.0f * cfa[indx + w2 - 2] * cfa[indx - w4 + 4] + 11.0f * cfa[indx + w2 - 2] * cfa[indx + w2 - 2] - 12.0f * cfa[indx - w2 + 2] * cfa[indx + w3 - 3] + 2 * cfa[indx - w2 + 2] * cfa[indx + w4 - 4] - 2.0f * cfa[indx - w2 + 2] * cfa[indx - w4 + 4] + 11.0f * cfa[indx - w2 + 2] * cfa[indx - w2 + 2] + 2.0f * cfa[indx + w3 - 3] * cfa[indx - w3 + 3] - 6.0f * cfa[indx + w3 - 3] * cfa[indx + w4 - 4] + 10.0f * cfa[indx + w3 - 3] * cfa[indx + w3 - 3] - 6.0f * cfa[indx - w3 + 3] * cfa[indx - w4 + 4] + 10.0f * cfa[indx - w3 + 3] * cfa[indx - w3 + 3] + 1.0f * cfa[indx + w4 - 4] * cfa[indx + w4 - 4] + 1.0f * cfa[indx - w4 + 4] * cfa[indx - w4 + 4]; + + PQ_Dir[indx] = P_Stat / ( P_Stat + Q_Stat ); + + } + } + + // RT --------------------------------------------------------------------- + if (plistener) { + plistener->setProgress(0.2); + } + // ------------------------------------------------------------------------- + + + VH_Disc = ( float ( * ) ) calloc( width * height, sizeof *VH_Disc ); //merror ( VH_Disc, "rcd_demosaicing_171117()" ); + PQ_Disc = ( float ( * ) ) calloc( width * height, sizeof *PQ_Disc ); //merror ( PQ_Disc, "rcd_demosaicing_171117()" ); + +#ifdef _OPENMP + #pragma omp parallel for +#endif + for ( int row = 4; row < height - 4; row++ ) { + for ( int col = 4, indx = row * width + col; col < width - 4; col++, indx++ ) { + + //Refined h/v local discrimination + float VH_Central_Value = VH_Dir[indx]; + float VH_Neighbour_Value = 0.25f * (VH_Dir[indx - w1 - 1] + VH_Dir[indx - w1 + 1] + VH_Dir[indx + w1 - 1] + VH_Dir[indx + w1 + 1]); + + VH_Disc[indx] = ( fabs( 0.5f - VH_Central_Value ) < fabs( 0.5f - VH_Neighbour_Value ) ) ? VH_Neighbour_Value : VH_Central_Value; + + //Refined m/p local discrimination + float PQ_Central_Value = PQ_Dir[indx]; + float PQ_Neighbour_Value = 0.25f * (PQ_Dir[indx - w1 - 1] + PQ_Dir[indx - w1 + 1] + PQ_Dir[indx + w1 - 1] + PQ_Dir[indx + w1 + 1]); + + PQ_Disc[indx] = ( fabs( 0.5f - PQ_Central_Value ) < fabs( 0.5f - PQ_Neighbour_Value ) ) ? PQ_Neighbour_Value : PQ_Central_Value; + + } + } + + free( VH_Dir ); + free( PQ_Dir ); + + // RT --------------------------------------------------------------------- + if (plistener) { + plistener->setProgress(0.4); + } + // ------------------------------------------------------------------------ + + /** + * STEP 2: Calculate the low pass filter + */ + + lpf = ( float ( * ) ) calloc( width * height, sizeof *lpf ); //merror ( lpf, "rcd_demosaicing_171117()" ); + +#ifdef _OPENMP + #pragma omp parallel for +#endif + for ( int row = 1; row < height - 1; row++ ) { + for ( int col = 1, indx = row * width + col; col < width - 1; col++, indx++ ) { + + //Low pass filter incorporating red and blue local samples + lpf[indx] = 0.25f * cfa[indx] + 0.125f * ( cfa[indx - w1] + cfa[indx + w1] + cfa[indx - 1] + cfa[indx + 1] ) + 0.0625f * ( cfa[indx - w1 - 1] + cfa[indx - w1 + 1] + cfa[indx + w1 - 1] + cfa[indx + w1 + 1] ); + + } + } + + // RT --------------------------------------------------------------------- + if (plistener) { + plistener->setProgress(0.5); + } + // ------------------------------------------------------------------------ + + /** + * STEP 3: Populate the green channel + */ +#ifdef _OPENMP + #pragma omp parallel for +#endif + for ( int row = 4; row < height - 4; row++ ) { + for ( int col = 4 + ( FC( row, 0 )&1 ), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { + + //Cardinal gradients + float N_Grad = eps + fabs( cfa[indx - w1] - cfa[indx + w1] ) + fabs( cfa[indx] - cfa[indx - w2] ) + fabs( cfa[indx - w1] - cfa[indx - w3] ) + fabs( cfa[indx - w2] - cfa[indx - w4] ); + float S_Grad = eps + fabs( cfa[indx + w1] - cfa[indx - w1] ) + fabs( cfa[indx] - cfa[indx + w2] ) + fabs( cfa[indx + w1] - cfa[indx + w3] ) + fabs( cfa[indx + w2] - cfa[indx + w4] ); + float W_Grad = eps + fabs( cfa[indx - 1] - cfa[indx + 1] ) + fabs( cfa[indx] - cfa[indx - 2] ) + fabs( cfa[indx - 1] - cfa[indx - 3] ) + fabs( cfa[indx - 2] - cfa[indx - 4] ); + float E_Grad = eps + fabs( cfa[indx + 1] - cfa[indx - 1] ) + fabs( cfa[indx] - cfa[indx + 2] ) + fabs( cfa[indx + 1] - cfa[indx + 3] ) + fabs( cfa[indx + 2] - cfa[indx + 4] ); + + //Cardinal pixel estimations + float N_Est = cfa[indx - w1] * ( 1.f + ( lpf[indx] - lpf[indx - w2] ) / ( eps + lpf[indx] + lpf[indx - w2] ) ); + float S_Est = cfa[indx + w1] * ( 1.f + ( lpf[indx] - lpf[indx + w2] ) / ( eps + lpf[indx] + lpf[indx + w2] ) ); + float W_Est = cfa[indx - 1] * ( 1.f + ( lpf[indx] - lpf[indx - 2] ) / ( eps + lpf[indx] + lpf[indx - 2] ) ); + float E_Est = cfa[indx + 1] * ( 1.f + ( lpf[indx] - lpf[indx + 2] ) / ( eps + lpf[indx] + lpf[indx + 2] ) ); + + //Interpolate G@R & G@B + float V_Est = ( S_Grad * N_Est + N_Grad * S_Est ) / ( N_Grad + S_Grad ); + float H_Est = ( W_Grad * E_Est + E_Grad * W_Est ) / ( E_Grad + W_Grad ); + + rgb[indx][1] = LIM( VH_Disc[indx] * H_Est + ( 1.0f - VH_Disc[indx] ) * V_Est, 0.f, 1.f ); + + } + } + + free( lpf ); + + // RT --------------------------------------------------------------------- + if (plistener) { + plistener->setProgress(0.7); + } + // ------------------------------------------------------------------------- + + /** + * STEP 4: Populate the red and blue channel + */ +#ifdef _OPENMP + #pragma omp parallel for +#endif + for ( int row = 4; row < height - 4; row++ ) { + for ( int col = 4 + ( FC( row, 0 )&1 ), indx = row * width + col, c = 2 - FC( row, col ); col < width - 4; col += 2, indx += 2 ) { + + //Diagonal gradients + float NW_Grad = eps + fabs( rgb[indx - w1 - 1][c] - rgb[indx + w1 + 1][c] ) + fabs( rgb[indx - w1 - 1][c] - rgb[indx - w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 - 2][1] ); + float NE_Grad = eps + fabs( rgb[indx - w1 + 1][c] - rgb[indx + w1 - 1][c] ) + fabs( rgb[indx - w1 + 1][c] - rgb[indx - w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 + 2][1] ); + float SW_Grad = eps + fabs( rgb[indx + w1 - 1][c] - rgb[indx - w1 + 1][c] ) + fabs( rgb[indx + w1 - 1][c] - rgb[indx + w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 - 2][1] ); + float SE_Grad = eps + fabs( rgb[indx + w1 + 1][c] - rgb[indx - w1 - 1][c] ) + fabs( rgb[indx + w1 + 1][c] - rgb[indx + w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 + 2][1] ); + + //Diagonal colour differences + float NW_Est = rgb[indx - w1 - 1][c] - rgb[indx - w1 - 1][1]; + float NE_Est = rgb[indx - w1 + 1][c] - rgb[indx - w1 + 1][1]; + float SW_Est = rgb[indx + w1 - 1][c] - rgb[indx + w1 - 1][1]; + float SE_Est = rgb[indx + w1 + 1][c] - rgb[indx + w1 + 1][1]; + + //Interpolate R@B and B@R + float P_Est = ( NW_Grad * SE_Est + SE_Grad * NW_Est ) / ( NW_Grad + SE_Grad ); + float Q_Est = ( NE_Grad * SW_Est + SW_Grad * NE_Est ) / ( NE_Grad + SW_Grad ); + + rgb[indx][c] = LIM( rgb[indx][1] + ( 1.0f - PQ_Disc[indx] ) * P_Est + PQ_Disc[indx] * Q_Est, 0.f, 1.f ); + + } + } + + // RT --------------------------------------------------------------------- + if (plistener) { + plistener->setProgress(0.825); + } + // ------------------------------------------------------------------------- + +#ifdef _OPENMP + #pragma omp parallel for +#endif + for ( int row = 4; row < height - 4; row++ ) { + for ( int col = 4 + ( FC( row, 1 )&1 ), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { + + for ( int c = 0; c <= 2; c += 2 ) { + + //Cardinal gradients + float N_Grad = eps + fabs( rgb[indx][1] - rgb[indx - w2][1] ) + fabs( rgb[indx - w1][c] - rgb[indx + w1][c] ) + fabs( rgb[indx - w1][c] - rgb[indx - w3][c] ); + float S_Grad = eps + fabs( rgb[indx][1] - rgb[indx + w2][1] ) + fabs( rgb[indx + w1][c] - rgb[indx - w1][c] ) + fabs( rgb[indx + w1][c] - rgb[indx + w3][c] ); + float W_Grad = eps + fabs( rgb[indx][1] - rgb[indx - 2][1] ) + fabs( rgb[indx - 1][c] - rgb[indx + 1][c] ) + fabs( rgb[indx - 1][c] - rgb[indx - 3][c] ); + float E_Grad = eps + fabs( rgb[indx][1] - rgb[indx + 2][1] ) + fabs( rgb[indx + 1][c] - rgb[indx - 1][c] ) + fabs( rgb[indx + 1][c] - rgb[indx + 3][c] ); + + //Cardinal colour differences + float N_Est = rgb[indx - w1][c] - rgb[indx - w1][1]; + float S_Est = rgb[indx + w1][c] - rgb[indx + w1][1]; + float W_Est = rgb[indx - 1][c] - rgb[indx - 1][1]; + float E_Est = rgb[indx + 1][c] - rgb[indx + 1][1]; + + //Interpolate R@G and B@G + float V_Est = ( N_Grad * S_Est + S_Grad * N_Est ) / ( N_Grad + S_Grad ); + float H_Est = ( E_Grad * W_Est + W_Grad * E_Est ) / ( E_Grad + W_Grad ); + + rgb[indx][c] = LIM( rgb[indx][1] + ( 1.0f - VH_Disc[indx] ) * V_Est + VH_Disc[indx] * H_Est, 0.f, 1.f ); + + } + } + } + + free( PQ_Disc ); + free( VH_Disc ); + + // RT --------------------------------------------------------------------- + if (plistener) { + plistener->setProgress(0.95); + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int row = 0; row < height; ++row) { + for (int col = 0, idx = row * width + col ; col < width; ++col, ++idx) { + red[row][col] = CLIP(rgb[idx][0] * 65535.f); + green[row][col] = CLIP(rgb[idx][1] * 65535.f); + blue[row][col] = CLIP(rgb[idx][2] * 65535.f); + } + } + + if (plistener) { + plistener->setProgress(1); + } + // ------------------------------------------------------------------------- +} + #define fcol(row,col) xtrans[(row)%6][(col)%6] #define isgreen(row,col) (xtrans[(row)%3][(col)%3]&1) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 0ada68a62..0447da364 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -53,7 +53,7 @@ const int tl = (int) options.rtSettings.top_left; const int bl = (int) options.rtSettings.bot_left; const char *LensProfParams::methodstring[static_cast(LensProfParams::LcMode::LCP) + 1u] = {"none", "lfauto", "lfmanual", "lcp"}; -const char *RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::numMethods] = {"amaze", "igv", "lmmse", "eahd", "hphd", "vng4", "dcb", "ahd", "fast", "mono", "none", "pixelshift" }; +const char *RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::numMethods] = {"amaze", "igv", "lmmse", "eahd", "hphd", "vng4", "dcb", "ahd", "rcd", "fast", "mono", "none", "pixelshift" }; const char *RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::numMethods] = {"3-pass (best)", "1-pass (medium)", "fast", "mono", "none" }; const char *RAWParams::ff_BlurTypestring[RAWParams::numFlatFileBlurTypes] = {/*"Parametric",*/ "Area Flatfield", "Vertical Flatfield", "Horizontal Flatfield", "V+H Flatfield"}; diff --git a/rtengine/procparams.h b/rtengine/procparams.h index b3139cdcb..d7ebd1921 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1262,7 +1262,7 @@ public: public: //enum eMethod{ eahd,hphd,vng4,dcb,amaze,ahd,IGV_noise,fast, //numMethods }; // This MUST be the last enum - enum eMethod { amaze, igv, lmmse, eahd, hphd, vng4, dcb, ahd, fast, mono, none, pixelshift, + enum eMethod { amaze, igv, lmmse, eahd, hphd, vng4, dcb, ahd, rcd, fast, mono, none, pixelshift, numMethods }; // This MUST be the last enum enum ePSMotionCorrection { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 5eb7aa7b9..a6b6d4b53 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -2049,6 +2049,8 @@ void RawImageSource::demosaic(const RAWParams &raw) fast_demosaic(); } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono] ) { nodemosaic(true); + } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::rcd] ) { + rcd_demosaic (); } else { nodemosaic(false); } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index d2ce77fed..4924b955a 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -248,6 +248,7 @@ protected: void fast_demosaic();//Emil's code for fast demosaicing void dcb_demosaic(int iterations, bool dcb_enhance); void ahd_demosaic(); + void rcd_demosaic(); void border_interpolate(unsigned int border, float (*image)[4], unsigned int start = 0, unsigned int end = 0); void border_interpolate2(int winw, int winh, int lborders); void dcb_initTileLimits(int &colMin, int &rowMin, int &colMax, int &rowMax, int x0, int y0, int border); From 3673f1392c1b19a232a4decf5b1f5b78aae974fd Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 19 Nov 2017 00:43:12 +0100 Subject: [PATCH 09/47] added reference to the original repo and license for the RCD demosaic code --- rtengine/demosaic_algos.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 61258fca2..1f89ce31f 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -3933,6 +3933,9 @@ void RawImageSource::cielab (const float (*rgb)[3], float* l, float* a, float *b * Luis Sanz Rodriguez (luis.sanz.rodriguez(at)gmail(dot)com) * * Release 2.2 @ 171117 +* +* Original code from https://github.com/LuisSR/RCD-Demosaicing +* Licensed under the GNU GPL version 3 */ void RawImageSource::rcd_demosaic() { From 95d303f442ced402068e0670255aeff22dc86ff1 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 19 Nov 2017 18:47:16 +0100 Subject: [PATCH 10/47] turn off parallelization of step 4 of rcd as the arrays are read and written, doing parallel operations properly requires some deeper analysis of the code. For now, let's simply disable them. We can always optimize later --- rtengine/demosaic_algos.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 1f89ce31f..0eb920a36 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -4122,9 +4122,6 @@ void RawImageSource::rcd_demosaic() /** * STEP 4: Populate the red and blue channel */ -#ifdef _OPENMP - #pragma omp parallel for -#endif for ( int row = 4; row < height - 4; row++ ) { for ( int col = 4 + ( FC( row, 0 )&1 ), indx = row * width + col, c = 2 - FC( row, col ); col < width - 4; col += 2, indx += 2 ) { @@ -4155,9 +4152,6 @@ void RawImageSource::rcd_demosaic() } // ------------------------------------------------------------------------- -#ifdef _OPENMP - #pragma omp parallel for -#endif for ( int row = 4; row < height - 4; row++ ) { for ( int col = 4 + ( FC( row, 1 )&1 ), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { From 5734e546d8300dc144241d54f1d5ec80ac0d3628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Mon, 20 Nov 2017 20:26:23 +0100 Subject: [PATCH 11/47] C'tor init for the rest of the Params --- rtengine/procparams.cc | 1124 +++++++++++++++++++++------------------- rtengine/procparams.h | 74 ++- rtgui/wavelet.cc | 17 +- 3 files changed, 640 insertions(+), 575 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 8e25f50bf..370fa5bd6 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -508,6 +508,20 @@ LCurveParams::LCurveParams() : { } +RGBCurvesParams::RGBCurvesParams() : + lumamode(false), + rcurve{ + DCT_Linear + }, + gcurve{ + DCT_Linear + }, + bcurve{ + DCT_Linear + } +{ +} + ColorToningParams::ColorToningParams () : enabled(false), autosat(true), @@ -862,30 +876,59 @@ void ColorToningParams::getCurves (ColorGradientCurve &colorCurveLUT, OpacityCur } SharpeningParams::SharpeningParams() : - enabled (false), - radius (0.5), - amount (200), - threshold (20, 80, 2000, 1200, false), - edgesonly (false), - edges_radius (1.9), - edges_tolerance (1800), - halocontrol (false), - halocontrol_amount (85), - deconvamount (75), - deconvradius (0.75), - deconviter (30), - deconvdamping (20) + enabled(false), + radius(0.5), + amount(200), + threshold(20, 80, 2000, 1200, false), + edgesonly(false), + edges_radius(1.9), + edges_tolerance(1800), + halocontrol(false), + halocontrol_amount(85), + method("usm"), + deconvamount(75), + deconvradius(0.75), + deconviter(30), + deconvdamping(20) +{ +} + +SharpenEdgeParams::SharpenEdgeParams() : + enabled(false), + passes(2), + amount(50.0), + threechannels(false) +{ +} + +SharpenMicroParams::SharpenMicroParams() : + enabled(false), + matrix(false), + amount(20.0), + uniformity(50.0) { } VibranceParams::VibranceParams() : - enabled (false), - pastels (0), - saturated (0), - psthreshold (0, 75, false), - protectskins (false), - avoidcolorshift (true), - pastsattog (true) + enabled(false), + pastels(0), + saturated(0), + psthreshold(0, 75, false), + protectskins(false), + avoidcolorshift(true), + pastsattog(true), + skintonescurve{ + DCT_Linear + } +{ +} + +WBParams::WBParams() : + method("Camera"), + temperature(6504), + green(1.0), + equal(1.0), + tempBias(0.0) { } @@ -931,16 +974,98 @@ const std::vector& WBParams::getWbEntries() return wb_entries; } -DirPyrDenoiseParams::DirPyrDenoiseParams () +ColorAppearanceParams::ColorAppearanceParams() : + enabled(false), + degree(90), + autodegree(true), + degreeout(90), + autodegreeout(true), + curve{ + DCT_Linear + }, + curve2{ + DCT_Linear + }, + curve3{ + DCT_Linear + }, + curveMode(TcMode::LIGHT), + curveMode2(TcMode::LIGHT), + curveMode3(CtcMode::CHROMA), + surround("Average"), + surrsrc("Average"), + adapscen(2000.0), + autoadapscen(true), + ybscen(18), + autoybscen(true), + adaplum(16), + badpixsl(0), + wbmodel("RawT"), + algo("No"), + contrast(0.0), + qcontrast(0.0), + jlight(0.0), + qbright(0.0), + chroma(0.0), + schroma(0.0), + mchroma(0.0), + colorh(0.0), + rstprotection(0.0), + surrsource(false), + gamut(true), + datacie(false), + tonecie(false), + tempout(5000), + ybout(18), + greenout(1.0), + tempsc(5000), + greensc(1.0) { - setDefaults (); } -void DirPyrDenoiseParams::setDefaults() +DefringeParams::DefringeParams() : + enabled(false), + radius(2.0), + threshold(13), + huecurve{ + FCT_MinMaxCPoints, + 0.166666667, + 0., + 0.35, + 0.35, + 0.347, + 0., + 0.35, + 0.35, + 0.513667426, + 0, + 0.35, + 0.35, + 0.668944571, + 0., + 0.35, + 0.35, + 0.8287775246, + 0.97835991, + 0.35, + 0.35, + 0.9908883827, + 0., + 0.35, + 0.35 + } { +} - lcurve = { - static_cast(FCT_MinMaxCPoints), +ImpulseDenoiseParams::ImpulseDenoiseParams() : + enabled(false), + thresh(50) +{ +} + +DirPyrDenoiseParams::DirPyrDenoiseParams() : + lcurve{ + FCT_MinMaxCPoints, 0.05, 0.15, 0.35, @@ -949,10 +1074,9 @@ void DirPyrDenoiseParams::setDefaults() 0.04, 0.35, 0.35 - }; - - cccurve = { - static_cast(FCT_MinMaxCPoints), + }, + cccurve{ + FCT_MinMaxCPoints, 0.05, 0.50, 0.35, @@ -961,28 +1085,27 @@ void DirPyrDenoiseParams::setDefaults() 0.05, 0.35, 0.35 - }; - - enabled = false; - enhance = false; - median = false; - perform = false; - luma = 0; - passes = 1; - dmethod = "Lab"; - Lmethod = "SLI";//"CUR";// SLIDER method with value 0 is set as default, while the default Lcurve is populated via getDefaultNoisCurve and can be switched to by the user - Cmethod = "MAN"; - C2method = "AUTO"; - smethod = "shal"; - medmethod = "soft"; - methodmed = "none"; - rgbmethod = "soft"; - Ldetail = 0; - chroma = 15; - redchro = 0; - bluechro = 0; - gamma = 1.7; - perform = false; + }, + enabled(false), + enhance(false), + median(false), + perform(false), + luma(0), + Ldetail(0), + chroma(15), + redchro(0), + bluechro(0), + gamma(1.7), + dmethod("Lab"), + Lmethod("SLI"), + Cmethod("MAN"), + C2method("AUTO"), + smethod("shal"), + medmethod("soft"), + methodmed("none"), + rgbmethod("soft"), + passes(1) +{ } void DirPyrDenoiseParams::getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) const @@ -991,25 +1114,45 @@ void DirPyrDenoiseParams::getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) con cCurve.Set (this->cccurve); } -FattalToneMappingParams::FattalToneMappingParams() +EPDParams::EPDParams() : + enabled(false), + strength(0.5), + gamma(1.0), + edgeStopping(1.4), + scale(1.0), + reweightingIterates(0) { - setDefaults(); } -void FattalToneMappingParams::setDefaults() +FattalToneMappingParams::FattalToneMappingParams() : + enabled(false), + threshold(0), + amount(0) +{ +} + +SHParams::SHParams() : + enabled(false), + hq(false), + highlights(0), + htonalwidth(80), + shadows(0), + stonalwidth(80), + localcontrast(0), + radius(40) { - enabled = false; - threshold = 0; - amount = 0; } CropParams::CropParams() : enabled(false), - x(0), - y(0), - w(0), - h(0), - fixratio(false) + x(-1), + y(-1), + w(15000), + h(15000), + fixratio(true), + ratio("3:2"), + orientation("As Image"), + guide("Frame") { } @@ -1018,39 +1161,41 @@ void CropParams::mapToResized (int resizedWidth, int resizedHeight, int scale, i x1 = 0, x2 = resizedWidth, y1 = 0, y2 = resizedHeight; if (enabled) { - x1 = min (resizedWidth - 1, max (0, x / scale)); - y1 = min (resizedHeight - 1, max (0, y / scale)); - x2 = min (resizedWidth, max (0, (x + w) / scale)); - y2 = min (resizedHeight, max (0, (y + h) / scale)); + x1 = min(resizedWidth - 1, max (0, x / scale)); + y1 = min(resizedHeight - 1, max (0, y / scale)); + x2 = min(resizedWidth, max (0, (x + w) / scale)); + y2 = min(resizedHeight, max (0, (y + h) / scale)); } } -CoarseTransformParams::CoarseTransformParams() +CoarseTransformParams::CoarseTransformParams() : + rotate(0), + hflip(false), + vflip(false) { - setDefaults(); } -void CoarseTransformParams::setDefaults() +CommonTransformParams::CommonTransformParams() : + autofill(true) { - rotate = 0; - hflip = false; - vflip = false; } -LensProfParams::LensProfParams() +RotateParams::RotateParams() : + degree(0.0) { - setDefaults(); } -void LensProfParams::setDefaults() +DistortionParams::DistortionParams() : + amount(0.0) +{ +} + +LensProfParams::LensProfParams() : + lcMode(LcMode::NONE), + useDist(true), + useVign(true), + useCA(false) { - lcMode = LcMode::NONE; - lcpFile = ""; - useDist = useVign = true; - useCA = false; - lfCameraMake = ""; - lfCameraModel = ""; - lfLens = ""; } bool LensProfParams::useLensfun() const @@ -1099,157 +1244,130 @@ LensProfParams::LcMode LensProfParams::getMethodNumber(const Glib::ustring& mode return LcMode::NONE; } -const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring ("No ICM: sRGB output"); - -ColorManagementParams::ColorManagementParams() +PerspectiveParams::PerspectiveParams() : + horizontal(0.0), + vertical(0.0) { - setDefaults(); } -void ColorManagementParams::setDefaults() +GradientParams::GradientParams() : + enabled(false), + degree(0.0), + feather(25), + strength(0.60), + centerX(0), + centerY(0) +{ +} + +PCVignetteParams::PCVignetteParams() : + enabled(false), + strength(0.60), + feather(50), + roundness(50) +{ +} + +VignettingParams::VignettingParams() : + amount(0), + radius(50), + strength(1), + centerX(0), + centerY(0) +{ +} + +ChannelMixerParams::ChannelMixerParams() : + red{ + 100, + 0, + 0 + }, + green{ + 0, + 100, + 0 + }, + blue{ + 0, + 0, + 100 + } +{ +} + +BlackWhiteParams::BlackWhiteParams() : + beforeCurve{ + DCT_Linear + }, + beforeCurveMode(BlackWhiteParams::TcMode::STD_BW), + afterCurve{ + DCT_Linear + }, + afterCurveMode(BlackWhiteParams::TcMode::STD_BW), + algo("SP"), + luminanceCurve{ + FCT_Linear + }, + autoc(false), + enabledcc(true), + enabled(false), + filter("None"), + setting("NormalContrast"), + method("Desaturation"), + mixerRed(33), + mixerOrange(33), + mixerYellow(33), + mixerGreen(33), + mixerCyan(33), + mixerBlue(33), + mixerMagenta(33), + mixerPurple(33), + gammaRed(0), + gammaGreen(0), + gammaBlue(0) +{ +} + +CACorrParams::CACorrParams() : + red(0.0), + blue(0.0) +{ +} + +ResizeParams::ResizeParams() : + enabled(false), + scale(1.0), + appliesTo("Cropped area"), + method("Lanczos"), + dataspec(3), + width(900), + height(900) +{ +} + +const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring ("No ICM: sRGB output"); + +ColorManagementParams::ColorManagementParams() : + input("(cameraICC)"), + toneCurve(false), + applyLookTable(false), + applyBaselineExposureOffset(true), + applyHueSatMap(true), + dcpIlluminant(0), + working("ProPhoto"), + output("RT_sRGB"), + outputIntent(RI_RELATIVE), + outputBPC(true), + gamma("default"), + gampos(2.22), + slpos(4.5), + freegamma(false) { - input = "(cameraICC)"; - toneCurve = false; - applyLookTable = false; - applyBaselineExposureOffset = true; - applyHueSatMap = true; - dcpIlluminant = 0; - working = "ProPhoto"; - output = "RT_sRGB"; - outputIntent = RI_RELATIVE; - outputBPC = true; - gamma = "default"; - gampos = 2.22; - slpos = 4.5; - freegamma = false; } WaveletParams::WaveletParams() : - hueskin ( -5, 25, 170, 120, false), - hueskin2 (-260, -250, -130, -140, false), - hllev ( 50, 75, 100, 98, false), - bllev ( 0, 2, 50, 25, false), - pastlev ( 0, 2, 30, 20, false), - satlev ( 30, 45, 130, 100, false), - edgcont ( bl, tl, br, tr, false), - /*edgcont ( 0, 10, 75, 40, false),*/ - level0noise (0, 0, false), - level1noise (0, 0, false), - level2noise (0, 0, false), - level3noise (0, 0, false) -{ - setDefaults (); -} - -void WaveletParams::setDefaults() -{ - getDefaultCCWCurve (ccwcurve); - getDefaultOpacityCurveRG (opacityCurveRG); - getDefaultOpacityCurveBY (opacityCurveBY); - getDefaultOpacityCurveW (opacityCurveW); - getDefaultOpacityCurveWL (opacityCurveWL); - enabled = false; - median = false; - medianlev = false; - linkedg = true; - cbenab = false; - lipst = false; - Medgreinf = "less"; //"none"; - avoid = false; - tmr = false; - strength = 100; - balance = 0; - iter = 0; - wavclCurve.clear (); - wavclCurve.push_back (DCT_Linear); - - Lmethod = "4_"; - CHmethod = "without"; - CHSLmethod = "SL"; - EDmethod = "CU"; - NPmethod = "none"; - BAmethod = "none"; - TMmethod = "cont"; - HSmethod = "with"; - CLmethod = "all"; - Backmethod = "grey"; - Dirmethod = "all"; - Tilesmethod = "full"; - daubcoeffmethod = "4_"; - rescon = 0; - resconH = 0; - reschro = 0; - tmrs = 0; - gamma = 1; - sky = 0.; - sup = 0; - thres = 7; - chroma = 5; - chro = 0; - contrast = 0; - edgrad = 15; - edgval = 0; - edgthresh = 10; - thr = 35; - thrH = 65; - skinprotect = 0.; - hueskin.setValues ( -5, 25, 170, 120); - hueskin2.setValues (-260, -250, -130, -140); - threshold = 5; - threshold2 = 4; - edgedetect = 90; - edgedetectthr = 20; - edgedetectthr2 = 0; - edgesensi = 60; - edgeampli = 10; - hllev.setValues (50, 75, 100, 98); - bllev.setValues ( 0, 2, 50, 25); - pastlev.setValues ( 0, 2, 30, 20); - satlev.setValues (30, 45, 130, 100); - //edgcont.setValues (bl, tl, br, tr); - edgcont.setValues ( 0, 10, 75, 40); - level0noise.setValues (0, 0); - level1noise.setValues (0, 0); - level2noise.setValues (0, 0); - level3noise.setValues (0, 0); - hhcurve.clear (); - hhcurve.push_back (FCT_Linear); - Chcurve.clear (); - Chcurve.push_back (FCT_Linear); - expcontrast = false; - expchroma = false; - expedge = false; - expresid = false; - expfinal = false; - exptoning = false; - expnoise = false; - - for (int i = 0; i < 9; i ++) { - c[i] = 0; - } - - for (int i = 0; i < 9; i ++) { - ch[i] = 0; - } - - greenlow = greenmed = greenhigh = 0.0; - bluelow = bluemed = bluehigh = 0.0; - -} - -void WaveletParams::getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG, WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const -{ - cCurve.Set (this->ccwcurve); - opacityCurveLUTRG.Set (this->opacityCurveRG); - opacityCurveLUTBY.Set (this->opacityCurveBY); - opacityCurveLUTW.Set (this->opacityCurveW); - opacityCurveLUTWL.Set (this->opacityCurveWL); - -} - -void WaveletParams::getDefaultCCWCurve (std::vector &curve) -{ - curve = { + ccwcurve{ static_cast(FCT_MinMaxCPoints), 0.0, 0.25, @@ -1263,13 +1381,8 @@ void WaveletParams::getDefaultCCWCurve (std::vector &curve) 0.0, 0.35, 0.35 - }; - -} - -void WaveletParams::getDefaultOpacityCurveRG (std::vector &curve) -{ - curve = { + }, + opacityCurveRG{ static_cast(FCT_MinMaxCPoints), 0.0, 0.50, @@ -1279,12 +1392,8 @@ void WaveletParams::getDefaultOpacityCurveRG (std::vector &curve) 0.50, 0.35, 0.35 - }; -} - -void WaveletParams::getDefaultOpacityCurveBY (std::vector &curve) -{ - curve = { + }, + opacityCurveBY{ static_cast(FCT_MinMaxCPoints), 0.0, 0.50, @@ -1294,12 +1403,8 @@ void WaveletParams::getDefaultOpacityCurveBY (std::vector &curve) 0.50, 0.35, 0.35 - }; -} - -void WaveletParams::getDefaultOpacityCurveW (std::vector &curve) -{ - curve = { + }, + opacityCurveW{ static_cast(FCT_MinMaxCPoints), 0.00, 0.35, @@ -1317,12 +1422,8 @@ void WaveletParams::getDefaultOpacityCurveW (std::vector &curve) 0.35, 0.00, 0.00 - }; -} - -void WaveletParams::getDefaultOpacityCurveWL (std::vector &curve) -{ - curve = { + }, + opacityCurveWL{ static_cast(FCT_MinMaxCPoints), 0.0, 0.50, @@ -1332,24 +1433,186 @@ void WaveletParams::getDefaultOpacityCurveWL (std::vector &curve) 0.50, 0.35, 0.35 - }; + }, + hhcurve{ + FCT_Linear + }, + Chcurve{ + FCT_Linear + }, + wavclCurve { + DCT_Linear + }, + enabled(false), + median(false), + medianlev(false), + linkedg(true), + cbenab(false), + greenlow(0), + bluelow(0), + greenmed(0), + bluemed(0), + greenhigh(0), + bluehigh(0), + lipst(false), + avoid(false), + tmr(false), + strength(100), + balance(0), + iter(0), + expcontrast(false), + expchroma(false), + c{}, + ch{}, + expedge(false), + expresid(false), + expfinal(false), + exptoning(false), + expnoise(false), + Lmethod("4_"), + CLmethod("all"), + Backmethod("grey"), + Tilesmethod("full"), + daubcoeffmethod("4_"), + CHmethod("without"), + Medgreinf("less"), + CHSLmethod("SL"), + EDmethod("CU"), + NPmethod("none"), + BAmethod("none"), + TMmethod("cont"), + Dirmethod("all"), + HSmethod("with"), + rescon(0), + resconH(0), + reschro(0), + tmrs(0), + gamma(1), + sup(0), + sky(0.0), + thres(7), + chroma(5), + chro(0), + threshold(5), + threshold2(4), + edgedetect(90), + edgedetectthr(20), + edgedetectthr2(0), + edgesensi(60), + edgeampli(10), + contrast(0), + edgrad(15), + edgval(0), + edgthresh(10), + thr(35), + thrH(65), + skinprotect(0.0), + hueskin(-5, 25, 170, 120, false), + hueskin2(-260, -250, -130, -140, false), + hllev(50, 75, 100, 98, false), + bllev(0, 2, 50, 25, false), + pastlev(0, 2, 30, 20, false), + satlev(30, 45, 130, 100, false), + edgcont(0, 10, 75, 40, false), + level0noise(0, 0, false), + level1noise(0, 0, false), + level2noise(0, 0, false), + level3noise(0, 0, false) +{ +} + +void WaveletParams::getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG, WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const +{ + cCurve.Set (this->ccwcurve); + opacityCurveLUTRG.Set (this->opacityCurveRG); + opacityCurveLUTBY.Set (this->opacityCurveBY); + opacityCurveLUTW.Set (this->opacityCurveW); + opacityCurveLUTWL.Set (this->opacityCurveWL); + } DirPyrEqualizerParams::DirPyrEqualizerParams() : - hueskin (20, 80, 2000, 1200, false) + enabled(false), + gamutlab(false), + mult{ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 + }, + threshold(0.2), + skinprotect(0.0), + hueskin (-5, 25, 170, 120, false), + cbdlMethod("bef") { } -FilmSimulationParams::FilmSimulationParams() +HSVEqualizerParams::HSVEqualizerParams() : + hcurve{ + FCT_Linear + }, + scurve{ + FCT_Linear + }, + vcurve{ + FCT_Linear + } { - setDefaults(); } -void FilmSimulationParams::setDefaults() +FilmSimulationParams::FilmSimulationParams() : + enabled(false), + strength(100) +{ +} + +RAWParams::BayerSensor::BayerSensor() : + method(getMethodString(Method::AMAZE)), + imageNum(0), + ccSteps(0), + black0(0.0), + black1(0.0), + black2(0.0), + black3(0.0), + twogreen(true), + linenoise(0), + greenthresh(0), + dcb_iterations(2), + lmmse_iterations(2), + pixelShiftMotion(0), + pixelShiftMotionCorrection(PSMotionCorrection::GRID_3X3_NEW), + pixelShiftMotionCorrectionMethod(PSMotionCorrectionMethod::AUTO), + pixelShiftStddevFactorGreen(5.0), + pixelShiftStddevFactorRed(5.0), + pixelShiftStddevFactorBlue(5.0), + pixelShiftEperIso(0.0), + pixelShiftNreadIso(0.0), + pixelShiftPrnu(1.0), + pixelShiftSigma(1.0), + pixelShiftSum(3.0), + pixelShiftRedBlueWeight(0.7), + pixelShiftShowMotion(false), + pixelShiftShowMotionMaskOnly(false), + pixelShiftAutomatic(true), + pixelShiftNonGreenHorizontal(false), + pixelShiftNonGreenVertical(false), + pixelShiftHoleFill(true), + pixelShiftMedian(false), + pixelShiftMedian3(false), + pixelShiftGreen(true), + pixelShiftBlur(true), + pixelShiftSmoothFactor(0.7), + pixelShiftExp0(false), + pixelShiftLmmse(false), + pixelShiftEqualBright(false), + pixelShiftEqualBrightChannel(false), + pixelShiftNonGreenCross(true), + pixelShiftNonGreenCross2(false), + pixelShiftNonGreenAmaze(false), + dcb_enhance(true) { - enabled = false; - clutFilename = Glib::ustring(); - strength = 100; } void RAWParams::BayerSensor::setPixelShiftDefaults() @@ -1408,6 +1671,15 @@ Glib::ustring RAWParams::BayerSensor::getMethodString(Method method) return getMethodStrings()[toUnderlying(method)]; } +RAWParams::XTransSensor::XTransSensor() : + method(getMethodString(Method::THREE_PASS)), + ccSteps(0), + blackred(0.0), + blackgreen(0.0), + blackblue(0.0) +{ +} + const std::vector& RAWParams::XTransSensor::getMethodStrings() { static const std::vector method_strings { @@ -1425,52 +1697,22 @@ Glib::ustring RAWParams::XTransSensor::getMethodString(Method method) return getMethodStrings()[toUnderlying(method)]; } -RAWParams::RAWParams() +RAWParams::RAWParams() : + df_autoselect(false), + ff_AutoSelect(false), + ff_BlurRadius(32), + ff_BlurType(getFlatFieldBlurTypeString(FlatFieldBlurType::AREA)), + ff_AutoClipControl(false), + ff_clipControl(0), + ca_autocorrect(false), + cared(0.0), + cablue(0.0), + expos(1.0), + preser(0.0), + hotPixelFilter(false), + deadPixelFilter(false), + hotdeadpix_thresh(100) { - setDefaults(); -} - -void RAWParams::setDefaults() -{ - bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE); - bayersensor.imageNum = 0; - bayersensor.ccSteps = 0; - bayersensor.dcb_iterations = 2; - bayersensor.dcb_enhance = true; -//bayersensor.all_enhance = false; - bayersensor.lmmse_iterations = 2; - bayersensor.black0 = 0.0; - bayersensor.black1 = 0.0; - bayersensor.black2 = 0.0; - bayersensor.black3 = 0.0; - bayersensor.twogreen = true; - bayersensor.linenoise = 0; - bayersensor.greenthresh = 0; - - xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::THREE_PASS); - xtranssensor.ccSteps = 0; - xtranssensor.blackred = 0.0; - xtranssensor.blackgreen = 0.0; - xtranssensor.blackblue = 0.0; - - expos = 1.0; - preser = 0.0; - df_autoselect = false; - ff_AutoSelect = false; - ff_BlurRadius = 32; - ff_BlurType = RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::AREA); - ff_AutoClipControl = false; - ff_clipControl = 0; - cared = 0; - cablue = 0; - ca_autocorrect = false; - hotPixelFilter = false; - deadPixelFilter = false; - hotdeadpix_thresh = 100; - bayersensor.setPixelShiftDefaults(); - bayersensor.pixelShiftShowMotion = false; - bayersensor.pixelShiftShowMotionMaskOnly = false; - } const std::vector& RAWParams::getFlatFieldBlurTypeStrings() @@ -1491,7 +1733,6 @@ Glib::ustring RAWParams::getFlatFieldBlurTypeString(FlatFieldBlurType type) ProcParams::ProcParams () { - setDefaults (); } @@ -1501,283 +1742,80 @@ void ProcParams::setDefaults () labCurve = LCurveParams(); - rgbCurves.lumamode = false; - rgbCurves.rcurve.clear (); - rgbCurves.rcurve.push_back (DCT_Linear); - rgbCurves.gcurve.clear (); - rgbCurves.gcurve.push_back (DCT_Linear); - rgbCurves.bcurve.clear (); - rgbCurves.bcurve.push_back (DCT_Linear); + rgbCurves = RGBCurvesParams(); colorToning = ColorToningParams(); - sharpenEdge.enabled = false; - sharpenEdge.passes = 2; - sharpenEdge.amount = 50.0; - sharpenEdge.threechannels = false; + sharpenEdge = SharpenEdgeParams(); - sharpenMicro.enabled = false; - sharpenMicro.amount = 20.0; - sharpenMicro.uniformity = 50.0; - sharpenMicro.matrix = false; + sharpenMicro = SharpenMicroParams(); - sharpening.enabled = false; - sharpening.radius = 0.5; - sharpening.amount = 200; - sharpening.threshold.setValues (20, 80, 2000, 1200); - sharpening.edgesonly = false; - sharpening.edges_radius = 1.9; - sharpening.edges_tolerance = 1800; - sharpening.halocontrol = false; - sharpening.halocontrol_amount = 85; - sharpening.method = "usm"; - sharpening.deconvradius = 0.75; - sharpening.deconviter = 30; - sharpening.deconvdamping = 20; - sharpening.deconvamount = 75; + sharpening = SharpeningParams(); - prsharpening.enabled = false; - prsharpening.radius = 0.5; - prsharpening.amount = 200; - prsharpening.threshold.setValues (20, 80, 2000, 1200); - prsharpening.edgesonly = false; - prsharpening.edges_radius = 1.9; - prsharpening.edges_tolerance = 1800; - prsharpening.halocontrol = false; - prsharpening.halocontrol_amount = 85; + prsharpening = SharpeningParams(); prsharpening.method = "rld"; + prsharpening.deconvamount = 100; prsharpening.deconvradius = 0.45; prsharpening.deconviter = 100; prsharpening.deconvdamping = 0; - prsharpening.deconvamount = 100; - vibrance.enabled = false; - vibrance.pastels = 0; - vibrance.saturated = 0; - vibrance.psthreshold.setValues (0, 75); - vibrance.protectskins = false; - vibrance.avoidcolorshift = true; - vibrance.pastsattog = true; - vibrance.skintonescurve.clear (); - vibrance.skintonescurve.push_back (DCT_Linear); + vibrance = VibranceParams(); - wb.method = "Camera"; - wb.temperature = 6504; - wb.green = 1.0; - wb.equal = 1.0; - wb.tempBias = 0.0; - colorappearance.enabled = false; - colorappearance.degree = 90; - colorappearance.autodegree = true; - colorappearance.degreeout = 90; - colorappearance.autodegreeout = true; - colorappearance.surround = "Average"; - colorappearance.surrsrc = "Average"; - colorappearance.adaplum = 16; - colorappearance.badpixsl = 0; - colorappearance.adapscen = 2000.0; - colorappearance.autoadapscen = true; - colorappearance.ybscen = 18; - colorappearance.autoybscen = true; - colorappearance.algo = "No"; - colorappearance.wbmodel = "RawT"; - colorappearance.jlight = 0.0; - colorappearance.qbright = 0.0; - colorappearance.chroma = 0.0; - colorappearance.schroma = 0.0; - colorappearance.mchroma = 0.0; - colorappearance.rstprotection = 0.0; - colorappearance.contrast = 0.0; - colorappearance.qcontrast = 0.0; - colorappearance.colorh = 0.0; - colorappearance.surrsource = false; - colorappearance.gamut = true; -// colorappearance.badpix = false; - colorappearance.datacie = false; - colorappearance.tonecie = false; -// colorappearance.sharpcie = false; - colorappearance.curve.clear (); - colorappearance.curve.push_back (DCT_Linear); - colorappearance.curve2.clear (); - colorappearance.curve2.push_back (DCT_Linear); - colorappearance.curveMode = ColorAppearanceParams::TcMode::LIGHT; - colorappearance.curveMode2 = ColorAppearanceParams::TcMode::LIGHT; - colorappearance.curve3.clear (); - colorappearance.curve3.push_back (DCT_Linear); - colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::CHROMA; - colorappearance.tempout = 5000; - colorappearance.greenout = 1.0; - colorappearance.ybout = 18; - colorappearance.tempsc = 5000; - colorappearance.greensc = 1.0; + wb = WBParams(); - impulseDenoise.enabled = false; - impulseDenoise.thresh = 50; + colorappearance = ColorAppearanceParams(); - defringe.enabled = false; - defringe.radius = 2.0; - defringe.threshold = 13; - defringe.huecurve.resize (25); - defringe.huecurve.at (0) = FCT_MinMaxCPoints; - defringe.huecurve.at (1) = 0.166666667; - defringe.huecurve.at (2) = 0.; - defringe.huecurve.at (3) = 0.35; - defringe.huecurve.at (4) = 0.35; - defringe.huecurve.at (5) = 0.347; - defringe.huecurve.at (6) = 0.; - defringe.huecurve.at (7) = 0.35; - defringe.huecurve.at (8) = 0.35; - defringe.huecurve.at (9) = 0.513667426; - defringe.huecurve.at (10) = 0; - defringe.huecurve.at (11) = 0.35; - defringe.huecurve.at (12) = 0.35; - defringe.huecurve.at (13) = 0.668944571; - defringe.huecurve.at (14) = 0.; - defringe.huecurve.at (15) = 0.35; - defringe.huecurve.at (16) = 0.35; - defringe.huecurve.at (17) = 0.8287775246; - defringe.huecurve.at (18) = 0.97835991; - defringe.huecurve.at (19) = 0.35; - defringe.huecurve.at (20) = 0.35; - defringe.huecurve.at (21) = 0.9908883827; - defringe.huecurve.at (22) = 0.; - defringe.huecurve.at (23) = 0.35; - defringe.huecurve.at (24) = 0.35; + defringe = DefringeParams(); - dirpyrDenoise.setDefaults(); + impulseDenoise = ImpulseDenoiseParams(); - epd.enabled = false; - epd.strength = 0.5; - epd.gamma = 1.0; - epd.edgeStopping = 1.4; - epd.scale = 1.0; - epd.reweightingIterates = 0; + dirpyrDenoise = DirPyrDenoiseParams(); - fattal.setDefaults(); + epd = EPDParams(); - sh.enabled = false; - sh.hq = false; - sh.highlights = 0; - sh.htonalwidth = 80; - sh.shadows = 0; - sh.stonalwidth = 80; - sh.localcontrast = 0; - sh.radius = 40; + fattal = FattalToneMappingParams(); - crop.enabled = false; - crop.x = -1; - crop.y = -1; - crop.w = 15000; - crop.h = 15000; - crop.fixratio = true; - crop.ratio = "3:2"; - crop.orientation = "As Image"; - crop.guide = "Frame"; + sh = SHParams(); - coarse.setDefaults(); + crop = CropParams(); - commonTrans.autofill = true; + coarse = CoarseTransformParams(); - rotate.degree = 0; + commonTrans = CommonTransformParams(); - distortion.amount = 0; + rotate = RotateParams(); - perspective.horizontal = 0; - perspective.vertical = 0; + distortion = DistortionParams(); - gradient.enabled = false; - gradient.degree = 0; - gradient.feather = 25; - gradient.strength = 0.60; - gradient.centerX = 0; - gradient.centerY = 0; + lensProf = LensProfParams(); - pcvignette.enabled = false; - pcvignette.strength = 0.60; - pcvignette.feather = 50; - pcvignette.roundness = 50; + perspective = PerspectiveParams(); - cacorrection.red = 0; - cacorrection.blue = 0; + gradient = GradientParams(); - vignetting.amount = 0; - vignetting.radius = 50; - vignetting.strength = 1; - vignetting.centerX = 0; - vignetting.centerY = 0; + pcvignette = PCVignetteParams(); - lensProf.setDefaults(); + vignetting = VignettingParams(); - chmixer.red[0] = 100; - chmixer.red[1] = 0; - chmixer.red[2] = 0; - chmixer.green[0] = 0; - chmixer.green[1] = 100; - chmixer.green[2] = 0; - chmixer.blue[0] = 0; - chmixer.blue[1] = 0; - chmixer.blue[2] = 100; + chmixer = ChannelMixerParams(); - blackwhite.autoc = false; - blackwhite.enabledcc = true; - blackwhite.enabled = false; - blackwhite.mixerRed = 33; - blackwhite.mixerGreen = 33; - blackwhite.mixerBlue = 33; - blackwhite.mixerOrange = 33; - blackwhite.mixerYellow = 33; - blackwhite.mixerCyan = 33; - blackwhite.mixerMagenta = 33; - blackwhite.mixerPurple = 33; - blackwhite.gammaRed = 0; - blackwhite.gammaGreen = 0; - blackwhite.gammaBlue = 0; - blackwhite.luminanceCurve.clear (); - blackwhite.luminanceCurve.push_back (FCT_Linear); - blackwhite.method = "Desaturation"; - blackwhite.filter = "None"; - blackwhite.setting = "NormalContrast"; - blackwhite.beforeCurve.clear (); - blackwhite.beforeCurve.push_back (DCT_Linear); - blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::STD_BW; - blackwhite.afterCurve.clear (); - blackwhite.afterCurve.push_back (DCT_Linear); - blackwhite.afterCurveMode = BlackWhiteParams::TcMode::STD_BW; - blackwhite.algo = "SP"; + blackwhite = BlackWhiteParams(); - resize.enabled = false; - resize.scale = 1.0; - resize.appliesTo = "Cropped area"; - resize.method = "Lanczos"; - resize.dataspec = 3; - resize.width = 900; - resize.height = 900; + cacorrection = CACorrParams(); - icm.setDefaults(); + resize = ResizeParams(); - dirpyrequalizer.enabled = false; - dirpyrequalizer.gamutlab = false; - dirpyrequalizer.cbdlMethod = "bef"; + icm = ColorManagementParams(); - for (int i = 0; i < 6; i ++) { - dirpyrequalizer.mult[i] = 1.0; - } + wavelet = WaveletParams(); - dirpyrequalizer.threshold = 0.2; - dirpyrequalizer.skinprotect = 0.; - dirpyrequalizer.hueskin.setValues (-5, 25, 170, 120); //default (b_l 0, t_l 30, b_r 170, t_r 120); -// dirpyrequalizer.algo = "FI"; + dirpyrequalizer = DirPyrEqualizerParams(); - hsvequalizer.hcurve.clear (); - hsvequalizer.hcurve.push_back (FCT_Linear); - hsvequalizer.scurve.clear (); - hsvequalizer.scurve.push_back (FCT_Linear); - hsvequalizer.vcurve.clear (); - hsvequalizer.vcurve.push_back (FCT_Linear); + hsvequalizer = HSVEqualizerParams(); - filmSimulation.setDefaults(); + filmSimulation = FilmSimulationParams(); - raw.setDefaults(); + raw = RAWParams(); exif.clear (); iptc.clear (); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 77965156f..0d2cd9cc2 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -362,6 +362,8 @@ struct RGBCurvesParams { std::vector rcurve; std::vector gcurve; std::vector bcurve; + + RGBCurvesParams(); }; /** @@ -450,6 +452,8 @@ struct SharpenEdgeParams { int passes; double amount; bool threechannels; + + SharpenEdgeParams(); }; struct SharpenMicroParams { @@ -457,6 +461,8 @@ struct SharpenMicroParams { bool matrix; double amount; double uniformity; + + SharpenMicroParams(); }; /** @@ -505,13 +511,14 @@ struct WBEntry { }; struct WBParams { - static const std::vector wbEntries; Glib::ustring method; int temperature; double green; double equal; double tempBias; + WBParams(); + static const std::vector& getWbEntries(); }; @@ -564,7 +571,6 @@ struct ColorAppearanceParams { double rstprotection; bool surrsource; bool gamut; - // bool badpix; bool datacie; bool tonecie; int tempout; @@ -572,6 +578,8 @@ struct ColorAppearanceParams { double greenout; int tempsc; double greensc; + + ColorAppearanceParams(); }; /** @@ -582,6 +590,8 @@ struct DefringeParams { double radius; float threshold; std::vector huecurve; + + DefringeParams(); }; /** @@ -591,6 +601,7 @@ struct ImpulseDenoiseParams { bool enabled; int thresh; + ImpulseDenoiseParams(); }; /** @@ -622,7 +633,7 @@ struct DirPyrDenoiseParams { int passes; DirPyrDenoiseParams(); - void setDefaults(); // SHOULD BE GENERALIZED TO ALL CLASSES! + void getCurves(NoiseCurve& lCurve, NoiseCurve& cCurve) const; }; @@ -635,6 +646,8 @@ struct EPDParams { double edgeStopping; double scale; int reweightingIterates; + + EPDParams(); }; // Fattal02 Tone-Mapping parameters @@ -644,7 +657,6 @@ struct FattalToneMappingParams { int amount; FattalToneMappingParams(); - void setDefaults(); }; /** @@ -659,6 +671,8 @@ struct SHParams { int stonalwidth; int localcontrast; int radius; + + SHParams(); }; /** @@ -676,7 +690,7 @@ struct CropParams { Glib::ustring guide; CropParams(); - void mapToResized (int resizedWidth, int resizedHeight, int scale, int& x1, int& x2, int& y1, int& y2) const; + void mapToResized(int resizedWidth, int resizedHeight, int scale, int& x1, int& x2, int& y1, int& y2) const; }; /** @@ -688,7 +702,6 @@ struct CoarseTransformParams { bool vflip; CoarseTransformParams(); - void setDefaults(); }; /** @@ -696,6 +709,8 @@ struct CoarseTransformParams { */ struct CommonTransformParams { bool autofill; + + CommonTransformParams(); }; /** @@ -703,6 +718,8 @@ struct CommonTransformParams { */ struct RotateParams { double degree; + + RotateParams(); }; /** @@ -710,6 +727,8 @@ struct RotateParams { */ struct DistortionParams { double amount; + + DistortionParams(); }; // Lens profile correction parameters @@ -729,7 +748,6 @@ struct LensProfParams { Glib::ustring lfLens; LensProfParams(); - void setDefaults(); bool useLensfun() const; bool lfAutoMatch() const; @@ -748,6 +766,8 @@ struct LensProfParams { struct PerspectiveParams { double horizontal; double vertical; + + PerspectiveParams(); }; /** @@ -760,6 +780,8 @@ struct GradientParams { double strength; int centerX; int centerY; + + GradientParams(); }; /** @@ -770,6 +792,8 @@ struct PCVignetteParams { double strength; int feather; int roundness; + + PCVignetteParams(); }; /** @@ -781,6 +805,8 @@ struct VignettingParams { int strength; int centerX; int centerY; + + VignettingParams(); }; /** @@ -790,6 +816,8 @@ struct ChannelMixerParams { int red[3]; int green[3]; int blue[3]; + + ChannelMixerParams(); }; struct BlackWhiteParams { @@ -824,6 +852,8 @@ struct BlackWhiteParams { int gammaRed; int gammaGreen; int gammaBlue; + + BlackWhiteParams(); }; /** @@ -832,6 +862,8 @@ struct BlackWhiteParams { struct CACorrParams { double red; double blue; + + CACorrParams(); }; /** @@ -845,6 +877,8 @@ struct ResizeParams { int dataspec; int width; int height; + + ResizeParams(); }; /** @@ -861,15 +895,15 @@ struct ColorManagementParams { Glib::ustring output; RenderingIntent outputIntent; bool outputBPC; - static const Glib::ustring NoICMString; Glib::ustring gamma; double gampos; double slpos; bool freegamma; + static const Glib::ustring NoICMString; + ColorManagementParams(); - void setDefaults(); }; /** @@ -882,7 +916,6 @@ typedef std::map ExifPairs; */ typedef std::map> IPTCPairs; - struct WaveletParams { std::vector ccwcurve; std::vector opacityCurveRG; @@ -971,13 +1004,8 @@ struct WaveletParams { Threshold level3noise; WaveletParams(); - void setDefaults(); + void getCurves(WavCurve& cCurve, WavOpacityCurveRG& opacityCurveLUTRG, WavOpacityCurveBY& opacityCurveLUTBY, WavOpacityCurveW& opacityCurveLUTW, WavOpacityCurveWL& opacityCurveLUTWL) const; - static void getDefaultCCWCurve (std::vector& curve); - static void getDefaultOpacityCurveRG (std::vector& curve); - static void getDefaultOpacityCurveBY (std::vector& curve); - static void getDefaultOpacityCurveW (std::vector& curve); - static void getDefaultOpacityCurveWL (std::vector& curve); }; /** @@ -999,9 +1027,11 @@ struct DirPyrEqualizerParams { * HSV equalizer params */ struct HSVEqualizerParams { - std::vector hcurve; - std::vector scurve; - std::vector vcurve; + std::vector hcurve; + std::vector scurve; + std::vector vcurve; + + HSVEqualizerParams(); }; @@ -1014,7 +1044,6 @@ struct FilmSimulationParams { int strength; FilmSimulationParams(); - void setDefaults(); }; @@ -1100,6 +1129,8 @@ struct RAWParams { bool pixelShiftNonGreenAmaze; bool dcb_enhance; + BayerSensor(); + void setPixelShiftDefaults(); static const std::vector& getMethodStrings(); @@ -1124,6 +1155,8 @@ struct RAWParams { double blackgreen; double blackblue; + XTransSensor(); + static const std::vector& getMethodStrings(); static Glib::ustring getMethodString(Method method); }; @@ -1161,7 +1194,6 @@ struct RAWParams { int hotdeadpix_thresh; RAWParams(); - void setDefaults(); static const std::vector& getFlatFieldBlurTypeStrings(); static Glib::ustring getFlatFieldBlurTypeString(FlatFieldBlurType type); diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index b61c9acd4..d3a594848 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -408,12 +408,11 @@ Wavelet::Wavelet() : opaCurveEditorG->setCurveListener (this); - std::vector defaultCurve; + const WaveletParams default_params; - rtengine::WaveletParams::getDefaultOpacityCurveRG(defaultCurve); opacityShapeRG = static_cast(opaCurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); opacityShapeRG->setIdentityValue(0.); - opacityShapeRG->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShapeRG->setResetCurve(FlatCurveType(default_params.opacityCurveRG.at(0)), default_params.opacityCurveRG); opaCurveEditorG->curveListComplete(); opaCurveEditorG->show(); @@ -422,10 +421,9 @@ Wavelet::Wavelet() : opacityCurveEditorG->setCurveListener (this); - rtengine::WaveletParams::getDefaultOpacityCurveBY(defaultCurve); opacityShapeBY = static_cast(opacityCurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); opacityShapeBY->setIdentityValue(0.); - opacityShapeBY->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShapeBY->setResetCurve(FlatCurveType(default_params.opacityCurveBY.at(0)), default_params.opacityCurveBY); opacityCurveEditorG->curveListComplete(); opacityCurveEditorG->show(); @@ -502,11 +500,10 @@ Wavelet::Wavelet() : // <-- Edge Sharpness Local Contrast curve CCWcurveEditorG->setCurveListener (this); - rtengine::WaveletParams::getDefaultCCWCurve(defaultCurve); ccshape = static_cast(CCWcurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); ccshape->setIdentityValue(0.); - ccshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + ccshape->setResetCurve(FlatCurveType(default_params.ccwcurve.at(0)), default_params.ccwcurve); ccshape->setTooltip(M("TP_WAVELET_CURVEEDITOR_CC_TOOLTIP")); CCWcurveEditorG->curveListComplete(); @@ -781,10 +778,9 @@ Wavelet::Wavelet() : opacityCurveEditorW->setCurveListener (this); - rtengine::WaveletParams::getDefaultOpacityCurveW(defaultCurve); opacityShape = static_cast(opacityCurveEditorW->addCurve(CT_Flat, "", nullptr, false, false)); opacityShape->setIdentityValue(0.); - opacityShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShape->setResetCurve(FlatCurveType(default_params.opacityCurveW.at(0)), default_params.opacityCurveW); opacityShape->setBottomBarBgGradient(milestones2); // This will add the reset button at the end of the curveType buttons @@ -798,10 +794,9 @@ Wavelet::Wavelet() : opacityCurveEditorWL->setCurveListener (this); - rtengine::WaveletParams::getDefaultOpacityCurveWL(defaultCurve); opacityShapeWL = static_cast(opacityCurveEditorWL->addCurve(CT_Flat, "", nullptr, false, false)); opacityShapeWL->setIdentityValue(0.); - opacityShapeWL->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShapeWL->setResetCurve(FlatCurveType(default_params.opacityCurveWL.at(0)), default_params.opacityCurveWL); opacityShapeWL->setTooltip(M("TP_WAVELET_OPACITYWL_TOOLTIP")); // This will add the reset button at the end of the curveType buttons From 0fc6d2f98ee13758b967ce42110cf87a33f7c20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Mon, 20 Nov 2017 21:09:06 +0100 Subject: [PATCH 12/47] Final touchups for `procparams.*` --- rtengine/procparams.cc | 299 ++++++++++++++++------------------------- rtengine/procparams.h | 46 ++++--- 2 files changed, 143 insertions(+), 202 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index bbc18ec33..150dbbb70 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -299,11 +299,6 @@ bool saveToKeyfile( return false; } -const int tr = options.rtSettings.top_right; -const int br = options.rtSettings.bot_right; -const int tl = options.rtSettings.top_left; -const int bl = options.rtSettings.bot_left; - } namespace rtengine @@ -463,10 +458,10 @@ RetinexParams::RetinexParams() : { } -void RetinexParams::getCurves (RetinextransmissionCurve &transmissionCurveLUT, RetinexgaintransmissionCurve &gaintransmissionCurveLUT) const +void RetinexParams::getCurves(RetinextransmissionCurve &transmissionCurveLUT, RetinexgaintransmissionCurve &gaintransmissionCurveLUT) const { - transmissionCurveLUT.Set (this->transmissionCurve); - gaintransmissionCurveLUT.Set (this->gaintransmissionCurve); + transmissionCurveLUT.Set(this->transmissionCurve); + gaintransmissionCurveLUT.Set(this->gaintransmissionCurve); } @@ -521,7 +516,7 @@ RGBCurvesParams::RGBCurvesParams() : { } -ColorToningParams::ColorToningParams () : +ColorToningParams::ColorToningParams() : enabled(false), autosat(true), opacityCurve{ @@ -595,7 +590,7 @@ ColorToningParams::ColorToningParams () : { } -void ColorToningParams::mixerToCurve (std::vector &colorCurve, std::vector &opacityCurve) const +void ColorToningParams::mixerToCurve(std::vector& colorCurve, std::vector& opacityCurve) const { // check if non null first if (!redlow && !greenlow && !bluelow && !redmed && !greenmed && !bluemed && !redhigh && !greenhigh && !bluehigh) { @@ -804,7 +799,7 @@ void ColorToningParams::mixerToCurve (std::vector &colorCurve, std::vect opacityCurve.at (12) = 0.35; } -void ColorToningParams::slidersToCurve (std::vector &colorCurve, std::vector &opacityCurve) const +void ColorToningParams::slidersToCurve(std::vector& colorCurve, std::vector& opacityCurve) const { if (hlColSat.getBottom() == 0 && shadowsColSat.getBottom() == 0) { // if both opacity are null, set both curves to Linear colorCurve.resize (1); @@ -837,7 +832,7 @@ void ColorToningParams::slidersToCurve (std::vector &colorCurve, std::ve opacityCurve.at (8) = 0.35; } -void ColorToningParams::getCurves (ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], bool &opautili) const +void ColorToningParams::getCurves (ColorGradientCurve& colorCurveLUT, OpacityCurve& opacityCurveLUT, const double xyz_rgb[3][3], bool& opautili) const { float satur = 0.8f; float lumin = 0.5f; //middle of luminance for optimization of gamut - no real importance...as we work in XYZ and gamut control @@ -934,40 +929,40 @@ WBParams::WBParams() : const std::vector& WBParams::getWbEntries() { static const std::vector wb_entries = { - {"Camera", WBEntry::Type::CAMERA, M ("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f}, - {"Auto", WBEntry::Type::AUTO, M ("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f}, - {"Daylight", WBEntry::Type::DAYLIGHT, M ("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f}, - {"Cloudy", WBEntry::Type::CLOUDY, M ("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f}, - {"Shade", WBEntry::Type::SHADE, M ("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f}, - {"Water 1", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER1"), 35000, 0.3f, 1.1f, 0.f}, - {"Water 2", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER2"), 48000, 0.63f, 1.38f, 0.f}, - {"Tungsten", WBEntry::Type::TUNGSTEN, M ("TP_WBALANCE_TUNGSTEN"), 2856, 1.f, 1.f, 0.f}, - {"Fluo F1", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO1"), 6430, 1.f, 1.f, 0.f}, - {"Fluo F2", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO2"), 4230, 1.f, 1.f, 0.f}, - {"Fluo F3", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO3"), 3450, 1.f, 1.f, 0.f}, - {"Fluo F4", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO4"), 2940, 1.f, 1.f, 0.f}, - {"Fluo F5", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO5"), 6350, 1.f, 1.f, 0.f}, - {"Fluo F6", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO6"), 4150, 1.f, 1.f, 0.f}, - {"Fluo F7", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO7"), 6500, 1.f, 1.f, 0.f}, - {"Fluo F8", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO8"), 5020, 1.f, 1.f, 0.f}, - {"Fluo F9", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO9"), 4330, 1.f, 1.f, 0.f}, - {"Fluo F10", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO10"), 5300, 1.f, 1.f, 0.f}, - {"Fluo F11", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO11"), 4000, 1.f, 1.f, 0.f}, - {"Fluo F12", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO12"), 3000, 1.f, 1.f, 0.f}, - {"HMI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_HMI"), 4800, 1.f, 1.f, 0.f}, - {"GTI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_GTI"), 5000, 1.f, 1.f, 0.f}, - {"JudgeIII Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_JUDGEIII"), 5100, 1.f, 1.f, 0.f}, - {"Solux Lamp 3500K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX35"), 3480, 1.f, 1.f, 0.f}, - {"Solux Lamp 4100K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX41"), 3930, 1.f, 1.f, 0.f}, - {"Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47"), 4700, 1.f, 1.f, 0.f}, - {"NG Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47_NG"), 4480, 1.f, 1.f, 0.f}, - {"LED LSI Lumelex 2040", WBEntry::Type::LED, M ("TP_WBALANCE_LED_LSI"), 2970, 1.f, 1.f, 0.f}, - {"LED CRS SP12 WWMR16", WBEntry::Type::LED, M ("TP_WBALANCE_LED_CRS"), 3050, 1.f, 1.f, 0.f}, - {"Flash 5500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH55"), 5500, 1.f, 1.f, 0.f}, - {"Flash 6000K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH60"), 6000, 1.f, 1.f, 0.f}, - {"Flash 6500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH65"), 6500, 1.f, 1.f, 0.f}, + {"Camera", WBEntry::Type::CAMERA, M("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f}, + {"Auto", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f}, + {"Daylight", WBEntry::Type::DAYLIGHT, M("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f}, + {"Cloudy", WBEntry::Type::CLOUDY, M("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f}, + {"Shade", WBEntry::Type::SHADE, M("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f}, + {"Water 1", WBEntry::Type::WATER, M("TP_WBALANCE_WATER1"), 35000, 0.3f, 1.1f, 0.f}, + {"Water 2", WBEntry::Type::WATER, M("TP_WBALANCE_WATER2"), 48000, 0.63f, 1.38f, 0.f}, + {"Tungsten", WBEntry::Type::TUNGSTEN, M("TP_WBALANCE_TUNGSTEN"), 2856, 1.f, 1.f, 0.f}, + {"Fluo F1", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO1"), 6430, 1.f, 1.f, 0.f}, + {"Fluo F2", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO2"), 4230, 1.f, 1.f, 0.f}, + {"Fluo F3", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO3"), 3450, 1.f, 1.f, 0.f}, + {"Fluo F4", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO4"), 2940, 1.f, 1.f, 0.f}, + {"Fluo F5", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO5"), 6350, 1.f, 1.f, 0.f}, + {"Fluo F6", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO6"), 4150, 1.f, 1.f, 0.f}, + {"Fluo F7", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO7"), 6500, 1.f, 1.f, 0.f}, + {"Fluo F8", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO8"), 5020, 1.f, 1.f, 0.f}, + {"Fluo F9", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO9"), 4330, 1.f, 1.f, 0.f}, + {"Fluo F10", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO10"), 5300, 1.f, 1.f, 0.f}, + {"Fluo F11", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO11"), 4000, 1.f, 1.f, 0.f}, + {"Fluo F12", WBEntry::Type::FLUORESCENT, M("TP_WBALANCE_FLUO12"), 3000, 1.f, 1.f, 0.f}, + {"HMI Lamp", WBEntry::Type::LAMP, M("TP_WBALANCE_HMI"), 4800, 1.f, 1.f, 0.f}, + {"GTI Lamp", WBEntry::Type::LAMP, M("TP_WBALANCE_GTI"), 5000, 1.f, 1.f, 0.f}, + {"JudgeIII Lamp", WBEntry::Type::LAMP, M("TP_WBALANCE_JUDGEIII"), 5100, 1.f, 1.f, 0.f}, + {"Solux Lamp 3500K", WBEntry::Type::LAMP, M("TP_WBALANCE_SOLUX35"), 3480, 1.f, 1.f, 0.f}, + {"Solux Lamp 4100K", WBEntry::Type::LAMP, M("TP_WBALANCE_SOLUX41"), 3930, 1.f, 1.f, 0.f}, + {"Solux Lamp 4700K", WBEntry::Type::LAMP, M("TP_WBALANCE_SOLUX47"), 4700, 1.f, 1.f, 0.f}, + {"NG Solux Lamp 4700K", WBEntry::Type::LAMP, M("TP_WBALANCE_SOLUX47_NG"), 4480, 1.f, 1.f, 0.f}, + {"LED LSI Lumelex 2040", WBEntry::Type::LED, M("TP_WBALANCE_LED_LSI"), 2970, 1.f, 1.f, 0.f}, + {"LED CRS SP12 WWMR16", WBEntry::Type::LED, M("TP_WBALANCE_LED_CRS"), 3050, 1.f, 1.f, 0.f}, + {"Flash 5500K", WBEntry::Type::FLASH, M("TP_WBALANCE_FLASH55"), 5500, 1.f, 1.f, 0.f}, + {"Flash 6000K", WBEntry::Type::FLASH, M("TP_WBALANCE_FLASH60"), 6000, 1.f, 1.f, 0.f}, + {"Flash 6500K", WBEntry::Type::FLASH, M("TP_WBALANCE_FLASH65"), 6500, 1.f, 1.f, 0.f}, // Should remain the last one - {"Custom", WBEntry::Type::CUSTOM, M ("TP_WBALANCE_CUSTOM"), 0, 1.f, 1.f, 0.f} + {"Custom", WBEntry::Type::CUSTOM, M ("TP_WBALANCE_CUSTOM"), 0, 1.f, 1.f, 0.f} }; return wb_entries; @@ -1155,7 +1150,7 @@ CropParams::CropParams() : { } -void CropParams::mapToResized (int resizedWidth, int resizedHeight, int scale, int &x1, int &x2, int &y1, int &y2) const +void CropParams::mapToResized(int resizedWidth, int resizedHeight, int scale, int& x1, int& x2, int& y1, int& y2) const { x1 = 0, x2 = resizedWidth, y1 = 0, y2 = resizedHeight; @@ -1520,7 +1515,13 @@ WaveletParams::WaveletParams() : { } -void WaveletParams::getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG, WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const +void WaveletParams::getCurves( + WavCurve& cCurve, + WavOpacityCurveRG& opacityCurveLUTRG, + WavOpacityCurveBY& opacityCurveLUTBY, + WavOpacityCurveW& opacityCurveLUTW, + WavOpacityCurveWL& opacityCurveLUTWL +) const { cCurve.Set (this->ccwcurve); opacityCurveLUTRG.Set (this->opacityCurveRG); @@ -1826,7 +1827,7 @@ void ProcParams::setDefaults () ppVersion = PPVERSION; } -int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, bool fnameAbsolute, ParamsEdited* pedited) +int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bool fnameAbsolute, ParamsEdited* pedited) { if (fname.empty () && fname2.empty ()) { return 0; @@ -2029,25 +2030,13 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->sharpenMicro.matrix, "SharpenMicro", "Matrix", sharpenMicro.matrix, keyFile); saveToKeyfile(!pedited || pedited->sharpenMicro.amount, "SharpenMicro", "Strength", sharpenMicro.amount, keyFile); saveToKeyfile(!pedited || pedited->sharpenMicro.uniformity, "SharpenMicro", "Uniformity", sharpenMicro.uniformity, keyFile); - /* - // colorBoost - if (!pedited || pedited->colorBoost.amount) keyFile.set_integer ("Color Boost", "Amount", colorBoost.amount); - if (!pedited || pedited->colorBoost.avoidclip) keyFile.set_boolean ("Color Boost", "AvoidColorClipping", colorBoost.avoidclip); - if (!pedited || pedited->colorBoost.enable_saturationlimiter) keyFile.set_boolean ("Color Boost", "SaturationLimiter", colorBoost.enable_saturationlimiter); - if (!pedited || pedited->colorBoost.saturationlimit) keyFile.set_double ("Color Boost", "SaturationLimit", colorBoost.saturationlimit); - */ - // wb +// WB saveToKeyfile(!pedited || pedited->wb.method, "White Balance", "Setting", wb.method, keyFile); saveToKeyfile(!pedited || pedited->wb.temperature, "White Balance", "Temperature", wb.temperature, keyFile); saveToKeyfile(!pedited || pedited->wb.green, "White Balance", "Green", wb.green, keyFile); saveToKeyfile(!pedited || pedited->wb.equal, "White Balance", "Equal", wb.equal, keyFile); saveToKeyfile(!pedited || pedited->wb.tempBias, "White Balance", "TemperatureBias", wb.tempBias, keyFile); - /* - // colorShift - if (!pedited || pedited->colorShift.a) keyFile.set_double ("Color Shift", "ChannelA", colorShift.a); - if (!pedited || pedited->colorShift.b) keyFile.set_double ("Color Shift", "ChannelB", colorShift.b); - */ // Colorappearance saveToKeyfile(!pedited || pedited->colorappearance.enabled, "Color appearance", "Enabled", colorappearance.enabled, keyFile); @@ -2057,7 +2046,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorappearance.autodegreeout, "Color appearance", "AutoDegreeout", colorappearance.autodegreeout, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.surround, "Color appearance", "Surround", colorappearance.surround, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.surrsrc, "Color appearance", "Surrsrc", colorappearance.surrsrc, keyFile); -// if (!pedited || pedited->colorappearance.backgrd) keyFile.set_integer ("Color appearance", "Background", colorappearance.backgrd); saveToKeyfile(!pedited || pedited->colorappearance.adaplum, "Color appearance", "AdaptLum", colorappearance.adaplum, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.badpixsl, "Color appearance", "Badpixsl", colorappearance.badpixsl, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.wbmodel, "Color appearance", "Model", colorappearance.wbmodel, keyFile); @@ -2082,10 +2070,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorappearance.tempsc, "Color appearance", "Tempsc", colorappearance.tempsc, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.greensc, "Color appearance", "Greensc", colorappearance.greensc, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.ybout, "Color appearance", "Ybout", colorappearance.ybout, keyFile); -// if (!pedited || pedited->colorappearance.badpix) keyFile.set_boolean ("Color appearance", "Badpix", colorappearance.badpix); saveToKeyfile(!pedited || pedited->colorappearance.datacie, "Color appearance", "Datacie", colorappearance.datacie, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.tonecie, "Color appearance", "Tonecie", colorappearance.tonecie, keyFile); -// if (!pedited || pedited->colorappearance.sharpcie) keyFile.set_boolean ("Color appearance", "Sharpcie", colorappearance.sharpcie); const std::map ca_mapping = { {ColorAppearanceParams::TcMode::LIGHT, "Lightness"}, @@ -2107,7 +2093,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b colorappearance.curveMode3, keyFile ); - saveToKeyfile(!pedited || pedited->colorappearance.curve, "Color appearance", "Curve", colorappearance.curve, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.curve2, "Color appearance", "Curve2", colorappearance.curve2, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.curve3, "Color appearance", "Curve3", colorappearance.curve3, keyFile); @@ -2126,23 +2111,19 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->dirpyrDenoise.enabled, "Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.enhance, "Directional Pyramid Denoising", "Enhance", dirpyrDenoise.enhance, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.median, "Directional Pyramid Denoising", "Median", dirpyrDenoise.median, keyFile); -// if (!pedited || pedited->dirpyrDenoise.perform) keyFile.set_boolean ("Directional Pyramid Denoising", "Perform", dirpyrDenoise.perform); saveToKeyfile(!pedited || pedited->dirpyrDenoise.luma, "Directional Pyramid Denoising", "Luma", dirpyrDenoise.luma, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.Ldetail, "Directional Pyramid Denoising", "Ldetail", dirpyrDenoise.Ldetail, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.chroma, "Directional Pyramid Denoising", "Chroma", dirpyrDenoise.chroma, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.dmethod, "Directional Pyramid Denoising", "Method", dirpyrDenoise.dmethod, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.Lmethod, "Directional Pyramid Denoising", "LMethod", dirpyrDenoise.Lmethod, keyFile); -// never save 'auto chroma preview mode' to pp3 if (dirpyrDenoise.Cmethod == "PRE") { - dirpyrDenoise.Cmethod = "MAN"; + dirpyrDenoise.Cmethod = "MAN"; // Never save 'auto chroma preview mode' to pp3 } saveToKeyfile(!pedited || pedited->dirpyrDenoise.Cmethod, "Directional Pyramid Denoising", "CMethod", dirpyrDenoise.Cmethod, keyFile); - if (dirpyrDenoise.C2method == "PREV") { dirpyrDenoise.C2method = "MANU"; } saveToKeyfile(!pedited || pedited->dirpyrDenoise.C2method, "Directional Pyramid Denoising", "C2Method", dirpyrDenoise.C2method, keyFile); - saveToKeyfile(!pedited || pedited->dirpyrDenoise.smethod, "Directional Pyramid Denoising", "SMethod", dirpyrDenoise.smethod, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.medmethod, "Directional Pyramid Denoising", "MedMethod", dirpyrDenoise.medmethod, keyFile); saveToKeyfile(!pedited || pedited->dirpyrDenoise.rgbmethod, "Directional Pyramid Denoising", "RGBMethod", dirpyrDenoise.rgbmethod, keyFile); @@ -2166,18 +2147,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->fattal.enabled, "FattalToneMapping", "Enabled", fattal.enabled, keyFile); saveToKeyfile(!pedited || pedited->fattal.threshold, "FattalToneMapping", "Threshold", fattal.threshold, keyFile); saveToKeyfile(!pedited || pedited->fattal.amount, "FattalToneMapping", "Amount", fattal.amount, keyFile); - /* - // lumaDenoise - if (!pedited || pedited->lumaDenoise.enabled) keyFile.set_boolean ("Luminance Denoising", "Enabled", lumaDenoise.enabled); - if (!pedited || pedited->lumaDenoise.radius) keyFile.set_double ("Luminance Denoising", "Radius", lumaDenoise.radius); - if (!pedited || pedited->lumaDenoise.edgetolerance) keyFile.set_integer ("Luminance Denoising", "EdgeTolerance", lumaDenoise.edgetolerance); - */ - - /* - // colorDenoise - //if (!pedited || pedited->colorDenoise.enabled) keyFile.set_boolean ("Chrominance Denoising", "Enabled", colorDenoise.enabled); - if (!pedited || pedited->colorDenoise.amount) keyFile.set_integer ("Chrominance Denoising", "Amount", colorDenoise.amount); - */ // Shadows & highlights saveToKeyfile(!pedited || pedited->sh.enabled, "Shadows & Highlights", "Enabled", sh.enabled, keyFile); @@ -2332,6 +2301,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->wavelet.expfinal, "Wavelet", "Expfinal", wavelet.expfinal, keyFile); saveToKeyfile(!pedited || pedited->wavelet.exptoning, "Wavelet", "Exptoning", wavelet.exptoning, keyFile); saveToKeyfile(!pedited || pedited->wavelet.expnoise, "Wavelet", "Expnoise", wavelet.expnoise, keyFile); + for (int i = 0; i < 9; i++) { std::stringstream ss; ss << "Contrast" << (i + 1); @@ -2386,14 +2356,11 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->wavelet.linkedg, "Wavelet", "Linkedg", wavelet.linkedg, keyFile); saveToKeyfile(!pedited || pedited->wavelet.cbenab, "Wavelet", "CBenab", wavelet.cbenab, keyFile); saveToKeyfile(!pedited || pedited->wavelet.lipst, "Wavelet", "Lipst", wavelet.lipst, keyFile); -// if (!pedited || pedited->wavelet.edgreinf) keyFile.set_boolean ("Wavelet", "Edgreinf", wavelet.edgreinf); saveToKeyfile(!pedited || pedited->wavelet.skinprotect, "Wavelet", "Skinprotect", wavelet.skinprotect, keyFile); saveToKeyfile(!pedited || pedited->wavelet.hueskin, "Wavelet", "Hueskin", wavelet.hueskin.toVector(), keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgrad, "Wavelet", "Edgrad", wavelet.edgrad, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgval, "Wavelet", "Edgval", wavelet.edgval, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgthresh, "Wavelet", "ThrEdg", wavelet.edgthresh, keyFile); -// if (!pedited || pedited->wavelet.strength) keyFile.set_integer ("Wavelet", "Strength", wavelet.strength); -// if (!pedited || pedited->wavelet.balance) keyFile.set_integer ("Wavelet", "Balance", wavelet.balance); saveToKeyfile(!pedited || pedited->wavelet.avoid, "Wavelet", "AvoidColorShift", wavelet.avoid, keyFile); saveToKeyfile(!pedited || pedited->wavelet.tmr, "Wavelet", "TMr", wavelet.tmr, keyFile); saveToKeyfile(!pedited || pedited->wavelet.rescon, "Wavelet", "ResidualcontShadow", wavelet.rescon, keyFile); @@ -2411,15 +2378,16 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->dirpyrequalizer.enabled, "Directional Pyramid Equalizer", "Enabled", dirpyrequalizer.enabled, keyFile); saveToKeyfile(!pedited || pedited->dirpyrequalizer.gamutlab, "Directional Pyramid Equalizer", "Gamutlab", dirpyrequalizer.gamutlab, keyFile); saveToKeyfile(!pedited || pedited->dirpyrequalizer.cbdlMethod, "Directional Pyramid Equalizer", "cbdlMethod", dirpyrequalizer.cbdlMethod, keyFile); + for (int i = 0; i < 6; i++) { std::stringstream ss; ss << "Mult" << i; saveToKeyfile(!pedited || pedited->dirpyrequalizer.mult[i], "Directional Pyramid Equalizer", ss.str(), dirpyrequalizer.mult[i], keyFile); } + saveToKeyfile(!pedited || pedited->dirpyrequalizer.threshold, "Directional Pyramid Equalizer", "Threshold", dirpyrequalizer.threshold, keyFile); saveToKeyfile(!pedited || pedited->dirpyrequalizer.skinprotect, "Directional Pyramid Equalizer", "Skinprotect", dirpyrequalizer.skinprotect, keyFile); -// if (!pedited || pedited->dirpyrequalizer.algo) keyFile.set_string ("Directional Pyramid Equalizer", "Algorithm", dirpyrequalizer.algo); saveToKeyfile(!pedited || pedited->dirpyrequalizer.hueskin, "Directional Pyramid Equalizer", "Hueskin", dirpyrequalizer.hueskin.toVector(), keyFile); // HSV Equalizer @@ -2569,7 +2537,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b } } -int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) +int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) { setlocale (LC_NUMERIC, "C"); // to set decimal point to "." @@ -2580,7 +2548,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) Glib::KeyFile keyFile; try { - if (pedited) { pedited->set (false); } @@ -2785,11 +2752,12 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) if (keyFile.has_group ("Luminance Curve")) { assignFromKeyfile(keyFile, "Luminance Curve", "Brightness", pedited, labCurve.brightness, pedited->labCurve.brightness); assignFromKeyfile(keyFile, "Luminance Curve", "Contrast", pedited, labCurve.contrast, pedited->labCurve.contrast); + if (ppVersion < 303) { -// transform Saturation into Chromaticity -// if Saturation == 0, should we set BWToning on? + // transform Saturation into Chromaticity + // if Saturation == 0, should we set BWToning on? assignFromKeyfile(keyFile, "Luminance Curve", "Saturation", pedited, labCurve.chromaticity, pedited->labCurve.chromaticity); -// transform AvoidColorClipping into AvoidColorShift + // transform AvoidColorClipping into AvoidColorShift assignFromKeyfile(keyFile, "Luminance Curve", "AvoidColorClipping", pedited, labCurve.avoidcolorshift, pedited->labCurve.avoidcolorshift); } else { if (keyFile.has_key ("Luminance Curve", "Chromaticity")) { @@ -2809,10 +2777,10 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } assignFromKeyfile(keyFile, "Luminance Curve", "LCredsk", pedited, labCurve.lcredsk, pedited->labCurve.lcredsk); - if (ppVersion < 314) -// Backward compatibility: If BWtoning is true, Chromaticity has to be set to -100, which will produce the same effect -// and will enable the b&w toning mode ('a' & 'b' curves) + if (ppVersion < 314) { + // Backward compatibility: If BWtoning is true, Chromaticity has to be set to -100, which will produce the same effect + // and will enable the b&w toning mode ('a' & 'b' curves) if (keyFile.has_key ("Luminance Curve", "BWtoning")) { if ( keyFile.get_boolean ("Luminance Curve", "BWtoning")) { labCurve.chromaticity = -100; @@ -2822,6 +2790,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } } + } assignFromKeyfile(keyFile, "Luminance Curve", "LCurve", pedited, labCurve.lcurve, pedited->labCurve.lcurve); assignFromKeyfile(keyFile, "Luminance Curve", "aCurve", pedited, labCurve.acurve, pedited->labCurve.acurve); @@ -2832,13 +2801,13 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Luminance Curve", "hhCurve", pedited, labCurve.hhcurve, pedited->labCurve.hhcurve); assignFromKeyfile(keyFile, "Luminance Curve", "LcCurve", pedited, labCurve.lccurve, pedited->labCurve.lccurve); assignFromKeyfile(keyFile, "Luminance Curve", "ClCurve", pedited, labCurve.clcurve, pedited->labCurve.clcurve); - } if (keyFile.has_group ("Sharpening")) { assignFromKeyfile(keyFile, "Sharpening", "Enabled", pedited, sharpening.enabled, pedited->sharpening.enabled); assignFromKeyfile(keyFile, "Sharpening", "Radius", pedited, sharpening.radius, pedited->sharpening.radius); assignFromKeyfile(keyFile, "Sharpening", "Amount", pedited, sharpening.amount, pedited->sharpening.amount); + if (keyFile.has_key ("Sharpening", "Threshold")) { if (ppVersion < 302) { int thresh = min (keyFile.get_integer ("Sharpening", "Threshold"), 2000); @@ -2886,6 +2855,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Vibrance", "Enabled", pedited, vibrance.enabled, pedited->vibrance.enabled); assignFromKeyfile(keyFile, "Vibrance", "Pastels", pedited, vibrance.pastels, pedited->vibrance.pastels); assignFromKeyfile(keyFile, "Vibrance", "Saturated", pedited, vibrance.saturated, pedited->vibrance.saturated); + if (keyFile.has_key ("Vibrance", "PSThreshold")) { if (ppVersion < 302) { int thresh = keyFile.get_integer ("Vibrance", "PSThreshold"); @@ -2909,21 +2879,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Vibrance", "SkinTonesCurve", pedited, vibrance.skintonescurve, pedited->vibrance.skintonescurve); } - // load colorBoost - /*if (keyFile.has_group ("Color Boost")) { - if (keyFile.has_key ("Color Boost", "Amount")) { colorBoost.amount = keyFile.get_integer ("Color Boost", "Amount"); if (pedited) pedited->colorBoost.amount = true; } - else { - int a=0, b=0; - if (keyFile.has_key ("Color Boost", "ChannelA")) { a = keyFile.get_integer ("Color Boost", "ChannelA"); } - if (keyFile.has_key ("Color Boost", "ChannelB")) { b = keyFile.get_integer ("Color Boost", "ChannelB"); } - colorBoost.amount = (a+b) / 2; - if (pedited) pedited->colorBoost.amount = true; - } - if (keyFile.has_key ("Color Boost", "AvoidColorClipping")) { colorBoost.avoidclip = keyFile.get_boolean ("Color Boost", "AvoidColorClipping"); if (pedited) pedited->colorBoost.avoidclip = true; } - if (keyFile.has_key ("Color Boost", "SaturationLimiter")) { colorBoost.enable_saturationlimiter= keyFile.get_boolean ("Color Boost", "SaturationLimiter"); if (pedited) pedited->colorBoost.enable_saturationlimiter = true; } - if (keyFile.has_key ("Color Boost", "SaturationLimit")) { colorBoost.saturationlimit = keyFile.get_double ("Color Boost", "SaturationLimit"); if (pedited) pedited->colorBoost.saturationlimit = true; } - }*/ - if (keyFile.has_group ("White Balance")) { assignFromKeyfile(keyFile, "White Balance", "Setting", pedited, wb.method, pedited->wb.method); assignFromKeyfile(keyFile, "White Balance", "Temperature", pedited, wb.temperature, pedited->wb.temperature); @@ -2932,15 +2887,10 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "White Balance", "TemperatureBias", pedited, wb.tempBias, pedited->wb.tempBias); } - // load colorShift - /*if (keyFile.has_group ("Color Shift")) { - if (keyFile.has_key ("Color Shift", "ChannelA")) { colorShift.a = keyFile.get_double ("Color Shift", "ChannelA"); if (pedited) pedited->colorShift.a = true; } - if (keyFile.has_key ("Color Shift", "ChannelB")) { colorShift.b = keyFile.get_double ("Color Shift", "ChannelB"); if (pedited) pedited->colorShift.b = true; } - }*/ - if (keyFile.has_group ("Defringing")) { assignFromKeyfile(keyFile, "Defringing", "Enabled", pedited, defringe.enabled, pedited->defringe.enabled); assignFromKeyfile(keyFile, "Defringing", "Radius", pedited, defringe.radius, pedited->defringe.radius); + if (keyFile.has_key ("Defringing", "Threshold")) { defringe.threshold = (float)keyFile.get_integer ("Defringing", "Threshold"); @@ -2966,7 +2916,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color appearance", "Surround", pedited, colorappearance.surround, pedited->colorappearance.surround); assignFromKeyfile(keyFile, "Color appearance", "Surrsrc", pedited, colorappearance.surrsrc, pedited->colorappearance.surrsrc); -// if (keyFile.has_key ("Color appearance", "Background")) {colorappearance.backgrd = keyFile.get_integer ("Color appearance", "Background"); if (pedited) pedited->colorappearance.backgrd = true; } assignFromKeyfile(keyFile, "Color appearance", "AdaptLum", pedited, colorappearance.adaplum, pedited->colorappearance.adaplum); assignFromKeyfile(keyFile, "Color appearance", "Badpixsl", pedited, colorappearance.badpixsl, pedited->colorappearance.badpixsl); assignFromKeyfile(keyFile, "Color appearance", "Model", pedited, colorappearance.wbmodel, pedited->colorappearance.wbmodel); @@ -2989,14 +2938,10 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color appearance", "Tempout", pedited, colorappearance.tempout, pedited->colorappearance.tempout); assignFromKeyfile(keyFile, "Color appearance", "Greenout", pedited, colorappearance.greenout, pedited->colorappearance.greenout); assignFromKeyfile(keyFile, "Color appearance", "Tempsc", pedited, colorappearance.tempsc, pedited->colorappearance.tempsc); - assignFromKeyfile(keyFile, "Color appearance", "Greensc", pedited, colorappearance.greensc, pedited->colorappearance.greensc); - assignFromKeyfile(keyFile, "Color appearance", "Ybout", pedited, colorappearance.ybout, pedited->colorappearance.ybout); -// if (keyFile.has_key ("Color appearance", "Badpix")) {colorappearance.badpix = keyFile.get_boolean ("Color appearance", "Badpix"); if (pedited) pedited->colorappearance.badpix = true; } assignFromKeyfile(keyFile, "Color appearance", "Datacie", pedited, colorappearance.datacie, pedited->colorappearance.datacie); assignFromKeyfile(keyFile, "Color appearance", "Tonecie", pedited, colorappearance.tonecie, pedited->colorappearance.tonecie); -// if (keyFile.has_key ("Color appearance", "Sharpcie")) {colorappearance.sharpcie = keyFile.get_boolean ("Color appearance", "Sharpcie"); if (pedited) pedited->colorappearance.sharpcie = true; } const std::map tc_mapping = { {"Lightness", ColorAppearanceParams::TcMode::LIGHT}, @@ -3036,16 +2981,15 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Enabled", pedited, dirpyrDenoise.enabled, pedited->dirpyrDenoise.enabled); assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Enhance", pedited, dirpyrDenoise.enhance, pedited->dirpyrDenoise.enhance); assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Median", pedited, dirpyrDenoise.median, pedited->dirpyrDenoise.median); -// if (keyFile.has_key ("Directional Pyramid Denoising", "Perform")) { dirpyrDenoise.perform = keyFile.get_boolean ("Directional Pyramid Denoising", "Perform"); if (pedited) pedited->dirpyrDenoise.perform = true; } assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Luma", pedited, dirpyrDenoise.luma, pedited->dirpyrDenoise.luma); assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Ldetail", pedited, dirpyrDenoise.Ldetail, pedited->dirpyrDenoise.Ldetail); assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Chroma", pedited, dirpyrDenoise.chroma, pedited->dirpyrDenoise.chroma); assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "Method", pedited, dirpyrDenoise.dmethod, pedited->dirpyrDenoise.dmethod); assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "LMethod", pedited, dirpyrDenoise.Lmethod, pedited->dirpyrDenoise.Lmethod); assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "CMethod", pedited, dirpyrDenoise.Cmethod, pedited->dirpyrDenoise.Cmethod); -// never load 'auto chroma preview mode' from pp3 + if (dirpyrDenoise.Cmethod == "PRE") { - dirpyrDenoise.Cmethod = "MAN"; + dirpyrDenoise.Cmethod = "MAN"; // Never load 'auto chroma preview mode' from pp3 } assignFromKeyfile(keyFile, "Directional Pyramid Denoising", "C2Method", pedited, dirpyrDenoise.C2method, pedited->dirpyrDenoise.C2method); @@ -3082,21 +3026,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "FattalToneMapping", "Amount", pedited, fattal.amount, pedited->fattal.amount); } - // load lumaDenoise - /*if (keyFile.has_group ("Luminance Denoising")) { - if (keyFile.has_key ("Luminance Denoising", "Enabled")) { lumaDenoise.enabled = keyFile.get_boolean ("Luminance Denoising", "Enabled"); if (pedited) pedited->lumaDenoise.enabled = true; } - if (keyFile.has_key ("Luminance Denoising", "Radius")) { lumaDenoise.radius = keyFile.get_double ("Luminance Denoising", "Radius"); if (pedited) pedited->lumaDenoise.radius = true; } - if (keyFile.has_key ("Luminance Denoising", "EdgeTolerance")) { lumaDenoise.edgetolerance = keyFile.get_integer ("Luminance Denoising", "EdgeTolerance"); if (pedited) pedited->lumaDenoise.edgetolerance = true; } - }*/ - - // load colorDenoise - /*if (keyFile.has_group ("Chrominance Denoising")) { - if (keyFile.has_key ("Chrominance Denoising", "Enabled")) { colorDenoise.enabled = keyFile.get_boolean ("Chrominance Denoising", "Enabled"); if (pedited) pedited->colorDenoise.enabled = true; } - // WARNING: radius doesn't exist anymore; is there any compatibility issue that require to keep the following line? - if (keyFile.has_key ("Chrominance Denoising", "Radius")) { colorDenoise.amount = 10*keyFile.get_double ("Chrominance Denoising", "Radius"); } - if (keyFile.has_key ("Chrominance Denoising", "Amount")) { colorDenoise.amount = keyFile.get_integer ("Chrominance Denoising", "Amount"); if (pedited) pedited->colorDenoise.amount = true; } - }*/ - if (keyFile.has_group ("Shadows & Highlights")) { assignFromKeyfile(keyFile, "Shadows & Highlights", "Enabled", pedited, sh.enabled, pedited->sh.enabled); assignFromKeyfile(keyFile, "Shadows & Highlights", "HighQuality", pedited, sh.hq, pedited->sh.hq); @@ -3112,6 +3041,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Crop", "Enabled", pedited, crop.enabled, pedited->crop.enabled); assignFromKeyfile(keyFile, "Crop", "X", pedited, crop.x, pedited->crop.x); assignFromKeyfile(keyFile, "Crop", "Y", pedited, crop.y, pedited->crop.y); + if (keyFile.has_key ("Crop", "W")) { crop.w = std::max (keyFile.get_integer ("Crop", "W"), 1); @@ -3129,6 +3059,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } assignFromKeyfile(keyFile, "Crop", "FixedRatio", pedited, crop.fixratio, pedited->crop.fixratio); + if (assignFromKeyfile(keyFile, "Crop", "Ratio", pedited, crop.ratio, pedited->crop.ratio)) { //backwards compatibility for crop.ratio if (crop.ratio == "DIN") { @@ -3181,7 +3112,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->lensProf.lcpFile = true; } - if(ppVersion < 327 && !lensProf.lcpFile.empty()) { + if (ppVersion < 327 && !lensProf.lcpFile.empty()) { lensProf.lcMode = LensProfParams::LcMode::LCP; } } @@ -3189,6 +3120,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "LensProfile", "UseDistortion", pedited, lensProf.useDist, pedited->lensProf.useDist); assignFromKeyfile(keyFile, "LensProfile", "UseVignette", pedited, lensProf.useVign, pedited->lensProf.useVign); assignFromKeyfile(keyFile, "LensProfile", "UseCA", pedited, lensProf.useCA, pedited->lensProf.useCA); + if (keyFile.has_key("LensProfile", "LFCameraMake")) { lensProf.lfCameraMake = keyFile.get_string("LensProfile", "LFCameraMake"); if (pedited) { @@ -3259,6 +3191,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "PostResizeSharpening", "Enabled", pedited, prsharpening.enabled, pedited->prsharpening.enabled); assignFromKeyfile(keyFile, "PostResizeSharpening", "Radius", pedited, prsharpening.radius, pedited->prsharpening.radius); assignFromKeyfile(keyFile, "PostResizeSharpening", "Amount", pedited, prsharpening.amount, pedited->prsharpening.amount); + if (keyFile.has_key ("PostResizeSharpening", "Threshold")) { if (ppVersion < 302) { int thresh = min (keyFile.get_integer ("PostResizeSharpening", "Threshold"), 2000); @@ -3304,6 +3237,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color Management", "DCPIlluminant", pedited, icm.dcpIlluminant, pedited->icm.dcpIlluminant); assignFromKeyfile(keyFile, "Color Management", "WorkingProfile", pedited, icm.working, pedited->icm.working); assignFromKeyfile(keyFile, "Color Management", "OutputProfile", pedited, icm.output, pedited->icm.output); + if (keyFile.has_key ("Color Management", "OutputProfileIntent")) { Glib::ustring intent = keyFile.get_string ("Color Management", "OutputProfileIntent"); @@ -3344,7 +3278,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "CBbluehigh", pedited, wavelet.bluehigh, pedited->wavelet.bluehigh); assignFromKeyfile(keyFile, "Wavelet", "CBbluemed", pedited, wavelet.bluemed, pedited->wavelet.bluemed); assignFromKeyfile(keyFile, "Wavelet", "CBbluelow", pedited, wavelet.bluelow, pedited->wavelet.bluelow); -// if (keyFile.has_key ("Wavelet", "Edgreinf")) {wavelet.edgreinf = keyFile.get_boolean ("Wavelet", "Edgreinf");if (pedited) pedited->wavelet.edgreinf = true;} assignFromKeyfile(keyFile, "Wavelet", "Lipst", pedited, wavelet.lipst, pedited->wavelet.lipst); assignFromKeyfile(keyFile, "Wavelet", "AvoidColorShift", pedited, wavelet.avoid, pedited->wavelet.avoid); assignFromKeyfile(keyFile, "Wavelet", "TMr", pedited, wavelet.tmr, pedited->wavelet.tmr); @@ -3393,6 +3326,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "HHcurve", pedited, wavelet.hhcurve, pedited->wavelet.hhcurve); assignFromKeyfile(keyFile, "Wavelet", "CHcurve", pedited, wavelet.Chcurve, pedited->wavelet.Chcurve); assignFromKeyfile(keyFile, "Wavelet", "WavclCurve", pedited, wavelet.wavclCurve, pedited->wavelet.wavclCurve); + if (keyFile.has_key ("Wavelet", "Hueskin")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Hueskin"); @@ -3404,6 +3338,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.hueskin = true; } } + if (keyFile.has_key ("Wavelet", "HueRange")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "HueRange"); @@ -3415,6 +3350,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.hueskin2 = true; } } + if (keyFile.has_key ("Wavelet", "HLRange")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "HLRange"); @@ -3426,6 +3362,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.hllev = true; } } + if (keyFile.has_key ("Wavelet", "SHRange")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "SHRange"); @@ -3437,6 +3374,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.bllev = true; } } + if (keyFile.has_key ("Wavelet", "Edgcont")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Edgcont"); @@ -3448,6 +3386,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.edgcont = true; } } + if (keyFile.has_key ("Wavelet", "Level0noise")) { const std::vector thresh = keyFile.get_double_list ("Wavelet", "Level0noise"); @@ -3459,6 +3398,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.level0noise = true; } } + if (keyFile.has_key ("Wavelet", "Level1noise")) { const std::vector thresh = keyFile.get_double_list ("Wavelet", "Level1noise"); @@ -3470,6 +3410,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.level1noise = true; } } + if (keyFile.has_key ("Wavelet", "Level2noise")) { const std::vector thresh = keyFile.get_double_list ("Wavelet", "Level2noise"); @@ -3481,6 +3422,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.level2noise = true; } } + if (keyFile.has_key ("Wavelet", "Level3noise")) { const std::vector thresh = keyFile.get_double_list ("Wavelet", "Level3noise"); @@ -3492,6 +3434,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.level3noise = true; } } + if (keyFile.has_key ("Wavelet", "Pastlev")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Pastlev"); @@ -3503,6 +3446,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.pastlev = true; } } + if (keyFile.has_key ("Wavelet", "Satlev")) { const std::vector thresh = keyFile.get_integer_list ("Wavelet", "Satlev"); @@ -3514,10 +3458,12 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->wavelet.satlev = true; } } + assignFromKeyfile(keyFile, "Wavelet", "Skinprotect", pedited, wavelet.skinprotect, pedited->wavelet.skinprotect); assignFromKeyfile(keyFile, "Wavelet", "Expcontrast", pedited, wavelet.expcontrast, pedited->wavelet.expcontrast); assignFromKeyfile(keyFile, "Wavelet", "Expchroma", pedited, wavelet.expchroma, pedited->wavelet.expchroma); - for (int i = 0; i < 9; i ++) { + + for (int i = 0; i < 9; ++i) { std::stringstream ss; ss << "Contrast" << (i + 1); @@ -3529,7 +3475,8 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } } - for (int i = 0; i < 9; i ++) { + + for (int i = 0; i < 9; ++i) { std::stringstream ss; ss << "Chroma" << (i + 1); @@ -3552,7 +3499,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "Enabled", pedited, dirpyrequalizer.enabled, pedited->dirpyrequalizer.enabled); assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "Gamutlab", pedited, dirpyrequalizer.gamutlab, pedited->dirpyrequalizer.gamutlab); assignFromKeyfile(keyFile, "Directional Pyramid Equalizer", "cbdlMethod", pedited, dirpyrequalizer.cbdlMethod, pedited->dirpyrequalizer.cbdlMethod); -// if (keyFile.has_key ("Directional Pyramid Equalizer", "Algorithm")) { dirpyrequalizer.algo = keyFile.get_string ("Directional Pyramid Equalizer", "Algorithm"); if (pedited) pedited->dirpyrequalizer.algo = true; } + if (keyFile.has_key ("Directional Pyramid Equalizer", "Hueskin")) { const std::vector thresh = keyFile.get_integer_list ("Directional Pyramid Equalizer", "Hueskin"); @@ -3564,6 +3511,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->dirpyrequalizer.hueskin = true; } } + if (ppVersion < 316) { for (int i = 0; i < 5; i ++) { std::stringstream ss; @@ -3588,7 +3536,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) dirpyrequalizer.mult[4] = 1.0; } else { -// 5 level wavelet + dedicated threshold parameter + // 5 level wavelet + dedicated threshold parameter for (int i = 0; i < 6; i ++) { std::stringstream ss; ss << "Mult" << i; @@ -3649,6 +3597,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "ColorToning", "SatProtectionThreshold", pedited, colorToning.satProtectionThreshold, pedited->colorToning.satprotectionthreshold); assignFromKeyfile(keyFile, "ColorToning", "SaturatedOpacity", pedited, colorToning.saturatedOpacity, pedited->colorToning.saturatedopacity); assignFromKeyfile(keyFile, "ColorToning", "Strength", pedited, colorToning.strength, pedited->colorToning.strength); + if (keyFile.has_key ("ColorToning", "HighlightsColorSaturation")) { const std::vector thresh = keyFile.get_integer_list ("ColorToning", "HighlightsColorSaturation"); @@ -3660,6 +3609,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->colorToning.hlColSat = true; } } + if (keyFile.has_key ("ColorToning", "ShadowsColorSaturation")) { const std::vector thresh = keyFile.get_integer_list ("ColorToning", "ShadowsColorSaturation"); @@ -3671,6 +3621,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->colorToning.shadowsColSat = true; } } + assignFromKeyfile(keyFile, "ColorToning", "ClCurve", pedited, colorToning.clcurve, pedited->colorToning.clcurve); assignFromKeyfile(keyFile, "ColorToning", "Cl2Curve", pedited, colorToning.cl2curve, pedited->colorToning.cl2curve); assignFromKeyfile(keyFile, "ColorToning", "Redlow", pedited, colorToning.redlow, pedited->colorToning.redlow); @@ -3695,7 +3646,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.darkFrame = true; } } + assignFromKeyfile(keyFile, "RAW", "DarkFrameAuto", pedited, raw.df_autoselect, pedited->raw.df_autoselect); + if (keyFile.has_key ("RAW", "FlatFieldFile")) { raw.ff_file = expandRelativePath (fname, "", keyFile.get_string ("RAW", "FlatFieldFile" )); @@ -3703,6 +3656,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.ff_file = true; } } + assignFromKeyfile(keyFile, "RAW", "FlatFieldAutoSelect", pedited, raw.ff_AutoSelect, pedited->raw.ff_AutoSelect); assignFromKeyfile(keyFile, "RAW", "FlatFieldBlurRadius", pedited, raw.ff_BlurRadius, pedited->raw.ff_BlurRadius); assignFromKeyfile(keyFile, "RAW", "FlatFieldBlurType", pedited, raw.ff_BlurType, pedited->raw.ff_BlurType); @@ -3733,12 +3687,12 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "RAW", "PreBlacktwo", pedited, raw.bayersensor.black2, pedited->raw.bayersensor.exBlack2); assignFromKeyfile(keyFile, "RAW", "PreBlackthree", pedited, raw.bayersensor.black3, pedited->raw.bayersensor.exBlack3); assignFromKeyfile(keyFile, "RAW", "PreTwoGreen", pedited, raw.bayersensor.twogreen, pedited->raw.bayersensor.exTwoGreen); -//if (keyFile.has_key ("RAW", "ALLEnhance")) { raw.bayersensor.all_enhance = keyFile.get_boolean("RAW", "ALLEnhance"); if (pedited) pedited->raw.bayersensor.allEnhance = true; } } } if (keyFile.has_group ("RAW Bayer")) { assignFromKeyfile(keyFile, "RAW Bayer", "Method", pedited, raw.bayersensor.method, pedited->raw.bayersensor.method); + if (keyFile.has_key ("RAW Bayer", "ImageNum")) { raw.bayersensor.imageNum = keyFile.get_integer ("RAW Bayer", "ImageNum") - 1; @@ -3746,6 +3700,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.bayersensor.imageNum = true; } } + assignFromKeyfile(keyFile, "RAW Bayer", "CcSteps", pedited, raw.bayersensor.ccSteps, pedited->raw.bayersensor.ccSteps); assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack0", pedited, raw.bayersensor.black0, pedited->raw.bayersensor.exBlack0); assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack1", pedited, raw.bayersensor.black1, pedited->raw.bayersensor.exBlack1); @@ -3758,6 +3713,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "RAW Bayer", "DCBEnhance", pedited, raw.bayersensor.dcb_enhance, pedited->raw.bayersensor.dcbEnhance); assignFromKeyfile(keyFile, "RAW Bayer", "LMMSEIterations", pedited, raw.bayersensor.lmmse_iterations, pedited->raw.bayersensor.lmmseIterations); assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftMotion", pedited, raw.bayersensor.pixelShiftMotion, pedited->raw.bayersensor.pixelShiftMotion); + if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrection")) { raw.bayersensor.pixelShiftMotionCorrection = (RAWParams::BayerSensor::PSMotionCorrection)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrection"); @@ -3765,6 +3721,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.bayersensor.pixelShiftMotionCorrection = true; } } + if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrectionMethod")) { raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::PSMotionCorrectionMethod)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrectionMethod"); @@ -3772,6 +3729,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod = true; } } + assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorGreen", pedited, raw.bayersensor.pixelShiftStddevFactorGreen, pedited->raw.bayersensor.pixelShiftStddevFactorGreen); assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorRed", pedited, raw.bayersensor.pixelShiftStddevFactorRed, pedited->raw.bayersensor.pixelShiftStddevFactorRed); assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftStddevFactorBlue", pedited, raw.bayersensor.pixelShiftStddevFactorBlue, pedited->raw.bayersensor.pixelShiftStddevFactorBlue); @@ -3868,19 +3826,17 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) return 0; } -ProcParams* ProcParams::create () +ProcParams* ProcParams::create() { - return new ProcParams(); } -void ProcParams::destroy (ProcParams* pp) +void ProcParams::destroy(ProcParams* pp) { - delete pp; } -bool ProcParams::operator== (const ProcParams& other) +bool ProcParams::operator ==(const ProcParams& other) { return toneCurve.curve == other.toneCurve.curve @@ -3989,16 +3945,10 @@ bool ProcParams::operator== (const ProcParams& other) && vibrance.avoidcolorshift == other.vibrance.avoidcolorshift && vibrance.pastsattog == other.vibrance.pastsattog && vibrance.skintonescurve == other.vibrance.skintonescurve - //&& colorBoost.amount == other.colorBoost.amount - //&& colorBoost.avoidclip == other.colorBoost.avoidclip - //&& colorBoost.enable_saturationlimiter == other.colorBoost.enable_saturationlimiter - //&& colorBoost.saturationlimit == other.colorBoost.saturationlimit && wb.method == other.wb.method && wb.green == other.wb.green && wb.temperature == other.wb.temperature && wb.equal == other.wb.equal - //&& colorShift.a == other.colorShift.a - //&& colorShift.b == other.colorShift.b && colorappearance.enabled == other.colorappearance.enabled && colorappearance.degree == other.colorappearance.degree && colorappearance.autodegree == other.colorappearance.autodegree @@ -4036,7 +3986,6 @@ bool ProcParams::operator== (const ProcParams& other) && dirpyrDenoise.enabled == other.dirpyrDenoise.enabled && dirpyrDenoise.enhance == other.dirpyrDenoise.enhance && dirpyrDenoise.median == other.dirpyrDenoise.median -// && dirpyrDenoise.perform == other.dirpyrDenoise.perform && dirpyrDenoise.luma == other.dirpyrDenoise.luma && dirpyrDenoise.lcurve == other.dirpyrDenoise.lcurve && dirpyrDenoise.cccurve == other.dirpyrDenoise.cccurve @@ -4067,13 +4016,6 @@ bool ProcParams::operator== (const ProcParams& other) && defringe.radius == other.defringe.radius && defringe.threshold == other.defringe.threshold && defringe.huecurve == other.defringe.huecurve - - //&& lumaDenoise.enabled == other.lumaDenoise.enabled - //&& lumaDenoise.radius == other.lumaDenoise.radius - //&& lumaDenoise.edgetolerance == other.lumaDenoise.edgetolerance - //&& colorDenoise.enabled == other.colorDenoise.enabled - //&& colorDenoise.edgetolerance == other.colorDenoise.edgetolerance - //&& colorDenoise.edgesensitive == other.colorDenoise.edgesensitive && sh.enabled == other.sh.enabled && sh.hq == other.sh.hq && sh.highlights == other.sh.highlights @@ -4311,7 +4253,6 @@ bool ProcParams::operator== (const ProcParams& other) && wavelet.bluelow == other.wavelet.bluelow && wavelet.iter == other.wavelet.iter && dirpyrequalizer == other.dirpyrequalizer - // && dirpyrequalizer.algo == other.dirpyrequalizer.algo && dirpyrequalizer.hueskin == other.dirpyrequalizer.hueskin && dirpyrequalizer.threshold == other.dirpyrequalizer.threshold && dirpyrequalizer.cbdlMethod == other.dirpyrequalizer.cbdlMethod @@ -4354,23 +4295,21 @@ bool ProcParams::operator== (const ProcParams& other) && iptc == other.iptc; } -bool ProcParams::operator!= (const ProcParams& other) +bool ProcParams::operator !=(const ProcParams& other) { - return !(*this == other); } -void ProcParams::init () +void ProcParams::init() { } -void ProcParams::cleanup () +void ProcParams::cleanup() { } -int ProcParams::write (const Glib::ustring &fname, const Glib::ustring &content) const +int ProcParams::write(const Glib::ustring& fname, const Glib::ustring& content) const { - int error = 0; if (fname.length()) { @@ -4388,7 +4327,7 @@ int ProcParams::write (const Glib::ustring &fname, const Glib::ustring &content) return error; } -PartialProfile::PartialProfile (bool createInstance, bool paramsEditedValue) +PartialProfile::PartialProfile(bool createInstance, bool paramsEditedValue) { if (createInstance) { pparams = new ProcParams(); @@ -4399,7 +4338,7 @@ PartialProfile::PartialProfile (bool createInstance, bool paramsEditedValue) } } -PartialProfile::PartialProfile (ProcParams* pp, ParamsEdited* pe, bool fullCopy) +PartialProfile::PartialProfile(ProcParams* pp, ParamsEdited* pe, bool fullCopy) { if (fullCopy && pp) { pparams = new ProcParams (*pp); @@ -4414,7 +4353,7 @@ PartialProfile::PartialProfile (ProcParams* pp, ParamsEdited* pe, bool fullCopy) } } -PartialProfile::PartialProfile (const ProcParams* pp, const ParamsEdited* pe) +PartialProfile::PartialProfile(const ProcParams* pp, const ParamsEdited* pe) { if (pp) { pparams = new ProcParams (*pp); @@ -4429,7 +4368,7 @@ PartialProfile::PartialProfile (const ProcParams* pp, const ParamsEdited* pe) } } -void PartialProfile::deleteInstance () +void PartialProfile::deleteInstance() { if (pparams) { delete pparams; @@ -4442,7 +4381,7 @@ void PartialProfile::deleteInstance () } } -void PartialProfile::clearGeneral () +void PartialProfile::clearGeneral() { if (pedited) { pedited->general.colorlabel = false; @@ -4451,7 +4390,7 @@ void PartialProfile::clearGeneral () } } -int PartialProfile::load (const Glib::ustring &fName) +int PartialProfile::load(const Glib::ustring& fName) { if (!pparams) { pparams = new ProcParams(); @@ -4474,14 +4413,14 @@ int PartialProfile::load (const Glib::ustring &fName) * Set the all values of the General section to false * in order to preserve them in applyTo */ -void PartialProfile::set (bool v) +void PartialProfile::set(bool v) { if (pedited) { pedited->set (v); } } -void PartialProfile::applyTo (ProcParams *destParams) const +void PartialProfile::applyTo(ProcParams* destParams) const { if (destParams && pparams && pedited) { pedited->combine (*destParams, *pparams, true); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 609c31b5e..44f0268c5 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -28,7 +28,6 @@ #include "coord.h" #include "LUT.h" -#include "utils.h" class ParamsEdited; @@ -1005,7 +1004,14 @@ struct WaveletParams { WaveletParams(); - void getCurves(WavCurve& cCurve, WavOpacityCurveRG& opacityCurveLUTRG, WavOpacityCurveBY& opacityCurveLUTBY, WavOpacityCurveW& opacityCurveLUTW, WavOpacityCurveWL& opacityCurveLUTWL) const; + void getCurves( + WavCurve& cCurve, + WavOpacityCurveRG& + opacityCurveLUTRG, + WavOpacityCurveBY& opacityCurveLUTBY, + WavOpacityCurveW& opacityCurveLUTW, + WavOpacityCurveWL& opacityCurveLUTWL + ) const; }; /** @@ -1208,7 +1214,7 @@ class ProcParams public: ToneCurveParams toneCurve; ///< Tone curve parameters LCurveParams labCurve; ///< CIELAB luminance curve parameters - RetinexParams retinex; ///< Retinex parameters + RetinexParams retinex; ///< Retinex parameters RGBCurvesParams rgbCurves; ///< RGB curves parameters ColorToningParams colorToning; ///< Color Toning parameters SharpeningParams sharpening; ///< Sharpening parameters @@ -1216,17 +1222,13 @@ public: SharpenEdgeParams sharpenEdge; ///< Sharpen edge parameters SharpenMicroParams sharpenMicro; ///< Sharpen microcontrast parameters VibranceParams vibrance; ///< Vibrance parameters - //ColorBoostParams colorBoost; ///< Color boost parameters WBParams wb; ///< White balance parameters ColorAppearanceParams colorappearance; - //ColorShiftParams colorShift; ///< Color shift parameters - //LumaDenoiseParams lumaDenoise; ///< Luminance denoising parameters - //ColorDenoiseParams colorDenoise; ///< Color denoising parameters DefringeParams defringe; ///< Defringing parameters ImpulseDenoiseParams impulseDenoise; ///< Impulse denoising parameters DirPyrDenoiseParams dirpyrDenoise; ///< Directional Pyramid denoising parameters EPDParams epd; ///< Edge Preserving Decomposition parameters - FattalToneMappingParams fattal; ///< Fattal02 tone mapping + FattalToneMappingParams fattal; ///< Fattal02 tone mapping SHParams sh; ///< Shadow/highlight enhancement parameters CropParams crop; ///< Crop parameters CoarseTransformParams coarse; ///< Coarse transformation (90, 180, 270 deg rotation, h/v flipping) parameters @@ -1254,17 +1256,17 @@ public: Glib::ustring appVersion; ///< Version of the application that generated the parameters int ppVersion; ///< Version of the PP file from which the parameters have been read - ExifPairs exif; ///< List of modifications appplied on the exif tags of the input image - IPTCPairs iptc; ///< The IPTC tags and values to be saved to the output image + ExifPairs exif; ///< List of modifications appplied on the exif tags of the input image + IPTCPairs iptc; ///< The IPTC tags and values to be saved to the output image /** * The constructor only sets the hand-wired defaults. */ - ProcParams (); + ProcParams(); /** * Sets the hand-wired defaults parameters. */ - void setDefaults (); + void setDefaults(); /** * Saves the parameters to possibly two files. This is a performance improvement if a function has to * save the same file in two different location, i.e. the cache and the image's directory @@ -1275,28 +1277,28 @@ public: * @param pedited pointer to a ParamsEdited object (optional) to store which values has to be saved * @return Error code (=0 if all supplied filenames where created correctly) */ - int save (const Glib::ustring& fname, const Glib::ustring& fname2 = "", bool fnameAbsolute = true, ParamsEdited* pedited = nullptr); + int save(const Glib::ustring& fname, const Glib::ustring& fname2 = Glib::ustring(), bool fnameAbsolute = true, ParamsEdited* pedited = nullptr); /** * Loads the parameters from a file. * @param fname the name of the file * @params pedited pointer to a ParamsEdited object (optional) to store which values has been loaded * @return Error code (=0 if no error) */ - int load (const Glib::ustring& fname, ParamsEdited* pedited = nullptr); + int load(const Glib::ustring& fname, ParamsEdited* pedited = nullptr); /** Creates a new instance of ProcParams. * @return a pointer to the new ProcParams instance. */ - static ProcParams* create (); + static ProcParams* create (); /** Destroys an instance of ProcParams. * @param pp a pointer to the ProcParams instance to destroy. */ - static void destroy (ProcParams* pp); + static void destroy(ProcParams* pp); - static void init (); - static void cleanup (); + static void init(); + static void cleanup(); - bool operator== (const ProcParams& other); - bool operator!= (const ProcParams& other); + bool operator ==(const ProcParams& other); + bool operator !=(const ProcParams& other); private: /** Write the ProcParams's text in the file of the given name. @@ -1304,7 +1306,7 @@ private: * @param content the text to write * @return Error code (=0 if no error) * */ - int write (const Glib::ustring& fname, const Glib::ustring& content) const; + int write(const Glib::ustring& fname, const Glib::ustring& content) const; }; @@ -1322,7 +1324,7 @@ class PartialProfile public: rtengine::procparams::ProcParams* pparams; ParamsEdited* pedited; - PartialProfile& operator = (const PartialProfile& rhs) + PartialProfile& operator =(const PartialProfile& rhs) { pparams = rhs.pparams; pedited = rhs.pedited; From 0eb3969279f25cef60e442d7f7139894b4e31c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Tue, 21 Nov 2017 18:11:26 +0100 Subject: [PATCH 13/47] Make `PartialProfile` non-copyable --- rtengine/procparams.cc | 10 ++++++++++ rtengine/procparams.h | 36 ++++++++++++++---------------------- rtgui/filebrowser.cc | 4 ++-- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 150dbbb70..a7a9686ef 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -4427,6 +4427,16 @@ void PartialProfile::applyTo(ProcParams* destParams) const } } +AutoPartialProfile::AutoPartialProfile() : + PartialProfile(true) +{ +} + +AutoPartialProfile::~AutoPartialProfile() +{ + deleteInstance(); +} + } } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 44f0268c5..7ec39d3cf 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -28,6 +28,7 @@ #include "coord.h" #include "LUT.h" +#include "noncopyable.h" class ParamsEdited; @@ -1307,7 +1308,6 @@ private: * @return Error code (=0 if no error) * */ int write(const Glib::ustring& fname, const Glib::ustring& content) const; - }; /** @@ -1319,26 +1319,21 @@ private: * and hence is not responsible of their destructions. The function that instanciate * PartialProfile object has to handle all this itself. */ -class PartialProfile +class PartialProfile : + public NonCopyable { public: + PartialProfile(bool createInstance = false, bool paramsEditedValue = false); + PartialProfile(ProcParams* pp, ParamsEdited* pe = nullptr, bool fullCopy = false); + PartialProfile(const ProcParams* pp, const ParamsEdited* pe = nullptr); + void deleteInstance(); + void clearGeneral(); + int load(const Glib::ustring& fName); + void set(bool v); + void applyTo(ProcParams* destParams) const ; + rtengine::procparams::ProcParams* pparams; ParamsEdited* pedited; - PartialProfile& operator =(const PartialProfile& rhs) - { - pparams = rhs.pparams; - pedited = rhs.pedited; - return *this; - }; - - PartialProfile (bool createInstance = false, bool paramsEditedValue = false); - PartialProfile (ProcParams* pp, ParamsEdited* pe = nullptr, bool fullCopy = false); - PartialProfile (const ProcParams* pp, const ParamsEdited* pe = nullptr); - void deleteInstance (); - void clearGeneral (); - int load (const Glib::ustring& fName); - void set (bool v); - void applyTo (ProcParams *destParams) const ; }; /** @@ -1350,11 +1345,8 @@ class AutoPartialProfile : public PartialProfile { public: - AutoPartialProfile() : PartialProfile (true) {} - ~AutoPartialProfile() - { - deleteInstance(); - } + AutoPartialProfile(); + ~AutoPartialProfile(); }; } diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index cda737285..b308911a7 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -1021,7 +1021,7 @@ void FileBrowser::pasteProfile () for (unsigned int i = 0; i < mselected.size(); i++) { // copying read only clipboard PartialProfile to a temporary one - rtengine::procparams::PartialProfile cbPartProf = clipboard.getPartialProfile(); + const rtengine::procparams::PartialProfile& cbPartProf = clipboard.getPartialProfile(); rtengine::procparams::PartialProfile pastedPartProf(cbPartProf.pparams, cbPartProf.pedited, true); // applying the PartialProfile to the thumb's ProcParams @@ -1069,7 +1069,7 @@ void FileBrowser::partPasteProfile () for (unsigned int i = 0; i < mselected.size(); i++) { // copying read only clipboard PartialProfile to a temporary one, initialized to the thumb's ProcParams mselected[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file - rtengine::procparams::PartialProfile cbPartProf = clipboard.getPartialProfile(); + const rtengine::procparams::PartialProfile& cbPartProf = clipboard.getPartialProfile(); rtengine::procparams::PartialProfile pastedPartProf(&mselected[i]->thumbnail->getProcParams (), nullptr); // pushing the selected values of the clipboard PartialProfile to the temporary PartialProfile From a1a583a077e1a307ee82aca465ed16cea52d9e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Tue, 21 Nov 2017 18:21:03 +0100 Subject: [PATCH 14/47] Fix SEGV in `ProcParams::load()` --- rtengine/procparams.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index a7a9686ef..e2c16a35d 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3668,7 +3668,9 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) // For compatibility to elder pp3 versions assignFromKeyfile(keyFile, "RAW", "HotDeadPixels", pedited, raw.hotPixelFilter, pedited->raw.hotPixelFilter); raw.deadPixelFilter = raw.hotPixelFilter; - pedited->raw.deadPixelFilter = pedited->raw.hotPixelFilter; + if (pedited) { + pedited->raw.deadPixelFilter = pedited->raw.hotPixelFilter; + } assignFromKeyfile(keyFile, "RAW", "HotPixelFilter", pedited, raw.hotPixelFilter, pedited->raw.hotPixelFilter); assignFromKeyfile(keyFile, "RAW", "DeadPixelFilter", pedited, raw.deadPixelFilter, pedited->raw.deadPixelFilter); assignFromKeyfile(keyFile, "RAW", "HotDeadPixelThresh", pedited, raw.hotdeadpix_thresh, pedited->raw.hotdeadpix_thresh); From 7ba16a6f0623b7920bd4e995abfc34e97ba239e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Wed, 22 Nov 2017 20:41:13 +0100 Subject: [PATCH 15/47] Bump PP version to 328 due to `ff_clipControl` (by @heckflosse) --- rtengine/procparams.cc | 8 +++++++- rtgui/ppversion.h | 11 +++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index e2c16a35d..159d9f503 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3661,7 +3661,13 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "RAW", "FlatFieldBlurRadius", pedited, raw.ff_BlurRadius, pedited->raw.ff_BlurRadius); assignFromKeyfile(keyFile, "RAW", "FlatFieldBlurType", pedited, raw.ff_BlurType, pedited->raw.ff_BlurType); assignFromKeyfile(keyFile, "RAW", "FlatFieldAutoClipControl", pedited, raw.ff_AutoClipControl, pedited->raw.ff_AutoClipControl); - assignFromKeyfile(keyFile, "RAW", "FlatFieldClipControl", pedited, raw.ff_clipControl, pedited->raw.ff_clipControl); + if (ppVersion < 328) { + // With ppversion < 328 this value was stored as a boolean, which is nonsense. + // To avoid annoying warnings we skip reading and assume 0. + raw.ff_clipControl = 0; + } else { + assignFromKeyfile(keyFile, "RAW", "FlatFieldClipControl", pedited, raw.ff_clipControl, pedited->raw.ff_clipControl); + } assignFromKeyfile(keyFile, "RAW", "CA", pedited, raw.ca_autocorrect, pedited->raw.ca_autocorrect); assignFromKeyfile(keyFile, "RAW", "CARed", pedited, raw.cared, pedited->raw.cared); assignFromKeyfile(keyFile, "RAW", "CABlue", pedited, raw.cablue, pedited->raw.cablue); diff --git a/rtgui/ppversion.h b/rtgui/ppversion.h index d2e9be090..d799be406 100644 --- a/rtgui/ppversion.h +++ b/rtgui/ppversion.h @@ -1,14 +1,15 @@ -#ifndef _PPVERSION_ -#define _PPVERSION_ +#pragma once // This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes -#define PPVERSION 327 +#define PPVERSION 328 #define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified /* Log of version changes + 328 2017-11-22 + Fix wrong type of ff_clipControl 327 2017-09-15 - [Profiles Lens Correction] Added Lensfun + [Profiled Lens Correction] Added Lensfun 326 2015-07-26 [Exposure] Added 'Perceptual' tone curve mode 325 2015-07-23 @@ -45,5 +46,3 @@ added [Directional Pyramid Denoising] Method, Redchro, Bluechro added [RGB Curves] LumaMode */ - -#endif From 421fa881c35423958757098be9cc221b5a9945eb Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 23 Nov 2017 16:25:47 +0100 Subject: [PATCH 16/47] RCD demosaic: fixed potential divisons by zero (due to non-associativity and cancellation effects of ops on floats) --- rtengine/demosaic_algos.cc | 45 +++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 0eb920a36..e1efcda86 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -4003,17 +4003,22 @@ void RawImageSource::rcd_demosaic() for (int col = 4, indx = row * width + col; col < width - 4; col++, indx++ ) { //Calculate h/v local discrimination - float V_Stat = epssq - 18.0f * cfa[indx] * cfa[indx - w1] - 18.0f * cfa[indx] * cfa[indx + w1] - 36.0f * cfa[indx] * cfa[indx - w2] - 36.0f * cfa[indx] * cfa[indx + w2] + 18.0f * cfa[indx] * cfa[indx - w3] + 18.0f * cfa[indx] * cfa[indx + w3] - 2.0f * cfa[indx] * cfa[indx - w4] - 2.0f * cfa[indx] * cfa[indx + w4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1] * cfa[indx + w1] - 12.0f * cfa[indx - w1] * cfa[indx - w2] + 24.0f * cfa[indx - w1] * cfa[indx + w2] - 38.0f * cfa[indx - w1] * cfa[indx - w3] + 16.0f * cfa[indx - w1] * cfa[indx + w3] + 12.0f * cfa[indx - w1] * cfa[indx - w4] - 6.0f * cfa[indx - w1] * cfa[indx + w4] + 46.0f * cfa[indx - w1] * cfa[indx - w1] + 24.0f * cfa[indx + w1] * cfa[indx - w2] - 12.0f * cfa[indx + w1] * cfa[indx + w2] + 16.0f * cfa[indx + w1] * cfa[indx - w3] - 38.0f * cfa[indx + w1] * cfa[indx + w3] - 6.0f * cfa[indx + w1] * cfa[indx - w4] + 12.0f * cfa[indx + w1] * cfa[indx + w4] + 46.0f * cfa[indx + w1] * cfa[indx + w1] + 14.0f * cfa[indx - w2] * cfa[indx + w2] - 12.0f * cfa[indx - w2] * cfa[indx + w3] - 2.0f * cfa[indx - w2] * cfa[indx - w4] + 2.0f * cfa[indx - w2] * cfa[indx + w4] + 11.0f * cfa[indx - w2] * cfa[indx - w2] - 12.0f * cfa[indx + w2] * cfa[indx - w3] + 2.0f * cfa[indx + w2] * cfa[indx - w4] - 2.0f * cfa[indx + w2] * cfa[indx + w4] + 11.0f * cfa[indx + w2] * cfa[indx + w2] + 2.0f * cfa[indx - w3] * cfa[indx + w3] - 6.0f * cfa[indx - w3] * cfa[indx - w4] + 10.0f * cfa[indx - w3] * cfa[indx - w3] - 6.0f * cfa[indx + w3] * cfa[indx + w4] + 10.0f * cfa[indx + w3] * cfa[indx + w3] + 1.0f * cfa[indx - w4] * cfa[indx - w4] + 1.0f * cfa[indx + w4] * cfa[indx + w4]; - float H_Stat = epssq - 18.0f * cfa[indx] * cfa[indx - 1] - 18.0f * cfa[indx] * cfa[indx + 1] - 36.0f * cfa[indx] * cfa[indx - 2] - 36.0f * cfa[indx] * cfa[indx + 2] + 18.0f * cfa[indx] * cfa[indx - 3] + 18.0f * cfa[indx] * cfa[indx + 3] - 2.0f * cfa[indx] * cfa[indx - 4] - 2.0f * cfa[indx] * cfa[indx + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - 1] * cfa[indx + 1] - 12.0f * cfa[indx - 1] * cfa[indx - 2] + 24.0f * cfa[indx - 1] * cfa[indx + 2] - 38.0f * cfa[indx - 1] * cfa[indx - 3] + 16.0f * cfa[indx - 1] * cfa[indx + 3] + 12.0f * cfa[indx - 1] * cfa[indx - 4] - 6.0f * cfa[indx - 1] * cfa[indx + 4] + 46.0f * cfa[indx - 1] * cfa[indx - 1] + 24.0f * cfa[indx + 1] * cfa[indx - 2] - 12.0f * cfa[indx + 1] * cfa[indx + 2] + 16.0f * cfa[indx + 1] * cfa[indx - 3] - 38.0f * cfa[indx + 1] * cfa[indx + 3] - 6.0f * cfa[indx + 1] * cfa[indx - 4] + 12.0f * cfa[indx + 1] * cfa[indx + 4] + 46.0f * cfa[indx + 1] * cfa[indx + 1] + 14.0f * cfa[indx - 2] * cfa[indx + 2] - 12.0f * cfa[indx - 2] * cfa[indx + 3] - 2.0f * cfa[indx - 2] * cfa[indx - 4] + 2.0f * cfa[indx - 2] * cfa[indx + 4] + 11.0f * cfa[indx - 2] * cfa[indx - 2] - 12.0f * cfa[indx + 2] * cfa[indx - 3] + 2.0f * cfa[indx + 2] * cfa[indx - 4] - 2.0f * cfa[indx + 2] * cfa[indx + 4] + 11.0f * cfa[indx + 2] * cfa[indx + 2] + 2.0f * cfa[indx - 3] * cfa[indx + 3] - 6.0f * cfa[indx - 3] * cfa[indx - 4] + 10.0f * cfa[indx - 3] * cfa[indx - 3] - 6.0f * cfa[indx + 3] * cfa[indx + 4] + 10.0f * cfa[indx + 3] * cfa[indx + 3] + 1.0f * cfa[indx - 4] * cfa[indx - 4] + 1.0f * cfa[indx + 4] * cfa[indx + 4]; + float V_Stat = epssq + (- 18.0f * cfa[indx] * cfa[indx - w1] - 18.0f * cfa[indx] * cfa[indx + w1] - 36.0f * cfa[indx] * cfa[indx - w2] - 36.0f * cfa[indx] * cfa[indx + w2] + 18.0f * cfa[indx] * cfa[indx - w3] + 18.0f * cfa[indx] * cfa[indx + w3] - 2.0f * cfa[indx] * cfa[indx - w4] - 2.0f * cfa[indx] * cfa[indx + w4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1] * cfa[indx + w1] - 12.0f * cfa[indx - w1] * cfa[indx - w2] + 24.0f * cfa[indx - w1] * cfa[indx + w2] - 38.0f * cfa[indx - w1] * cfa[indx - w3] + 16.0f * cfa[indx - w1] * cfa[indx + w3] + 12.0f * cfa[indx - w1] * cfa[indx - w4] - 6.0f * cfa[indx - w1] * cfa[indx + w4] + 46.0f * cfa[indx - w1] * cfa[indx - w1] + 24.0f * cfa[indx + w1] * cfa[indx - w2] - 12.0f * cfa[indx + w1] * cfa[indx + w2] + 16.0f * cfa[indx + w1] * cfa[indx - w3] - 38.0f * cfa[indx + w1] * cfa[indx + w3] - 6.0f * cfa[indx + w1] * cfa[indx - w4] + 12.0f * cfa[indx + w1] * cfa[indx + w4] + 46.0f * cfa[indx + w1] * cfa[indx + w1] + 14.0f * cfa[indx - w2] * cfa[indx + w2] - 12.0f * cfa[indx - w2] * cfa[indx + w3] - 2.0f * cfa[indx - w2] * cfa[indx - w4] + 2.0f * cfa[indx - w2] * cfa[indx + w4] + 11.0f * cfa[indx - w2] * cfa[indx - w2] - 12.0f * cfa[indx + w2] * cfa[indx - w3] + 2.0f * cfa[indx + w2] * cfa[indx - w4] - 2.0f * cfa[indx + w2] * cfa[indx + w4] + 11.0f * cfa[indx + w2] * cfa[indx + w2] + 2.0f * cfa[indx - w3] * cfa[indx + w3] - 6.0f * cfa[indx - w3] * cfa[indx - w4] + 10.0f * cfa[indx - w3] * cfa[indx - w3] - 6.0f * cfa[indx + w3] * cfa[indx + w4] + 10.0f * cfa[indx + w3] * cfa[indx + w3] + 1.0f * cfa[indx - w4] * cfa[indx - w4] + 1.0f * cfa[indx + w4] * cfa[indx + w4]); + + float H_Stat = epssq + (- 18.0f * cfa[indx] * cfa[indx - 1] - 18.0f * cfa[indx] * cfa[indx + 1] - 36.0f * cfa[indx] * cfa[indx - 2] - 36.0f * cfa[indx] * cfa[indx + 2] + 18.0f * cfa[indx] * cfa[indx - 3] + 18.0f * cfa[indx] * cfa[indx + 3] - 2.0f * cfa[indx] * cfa[indx - 4] - 2.0f * cfa[indx] * cfa[indx + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - 1] * cfa[indx + 1] - 12.0f * cfa[indx - 1] * cfa[indx - 2] + 24.0f * cfa[indx - 1] * cfa[indx + 2] - 38.0f * cfa[indx - 1] * cfa[indx - 3] + 16.0f * cfa[indx - 1] * cfa[indx + 3] + 12.0f * cfa[indx - 1] * cfa[indx - 4] - 6.0f * cfa[indx - 1] * cfa[indx + 4] + 46.0f * cfa[indx - 1] * cfa[indx - 1] + 24.0f * cfa[indx + 1] * cfa[indx - 2] - 12.0f * cfa[indx + 1] * cfa[indx + 2] + 16.0f * cfa[indx + 1] * cfa[indx - 3] - 38.0f * cfa[indx + 1] * cfa[indx + 3] - 6.0f * cfa[indx + 1] * cfa[indx - 4] + 12.0f * cfa[indx + 1] * cfa[indx + 4] + 46.0f * cfa[indx + 1] * cfa[indx + 1] + 14.0f * cfa[indx - 2] * cfa[indx + 2] - 12.0f * cfa[indx - 2] * cfa[indx + 3] - 2.0f * cfa[indx - 2] * cfa[indx - 4] + 2.0f * cfa[indx - 2] * cfa[indx + 4] + 11.0f * cfa[indx - 2] * cfa[indx - 2] - 12.0f * cfa[indx + 2] * cfa[indx - 3] + 2.0f * cfa[indx + 2] * cfa[indx - 4] - 2.0f * cfa[indx + 2] * cfa[indx + 4] + 11.0f * cfa[indx + 2] * cfa[indx + 2] + 2.0f * cfa[indx - 3] * cfa[indx + 3] - 6.0f * cfa[indx - 3] * cfa[indx - 4] + 10.0f * cfa[indx - 3] * cfa[indx - 3] - 6.0f * cfa[indx + 3] * cfa[indx + 4] + 10.0f * cfa[indx + 3] * cfa[indx + 3] + 1.0f * cfa[indx - 4] * cfa[indx - 4] + 1.0f * cfa[indx + 4] * cfa[indx + 4]); VH_Dir[indx] = V_Stat / (V_Stat + H_Stat); //Calculate m/p local discrimination - float P_Stat = epssq - 18.0f * cfa[indx] * cfa[indx - w1 - 1] - 18.0f * cfa[indx] * cfa[indx + w1 + 1] - 36.0f * cfa[indx] * cfa[indx - w2 - 2] - 36.0f * cfa[indx] * cfa[indx + w2 + 2] + 18.0f * cfa[indx] * cfa[indx - w3 - 3] + 18.0f * cfa[indx] * cfa[indx + w3 + 3] - 2.0f * cfa[indx] * cfa[indx - w4 - 4] - 2.0f * cfa[indx] * cfa[indx + w4 + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1 - 1] * cfa[indx + w1 + 1] - 12.0f * cfa[indx - w1 - 1] * cfa[indx - w2 - 2] + 24.0f * cfa[indx - w1 - 1] * cfa[indx + w2 + 2] - 38.0f * cfa[indx - w1 - 1] * cfa[indx - w3 - 3] + 16.0f * cfa[indx - w1 - 1] * cfa[indx + w3 + 3] + 12.0f * cfa[indx - w1 - 1] * cfa[indx - w4 - 4] - 6.0f * cfa[indx - w1 - 1] * cfa[indx + w4 + 4] + 46.0f * cfa[indx - w1 - 1] * cfa[indx - w1 - 1] + 24.0f * cfa[indx + w1 + 1] * cfa[indx - w2 - 2] - 12.0f * cfa[indx + w1 + 1] * cfa[indx + w2 + 2] + 16.0f * cfa[indx + w1 + 1] * cfa[indx - w3 - 3] - 38.0f * cfa[indx + w1 + 1] * cfa[indx + w3 + 3] - 6.0f * cfa[indx + w1 + 1] * cfa[indx - w4 - 4] + 12.0f * cfa[indx + w1 + 1] * cfa[indx + w4 + 4] + 46.0f * cfa[indx + w1 + 1] * cfa[indx + w1 + 1] + 14.0f * cfa[indx - w2 - 2] * cfa[indx + w2 + 2] - 12.0f * cfa[indx - w2 - 2] * cfa[indx + w3 + 3] - 2.0f * cfa[indx - w2 - 2] * cfa[indx - w4 - 4] + 2.0f * cfa[indx - w2 - 2] * cfa[indx + w4 + 4] + 11.0f * cfa[indx - w2 - 2] * cfa[indx - w2 - 2] - 12.0f * cfa[indx + w2 + 2] * cfa[indx - w3 - 3] + 2 * cfa[indx + w2 + 2] * cfa[indx - w4 - 4] - 2.0f * cfa[indx + w2 + 2] * cfa[indx + w4 + 4] + 11.0f * cfa[indx + w2 + 2] * cfa[indx + w2 + 2] + 2.0f * cfa[indx - w3 - 3] * cfa[indx + w3 + 3] - 6.0f * cfa[indx - w3 - 3] * cfa[indx - w4 - 4] + 10.0f * cfa[indx - w3 - 3] * cfa[indx - w3 - 3] - 6.0f * cfa[indx + w3 + 3] * cfa[indx + w4 + 4] + 10.0f * cfa[indx + w3 + 3] * cfa[indx + w3 + 3] + 1.0f * cfa[indx - w4 - 4] * cfa[indx - w4 - 4] + 1.0f * cfa[indx + w4 + 4] * cfa[indx + w4 + 4]; - float Q_Stat = epssq - 18.0f * cfa[indx] * cfa[indx + w1 - 1] - 18.0f * cfa[indx] * cfa[indx - w1 + 1] - 36.0f * cfa[indx] * cfa[indx + w2 - 2] - 36.0f * cfa[indx] * cfa[indx - w2 + 2] + 18.0f * cfa[indx] * cfa[indx + w3 - 3] + 18.0f * cfa[indx] * cfa[indx - w3 + 3] - 2.0f * cfa[indx] * cfa[indx + w4 - 4] - 2.0f * cfa[indx] * cfa[indx - w4 + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx + w1 - 1] * cfa[indx - w1 + 1] - 12.0f * cfa[indx + w1 - 1] * cfa[indx + w2 - 2] + 24.0f * cfa[indx + w1 - 1] * cfa[indx - w2 + 2] - 38.0f * cfa[indx + w1 - 1] * cfa[indx + w3 - 3] + 16.0f * cfa[indx + w1 - 1] * cfa[indx - w3 + 3] + 12.0f * cfa[indx + w1 - 1] * cfa[indx + w4 - 4] - 6.0f * cfa[indx + w1 - 1] * cfa[indx - w4 + 4] + 46.0f * cfa[indx + w1 - 1] * cfa[indx + w1 - 1] + 24.0f * cfa[indx - w1 + 1] * cfa[indx + w2 - 2] - 12.0f * cfa[indx - w1 + 1] * cfa[indx - w2 + 2] + 16.0f * cfa[indx - w1 + 1] * cfa[indx + w3 - 3] - 38.0f * cfa[indx - w1 + 1] * cfa[indx - w3 + 3] - 6.0f * cfa[indx - w1 + 1] * cfa[indx + w4 - 4] + 12.0f * cfa[indx - w1 + 1] * cfa[indx - w4 + 4] + 46.0f * cfa[indx - w1 + 1] * cfa[indx - w1 + 1] + 14.0f * cfa[indx + w2 - 2] * cfa[indx - w2 + 2] - 12.0f * cfa[indx + w2 - 2] * cfa[indx - w3 + 3] - 2.0f * cfa[indx + w2 - 2] * cfa[indx + w4 - 4] + 2.0f * cfa[indx + w2 - 2] * cfa[indx - w4 + 4] + 11.0f * cfa[indx + w2 - 2] * cfa[indx + w2 - 2] - 12.0f * cfa[indx - w2 + 2] * cfa[indx + w3 - 3] + 2 * cfa[indx - w2 + 2] * cfa[indx + w4 - 4] - 2.0f * cfa[indx - w2 + 2] * cfa[indx - w4 + 4] + 11.0f * cfa[indx - w2 + 2] * cfa[indx - w2 + 2] + 2.0f * cfa[indx + w3 - 3] * cfa[indx - w3 + 3] - 6.0f * cfa[indx + w3 - 3] * cfa[indx + w4 - 4] + 10.0f * cfa[indx + w3 - 3] * cfa[indx + w3 - 3] - 6.0f * cfa[indx - w3 + 3] * cfa[indx - w4 + 4] + 10.0f * cfa[indx - w3 + 3] * cfa[indx - w3 + 3] + 1.0f * cfa[indx + w4 - 4] * cfa[indx + w4 - 4] + 1.0f * cfa[indx - w4 + 4] * cfa[indx - w4 + 4]; + float P_Stat = epssq + (- 18.0f * cfa[indx] * cfa[indx - w1 - 1] - 18.0f * cfa[indx] * cfa[indx + w1 + 1] - 36.0f * cfa[indx] * cfa[indx - w2 - 2] - 36.0f * cfa[indx] * cfa[indx + w2 + 2] + 18.0f * cfa[indx] * cfa[indx - w3 - 3] + 18.0f * cfa[indx] * cfa[indx + w3 + 3] - 2.0f * cfa[indx] * cfa[indx - w4 - 4] - 2.0f * cfa[indx] * cfa[indx + w4 + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1 - 1] * cfa[indx + w1 + 1] - 12.0f * cfa[indx - w1 - 1] * cfa[indx - w2 - 2] + 24.0f * cfa[indx - w1 - 1] * cfa[indx + w2 + 2] - 38.0f * cfa[indx - w1 - 1] * cfa[indx - w3 - 3] + 16.0f * cfa[indx - w1 - 1] * cfa[indx + w3 + 3] + 12.0f * cfa[indx - w1 - 1] * cfa[indx - w4 - 4] - 6.0f * cfa[indx - w1 - 1] * cfa[indx + w4 + 4] + 46.0f * cfa[indx - w1 - 1] * cfa[indx - w1 - 1] + 24.0f * cfa[indx + w1 + 1] * cfa[indx - w2 - 2] - 12.0f * cfa[indx + w1 + 1] * cfa[indx + w2 + 2] + 16.0f * cfa[indx + w1 + 1] * cfa[indx - w3 - 3] - 38.0f * cfa[indx + w1 + 1] * cfa[indx + w3 + 3] - 6.0f * cfa[indx + w1 + 1] * cfa[indx - w4 - 4] + 12.0f * cfa[indx + w1 + 1] * cfa[indx + w4 + 4] + 46.0f * cfa[indx + w1 + 1] * cfa[indx + w1 + 1] + 14.0f * cfa[indx - w2 - 2] * cfa[indx + w2 + 2] - 12.0f * cfa[indx - w2 - 2] * cfa[indx + w3 + 3] - 2.0f * cfa[indx - w2 - 2] * cfa[indx - w4 - 4] + 2.0f * cfa[indx - w2 - 2] * cfa[indx + w4 + 4] + 11.0f * cfa[indx - w2 - 2] * cfa[indx - w2 - 2] - 12.0f * cfa[indx + w2 + 2] * cfa[indx - w3 - 3] + 2 * cfa[indx + w2 + 2] * cfa[indx - w4 - 4] - 2.0f * cfa[indx + w2 + 2] * cfa[indx + w4 + 4] + 11.0f * cfa[indx + w2 + 2] * cfa[indx + w2 + 2] + 2.0f * cfa[indx - w3 - 3] * cfa[indx + w3 + 3] - 6.0f * cfa[indx - w3 - 3] * cfa[indx - w4 - 4] + 10.0f * cfa[indx - w3 - 3] * cfa[indx - w3 - 3] - 6.0f * cfa[indx + w3 + 3] * cfa[indx + w4 + 4] + 10.0f * cfa[indx + w3 + 3] * cfa[indx + w3 + 3] + 1.0f * cfa[indx - w4 - 4] * cfa[indx - w4 - 4] + 1.0f * cfa[indx + w4 + 4] * cfa[indx + w4 + 4]); + + float Q_Stat = epssq + (- 18.0f * cfa[indx] * cfa[indx + w1 - 1] - 18.0f * cfa[indx] * cfa[indx - w1 + 1] - 36.0f * cfa[indx] * cfa[indx + w2 - 2] - 36.0f * cfa[indx] * cfa[indx - w2 + 2] + 18.0f * cfa[indx] * cfa[indx + w3 - 3] + 18.0f * cfa[indx] * cfa[indx - w3 + 3] - 2.0f * cfa[indx] * cfa[indx + w4 - 4] - 2.0f * cfa[indx] * cfa[indx - w4 + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx + w1 - 1] * cfa[indx - w1 + 1] - 12.0f * cfa[indx + w1 - 1] * cfa[indx + w2 - 2] + 24.0f * cfa[indx + w1 - 1] * cfa[indx - w2 + 2] - 38.0f * cfa[indx + w1 - 1] * cfa[indx + w3 - 3] + 16.0f * cfa[indx + w1 - 1] * cfa[indx - w3 + 3] + 12.0f * cfa[indx + w1 - 1] * cfa[indx + w4 - 4] - 6.0f * cfa[indx + w1 - 1] * cfa[indx - w4 + 4] + 46.0f * cfa[indx + w1 - 1] * cfa[indx + w1 - 1] + 24.0f * cfa[indx - w1 + 1] * cfa[indx + w2 - 2] - 12.0f * cfa[indx - w1 + 1] * cfa[indx - w2 + 2] + 16.0f * cfa[indx - w1 + 1] * cfa[indx + w3 - 3] - 38.0f * cfa[indx - w1 + 1] * cfa[indx - w3 + 3] - 6.0f * cfa[indx - w1 + 1] * cfa[indx + w4 - 4] + 12.0f * cfa[indx - w1 + 1] * cfa[indx - w4 + 4] + 46.0f * cfa[indx - w1 + 1] * cfa[indx - w1 + 1] + 14.0f * cfa[indx + w2 - 2] * cfa[indx - w2 + 2] - 12.0f * cfa[indx + w2 - 2] * cfa[indx - w3 + 3] - 2.0f * cfa[indx + w2 - 2] * cfa[indx + w4 - 4] + 2.0f * cfa[indx + w2 - 2] * cfa[indx - w4 + 4] + 11.0f * cfa[indx + w2 - 2] * cfa[indx + w2 - 2] - 12.0f * cfa[indx - w2 + 2] * cfa[indx + w3 - 3] + 2 * cfa[indx - w2 + 2] * cfa[indx + w4 - 4] - 2.0f * cfa[indx - w2 + 2] * cfa[indx - w4 + 4] + 11.0f * cfa[indx - w2 + 2] * cfa[indx - w2 + 2] + 2.0f * cfa[indx + w3 - 3] * cfa[indx - w3 + 3] - 6.0f * cfa[indx + w3 - 3] * cfa[indx + w4 - 4] + 10.0f * cfa[indx + w3 - 3] * cfa[indx + w3 - 3] - 6.0f * cfa[indx - w3 + 3] * cfa[indx - w4 + 4] + 10.0f * cfa[indx - w3 + 3] * cfa[indx - w3 + 3] + 1.0f * cfa[indx + w4 - 4] * cfa[indx + w4 - 4] + 1.0f * cfa[indx - w4 + 4] * cfa[indx - w4 + 4]); PQ_Dir[indx] = P_Stat / ( P_Stat + Q_Stat ); + assert(isfinite(VH_Dir[indx])); + assert(isfinite(PQ_Dir[indx])); + } } @@ -4091,16 +4096,16 @@ void RawImageSource::rcd_demosaic() for ( int col = 4 + ( FC( row, 0 )&1 ), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { //Cardinal gradients - float N_Grad = eps + fabs( cfa[indx - w1] - cfa[indx + w1] ) + fabs( cfa[indx] - cfa[indx - w2] ) + fabs( cfa[indx - w1] - cfa[indx - w3] ) + fabs( cfa[indx - w2] - cfa[indx - w4] ); - float S_Grad = eps + fabs( cfa[indx + w1] - cfa[indx - w1] ) + fabs( cfa[indx] - cfa[indx + w2] ) + fabs( cfa[indx + w1] - cfa[indx + w3] ) + fabs( cfa[indx + w2] - cfa[indx + w4] ); - float W_Grad = eps + fabs( cfa[indx - 1] - cfa[indx + 1] ) + fabs( cfa[indx] - cfa[indx - 2] ) + fabs( cfa[indx - 1] - cfa[indx - 3] ) + fabs( cfa[indx - 2] - cfa[indx - 4] ); - float E_Grad = eps + fabs( cfa[indx + 1] - cfa[indx - 1] ) + fabs( cfa[indx] - cfa[indx + 2] ) + fabs( cfa[indx + 1] - cfa[indx + 3] ) + fabs( cfa[indx + 2] - cfa[indx + 4] ); + float N_Grad = eps + (fabs( cfa[indx - w1] - cfa[indx + w1] ) + fabs( cfa[indx] - cfa[indx - w2] ) + fabs( cfa[indx - w1] - cfa[indx - w3] ) + fabs( cfa[indx - w2] - cfa[indx - w4] )); + float S_Grad = eps + (fabs( cfa[indx + w1] - cfa[indx - w1] ) + fabs( cfa[indx] - cfa[indx + w2] ) + fabs( cfa[indx + w1] - cfa[indx + w3] ) + fabs( cfa[indx + w2] - cfa[indx + w4] )); + float W_Grad = eps + (fabs( cfa[indx - 1] - cfa[indx + 1] ) + fabs( cfa[indx] - cfa[indx - 2] ) + fabs( cfa[indx - 1] - cfa[indx - 3] ) + fabs( cfa[indx - 2] - cfa[indx - 4] )); + float E_Grad = eps + (fabs( cfa[indx + 1] - cfa[indx - 1] ) + fabs( cfa[indx] - cfa[indx + 2] ) + fabs( cfa[indx + 1] - cfa[indx + 3] ) + fabs( cfa[indx + 2] - cfa[indx + 4] )); //Cardinal pixel estimations - float N_Est = cfa[indx - w1] * ( 1.f + ( lpf[indx] - lpf[indx - w2] ) / ( eps + lpf[indx] + lpf[indx - w2] ) ); - float S_Est = cfa[indx + w1] * ( 1.f + ( lpf[indx] - lpf[indx + w2] ) / ( eps + lpf[indx] + lpf[indx + w2] ) ); - float W_Est = cfa[indx - 1] * ( 1.f + ( lpf[indx] - lpf[indx - 2] ) / ( eps + lpf[indx] + lpf[indx - 2] ) ); - float E_Est = cfa[indx + 1] * ( 1.f + ( lpf[indx] - lpf[indx + 2] ) / ( eps + lpf[indx] + lpf[indx + 2] ) ); + float N_Est = cfa[indx - w1] * ( 1.f + ( lpf[indx] - lpf[indx - w2] ) / ( eps + (lpf[indx] + lpf[indx - w2])) ); + float S_Est = cfa[indx + w1] * ( 1.f + ( lpf[indx] - lpf[indx + w2] ) / ( eps + (lpf[indx] + lpf[indx + w2])) ); + float W_Est = cfa[indx - 1] * ( 1.f + ( lpf[indx] - lpf[indx - 2] ) / ( eps + (lpf[indx] + lpf[indx - 2])) ); + float E_Est = cfa[indx + 1] * ( 1.f + ( lpf[indx] - lpf[indx + 2] ) / ( eps + (lpf[indx] + lpf[indx + 2])) ); //Interpolate G@R & G@B float V_Est = ( S_Grad * N_Est + N_Grad * S_Est ) / ( N_Grad + S_Grad ); @@ -4126,10 +4131,10 @@ void RawImageSource::rcd_demosaic() for ( int col = 4 + ( FC( row, 0 )&1 ), indx = row * width + col, c = 2 - FC( row, col ); col < width - 4; col += 2, indx += 2 ) { //Diagonal gradients - float NW_Grad = eps + fabs( rgb[indx - w1 - 1][c] - rgb[indx + w1 + 1][c] ) + fabs( rgb[indx - w1 - 1][c] - rgb[indx - w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 - 2][1] ); - float NE_Grad = eps + fabs( rgb[indx - w1 + 1][c] - rgb[indx + w1 - 1][c] ) + fabs( rgb[indx - w1 + 1][c] - rgb[indx - w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 + 2][1] ); - float SW_Grad = eps + fabs( rgb[indx + w1 - 1][c] - rgb[indx - w1 + 1][c] ) + fabs( rgb[indx + w1 - 1][c] - rgb[indx + w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 - 2][1] ); - float SE_Grad = eps + fabs( rgb[indx + w1 + 1][c] - rgb[indx - w1 - 1][c] ) + fabs( rgb[indx + w1 + 1][c] - rgb[indx + w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 + 2][1] ); + float NW_Grad = eps + (fabs( rgb[indx - w1 - 1][c] - rgb[indx + w1 + 1][c] ) + fabs( rgb[indx - w1 - 1][c] - rgb[indx - w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 - 2][1] )); + float NE_Grad = eps + (fabs( rgb[indx - w1 + 1][c] - rgb[indx + w1 - 1][c] ) + fabs( rgb[indx - w1 + 1][c] - rgb[indx - w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 + 2][1] )); + float SW_Grad = eps + (fabs( rgb[indx + w1 - 1][c] - rgb[indx - w1 + 1][c] ) + fabs( rgb[indx + w1 - 1][c] - rgb[indx + w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 - 2][1] )); + float SE_Grad = eps + (fabs( rgb[indx + w1 + 1][c] - rgb[indx - w1 - 1][c] ) + fabs( rgb[indx + w1 + 1][c] - rgb[indx + w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 + 2][1] )); //Diagonal colour differences float NW_Est = rgb[indx - w1 - 1][c] - rgb[indx - w1 - 1][1]; @@ -4158,10 +4163,10 @@ void RawImageSource::rcd_demosaic() for ( int c = 0; c <= 2; c += 2 ) { //Cardinal gradients - float N_Grad = eps + fabs( rgb[indx][1] - rgb[indx - w2][1] ) + fabs( rgb[indx - w1][c] - rgb[indx + w1][c] ) + fabs( rgb[indx - w1][c] - rgb[indx - w3][c] ); - float S_Grad = eps + fabs( rgb[indx][1] - rgb[indx + w2][1] ) + fabs( rgb[indx + w1][c] - rgb[indx - w1][c] ) + fabs( rgb[indx + w1][c] - rgb[indx + w3][c] ); - float W_Grad = eps + fabs( rgb[indx][1] - rgb[indx - 2][1] ) + fabs( rgb[indx - 1][c] - rgb[indx + 1][c] ) + fabs( rgb[indx - 1][c] - rgb[indx - 3][c] ); - float E_Grad = eps + fabs( rgb[indx][1] - rgb[indx + 2][1] ) + fabs( rgb[indx + 1][c] - rgb[indx - 1][c] ) + fabs( rgb[indx + 1][c] - rgb[indx + 3][c] ); + float N_Grad = eps + (fabs( rgb[indx][1] - rgb[indx - w2][1] ) + fabs( rgb[indx - w1][c] - rgb[indx + w1][c] ) + fabs( rgb[indx - w1][c] - rgb[indx - w3][c] )); + float S_Grad = eps + (fabs( rgb[indx][1] - rgb[indx + w2][1] ) + fabs( rgb[indx + w1][c] - rgb[indx - w1][c] ) + fabs( rgb[indx + w1][c] - rgb[indx + w3][c] )); + float W_Grad = eps + (fabs( rgb[indx][1] - rgb[indx - 2][1] ) + fabs( rgb[indx - 1][c] - rgb[indx + 1][c] ) + fabs( rgb[indx - 1][c] - rgb[indx - 3][c] )); + float E_Grad = eps + (fabs( rgb[indx][1] - rgb[indx + 2][1] ) + fabs( rgb[indx + 1][c] - rgb[indx - 1][c] ) + fabs( rgb[indx + 1][c] - rgb[indx + 3][c] )); //Cardinal colour differences float N_Est = rgb[indx - w1][c] - rgb[indx - w1][1]; From 4b6b806163a1df157600e741738ef09c60f78d86 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 24 Nov 2017 17:46:07 +0100 Subject: [PATCH 17/47] RCD: some tweaks to better fit in the RT way of dealing with highlight scaling --- rtengine/demosaic_algos.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index e1efcda86..c73f29415 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -3950,13 +3950,27 @@ void RawImageSource::rcd_demosaic() std::vector cfa(width * height); std::vector> rgb(width * height); + const float prescale = max(ref_pre_mul[0], ref_pre_mul[1], ref_pre_mul[2], ref_pre_mul[3]) / min(ref_pre_mul[0], ref_pre_mul[1], ref_pre_mul[2], ref_pre_mul[3]); + + auto clip = + [=](float v) -> float + { + v /= 65535.f; + float f = (1.f - LIM01(v * 0.25f)) * prescale; + if (f > 1e-4f) { + return LIM01(v * f) / f; + } else { + return LIM01(v); + } + }; + #ifdef _OPENMP #pragma omp parallel for #endif for (int row = 0; row < height; row++) { for (int col = 0, indx = row * width + col; col < width; col++, indx++) { int c = FC(row, col); - cfa[indx] = rgb[indx][c] = CLIP(rawData[row][col]) / 65535.f; + cfa[indx] = rgb[indx][c] = clip(rawData[row][col]); } } From 95614c7ecb607c9fc924cdcb44271ca849b103de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Sun, 26 Nov 2017 14:03:25 +0100 Subject: [PATCH 18/47] Add `operator ==()` to every parameter `struct` --- rtengine/procparams.cc | 1399 ++++++++++++++++++++++++++-------------- rtengine/procparams.h | 122 +++- rtgui/paramsedited.h | 3 - 3 files changed, 1028 insertions(+), 496 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 159d9f503..6629589ad 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -307,42 +307,6 @@ namespace rtengine namespace procparams { -bool operator ==(const rtengine::procparams::WaveletParams& a, const rtengine::procparams::WaveletParams& b) -{ - if (a.enabled != b.enabled) { - return false; - } - - for (int i = 0; i < 9; i++) { - if (a.c[i] != b.c[i]) { - return false; - } - } - - for (int i = 0; i < 9; i++) { - if (a.ch[i] != b.ch[i]) { - return false; - } - } - - return true; -} - -bool operator ==(const rtengine::procparams::DirPyrEqualizerParams& a, const rtengine::procparams::DirPyrEqualizerParams& b) -{ - if (a.enabled != b.enabled) { - return false; - } - - for (int i = 0; i < 6; i++) { - if (a.mult[i] != b.mult[i]) { - return false; - } - } - - return a.threshold == b.threshold; -} - ToneCurveParams::ToneCurveParams() : autoexp(false), clip(0.02), @@ -367,6 +331,32 @@ ToneCurveParams::ToneCurveParams() : { } +bool ToneCurveParams::operator ==(const ToneCurveParams& other) const +{ + return + autoexp == other.autoexp + && clip == other.clip + && hrenabled == other.hrenabled + && method == other.method + && expcomp == other.expcomp + && curve == other.curve + && curve2 == other.curve2 + && curveMode == other.curveMode + && curveMode2 == other.curveMode2 + && brightness == other.brightness + && black == other.black + && contrast == other.contrast + && saturation == other.saturation + && shcompr == other.shcompr + && hlcompr == other.hlcompr + && hlcomprthresh == other.hlcomprthresh; +} + +bool ToneCurveParams::operator !=(const ToneCurveParams& other) const +{ + return !(*this == other); +} + bool ToneCurveParams::HLReconstructionNecessary(const LUTu& histRedRaw, const LUTu& histGreenRaw, const LUTu& histBlueRaw) { if (options.rtSettings.verbose) { @@ -458,6 +448,47 @@ RetinexParams::RetinexParams() : { } +bool RetinexParams::operator ==(const RetinexParams& other) const +{ + return + enabled == other.enabled + && cdcurve == other.cdcurve + && cdHcurve == other.cdHcurve + && lhcurve == other.lhcurve + && transmissionCurve == other.transmissionCurve + && gaintransmissionCurve == other.gaintransmissionCurve + && mapcurve == other.mapcurve + && str == other.str + && scal == other.scal + && iter == other.iter + && grad == other.grad + && grads == other.grads + && gam == other.gam + && slope == other.slope + && neigh == other.neigh + && offs == other.offs + && highlights == other.highlights + && htonalwidth == other.htonalwidth + && shadows == other.shadows + && stonalwidth == other.stonalwidth + && radius == other.radius + && retinexMethod == other.retinexMethod + && retinexcolorspace == other.retinexcolorspace + && gammaretinex == other.gammaretinex + && mapMethod == other.mapMethod + && viewMethod == other.viewMethod + && vart == other.vart + && limd == other.limd + && highl == other.highl + && skal == other.skal + && medianmap == other.medianmap; +} + +bool RetinexParams::operator !=(const RetinexParams& other) const +{ + return !(*this == other); +} + void RetinexParams::getCurves(RetinextransmissionCurve &transmissionCurveLUT, RetinexgaintransmissionCurve &gaintransmissionCurveLUT) const { transmissionCurveLUT.Set(this->transmissionCurve); @@ -502,6 +533,31 @@ LCurveParams::LCurveParams() : { } +bool LCurveParams::operator ==(const LCurveParams& other) const +{ + return + lcurve == other.lcurve + && acurve == other.acurve + && bcurve == other.bcurve + && cccurve == other.cccurve + && chcurve == other.chcurve + && lhcurve == other.lhcurve + && hhcurve == other.hhcurve + && lccurve == other.lccurve + && clcurve == other.clcurve + && brightness == other.brightness + && contrast == other.contrast + && chromaticity == other.chromaticity + && avoidcolorshift == other.avoidcolorshift + && rstprotection == other.rstprotection + && lcredsk == other.lcredsk; +} + +bool LCurveParams::operator !=(const LCurveParams& other) const +{ + return !(*this == other); +} + RGBCurvesParams::RGBCurvesParams() : lumamode(false), rcurve{ @@ -516,6 +572,20 @@ RGBCurvesParams::RGBCurvesParams() : { } +bool RGBCurvesParams::operator ==(const RGBCurvesParams& other) const +{ + return + lumamode == other.lumamode + && rcurve == other.rcurve + && gcurve == other.gcurve + && bcurve == other.bcurve; +} + +bool RGBCurvesParams::operator !=(const RGBCurvesParams& other) const +{ + return !(*this == other); +} + ColorToningParams::ColorToningParams() : enabled(false), autosat(true), @@ -590,6 +660,42 @@ ColorToningParams::ColorToningParams() : { } +bool ColorToningParams::operator ==(const ColorToningParams& other) const +{ + return + enabled == other.enabled + && autosat == other.autosat + && opacityCurve == other.opacityCurve + && colorCurve == other.colorCurve + && satProtectionThreshold == other.satProtectionThreshold + && saturatedOpacity == other.saturatedOpacity + && strength == other.strength + && balance == other.balance + && hlColSat == other.hlColSat + && shadowsColSat == other.shadowsColSat + && clcurve == other.clcurve + && cl2curve == other.cl2curve + && method == other.method + && twocolor == other.twocolor + && redlow == other.redlow + && greenlow == other.greenlow + && bluelow == other.bluelow + && redmed == other.redmed + && greenmed == other.greenmed + && bluemed == other.bluemed + && redhigh == other.redhigh + && greenhigh == other.greenhigh + && bluehigh == other.bluehigh + && satlow == other.satlow + && sathigh == other.sathigh + && lumamode == other.lumamode; +} + +bool ColorToningParams::operator !=(const ColorToningParams& other) const +{ + return !(*this == other); +} + void ColorToningParams::mixerToCurve(std::vector& colorCurve, std::vector& opacityCurve) const { // check if non null first @@ -832,7 +938,7 @@ void ColorToningParams::slidersToCurve(std::vector& colorCurve, std::vec opacityCurve.at (8) = 0.35; } -void ColorToningParams::getCurves (ColorGradientCurve& colorCurveLUT, OpacityCurve& opacityCurveLUT, const double xyz_rgb[3][3], bool& opautili) const +void ColorToningParams::getCurves(ColorGradientCurve& colorCurveLUT, OpacityCurve& opacityCurveLUT, const double xyz_rgb[3][3], bool& opautili) const { float satur = 0.8f; float lumin = 0.5f; //middle of luminance for optimization of gamut - no real importance...as we work in XYZ and gamut control @@ -887,6 +993,30 @@ SharpeningParams::SharpeningParams() : { } +bool SharpeningParams::operator ==(const SharpeningParams& other) const +{ + return + enabled == other.enabled + && radius == other.radius + && amount == other.amount + && threshold == other.threshold + && edgesonly == other.edgesonly + && edges_radius == other.edges_radius + && edges_tolerance == other.edges_tolerance + && halocontrol == other.halocontrol + && halocontrol_amount == other.halocontrol_amount + && method == other.method + && deconvamount == other.deconvamount + && deconvradius == other.deconvradius + && deconviter == other.deconviter + && deconvdamping == other.deconvdamping; +} + +bool SharpeningParams::operator !=(const SharpeningParams& other) const +{ + return !(*this == other); +} + SharpenEdgeParams::SharpenEdgeParams() : enabled(false), passes(2), @@ -895,6 +1025,20 @@ SharpenEdgeParams::SharpenEdgeParams() : { } +bool SharpenEdgeParams::operator ==(const SharpenEdgeParams& other) const +{ + return + enabled == other.enabled + && passes == other.passes + && amount == other.amount + && threechannels == other.threechannels; +} + +bool SharpenEdgeParams::operator !=(const SharpenEdgeParams& other) const +{ + return !(*this == other); +} + SharpenMicroParams::SharpenMicroParams() : enabled(false), matrix(false), @@ -903,6 +1047,20 @@ SharpenMicroParams::SharpenMicroParams() : { } +bool SharpenMicroParams::operator ==(const SharpenMicroParams& other) const +{ + return + enabled == other.enabled + && matrix == other.matrix + && amount == other.amount + && uniformity == other.uniformity; +} + +bool SharpenMicroParams::operator !=(const SharpenMicroParams& other) const +{ + return !(*this == other); +} + VibranceParams::VibranceParams() : enabled(false), pastels(0), @@ -917,6 +1075,24 @@ VibranceParams::VibranceParams() : { } +bool VibranceParams::operator ==(const VibranceParams& other) const +{ + return + enabled == other.enabled + && pastels == other.pastels + && saturated == other.saturated + && psthreshold == other.psthreshold + && protectskins == other.protectskins + && avoidcolorshift == other.avoidcolorshift + && pastsattog == other.pastsattog + && skintonescurve == other.skintonescurve; +} + +bool VibranceParams::operator !=(const VibranceParams& other) const +{ + return !(*this == other); +} + WBParams::WBParams() : method("Camera"), temperature(6504), @@ -926,6 +1102,21 @@ WBParams::WBParams() : { } +bool WBParams::operator ==(const WBParams& other) const +{ + return + method == other.method + && temperature == other.temperature + && green == other.green + && equal == other.equal + && tempBias == other.tempBias; +} + +bool WBParams::operator !=(const WBParams& other) const +{ + return !(*this == other); +} + const std::vector& WBParams::getWbEntries() { static const std::vector wb_entries = { @@ -1017,6 +1208,55 @@ ColorAppearanceParams::ColorAppearanceParams() : { } +bool ColorAppearanceParams::operator ==(const ColorAppearanceParams& other) const +{ + return + enabled == other.enabled + && degree == other.degree + && autodegree == other.autodegree + && degreeout == other.degreeout + && autodegreeout == other.autodegreeout + && curve == other.curve + && curve2 == other.curve2 + && curve3 == other.curve3 + && curveMode == other.curveMode + && curveMode2 == other.curveMode2 + && curveMode3 == other.curveMode3 + && surround == other.surround + && surrsrc == other.surrsrc + && adapscen == other.adapscen + && autoadapscen == other.autoadapscen + && ybscen == other.ybscen + && autoybscen == other.autoybscen + && adaplum == other.adaplum + && badpixsl == other.badpixsl + && wbmodel == other.wbmodel + && algo == other.algo + && contrast == other.contrast + && qcontrast == other.qcontrast + && jlight == other.jlight + && qbright == other.qbright + && chroma == other.chroma + && schroma == other.schroma + && mchroma == other.mchroma + && colorh == other.colorh + && rstprotection == other.rstprotection + && surrsource == other.surrsource + && gamut == other.gamut + && datacie == other.datacie + && tonecie == other.tonecie + && tempout == other.tempout + && ybout == other.ybout + && greenout == other.greenout + && tempsc == other.tempsc + && greensc == other.greensc; +} + +bool ColorAppearanceParams::operator !=(const ColorAppearanceParams& other) const +{ + return !(*this == other); +} + DefringeParams::DefringeParams() : enabled(false), radius(2.0), @@ -1051,12 +1291,38 @@ DefringeParams::DefringeParams() : { } +bool DefringeParams::operator ==(const DefringeParams& other) const +{ + return + enabled == other.enabled + && radius == other.radius + && threshold == other.threshold + && huecurve == other.huecurve; +} + +bool DefringeParams::operator !=(const DefringeParams& other) const +{ + return !(*this == other); +} + ImpulseDenoiseParams::ImpulseDenoiseParams() : enabled(false), thresh(50) { } +bool ImpulseDenoiseParams::operator ==(const ImpulseDenoiseParams& other) const +{ + return + enabled == other.enabled + && thresh == other.thresh; +} + +bool ImpulseDenoiseParams::operator !=(const ImpulseDenoiseParams& other) const +{ + return !(*this == other); +} + DirPyrDenoiseParams::DirPyrDenoiseParams() : lcurve{ FCT_MinMaxCPoints, @@ -1102,10 +1368,41 @@ DirPyrDenoiseParams::DirPyrDenoiseParams() : { } +bool DirPyrDenoiseParams::operator ==(const DirPyrDenoiseParams& other) const +{ + return + lcurve == other.lcurve + && cccurve == other.cccurve + && enabled == other.enabled + && enhance == other.enhance + && median == other.median + && perform == other.perform + && luma == other.luma + && Ldetail == other.Ldetail + && chroma == other.chroma + && redchro == other.redchro + && bluechro == other.bluechro + && gamma == other.gamma + && dmethod == other.dmethod + && Lmethod == other.Lmethod + && Cmethod == other.Cmethod + && C2method == other.C2method + && smethod == other.smethod + && medmethod == other.medmethod + && methodmed == other.methodmed + && rgbmethod == other.rgbmethod + && passes == other.passes; +} + +bool DirPyrDenoiseParams::operator !=(const DirPyrDenoiseParams& other) const +{ + return !(*this == other); +} + void DirPyrDenoiseParams::getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) const { - lCurve.Set (this->lcurve); - cCurve.Set (this->cccurve); + lCurve.Set(this->lcurve); + cCurve.Set(this->cccurve); } EPDParams::EPDParams() : @@ -1118,6 +1415,22 @@ EPDParams::EPDParams() : { } +bool EPDParams::operator ==(const EPDParams& other) const +{ + return + enabled == other.enabled + && strength == other.strength + && gamma == other.gamma + && edgeStopping == other.edgeStopping + && scale == other.scale + && reweightingIterates == other.reweightingIterates; +} + +bool EPDParams::operator !=(const EPDParams& other) const +{ + return !(*this == other); +} + FattalToneMappingParams::FattalToneMappingParams() : enabled(false), threshold(0), @@ -1125,6 +1438,19 @@ FattalToneMappingParams::FattalToneMappingParams() : { } +bool FattalToneMappingParams::operator ==(const FattalToneMappingParams& other) const +{ + return + enabled == other.enabled + && threshold == other.threshold + && amount == other.amount; +} + +bool FattalToneMappingParams::operator !=(const FattalToneMappingParams& other) const +{ + return !(*this == other); +} + SHParams::SHParams() : enabled(false), hq(false), @@ -1137,6 +1463,24 @@ SHParams::SHParams() : { } +bool SHParams::operator ==(const SHParams& other) const +{ + return + enabled == other.enabled + && hq == other.hq + && highlights == other.highlights + && htonalwidth == other.htonalwidth + && shadows == other.shadows + && stonalwidth == other.stonalwidth + && localcontrast == other.localcontrast + && radius == other.radius; +} + +bool SHParams::operator !=(const SHParams& other) const +{ + return !(*this == other); +} + CropParams::CropParams() : enabled(false), x(-1), @@ -1150,6 +1494,25 @@ CropParams::CropParams() : { } +bool CropParams::operator ==(const CropParams& other) const +{ + return + enabled == other.enabled + && x == other.x + && y == other.y + && w == other.w + && h == other.h + && fixratio == other.fixratio + && ratio == other.ratio + && orientation == other.orientation + && guide == other.guide; +} + +bool CropParams::operator !=(const CropParams& other) const +{ + return !(*this == other); +} + void CropParams::mapToResized(int resizedWidth, int resizedHeight, int scale, int& x1, int& x2, int& y1, int& y2) const { x1 = 0, x2 = resizedWidth, y1 = 0, y2 = resizedHeight; @@ -1169,21 +1532,64 @@ CoarseTransformParams::CoarseTransformParams() : { } +bool CoarseTransformParams::operator ==(const CoarseTransformParams& other) const +{ + return + rotate == other.rotate + && hflip == other.hflip + && vflip == other.vflip; +} + +bool CoarseTransformParams::operator !=(const CoarseTransformParams& other) const +{ + return !(*this == other); +} + CommonTransformParams::CommonTransformParams() : autofill(true) { } +bool CommonTransformParams::operator ==(const CommonTransformParams& other) const +{ + return autofill == other.autofill; +} + +bool CommonTransformParams::operator !=(const CommonTransformParams& other) const +{ + return !(*this == other); +} + RotateParams::RotateParams() : degree(0.0) { } +bool RotateParams::operator ==(const RotateParams& other) const +{ + return degree == other.degree; +} + +bool RotateParams::operator !=(const RotateParams& other) const +{ + return !(*this == other); +} + DistortionParams::DistortionParams() : amount(0.0) { } +bool DistortionParams::operator ==(const DistortionParams& other) const +{ + return amount == other.amount; +} + +bool DistortionParams::operator !=(const DistortionParams& other) const +{ + return !(*this == other); +} + LensProfParams::LensProfParams() : lcMode(LcMode::NONE), useDist(true), @@ -1192,6 +1598,22 @@ LensProfParams::LensProfParams() : { } +bool LensProfParams::operator ==(const LensProfParams& other) const +{ + return + lcMode == other.lcMode + && lcpFile == other.lcpFile + && useCA == other.useCA + && lfCameraMake == other.lfCameraMake + && lfCameraModel == other.lfCameraModel + && lfLens == other.lfLens; +} + +bool LensProfParams::operator !=(const LensProfParams& other) const +{ + return !(*this == other); +} + bool LensProfParams::useLensfun() const { return lcMode == LcMode::LENSFUNAUTOMATCH || lcMode == LcMode::LENSFUNMANUAL; @@ -1244,6 +1666,18 @@ PerspectiveParams::PerspectiveParams() : { } +bool PerspectiveParams::operator ==(const PerspectiveParams& other) const +{ + return + horizontal == other.horizontal + && vertical == other.vertical; +} + +bool PerspectiveParams::operator !=(const PerspectiveParams& other) const +{ + return !(*this == other); +} + GradientParams::GradientParams() : enabled(false), degree(0.0), @@ -1254,6 +1688,22 @@ GradientParams::GradientParams() : { } +bool GradientParams::operator ==(const GradientParams& other) const +{ + return + enabled == other.enabled + && degree == other.degree + && feather == other.feather + && strength == other.strength + && centerX == other.centerX + && centerY == other.centerY; +} + +bool GradientParams::operator !=(const GradientParams& other) const +{ + return !(*this == other); +} + PCVignetteParams::PCVignetteParams() : enabled(false), strength(0.60), @@ -1262,6 +1712,20 @@ PCVignetteParams::PCVignetteParams() : { } +bool PCVignetteParams::operator ==(const PCVignetteParams& other) const +{ + return + enabled == other.enabled + && strength == other.strength + && feather == other.feather + && roundness == other.roundness; +} + +bool PCVignetteParams::operator !=(const PCVignetteParams& other) const +{ + return !(*this == other); +} + VignettingParams::VignettingParams() : amount(0), radius(50), @@ -1271,6 +1735,21 @@ VignettingParams::VignettingParams() : { } +bool VignettingParams::operator ==(const VignettingParams& other) const +{ + return + amount == other.amount + && radius == other.radius + && strength == other.strength + && centerX == other.centerX + && centerY == other.centerY; +} + +bool VignettingParams::operator !=(const VignettingParams& other) const +{ + return !(*this == other); +} + ChannelMixerParams::ChannelMixerParams() : red{ 100, @@ -1290,6 +1769,25 @@ ChannelMixerParams::ChannelMixerParams() : { } +bool ChannelMixerParams::operator ==(const ChannelMixerParams& other) const +{ + for (unsigned int i = 0; i < 3; ++i) { + if ( + red[i] != other.red[i] + || green[i] != other.green[i] + || blue[i] != other.blue[i] + ) { + return false; + } + } + return true; +} + +bool ChannelMixerParams::operator !=(const ChannelMixerParams& other) const +{ + return !(*this == other); +} + BlackWhiteParams::BlackWhiteParams() : beforeCurve{ DCT_Linear @@ -1323,12 +1821,57 @@ BlackWhiteParams::BlackWhiteParams() : { } +bool BlackWhiteParams::operator ==(const BlackWhiteParams& other) const +{ + return + beforeCurve == other.beforeCurve + && beforeCurveMode == other.beforeCurveMode + && afterCurve == other.afterCurve + && afterCurveMode == other.afterCurveMode + && algo == other.algo + && luminanceCurve == other.luminanceCurve + && autoc == other.autoc + && enabledcc == other.enabledcc + && enabled == other.enabled + && filter == other.filter + && setting == other.setting + && method == other.method + && mixerRed == other.mixerRed + && mixerOrange == other.mixerOrange + && mixerYellow == other.mixerYellow + && mixerGreen == other.mixerGreen + && mixerCyan == other.mixerCyan + && mixerBlue == other.mixerBlue + && mixerMagenta == other.mixerMagenta + && mixerPurple == other.mixerPurple + && gammaRed == other.gammaRed + && gammaGreen == other.gammaGreen + && gammaBlue == other.gammaBlue; +} + +bool BlackWhiteParams::operator !=(const BlackWhiteParams& other) const +{ + return !(*this == other); +} + CACorrParams::CACorrParams() : red(0.0), blue(0.0) { } +bool CACorrParams::operator ==(const CACorrParams& other) const +{ + return + red == other.red + && blue == other.blue; +} + +bool CACorrParams::operator !=(const CACorrParams& other) const +{ + return !(*this == other); +} + ResizeParams::ResizeParams() : enabled(false), scale(1.0), @@ -1340,6 +1883,23 @@ ResizeParams::ResizeParams() : { } +bool ResizeParams::operator ==(const ResizeParams& other) const +{ + return + enabled == other.enabled + && scale == other.scale + && appliesTo == other.appliesTo + && method == other.method + && dataspec == other.dataspec + && width == other.width + && height == other.height; +} + +bool ResizeParams::operator !=(const ResizeParams& other) const +{ + return !(*this == other); +} + const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring ("No ICM: sRGB output"); ColorManagementParams::ColorManagementParams() : @@ -1360,6 +1920,30 @@ ColorManagementParams::ColorManagementParams() : { } +bool ColorManagementParams::operator ==(const ColorManagementParams& other) const +{ + return + input == other.input + && toneCurve == other.toneCurve + && applyLookTable == other.applyLookTable + && applyBaselineExposureOffset == other.applyBaselineExposureOffset + && applyHueSatMap == other.applyHueSatMap + && dcpIlluminant == other.dcpIlluminant + && working == other.working + && output == other.output + && outputIntent == other.outputIntent + && outputBPC == other.outputBPC + && gamma == other.gamma + && gampos == other.gampos + && slpos == other.slpos + && freegamma == other.freegamma; +} + +bool ColorManagementParams::operator !=(const ColorManagementParams& other) const +{ + return !(*this == other); +} + WaveletParams::WaveletParams() : ccwcurve{ static_cast(FCT_MinMaxCPoints), @@ -1515,6 +2099,106 @@ WaveletParams::WaveletParams() : { } +bool WaveletParams::operator ==(const WaveletParams& other) const +{ + return + ccwcurve == other.ccwcurve + && opacityCurveRG == other.opacityCurveRG + && opacityCurveBY == other.opacityCurveBY + && opacityCurveW == other.opacityCurveW + && opacityCurveWL == other.opacityCurveWL + && hhcurve == other.hhcurve + && Chcurve == other.Chcurve + && wavclCurve == other.wavclCurve + && enabled == other.enabled + && median == other.median + && medianlev == other.medianlev + && linkedg == other.linkedg + && cbenab == other.cbenab + && greenlow == other.greenlow + && bluelow == other.bluelow + && greenmed == other.greenmed + && bluemed == other.bluemed + && greenhigh == other.greenhigh + && bluehigh == other.bluehigh + && lipst == other.lipst + && avoid == other.avoid + && tmr == other.tmr + && strength == other.strength + && balance == other.balance + && iter == other.iter + && expcontrast == other.expcontrast + && expchroma == other.expchroma + && [this, &other]() -> bool + { + for (unsigned int i = 0; i < 9; ++i) { + if (c[i] != other.c[i] || ch[i] != other.ch[i]) { + return false; + } + } + return true; + }() + && expedge == other.expedge + && expresid == other.expresid + && expfinal == other.expfinal + && exptoning == other.exptoning + && expnoise == other.expnoise + && Lmethod == other.Lmethod + && CLmethod == other.CLmethod + && Backmethod == other.Backmethod + && Tilesmethod == other.Tilesmethod + && daubcoeffmethod == other.daubcoeffmethod + && CHmethod == other.CHmethod + && Medgreinf == other.Medgreinf + && CHSLmethod == other.CHSLmethod + && EDmethod == other.EDmethod + && NPmethod == other.NPmethod + && BAmethod == other.BAmethod + && TMmethod == other.TMmethod + && Dirmethod == other.Dirmethod + && HSmethod == other.HSmethod + && rescon == other.rescon + && resconH == other.resconH + && reschro == other.reschro + && tmrs == other.tmrs + && gamma == other.gamma + && sup == other.sup + && sky == other.sky + && thres == other.thres + && chroma == other.chroma + && chro == other.chro + && threshold == other.threshold + && threshold2 == other.threshold2 + && edgedetect == other.edgedetect + && edgedetectthr == other.edgedetectthr + && edgedetectthr2 == other.edgedetectthr2 + && edgesensi == other.edgesensi + && edgeampli == other.edgeampli + && contrast == other.contrast + && edgrad == other.edgrad + && edgval == other.edgval + && edgthresh == other.edgthresh + && thr == other.thr + && thrH == other.thrH + && skinprotect == other.skinprotect + && hueskin == other.hueskin + && hueskin2 == other.hueskin2 + && hllev == other.hllev + && bllev == other.bllev + && pastlev == other.pastlev + && satlev == other.satlev + && edgcont == other.edgcont + && level0noise == other.level0noise + && level1noise == other.level1noise + && level2noise == other.level2noise + && level3noise == other.level3noise; +} + +bool WaveletParams::operator !=(const WaveletParams& other) const +{ + return !(*this == other); +} + void WaveletParams::getCurves( WavCurve& cCurve, WavOpacityCurveRG& opacityCurveLUTRG, @@ -1549,6 +2233,31 @@ DirPyrEqualizerParams::DirPyrEqualizerParams() : { } +bool DirPyrEqualizerParams::operator ==(const DirPyrEqualizerParams& other) const +{ + return + enabled == other.enabled + && gamutlab == other.gamutlab + && [this, &other]() -> bool + { + for (unsigned int i = 0; i < 6; ++i) { + if (mult[i] != other.mult[i]) { + return false; + } + } + return true; + }() + && threshold == other.threshold + && skinprotect == other.skinprotect + && hueskin == other.hueskin + && cbdlMethod == other.cbdlMethod; +} + +bool DirPyrEqualizerParams::operator !=(const DirPyrEqualizerParams& other) const +{ + return !(*this == other); +} + HSVEqualizerParams::HSVEqualizerParams() : hcurve{ FCT_Linear @@ -1562,12 +2271,38 @@ HSVEqualizerParams::HSVEqualizerParams() : { } +bool HSVEqualizerParams::operator ==(const HSVEqualizerParams& other) const +{ + return + hcurve == other.hcurve + && scurve == other.scurve + && vcurve == other.vcurve; +} + +bool HSVEqualizerParams::operator !=(const HSVEqualizerParams& other) const +{ + return !(*this == other); +} + FilmSimulationParams::FilmSimulationParams() : enabled(false), strength(100) { } +bool FilmSimulationParams::operator ==(const FilmSimulationParams& other) const +{ + return + enabled == other.enabled + && clutFilename == other.clutFilename + && strength == other.strength; +} + +bool FilmSimulationParams::operator !=(const FilmSimulationParams& other) const +{ + return !(*this == other); +} + RAWParams::BayerSensor::BayerSensor() : method(getMethodString(Method::AMAZE)), imageNum(0), @@ -1615,6 +2350,59 @@ RAWParams::BayerSensor::BayerSensor() : { } +bool RAWParams::BayerSensor::operator ==(const BayerSensor& other) const +{ + return + method == other.method + && imageNum == other.imageNum + && ccSteps == other.ccSteps + && black0 == other.black0 + && black1 == other.black1 + && black2 == other.black2 + && black3 == other.black3 + && twogreen == other.twogreen + && linenoise == other.linenoise + && greenthresh == other.greenthresh + && dcb_iterations == other.dcb_iterations + && lmmse_iterations == other.lmmse_iterations + && pixelShiftMotion == other.pixelShiftMotion + && pixelShiftMotionCorrection == other.pixelShiftMotionCorrection + && pixelShiftMotionCorrectionMethod == other.pixelShiftMotionCorrectionMethod + && pixelShiftStddevFactorGreen == other.pixelShiftStddevFactorGreen + && pixelShiftStddevFactorRed == other.pixelShiftStddevFactorRed + && pixelShiftStddevFactorBlue == other.pixelShiftStddevFactorBlue + && pixelShiftEperIso == other.pixelShiftEperIso + && pixelShiftNreadIso == other.pixelShiftNreadIso + && pixelShiftPrnu == other.pixelShiftPrnu + && pixelShiftSigma == other.pixelShiftSigma + && pixelShiftSum == other.pixelShiftSum + && pixelShiftRedBlueWeight == other.pixelShiftRedBlueWeight + && pixelShiftShowMotion == other.pixelShiftShowMotion + && pixelShiftShowMotionMaskOnly == other.pixelShiftShowMotionMaskOnly + && pixelShiftAutomatic == other.pixelShiftAutomatic + && pixelShiftNonGreenHorizontal == other.pixelShiftNonGreenHorizontal + && pixelShiftNonGreenVertical == other.pixelShiftNonGreenVertical + && pixelShiftHoleFill == other.pixelShiftHoleFill + && pixelShiftMedian == other.pixelShiftMedian + && pixelShiftMedian3 == other.pixelShiftMedian3 + && pixelShiftGreen == other.pixelShiftGreen + && pixelShiftBlur == other.pixelShiftBlur + && pixelShiftSmoothFactor == other.pixelShiftSmoothFactor + && pixelShiftExp0 == other.pixelShiftExp0 + && pixelShiftLmmse == other.pixelShiftLmmse + && pixelShiftEqualBright == other.pixelShiftEqualBright + && pixelShiftEqualBrightChannel == other.pixelShiftEqualBrightChannel + && pixelShiftNonGreenCross == other.pixelShiftNonGreenCross + && pixelShiftNonGreenCross2 == other.pixelShiftNonGreenCross2 + && pixelShiftNonGreenAmaze == other.pixelShiftNonGreenAmaze + && dcb_enhance == other.dcb_enhance; +} + +bool RAWParams::BayerSensor::operator !=(const BayerSensor& other) const +{ + return !(*this == other); +} + void RAWParams::BayerSensor::setPixelShiftDefaults() { pixelShiftMotion = 0; @@ -1680,6 +2468,21 @@ RAWParams::XTransSensor::XTransSensor() : { } +bool RAWParams::XTransSensor::operator ==(const XTransSensor& other) const +{ + return + method == other.method + && ccSteps == other.ccSteps + && blackred == other.blackred + && blackgreen == other.blackgreen + && blackblue == other.blackblue; +} + +bool RAWParams::XTransSensor::operator !=(const XTransSensor& other) const +{ + return !(*this == other); +} + const std::vector& RAWParams::XTransSensor::getMethodStrings() { static const std::vector method_strings { @@ -1715,6 +2518,34 @@ RAWParams::RAWParams() : { } +bool RAWParams::operator ==(const RAWParams& other) const +{ + return + bayersensor == other.bayersensor + && xtranssensor == other.xtranssensor + && dark_frame == other.dark_frame + && df_autoselect == other.df_autoselect + && ff_file == other.ff_file + && ff_AutoSelect == other.ff_AutoSelect + && ff_BlurRadius == other.ff_BlurRadius + && ff_BlurType == other.ff_BlurType + && ff_AutoClipControl == other.ff_AutoClipControl + && ff_clipControl == other.ff_clipControl + && ca_autocorrect == other.ca_autocorrect + && cared == other.cared + && cablue == other.cablue + && expos == other.expos + && preser == other.preser + && hotPixelFilter == other.hotPixelFilter + && deadPixelFilter == other.deadPixelFilter + && hotdeadpix_thresh == other.hotdeadpix_thresh; +} + +bool RAWParams::operator !=(const RAWParams& other) const +{ + return !(*this == other); +} + const std::vector& RAWParams::getFlatFieldBlurTypeStrings() { static const std::vector blur_type_strings { @@ -3844,466 +4675,52 @@ void ProcParams::destroy(ProcParams* pp) delete pp; } -bool ProcParams::operator ==(const ProcParams& other) +bool ProcParams::operator ==(const ProcParams& other) const { return - toneCurve.curve == other.toneCurve.curve - && toneCurve.curve2 == other.toneCurve.curve2 - && toneCurve.brightness == other.toneCurve.brightness - && toneCurve.black == other.toneCurve.black - && toneCurve.contrast == other.toneCurve.contrast - && toneCurve.saturation == other.toneCurve.saturation - && toneCurve.shcompr == other.toneCurve.shcompr - && toneCurve.hlcompr == other.toneCurve.hlcompr - && toneCurve.hlcomprthresh == other.toneCurve.hlcomprthresh - && toneCurve.autoexp == other.toneCurve.autoexp - && toneCurve.clip == other.toneCurve.clip - && toneCurve.expcomp == other.toneCurve.expcomp - && toneCurve.curveMode == other.toneCurve.curveMode - && toneCurve.curveMode2 == other.toneCurve.curveMode2 - && toneCurve.hrenabled == other.toneCurve.hrenabled - && toneCurve.method == other.toneCurve.method - && retinex.cdcurve == other.retinex.cdcurve - && retinex.mapcurve == other.retinex.mapcurve - && retinex.cdHcurve == other.retinex.cdHcurve - && retinex.lhcurve == other.retinex.lhcurve - && retinex.transmissionCurve == other.retinex.transmissionCurve - && retinex.gaintransmissionCurve == other.retinex.gaintransmissionCurve - && retinex.str == other.retinex.str - && retinex.scal == other.retinex.scal - && retinex.iter == other.retinex.iter - && retinex.grad == other.retinex.grad - && retinex.grads == other.retinex.grads - && retinex.gam == other.retinex.gam - && retinex.slope == other.retinex.slope - && retinex.neigh == other.retinex.neigh - && retinex.limd == other.retinex.limd - && retinex.highl == other.retinex.highl - && retinex.highlights == other.retinex.highlights - && retinex.htonalwidth == other.retinex.htonalwidth - && retinex.shadows == other.retinex.shadows - && retinex.stonalwidth == other.retinex.stonalwidth - && retinex.radius == other.retinex.radius - && retinex.skal == other.retinex.skal - && retinex.offs == other.retinex.offs - && retinex.retinexMethod == other.retinex.retinexMethod - && retinex.mapMethod == other.retinex.mapMethod - && retinex.viewMethod == other.retinex.viewMethod - && retinex.retinexcolorspace == other.retinex.retinexcolorspace - && retinex.gammaretinex == other.retinex.gammaretinex - && retinex.vart == other.retinex.vart - && retinex.medianmap == other.retinex.medianmap - && retinex.enabled == other.retinex.enabled - && labCurve.lcurve == other.labCurve.lcurve - && labCurve.acurve == other.labCurve.acurve - && labCurve.bcurve == other.labCurve.bcurve - && labCurve.cccurve == other.labCurve.cccurve - && labCurve.chcurve == other.labCurve.chcurve - && labCurve.lhcurve == other.labCurve.lhcurve - && labCurve.hhcurve == other.labCurve.hhcurve - && labCurve.lccurve == other.labCurve.lccurve - && labCurve.clcurve == other.labCurve.clcurve - && labCurve.brightness == other.labCurve.brightness - && labCurve.contrast == other.labCurve.contrast - && labCurve.chromaticity == other.labCurve.chromaticity - && labCurve.avoidcolorshift == other.labCurve.avoidcolorshift - && labCurve.rstprotection == other.labCurve.rstprotection - && labCurve.lcredsk == other.labCurve.lcredsk - && sharpenEdge.enabled == other.sharpenEdge.enabled - && sharpenEdge.passes == other.sharpenEdge.passes - && sharpenEdge.amount == other.sharpenEdge.amount - && sharpenEdge.threechannels == other.sharpenEdge.threechannels - && sharpenMicro.enabled == other.sharpenMicro.enabled - && sharpenMicro.matrix == other.sharpenMicro.matrix - && sharpenMicro.amount == other.sharpenMicro.amount - && sharpenMicro.uniformity == other.sharpenMicro.uniformity - && sharpening.enabled == other.sharpening.enabled - && sharpening.radius == other.sharpening.radius - && sharpening.amount == other.sharpening.amount - && sharpening.threshold == other.sharpening.threshold - && sharpening.edgesonly == other.sharpening.edgesonly - && sharpening.edges_radius == other.sharpening.edges_radius - && sharpening.edges_tolerance == other.sharpening.edges_tolerance - && sharpening.halocontrol == other.sharpening.halocontrol - && sharpening.halocontrol_amount == other.sharpening.halocontrol_amount - && sharpening.method == other.sharpening.method - && sharpening.deconvamount == other.sharpening.deconvamount - && sharpening.deconvradius == other.sharpening.deconvradius - && sharpening.deconviter == other.sharpening.deconviter - && sharpening.deconvdamping == other.sharpening.deconvdamping - && prsharpening.enabled == other.prsharpening.enabled - && prsharpening.radius == other.prsharpening.radius - && prsharpening.amount == other.prsharpening.amount - && prsharpening.threshold == other.prsharpening.threshold - && prsharpening.edgesonly == other.prsharpening.edgesonly - && prsharpening.edges_radius == other.prsharpening.edges_radius - && prsharpening.edges_tolerance == other.prsharpening.edges_tolerance - && prsharpening.halocontrol == other.prsharpening.halocontrol - && prsharpening.halocontrol_amount == other.prsharpening.halocontrol_amount - && prsharpening.method == other.prsharpening.method - && prsharpening.deconvamount == other.prsharpening.deconvamount - && prsharpening.deconvradius == other.prsharpening.deconvradius - && prsharpening.deconviter == other.prsharpening.deconviter - && prsharpening.deconvdamping == other.prsharpening.deconvdamping - && vibrance.enabled == other.vibrance.enabled - && vibrance.pastels == other.vibrance.pastels - && vibrance.saturated == other.vibrance.saturated - && vibrance.psthreshold == other.vibrance.psthreshold - && vibrance.protectskins == other.vibrance.protectskins - && vibrance.avoidcolorshift == other.vibrance.avoidcolorshift - && vibrance.pastsattog == other.vibrance.pastsattog - && vibrance.skintonescurve == other.vibrance.skintonescurve - && wb.method == other.wb.method - && wb.green == other.wb.green - && wb.temperature == other.wb.temperature - && wb.equal == other.wb.equal - && colorappearance.enabled == other.colorappearance.enabled - && colorappearance.degree == other.colorappearance.degree - && colorappearance.autodegree == other.colorappearance.autodegree - && colorappearance.degreeout == other.colorappearance.degreeout - && colorappearance.autodegreeout == other.colorappearance.autodegreeout - && colorappearance.surround == other.colorappearance.surround - && colorappearance.surrsrc == other.colorappearance.surrsrc - && colorappearance.adapscen == other.colorappearance.adapscen - && colorappearance.autoadapscen == other.colorappearance.autoadapscen - && colorappearance.ybscen == other.colorappearance.ybscen - && colorappearance.autoybscen == other.colorappearance.autoybscen - && colorappearance.adaplum == other.colorappearance.adaplum - && colorappearance.badpixsl == other.colorappearance.badpixsl - && colorappearance.wbmodel == other.colorappearance.wbmodel - && colorappearance.algo == other.colorappearance.algo - && colorappearance.curveMode == other.colorappearance.curveMode - && colorappearance.curveMode2 == other.colorappearance.curveMode2 - && colorappearance.curveMode3 == other.colorappearance.curveMode3 - && colorappearance.jlight == other.colorappearance.jlight - && colorappearance.qbright == other.colorappearance.qbright - && colorappearance.chroma == other.colorappearance.chroma - && colorappearance.schroma == other.colorappearance.schroma - && colorappearance.mchroma == other.colorappearance.mchroma - && colorappearance.rstprotection == other.colorappearance.rstprotection - && colorappearance.contrast == other.colorappearance.contrast - && colorappearance.qcontrast == other.colorappearance.qcontrast - && colorappearance.colorh == other.colorappearance.colorh - && colorappearance.tempout == other.colorappearance.tempout - && colorappearance.greenout == other.colorappearance.greenout - && colorappearance.tempsc == other.colorappearance.tempsc - && colorappearance.greensc == other.colorappearance.greensc - && colorappearance.ybout == other.colorappearance.ybout - && impulseDenoise.enabled == other.impulseDenoise.enabled - && impulseDenoise.thresh == other.impulseDenoise.thresh - && dirpyrDenoise.enabled == other.dirpyrDenoise.enabled - && dirpyrDenoise.enhance == other.dirpyrDenoise.enhance - && dirpyrDenoise.median == other.dirpyrDenoise.median - && dirpyrDenoise.luma == other.dirpyrDenoise.luma - && dirpyrDenoise.lcurve == other.dirpyrDenoise.lcurve - && dirpyrDenoise.cccurve == other.dirpyrDenoise.cccurve - && dirpyrDenoise.Ldetail == other.dirpyrDenoise.Ldetail - && dirpyrDenoise.chroma == other.dirpyrDenoise.chroma - && dirpyrDenoise.dmethod == other.dirpyrDenoise.dmethod - && dirpyrDenoise.Lmethod == other.dirpyrDenoise.Lmethod - && dirpyrDenoise.Cmethod == other.dirpyrDenoise.Cmethod - && dirpyrDenoise.C2method == other.dirpyrDenoise.C2method - && dirpyrDenoise.smethod == other.dirpyrDenoise.smethod - && dirpyrDenoise.medmethod == other.dirpyrDenoise.medmethod - && dirpyrDenoise.methodmed == other.dirpyrDenoise.methodmed - && dirpyrDenoise.rgbmethod == other.dirpyrDenoise.rgbmethod - && dirpyrDenoise.redchro == other.dirpyrDenoise.redchro - && dirpyrDenoise.bluechro == other.dirpyrDenoise.bluechro - && dirpyrDenoise.gamma == other.dirpyrDenoise.gamma - && dirpyrDenoise.passes == other.dirpyrDenoise.passes - && epd.enabled == other.epd.enabled - && epd.strength == other.epd.strength - && epd.gamma == other.epd.gamma - && epd.edgeStopping == other.epd.edgeStopping - && epd.scale == other.epd.scale - && epd.reweightingIterates == other.epd.reweightingIterates - && fattal.enabled == other.fattal.enabled - && fattal.threshold == other.fattal.threshold - && fattal.amount == other.fattal.amount - && defringe.enabled == other.defringe.enabled - && defringe.radius == other.defringe.radius - && defringe.threshold == other.defringe.threshold - && defringe.huecurve == other.defringe.huecurve - && sh.enabled == other.sh.enabled - && sh.hq == other.sh.hq - && sh.highlights == other.sh.highlights - && sh.htonalwidth == other.sh.htonalwidth - && sh.shadows == other.sh.shadows - && sh.stonalwidth == other.sh.stonalwidth - && sh.localcontrast == other.sh.localcontrast - && sh.radius == other.sh.radius - && crop.enabled == other.crop.enabled - && crop.x == other.crop.x - && crop.y == other.crop.y - && crop.w == other.crop.w - && crop.h == other.crop.h - && crop.fixratio == other.crop.fixratio - && crop.ratio == other.crop.ratio - && crop.orientation == other.crop.orientation - && crop.guide == other.crop.guide - && coarse.rotate == other.coarse.rotate - && coarse.hflip == other.coarse.hflip - && coarse.vflip == other.coarse.vflip - && rotate.degree == other.rotate.degree - && commonTrans.autofill == other.commonTrans.autofill - && distortion.amount == other.distortion.amount - && lensProf.lcMode == other.lensProf.lcMode - && lensProf.lcpFile == other.lensProf.lcpFile - && lensProf.useDist == other.lensProf.useDist - && lensProf.useVign == other.lensProf.useVign - && lensProf.useCA == other.lensProf.useCA - && lensProf.lfCameraMake == other.lensProf.lfCameraMake - && lensProf.lfCameraModel == other.lensProf.lfCameraModel - && lensProf.lfLens == other.lensProf.lfLens - && perspective.horizontal == other.perspective.horizontal - && perspective.vertical == other.perspective.vertical - && gradient.enabled == other.gradient.enabled - && gradient.degree == other.gradient.degree - && gradient.feather == other.gradient.feather - && gradient.strength == other.gradient.strength - && gradient.centerX == other.gradient.centerX - && gradient.centerY == other.gradient.centerY - && pcvignette.enabled == other.pcvignette.enabled - && pcvignette.strength == other.pcvignette.strength - && pcvignette.feather == other.pcvignette.feather - && pcvignette.roundness == other.pcvignette.roundness - && cacorrection.red == other.cacorrection.red - && cacorrection.blue == other.cacorrection.blue - && vignetting.amount == other.vignetting.amount - && vignetting.radius == other.vignetting.radius - && vignetting.strength == other.vignetting.strength - && vignetting.centerX == other.vignetting.centerX - && vignetting.centerY == other.vignetting.centerY - && !memcmp (&chmixer.red, &other.chmixer.red, 3 * sizeof (int)) - && !memcmp (&chmixer.green, &other.chmixer.green, 3 * sizeof (int)) - && !memcmp (&chmixer.blue, &other.chmixer.blue, 3 * sizeof (int)) - && blackwhite.mixerRed == other.blackwhite.mixerRed - && blackwhite.mixerOrange == other.blackwhite.mixerOrange - && blackwhite.mixerYellow == other.blackwhite.mixerYellow - && blackwhite.mixerGreen == other.blackwhite.mixerGreen - && blackwhite.mixerCyan == other.blackwhite.mixerCyan - && blackwhite.mixerBlue == other.blackwhite.mixerBlue - && blackwhite.mixerMagenta == other.blackwhite.mixerMagenta - && blackwhite.mixerPurple == other.blackwhite.mixerPurple - && blackwhite.gammaRed == other.blackwhite.gammaRed - && blackwhite.gammaGreen == other.blackwhite.gammaGreen - && blackwhite.gammaBlue == other.blackwhite.gammaBlue - && blackwhite.filter == other.blackwhite.filter - && blackwhite.setting == other.blackwhite.setting - && blackwhite.method == other.blackwhite.method - && blackwhite.luminanceCurve == other.blackwhite.luminanceCurve - && blackwhite.beforeCurve == other.blackwhite.beforeCurve - && blackwhite.afterCurve == other.blackwhite.afterCurve - && blackwhite.beforeCurveMode == other.blackwhite.beforeCurveMode - && blackwhite.afterCurveMode == other.blackwhite.afterCurveMode - && blackwhite.autoc == other.blackwhite.autoc - && blackwhite.algo == other.blackwhite.algo - && resize.scale == other.resize.scale - && resize.appliesTo == other.resize.appliesTo - && resize.method == other.resize.method - && resize.dataspec == other.resize.dataspec - && resize.width == other.resize.width - && resize.height == other.resize.height - && raw.bayersensor.method == other.raw.bayersensor.method - && raw.bayersensor.imageNum == other.raw.bayersensor.imageNum - && raw.bayersensor.ccSteps == other.raw.bayersensor.ccSteps - && raw.bayersensor.black0 == other.raw.bayersensor.black0 - && raw.bayersensor.black1 == other.raw.bayersensor.black1 - && raw.bayersensor.black2 == other.raw.bayersensor.black2 - && raw.bayersensor.black3 == other.raw.bayersensor.black3 - && raw.bayersensor.twogreen == other.raw.bayersensor.twogreen - && raw.bayersensor.greenthresh == other.raw.bayersensor.greenthresh - && raw.bayersensor.linenoise == other.raw.bayersensor.linenoise - && raw.bayersensor.dcb_iterations == other.raw.bayersensor.dcb_iterations - && raw.bayersensor.lmmse_iterations == other.raw.bayersensor.lmmse_iterations - && raw.bayersensor.pixelShiftMotion == other.raw.bayersensor.pixelShiftMotion - && raw.bayersensor.pixelShiftMotionCorrection == other.raw.bayersensor.pixelShiftMotionCorrection - && raw.bayersensor.pixelShiftMotionCorrectionMethod == other.raw.bayersensor.pixelShiftMotionCorrectionMethod - && raw.bayersensor.pixelShiftStddevFactorGreen == other.raw.bayersensor.pixelShiftStddevFactorGreen - && raw.bayersensor.pixelShiftStddevFactorRed == other.raw.bayersensor.pixelShiftStddevFactorRed - && raw.bayersensor.pixelShiftStddevFactorBlue == other.raw.bayersensor.pixelShiftStddevFactorBlue - && raw.bayersensor.pixelShiftEperIso == other.raw.bayersensor.pixelShiftEperIso - && raw.bayersensor.pixelShiftNreadIso == other.raw.bayersensor.pixelShiftNreadIso - && raw.bayersensor.pixelShiftPrnu == other.raw.bayersensor.pixelShiftPrnu - && raw.bayersensor.pixelShiftSigma == other.raw.bayersensor.pixelShiftSigma - && raw.bayersensor.pixelShiftSum == other.raw.bayersensor.pixelShiftSum - && raw.bayersensor.pixelShiftRedBlueWeight == other.raw.bayersensor.pixelShiftRedBlueWeight - && raw.bayersensor.pixelShiftShowMotion == other.raw.bayersensor.pixelShiftShowMotion - && raw.bayersensor.pixelShiftShowMotionMaskOnly == other.raw.bayersensor.pixelShiftShowMotionMaskOnly - && raw.bayersensor.pixelShiftAutomatic == other.raw.bayersensor.pixelShiftAutomatic - && raw.bayersensor.pixelShiftNonGreenHorizontal == other.raw.bayersensor.pixelShiftNonGreenHorizontal - && raw.bayersensor.pixelShiftNonGreenVertical == other.raw.bayersensor.pixelShiftNonGreenVertical - && raw.bayersensor.pixelShiftHoleFill == other.raw.bayersensor.pixelShiftHoleFill - && raw.bayersensor.pixelShiftMedian == other.raw.bayersensor.pixelShiftMedian - && raw.bayersensor.pixelShiftMedian3 == other.raw.bayersensor.pixelShiftMedian3 - && raw.bayersensor.pixelShiftGreen == other.raw.bayersensor.pixelShiftGreen - && raw.bayersensor.pixelShiftBlur == other.raw.bayersensor.pixelShiftBlur - && raw.bayersensor.pixelShiftSmoothFactor == other.raw.bayersensor.pixelShiftSmoothFactor - && raw.bayersensor.pixelShiftExp0 == other.raw.bayersensor.pixelShiftExp0 - && raw.bayersensor.pixelShiftLmmse == other.raw.bayersensor.pixelShiftLmmse - && raw.bayersensor.pixelShiftEqualBright == other.raw.bayersensor.pixelShiftEqualBright - && raw.bayersensor.pixelShiftEqualBrightChannel == other.raw.bayersensor.pixelShiftEqualBrightChannel - && raw.bayersensor.pixelShiftNonGreenCross == other.raw.bayersensor.pixelShiftNonGreenCross - && raw.bayersensor.pixelShiftNonGreenCross2 == other.raw.bayersensor.pixelShiftNonGreenCross2 - && raw.bayersensor.pixelShiftNonGreenAmaze == other.raw.bayersensor.pixelShiftNonGreenAmaze - && raw.bayersensor.dcb_enhance == other.raw.bayersensor.dcb_enhance - && raw.xtranssensor.method == other.raw.xtranssensor.method - && raw.xtranssensor.ccSteps == other.raw.xtranssensor.ccSteps - && raw.xtranssensor.blackred == other.raw.xtranssensor.blackred - && raw.xtranssensor.blackgreen == other.raw.xtranssensor.blackgreen - && raw.xtranssensor.blackblue == other.raw.xtranssensor.blackblue - && raw.dark_frame == other.raw.dark_frame - && raw.df_autoselect == other.raw.df_autoselect - && raw.ff_file == other.raw.ff_file - && raw.ff_AutoSelect == other.raw.ff_AutoSelect - && raw.ff_BlurRadius == other.raw.ff_BlurRadius - && raw.ff_BlurType == other.raw.ff_BlurType - && raw.ff_AutoClipControl == other.raw.ff_AutoClipControl - && raw.ff_clipControl == other.raw.ff_clipControl - && raw.expos == other.raw.expos - && raw.preser == other.raw.preser - && raw.ca_autocorrect == other.raw.ca_autocorrect - && raw.cared == other.raw.cared - && raw.cablue == other.raw.cablue - && raw.hotPixelFilter == other.raw.hotPixelFilter - && raw.deadPixelFilter == other.raw.deadPixelFilter - && raw.hotdeadpix_thresh == other.raw.hotdeadpix_thresh - && icm.input == other.icm.input - && icm.toneCurve == other.icm.toneCurve - && icm.applyLookTable == other.icm.applyLookTable - && icm.applyBaselineExposureOffset == other.icm.applyBaselineExposureOffset - && icm.applyHueSatMap == other.icm.applyHueSatMap - && icm.dcpIlluminant == other.icm.dcpIlluminant - && icm.working == other.icm.working - && icm.output == other.icm.output - && icm.gamma == other.icm.gamma - && icm.freegamma == other.icm.freegamma - && icm.gampos == other.icm.gampos - && icm.slpos == other.icm.slpos + toneCurve == other.toneCurve + && retinex == other.retinex + && labCurve == other.labCurve + && sharpenEdge == other.sharpenEdge + && sharpenMicro == other.sharpenMicro + && sharpening == other.sharpening + && prsharpening == other.prsharpening + && vibrance == other.vibrance + && wb == other.wb + && colorappearance == other.colorappearance + && impulseDenoise == other.impulseDenoise + && dirpyrDenoise == other.dirpyrDenoise + && epd == other.epd + && fattal == other.fattal + && defringe == other.defringe + && sh == other.sh + && crop == other.crop + && coarse == other.coarse + && rotate == other.rotate + && commonTrans == other.commonTrans + && distortion == other.distortion + && lensProf == other.lensProf + && perspective == other.perspective + && gradient == other.gradient + && pcvignette == other.pcvignette + && cacorrection == other.cacorrection + && vignetting == other.vignetting + && chmixer == other.chmixer + && blackwhite == other.blackwhite + && resize == other.resize + && raw == other.raw + && icm == other.icm && wavelet == other.wavelet - && wavelet.Lmethod == other.wavelet.Lmethod - && wavelet.CLmethod == other.wavelet.CLmethod - && wavelet.Backmethod == other.wavelet.Backmethod - && wavelet.Tilesmethod == other.wavelet.Tilesmethod - && wavelet.daubcoeffmethod == other.wavelet.daubcoeffmethod - && wavelet.CHmethod == other.wavelet.CHmethod - && wavelet.CHSLmethod == other.wavelet.CHSLmethod - && wavelet.EDmethod == other.wavelet.EDmethod - && wavelet.NPmethod == other.wavelet.NPmethod - && wavelet.BAmethod == other.wavelet.BAmethod - && wavelet.TMmethod == other.wavelet.TMmethod - && wavelet.HSmethod == other.wavelet.HSmethod - && wavelet.Dirmethod == other.wavelet.Dirmethod - && wavelet.rescon == other.wavelet.rescon - && wavelet.resconH == other.wavelet.resconH - && wavelet.reschro == other.wavelet.reschro - && wavelet.tmrs == other.wavelet.tmrs - && wavelet.gamma == other.wavelet.gamma - && wavelet.sup == other.wavelet.sup - && wavelet.sky == other.wavelet.sky - && wavelet.thres == other.wavelet.thres - && wavelet.chroma == other.wavelet.chroma - && wavelet.chro == other.wavelet.chro - && wavelet.tmr == other.wavelet.tmr - && wavelet.contrast == other.wavelet.contrast - && wavelet.median == other.wavelet.median - && wavelet.expcontrast == other.wavelet.expcontrast - && wavelet.expchroma == other.wavelet.expchroma - && wavelet.expedge == other.wavelet.expedge - && wavelet.expresid == other.wavelet.expresid - && wavelet.expfinal == other.wavelet.expfinal - && wavelet.exptoning == other.wavelet.exptoning - && wavelet.expnoise == other.wavelet.expnoise - && wavelet.medianlev == other.wavelet.medianlev - && wavelet.linkedg == other.wavelet.linkedg - && wavelet.cbenab == other.wavelet.cbenab - && wavelet.lipst == other.wavelet.lipst - && wavelet.Medgreinf == other.wavelet.Medgreinf - && wavelet.edgrad == other.wavelet.edgrad - && wavelet.edgval == other.wavelet.edgval - && wavelet.edgthresh == other.wavelet.edgthresh - && wavelet.thr == other.wavelet.thr - && wavelet.thrH == other.wavelet.thrH - && wavelet.threshold == other.wavelet.threshold - && wavelet.threshold2 == other.wavelet.threshold2 - && wavelet.edgedetect == other.wavelet.edgedetect - && wavelet.edgedetectthr == other.wavelet.edgedetectthr - && wavelet.edgedetectthr2 == other.wavelet.edgedetectthr2 - && wavelet.edgesensi == other.wavelet.edgesensi - && wavelet.edgeampli == other.wavelet.edgeampli - && wavelet.hueskin == other.wavelet.hueskin - && wavelet.hueskin2 == other.wavelet.hueskin2 - && wavelet.hllev == other.wavelet.hllev - && wavelet.bllev == other.wavelet.bllev - && wavelet.edgcont == other.wavelet.edgcont - && wavelet.level0noise == other.wavelet.level0noise - && wavelet.level1noise == other.wavelet.level1noise - && wavelet.level2noise == other.wavelet.level2noise - && wavelet.level3noise == other.wavelet.level3noise - && wavelet.pastlev == other.wavelet.pastlev - && wavelet.satlev == other.wavelet.satlev - && wavelet.opacityCurveRG == other.wavelet.opacityCurveRG - && wavelet.opacityCurveBY == other.wavelet.opacityCurveBY - && wavelet.opacityCurveW == other.wavelet.opacityCurveW - && wavelet.opacityCurveWL == other.wavelet.opacityCurveWL - && wavelet.hhcurve == other.wavelet.hhcurve - && wavelet.Chcurve == other.wavelet.Chcurve - && wavelet.ccwcurve == other.wavelet.ccwcurve - && wavelet.wavclCurve == other.wavelet.wavclCurve - && wavelet.skinprotect == other.wavelet.skinprotect - && wavelet.strength == other.wavelet.strength - && wavelet.balance == other.wavelet.balance - && wavelet.greenhigh == other.wavelet.greenhigh - && wavelet.greenmed == other.wavelet.greenmed - && wavelet.greenlow == other.wavelet.greenlow - && wavelet.bluehigh == other.wavelet.bluehigh - && wavelet.bluemed == other.wavelet.bluemed - && wavelet.bluelow == other.wavelet.bluelow - && wavelet.iter == other.wavelet.iter && dirpyrequalizer == other.dirpyrequalizer - && dirpyrequalizer.hueskin == other.dirpyrequalizer.hueskin - && dirpyrequalizer.threshold == other.dirpyrequalizer.threshold - && dirpyrequalizer.cbdlMethod == other.dirpyrequalizer.cbdlMethod - && dirpyrequalizer.skinprotect == other.dirpyrequalizer.skinprotect - && hsvequalizer.hcurve == other.hsvequalizer.hcurve - && hsvequalizer.scurve == other.hsvequalizer.scurve - && hsvequalizer.vcurve == other.hsvequalizer.vcurve - && filmSimulation.enabled == other.filmSimulation.enabled - && filmSimulation.clutFilename == other.filmSimulation.clutFilename - && filmSimulation.strength == other.filmSimulation.strength - && rgbCurves.rcurve == other.rgbCurves.rcurve - && rgbCurves.gcurve == other.rgbCurves.gcurve - && rgbCurves.bcurve == other.rgbCurves.bcurve - && colorToning.enabled == other.colorToning.enabled - && colorToning.twocolor == other.colorToning.twocolor - && colorToning.method == other.colorToning.method - && colorToning.colorCurve == other.colorToning.colorCurve - && colorToning.opacityCurve == other.colorToning.opacityCurve - && colorToning.autosat == other.colorToning.autosat - && colorToning.satProtectionThreshold == other.colorToning.satProtectionThreshold - && colorToning.saturatedOpacity == other.colorToning.saturatedOpacity - && colorToning.strength == other.colorToning.strength - && colorToning.hlColSat == other.colorToning.hlColSat - && colorToning.shadowsColSat == other.colorToning.shadowsColSat - && colorToning.balance == other.colorToning.balance - && colorToning.clcurve == other.colorToning.clcurve - && colorToning.cl2curve == other.colorToning.cl2curve - && colorToning.redlow == other.colorToning.redlow - && colorToning.greenlow == other.colorToning.greenlow - && colorToning.bluelow == other.colorToning.bluelow - && colorToning.satlow == other.colorToning.satlow - && colorToning.sathigh == other.colorToning.sathigh - && colorToning.redmed == other.colorToning.redmed - && colorToning.greenmed == other.colorToning.greenmed - && colorToning.bluemed == other.colorToning.bluemed - && colorToning.redhigh == other.colorToning.redhigh - && colorToning.greenhigh == other.colorToning.greenhigh - && colorToning.bluehigh == other.colorToning.bluehigh + && hsvequalizer == other.hsvequalizer + && filmSimulation == other.filmSimulation + && rgbCurves == other.rgbCurves + && colorToning == other.colorToning && exif == other.exif && iptc == other.iptc; } -bool ProcParams::operator !=(const ProcParams& other) +bool ProcParams::operator !=(const ProcParams& other) const { return !(*this == other); } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 7ec39d3cf..21a048347 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -283,6 +283,9 @@ struct ToneCurveParams { ToneCurveParams(); + bool operator ==(const ToneCurveParams& other) const; + bool operator !=(const ToneCurveParams& other) const; + static bool HLReconstructionNecessary(const LUTu& histRedRaw, const LUTu& histGreenRaw, const LUTu& histBlueRaw); }; @@ -326,6 +329,9 @@ struct RetinexParams RetinexParams(); + bool operator ==(const RetinexParams& other) const; + bool operator !=(const RetinexParams& other) const; + void getCurves(RetinextransmissionCurve& transmissionCurveLUT, RetinexgaintransmissionCurve& gaintransmissionCurveLUT) const; }; @@ -352,6 +358,9 @@ struct LCurveParams bool lcredsk; LCurveParams(); + + bool operator ==(const LCurveParams& other) const; + bool operator !=(const LCurveParams& other) const; }; /** @@ -364,6 +373,9 @@ struct RGBCurvesParams { std::vector bcurve; RGBCurvesParams(); + + bool operator ==(const RGBCurvesParams& other) const; + bool operator !=(const RGBCurvesParams& other) const; }; /** @@ -417,6 +429,9 @@ struct ColorToningParams { ColorToningParams(); + bool operator ==(const ColorToningParams& other) const; + bool operator !=(const ColorToningParams& other) const; + /// @brief Transform the mixer values to their curve equivalences void mixerToCurve(std::vector& colorCurve, std::vector& opacityCurve) const; /// @brief Specifically transform the sliders values to their curve equivalences @@ -445,6 +460,9 @@ struct SharpeningParams { int deconvdamping; SharpeningParams(); + + bool operator ==(const SharpeningParams& other) const; + bool operator !=(const SharpeningParams& other) const; }; struct SharpenEdgeParams { @@ -454,6 +472,9 @@ struct SharpenEdgeParams { bool threechannels; SharpenEdgeParams(); + + bool operator ==(const SharpenEdgeParams& other) const; + bool operator !=(const SharpenEdgeParams& other) const; }; struct SharpenMicroParams { @@ -463,6 +484,9 @@ struct SharpenMicroParams { double uniformity; SharpenMicroParams(); + + bool operator ==(const SharpenMicroParams& other) const; + bool operator !=(const SharpenMicroParams& other) const; }; /** @@ -479,6 +503,9 @@ struct VibranceParams { std::vector skintonescurve; VibranceParams(); + + bool operator ==(const VibranceParams& other) const; + bool operator !=(const VibranceParams& other) const; }; /** @@ -519,6 +546,9 @@ struct WBParams { WBParams(); + bool operator ==(const WBParams& other) const; + bool operator !=(const WBParams& other) const; + static const std::vector& getWbEntries(); }; @@ -580,6 +610,9 @@ struct ColorAppearanceParams { double greensc; ColorAppearanceParams(); + + bool operator ==(const ColorAppearanceParams& other) const; + bool operator !=(const ColorAppearanceParams& other) const; }; /** @@ -592,6 +625,9 @@ struct DefringeParams { std::vector huecurve; DefringeParams(); + + bool operator ==(const DefringeParams& other) const; + bool operator !=(const DefringeParams& other) const; }; /** @@ -602,6 +638,9 @@ struct ImpulseDenoiseParams { int thresh; ImpulseDenoiseParams(); + + bool operator ==(const ImpulseDenoiseParams& other) const; + bool operator !=(const ImpulseDenoiseParams& other) const; }; /** @@ -634,6 +673,9 @@ struct DirPyrDenoiseParams { DirPyrDenoiseParams(); + bool operator ==(const DirPyrDenoiseParams& other) const; + bool operator !=(const DirPyrDenoiseParams& other) const; + void getCurves(NoiseCurve& lCurve, NoiseCurve& cCurve) const; }; @@ -648,6 +690,9 @@ struct EPDParams { int reweightingIterates; EPDParams(); + + bool operator ==(const EPDParams& other) const; + bool operator !=(const EPDParams& other) const; }; // Fattal02 Tone-Mapping parameters @@ -657,6 +702,9 @@ struct FattalToneMappingParams { int amount; FattalToneMappingParams(); + + bool operator ==(const FattalToneMappingParams& other) const; + bool operator !=(const FattalToneMappingParams& other) const; }; /** @@ -673,6 +721,9 @@ struct SHParams { int radius; SHParams(); + + bool operator ==(const SHParams& other) const; + bool operator !=(const SHParams& other) const; }; /** @@ -690,6 +741,10 @@ struct CropParams { Glib::ustring guide; CropParams(); + + bool operator ==(const CropParams& other) const; + bool operator !=(const CropParams& other) const; + void mapToResized(int resizedWidth, int resizedHeight, int scale, int& x1, int& x2, int& y1, int& y2) const; }; @@ -702,6 +757,9 @@ struct CoarseTransformParams { bool vflip; CoarseTransformParams(); + + bool operator ==(const CoarseTransformParams& other) const; + bool operator !=(const CoarseTransformParams& other) const; }; /** @@ -711,6 +769,9 @@ struct CommonTransformParams { bool autofill; CommonTransformParams(); + + bool operator ==(const CommonTransformParams& other) const; + bool operator !=(const CommonTransformParams& other) const; }; /** @@ -720,6 +781,9 @@ struct RotateParams { double degree; RotateParams(); + + bool operator ==(const RotateParams& other) const; + bool operator !=(const RotateParams& other) const; }; /** @@ -729,6 +793,9 @@ struct DistortionParams { double amount; DistortionParams(); + + bool operator ==(const DistortionParams& other) const; + bool operator !=(const DistortionParams& other) const; }; // Lens profile correction parameters @@ -749,6 +816,9 @@ struct LensProfParams { LensProfParams(); + bool operator ==(const LensProfParams& other) const; + bool operator !=(const LensProfParams& other) const; + bool useLensfun() const; bool lfAutoMatch() const; bool useLcp() const; @@ -768,6 +838,9 @@ struct PerspectiveParams { double vertical; PerspectiveParams(); + + bool operator ==(const PerspectiveParams& other) const; + bool operator !=(const PerspectiveParams& other) const; }; /** @@ -782,6 +855,9 @@ struct GradientParams { int centerY; GradientParams(); + + bool operator ==(const GradientParams& other) const; + bool operator !=(const GradientParams& other) const; }; /** @@ -794,6 +870,9 @@ struct PCVignetteParams { int roundness; PCVignetteParams(); + + bool operator ==(const PCVignetteParams& other) const; + bool operator !=(const PCVignetteParams& other) const; }; /** @@ -807,6 +886,9 @@ struct VignettingParams { int centerY; VignettingParams(); + + bool operator ==(const VignettingParams& other) const; + bool operator !=(const VignettingParams& other) const; }; /** @@ -818,6 +900,9 @@ struct ChannelMixerParams { int blue[3]; ChannelMixerParams(); + + bool operator ==(const ChannelMixerParams& other) const; + bool operator !=(const ChannelMixerParams& other) const; }; struct BlackWhiteParams { @@ -854,6 +939,9 @@ struct BlackWhiteParams { int gammaBlue; BlackWhiteParams(); + + bool operator ==(const BlackWhiteParams& other) const; + bool operator !=(const BlackWhiteParams& other) const; }; /** @@ -864,6 +952,9 @@ struct CACorrParams { double blue; CACorrParams(); + + bool operator ==(const CACorrParams& other) const; + bool operator !=(const CACorrParams& other) const; }; /** @@ -879,6 +970,9 @@ struct ResizeParams { int height; ResizeParams(); + + bool operator ==(const ResizeParams& other) const; + bool operator !=(const ResizeParams& other) const; }; /** @@ -904,6 +998,9 @@ struct ColorManagementParams { static const Glib::ustring NoICMString; ColorManagementParams(); + + bool operator ==(const ColorManagementParams& other) const; + bool operator !=(const ColorManagementParams& other) const; }; /** @@ -1005,6 +1102,9 @@ struct WaveletParams { WaveletParams(); + bool operator ==(const WaveletParams& other) const; + bool operator !=(const WaveletParams& other) const; + void getCurves( WavCurve& cCurve, WavOpacityCurveRG& @@ -1028,6 +1128,9 @@ struct DirPyrEqualizerParams { Glib::ustring cbdlMethod; DirPyrEqualizerParams(); + + bool operator ==(const DirPyrEqualizerParams& other) const; + bool operator !=(const DirPyrEqualizerParams& other) const; }; /** @@ -1039,6 +1142,9 @@ struct HSVEqualizerParams { std::vector vcurve; HSVEqualizerParams(); + + bool operator ==(const HSVEqualizerParams& other) const; + bool operator !=(const HSVEqualizerParams& other) const; }; @@ -1051,6 +1157,9 @@ struct FilmSimulationParams { int strength; FilmSimulationParams(); + + bool operator ==(const FilmSimulationParams& other) const; + bool operator !=(const FilmSimulationParams& other) const; }; @@ -1138,6 +1247,9 @@ struct RAWParams { BayerSensor(); + bool operator ==(const BayerSensor& other) const; + bool operator !=(const BayerSensor& other) const; + void setPixelShiftDefaults(); static const std::vector& getMethodStrings(); @@ -1164,6 +1276,9 @@ struct RAWParams { XTransSensor(); + bool operator ==(const XTransSensor& other) const; + bool operator !=(const XTransSensor& other) const; + static const std::vector& getMethodStrings(); static Glib::ustring getMethodString(Method method); }; @@ -1202,6 +1317,9 @@ struct RAWParams { RAWParams(); + bool operator ==(const RAWParams& other) const; + bool operator !=(const RAWParams& other) const; + static const std::vector& getFlatFieldBlurTypeStrings(); static Glib::ustring getFlatFieldBlurTypeString(FlatFieldBlurType type); }; @@ -1298,8 +1416,8 @@ public: static void init(); static void cleanup(); - bool operator ==(const ProcParams& other); - bool operator !=(const ProcParams& other); + bool operator ==(const ProcParams& other) const; + bool operator !=(const ProcParams& other) const; private: /** Write the ProcParams's text in the file of the given name. diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 587c89af7..c2f22697d 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -839,8 +839,5 @@ public: void set (bool v); void initFrom (const std::vector& src); void combine (rtengine::procparams::ProcParams& toEdit, const rtengine::procparams::ProcParams& mods, bool forceSet); - - bool operator== (const ParamsEdited& other); - bool operator!= (const ParamsEdited& other); }; #endif From a2edcbd67db23f810b35a70214b08a9d395b877e Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 26 Nov 2017 22:02:58 +0100 Subject: [PATCH 19/47] made the "before" view use the current monitor profile Fixes #3090 --- rtgui/editorpanel.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index c2bec8692..cf5dcba89 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -2186,6 +2186,11 @@ void EditorPanel::beforeAfterToggled () beforeIpc = rtengine::StagedImageProcessor::create (beforeImg); beforeIpc->setPreviewScale (10); beforeIpc->setPreviewImageListener (beforePreviewHandler); + Glib::ustring monitorProfile; + rtengine::RenderingIntent intent; + ipc->getMonitorProfile(monitorProfile, intent); + beforeIpc->setMonitorProfile(monitorProfile, intent); + beforeIarea->imageArea->setPreviewHandler (beforePreviewHandler); beforeIarea->imageArea->setImProcCoordinator (beforeIpc); From 84379ffb7d6c46879fd466ae374c74aa6d051693 Mon Sep 17 00:00:00 2001 From: Oleg Koncevoy Date: Mon, 27 Nov 2017 17:00:09 +0200 Subject: [PATCH 20/47] Removed histogram profile settings from preferences window. modified: ../rtgui/preferences.cc modified: ../rtgui/preferences.h --- rtgui/preferences.cc | 8 +------- rtgui/preferences.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 3f414321b..7e6018ff0 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -990,18 +990,14 @@ Gtk::Widget* Preferences::getGeneralPanel () ckbHistogramPositionLeft = Gtk::manage ( new Gtk::CheckButton (M ("PREFERENCES_HISTOGRAMPOSITIONLEFT")) ); setExpandAlignProperties (ckbHistogramPositionLeft, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); - ckbHistogramWorking = Gtk::manage ( new Gtk::CheckButton (M ("PREFERENCES_HISTOGRAMWORKING")) ); - setExpandAlignProperties (ckbHistogramWorking, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); - ckbHistogramWorking->set_tooltip_markup (M ("PREFERENCES_HISTOGRAM_TOOLTIP")); workflowGrid->attach_next_to (*ckbHistogramPositionLeft, *curveBBoxPosL, Gtk::POS_BOTTOM, 1, 1); - workflowGrid->attach_next_to (*ckbHistogramWorking, *curveBBoxPosC, Gtk::POS_BOTTOM, 2, 1); ckbFileBrowserToolbarSingleRow = Gtk::manage ( new Gtk::CheckButton (M ("PREFERENCES_FILEBROWSERTOOLBARSINGLEROW")) ); setExpandAlignProperties (ckbFileBrowserToolbarSingleRow, false, false, Gtk::ALIGN_START, Gtk::ALIGN_START); ckbShowFilmStripToolBar = Gtk::manage ( new Gtk::CheckButton (M ("PREFERENCES_SHOWFILMSTRIPTOOLBAR")) ); setExpandAlignProperties (ckbShowFilmStripToolBar, false, false, Gtk::ALIGN_START, Gtk::ALIGN_START); workflowGrid->attach_next_to (*ckbFileBrowserToolbarSingleRow, *ckbHistogramPositionLeft, Gtk::POS_BOTTOM, 1, 1); - workflowGrid->attach_next_to (*ckbShowFilmStripToolBar, *ckbHistogramWorking, Gtk::POS_BOTTOM, 2, 1); + workflowGrid->attach_next_to (*ckbShowFilmStripToolBar, *curveBBoxPosC, Gtk::POS_BOTTOM, 2, 1); Gtk::Label* hb4label = Gtk::manage ( new Gtk::Label (M ("PREFERENCES_TP_LABEL")) ); setExpandAlignProperties (hb4label, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); @@ -1757,7 +1753,6 @@ void Preferences::storePreferences () // moptions.rtSettings.viewinggreySc = greySc->get_active_row_number (); // moptions.rtSettings.autocielab = cbAutocielab->get_active (); moptions.rtSettings.ciecamfloat = cbciecamfloat->get_active (); - moptions.rtSettings.HistogramWorking = ckbHistogramWorking->get_active (); moptions.rtSettings.leveldnv = dnv->get_active_row_number (); moptions.rtSettings.leveldnti = dnti->get_active_row_number (); moptions.rtSettings.leveldnliss = dnliss->get_active_row_number (); @@ -1928,7 +1923,6 @@ void Preferences::fillPreferences () // cbAutocielab->set_active (moptions.rtSettings.autocielab); cbciecamfloat->set_active (moptions.rtSettings.ciecamfloat); - ckbHistogramWorking->set_active (moptions.rtSettings.HistogramWorking); languages->set_active_text (moptions.language); ckbLangAutoDetect->set_active (moptions.languageAutoDetect); int themeNbr = getThemeRowNumber (moptions.theme); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index b3efd8b6a..70cef4bee 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -195,7 +195,6 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener Gtk::ComboBoxText* custProfBuilderLabelType; Gtk::CheckButton* ckbHistogramPositionLeft; - Gtk::CheckButton* ckbHistogramWorking; Gtk::CheckButton* ckbFileBrowserToolbarSingleRow; Gtk::CheckButton* ckbShowFilmStripToolBar; Gtk::CheckButton* ckbHideTPVScrollbar; From 4c76c7456f9cc6707450606d52c7c735a50d54da Mon Sep 17 00:00:00 2001 From: Oleg Koncevoy Date: Mon, 27 Nov 2017 17:00:51 +0200 Subject: [PATCH 21/47] Added a histogram profile settings toggle button. Now working histogram profile can be changed without entering the preferences window. modified: ../rtgui/editorpanel.cc modified: ../rtgui/editorpanel.h --- rtgui/editorpanel.cc | 17 +++++++++++++++++ rtgui/editorpanel.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index cf5dcba89..21286ca01 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -585,6 +585,13 @@ EditorPanel::EditorPanel (FilePanel* filePanel) Gtk::VSeparator* vsep1 = Gtk::manage (new Gtk::VSeparator ()); Gtk::VSeparator* vsep2 = Gtk::manage (new Gtk::VSeparator ()); + // Histogram profile toggle controls + toggleHistogramProfile = Gtk::manage (new Gtk::ToggleButton ()); + toggleHistogramProfile->set_relief(Gtk::RELIEF_NONE); + toggleHistogramProfile->set_active(options.rtSettings.HistogramWorking); + + Gtk::VSeparator* vsep3 = Gtk::manage (new Gtk::VSeparator ()); + iareapanel = new ImageAreaPanel (); tpc->setEditProvider (iareapanel->imageArea); tpc->getToolBar()->setLockablePickerToolListener (iareapanel->imageArea); @@ -607,6 +614,10 @@ EditorPanel::EditorPanel (FilePanel* filePanel) toolBarPanel->pack_end (*tpc->coarse, Gtk::PACK_SHRINK, 2); toolBarPanel->pack_end (*vsepcl, Gtk::PACK_SHRINK, 2); + // Histogram profile toggle + toolBarPanel->pack_end (*toggleHistogramProfile, Gtk::PACK_SHRINK, 1); + toolBarPanel->pack_end (*vsep3, Gtk::PACK_SHRINK, 2); + toolBarPanel->pack_end (*iareapanel->imageArea->indClippedPanel, Gtk::PACK_SHRINK, 0); toolBarPanel->pack_end (*vsepz, Gtk::PACK_SHRINK, 2); toolBarPanel->pack_end (*iareapanel->imageArea->previewModePanel, Gtk::PACK_SHRINK, 0); @@ -819,6 +830,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) saveimgas->signal_pressed().connect ( sigc::mem_fun (*this, &EditorPanel::saveAsPressed) ); queueimg->signal_pressed().connect ( sigc::mem_fun (*this, &EditorPanel::queueImgPressed) ); sendtogimp->signal_pressed().connect ( sigc::mem_fun (*this, &EditorPanel::sendToGimpPressed) ); + toggleHistogramProfile->signal_toggled().connect( sigc::mem_fun (*this, &EditorPanel::histogramProfile_toggled) ); if (navPrev) { navPrev->signal_pressed().connect ( sigc::mem_fun (*this, &EditorPanel::openPreviousEditorImage) ); @@ -2015,6 +2027,11 @@ void EditorPanel::syncFileBrowser() // synchronize filebrowser with image in E } } +void EditorPanel::histogramProfile_toggled() +{ + options.rtSettings.HistogramWorking = toggleHistogramProfile->get_active(); +} + bool EditorPanel::idle_sendToGimp ( ProgressConnector *pc, Glib::ustring fname) { diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index 5beb9ee7d..9ccbbef2d 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -115,6 +115,7 @@ public: void openNextEditorImage (); void openPreviousEditorImage (); void syncFileBrowser (); + void histogramProfile_toggled (); void tbTopPanel_1_visible (bool visible); bool CheckSidePanelsVisibility(); @@ -196,6 +197,7 @@ private: Gtk::HBox* beforeAfterBox; Gtk::HBox* beforeHeaderBox; Gtk::HBox* afterHeaderBox; + Gtk::ToggleButton* toggleHistogramProfile; Gtk::Frame* ppframe; ProfilePanel* profilep; From f071d321fdf61f1536b958bc8b44a9c087d8d44f Mon Sep 17 00:00:00 2001 From: Oleg Koncevoy Date: Mon, 27 Nov 2017 17:38:09 +0200 Subject: [PATCH 22/47] Added tooltip for histogram profile toggle button --- rtgui/editorpanel.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 21286ca01..855458b93 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -587,8 +587,9 @@ EditorPanel::EditorPanel (FilePanel* filePanel) // Histogram profile toggle controls toggleHistogramProfile = Gtk::manage (new Gtk::ToggleButton ()); - toggleHistogramProfile->set_relief(Gtk::RELIEF_NONE); - toggleHistogramProfile->set_active(options.rtSettings.HistogramWorking); + toggleHistogramProfile->set_relief (Gtk::RELIEF_NONE); + toggleHistogramProfile->set_active (options.rtSettings.HistogramWorking); + toggleHistogramProfile->set_tooltip_markup ( (M ("PREFERENCES_HISTOGRAM_TOOLTIP"))); Gtk::VSeparator* vsep3 = Gtk::manage (new Gtk::VSeparator ()); From edbe4f3f14ee4dcd21091e9800fdbcb96e38b271 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Mon, 27 Nov 2017 19:48:16 +0100 Subject: [PATCH 23/47] Added template icon showing RT sRGB and ProPhoto CIE XY gamuts --- .../scalable/gamut_srgb_prophoto_xy.svg | 656 ++++++++++++++++++ 1 file changed, 656 insertions(+) create mode 100644 tools/source_icons/scalable/gamut_srgb_prophoto_xy.svg diff --git a/tools/source_icons/scalable/gamut_srgb_prophoto_xy.svg b/tools/source_icons/scalable/gamut_srgb_prophoto_xy.svg new file mode 100644 index 000000000..21058878e --- /dev/null +++ b/tools/source_icons/scalable/gamut_srgb_prophoto_xy.svg @@ -0,0 +1,656 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + Morgan Hardwood + + + RawTherapee www.rawtherapee.com + + + + + + + + + + + + + + + + + + + From 8e43df5abb6eda05ff570791a9111a8e49b0deb4 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 28 Nov 2017 08:57:45 +0100 Subject: [PATCH 24/47] Fattal: fixed off-by-one error in rescaling the luminance Fixes #4200 --- rtengine/tmo_fattal02.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index 1b301123a..4af176cd2 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -1253,15 +1253,18 @@ void ImProcFunctions::ToneMapFattal02 (Imagefloat *rgb) rescale_nearest (Yr, L, multiThread); tmo_fattal02 (w2, h2, L, L, alpha, beta, noise, detail_level, multiThread); + const float hr = float(h2) / float(h); + const float wr = float(w2) / float(w); + #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif - for (int y = 0; y < h; y++) { - int yy = y * h2 / h; - + int yy = y * hr + 1; + for (int x = 0; x < w; x++) { - int xx = x * w2 / w; + int xx = x * wr + 1; + float Y = Yr (x, y); float l = std::max (L (xx, yy), epsilon) * (65535.f / Y); rgb->r (y, x) = std::max (rgb->r (y, x), 0.f) * l; From 56dc615b2ace5a6009acbd5b0a86383398bf70d2 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 28 Nov 2017 14:26:30 +0100 Subject: [PATCH 25/47] lens profile: correctly update the value of the "correct CA" checkbox Fixes #4201 --- rtgui/lensprofile.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index f5c9a11ab..052cb1455 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -190,10 +190,6 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa updateDisabled(false); } - ckbUseDist->set_active (pp->lensProf.useDist); - ckbUseVign->set_active (pp->lensProf.useVign && isRaw); - ckbUseCA->set_active(pp->lensProf.useCA && isRaw && ckbUseCA->get_sensitive()); - const LFDatabase *db = LFDatabase::getInstance(); LFCamera c; @@ -226,6 +222,10 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa updateLensfunWarning(); + ckbUseDist->set_active (pp->lensProf.useDist); + ckbUseVign->set_active (pp->lensProf.useVign && isRaw); + ckbUseCA->set_active(pp->lensProf.useCA && isRaw && ckbUseCA->get_sensitive()); + enableListener (); conUseDist.block(false); } From 80fca667e285e29070abf19630d7c2cf1b75d749 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 29 Nov 2017 23:06:53 +0100 Subject: [PATCH 26/47] Fix crash bug in raw ca correction when width is odd, also fix two overruns detected by adress sanitizer, fixes #4202 --- rtengine/CA_correct_RT.cc | 14 +++++++------- rtengine/amaze_demosaic_RT.cc | 10 ++++++++-- rtengine/demosaic_algos.cc | 3 ++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/rtengine/CA_correct_RT.cc b/rtengine/CA_correct_RT.cc index 59fd804f1..bfd56cc0a 100644 --- a/rtengine/CA_correct_RT.cc +++ b/rtengine/CA_correct_RT.cc @@ -218,18 +218,18 @@ void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const // Main algorithm: Tile loop calculating correction parameters per tile #pragma omp for collapse(2) schedule(dynamic) nowait for (int top = -border ; top < height; top += ts - border2) - for (int left = -border; left < width; left += ts - border2) { + for (int left = -border; left < width - (W & 1); left += ts - border2) { memset(buffer, 0, buffersize); const int vblock = ((top + border) / (ts - border2)) + 1; const int hblock = ((left + border) / (ts - border2)) + 1; const int bottom = min(top + ts, height + border); - const int right = min(left + ts, width + border); + const int right = min(left + ts, width - (W & 1) + border); const int rr1 = bottom - top; const int cc1 = right - left; const int rrmin = top < 0 ? border : 0; const int rrmax = bottom > height ? height - top : rr1; const int ccmin = left < 0 ? border : 0; - const int ccmax = right > width ? width - left : cc1; + const int ccmax = (right > width - (W & 1)) ? width - (W & 1) - left : cc1; // rgb from input CFA data // rgb values should be floating point numbers between 0 and 1 @@ -755,20 +755,20 @@ void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const #pragma omp for schedule(dynamic) collapse(2) nowait for (int top = -border; top < height; top += ts - border2) - for (int left = -border; left < width; left += ts - border2) { + for (int left = -border; left < width - (W & 1); left += ts - border2) { memset(buffer, 0, buffersize); float lblockshifts[2][2]; const int vblock = ((top + border) / (ts - border2)) + 1; const int hblock = ((left + border) / (ts - border2)) + 1; const int bottom = min(top + ts, height + border); - const int right = min(left + ts, width + border); + const int right = min(left + ts, width - (W & 1) + border); const int rr1 = bottom - top; const int cc1 = right - left; const int rrmin = top < 0 ? border : 0; const int rrmax = bottom > height ? height - top : rr1; const int ccmin = left < 0 ? border : 0; - const int ccmax = right > width ? width - left : cc1; + const int ccmax = (right > width - (W & 1)) ? width - (W & 1) - left : cc1; // rgb from input CFA data // rgb values should be floating point number between 0 and 1 @@ -1145,7 +1145,7 @@ void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const STC2VFU(rawData[row][col], LVFU(RawDataTmp[indx])); } #endif - for(; col < width; col += 2, indx++) { + for(; col < width - (W & 1); col += 2, indx++) { rawData[row][col] = RawDataTmp[indx]; } } diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc index 3cb0ee8de..fdd51d92a 100644 --- a/rtengine/amaze_demosaic_RT.cc +++ b/rtengine/amaze_demosaic_RT.cc @@ -223,13 +223,19 @@ SSEFUNCTION void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, // fill inner part for (int rr = rrmin; rr < rrmax; rr++) { int row = rr + top; - - for (int cc = ccmin; cc < ccmax; cc += 4) { + int cc = ccmin; + for (; cc < ccmax - 3; cc += 4) { int indx1 = rr * ts + cc; vfloat tempv = LVFU(rawData[row][cc + left]) / c65535v; STVF(cfa[indx1], tempv ); STVF(rgbgreen[indx1], tempv ); } + for (; cc < ccmax; ++cc) { + int indx1 = rr * ts + cc; + float temp = rawData[row][cc + left] / 65535.f; + cfa[indx1] = temp; + rgbgreen[indx1] = temp; + } } //fill lower border diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 88d369969..1677b785f 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -2029,7 +2029,8 @@ SSEFUNCTION void RawImageSource::igv_interpolate(int winw, int winh) for (; col < width; col++, indx += 2) { dest1[indx >> 1] = CLIP(rawData[row][col]); //rawData = RT datas col++; - dest2[indx >> 1] = CLIP(rawData[row][col]); //rawData = RT datas + if(col < width) + dest2[indx >> 1] = CLIP(rawData[row][col]); //rawData = RT datas } } From 9da5da89539d0cb76dd99cbaec9b1f075a3af446 Mon Sep 17 00:00:00 2001 From: Stefal Date: Thu, 30 Nov 2017 11:36:51 +0100 Subject: [PATCH 27/47] Update french translation --- rtdata/languages/Francais | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 85fe0b306..e9efe4005 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -1069,7 +1069,7 @@ PREFERENCES_OUTDIR;Dossier de sortie PREFERENCES_OUTDIRFOLDER;Dossier de sauvegarde PREFERENCES_OUTDIRFOLDERHINT;Place les images traitées dans le dossier selectionné PREFERENCES_OUTDIRTEMPLATE;Utiliser le modèle -PREFERENCES_OUTDIRTEMPLATEHINT;Vous pouvez utiliser les paramètres de chaîne formatées suivants:\n%f, %d1, %d2, ..., %p1, %p2, ..., %r, %s1, %s2, ...\n\nCes chaînes de formattage se réfèrent aux différentes parties du chemin de la photo, certains de ses attributs ou un numéro de séquence arbitraire dans le traitement par lot.\n\nPar exemple, si la photo en cours de traitement a le chemin suivant:\n/home/tom/image/02-09-2006/dsc0012.nef\nla signification des chaînes de formattage est:\n%d4 = home\n%d3 = tom\n%d2 = photos\n%d1 = 2010-10-31\n%f = dsc0042\n%p1 = /home/tom/photos/2010-10-31/\n%p2 = /home/tom/photos/\n%p3 = /home/tom/\n%p4 = /home/\n\n%r sera remplacé par le rang de la photo. Si la photo n'a pas de rang, %r sera remplacé par '0'. Si la photo est dans la corbeille de RawTherapee, %r sera remplacé par 'x'.\n\n%s1, %s2, etc. sera remplacé par un index de séquence constitué de 1 à 9 chiffre. L'index de la séquence commencera à 1 à chaque fois que le file de traitement est démarrée, et est incrémenté de 1 pour chaque image traitée.\n\nSi vous voulez enregistrer l'image de sortie là où se trouve l'originale, écrivez:\n%p1/%f\n\nSi vous voulez enregistrer l'image de sortie dans un dossier nommé "convertis" situé dans le dossier de l'originale, écrivez:\n%p1/convertis/%f\n\nSi vous voulez enregistrer l'image de sortie dans un dossier nommé "/home/tom/photos/convertis/2010-10-31", écrivez:\n%p2/convertis/%d1/%f +PREFERENCES_OUTDIRTEMPLATEHINT;Vous pouvez utiliser les paramètres de chaîne formatées suivants:\n%f, %d1, %d2, ..., %p1, %p2, ..., %r, %s1, %s2, ...\n\nCes chaînes de formattage se réfèrent aux différentes parties du chemin de la photo, certains de ses attributs ou un numéro de séquence arbitraire dans le traitement par lot.\n\nPar exemple, si la photo en cours de traitement a le chemin suivant:\n/home/tom/photos/2010-10-31/dsc0042.nef\nla signification des chaînes de formattage est:\n%d4 = home\n%d3 = tom\n%d2 = photos\n%d1 = 2010-10-31\n%f = dsc0042\n%p1 = /home/tom/photos/2010-10-31/\n%p2 = /home/tom/photos/\n%p3 = /home/tom/\n%p4 = /home/\n\n%r sera remplacé par le rang de la photo. Si la photo n'a pas de rang, %r sera remplacé par '0'. Si la photo est dans la corbeille de RawTherapee, %r sera remplacé par 'x'.\n\n%s1, %s2, etc. sera remplacé par un index de séquence constitué de 1 à 9 chiffres. L'index de la séquence commencera à 1 à chaque fois que le file de traitement est démarrée, et est incrémenté de 1 pour chaque image traitée.\n\nSi vous voulez enregistrer l'image de sortie là où se trouve l'originale, écrivez:\n%p1/%f\n\nSi vous voulez enregistrer l'image de sortie dans un dossier nommé "convertis" situé dans le dossier de l'originale, écrivez:\n%p1/convertis/%f\n\nSi vous voulez enregistrer l'image de sortie dans un dossier nommé "/home/tom/photos/convertis/2010-10-31", écrivez:\n%p2/convertis/%d1/%f PREFERENCES_OVERLAY_FILENAMES;Superposer les noms de fichier sur les vignettes dans le navigateur de fichier PREFERENCES_OVERLAY_FILENAMES_FILMSTRIP;Superposer les noms de fichier sur les vignettes dans le panneau d'édition PREFERENCES_OVERWRITEOUTPUTFILE;Écraser le fichier s'il existe déjà From 6512b9f5fff7aaed9ec7f4ad667309a5631f67f6 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 30 Nov 2017 23:15:20 +0100 Subject: [PATCH 28/47] updated RCD to the latest version (plus tweaks to avoid division by zero) --- rtengine/demosaic_algos.cc | 251 ++++++++++++++++++------------------- 1 file changed, 124 insertions(+), 127 deletions(-) diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index c73f29415..a21ff216d 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -3932,7 +3932,7 @@ void RawImageSource::cielab (const float (*rgb)[3], float* l, float* a, float *b * RATIO CORRECTED DEMOSAICING * Luis Sanz Rodriguez (luis.sanz.rodriguez(at)gmail(dot)com) * -* Release 2.2 @ 171117 +* Release 2.3 @ 171125 * * Original code from https://github.com/LuisSR/RCD-Demosaicing * Licensed under the GNU GPL version 3 @@ -3950,27 +3950,13 @@ void RawImageSource::rcd_demosaic() std::vector cfa(width * height); std::vector> rgb(width * height); - const float prescale = max(ref_pre_mul[0], ref_pre_mul[1], ref_pre_mul[2], ref_pre_mul[3]) / min(ref_pre_mul[0], ref_pre_mul[1], ref_pre_mul[2], ref_pre_mul[3]); - - auto clip = - [=](float v) -> float - { - v /= 65535.f; - float f = (1.f - LIM01(v * 0.25f)) * prescale; - if (f > 1e-4f) { - return LIM01(v * f) / f; - } else { - return LIM01(v); - } - }; - #ifdef _OPENMP #pragma omp parallel for #endif for (int row = 0; row < height; row++) { for (int col = 0, indx = row * width + col; col < width; col++, indx++) { int c = FC(row, col); - cfa[indx] = rgb[indx][c] = clip(rawData[row][col]); + cfa[indx] = rgb[indx][c] = LIM01(rawData[row][col] / 65535.f); } } @@ -3997,7 +3983,7 @@ void RawImageSource::rcd_demosaic() //float V_Stat, H_Stat, P_Stat, Q_Stat; float VH_Central_Value, VH_Neighbour_Value, PQ_Central_Value, PQ_Neighbour_Value; */ - float ( *VH_Dir ), ( *VH_Disc ), ( *PQ_Dir ), ( *PQ_Disc ); + float ( *VH_Dir ), ( *PQ_Dir ); //Low pass filter float ( *lpf ); @@ -4008,31 +3994,18 @@ void RawImageSource::rcd_demosaic() */ VH_Dir = ( float ( * ) ) calloc( width * height, sizeof *VH_Dir ); //merror ( VH_Dir, "rcd_demosaicing_171117()" ); - PQ_Dir = ( float ( * ) ) calloc( width * height, sizeof *PQ_Dir ); //merror ( PQ_Dir, "rcd_demosaicing_171117()" ); #ifdef _OPENMP #pragma omp parallel for #endif for (int row = 4; row < height - 4; row++ ) { for (int col = 4, indx = row * width + col; col < width - 4; col++, indx++ ) { - //Calculate h/v local discrimination - float V_Stat = epssq + (- 18.0f * cfa[indx] * cfa[indx - w1] - 18.0f * cfa[indx] * cfa[indx + w1] - 36.0f * cfa[indx] * cfa[indx - w2] - 36.0f * cfa[indx] * cfa[indx + w2] + 18.0f * cfa[indx] * cfa[indx - w3] + 18.0f * cfa[indx] * cfa[indx + w3] - 2.0f * cfa[indx] * cfa[indx - w4] - 2.0f * cfa[indx] * cfa[indx + w4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1] * cfa[indx + w1] - 12.0f * cfa[indx - w1] * cfa[indx - w2] + 24.0f * cfa[indx - w1] * cfa[indx + w2] - 38.0f * cfa[indx - w1] * cfa[indx - w3] + 16.0f * cfa[indx - w1] * cfa[indx + w3] + 12.0f * cfa[indx - w1] * cfa[indx - w4] - 6.0f * cfa[indx - w1] * cfa[indx + w4] + 46.0f * cfa[indx - w1] * cfa[indx - w1] + 24.0f * cfa[indx + w1] * cfa[indx - w2] - 12.0f * cfa[indx + w1] * cfa[indx + w2] + 16.0f * cfa[indx + w1] * cfa[indx - w3] - 38.0f * cfa[indx + w1] * cfa[indx + w3] - 6.0f * cfa[indx + w1] * cfa[indx - w4] + 12.0f * cfa[indx + w1] * cfa[indx + w4] + 46.0f * cfa[indx + w1] * cfa[indx + w1] + 14.0f * cfa[indx - w2] * cfa[indx + w2] - 12.0f * cfa[indx - w2] * cfa[indx + w3] - 2.0f * cfa[indx - w2] * cfa[indx - w4] + 2.0f * cfa[indx - w2] * cfa[indx + w4] + 11.0f * cfa[indx - w2] * cfa[indx - w2] - 12.0f * cfa[indx + w2] * cfa[indx - w3] + 2.0f * cfa[indx + w2] * cfa[indx - w4] - 2.0f * cfa[indx + w2] * cfa[indx + w4] + 11.0f * cfa[indx + w2] * cfa[indx + w2] + 2.0f * cfa[indx - w3] * cfa[indx + w3] - 6.0f * cfa[indx - w3] * cfa[indx - w4] + 10.0f * cfa[indx - w3] * cfa[indx - w3] - 6.0f * cfa[indx + w3] * cfa[indx + w4] + 10.0f * cfa[indx + w3] * cfa[indx + w3] + 1.0f * cfa[indx - w4] * cfa[indx - w4] + 1.0f * cfa[indx + w4] * cfa[indx + w4]); + float V_Stat = max(epssq, - 18.0f * cfa[indx] * cfa[indx - w1] - 18.0f * cfa[indx] * cfa[indx + w1] - 36.0f * cfa[indx] * cfa[indx - w2] - 36.0f * cfa[indx] * cfa[indx + w2] + 18.0f * cfa[indx] * cfa[indx - w3] + 18.0f * cfa[indx] * cfa[indx + w3] - 2.0f * cfa[indx] * cfa[indx - w4] - 2.0f * cfa[indx] * cfa[indx + w4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1] * cfa[indx + w1] - 12.0f * cfa[indx - w1] * cfa[indx - w2] + 24.0f * cfa[indx - w1] * cfa[indx + w2] - 38.0f * cfa[indx - w1] * cfa[indx - w3] + 16.0f * cfa[indx - w1] * cfa[indx + w3] + 12.0f * cfa[indx - w1] * cfa[indx - w4] - 6.0f * cfa[indx - w1] * cfa[indx + w4] + 46.0f * cfa[indx - w1] * cfa[indx - w1] + 24.0f * cfa[indx + w1] * cfa[indx - w2] - 12.0f * cfa[indx + w1] * cfa[indx + w2] + 16.0f * cfa[indx + w1] * cfa[indx - w3] - 38.0f * cfa[indx + w1] * cfa[indx + w3] - 6.0f * cfa[indx + w1] * cfa[indx - w4] + 12.0f * cfa[indx + w1] * cfa[indx + w4] + 46.0f * cfa[indx + w1] * cfa[indx + w1] + 14.0f * cfa[indx - w2] * cfa[indx + w2] - 12.0f * cfa[indx - w2] * cfa[indx + w3] - 2.0f * cfa[indx - w2] * cfa[indx - w4] + 2.0f * cfa[indx - w2] * cfa[indx + w4] + 11.0f * cfa[indx - w2] * cfa[indx - w2] - 12.0f * cfa[indx + w2] * cfa[indx - w3] + 2.0f * cfa[indx + w2] * cfa[indx - w4] - 2.0f * cfa[indx + w2] * cfa[indx + w4] + 11.0f * cfa[indx + w2] * cfa[indx + w2] + 2.0f * cfa[indx - w3] * cfa[indx + w3] - 6.0f * cfa[indx - w3] * cfa[indx - w4] + 10.0f * cfa[indx - w3] * cfa[indx - w3] - 6.0f * cfa[indx + w3] * cfa[indx + w4] + 10.0f * cfa[indx + w3] * cfa[indx + w3] + 1.0f * cfa[indx - w4] * cfa[indx - w4] + 1.0f * cfa[indx + w4] * cfa[indx + w4]); - float H_Stat = epssq + (- 18.0f * cfa[indx] * cfa[indx - 1] - 18.0f * cfa[indx] * cfa[indx + 1] - 36.0f * cfa[indx] * cfa[indx - 2] - 36.0f * cfa[indx] * cfa[indx + 2] + 18.0f * cfa[indx] * cfa[indx - 3] + 18.0f * cfa[indx] * cfa[indx + 3] - 2.0f * cfa[indx] * cfa[indx - 4] - 2.0f * cfa[indx] * cfa[indx + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - 1] * cfa[indx + 1] - 12.0f * cfa[indx - 1] * cfa[indx - 2] + 24.0f * cfa[indx - 1] * cfa[indx + 2] - 38.0f * cfa[indx - 1] * cfa[indx - 3] + 16.0f * cfa[indx - 1] * cfa[indx + 3] + 12.0f * cfa[indx - 1] * cfa[indx - 4] - 6.0f * cfa[indx - 1] * cfa[indx + 4] + 46.0f * cfa[indx - 1] * cfa[indx - 1] + 24.0f * cfa[indx + 1] * cfa[indx - 2] - 12.0f * cfa[indx + 1] * cfa[indx + 2] + 16.0f * cfa[indx + 1] * cfa[indx - 3] - 38.0f * cfa[indx + 1] * cfa[indx + 3] - 6.0f * cfa[indx + 1] * cfa[indx - 4] + 12.0f * cfa[indx + 1] * cfa[indx + 4] + 46.0f * cfa[indx + 1] * cfa[indx + 1] + 14.0f * cfa[indx - 2] * cfa[indx + 2] - 12.0f * cfa[indx - 2] * cfa[indx + 3] - 2.0f * cfa[indx - 2] * cfa[indx - 4] + 2.0f * cfa[indx - 2] * cfa[indx + 4] + 11.0f * cfa[indx - 2] * cfa[indx - 2] - 12.0f * cfa[indx + 2] * cfa[indx - 3] + 2.0f * cfa[indx + 2] * cfa[indx - 4] - 2.0f * cfa[indx + 2] * cfa[indx + 4] + 11.0f * cfa[indx + 2] * cfa[indx + 2] + 2.0f * cfa[indx - 3] * cfa[indx + 3] - 6.0f * cfa[indx - 3] * cfa[indx - 4] + 10.0f * cfa[indx - 3] * cfa[indx - 3] - 6.0f * cfa[indx + 3] * cfa[indx + 4] + 10.0f * cfa[indx + 3] * cfa[indx + 3] + 1.0f * cfa[indx - 4] * cfa[indx - 4] + 1.0f * cfa[indx + 4] * cfa[indx + 4]); + float H_Stat = max(epssq, - 18.0f * cfa[indx] * cfa[indx - 1] - 18.0f * cfa[indx] * cfa[indx + 1] - 36.0f * cfa[indx] * cfa[indx - 2] - 36.0f * cfa[indx] * cfa[indx + 2] + 18.0f * cfa[indx] * cfa[indx - 3] + 18.0f * cfa[indx] * cfa[indx + 3] - 2.0f * cfa[indx] * cfa[indx - 4] - 2.0f * cfa[indx] * cfa[indx + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - 1] * cfa[indx + 1] - 12.0f * cfa[indx - 1] * cfa[indx - 2] + 24.0f * cfa[indx - 1] * cfa[indx + 2] - 38.0f * cfa[indx - 1] * cfa[indx - 3] + 16.0f * cfa[indx - 1] * cfa[indx + 3] + 12.0f * cfa[indx - 1] * cfa[indx - 4] - 6.0f * cfa[indx - 1] * cfa[indx + 4] + 46.0f * cfa[indx - 1] * cfa[indx - 1] + 24.0f * cfa[indx + 1] * cfa[indx - 2] - 12.0f * cfa[indx + 1] * cfa[indx + 2] + 16.0f * cfa[indx + 1] * cfa[indx - 3] - 38.0f * cfa[indx + 1] * cfa[indx + 3] - 6.0f * cfa[indx + 1] * cfa[indx - 4] + 12.0f * cfa[indx + 1] * cfa[indx + 4] + 46.0f * cfa[indx + 1] * cfa[indx + 1] + 14.0f * cfa[indx - 2] * cfa[indx + 2] - 12.0f * cfa[indx - 2] * cfa[indx + 3] - 2.0f * cfa[indx - 2] * cfa[indx - 4] + 2.0f * cfa[indx - 2] * cfa[indx + 4] + 11.0f * cfa[indx - 2] * cfa[indx - 2] - 12.0f * cfa[indx + 2] * cfa[indx - 3] + 2.0f * cfa[indx + 2] * cfa[indx - 4] - 2.0f * cfa[indx + 2] * cfa[indx + 4] + 11.0f * cfa[indx + 2] * cfa[indx + 2] + 2.0f * cfa[indx - 3] * cfa[indx + 3] - 6.0f * cfa[indx - 3] * cfa[indx - 4] + 10.0f * cfa[indx - 3] * cfa[indx - 3] - 6.0f * cfa[indx + 3] * cfa[indx + 4] + 10.0f * cfa[indx + 3] * cfa[indx + 3] + 1.0f * cfa[indx - 4] * cfa[indx - 4] + 1.0f * cfa[indx + 4] * cfa[indx + 4]); VH_Dir[indx] = V_Stat / (V_Stat + H_Stat); - - //Calculate m/p local discrimination - float P_Stat = epssq + (- 18.0f * cfa[indx] * cfa[indx - w1 - 1] - 18.0f * cfa[indx] * cfa[indx + w1 + 1] - 36.0f * cfa[indx] * cfa[indx - w2 - 2] - 36.0f * cfa[indx] * cfa[indx + w2 + 2] + 18.0f * cfa[indx] * cfa[indx - w3 - 3] + 18.0f * cfa[indx] * cfa[indx + w3 + 3] - 2.0f * cfa[indx] * cfa[indx - w4 - 4] - 2.0f * cfa[indx] * cfa[indx + w4 + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1 - 1] * cfa[indx + w1 + 1] - 12.0f * cfa[indx - w1 - 1] * cfa[indx - w2 - 2] + 24.0f * cfa[indx - w1 - 1] * cfa[indx + w2 + 2] - 38.0f * cfa[indx - w1 - 1] * cfa[indx - w3 - 3] + 16.0f * cfa[indx - w1 - 1] * cfa[indx + w3 + 3] + 12.0f * cfa[indx - w1 - 1] * cfa[indx - w4 - 4] - 6.0f * cfa[indx - w1 - 1] * cfa[indx + w4 + 4] + 46.0f * cfa[indx - w1 - 1] * cfa[indx - w1 - 1] + 24.0f * cfa[indx + w1 + 1] * cfa[indx - w2 - 2] - 12.0f * cfa[indx + w1 + 1] * cfa[indx + w2 + 2] + 16.0f * cfa[indx + w1 + 1] * cfa[indx - w3 - 3] - 38.0f * cfa[indx + w1 + 1] * cfa[indx + w3 + 3] - 6.0f * cfa[indx + w1 + 1] * cfa[indx - w4 - 4] + 12.0f * cfa[indx + w1 + 1] * cfa[indx + w4 + 4] + 46.0f * cfa[indx + w1 + 1] * cfa[indx + w1 + 1] + 14.0f * cfa[indx - w2 - 2] * cfa[indx + w2 + 2] - 12.0f * cfa[indx - w2 - 2] * cfa[indx + w3 + 3] - 2.0f * cfa[indx - w2 - 2] * cfa[indx - w4 - 4] + 2.0f * cfa[indx - w2 - 2] * cfa[indx + w4 + 4] + 11.0f * cfa[indx - w2 - 2] * cfa[indx - w2 - 2] - 12.0f * cfa[indx + w2 + 2] * cfa[indx - w3 - 3] + 2 * cfa[indx + w2 + 2] * cfa[indx - w4 - 4] - 2.0f * cfa[indx + w2 + 2] * cfa[indx + w4 + 4] + 11.0f * cfa[indx + w2 + 2] * cfa[indx + w2 + 2] + 2.0f * cfa[indx - w3 - 3] * cfa[indx + w3 + 3] - 6.0f * cfa[indx - w3 - 3] * cfa[indx - w4 - 4] + 10.0f * cfa[indx - w3 - 3] * cfa[indx - w3 - 3] - 6.0f * cfa[indx + w3 + 3] * cfa[indx + w4 + 4] + 10.0f * cfa[indx + w3 + 3] * cfa[indx + w3 + 3] + 1.0f * cfa[indx - w4 - 4] * cfa[indx - w4 - 4] + 1.0f * cfa[indx + w4 + 4] * cfa[indx + w4 + 4]); - - float Q_Stat = epssq + (- 18.0f * cfa[indx] * cfa[indx + w1 - 1] - 18.0f * cfa[indx] * cfa[indx - w1 + 1] - 36.0f * cfa[indx] * cfa[indx + w2 - 2] - 36.0f * cfa[indx] * cfa[indx - w2 + 2] + 18.0f * cfa[indx] * cfa[indx + w3 - 3] + 18.0f * cfa[indx] * cfa[indx - w3 + 3] - 2.0f * cfa[indx] * cfa[indx + w4 - 4] - 2.0f * cfa[indx] * cfa[indx - w4 + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx + w1 - 1] * cfa[indx - w1 + 1] - 12.0f * cfa[indx + w1 - 1] * cfa[indx + w2 - 2] + 24.0f * cfa[indx + w1 - 1] * cfa[indx - w2 + 2] - 38.0f * cfa[indx + w1 - 1] * cfa[indx + w3 - 3] + 16.0f * cfa[indx + w1 - 1] * cfa[indx - w3 + 3] + 12.0f * cfa[indx + w1 - 1] * cfa[indx + w4 - 4] - 6.0f * cfa[indx + w1 - 1] * cfa[indx - w4 + 4] + 46.0f * cfa[indx + w1 - 1] * cfa[indx + w1 - 1] + 24.0f * cfa[indx - w1 + 1] * cfa[indx + w2 - 2] - 12.0f * cfa[indx - w1 + 1] * cfa[indx - w2 + 2] + 16.0f * cfa[indx - w1 + 1] * cfa[indx + w3 - 3] - 38.0f * cfa[indx - w1 + 1] * cfa[indx - w3 + 3] - 6.0f * cfa[indx - w1 + 1] * cfa[indx + w4 - 4] + 12.0f * cfa[indx - w1 + 1] * cfa[indx - w4 + 4] + 46.0f * cfa[indx - w1 + 1] * cfa[indx - w1 + 1] + 14.0f * cfa[indx + w2 - 2] * cfa[indx - w2 + 2] - 12.0f * cfa[indx + w2 - 2] * cfa[indx - w3 + 3] - 2.0f * cfa[indx + w2 - 2] * cfa[indx + w4 - 4] + 2.0f * cfa[indx + w2 - 2] * cfa[indx - w4 + 4] + 11.0f * cfa[indx + w2 - 2] * cfa[indx + w2 - 2] - 12.0f * cfa[indx - w2 + 2] * cfa[indx + w3 - 3] + 2 * cfa[indx - w2 + 2] * cfa[indx + w4 - 4] - 2.0f * cfa[indx - w2 + 2] * cfa[indx - w4 + 4] + 11.0f * cfa[indx - w2 + 2] * cfa[indx - w2 + 2] + 2.0f * cfa[indx + w3 - 3] * cfa[indx - w3 + 3] - 6.0f * cfa[indx + w3 - 3] * cfa[indx + w4 - 4] + 10.0f * cfa[indx + w3 - 3] * cfa[indx + w3 - 3] - 6.0f * cfa[indx - w3 + 3] * cfa[indx - w4 + 4] + 10.0f * cfa[indx - w3 + 3] * cfa[indx - w3 + 3] + 1.0f * cfa[indx + w4 - 4] * cfa[indx + w4 - 4] + 1.0f * cfa[indx - w4 + 4] * cfa[indx - w4 + 4]); - - PQ_Dir[indx] = P_Stat / ( P_Stat + Q_Stat ); - - assert(isfinite(VH_Dir[indx])); - assert(isfinite(PQ_Dir[indx])); - } } @@ -4041,91 +4014,66 @@ void RawImageSource::rcd_demosaic() plistener->setProgress(0.2); } // ------------------------------------------------------------------------- - - VH_Disc = ( float ( * ) ) calloc( width * height, sizeof *VH_Disc ); //merror ( VH_Disc, "rcd_demosaicing_171117()" ); - PQ_Disc = ( float ( * ) ) calloc( width * height, sizeof *PQ_Disc ); //merror ( PQ_Disc, "rcd_demosaicing_171117()" ); + /** + * STEP 2: Calculate the low pass filter + */ + + // Step 2.1: Low pass filter incorporating green, red and blue local samples from the raw data + lpf = ( float ( * ) ) calloc( width * height, sizeof *lpf ); //merror ( lpf, "rcd_demosaicing_171125()" ); #ifdef _OPENMP #pragma omp parallel for -#endif - for ( int row = 4; row < height - 4; row++ ) { - for ( int col = 4, indx = row * width + col; col < width - 4; col++, indx++ ) { +#endif + for ( int row = 2; row < height - 2; row++ ) { + for ( int col = 2 + (FC( row, 0 ) & 1), indx = row * width + col; col < width - 2; col += 2, indx += 2 ) { - //Refined h/v local discrimination - float VH_Central_Value = VH_Dir[indx]; - float VH_Neighbour_Value = 0.25f * (VH_Dir[indx - w1 - 1] + VH_Dir[indx - w1 + 1] + VH_Dir[indx + w1 - 1] + VH_Dir[indx + w1 + 1]); - - VH_Disc[indx] = ( fabs( 0.5f - VH_Central_Value ) < fabs( 0.5f - VH_Neighbour_Value ) ) ? VH_Neighbour_Value : VH_Central_Value; - - //Refined m/p local discrimination - float PQ_Central_Value = PQ_Dir[indx]; - float PQ_Neighbour_Value = 0.25f * (PQ_Dir[indx - w1 - 1] + PQ_Dir[indx - w1 + 1] + PQ_Dir[indx + w1 - 1] + PQ_Dir[indx + w1 + 1]); - - PQ_Disc[indx] = ( fabs( 0.5f - PQ_Central_Value ) < fabs( 0.5f - PQ_Neighbour_Value ) ) ? PQ_Neighbour_Value : PQ_Central_Value; + lpf[indx] = 0.25f * cfa[indx] + 0.125f * ( cfa[indx - w1] + cfa[indx + w1] + cfa[indx - 1] + cfa[indx + 1] ) + 0.0625f * ( cfa[indx - w1 - 1] + cfa[indx - w1 + 1] + cfa[indx + w1 - 1] + cfa[indx + w1 + 1] ); } } - free( VH_Dir ); - free( PQ_Dir ); - // RT --------------------------------------------------------------------- if (plistener) { plistener->setProgress(0.4); } // ------------------------------------------------------------------------ - /** - * STEP 2: Calculate the low pass filter - */ - - lpf = ( float ( * ) ) calloc( width * height, sizeof *lpf ); //merror ( lpf, "rcd_demosaicing_171117()" ); - -#ifdef _OPENMP - #pragma omp parallel for -#endif - for ( int row = 1; row < height - 1; row++ ) { - for ( int col = 1, indx = row * width + col; col < width - 1; col++, indx++ ) { - - //Low pass filter incorporating red and blue local samples - lpf[indx] = 0.25f * cfa[indx] + 0.125f * ( cfa[indx - w1] + cfa[indx + w1] + cfa[indx - 1] + cfa[indx + 1] ) + 0.0625f * ( cfa[indx - w1 - 1] + cfa[indx - w1 + 1] + cfa[indx + w1 - 1] + cfa[indx + w1 + 1] ); - - } - } - - // RT --------------------------------------------------------------------- - if (plistener) { - plistener->setProgress(0.5); - } - // ------------------------------------------------------------------------ - /** * STEP 3: Populate the green channel */ + + // Step 3.1: Populate the green channel at blue and red CFA positions #ifdef _OPENMP #pragma omp parallel for #endif - for ( int row = 4; row < height - 4; row++ ) { - for ( int col = 4 + ( FC( row, 0 )&1 ), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { + for ( int row = 4; row < height - 4; row++ ) { + for ( int col = 4 + (FC( row, 0 ) & 1), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { - //Cardinal gradients - float N_Grad = eps + (fabs( cfa[indx - w1] - cfa[indx + w1] ) + fabs( cfa[indx] - cfa[indx - w2] ) + fabs( cfa[indx - w1] - cfa[indx - w3] ) + fabs( cfa[indx - w2] - cfa[indx - w4] )); - float S_Grad = eps + (fabs( cfa[indx + w1] - cfa[indx - w1] ) + fabs( cfa[indx] - cfa[indx + w2] ) + fabs( cfa[indx + w1] - cfa[indx + w3] ) + fabs( cfa[indx + w2] - cfa[indx + w4] )); - float W_Grad = eps + (fabs( cfa[indx - 1] - cfa[indx + 1] ) + fabs( cfa[indx] - cfa[indx - 2] ) + fabs( cfa[indx - 1] - cfa[indx - 3] ) + fabs( cfa[indx - 2] - cfa[indx - 4] )); - float E_Grad = eps + (fabs( cfa[indx + 1] - cfa[indx - 1] ) + fabs( cfa[indx] - cfa[indx + 2] ) + fabs( cfa[indx + 1] - cfa[indx + 3] ) + fabs( cfa[indx + 2] - cfa[indx + 4] )); + // Refined vertical and horizontal local discrimination + float VH_Central_Value = VH_Dir[indx]; + float VH_Neighbourhood_Value = 0.25f * ( VH_Dir[indx - w1 - 1] + VH_Dir[indx - w1 + 1] + VH_Dir[indx + w1 - 1] + VH_Dir[indx + w1 + 1] ); - //Cardinal pixel estimations - float N_Est = cfa[indx - w1] * ( 1.f + ( lpf[indx] - lpf[indx - w2] ) / ( eps + (lpf[indx] + lpf[indx - w2])) ); - float S_Est = cfa[indx + w1] * ( 1.f + ( lpf[indx] - lpf[indx + w2] ) / ( eps + (lpf[indx] + lpf[indx + w2])) ); - float W_Est = cfa[indx - 1] * ( 1.f + ( lpf[indx] - lpf[indx - 2] ) / ( eps + (lpf[indx] + lpf[indx - 2])) ); - float E_Est = cfa[indx + 1] * ( 1.f + ( lpf[indx] - lpf[indx + 2] ) / ( eps + (lpf[indx] + lpf[indx + 2])) ); + float VH_Disc = ( fabs( 0.5f - VH_Central_Value ) < fabs( 0.5f - VH_Neighbourhood_Value ) ) ? VH_Neighbourhood_Value : VH_Central_Value; - //Interpolate G@R & G@B - float V_Est = ( S_Grad * N_Est + N_Grad * S_Est ) / ( N_Grad + S_Grad ); - float H_Est = ( W_Grad * E_Est + E_Grad * W_Est ) / ( E_Grad + W_Grad ); + // Cardinal gradients + float N_Grad = eps + fabs( cfa[indx - w1] - cfa[indx + w1] ) + fabs( cfa[indx] - cfa[indx - w2] ) + fabs( cfa[indx - w1] - cfa[indx - w3] ) + fabs( cfa[indx - w2] - cfa[indx - w4] ); + float S_Grad = eps + fabs( cfa[indx + w1] - cfa[indx - w1] ) + fabs( cfa[indx] - cfa[indx + w2] ) + fabs( cfa[indx + w1] - cfa[indx + w3] ) + fabs( cfa[indx + w2] - cfa[indx + w4] ); + float W_Grad = eps + fabs( cfa[indx - 1] - cfa[indx + 1] ) + fabs( cfa[indx] - cfa[indx - 2] ) + fabs( cfa[indx - 1] - cfa[indx - 3] ) + fabs( cfa[indx - 2] - cfa[indx - 4] ); + float E_Grad = eps + fabs( cfa[indx + 1] - cfa[indx - 1] ) + fabs( cfa[indx] - cfa[indx + 2] ) + fabs( cfa[indx + 1] - cfa[indx + 3] ) + fabs( cfa[indx + 2] - cfa[indx + 4] ); - rgb[indx][1] = LIM( VH_Disc[indx] * H_Est + ( 1.0f - VH_Disc[indx] ) * V_Est, 0.f, 1.f ); + // Cardinal pixel estimations + float N_Est = cfa[indx - w1] * ( 1.f + ( lpf[indx] - lpf[indx - w2] ) / ( eps + lpf[indx] + lpf[indx - w2] ) ); + float S_Est = cfa[indx + w1] * ( 1.f + ( lpf[indx] - lpf[indx + w2] ) / ( eps + lpf[indx] + lpf[indx + w2] ) ); + float W_Est = cfa[indx - 1] * ( 1.f + ( lpf[indx] - lpf[indx - 2] ) / ( eps + lpf[indx] + lpf[indx - 2] ) ); + float E_Est = cfa[indx + 1] * ( 1.f + ( lpf[indx] - lpf[indx + 2] ) / ( eps + lpf[indx] + lpf[indx + 2] ) ); + + // Vertical and horizontal estimations + float V_Est = ( S_Grad * N_Est + N_Grad * S_Est ) / max(eps, N_Grad + S_Grad ); + float H_Est = ( W_Grad * E_Est + E_Grad * W_Est ) / max(eps, E_Grad + W_Grad ); + + // G@B and G@R interpolation + rgb[indx][1] = LIM( VH_Disc * H_Est + ( 1.f - VH_Disc ) * V_Est, 0.f, 1.f ); } } @@ -4134,72 +4082,119 @@ void RawImageSource::rcd_demosaic() // RT --------------------------------------------------------------------- if (plistener) { - plistener->setProgress(0.7); + plistener->setProgress(0.5); } - // ------------------------------------------------------------------------- - + // ------------------------------------------------------------------------ + /** - * STEP 4: Populate the red and blue channel + * STEP 4: Populate the red and blue channels */ + + // Step 4.1: Calculate P/Q diagonal local discrimination + PQ_Dir = ( float ( * ) ) calloc( width * height, sizeof *PQ_Dir ); //merror ( PQ_Dir, "rcd_demosaicing_171125()" ); + +#ifdef _OPENMP + #pragma omp parallel for +#endif for ( int row = 4; row < height - 4; row++ ) { - for ( int col = 4 + ( FC( row, 0 )&1 ), indx = row * width + col, c = 2 - FC( row, col ); col < width - 4; col += 2, indx += 2 ) { + for ( int col = 4 + (FC( row, 0 ) & 1), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { - //Diagonal gradients - float NW_Grad = eps + (fabs( rgb[indx - w1 - 1][c] - rgb[indx + w1 + 1][c] ) + fabs( rgb[indx - w1 - 1][c] - rgb[indx - w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 - 2][1] )); - float NE_Grad = eps + (fabs( rgb[indx - w1 + 1][c] - rgb[indx + w1 - 1][c] ) + fabs( rgb[indx - w1 + 1][c] - rgb[indx - w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 + 2][1] )); - float SW_Grad = eps + (fabs( rgb[indx + w1 - 1][c] - rgb[indx - w1 + 1][c] ) + fabs( rgb[indx + w1 - 1][c] - rgb[indx + w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 - 2][1] )); - float SE_Grad = eps + (fabs( rgb[indx + w1 + 1][c] - rgb[indx - w1 - 1][c] ) + fabs( rgb[indx + w1 + 1][c] - rgb[indx + w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 + 2][1] )); + float P_Stat = max( - 18.f * cfa[indx] * cfa[indx - w1 - 1] - 18.f * cfa[indx] * cfa[indx + w1 + 1] - 36.f * cfa[indx] * cfa[indx - w2 - 2] - 36.f * cfa[indx] * cfa[indx + w2 + 2] + 18.f * cfa[indx] * cfa[indx - w3 - 3] + 18.f * cfa[indx] * cfa[indx + w3 + 3] - 2.f * cfa[indx] * cfa[indx - w4 - 4] - 2.f * cfa[indx] * cfa[indx + w4 + 4] + 38.f * cfa[indx] * cfa[indx] - 70.f * cfa[indx - w1 - 1] * cfa[indx + w1 + 1] - 12.f * cfa[indx - w1 - 1] * cfa[indx - w2 - 2] + 24.f * cfa[indx - w1 - 1] * cfa[indx + w2 + 2] - 38.f * cfa[indx - w1 - 1] * cfa[indx - w3 - 3] + 16.f * cfa[indx - w1 - 1] * cfa[indx + w3 + 3] + 12.f * cfa[indx - w1 - 1] * cfa[indx - w4 - 4] - 6.f * cfa[indx - w1 - 1] * cfa[indx + w4 + 4] + 46.f * cfa[indx - w1 - 1] * cfa[indx - w1 - 1] + 24.f * cfa[indx + w1 + 1] * cfa[indx - w2 - 2] - 12.f * cfa[indx + w1 + 1] * cfa[indx + w2 + 2] + 16.f * cfa[indx + w1 + 1] * cfa[indx - w3 - 3] - 38.f * cfa[indx + w1 + 1] * cfa[indx + w3 + 3] - 6.f * cfa[indx + w1 + 1] * cfa[indx - w4 - 4] + 12.f * cfa[indx + w1 + 1] * cfa[indx + w4 + 4] + 46.f * cfa[indx + w1 + 1] * cfa[indx + w1 + 1] + 14.f * cfa[indx - w2 - 2] * cfa[indx + w2 + 2] - 12.f * cfa[indx - w2 - 2] * cfa[indx + w3 + 3] - 2.f * cfa[indx - w2 - 2] * cfa[indx - w4 - 4] + 2.f * cfa[indx - w2 - 2] * cfa[indx + w4 + 4] + 11.f * cfa[indx - w2 - 2] * cfa[indx - w2 - 2] - 12.f * cfa[indx + w2 + 2] * cfa[indx - w3 - 3] + 2 * cfa[indx + w2 + 2] * cfa[indx - w4 - 4] - 2.f * cfa[indx + w2 + 2] * cfa[indx + w4 + 4] + 11.f * cfa[indx + w2 + 2] * cfa[indx + w2 + 2] + 2.f * cfa[indx - w3 - 3] * cfa[indx + w3 + 3] - 6.f * cfa[indx - w3 - 3] * cfa[indx - w4 - 4] + 10.f * cfa[indx - w3 - 3] * cfa[indx - w3 - 3] - 6.f * cfa[indx + w3 + 3] * cfa[indx + w4 + 4] + 10.f * cfa[indx + w3 + 3] * cfa[indx + w3 + 3] + 1.f * cfa[indx - w4 - 4] * cfa[indx - w4 - 4] + 1.f * cfa[indx + w4 + 4] * cfa[indx + w4 + 4], epssq ); + float Q_Stat = max( - 18.f * cfa[indx] * cfa[indx + w1 - 1] - 18.f * cfa[indx] * cfa[indx - w1 + 1] - 36.f * cfa[indx] * cfa[indx + w2 - 2] - 36.f * cfa[indx] * cfa[indx - w2 + 2] + 18.f * cfa[indx] * cfa[indx + w3 - 3] + 18.f * cfa[indx] * cfa[indx - w3 + 3] - 2.f * cfa[indx] * cfa[indx + w4 - 4] - 2.f * cfa[indx] * cfa[indx - w4 + 4] + 38.f * cfa[indx] * cfa[indx] - 70.f * cfa[indx + w1 - 1] * cfa[indx - w1 + 1] - 12.f * cfa[indx + w1 - 1] * cfa[indx + w2 - 2] + 24.f * cfa[indx + w1 - 1] * cfa[indx - w2 + 2] - 38.f * cfa[indx + w1 - 1] * cfa[indx + w3 - 3] + 16.f * cfa[indx + w1 - 1] * cfa[indx - w3 + 3] + 12.f * cfa[indx + w1 - 1] * cfa[indx + w4 - 4] - 6.f * cfa[indx + w1 - 1] * cfa[indx - w4 + 4] + 46.f * cfa[indx + w1 - 1] * cfa[indx + w1 - 1] + 24.f * cfa[indx - w1 + 1] * cfa[indx + w2 - 2] - 12.f * cfa[indx - w1 + 1] * cfa[indx - w2 + 2] + 16.f * cfa[indx - w1 + 1] * cfa[indx + w3 - 3] - 38.f * cfa[indx - w1 + 1] * cfa[indx - w3 + 3] - 6.f * cfa[indx - w1 + 1] * cfa[indx + w4 - 4] + 12.f * cfa[indx - w1 + 1] * cfa[indx - w4 + 4] + 46.f * cfa[indx - w1 + 1] * cfa[indx - w1 + 1] + 14.f * cfa[indx + w2 - 2] * cfa[indx - w2 + 2] - 12.f * cfa[indx + w2 - 2] * cfa[indx - w3 + 3] - 2.f * cfa[indx + w2 - 2] * cfa[indx + w4 - 4] + 2.f * cfa[indx + w2 - 2] * cfa[indx - w4 + 4] + 11.f * cfa[indx + w2 - 2] * cfa[indx + w2 - 2] - 12.f * cfa[indx - w2 + 2] * cfa[indx + w3 - 3] + 2 * cfa[indx - w2 + 2] * cfa[indx + w4 - 4] - 2.f * cfa[indx - w2 + 2] * cfa[indx - w4 + 4] + 11.f * cfa[indx - w2 + 2] * cfa[indx - w2 + 2] + 2.f * cfa[indx + w3 - 3] * cfa[indx - w3 + 3] - 6.f * cfa[indx + w3 - 3] * cfa[indx + w4 - 4] + 10.f * cfa[indx + w3 - 3] * cfa[indx + w3 - 3] - 6.f * cfa[indx - w3 + 3] * cfa[indx - w4 + 4] + 10.f * cfa[indx - w3 + 3] * cfa[indx - w3 + 3] + 1.f * cfa[indx + w4 - 4] * cfa[indx + w4 - 4] + 1.f * cfa[indx - w4 + 4] * cfa[indx - w4 + 4], epssq ); - //Diagonal colour differences - float NW_Est = rgb[indx - w1 - 1][c] - rgb[indx - w1 - 1][1]; - float NE_Est = rgb[indx - w1 + 1][c] - rgb[indx - w1 + 1][1]; - float SW_Est = rgb[indx + w1 - 1][c] - rgb[indx + w1 - 1][1]; - float SE_Est = rgb[indx + w1 + 1][c] - rgb[indx + w1 + 1][1]; - - //Interpolate R@B and B@R - float P_Est = ( NW_Grad * SE_Est + SE_Grad * NW_Est ) / ( NW_Grad + SE_Grad ); - float Q_Est = ( NE_Grad * SW_Est + SW_Grad * NE_Est ) / ( NE_Grad + SW_Grad ); - - rgb[indx][c] = LIM( rgb[indx][1] + ( 1.0f - PQ_Disc[indx] ) * P_Est + PQ_Disc[indx] * Q_Est, 0.f, 1.f ); + PQ_Dir[indx] = P_Stat / ( P_Stat + Q_Stat ); } } + // RT --------------------------------------------------------------------- + if (plistener) { + plistener->setProgress(0.7); + } + // ------------------------------------------------------------------------- + + // Step 4.2: Populate the red and blue channels at blue and red CFA positions +#ifdef _OPENMP + #pragma omp parallel for +#endif + for ( int row = 4; row < height - 4; row++ ) { + for ( int col = 4 + (FC( row, 0 ) & 1), indx = row * width + col, c = 2 - FC( row, col ); col < width - 4; col += 2, indx += 2 ) { + + // Refined P/Q diagonal local discrimination + float PQ_Central_Value = PQ_Dir[indx]; + float PQ_Neighbourhood_Value = 0.25f * ( PQ_Dir[indx - w1 - 1] + PQ_Dir[indx - w1 + 1] + PQ_Dir[indx + w1 - 1] + PQ_Dir[indx + w1 + 1] ); + + float PQ_Disc = ( fabs( 0.5f - PQ_Central_Value ) < fabs( 0.5f - PQ_Neighbourhood_Value ) ) ? PQ_Neighbourhood_Value : PQ_Central_Value; + + // Diagonal gradients + float NW_Grad = eps + fabs( rgb[indx - w1 - 1][c] - rgb[indx + w1 + 1][c] ) + fabs( rgb[indx - w1 - 1][c] - rgb[indx - w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 - 2][1] ); + float NE_Grad = eps + fabs( rgb[indx - w1 + 1][c] - rgb[indx + w1 - 1][c] ) + fabs( rgb[indx - w1 + 1][c] - rgb[indx - w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 + 2][1] ); + float SW_Grad = eps + fabs( rgb[indx + w1 - 1][c] - rgb[indx - w1 + 1][c] ) + fabs( rgb[indx + w1 - 1][c] - rgb[indx + w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 - 2][1] ); + float SE_Grad = eps + fabs( rgb[indx + w1 + 1][c] - rgb[indx - w1 - 1][c] ) + fabs( rgb[indx + w1 + 1][c] - rgb[indx + w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 + 2][1] ); + + // Diagonal colour differences + float NW_Est = rgb[indx - w1 - 1][c] - rgb[indx - w1 - 1][1]; + float NE_Est = rgb[indx - w1 + 1][c] - rgb[indx - w1 + 1][1]; + float SW_Est = rgb[indx + w1 - 1][c] - rgb[indx + w1 - 1][1]; + float SE_Est = rgb[indx + w1 + 1][c] - rgb[indx + w1 + 1][1]; + + // P/Q estimations + float P_Est = ( NW_Grad * SE_Est + SE_Grad * NW_Est ) / max(eps, NW_Grad + SE_Grad ); + float Q_Est = ( NE_Grad * SW_Est + SW_Grad * NE_Est ) / max(eps, NE_Grad + SW_Grad ); + + // R@B and B@R interpolation + rgb[indx][c] = LIM( rgb[indx][1] + ( 1.f - PQ_Disc ) * P_Est + PQ_Disc * Q_Est, 0.f, 1.f ); + + } + } + + free( PQ_Dir ); + // RT --------------------------------------------------------------------- if (plistener) { plistener->setProgress(0.825); } // ------------------------------------------------------------------------- - + + // Step 4.3: Populate the red and blue channels at green CFA positions +#ifdef _OPENMP + #pragma omp parallel for +#endif for ( int row = 4; row < height - 4; row++ ) { - for ( int col = 4 + ( FC( row, 1 )&1 ), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { + for ( int col = 4 + (FC( row, 1 ) & 1), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) { + + // Refined vertical and horizontal local discrimination + float VH_Central_Value = VH_Dir[indx]; + float VH_Neighbourhood_Value = 0.25f * ( VH_Dir[indx - w1 - 1] + VH_Dir[indx - w1 + 1] + VH_Dir[indx + w1 - 1] + VH_Dir[indx + w1 + 1] ); + + float VH_Disc = ( fabs( 0.5f - VH_Central_Value ) < fabs( 0.5f - VH_Neighbourhood_Value ) ) ? VH_Neighbourhood_Value : VH_Central_Value; for ( int c = 0; c <= 2; c += 2 ) { - //Cardinal gradients - float N_Grad = eps + (fabs( rgb[indx][1] - rgb[indx - w2][1] ) + fabs( rgb[indx - w1][c] - rgb[indx + w1][c] ) + fabs( rgb[indx - w1][c] - rgb[indx - w3][c] )); - float S_Grad = eps + (fabs( rgb[indx][1] - rgb[indx + w2][1] ) + fabs( rgb[indx + w1][c] - rgb[indx - w1][c] ) + fabs( rgb[indx + w1][c] - rgb[indx + w3][c] )); - float W_Grad = eps + (fabs( rgb[indx][1] - rgb[indx - 2][1] ) + fabs( rgb[indx - 1][c] - rgb[indx + 1][c] ) + fabs( rgb[indx - 1][c] - rgb[indx - 3][c] )); - float E_Grad = eps + (fabs( rgb[indx][1] - rgb[indx + 2][1] ) + fabs( rgb[indx + 1][c] - rgb[indx - 1][c] ) + fabs( rgb[indx + 1][c] - rgb[indx + 3][c] )); + // Cardinal gradients + float N_Grad = eps + fabs( rgb[indx][1] - rgb[indx - w2][1] ) + fabs( rgb[indx - w1][c] - rgb[indx + w1][c] ) + fabs( rgb[indx - w1][c] - rgb[indx - w3][c] ); + float S_Grad = eps + fabs( rgb[indx][1] - rgb[indx + w2][1] ) + fabs( rgb[indx + w1][c] - rgb[indx - w1][c] ) + fabs( rgb[indx + w1][c] - rgb[indx + w3][c] ); + float W_Grad = eps + fabs( rgb[indx][1] - rgb[indx - 2][1] ) + fabs( rgb[indx - 1][c] - rgb[indx + 1][c] ) + fabs( rgb[indx - 1][c] - rgb[indx - 3][c] ); + float E_Grad = eps + fabs( rgb[indx][1] - rgb[indx + 2][1] ) + fabs( rgb[indx + 1][c] - rgb[indx - 1][c] ) + fabs( rgb[indx + 1][c] - rgb[indx + 3][c] ); - //Cardinal colour differences + // Cardinal colour differences float N_Est = rgb[indx - w1][c] - rgb[indx - w1][1]; float S_Est = rgb[indx + w1][c] - rgb[indx + w1][1]; float W_Est = rgb[indx - 1][c] - rgb[indx - 1][1]; float E_Est = rgb[indx + 1][c] - rgb[indx + 1][1]; - //Interpolate R@G and B@G - float V_Est = ( N_Grad * S_Est + S_Grad * N_Est ) / ( N_Grad + S_Grad ); - float H_Est = ( E_Grad * W_Est + W_Grad * E_Est ) / ( E_Grad + W_Grad ); + // Vertical and horizontal estimations + float V_Est = ( N_Grad * S_Est + S_Grad * N_Est ) / max(eps, N_Grad + S_Grad ); + float H_Est = ( E_Grad * W_Est + W_Grad * E_Est ) / max(eps, E_Grad + W_Grad ); - rgb[indx][c] = LIM( rgb[indx][1] + ( 1.0f - VH_Disc[indx] ) * V_Est + VH_Disc[indx] * H_Est, 0.f, 1.f ); + // R@G and B@G interpolation + rgb[indx][c] = LIM( rgb[indx][1] + ( 1.f - VH_Disc ) * V_Est + VH_Disc * H_Est, 0.f, 1.f ); } } } - free( PQ_Disc ); - free( VH_Disc ); + free(VH_Dir); // RT --------------------------------------------------------------------- if (plistener) { @@ -4217,6 +4212,8 @@ void RawImageSource::rcd_demosaic() } } + border_interpolate2(width, height, 4); + if (plistener) { plistener->setProgress(1); } From d78848c61481f72a9f354c2c83a7c70cd5ed27f0 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Mon, 4 Dec 2017 22:44:25 +0100 Subject: [PATCH 29/47] Use Glib::KeyFile::load_from_file in ProcParams::load instead of reading into a temporary buffer Fixes #4205 --- rtengine/procparams.cc | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 0ada68a62..c50b7a2fe 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3743,29 +3743,10 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) pedited->set (false); } - FILE* f = g_fopen (fname.c_str (), "rt"); - - if (!f) { + if (!keyFile.load_from_file(fname)) { return 1; } - char* buffer = new char[1024]; - std::ostringstream ostr; - - while (fgets (buffer, 1024, f)) { - ostr << buffer << "\n"; - } - - delete [] buffer; - - if (!keyFile.load_from_data (ostr.str())) { - return 1; - } - - fclose (f); - - // load tonecurve: - ppVersion = PPVERSION; appVersion = APPVERSION; From 4d616e2782b3d80b1d18fbaae098594309b19bd7 Mon Sep 17 00:00:00 2001 From: Oleg Koncevoy Date: Tue, 5 Dec 2017 17:34:18 +0200 Subject: [PATCH 30/47] Added updateHistogram method to ColorManagementToolbar class. This method get's called on histogram profile icon toggle and updated histogram. modified: rtgui/editorpanel.cc --- rtgui/editorpanel.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 855458b93..d5cd42dcb 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -464,6 +464,13 @@ public: updateParameters (); } + void updateHistogram() + { + intentBox.setSelected(intentBox.getSelected()); + updateParameters(); + } + + void defaultMonitorProfileChanged (const Glib::ustring &profile_name, bool auto_monitor_profile) { ConnectionBlocker profileBlocker (profileConn); @@ -2031,6 +2038,7 @@ void EditorPanel::syncFileBrowser() // synchronize filebrowser with image in E void EditorPanel::histogramProfile_toggled() { options.rtSettings.HistogramWorking = toggleHistogramProfile->get_active(); + colorMgmtToolBar->updateHistogram(); } bool EditorPanel::idle_sendToGimp ( ProgressConnector *pc, Glib::ustring fname) From edc1175271e43d6aebca8ece3136f427e98d0d60 Mon Sep 17 00:00:00 2001 From: Oleg Koncevoy Date: Tue, 5 Dec 2017 19:04:34 +0200 Subject: [PATCH 31/47] Clean up for updateHistogram() method --- rtgui/editorpanel.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index d5cd42dcb..98854d67b 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -466,7 +466,6 @@ public: void updateHistogram() { - intentBox.setSelected(intentBox.getSelected()); updateParameters(); } From 2cd102cc615a69bfa3a39992a8801b4d49421aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Tue, 5 Dec 2017 18:51:52 +0100 Subject: [PATCH 32/47] Don't compare pointers but strings --- rtengine/procparams.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index e67fd93a5..4de4d455f 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -174,7 +174,7 @@ bool assignFromKeyfile( const Glib::ustring& group_name, const Glib::ustring& key, bool has_params_edited, - const std::map& mapping, + const std::map& mapping, T& value, bool& params_edited_value ) @@ -183,7 +183,7 @@ bool assignFromKeyfile( Glib::ustring v; getFromKeyfile(keyfile, group_name, key, v); - const typename std::map::const_iterator m = mapping.find(v.c_str()); + const typename std::map::const_iterator m = mapping.find(v); if (m != mapping.end()) { value = m->second; @@ -3425,7 +3425,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) toneCurve.shcompr = 100; // older pp3 files can have values above 100. } - const std::map tc_mapping = { + const std::map tc_mapping = { {"Standard", ToneCurveParams::TcMode::STD}, {"FilmLike", ToneCurveParams::TcMode::FILMLIKE}, {"SatAndValueBlending", ToneCurveParams::TcMode::SATANDVALBLENDING}, @@ -3757,7 +3757,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color appearance", "Datacie", pedited, colorappearance.datacie, pedited->colorappearance.datacie); assignFromKeyfile(keyFile, "Color appearance", "Tonecie", pedited, colorappearance.tonecie, pedited->colorappearance.tonecie); - const std::map tc_mapping = { + const std::map tc_mapping = { {"Lightness", ColorAppearanceParams::TcMode::LIGHT}, {"Brightness", ColorAppearanceParams::TcMode::BRIGHT} }; From 8bebb5c7209cff0b192b4a2a7106ec69fb00ca4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Tue, 5 Dec 2017 18:55:59 +0100 Subject: [PATCH 33/47] Remove unused `ColorManagementParamsEdited::gamfree` --- rtengine/procparams.cc | 2 +- rtgui/paramsedited.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 4de4d455f..8e25abe8a 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -4071,7 +4071,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) } assignFromKeyfile(keyFile, "Color Management", "OutputBPC", pedited, icm.outputBPC, pedited->icm.outputBPC); - assignFromKeyfile(keyFile, "Color Management", "Gammafree", pedited, icm.gamma, pedited->icm.gamfree); + assignFromKeyfile(keyFile, "Color Management", "Gammafree", pedited, icm.gamma, pedited->icm.gamma); assignFromKeyfile(keyFile, "Color Management", "Freegamma", pedited, icm.freegamma, pedited->icm.freegamma); assignFromKeyfile(keyFile, "Color Management", "GammaValue", pedited, icm.gampos, pedited->icm.gampos); assignFromKeyfile(keyFile, "Color Management", "GammaSlope", pedited, icm.slpos, pedited->icm.slpos); diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index c2f22697d..a571f5484 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -567,7 +567,6 @@ public: bool gamma; bool gampos; bool slpos; - bool gamfree; bool freegamma; }; class WaveletParamsEdited From cb1bbfef5945b7aa60efacef314c5d93f33caea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Tue, 5 Dec 2017 19:51:48 +0100 Subject: [PATCH 34/47] Fix loading of `Wavelet/ThresholdHighlight` --- rtengine/procparams.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 8e25abe8a..782d6fe2d 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -4117,7 +4117,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "ContExtra", pedited, wavelet.sup, pedited->wavelet.sup); assignFromKeyfile(keyFile, "Wavelet", "HueRangeResidual", pedited, wavelet.sky, pedited->wavelet.sky); assignFromKeyfile(keyFile, "Wavelet", "MaxLev", pedited, wavelet.thres, pedited->wavelet.thres); - assignFromKeyfile(keyFile, "Wavelet", "ThresholdHighLight", pedited, wavelet.threshold, pedited->wavelet.threshold); + assignFromKeyfile(keyFile, "Wavelet", "ThresholdHighlight", pedited, wavelet.threshold, pedited->wavelet.threshold); assignFromKeyfile(keyFile, "Wavelet", "ThresholdShadow", pedited, wavelet.threshold2, pedited->wavelet.threshold2); assignFromKeyfile(keyFile, "Wavelet", "Edgedetect", pedited, wavelet.edgedetect, pedited->wavelet.edgedetect); assignFromKeyfile(keyFile, "Wavelet", "Edgedetectthr", pedited, wavelet.edgedetectthr, pedited->wavelet.edgedetectthr); From 7cde837a15ce78ff00a15d128e14cad28af32cf2 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 6 Dec 2017 08:34:15 +0100 Subject: [PATCH 35/47] Fixes reading tone curve mode from sidecar. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flössie fixed a regression when reading tone curve modes from a sidecar. Closes #4207. --- rtengine/procparams.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 782d6fe2d..743553786 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3435,7 +3435,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) }; assignFromKeyfile(keyFile, "Exposure", "CurveMode", pedited, tc_mapping, toneCurve.curveMode, pedited->toneCurve.curveMode); - assignFromKeyfile(keyFile, "Exposure", "CurveMode2", pedited, tc_mapping, toneCurve.curveMode, pedited->toneCurve.curveMode); + assignFromKeyfile(keyFile, "Exposure", "CurveMode2", pedited, tc_mapping, toneCurve.curveMode2, pedited->toneCurve.curveMode2); if (ppVersion > 200) { assignFromKeyfile(keyFile, "Exposure", "Curve", pedited, toneCurve.curve, pedited->toneCurve.curve); From 95af7dd65c4773167ac30f72a8bb00ffb6ad7b2c Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 6 Dec 2017 11:03:56 +0100 Subject: [PATCH 36/47] Added histogram profile button images, #4066 --- rtdata/images/Dark/actions/gamut-hist.png | Bin 0 -> 761 bytes rtdata/images/Light/actions/gamut-hist.png | Bin 0 -> 763 bytes rtgui/editorpanel.cc | 2 + tools/source_icons/scalable/gamut-hist.file | 1 + tools/source_icons/scalable/gamut-hist.svg | 852 ++++++++++++++++++++ 5 files changed, 855 insertions(+) create mode 100644 rtdata/images/Dark/actions/gamut-hist.png create mode 100644 rtdata/images/Light/actions/gamut-hist.png create mode 100644 tools/source_icons/scalable/gamut-hist.file create mode 100644 tools/source_icons/scalable/gamut-hist.svg diff --git a/rtdata/images/Dark/actions/gamut-hist.png b/rtdata/images/Dark/actions/gamut-hist.png new file mode 100644 index 0000000000000000000000000000000000000000..8a60118ddb5c741891ed9d763a84b0d4a2376592 GIT binary patch literal 761 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fEX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1UVK#Cko zOEU6{7<_@kiFpbhiA5>p`S~dc0i`#AD%2pxlolnYG6W@-hh(G{0gXsi02x@6SY86< z>m}#sUXA#e2GkJ*(&3z6P+63jo>9W!?5yBeQc{$eR9cdmpQjs~0d$UIPG)whLPkkR zft9{~a#3nxNoH9p(1hIlykd~+^m8(kQ}c>bi}jN#b&C`AP4o=(4~HbNGB7Y6@pN$v zvFP1;)wWwWP=xKl_d6%W4v8_k3QU>1apPvMsYOP@!CkIz-duCq5}>4Wqo>tgX}^Px z$e&f`?kw>VlinSB!Eqie;$APZdHY%j#6FTozSbxvl~6xcJ}`fn|S-Q zntlu8kDdR78>|_$R_!X!o3TV)>3Y%T-bF8tCm8HtKM;JiWyu-P+MwqCpEKk3Po%>rh}eq4@o zd9%kjP(-%RZE^qAtgjz)J_R{G622i(%$2wOcC@3w9n)hr3YCVwmvb4;pKoDgIi9({ zHL>E;?#UwAZ*>{`J>FS7-`8=%d(!&pUN)_aFG>zZMQ^>fjp5CNEyrf4@EooceE8<+ z&Vv2-_fJT@naUv1f85OX^6Yav#ZKljtUvYi({Hb(pH?eesj)b1B;UX=V~W>OwubpC z^IZeKY~`>PHaixh`17FU_hr{#zg72qG>w(}Vbt1dj29wBf2-g5AET$m_-~)WYnR6s f`!;SoBE8z)^8dk}Ye$4Z37f&w)z4*}Q$iB}A<;&Z literal 0 HcmV?d00001 diff --git a/rtdata/images/Light/actions/gamut-hist.png b/rtdata/images/Light/actions/gamut-hist.png new file mode 100644 index 0000000000000000000000000000000000000000..8c81e0213533842906b9bc72ec9fed769b605e47 GIT binary patch literal 763 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fEX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1UVK#Cko zOEU6{7<_@kiFpbhiA5>p`S~dc0i`#AD%2pxlolnYG6W@-hh(G{0gXsi02x@6SY86< z>m}#sUXA#e2GkJ*(&3z6P+63jo>9W!?5yBeQc{$eR9cdmpQjs~0d$UIPG)whLPkkR zft9{~a#3nxNoH9p(1hIlykd~+^m8(kQ}c>bi}jN#b&C`AP4o=(4~HbNGB7Y6^K@|x zvFP1;b?@rS2_kGCo_pSM+))z9;<(ZD&1GHKmmXrB{`$dvB|fe? z-%HiUyD#hton^LAL{QMkLsKlu=J-K2r`${Yw~Y5b-*d9ReR>VUZ=LIU;8?-xtGiaLs$@`D zdHLlR76z-i=eFE`zh7XY{;?T{O>9KB|3>pSJ0B-!>Ry{J^9;j@4xJ{^iZIPXy{ax{~afM zC+&B65-HJkf76Dk8#-bXejePk#(dxV`Aic^5BgZ}98P99K0E1T)K|eadd (*histProfImg); toggleHistogramProfile->set_relief (Gtk::RELIEF_NONE); toggleHistogramProfile->set_active (options.rtSettings.HistogramWorking); toggleHistogramProfile->set_tooltip_markup ( (M ("PREFERENCES_HISTOGRAM_TOOLTIP"))); diff --git a/tools/source_icons/scalable/gamut-hist.file b/tools/source_icons/scalable/gamut-hist.file new file mode 100644 index 000000000..5eb359187 --- /dev/null +++ b/tools/source_icons/scalable/gamut-hist.file @@ -0,0 +1 @@ +gamut-hist.png,w22,actions diff --git a/tools/source_icons/scalable/gamut-hist.svg b/tools/source_icons/scalable/gamut-hist.svg new file mode 100644 index 000000000..cf163df83 --- /dev/null +++ b/tools/source_icons/scalable/gamut-hist.svg @@ -0,0 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + Morgan Hardwood + + + RawTherapee www.rawtherapee.com + + + + + + + + + + + + + + + + + From 58c9f5a4da90f32fe334dfb55e76674c26cfab02 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Wed, 6 Dec 2017 11:59:12 +0100 Subject: [PATCH 37/47] procparams loading: test for file existence before calling the KeyFile parser Fixes #4205 --- rtengine/procparams.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 743553786..f7618e84d 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3383,7 +3383,8 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) pedited->set (false); } - if (!keyFile.load_from_file(fname)) { + if (!Glib::file_test(fname, Glib::FILE_TEST_EXISTS) || + !keyFile.load_from_file(fname)) { return 1; } From 441c320375414ae49019f481840166e1c175fa6c Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 6 Dec 2017 12:55:05 +0100 Subject: [PATCH 38/47] NR Median now works independently of lumiance details, #4208 --- rtengine/FTblockDN.cc | 146 +++++++++++++++++++++--------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 0634deedd..fb46937e6 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -1295,79 +1295,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } if (!memoryAllocationFailed) { - if ((metchoice == 1 || metchoice == 2 || metchoice == 3 || metchoice == 4) && dnparams.median) { - float** tmL; - int wid = labdn->W; - int hei = labdn->H; - tmL = new float*[hei]; - - for (int i = 0; i < hei; ++i) { - tmL[i] = new float[wid]; - } - - Median medianTypeL = Median::TYPE_3X3_SOFT; - Median medianTypeAB = Median::TYPE_3X3_SOFT; - - if (dnparams.medmethod == "soft") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_3X3_SOFT; - } else { - medianTypeL = Median::TYPE_3X3_SOFT; - medianTypeAB = Median::TYPE_3X3_SOFT; - } - } else if (dnparams.medmethod == "33") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_3X3_STRONG; - } else { - medianTypeL = Median::TYPE_3X3_SOFT; - medianTypeAB = Median::TYPE_3X3_STRONG; - } - } else if (dnparams.medmethod == "55soft") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_5X5_SOFT; - } else { - medianTypeL = Median::TYPE_3X3_SOFT; - medianTypeAB = Median::TYPE_5X5_SOFT; - } - } else if (dnparams.medmethod == "55") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_5X5_STRONG; - } else { - medianTypeL = Median::TYPE_3X3_STRONG; - medianTypeAB = Median::TYPE_5X5_STRONG; - } - } else if (dnparams.medmethod == "77") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_7X7; - } else { - medianTypeL = Median::TYPE_3X3_STRONG; - medianTypeAB = Median::TYPE_7X7; - } - } else if (dnparams.medmethod == "99") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_9X9; - } else { - medianTypeL = Median::TYPE_5X5_SOFT; - medianTypeAB = Median::TYPE_9X9; - } - } - - if (metchoice == 1 || metchoice == 2 || metchoice == 4) { - Median_Denoise(labdn->L, labdn->L, wid, hei, medianTypeL, dnparams.passes, denoiseNestedLevels, tmL); - } - - if (metchoice == 2 || metchoice == 3 || metchoice == 4) { - Median_Denoise(labdn->a, labdn->a, wid, hei, medianTypeAB, dnparams.passes, denoiseNestedLevels, tmL); - Median_Denoise(labdn->b, labdn->b, wid, hei, medianTypeAB, dnparams.passes, denoiseNestedLevels, tmL); - } - - for (int i = 0; i < hei; ++i) { - delete[] tmL[i]; - } - - delete[] tmL; - } - //wavelet denoised L channel //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1530,6 +1457,79 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } + if ((metchoice == 1 || metchoice == 2 || metchoice == 3 || metchoice == 4) && dnparams.median) { + float** tmL; + int wid = labdn->W; + int hei = labdn->H; + tmL = new float*[hei]; + + for (int i = 0; i < hei; ++i) { + tmL[i] = new float[wid]; + } + + Median medianTypeL = Median::TYPE_3X3_SOFT; + Median medianTypeAB = Median::TYPE_3X3_SOFT; + + if (dnparams.medmethod == "soft") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_3X3_SOFT; + } else { + medianTypeL = Median::TYPE_3X3_SOFT; + medianTypeAB = Median::TYPE_3X3_SOFT; + } + } else if (dnparams.medmethod == "33") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_3X3_STRONG; + } else { + medianTypeL = Median::TYPE_3X3_SOFT; + medianTypeAB = Median::TYPE_3X3_STRONG; + } + } else if (dnparams.medmethod == "55soft") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_5X5_SOFT; + } else { + medianTypeL = Median::TYPE_3X3_SOFT; + medianTypeAB = Median::TYPE_5X5_SOFT; + } + } else if (dnparams.medmethod == "55") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_5X5_STRONG; + } else { + medianTypeL = Median::TYPE_3X3_STRONG; + medianTypeAB = Median::TYPE_5X5_STRONG; + } + } else if (dnparams.medmethod == "77") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_7X7; + } else { + medianTypeL = Median::TYPE_3X3_STRONG; + medianTypeAB = Median::TYPE_7X7; + } + } else if (dnparams.medmethod == "99") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_9X9; + } else { + medianTypeL = Median::TYPE_5X5_SOFT; + medianTypeAB = Median::TYPE_9X9; + } + } + + if (metchoice == 1 || metchoice == 2 || metchoice == 4) { + Median_Denoise(labdn->L, labdn->L, wid, hei, medianTypeL, dnparams.passes, denoiseNestedLevels, tmL); + } + + if (metchoice == 2 || metchoice == 3 || metchoice == 4) { + Median_Denoise(labdn->a, labdn->a, wid, hei, medianTypeAB, dnparams.passes, denoiseNestedLevels, tmL); + Median_Denoise(labdn->b, labdn->b, wid, hei, medianTypeAB, dnparams.passes, denoiseNestedLevels, tmL); + } + + for (int i = 0; i < hei; ++i) { + delete[] tmL[i]; + } + + delete[] tmL; + } + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // transform denoised "Lab" to output RGB From a633f3d233551d6ae3f59d273ac0ea910ce9c938 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 7 Dec 2017 22:51:19 +0100 Subject: [PATCH 39/47] fattal: optimized memory usage --- rtengine/tmo_fattal02.cc | 163 ++++++++++----------------------------- 1 file changed, 39 insertions(+), 124 deletions(-) diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index 4af176cd2..571f2e430 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -69,7 +69,7 @@ #include "improcfun.h" #include "settings.h" #include "iccstore.h" -//#define BENCHMARK +#define BENCHMARK #include "StopWatch.h" #include "sleef.c" #include "opthelper.h" @@ -233,18 +233,12 @@ void gaussianBlur (const Array2Df& I, Array2Df& L, bool multithread) } } -void createGaussianPyramids ( Array2Df* H, Array2Df** pyramids, int nlevels, bool multithread) +void createGaussianPyramids (Array2Df** pyramids, int nlevels, bool multithread) { - int width = H->getCols(); - int height = H->getRows(); - const int size = width * height; + // pyramids[0] is already set + int width = pyramids[0]->getCols(); + int height = pyramids[0]->getRows(); - pyramids[0] = new Array2Df (width, height); - -//#pragma omp parallel for shared(pyramids, H) - for ( int i = 0 ; i < size ; i++ ) { - (*pyramids[0]) (i) = (*H) (i); - } Array2Df* L = new Array2Df (width, height); gaussianBlur ( *pyramids[0], *L, multithread ); @@ -531,77 +525,54 @@ void tmo_fattal02 (size_t width, /** RT */ - // create gaussian pyramids - // int mins = (width= MSIZE ) - // { - // nlevels++; - // mins /= 2; - // } - // // std::cout << "DEBUG: nlevels = " << nlevels << ", mins = " << mins << std::endl; - // // The following lines solves a bug with images particularly small - // if (nlevels == 0) nlevels = 1; const int nlevels = 7; // RT -- see above - Array2Df** pyramids = new Array2Df*[nlevels]; - createGaussianPyramids (H, pyramids, nlevels, multithread); - // ph.setValue(8); + Array2Df* pyramids[nlevels]; + pyramids[0] = H; + createGaussianPyramids (pyramids, nlevels, multithread); // calculate gradients and its average values on pyramid levels - Array2Df** gradients = new Array2Df*[nlevels]; - float* avgGrad = new float[nlevels]; + Array2Df* gradients[nlevels]; + float avgGrad[nlevels]; for ( int k = 0 ; k < nlevels ; k++ ) { gradients[k] = new Array2Df (pyramids[k]->getCols(), pyramids[k]->getRows()); avgGrad[k] = calculateGradients (pyramids[k], gradients[k], k, multithread); - delete pyramids[k]; + if(k != 0) // pyramids[0] is H. Will be deleted later + delete pyramids[k]; } - delete[] pyramids; - // ph.setValue(12); // calculate fi matrix Array2Df* FI = new Array2Df (width, height); calculateFiMatrix (FI, gradients, avgGrad, nlevels, detail_level, alfa, beta, noise, multithread); -// dumpPFS( "FI.pfs", FI, "Y" ); for ( int i = 0 ; i < nlevels ; i++ ) { delete gradients[i]; } - delete[] gradients; - delete[] avgGrad; - // ph.setValue(16); - // if (ph.canceled()){ - // delete FI; - // delete H; - // return; - // } - /** - RT - bring back the FI image to the input size if it was downscaled */ if (fullH) { + delete H; + H = fullH; Array2Df *FI2 = new Array2Df (fullwidth, fullheight); rescale_bilinear (*FI, *FI2, multithread); delete FI; FI = FI2; width = fullwidth; height = fullheight; - delete H; - H = fullH; } /** RT */ // attenuate gradients Array2Df* Gx = new Array2Df (width, height); - Array2Df* Gy = new Array2Df (width, height); + Array2Df* Gy = &L; // use L as buffer for Gy // the fft solver solves the Poisson pde but with slightly different // boundary conditions, so we need to adjust the assembly of the right hand // side accordingly (basically fft solver assumes U(-1) = U(1), whereas zero // Neumann conditions assume U(-1)=U(0)), see also divergence calculation - // if (fftsolver) #pragma omp parallel for if(multithread) for ( size_t y = 0 ; y < height ; y++ ) { @@ -634,68 +605,49 @@ void tmo_fattal02 (size_t width, (*FI) (x, y) -= (*Gy) (x, y - 1); } - // if (fftsolver) - { - if (x == 0) { - (*FI) (x, y) += (*Gx) (x, y); - } + if (x == 0) { + (*FI) (x, y) += (*Gx) (x, y); + } - if (y == 0) { - (*FI) (x, y) += (*Gy) (x, y); - } + if (y == 0) { + (*FI) (x, y) += (*Gy) (x, y); } } } //delete Gx; // RT - reused as temp buffer in solve_pde_fft, deleted later - delete Gy; // solve pde and exponentiate (ie recover compressed image) { - // if (fftsolver) - { - MyMutex::MyLock lock (*fftwMutex); - solve_pde_fft (FI, &L, Gx, multithread); //, ph); - } - delete Gx; - delete FI; - // else - // { - // solve_pde_multigrid(&DivG, &U, ph); - // } -// #ifndef NDEBUG -// printf("\npde residual error: %f\n", residual_pde(&U, &DivG)); -// #endif - // ph.setValue(90); - // if ( ph.canceled() ) - // { - // return; - // } - #pragma omp parallel if(multithread) - { + MyMutex::MyLock lock (*fftwMutex); + solve_pde_fft (FI, &L, Gx, multithread); + } + delete Gx; + delete FI; + + #pragma omp parallel if(multithread) + { #ifdef __SSE2__ - vfloat gammav = F2V (gamma); + vfloat gammav = F2V (gamma); #endif - #pragma omp for schedule(dynamic,16) + #pragma omp for schedule(dynamic,16) - for (size_t i = 0 ; i < height ; i++) { - size_t j = 0; + for (size_t i = 0 ; i < height ; i++) { + size_t j = 0; #ifdef __SSE2__ - for (; j < width - 3; j += 4) { - STVFU (L[i][j], xexpf (gammav * LVFU (L[i][j]))); - } + for (; j < width - 3; j += 4) { + STVFU (L[i][j], xexpf (gammav * LVFU (L[i][j]))); + } #endif - for (; j < width; j++) { - L[i][j] = xexpf ( gamma * L[i][j]); - } + for (; j < width; j++) { + L[i][j] = xexpf ( gamma * L[i][j]); } } } - // ph.setValue(95); // remove percentile of min and max values and renormalize float cut_min = 0.01f * black_point; @@ -759,31 +711,6 @@ void tmo_fattal02 (size_t width, // atimes(). This means the assembly of the right hand side F is different // for both solvers. -// #include - -// #include - -// #include -// #include -// #include "arch/math.h" -// #include -// #ifdef _OPENMP -// #include -// #endif -// #include -// #include - -// #include "Libpfs/progress.h" -// #include "Libpfs/array2d.h" -// #include "pde.h" - -// using namespace std; - - -// #ifndef SQR -// #define SQR(x) (x)*(x) -// #endif - // returns T = EVy A EVx^tr // note, modifies input data @@ -955,23 +882,13 @@ void solve_pde_fft (Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread)/* // transforms F into eigenvector space: Ftr = //DEBUG_STR << "solve_pde_fft: transform F to ev space (fft)" << std::endl; - Array2Df* F_tr = buf; //new Array2Df(width,height); + Array2Df* F_tr = buf; transform_normal2ev (F, F_tr, multithread); // TODO: F no longer needed so could release memory, but as it is an // input parameter we won't do that - // ph.setValue(50); - // if (ph.canceled()) - // { - // delete F_tr; - // return; - // } - //DEBUG_STR << "solve_pde_fft: F_tr(0,0) = " << (*F_tr)(0,0); - //DEBUG_STR << " (must be 0 for solution to exist)" << std::endl; // in the eigenvector space the solution is very simple - //DEBUG_STR << "solve_pde_fft: solve in eigenvector space" << std::endl; -// Array2Df* U_tr = new Array2Df(width,height); std::vector l1 = get_lambda (height); std::vector l2 = get_lambda (width); @@ -985,10 +902,8 @@ void solve_pde_fft (Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread)/* (*F_tr) (0, 0) = 0.f; // any value ok, only adds a const to the solution - // transforms U_tr back to the normal space - //DEBUG_STR << "solve_pde_fft: transform U_tr to normal space (fft)" << std::endl; + // transforms F_tr back to the normal space transform_ev2normal (F_tr, U, multithread); -// delete F_tr; // no longer needed so release memory // the solution U as calculated will satisfy something like int U = 0 // since for any constant c, U-c is also a solution and we are mainly From 3b6cf1d881a335d7ecdda991f803d1a34e3ed5c0 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 7 Dec 2017 22:57:19 +0100 Subject: [PATCH 40/47] Disabled StopWatch --- rtengine/tmo_fattal02.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index 571f2e430..645451905 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -69,7 +69,7 @@ #include "improcfun.h" #include "settings.h" #include "iccstore.h" -#define BENCHMARK +//#define BENCHMARK #include "StopWatch.h" #include "sleef.c" #include "opthelper.h" From d668e0d74595a3e4ad142638769a71a623bb3cc6 Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 8 Dec 2017 08:09:49 +0100 Subject: [PATCH 41/47] Format ftblockdn.cc --- rtengine/FTblockDN.cc | 143 ++++++++++++++++++++++-------------------- 1 file changed, 74 insertions(+), 69 deletions(-) diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index fb46937e6..4deb2b7c8 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -74,13 +74,14 @@ extern const Settings* settings; extern MyMutex *fftwMutex; -namespace { +namespace +{ template void do_median_denoise(float **src, float **dst, float upperBound, const int width, const int height, const ImProcFunctions::Median medianType, const int iterations, const int numThreads, float **buffer) { typedef ImProcFunctions::Median Median; - + int border = 1; switch (medianType) { @@ -227,6 +228,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid case Median::TYPE_5X5_STRONG: { #ifdef __SSE2__ + for (; !useUpperBound && j < width - border - 3; j += 4) { STVFU( medianOut[i][j], @@ -261,6 +263,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid } #endif + for (; j < width - border; ++j) { if (!useUpperBound || medianIn[i][j] <= upperBound) { medianOut[i][j] = median( @@ -315,7 +318,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid #endif std::array pp; - + for (; j < width - border; ++j) { if (!useUpperBound || medianIn[i][j] <= upperBound) { for (int kk = 0, ii = -border; ii <= border; ++ii) { @@ -323,7 +326,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid pp[kk] = medianIn[i + ii][j + jj]; } } - + medianOut[i][j] = median(pp); } else { medianOut[i][j] = medianIn[i][j]; @@ -350,7 +353,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid #endif std::array pp; - + for (; j < width - border; ++j) { if (!useUpperBound || medianIn[i][j] <= upperBound) { for (int kk = 0, ii = -border; ii <= border; ++ii) { @@ -358,7 +361,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid pp[kk] = medianIn[i + ii][j + jj]; } } - + medianOut[i][j] = median(pp); } else { medianOut[i][j] = medianIn[i][j]; @@ -393,6 +396,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid #ifdef _OPENMP #pragma omp parallel for num_threads(numThreads) if (numThreads>1) #endif + for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { dst[i][j] = medianOut[i][j]; @@ -491,7 +495,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef MyMutex::MyLock lock(*fftwMutex); const nrquality nrQuality = (dnparams.smethod == "shal") ? QUALITY_STANDARD : QUALITY_HIGH;//shrink method - const float qhighFactor = (nrQuality == QUALITY_HIGH) ? 1.f / static_cast( settings->nrhigh) : 1.0f; + const float qhighFactor = (nrQuality == QUALITY_HIGH) ? 1.f / static_cast(settings->nrhigh) : 1.0f; const bool useNoiseCCurve = (noiseCCurve && noiseCCurve.getSum() > 5.f); const bool useNoiseLCurve = (noiseLCurve && noiseLCurve.getSum() >= 7.f); const bool autoch = (settings->leveldnautsimpl == 1 && (dnparams.Cmethod == "AUT" || dnparams.Cmethod == "PRE")) || (settings->leveldnautsimpl == 0 && (dnparams.C2method == "AUTO" || dnparams.C2method == "PREV")); @@ -531,15 +535,15 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef const bool denoiseMethodRgb = (dnparams.dmethod == "RGB"); // init luma noisevarL - const float noiseluma = static_cast( dnparams.luma); - const float noisevarL = (useNoiseLCurve && (denoiseMethodRgb || !isRAW)) ? static_cast (SQR(((noiseluma + 1.0) / 125.0) * (10. + (noiseluma + 1.0) / 25.0))) : static_cast (SQR((noiseluma / 125.0) * (1.0 + noiseluma / 25.0))); + const float noiseluma = static_cast(dnparams.luma); + const float noisevarL = (useNoiseLCurve && (denoiseMethodRgb || !isRAW)) ? static_cast(SQR(((noiseluma + 1.0) / 125.0) * (10. + (noiseluma + 1.0) / 25.0))) : static_cast(SQR((noiseluma / 125.0) * (1.0 + noiseluma / 25.0))); const bool denoiseLuminance = (noisevarL > 0.00001f); //printf("NL=%f \n",noisevarL); if (useNoiseLCurve || useNoiseCCurve) { int hei = calclum->getHeight(); int wid = calclum->getWidth(); - TMatrix wprofi = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); + TMatrix wprofi = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); const float wpi[3][3] = { {static_cast(wprofi[0][0]), static_cast(wprofi[0][1]), static_cast(wprofi[0][2])}, @@ -653,7 +657,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef Color::gammanf2lut(igamcurve, igam, 32768.f, 65535.f); } - const float gain = pow (2.0f, float(expcomp)); + const float gain = pow(2.0f, float(expcomp)); float noisevar_Ldetail = SQR(static_cast(SQR(100. - dnparams.Ldetail) + 50.*(100. - dnparams.Ldetail)) * TS * 0.5f); array2D tilemask_in(TS, TS); @@ -706,7 +710,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef int numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip; - Tile_calc (tilesize, overlap, (options.rgbDenoiseThreadLimit == 0 && !ponder) ? (numTries == 1 ? 0 : 2) : 2, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + Tile_calc(tilesize, overlap, (options.rgbDenoiseThreadLimit == 0 && !ponder) ? (numTries == 1 ? 0 : 2) : 2, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); memoryAllocationFailed = false; const int numtiles = numtiles_W * numtiles_H; @@ -746,8 +750,8 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef fftwf_plan plan_backward_blox[2]; if (denoiseLuminance) { - float *Lbloxtmp = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof (float))); - float *fLbloxtmp = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof (float))); + float *Lbloxtmp = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + float *fLbloxtmp = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); int nfwd[2] = {TS, TS}; @@ -756,12 +760,12 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef fftw_r2r_kind bwdkind[2] = {FFTW_REDFT01, FFTW_REDFT01}; // Creating the plans with FFTW_MEASURE instead of FFTW_ESTIMATE speeds up the execute a bit - plan_forward_blox[0] = fftwf_plan_many_r2r(2, nfwd, max_numblox_W, Lbloxtmp, nullptr, 1, TS * TS, fLbloxtmp, nullptr, 1, TS * TS, fwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT ); - plan_backward_blox[0] = fftwf_plan_many_r2r(2, nfwd, max_numblox_W, fLbloxtmp, nullptr, 1, TS * TS, Lbloxtmp, nullptr, 1, TS * TS, bwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT ); - plan_forward_blox[1] = fftwf_plan_many_r2r(2, nfwd, min_numblox_W, Lbloxtmp, nullptr, 1, TS * TS, fLbloxtmp, nullptr, 1, TS * TS, fwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT ); - plan_backward_blox[1] = fftwf_plan_many_r2r(2, nfwd, min_numblox_W, fLbloxtmp, nullptr, 1, TS * TS, Lbloxtmp, nullptr, 1, TS * TS, bwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT ); - fftwf_free (Lbloxtmp); - fftwf_free (fLbloxtmp); + plan_forward_blox[0] = fftwf_plan_many_r2r(2, nfwd, max_numblox_W, Lbloxtmp, nullptr, 1, TS * TS, fLbloxtmp, nullptr, 1, TS * TS, fwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT); + plan_backward_blox[0] = fftwf_plan_many_r2r(2, nfwd, max_numblox_W, fLbloxtmp, nullptr, 1, TS * TS, Lbloxtmp, nullptr, 1, TS * TS, bwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT); + plan_forward_blox[1] = fftwf_plan_many_r2r(2, nfwd, min_numblox_W, Lbloxtmp, nullptr, 1, TS * TS, fLbloxtmp, nullptr, 1, TS * TS, fwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT); + plan_backward_blox[1] = fftwf_plan_many_r2r(2, nfwd, min_numblox_W, fLbloxtmp, nullptr, 1, TS * TS, Lbloxtmp, nullptr, 1, TS * TS, bwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT); + fftwf_free(Lbloxtmp); + fftwf_free(fLbloxtmp); } #ifndef _OPENMP @@ -785,7 +789,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } if (options.rgbDenoiseThreadLimit > 0) - while(denoiseNestedLevels * numthreads > options.rgbDenoiseThreadLimit) { + while (denoiseNestedLevels * numthreads > options.rgbDenoiseThreadLimit) { denoiseNestedLevels--; } @@ -801,12 +805,12 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef if (numtiles > 1 && denoiseLuminance) { for (int i = 0; i < denoiseNestedLevels * numthreads; ++i) { - LbloxArray[i] = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); - fLbloxArray[i] = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + LbloxArray[i] = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + fLbloxArray[i] = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); } } - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.working); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.working); //inverse matrix user select const float wip[3][3] = { {static_cast(wiprof[0][0]), static_cast(wiprof[0][1]), static_cast(wiprof[0][2])}, @@ -814,7 +818,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef {static_cast(wiprof[2][0]), static_cast(wiprof[2][1]), static_cast(wiprof[2][2])} }; - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); const float wp[3][3] = { {static_cast(wprof[0][0]), static_cast(wprof[0][1]), static_cast(wprof[0][2])}, @@ -853,19 +857,19 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef int height = tilebottom - tiletop; int width2 = (width + 1) / 2; float realred, realblue; - float interm_med = static_cast( dnparams.chroma) / 10.0; + float interm_med = static_cast(dnparams.chroma) / 10.0; float intermred, intermblue; if (dnparams.redchro > 0.) { intermred = (dnparams.redchro / 10.); } else { - intermred = static_cast( dnparams.redchro) / 7.0; //increase slower than linear for more sensit + intermred = static_cast(dnparams.redchro) / 7.0; //increase slower than linear for more sensit } if (dnparams.bluechro > 0.) { intermblue = (dnparams.bluechro / 10.); } else { - intermblue = static_cast( dnparams.bluechro) / 7.0; //increase slower than linear for more sensit + intermblue = static_cast(dnparams.bluechro) / 7.0; //increase slower than linear for more sensit } if (ponder && kall == 2) { @@ -1079,7 +1083,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef //binary 1 or 0 for each level, eg subsampling = 0 means no subsampling, 1 means subsample //the first level only, 7 means subsample the first three levels, etc. //actual implementation only works with subsampling set to 1 - float interm_medT = static_cast( dnparams.chroma) / 10.0; + float interm_medT = static_cast(dnparams.chroma) / 10.0; bool execwavelet = true; if (!denoiseLuminance && interm_medT < 0.05f && dnparams.median && (dnparams.methodmed == "Lab" || dnparams.methodmed == "Lonly")) { @@ -1139,7 +1143,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef levwav = min(maxlev2, levwav); // if (settings->verbose) printf("levwavelet=%i noisevarA=%f noisevarB=%f \n",levwav, noisevarab_r, noisevarab_b); - Ldecomp = new wavelet_decomposition (labdn->L[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); + Ldecomp = new wavelet_decomposition(labdn->L[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); if (Ldecomp->memoryAllocationFailed) { memoryAllocationFailed = true; @@ -1176,7 +1180,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef float chmaxresid = 0.f; float chmaxresidtemp = 0.f; - adecomp = new wavelet_decomposition (labdn->a[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); + adecomp = new wavelet_decomposition(labdn->a[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); if (adecomp->memoryAllocationFailed) { memoryAllocationFailed = true; @@ -1213,7 +1217,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef delete adecomp; if (!memoryAllocationFailed) { - wavelet_decomposition* bdecomp = new wavelet_decomposition (labdn->b[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); + wavelet_decomposition* bdecomp = new wavelet_decomposition(labdn->b[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); if (bdecomp->memoryAllocationFailed) { memoryAllocationFailed = true; @@ -1323,8 +1327,8 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef if (numtiles == 1) { for (int i = 0; i < denoiseNestedLevels * numthreads; ++i) { - LbloxArray[i] = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); - fLbloxArray[i] = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + LbloxArray[i] = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + fLbloxArray[i] = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); } } @@ -1419,7 +1423,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef for (int hblk = 0; hblk < numblox_W; ++hblk) { - RGBtile_denoise (fLblox, hblk, noisevar_Ldetail, nbrwt, blurbuffer); + RGBtile_denoise(fLblox, hblk, noisevar_Ldetail, nbrwt, blurbuffer); }//end of horizontal block loop //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1434,7 +1438,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef int topproc = (vblk - blkrad) * offset; //add row of blocks to output image tile - RGBoutput_tile_row (Lblox, Ldetail, tilemask_out, height, width, topproc); + RGBoutput_tile_row(Lblox, Ldetail, tilemask_out, height, width, topproc); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1776,7 +1780,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef fftwf_destroy_plan(plan_backward_blox[1]); fftwf_cleanup(); } - } while(memoryAllocationFailed && numTries < 2 && (options.rgbDenoiseThreadLimit == 0) && !ponder); + } while (memoryAllocationFailed && numTries < 2 && (options.rgbDenoiseThreadLimit == 0) && !ponder); if (memoryAllocationFailed) { printf("tiled denoise failed due to isufficient memory. Output is not denoised!\n"); @@ -1838,16 +1842,16 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } } - } else { + } else + { #pragma omp for - for (int i = 2; i < hei - 2; ++i) - { + for (int i = 2; i < hei - 2; ++i) { if (methmed == 3) { for (int j = 2; j < wid - 2; ++j) { tm[i][j] = median(source->r(i, j), source->r(i - 1, j), source->r(i + 1, j), source->r(i, j + 1), source->r(i, j - 1), source->r(i - 1, j - 1), source->r(i - 1, j + 1), source->r(i + 1, j - 1), source->r(i + 1, j + 1), - source->r(i - 2, j), source->r(i + 2, j), source->r(i, j + 2), source->r(i, j - 2), source->r(i - 2, j - 2), source->r(i - 2, j + 2), source->r(i + 2, j - 2), source->r(i + 2, j + 2), - source->r(i - 2, j + 1), source->r(i + 2, j + 1), source->r(i - 1, j + 2), source->r(i - 1, j - 2), source->r(i - 2, j - 1), source->r(i + 2, j - 1), source->r(i + 1, j + 2), source->r(i + 1, j - 2));//5x5 + source->r(i - 2, j), source->r(i + 2, j), source->r(i, j + 2), source->r(i, j - 2), source->r(i - 2, j - 2), source->r(i - 2, j + 2), source->r(i + 2, j - 2), source->r(i + 2, j + 2), + source->r(i - 2, j + 1), source->r(i + 2, j + 1), source->r(i - 1, j + 2), source->r(i - 1, j - 2), source->r(i - 2, j - 1), source->r(i + 2, j - 1), source->r(i + 1, j + 2), source->r(i + 1, j - 2));//5x5 } } else { for (int j = 2; j < wid - 2; ++j) { @@ -1870,6 +1874,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } } + #ifdef _OPENMP #pragma omp for nowait #endif @@ -1896,16 +1901,16 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } } - } else { + } else + { #pragma omp for - for (int i = 2; i < hei - 2; ++i) - { + for (int i = 2; i < hei - 2; ++i) { if (methmed == 3) { for (int j = 2; j < wid - 2; ++j) { tm[i][j] = median(source->b(i, j), source->b(i - 1, j), source->b(i + 1, j), source->b(i, j + 1), source->b(i, j - 1), source->b(i - 1, j - 1), source->b(i - 1, j + 1), source->b(i + 1, j - 1), source->b(i + 1, j + 1), - source->b(i - 2, j), source->b(i + 2, j), source->b(i, j + 2), source->b(i, j - 2), source->b(i - 2, j - 2), source->b(i - 2, j + 2), source->b(i + 2, j - 2), source->b(i + 2, j + 2), - source->b(i - 2, j + 1), source->b(i + 2, j + 1), source->b(i - 1, j + 2), source->b(i - 1, j - 2), source->b(i - 2, j - 1), source->b(i + 2, j - 1), source->b(i + 1, j + 2), source->b(i + 1, j - 2)); // 5x5 + source->b(i - 2, j), source->b(i + 2, j), source->b(i, j + 2), source->b(i, j - 2), source->b(i - 2, j - 2), source->b(i - 2, j + 2), source->b(i + 2, j - 2), source->b(i + 2, j + 2), + source->b(i - 2, j + 1), source->b(i + 2, j + 1), source->b(i - 1, j + 2), source->b(i - 1, j - 2), source->b(i - 2, j - 1), source->b(i + 2, j - 1), source->b(i + 1, j + 2), source->b(i + 1, j - 2)); // 5x5 } } else { for (int j = 2; j < wid - 2; ++j) { @@ -1956,16 +1961,16 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } } - } else { + } else + { #pragma omp for - for (int i = 2; i < hei - 2; ++i) - { + for (int i = 2; i < hei - 2; ++i) { if (methmed == 3) { for (int j = 2; j < wid - 2; ++j) { tm[i][j] = median(source->g(i, j), source->g(i - 1, j), source->g(i + 1, j), source->g(i, j + 1), source->g(i, j - 1), source->g(i - 1, j - 1), source->g(i - 1, j + 1), source->g(i + 1, j - 1), source->g(i + 1, j + 1), - source->g(i - 2, j), source->g(i + 2, j), source->g(i, j + 2), source->g(i, j - 2), source->g(i - 2, j - 2), source->g(i - 2, j + 2), source->g(i + 2, j - 2), source->g(i + 2, j + 2), - source->g(i - 2, j + 1), source->g(i + 2, j + 1), source->g(i - 1, j + 2), source->g(i - 1, j - 2), source->g(i - 2, j - 1), source->g(i + 2, j - 1), source->g(i + 1, j + 2), source->g(i + 1, j - 2)); // 5x5 + source->g(i - 2, j), source->g(i + 2, j), source->g(i, j + 2), source->g(i, j - 2), source->g(i - 2, j - 2), source->g(i - 2, j + 2), source->g(i + 2, j - 2), source->g(i + 2, j + 2), + source->g(i - 2, j + 1), source->g(i + 2, j + 1), source->g(i - 1, j + 2), source->g(i - 1, j - 2), source->g(i - 2, j - 1), source->g(i + 2, j - 1), source->g(i + 1, j + 2), source->g(i + 1, j - 2)); // 5x5 } } else { for (int j = 2; j < wid - 2; ++j) { @@ -2034,7 +2039,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -SSEFUNCTION void ImProcFunctions::RGBtile_denoise (float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer) //for DCT +SSEFUNCTION void ImProcFunctions::RGBtile_denoise(float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer) //for DCT { int blkstart = hblproc * TS * TS; @@ -2067,7 +2072,7 @@ SSEFUNCTION void ImProcFunctions::RGBtile_denoise (float * fLblox, int hblproc, //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void ImProcFunctions::RGBoutput_tile_row (float *bloxrow_L, float ** Ldetail, float ** tilemask_out, int height, int width, int top) +void ImProcFunctions::RGBoutput_tile_row(float *bloxrow_L, float ** Ldetail, float ** tilemask_out, int height, int width, int top) { const int numblox_W = ceil((static_cast(width)) / (offset)); const float DCTnorm = 1.0f / (4 * TS * TS); //for DCT @@ -2146,7 +2151,7 @@ float ImProcFunctions::MadMax(float * DataList, int & max, int datalen) float ImProcFunctions::Mad(float * DataList, const int datalen) { - if(datalen <= 1) { // Avoid possible buffer underrun + if (datalen <= 1) { // Avoid possible buffer underrun return 0; } @@ -2175,7 +2180,7 @@ float ImProcFunctions::Mad(float * DataList, const int datalen) float ImProcFunctions::MadRgb(float * DataList, const int datalen) { - if(datalen <= 1) { // Avoid possible buffer underrun + if (datalen <= 1) { // Avoid possible buffer underrun return 0; } @@ -2902,7 +2907,7 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll_info(float ** WavCoeffs_a, float ** } } - const float reduc = (schoice == 2) ? static_cast( settings->nrhigh) : 1.f; + const float reduc = (schoice == 2) ? static_cast(settings->nrhigh) : 1.f; for (int dir = 1; dir < 4; ++dir) { float mada, madb; @@ -3002,7 +3007,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_infoGamCurve(const procparams::Dir } } -void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc) +void ImProcFunctions::calcautodn_info(float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc) { float reducdelta = 1.f; @@ -3081,7 +3086,7 @@ void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int l delta *= 0.15f; } else if (chaut < 650.f) { delta *= 0.1f; - } else /*if (chaut >= 650.f)*/ { + } else { /*if (chaut >= 650.f)*/ delta *= 0.07f; } @@ -3119,7 +3124,7 @@ void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int l delta *= 0.3f; } else if (chaut < 650.f) { delta *= 0.2f; - } else /*if (chaut >= 650.f)*/ { + } else { /*if (chaut >= 650.f)*/ delta *= 0.15f; } @@ -3157,7 +3162,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat float** bcalc; hei = provicalc->getHeight(); wid = provicalc->getWidth(); - TMatrix wprofi = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); + TMatrix wprofi = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); const float wpi[3][3] = { {static_cast(wprofi[0][0]), static_cast(wprofi[0][1]), static_cast(wprofi[0][2])}, @@ -3209,7 +3214,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat bool denoiseMethodRgb = (dnparams.dmethod == "RGB"); - const float gain = pow (2.0f, float(expcomp)); + const float gain = pow(2.0f, float(expcomp)); int tilesize; int overlap; @@ -3228,11 +3233,11 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat //always no Tiles int kall = 0; - Tile_calc (tilesize, overlap, kall, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + Tile_calc(tilesize, overlap, kall, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); const float wp[3][3] = { {static_cast(wprof[0][0]), static_cast(wprof[0][1]), static_cast(wprof[0][2])}, {static_cast(wprof[1][0]), static_cast(wprof[1][1]), static_cast(wprof[1][2])}, @@ -3276,19 +3281,19 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat } float realred, realblue; - float interm_med = static_cast( dnparams.chroma) / 10.0; + float interm_med = static_cast(dnparams.chroma) / 10.0; float intermred, intermblue; if (dnparams.redchro > 0.) { intermred = (dnparams.redchro / 10.); } else { - intermred = static_cast( dnparams.redchro) / 7.0; //increase slower than linear for more sensit + intermred = static_cast(dnparams.redchro) / 7.0; //increase slower than linear for more sensit } if (dnparams.bluechro > 0.) { intermblue = (dnparams.bluechro / 10.); } else { - intermblue = static_cast( dnparams.bluechro) / 7.0; //increase slower than linear for more sensit + intermblue = static_cast(dnparams.bluechro) / 7.0; //increase slower than linear for more sensit } realred = interm_med + intermred; @@ -3522,13 +3527,13 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat #pragma omp section #endif { - adecomp = new wavelet_decomposition (labdn->data + datalen, labdn->W, labdn->H, levwav, 1); + adecomp = new wavelet_decomposition(labdn->data + datalen, labdn->W, labdn->H, levwav, 1); } #ifdef _RT_NESTED_OPENMP #pragma omp section #endif { - bdecomp = new wavelet_decomposition (labdn->data + 2 * datalen, labdn->W, labdn->H, levwav, 1); + bdecomp = new wavelet_decomposition(labdn->data + 2 * datalen, labdn->W, labdn->H, levwav, 1); } } From d6037a880ee423a67b05a7b6d457c655ca115921 Mon Sep 17 00:00:00 2001 From: Oleg Koncevoy Date: Fri, 8 Dec 2017 09:59:46 +0200 Subject: [PATCH 42/47] Moved histogramProfile_toggled() to EditorPanel private section. modified: rtgui/editorpanel.h --- rtgui/editorpanel.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index 9ccbbef2d..0249e77ca 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -115,7 +115,6 @@ public: void openNextEditorImage (); void openPreviousEditorImage (); void syncFileBrowser (); - void histogramProfile_toggled (); void tbTopPanel_1_visible (bool visible); bool CheckSidePanelsVisibility(); @@ -151,6 +150,8 @@ private: bool idle_saveImage (ProgressConnector *pc, Glib::ustring fname, SaveFormat sf, rtengine::procparams::ProcParams &pparams); bool idle_sendToGimp ( ProgressConnector *pc, Glib::ustring fname); bool idle_sentToGimp (ProgressConnector *pc, rtengine::IImage16* img, Glib::ustring filename); + void histogramProfile_toggled (); + Glib::ustring lastSaveAsFileName; bool realized; From 729e50ff2e3bd15a1ab9353db30fdf2a3f67f80f Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 8 Dec 2017 15:54:05 +0100 Subject: [PATCH 43/47] color toning: properly draw hue and strength gradients for the highlights and shadows sliders Fixes #4209 --- rtgui/colortoning.cc | 22 ++++++++++------------ rtgui/thresholdselector.cc | 3 +++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index c5d9252cd..b53f7e5db 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -954,36 +954,34 @@ void ColorToning::colorForValue (double valX, double valY, enum ColorCaller::Ele if (callerId == 1) { // ch - main curve Color::hsv2rgb01(float(valY), 1.0f, 0.5f, R, G, B); } else if (callerId == 2) { // Slider 1 background - if (valY > 0.5) + if (valY <= 0.5) // the hue range { Color::hsv2rgb01(float(valX), 1.0f, 0.5f, R, G, B); } else { // the strength applied to the current hue double strength, hue; - float r_, g_, b_; hlColSat->getValue(strength, hue); - Color::hsv2rgb01(valY * 2.f, 1.f, 1.f, r_, g_, b_); Color::hsv2rgb01(hue / 360.f, 1.f, 1.f, R, G, B); - R = r_ + (R - r_) * valX; - G = g_ + (G - g_) * valX; - B = b_ + (B - b_) * valX; + const double gray = 0.46; + R = (gray * (1.0 - valX)) + R * valX; + G = (gray * (1.0 - valX)) + G * valX; + B = (gray * (1.0 - valX)) + B * valX; } } else if (callerId == 3) { // Slider 2 background - if (valY > 0.5) + if (valY <= 0.5) // the hue range { Color::hsv2rgb01(float(valX), 1.0f, 0.5f, R, G, B); } else { // the strength applied to the current hue double strength, hue; - float r_, g_, b_; shadowsColSat->getValue(strength, hue); - Color::hsv2rgb01(valY * 2.f, 1.f, 1.f, r_, g_, b_); Color::hsv2rgb01(hue / 360.f, 1.f, 1.f, R, G, B); - R = r_ + (R - r_) * valX; - G = g_ + (G - g_) * valX; - B = b_ + (B - b_) * valX; + const double gray = 0.46; + R = (gray * (1.0 - valX)) + R * valX; + G = (gray * (1.0 - valX)) + G * valX; + B = (gray * (1.0 - valX)) + B * valX; } } diff --git a/rtgui/thresholdselector.cc b/rtgui/thresholdselector.cc index 0f9b11cf2..891095e6f 100644 --- a/rtgui/thresholdselector.cc +++ b/rtgui/thresholdselector.cc @@ -284,6 +284,9 @@ void ThresholdSelector::updateBackBuffer() cr->set_line_cap(Cairo::LINE_CAP_BUTT); if (is_sensitive() && coloredBar.canGetColors()) { + if (updatePolicy == RTUP_DYNAMIC) { + coloredBar.setDirty(true); + } // this will eventually create/update the off-screen Surface for the gradient area only ! coloredBar.setDrawRectangle(hb + hwslider, int(float(h) * 1.5f / 7.f + 0.5f), iw + 1, int(float(h) * 4.f / 7.f + 0.5f)); // that we're displaying here From a3d59a864a661ad30cc8193aab2a5515c385cbc6 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 8 Dec 2017 20:40:03 +0100 Subject: [PATCH 44/47] heap-buffer-overflow, fixes #4217 --- rtexif/rtexif.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index bc0e2002f..d44515f6a 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -1671,7 +1671,7 @@ void Tag::toString (char* buffer, int ofs) strcpy (buffer, ""); - for (size_t i = 0; i < maxcount; i++) { + for (size_t i = 0; i < std::min(maxcount, static_cast(valuesize - ofs)); i++) { if (i > 0) { strcat (buffer, ", "); } From d258216d41c9f4bdeb32cac7060efd205c0a6e4e Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sat, 9 Dec 2017 00:34:07 +0100 Subject: [PATCH 45/47] fixed warning reported by clang (forward declaration of ColorManagementParams as class, but it is a struct) --- rtengine/iccstore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/iccstore.h b/rtengine/iccstore.h index 48efae087..bdb15d2c0 100644 --- a/rtengine/iccstore.h +++ b/rtengine/iccstore.h @@ -34,7 +34,7 @@ namespace rtengine namespace procparams { - class ColorManagementParams; + struct ColorManagementParams; } From d7fb8c91360188d3c8eefd645d5199fe0f2767aa Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sat, 9 Dec 2017 00:35:09 +0100 Subject: [PATCH 46/47] Avoid division by zero in RGB_denoise Fix for #4214 --- rtengine/FTblockDN.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 4deb2b7c8..334f97f05 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -658,7 +658,8 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } const float gain = pow(2.0f, float(expcomp)); - float noisevar_Ldetail = SQR(static_cast(SQR(100. - dnparams.Ldetail) + 50.*(100. - dnparams.Ldetail)) * TS * 0.5f); + float params_Ldetail = min(float(dnparams.Ldetail), 99.9f); // max out to avoid div by zero when using noisevar_Ldetail as divisor + float noisevar_Ldetail = SQR(static_cast(SQR(100. - params_Ldetail) + 50.*(100. - params_Ldetail)) * TS * 0.5f); array2D tilemask_in(TS, TS); array2D tilemask_out(TS, TS); From 4cc7861125feb1ad03966c7ca8678a40feceb8dd Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 9 Dec 2017 11:54:23 +0100 Subject: [PATCH 47/47] Fix wrong cast --- rtexif/rtexif.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index d44515f6a..8b57fd239 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -1671,7 +1671,7 @@ void Tag::toString (char* buffer, int ofs) strcpy (buffer, ""); - for (size_t i = 0; i < std::min(maxcount, static_cast(valuesize - ofs)); i++) { + for (size_t i = 0; i < std::min(maxcount, valuesize - ofs); i++) { if (i > 0) { strcat (buffer, ", "); }