Replace raw arrays with std::array<>

This commit is contained in:
Flössie 2019-06-14 08:58:04 +02:00
parent 015cffc73a
commit 80f2b6a002
10 changed files with 46 additions and 42 deletions

View File

@ -82,7 +82,7 @@ float logBase(float base, float num) {
return log(num) / log(base); return log(num) / log(base);
} }
bool RawImageSource::getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams &currentParams, float newExps[3]) bool RawImageSource::getFilmNegativeExponents(Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams &currentParams, std::array<float, 3>& newExps)
{ {
float clearVals[3], denseVals[3]; float clearVals[3], denseVals[3];

View File

@ -18,6 +18,7 @@
*/ */
#pragma once #pragma once
#include <array>
#include <vector> #include <vector>
#include <glibmm.h> #include <glibmm.h>
@ -81,7 +82,7 @@ public:
virtual int load (const Glib::ustring &fname) = 0; 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 preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) {};
virtual void filmNegativeProcess (const procparams::FilmNegativeParams &params) {}; virtual void filmNegativeProcess (const procparams::FilmNegativeParams &params) {};
virtual bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams &currentParams, float newExps[3]) { return false; }; virtual bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams& currentParams, std::array<float, 3>& newExps) { return false; };
virtual void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold) {}; 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<float, 4> &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 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<float, 4> &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) {}; 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) {};

View File

@ -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<float, 3>& newExps)
{ {
MyMutex::MyLock lock(mProcessing); MyMutex::MyLock lock(mProcessing);

View File

@ -269,7 +269,7 @@ public:
bool getAutoWB (double& temp, double& green, double equal, double tempBias) override; bool getAutoWB (double& temp, double& green, double equal, double tempBias) override;
void getCamWB (double& temp, double& green) override; void getCamWB (double& temp, double& green) override;
void getSpotWB (int x, int y, int rectSize, 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<float, 3>& newExps) override;
void getAutoCrop (double ratio, int &x, int &y, int &w, int &h) override; void getAutoCrop (double ratio, int &x, int &y, int &w, int &h) override;
bool getHighQualComputed() override; bool getHighQualComputed() override;
void setHighQualComputed() override; void setHighQualComputed() override;

View File

@ -16,9 +16,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _RAWIMAGESOURCE_ #pragma once
#define _RAWIMAGESOURCE_
#include <array>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
@ -116,7 +116,7 @@ public:
int load(const Glib::ustring &fname, bool firstFrameOnly); 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 preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) override;
void filmNegativeProcess (const procparams::FilmNegativeParams &params) override; void filmNegativeProcess (const procparams::FilmNegativeParams &params) override;
bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams &currentParams, float newExps[3]) override; bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams &currentParams, std::array<float, 3>& newExps) override;
void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold) 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<float, 4> &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 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<float, 4> &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; 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; void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) override;
}; };
} }
#endif

View File

@ -16,23 +16,29 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _RTENGINE_ #pragma once
#define _RTENGINE_
#include "imageformat.h" #include <array>
#include "rt_math.h"
#include "procevents.h"
#include <lcms2.h>
#include <string>
#include <glibmm.h>
#include <ctime> #include <ctime>
#include "../rtexif/rtexif.h" #include <string>
#include "rawmetadatalocation.h"
#include <glibmm.h>
#include <lcms2.h>
#include "iimage.h" #include "iimage.h"
#include "utils.h" #include "imageformat.h"
#include "../rtgui/threadutils.h"
#include "settings.h"
#include "LUT.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 * @file
* This file contains the main functionality of the RawTherapee engine. * 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 bool getAutoWB (double& temp, double& green, double equal, double tempBias) = 0;
virtual void getCamWB (double& temp, double& green) = 0; virtual void getCamWB (double& temp, double& green) = 0;
virtual void getSpotWB (int x, int y, int rectSize, 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<float, 3>& newExps) = 0;
virtual void getAutoCrop (double ratio, int &x, int &y, int &w, int &h) = 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; virtual void saveInputICCReference (const Glib::ustring& fname, bool apply_wb) = 0;
@ -613,6 +619,3 @@ void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl);
extern MyMutex* lcmsMutex; extern MyMutex* lcmsMutex;
} }
#endif

View File

@ -281,7 +281,7 @@ bool FilmNegative::button1Pressed(int modifierKey)
// User has selected 2 reference gray spots. Calculating new exponents // User has selected 2 reference gray spots. Calculating new exponents
// from channel values and updating parameters. // from channel values and updating parameters.
float newExps[3]; std::array<float, 3> newExps;
if (fnp->getFilmNegativeExponents(refSpotCoords[0], refSpotCoords[1], newExps)) { if (fnp->getFilmNegativeExponents(refSpotCoords[0], refSpotCoords[1], newExps)) {
disableListener(); disableListener();
redExp->setValue(newExps[0]); redExp->setValue(newExps[0]);

View File

@ -16,23 +16,25 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _NEG_H_ #pragma once
#define _NEG_H_
#include <array>
#include <gtkmm.h> #include <gtkmm.h>
#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 class FilmNegProvider
{ {
public: public:
virtual ~FilmNegProvider() = default; 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<float, 3>& newExps) = 0;
}; };
class FilmNegative : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public EditSubscriber class FilmNegative : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public EditSubscriber
@ -89,5 +91,3 @@ public:
bool pick1(bool picked) override; bool pick1(bool picked) override;
}; };
#endif

View File

@ -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<float, 3>& newExps)
{ {
return ipc && ipc->getFilmNegativeExponents(spotA.x, spotA.y, spotB.x, spotB.y, newExps); return ipc && ipc->getFilmNegativeExponents(spotA.x, spotA.y, spotB.x, spotB.y, newExps);
} }

View File

@ -292,7 +292,7 @@ public:
Glib::ustring GetCurrentImageFilePath() override; Glib::ustring GetCurrentImageFilePath() override;
// FilmNegProvider interface // FilmNegProvider interface
bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, float* newExps) override; bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array<float, 3>& newExps) override;
// rotatelistener interface // rotatelistener interface
void straightenRequested () override; void straightenRequested () override;