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);
}
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];

View File

@ -18,6 +18,7 @@
*/
#pragma once
#include <array>
#include <vector>
#include <glibmm.h>
@ -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 &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 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) {};

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);

View File

@ -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<float, 3>& newExps) override;
void getAutoCrop (double ratio, int &x, int &y, int &w, int &h) override;
bool getHighQualComputed() override;
void setHighQualComputed() override;

View File

@ -16,9 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RAWIMAGESOURCE_
#define _RAWIMAGESOURCE_
#pragma once
#include <array>
#include <iostream>
#include <memory>
@ -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 &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 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;
@ -309,5 +309,5 @@ protected:
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
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RTENGINE_
#define _RTENGINE_
#pragma once
#include "imageformat.h"
#include "rt_math.h"
#include "procevents.h"
#include <lcms2.h>
#include <string>
#include <glibmm.h>
#include <array>
#include <ctime>
#include "../rtexif/rtexif.h"
#include "rawmetadatalocation.h"
#include <string>
#include <glibmm.h>
#include <lcms2.h>
#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<float, 3>& 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

View File

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

View File

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

View File

@ -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<float, 3>& newExps) override;
// rotatelistener interface
void straightenRequested () override;