Merge branch 'dev' into spot-removal-tool

This commit is contained in:
Hombre
2019-03-18 22:35:11 +01:00
2691 changed files with 93967 additions and 238984 deletions

View File

@@ -27,10 +27,9 @@
#include <lcms2.h>
#include "coord.h"
#include "LUT.h"
#include "noncopyable.h"
class ParamsEdited;
struct ParamsEdited;
namespace rtengine
{
@@ -46,7 +45,7 @@ class WavOpacityCurveRG;
class WavOpacityCurveW;
class WavOpacityCurveWL;
enum RenderingIntent {
enum RenderingIntent : int {
RI_PERCEPTUAL = INTENT_PERCEPTUAL,
RI_RELATIVE = INTENT_RELATIVE_COLORIMETRIC,
RI_SATURATION = INTENT_SATURATION,
@@ -76,14 +75,14 @@ public:
{
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;
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;
std::fabs(bottom_left - rhs.bottom_left) < 1e-10
&& std::fabs(top_left - rhs.top_left) < 1e-10;
}
}
@@ -113,7 +112,7 @@ public:
return top_left;
}
T getBottomLeft() const
T getBottomLeft() const
{
return bottom_left;
}
@@ -123,7 +122,7 @@ public:
return top_left;
}
T getBottomRight() const
T getBottomRight() const
{
return bottom_right;
}
@@ -173,7 +172,7 @@ 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 y_max) const
RT multiply(RV x, RV2 y_max) const
{
const double val = x;
@@ -251,36 +250,38 @@ private:
bool is_double;
};
enum class ToneCurveMode : int {
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
};
/**
* Parameters of the tone curve
*/
struct ToneCurveParams {
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
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;
double clip;
bool hrenabled; // Highlight Reconstruction enabled
Glib::ustring method; // Highlight Reconstruction's method
double expcomp;
std::vector<double> curve;
std::vector<double> curve2;
TcMode curveMode;
TcMode curveMode2;
int brightness;
int black;
int contrast;
int saturation;
int shcompr;
int hlcompr; // Highlight Recovery's compression
int hlcomprthresh; // Highlight Recovery's threshold
bool autoexp;
double clip;
bool hrenabled; // Highlight Reconstruction enabled
Glib::ustring method; // Highlight Reconstruction's method
double expcomp;
std::vector<double> curve;
std::vector<double> curve2;
ToneCurveMode curveMode;
ToneCurveMode curveMode2;
int brightness;
int black;
int contrast;
int saturation;
int shcompr;
int hlcompr; // Highlight Recovery's compression
int hlcomprthresh; // Highlight Recovery's threshold
bool histmatching; // histogram matching
bool fromHistMatching;
bool clampOOG; // clamp out of gamut colours
ToneCurveParams();
@@ -292,8 +293,7 @@ struct ToneCurveParams {
/**
* Parameters of Retinex
*/
struct RetinexParams
{
struct RetinexParams {
bool enabled;
std::vector<double> cdcurve;
std::vector<double> cdHcurve;
@@ -339,8 +339,7 @@ struct RetinexParams
/**
* Parameters of the luminance curve
*/
struct LCurveParams
{
struct LCurveParams {
bool enabled;
std::vector<double> lcurve;
std::vector<double> acurve;
@@ -367,7 +366,7 @@ struct LCurveParams
/**
* Parameters for local contrast
*/
*/
struct LocalContrastParams {
bool enabled;
int radius;
@@ -453,6 +452,28 @@ struct ColorToningParams {
double labgridAHigh;
double labgridBHigh;
static const double LABGRID_CORR_MAX;
static const double LABGRID_CORR_SCALE;
struct LabCorrectionRegion {
enum { CHAN_ALL = -1, CHAN_R, CHAN_G, CHAN_B };
double a;
double b;
double saturation;
double slope;
double offset;
double power;
std::vector<double> hueMask;
std::vector<double> chromaticityMask;
std::vector<double> lightnessMask;
double maskBlur;
int channel;
LabCorrectionRegion();
bool operator==(const LabCorrectionRegion &other) const;
bool operator!=(const LabCorrectionRegion &other) const;
};
std::vector<LabCorrectionRegion> labregions;
int labregionsShowMask;
ColorToningParams();
@@ -472,6 +493,8 @@ struct ColorToningParams {
*/
struct SharpeningParams {
bool enabled;
double contrast;
double blurradius;
double radius;
int amount;
Threshold<int> threshold;
@@ -508,7 +531,8 @@ struct SharpenMicroParams {
bool enabled;
bool matrix;
double amount;
double uniformity;
double contrast;
int uniformity;
SharpenMicroParams();
@@ -649,7 +673,7 @@ struct ColorAppearanceParams {
struct DefringeParams {
bool enabled;
double radius;
float threshold;
int threshold;
std::vector<double> huecurve;
DefringeParams();
@@ -728,6 +752,7 @@ struct FattalToneMappingParams {
bool enabled;
int threshold;
int amount;
int anchor;
FattalToneMappingParams();
@@ -740,12 +765,12 @@ struct FattalToneMappingParams {
*/
struct SHParams {
bool enabled;
bool hq;
int highlights;
int htonalwidth;
int shadows;
int stonalwidth;
int radius;
bool lab;
SHParams();
@@ -996,6 +1021,7 @@ struct ResizeParams {
int dataspec;
int width;
int height;
bool allowUpscaling;
ResizeParams();
@@ -1006,8 +1032,7 @@ struct ResizeParams {
/**
* Parameters entry
*/
struct SpotEntry
{
struct SpotEntry {
Coord sourcePos;
Coord targetPos;
int radius;
@@ -1023,8 +1048,7 @@ struct SpotEntry
/**
* Parameters of the dust removal tool
*/
struct SpotParams
{
struct SpotParams {
bool enabled;
std::vector<SpotEntry> entries;
@@ -1043,22 +1067,22 @@ struct SpotParams
* Parameters of the color spaces used during the processing
*/
struct ColorManagementParams {
Glib::ustring input;
bool toneCurve;
bool applyLookTable;
bool applyBaselineExposureOffset;
bool applyHueSatMap;
Glib::ustring inputProfile;
bool toneCurve;
bool applyLookTable;
bool applyBaselineExposureOffset;
bool applyHueSatMap;
int dcpIlluminant;
Glib::ustring working;
Glib::ustring output;
Glib::ustring workingProfile;
Glib::ustring workingTRC;
double workingTRCGamma;
double workingTRCSlope;
Glib::ustring outputProfile;
RenderingIntent outputIntent;
bool outputBPC;
Glib::ustring gamma;
double gampos;
double slpos;
bool freegamma;
static const Glib::ustring NoICMString;
ColorManagementParams();
@@ -1087,14 +1111,89 @@ struct MetaDataParams {
/**
* Typedef for representing a key/value for the exif metadata information
* Minimal wrapper allowing forward declaration for representing a key/value for the exif metadata information
*/
typedef std::map<Glib::ustring, Glib::ustring> ExifPairs;
class ExifPairs final
{
public:
using const_iterator = std::map<Glib::ustring, Glib::ustring>::const_iterator;
const_iterator begin() const
{
return pairs.begin();
}
const_iterator end() const
{
return pairs.end();
}
void clear()
{
pairs.clear();
}
Glib::ustring& operator[](const Glib::ustring& key)
{
return pairs[key];
}
bool operator ==(const ExifPairs& other) const
{
return pairs == other.pairs;
}
private:
std::map<Glib::ustring, Glib::ustring> pairs;
};
/**
* The IPTC key/value pairs
*/
typedef std::map<Glib::ustring, std::vector<Glib::ustring>> IPTCPairs;
class IPTCPairs final
{
public:
using iterator = std::map<Glib::ustring, std::vector<Glib::ustring>>::iterator;
using const_iterator = std::map<Glib::ustring, std::vector<Glib::ustring>>::const_iterator;
iterator find(const Glib::ustring& key)
{
return pairs.find(key);
}
const_iterator begin() const
{
return pairs.begin();
}
const_iterator end() const
{
return pairs.end();
}
bool empty() const
{
return pairs.empty();
}
void clear()
{
pairs.clear();
}
std::vector<Glib::ustring>& operator[](const Glib::ustring& key)
{
return pairs[key];
}
bool operator ==(const IPTCPairs& other) const
{
return pairs == other.pairs;
}
private:
std::map<Glib::ustring, std::vector<Glib::ustring>> pairs;
};
struct WaveletParams {
std::vector<double> ccwcurve;
@@ -1133,7 +1232,7 @@ struct WaveletParams {
bool exptoning;
bool expnoise;
Glib::ustring Lmethod;
int Lmethod;
Glib::ustring CLmethod;
Glib::ustring Backmethod;
Glib::ustring Tilesmethod;
@@ -1247,6 +1346,30 @@ struct FilmSimulationParams {
};
struct SoftLightParams {
bool enabled;
int strength;
SoftLightParams();
bool operator==(const SoftLightParams &other) const;
bool operator!=(const SoftLightParams &other) const;
};
struct DehazeParams {
bool enabled;
int strength;
bool showDepthMap;
int depth;
DehazeParams();
bool operator==(const DehazeParams &other) const;
bool operator!=(const DehazeParams &other) const;
};
/**
* Parameters for RAW demosaicing, common to all sensor type
*/
@@ -1257,27 +1380,21 @@ struct RAWParams {
struct BayerSensor {
enum class Method {
AMAZE,
IGV,
AMAZEVNG4,
RCD,
RCDVNG4,
DCB,
DCBVNG4,
LMMSE,
IGV,
AHD,
EAHD,
HPHD,
VNG4,
DCB,
AHD,
RCD,
FAST,
MONO,
NONE,
PIXELSHIFT
};
enum class PSMotionCorrection {
GRID_1X1,
GRID_1X2,
GRID_3X3,
GRID_5X5,
GRID_7X7,
GRID_3X3_NEW
PIXELSHIFT,
NONE
};
enum class PSMotionCorrectionMethod {
@@ -1286,7 +1403,14 @@ struct RAWParams {
CUSTOM
};
enum class PSDemosaicMethod {
AMAZE,
AMAZEVNG4,
LMMSE
};
Glib::ustring method;
int border;
int imageNum;
int ccSteps;
double black0;
@@ -1295,41 +1419,34 @@ struct RAWParams {
double black3;
bool twogreen;
int linenoise;
enum class LineNoiseDirection {
HORIZONTAL = 1,
VERTICAL,
BOTH,
PDAF_LINES = 5
};
LineNoiseDirection linenoiseDirection;
int greenthresh;
int dcb_iterations;
int lmmse_iterations;
int pixelShiftMotion;
PSMotionCorrection pixelShiftMotionCorrection;
bool dualDemosaicAutoContrast;
double dualDemosaicContrast;
PSMotionCorrectionMethod pixelShiftMotionCorrectionMethod;
double pixelShiftStddevFactorGreen;
double pixelShiftStddevFactorRed;
double pixelShiftStddevFactorBlue;
double pixelShiftEperIso;
double pixelShiftNreadIso;
double pixelShiftPrnu;
double pixelShiftSigma;
double pixelShiftSum;
double pixelShiftRedBlueWeight;
bool pixelShiftShowMotion;
bool pixelShiftShowMotionMaskOnly;
bool pixelShiftAutomatic;
bool pixelShiftNonGreenHorizontal;
bool pixelShiftNonGreenVertical;
bool pixelShiftHoleFill;
bool pixelShiftMedian;
bool pixelShiftMedian3;
bool pixelShiftGreen;
bool pixelShiftBlur;
double pixelShiftSmoothFactor;
bool pixelShiftExp0;
bool pixelShiftLmmse;
bool pixelShiftOneGreen;
bool pixelShiftEqualBright;
bool pixelShiftEqualBrightChannel;
bool pixelShiftNonGreenCross;
bool pixelShiftNonGreenCross2;
bool pixelShiftNonGreenAmaze;
Glib::ustring pixelShiftDemosaicMethod;
bool dcb_enhance;
bool pdafLinesFilter;
BayerSensor();
@@ -1340,6 +1457,9 @@ struct RAWParams {
static const std::vector<const char*>& getMethodStrings();
static Glib::ustring getMethodString(Method method);
static const std::vector<const char*>& getPSDemosaicMethodStrings();
static Glib::ustring getPSDemosaicMethodString(PSDemosaicMethod method);
};
/**
@@ -1347,7 +1467,9 @@ struct RAWParams {
*/
struct XTransSensor {
enum class Method {
FOUR_PASS,
THREE_PASS,
TWO_PASS,
ONE_PASS,
FAST,
MONO,
@@ -1355,6 +1477,9 @@ struct RAWParams {
};
Glib::ustring method;
bool dualDemosaicAutoContrast;
double dualDemosaicContrast;
int border;
int ccSteps;
double blackred;
double blackgreen;
@@ -1367,7 +1492,7 @@ struct RAWParams {
static const std::vector<const char*>& getMethodStrings();
static Glib::ustring getMethodString(Method method);
};
};
BayerSensor bayersensor; ///< RAW parameters for Bayer sensors
XTransSensor xtranssensor; ///< RAW parameters for X-Trans sensors
@@ -1390,12 +1515,13 @@ struct RAWParams {
int ff_clipControl;
bool ca_autocorrect;
bool ca_avoidcolourshift;
int caautoiterations;
double cared;
double cablue;
// exposure before interpolation
double expos;
double preser;
bool hotPixelFilter;
bool deadPixelFilter;
@@ -1457,6 +1583,8 @@ public:
DirPyrEqualizerParams dirpyrequalizer; ///< directional pyramid wavelet parameters
HSVEqualizerParams hsvequalizer; ///< hsv wavelet parameters
FilmSimulationParams filmSimulation; ///< film simulation parameters
SoftLightParams softlight; ///< softlight parameters
DehazeParams dehaze; ///< dehaze parameters
int rank; ///< Custom image quality ranking
int colorlabel; ///< Custom color label
bool inTrash; ///< Marks deleted image
@@ -1496,7 +1624,7 @@ public:
/** 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. */
@@ -1523,7 +1651,7 @@ private:
* saving too)
*
* PartialProfile is not responsible of ProcParams and ParamsEdited object creation
* and hence is not responsible of their destructions. The function that instanciate
* and hence is not responsible of their destructions. The function that instantiate
* PartialProfile object has to handle all this itself.
*/
class PartialProfile :
@@ -1537,7 +1665,7 @@ public:
void clearGeneral();
int load(const Glib::ustring& fName);
void set(bool v);
void applyTo(ProcParams* destParams) const ;
void applyTo(ProcParams* destParams, bool fromLastSaved = false) const ;
rtengine::procparams::ProcParams* pparams;
ParamsEdited* pedited;