Make ImProcFunctions::transCoord() const

This commit is contained in:
Flössie 2019-10-08 14:12:42 +02:00
parent 1a3d4504d1
commit f7c57eeeda
2 changed files with 26 additions and 26 deletions

View File

@ -67,14 +67,14 @@ class ImProcFunctions
void transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); void transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap);
void transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap); void transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap);
bool needsCA(); bool needsCA() const;
bool needsDistortion(); bool needsDistortion() const;
bool needsRotation(); bool needsRotation() const;
bool needsPerspective(); bool needsPerspective() const;
bool needsGradient(); bool needsGradient() const;
bool needsVignetting(); bool needsVignetting() const;
bool needsLCP(); bool needsLCP() const;
bool needsLensfun(); bool needsLensfun() const;
// static cmsUInt8Number* Mempro = NULL; // static cmsUInt8Number* Mempro = NULL;
@ -99,8 +99,8 @@ public:
} }
void setScale(double iscale); void setScale(double iscale);
bool needsTransform(); bool needsTransform() const;
bool needsPCVignetting(); bool needsPCVignetting() const;
void firstAnalysis(const Imagefloat* const working, const procparams::ProcParams &params, LUTu & vhist16); void firstAnalysis(const Imagefloat* const working, const procparams::ProcParams &params, LUTu & vhist16);
void updateColorProfiles(const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); void updateColorProfiles(const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck);
@ -247,11 +247,11 @@ public:
// CieImage *ciec; // CieImage *ciec;
void workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, int ch, int mul, const Glib::ustring &profile, double gampos, double slpos, cmsHTRANSFORM &transform, bool normalizeIn = true, bool normalizeOut = true, bool keepTransForm = false) const; void workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, int ch, int mul, const Glib::ustring &profile, double gampos, double slpos, cmsHTRANSFORM &transform, bool normalizeIn = true, bool normalizeOut = true, bool keepTransForm = false) const;
bool transCoord(int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); bool transCoord(int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr) const;
bool transCoord(int W, int H, const std::vector<Coord2D> &src, std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); bool transCoord(int W, int H, const std::vector<Coord2D> &src, std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr) const;
static void getAutoExp(const LUTu & histogram, int histcompr, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh); static void getAutoExp(const LUTu & histogram, int histcompr, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh);
static double getAutoDistor(const Glib::ustring& fname, int thumb_size); static double getAutoDistor(const Glib::ustring& fname, int thumb_size);
double getTransformAutoFill(int oW, int oH, const LensCorrection *pLCPMap = nullptr); double getTransformAutoFill(int oW, int oH, const LensCorrection *pLCPMap = nullptr) const;
void rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace); void rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace);
void lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace); void lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace);
}; };

View File

@ -208,7 +208,7 @@ namespace rtengine
#define CLIPTOC(a,b,c,d) ((a)>=(b)?((a)<=(c)?(a):(d=true,(c))):(d=true,(b))) #define CLIPTOC(a,b,c,d) ((a)>=(b)?((a)<=(c)?(a):(d=true,(c))):(d=true,(b)))
bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src, std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, double ascaleDef, bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src, std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, double ascaleDef,
const LensCorrection *pLCPMap) const LensCorrection *pLCPMap) const
{ {
bool clipped = false; bool clipped = false;
@ -310,7 +310,7 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src,
} }
// Transform all corners and critical sidelines of an image // Transform all corners and critical sidelines of an image
bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef, const LensCorrection *pLCPMap) bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef, const LensCorrection *pLCPMap) const
{ {
const int DivisionsPerBorder = 32; const int DivisionsPerBorder = 32;
@ -1113,7 +1113,7 @@ void ImProcFunctions::transformLCPCAOnly(Imagefloat *original, Imagefloat *trans
} }
double ImProcFunctions::getTransformAutoFill (int oW, int oH, const LensCorrection *pLCPMap) double ImProcFunctions::getTransformAutoFill (int oW, int oH, const LensCorrection *pLCPMap) const
{ {
if (!needsCA() && !needsDistortion() && !needsRotation() && !needsPerspective() && (!params->lensProf.useDist || pLCPMap == nullptr)) { if (!needsCA() && !needsDistortion() && !needsRotation() && !needsPerspective() && (!params->lensProf.useDist || pLCPMap == nullptr)) {
return 1; return 1;
@ -1137,52 +1137,52 @@ double ImProcFunctions::getTransformAutoFill (int oW, int oH, const LensCorrecti
return scaleL; return scaleL;
} }
bool ImProcFunctions::needsCA () bool ImProcFunctions::needsCA () const
{ {
return fabs (params->cacorrection.red) > 1e-15 || fabs (params->cacorrection.blue) > 1e-15; return fabs (params->cacorrection.red) > 1e-15 || fabs (params->cacorrection.blue) > 1e-15;
} }
bool ImProcFunctions::needsDistortion () bool ImProcFunctions::needsDistortion () const
{ {
return fabs (params->distortion.amount) > 1e-15; return fabs (params->distortion.amount) > 1e-15;
} }
bool ImProcFunctions::needsRotation () bool ImProcFunctions::needsRotation () const
{ {
return fabs (params->rotate.degree) > 1e-15; return fabs (params->rotate.degree) > 1e-15;
} }
bool ImProcFunctions::needsPerspective () bool ImProcFunctions::needsPerspective () const
{ {
return params->perspective.horizontal || params->perspective.vertical; return params->perspective.horizontal || params->perspective.vertical;
} }
bool ImProcFunctions::needsGradient () bool ImProcFunctions::needsGradient () const
{ {
return params->gradient.enabled && fabs (params->gradient.strength) > 1e-15; return params->gradient.enabled && fabs (params->gradient.strength) > 1e-15;
} }
bool ImProcFunctions::needsPCVignetting () bool ImProcFunctions::needsPCVignetting () const
{ {
return params->pcvignette.enabled && fabs (params->pcvignette.strength) > 1e-15; return params->pcvignette.enabled && fabs (params->pcvignette.strength) > 1e-15;
} }
bool ImProcFunctions::needsVignetting () bool ImProcFunctions::needsVignetting () const
{ {
return params->vignetting.amount; return params->vignetting.amount;
} }
bool ImProcFunctions::needsLCP () bool ImProcFunctions::needsLCP () const
{ {
return params->lensProf.useLcp(); return params->lensProf.useLcp();
} }
bool ImProcFunctions::needsLensfun() bool ImProcFunctions::needsLensfun() const
{ {
return params->lensProf.useLensfun(); return params->lensProf.useLensfun();
} }
bool ImProcFunctions::needsTransform () bool ImProcFunctions::needsTransform () const
{ {
return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsLensfun(); return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsLensfun();
} }