Init locallabgtk3

This commit is contained in:
Desmis
2017-01-21 15:34:40 +01:00
parent 928c4c7d02
commit 273e1cb3b2
47 changed files with 18583 additions and 3345 deletions

View File

@@ -45,6 +45,10 @@ class WavOpacityCurveW;
class WavOpacityCurveWL;
class RetinextransmissionCurve;
class RetinexgaintransmissionCurve;
class LocretigainCurve;
class LocretigainCurverab;
class LocLHCurve;
enum RenderingIntent {
RI_PERCEPTUAL = INTENT_PERCEPTUAL,
@@ -73,8 +77,8 @@ public:
initEq1 = startAtOne;
value[0] = bottom;
value[1] = top;
value[2] = T(0);
value[3] = T(0);
value[2] = T (0);
value[3] = T (0);
_isDouble = false;
}
@@ -89,14 +93,14 @@ public:
}
// for convenience, since 'values' is public
void setValues(T bottom, T top)
void setValues (T bottom, T top)
{
value[0] = bottom;
value[1] = top;
}
// for convenience, since 'values' is public
void setValues(T bottomLeft, T topLeft, T bottomRight, T topRight)
void setValues (T bottomLeft, T topLeft, T bottomRight, T topRight)
{
value[0] = bottomLeft;
value[1] = topLeft;
@@ -113,64 +117,64 @@ public:
// RV: Type of the value on the X axis
// RV2: Type of the maximum value on the Y axis
template <typename RT, typename RV, typename RV2>
RT multiply(RV x, RV2 yMax) const
RT multiply (RV x, RV2 yMax) const
{
double val = double(x);
double val = double (x);
if (initEq1) {
if (_isDouble) {
if (val == double(value[2]) && double(value[2]) == double(value[3]))
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,
// useful if one wants to keep the bottom value even beyond the x max bound
{
return RT(0.);
return RT (0.);
}
if (val >= double(value[3])) {
return RT(yMax);
if (val >= double (value[3])) {
return RT (yMax);
}
if (val > double(value[2])) {
return RT(double(yMax) * (val - double(value[2])) / (double(value[3]) - double(value[2])));
if (val > double (value[2])) {
return RT (double (yMax) * (val - double (value[2])) / (double (value[3]) - double (value[2])));
}
}
if (val >= double(value[0])) {
return RT(0);
if (val >= double (value[0])) {
return RT (0);
}
if (val > double(value[1])) {
return RT(double(yMax) * (1. - (val - double(value[0])) / (double(value[1]) - double(value[0]))));
if (val > double (value[1])) {
return RT (double (yMax) * (1. - (val - double (value[0])) / (double (value[1]) - double (value[0]))));
}
return RT(yMax);
return RT (yMax);
} else {
if (_isDouble) {
if (val == double(value[2]) && double(value[2]) == double(value[3]))
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,
// useful if one wants to keep the top value even beyond the x max bound
{
return RT(yMax);
return RT (yMax);
}
if (val >= double(value[2])) {
return RT(0);
if (val >= double (value[2])) {
return RT (0);
}
if (val > double(value[3])) {
return RT(double(yMax) * (1. - (val - double(value[3])) / (double(value[2]) - double(value[3]))));
if (val > double (value[3])) {
return RT (double (yMax) * (1. - (val - double (value[3])) / (double (value[2]) - double (value[3]))));
}
}
if (val >= double(value[1])) {
return RT(yMax);
if (val >= double (value[1])) {
return RT (yMax);
}
if (val > double(value[0])) {
return RT(double(yMax) * (val - double(value[0])) / (double(value[1]) - double(value[0])));
if (val > double (value[0])) {
return RT (double (yMax) * (val - double (value[0])) / (double (value[1]) - double (value[0])));
}
return RT(0);
return RT (0);
}
}
@@ -207,7 +211,7 @@ public:
}
}*/
Threshold<T>& operator =(const Threshold<T> &rhs)
Threshold<T>& operator = (const Threshold<T> &rhs)
{
value[0] = rhs.value[0];
value[1] = rhs.value[1];
@@ -219,21 +223,21 @@ public:
}
template<typename U = T>
typename std::enable_if<std::is_floating_point<U>::value, bool>::type operator ==(const Threshold<U> &rhs) const
typename std::enable_if<std::is_floating_point<U>::value, bool>::type operator == (const Threshold<U> &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;
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;
return std::fabs (value[0] - rhs.value[0]) < 1e-10
&& std::fabs (value[1] - rhs.value[1]) < 1e-10;
}
}
template<typename U = T>
typename std::enable_if<std::is_integral<U>::value, bool>::type operator ==(const Threshold<U> &rhs) const
typename std::enable_if<std::is_integral<U>::value, bool>::type operator == (const Threshold<U> &rhs) const
{
if (_isDouble) {
return
@@ -288,7 +292,7 @@ public:
setDefaults();
}
void setDefaults();
static bool HLReconstructionNecessary(LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw);
static bool HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw);
};
/**
* Parameters of Retinex
@@ -333,11 +337,11 @@ public:
bool medianmap;
RetinexParams ();
void setDefaults();
void getCurves(RetinextransmissionCurve &transmissionCurveLUT, RetinexgaintransmissionCurve &gaintransmissionCurveLUT) const;
void getCurves (RetinextransmissionCurve &transmissionCurveLUT, RetinexgaintransmissionCurve &gaintransmissionCurveLUT) const;
static void getDefaultgaintransmissionCurve(std::vector<double> &curve);
static void getDefaultgaintransmissionCurve (std::vector<double> &curve);
static void getDefaulttransmissionCurve(std::vector<double> &curve);
static void getDefaulttransmissionCurve (std::vector<double> &curve);
};
@@ -433,16 +437,16 @@ public:
ColorToningParams ();
void setDefaults(); // SHOULD BE GENERALIZED TO ALL CLASSES!
/// @brief Transform the mixer values to their curve equivalences
void mixerToCurve(std::vector<double> &colorCurve, std::vector<double> &opacityCurve) const;
void mixerToCurve (std::vector<double> &colorCurve, std::vector<double> &opacityCurve) const;
/// @brief Specifically transform the sliders values to their curve equivalences
void slidersToCurve(std::vector<double> &colorCurve, std::vector<double> &opacityCurve) const;
void slidersToCurve (std::vector<double> &colorCurve, std::vector<double> &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;
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<double> &curve);
static void getDefaultOpacityCurve(std::vector<double> &curve);
static void getDefaultCLCurve(std::vector<double> &curve);
static void getDefaultCL2Curve(std::vector<double> &curve);
static void getDefaultColorCurve (std::vector<double> &curve);
static void getDefaultOpacityCurve (std::vector<double> &curve);
static void getDefaultCLCurve (std::vector<double> &curve);
static void getDefaultCL2Curve (std::vector<double> &curve);
};
/**
@@ -467,7 +471,7 @@ public:
int deconviter;
int deconvdamping;
SharpeningParams() : threshold(20, 80, 2000, 1200, false) {};
SharpeningParams() : threshold (20, 80, 2000, 1200, false) {};
};
class SharpenEdgeParams
{
@@ -502,7 +506,7 @@ public:
bool pastsattog;
std::vector<double> skintonescurve;
VibranceParams() : psthreshold(0, 75, false) {};
VibranceParams() : psthreshold (0, 75, false) {};
};
/**
@@ -547,7 +551,7 @@ public:
double green;
double equal;
WBEntry(const Glib::ustring &p, enum WBTypes t, const Glib::ustring &l, int temp, double green, double equal) : ppLabel(p), type(t), GUILabel(l), temperature(temp), green(green), equal(equal) {};
WBEntry (const Glib::ustring &p, enum WBTypes t, const Glib::ustring &l, int temp, double green, double equal) : ppLabel (p), type (t), GUILabel (l), temperature (temp), green (green), equal (equal) {};
};
class WBParams
@@ -709,10 +713,10 @@ public:
DirPyrDenoiseParams ();
void setDefaults(); // SHOULD BE GENERALIZED TO ALL CLASSES!
void getCurves(NoiseCurve &lCurve, NoiseCurve &cCurve) const;
void getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) const;
static void getDefaultNoisCurve(std::vector<double> &curve);
static void getDefaultCCCurve(std::vector<double> &curve);
static void getDefaultNoisCurve (std::vector<double> &curve);
static void getDefaultCCCurve (std::vector<double> &curve);
};
@@ -762,8 +766,8 @@ 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() : 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;
};
/**
@@ -854,6 +858,101 @@ public:
int centerX;
int centerY;
};
/**
* Parameters of the Local Lab
*/
class LocallabParams
{
public:
bool enabled;
double degree;
int locY;
int locX;
int locYT;
int locXL;
int centerX;
int centerY;
int circrad;
int thres;
int proxi;
Glib::ustring qualityMethod;
bool expcolor;
bool expblur;
bool exptonemap;
bool expreti;
bool expsharp;
bool expcbdl;
bool expdenoi;
int lightness;
int contrast;
int chroma;
int sharradius;
int sharamount;
int shardamping;
int shariter;
int noiselumf;
int noiselumc;
int noisechrof;
int noisechroc;
int sensi;
int sensih;
int retrab;
int sensicb;
int sensibn;
int sensisha;
int sensitm;
int radius;
int strength;
int stren;
int gamma;
int estop;
int scaltm;
int rewei;
int transit;
bool avoid;
Glib::ustring Smethod;
Glib::ustring retinexMethod;
bool invers;
bool curvactiv;
bool activlum;
bool inversrad;
bool inversret;
bool inverssha;
double hueref;
double chromaref;
double lumaref;
int str;
int neigh;
int nbspot;
int anbspot;
int vart;
int chrrt;
std::vector<double> localTgaincurve;
std::vector<double> localTgaincurverab;
std::vector<double> llcurve;
std::vector<double> LHcurve;
double mult[5];
double threshold;
LocallabParams ()
{
setDefaults();
}
void setDefaults();
void getCurves (LocretigainCurve &cTgainCurve, LocretigainCurverab &cTgainCurverab, LocLHCurve & lhCurve) const;
static void getDefaultLocalgainCurveT (std::vector<double> &curve);
static void getDefaultLocalgainCurveTrab (std::vector<double> &curve);
static void getDefaultLLCurve (std::vector<double> &curve);
static void getDefaultLHCurve (std::vector<double> &curve);
};
/**
* Parameters of the post-crop vignette filter
@@ -1106,12 +1205,12 @@ public:
WaveletParams ();
void setDefaults();
void getCurves(WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG , WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const;
static void getDefaultCCWCurve(std::vector<double> &curve);
static void getDefaultOpacityCurveRG(std::vector<double> &curve);
static void getDefaultOpacityCurveBY(std::vector<double> &curve);
static void getDefaultOpacityCurveW(std::vector<double> &curve);
static void getDefaultOpacityCurveWL(std::vector<double> &curve);
void getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG , WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const;
static void getDefaultCCWCurve (std::vector<double> &curve);
static void getDefaultOpacityCurveRG (std::vector<double> &curve);
static void getDefaultOpacityCurveBY (std::vector<double> &curve);
static void getDefaultOpacityCurveW (std::vector<double> &curve);
static void getDefaultOpacityCurveWL (std::vector<double> &curve);
};
@@ -1131,7 +1230,7 @@ public:
Threshold<int> hueskin;
//Glib::ustring algo;
Glib::ustring cbdlMethod;
DirPyrEqualizerParams() : hueskin(20, 80, 2000, 1200, false) {};
DirPyrEqualizerParams() : hueskin (20, 80, 2000, 1200, false) {};
};
/**
@@ -1297,6 +1396,7 @@ public:
LensProfParams lensProf; ///< Lens correction profile parameters
PerspectiveParams perspective; ///< Perspective correction parameters
GradientParams gradient; ///< Gradient filter parameters
LocallabParams locallab; ///< Local lab parameters
PCVignetteParams pcvignette; ///< Post-crop vignette filter parameters
CACorrParams cacorrection; ///< Lens c/a correction parameters
VignettingParams vignetting; ///< Lens vignetting correction parameters
@@ -1314,7 +1414,7 @@ public:
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
int prot;
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
@@ -1383,7 +1483,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;
@@ -1408,7 +1508,7 @@ public:
class AutoPartialProfile : public PartialProfile
{
public:
AutoPartialProfile() : PartialProfile(true) {}
AutoPartialProfile() : PartialProfile (true) {}
~AutoPartialProfile()
{
deleteInstance();