From c2960caab52804eaf7eb691bdf62502f73987f4c Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Wed, 13 Sep 2017 15:06:47 +0200 Subject: [PATCH] some (minor) code cleanup --- rtengine/dcrop.cc | 3 --- rtengine/improccoordinator.cc | 9 ++------- rtengine/improcfun.h | 2 -- rtengine/iptransform.cc | 19 ++----------------- rtengine/rtthumbnail.cc | 8 -------- rtengine/rtthumbnail.h | 2 -- rtengine/simpleprocess.cc | 6 +----- rtgui/cacheimagedata.h | 5 ----- rtgui/lensgeom.h | 2 -- 9 files changed, 5 insertions(+), 51 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 92416917d..25710205f 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -699,9 +699,6 @@ void Crop::update (int todo) if (needstransform) parent->ipf.transform (baseCrop, transCrop, cropx / skip, cropy / skip, trafx / skip, trafy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->getFullWidth(), parent->getFullHeight(), parent->imgsrc->getMetaData(), - // parent->imgsrc->getMetaData()->getFocalLen(), parent->imgsrc->getMetaData()->getFocalLen35mm(), - // parent->imgsrc->getMetaData()->getFocusDist(), - // parent->imgsrc->getMetaData()->getFNumber(), parent->imgsrc->getRotateDegree(), false); else { baseCrop->copyData (transCrop); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 8a3b979ae..2b9edc3d6 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -401,10 +401,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (needstransform) ipf.transform (orig_prev, oprevi, 0, 0, 0, 0, pW, pH, fw, fh, - imgsrc->getMetaData(), - // imgsrc->getMetaData()->getFocalLen(), - // imgsrc->getMetaData()->getFocalLen35mm(), imgsrc->getMetaData()->getFocusDist(), imgsrc->getMetaData()->getFNumber(), - imgsrc->getRotateDegree(), false); + imgsrc->getMetaData(), imgsrc->getRotateDegree(), false); else { orig_prev->copyData (oprevi); } @@ -1223,9 +1220,7 @@ void ImProcCoordinator::saveInputICCReference (const Glib::ustring& fname, bool if (ipf.needsTransform()) { Imagefloat* trImg = new Imagefloat (fW, fH); ipf.transform (im, trImg, 0, 0, 0, 0, fW, fH, fW, fH, - imgsrc->getMetaData(), - // imgsrc->getMetaData()->getFocalLen(), imgsrc->getMetaData()->getFocalLen35mm(), imgsrc->getMetaData()->getFocusDist(), imgsrc->getMetaData()->getFNumber(), - imgsrc->getRotateDegree(), true); + imgsrc->getMetaData(), imgsrc->getRotateDegree(), true); delete im; im = trImg; } diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 1bcca4d37..e48ec3c7f 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -240,8 +240,6 @@ public: void colorCurve (LabImage* lold, LabImage* lnew); void sharpening (LabImage* lab, float** buffer, SharpeningParams &sharpenParam); void sharpeningcam (CieImage* ncie, float** buffer); - /* void transform (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, */ - /* double focalLen, double focalLen35mm, float focusDist, double fNumber, int rawRotationDeg, bool fullImage); */ void transform (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const ImageMetaData *metadata, int rawRotationDeg, bool fullImage); float resizeScale (const ProcParams* params, int fw, int fh, int &imw, int &imh); void lab2monitorRgb (LabImage* lab, Image8* image); diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index e5f3a7af1..3f7472f6f 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -87,20 +87,6 @@ float normn (float a, float b, int n) } -inline void correct_distortion(const rtengine::LensCorrection *lcp, double &x, double &y, - int cx, int cy, double scale) -{ - assert (lcp); - - // x += cx; - // y += cy; - // std::cout << "DIST: x=" << x << ", y=" << y; - lcp->correctDistortion(x, y, cx, cy, scale); - // std::cout << " --> pos[0]=" << x << ", pos[1]=" << y << std::endl; - // x -= (cx * scale); - // y -= (cy * scale); -} - } namespace rtengine @@ -160,7 +146,7 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector &src, double x_d = src[i].x, y_d = src[i].y; if (pLCPMap && params->lensProf.useDist) { - correct_distortion (pLCPMap, x_d, y_d, 0, 0, ascale); + pLCPMap->correctDistortion(x_d, y_d, 0, 0, ascale); } else { x_d *= ascale; y_d *= ascale; @@ -311,7 +297,6 @@ bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int& void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const ImageMetaData *metadata, - //double focalLen, double focalLen35mm, float focusDist, double fNumber, int rawRotationDeg, bool fullImage) { double focalLen = metadata->getFocalLen(); @@ -831,7 +816,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag double x_d = x, y_d = y; if (enableLCPDist) { - correct_distortion(pLCPMap, x_d, y_d, cx, cy, ascale); // must be first transform + pLCPMap->correctDistortion(x_d, y_d, cx, cy, ascale); // must be first transform } else { x_d *= ascale; y_d *= ascale; diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index a5d951de2..065d4640c 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -954,8 +954,6 @@ IImage8* Thumbnail::quickProcessImage (const procparams::ProcParams& params, int } // Full thumbnail processing, second stage if complete profile exists -// IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rheight, TypeInterpolation interp, std::string camName, -// double focalLen, double focalLen35mm, float focusDist, float shutter, float fnumber, float iso, std::string expcomp_, double& myscale) IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rheight, TypeInterpolation interp, const ImageMetaData *metadata, double& myscale) { std::string camName = metadata->getCamera(); @@ -1086,7 +1084,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei int origFH; double tscale = 0.0; getDimensions (origFW, origFH, tscale); - // ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, origFW * tscale + 0.5, origFH * tscale + 0.5, focalLen, focalLen35mm, focusDist, fnumber, 0, true); // Raw rotate degree not detectable here ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, origFW * tscale + 0.5, origFH * tscale + 0.5, metadata, 0, true); // Raw rotate degree not detectable here delete baseImg; baseImg = trImg; @@ -1286,11 +1283,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei float fnum = fnumber;// F number float fiso = iso;// ISO float fspeed = shutter;//speed - // char * writ = new char[expcomp_.size() + 1];//convert expcomp_ to char - // std::copy (expcomp_.begin(), expcomp_.end(), writ); - // writ[expcomp_.size()] = '\0'; - // float fcomp = atof (writ); //compensation + - - // delete[] writ; float adap; if (fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) diff --git a/rtengine/rtthumbnail.h b/rtengine/rtthumbnail.h index 4fc3466c8..3610a530f 100644 --- a/rtengine/rtthumbnail.h +++ b/rtengine/rtthumbnail.h @@ -71,8 +71,6 @@ public: void init (); - // IImage8* processImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, std::string camName, - // double focalLen, double focalLen35mm, float focusDist, float shutter, float fnumber, float iso, std::string expcomp_, double& scale); IImage8* processImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, const ImageMetaData *metadata, double& scale); IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale); int getImageWidth (const procparams::ProcParams& pparams, int rheight, float &ratio); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index fabcf2158..fd0a67411 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -814,11 +814,7 @@ private: if (ipf.needsTransform()) { Imagefloat* trImg = new Imagefloat (fw, fh); ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh, - imgsrc->getMetaData(), - // imgsrc->getMetaData()->getFocalLen(), imgsrc->getMetaData()->getFocalLen35mm(), - // imgsrc->getMetaData()->getFocusDist(), - // imgsrc->getMetaData()->getFNumber(), - imgsrc->getRotateDegree(), true); + imgsrc->getMetaData(), imgsrc->getRotateDegree(), true); delete baseImg; baseImg = trImg; } diff --git a/rtgui/cacheimagedata.h b/rtgui/cacheimagedata.h index 0af6d4fcf..e1c317508 100644 --- a/rtgui/cacheimagedata.h +++ b/rtgui/cacheimagedata.h @@ -77,11 +77,6 @@ public: int load (const Glib::ustring& fname); int save (const Glib::ustring& fname); - // Glib::ustring getCamera() const - // { - // return Glib::ustring(camMake + " " + camModel); - // } - //------------------------------------------------------------------------- // ImageMetaData interface //------------------------------------------------------------------------- diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h index aa473cb91..29b0c7f20 100644 --- a/rtgui/lensgeom.h +++ b/rtgui/lensgeom.h @@ -44,8 +44,6 @@ public: return packBox; } - Gtk::CheckButton *getFill() { return fill; } - void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr); void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr); void setBatchMode (bool batchMode);