From 80f2b6a00281be746ff6275b9e23f6b1a429b9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Fri, 14 Jun 2019 08:58:04 +0200 Subject: [PATCH] Replace raw arrays with `std::array<>` --- rtengine/filmnegativeproc.cc | 4 ++-- rtengine/imagesource.h | 3 ++- rtengine/improccoordinator.cc | 2 +- rtengine/improccoordinator.h | 2 +- rtengine/rawimagesource.h | 8 ++++---- rtengine/rtengine.h | 37 +++++++++++++++++++---------------- rtgui/filmnegative.cc | 6 +++--- rtgui/filmnegative.h | 22 ++++++++++----------- rtgui/toolpanelcoord.cc | 2 +- rtgui/toolpanelcoord.h | 2 +- 10 files changed, 46 insertions(+), 42 deletions(-) diff --git a/rtengine/filmnegativeproc.cc b/rtengine/filmnegativeproc.cc index db98fdf02..871b7a1d9 100644 --- a/rtengine/filmnegativeproc.cc +++ b/rtengine/filmnegativeproc.cc @@ -82,7 +82,7 @@ float logBase(float base, float num) { return log(num) / log(base); } -bool RawImageSource::getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams ¤tParams, float newExps[3]) +bool RawImageSource::getFilmNegativeExponents(Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams ¤tParams, std::array& newExps) { float clearVals[3], denseVals[3]; @@ -317,4 +317,4 @@ void RawImageSource::filmNegativeProcess(const procparams::FilmNegativeParams &p } } -} \ No newline at end of file +} diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 0a34b6bc8..bf73b5bb2 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -18,6 +18,7 @@ */ #pragma once +#include #include #include @@ -81,7 +82,7 @@ public: virtual int load (const Glib::ustring &fname) = 0; virtual void preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) {}; virtual void filmNegativeProcess (const procparams::FilmNegativeParams ¶ms) {}; - virtual bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams ¤tParams, float newExps[3]) { return false; }; + virtual bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams& currentParams, std::array& newExps) { return false; }; virtual void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold) {}; virtual void retinex (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &deh, const procparams::ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; virtual void retinexPrepareCurves (const procparams::RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index fb6250183..6f471eedf 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -1262,7 +1262,7 @@ void ImProcCoordinator::getSpotWB(int x, int y, int rect, double& temp, double& } } -bool ImProcCoordinator::getFilmNegativeExponents(int xA, int yA, int xB, int yB, float* newExps) +bool ImProcCoordinator::getFilmNegativeExponents(int xA, int yA, int xB, int yB, std::array& newExps) { MyMutex::MyLock lock(mProcessing); diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index d10db8d70..fdf74d297 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -269,7 +269,7 @@ public: bool getAutoWB (double& temp, double& green, double equal, double tempBias) override; void getCamWB (double& temp, double& green) override; void getSpotWB (int x, int y, int rectSize, double& temp, double& green) override; - bool getFilmNegativeExponents(int xA, int yA, int xB, int yB, float* newExps) override; + bool getFilmNegativeExponents(int xA, int yA, int xB, int yB, std::array& newExps) override; void getAutoCrop (double ratio, int &x, int &y, int &w, int &h) override; bool getHighQualComputed() override; void setHighQualComputed() override; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 6e039e7f8..9bfeb0c67 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RAWIMAGESOURCE_ -#define _RAWIMAGESOURCE_ +#pragma once +#include #include #include @@ -116,7 +116,7 @@ public: int load(const Glib::ustring &fname, bool firstFrameOnly); void preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) override; void filmNegativeProcess (const procparams::FilmNegativeParams ¶ms) override; - bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams ¤tParams, float newExps[3]) override; + bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams ¤tParams, std::array& newExps) override; void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold) override; void retinex (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &deh, const procparams::ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) override; void retinexPrepareCurves (const procparams::RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) override; @@ -309,5 +309,5 @@ protected: void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) override; }; + } -#endif diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index cc46cfca8..da10d470f 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -16,23 +16,29 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RTENGINE_ -#define _RTENGINE_ +#pragma once -#include "imageformat.h" -#include "rt_math.h" -#include "procevents.h" -#include -#include -#include +#include #include -#include "../rtexif/rtexif.h" -#include "rawmetadatalocation.h" +#include + +#include + +#include + #include "iimage.h" -#include "utils.h" -#include "../rtgui/threadutils.h" -#include "settings.h" +#include "imageformat.h" #include "LUT.h" +#include "procevents.h" +#include "rawmetadatalocation.h" +#include "rt_math.h" +#include "settings.h" +#include "utils.h" + +#include "../rtexif/rtexif.h" + +#include "../rtgui/threadutils.h" + /** * @file * This file contains the main functionality of the RawTherapee engine. @@ -499,7 +505,7 @@ public: virtual bool getAutoWB (double& temp, double& green, double equal, double tempBias) = 0; virtual void getCamWB (double& temp, double& green) = 0; virtual void getSpotWB (int x, int y, int rectSize, double& temp, double& green) = 0; - virtual bool getFilmNegativeExponents(int xA, int yA, int xB, int yB, float* newExps) = 0; + virtual bool getFilmNegativeExponents(int xA, int yA, int xB, int yB, std::array& newExps) = 0; virtual void getAutoCrop (double ratio, int &x, int &y, int &w, int &h) = 0; virtual void saveInputICCReference (const Glib::ustring& fname, bool apply_wb) = 0; @@ -613,6 +619,3 @@ void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl); extern MyMutex* lcmsMutex; } - -#endif - diff --git a/rtgui/filmnegative.cc b/rtgui/filmnegative.cc index 8f1fb5610..72141ecfb 100644 --- a/rtgui/filmnegative.cc +++ b/rtgui/filmnegative.cc @@ -281,8 +281,8 @@ bool FilmNegative::button1Pressed(int modifierKey) // User has selected 2 reference gray spots. Calculating new exponents // from channel values and updating parameters. - float newExps[3]; - if(fnp->getFilmNegativeExponents(refSpotCoords[0], refSpotCoords[1], newExps)) { + std::array newExps; + if (fnp->getFilmNegativeExponents(refSpotCoords[0], refSpotCoords[1], newExps)) { disableListener(); redExp->setValue(newExps[0]); greenExp->setValue(newExps[1]); @@ -335,4 +335,4 @@ void FilmNegative::switchOffEditMode () refSpotCoords.clear(); unsubscribe(); spotbutton->set_active(false); -} \ No newline at end of file +} diff --git a/rtgui/filmnegative.h b/rtgui/filmnegative.h index 5d6c8ce03..b9dc15378 100644 --- a/rtgui/filmnegative.h +++ b/rtgui/filmnegative.h @@ -16,23 +16,25 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _NEG_H_ -#define _NEG_H_ +#pragma once + +#include #include -#include "toolpanel.h" -#include "adjuster.h" -#include "guiutils.h" -#include "wbprovider.h" -#include "editcallbacks.h" -#include "../rtengine/procparams.h" +#include "adjuster.h" +#include "editcallbacks.h" +#include "guiutils.h" +#include "toolpanel.h" +#include "wbprovider.h" + +#include "../rtengine/procparams.h" class FilmNegProvider { public: virtual ~FilmNegProvider() = default; - virtual bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, float* newExps) = 0; + virtual bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array& newExps) = 0; }; class FilmNegative : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public EditSubscriber @@ -89,5 +91,3 @@ public: bool pick1(bool picked) override; }; - -#endif diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 42dbeb984..f7e2991e1 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -1023,7 +1023,7 @@ void ToolPanelCoordinator::setEditProvider (EditDataProvider *provider) } } -bool ToolPanelCoordinator::getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, float* newExps) +bool ToolPanelCoordinator::getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array& newExps) { return ipc && ipc->getFilmNegativeExponents(spotA.x, spotA.y, spotB.x, spotB.y, newExps); } diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 9910f9757..5569861ae 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -292,7 +292,7 @@ public: Glib::ustring GetCurrentImageFilePath() override; // FilmNegProvider interface - bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, float* newExps) override; + bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array& newExps) override; // rotatelistener interface void straightenRequested () override;