Merge pull request #5675 from Beep6581/rawimagesource_cleanup

Cleanups for rawimagesource.cc
Speedups for ItcWB
This commit is contained in:
Ingo Weyrich 2020-03-01 13:45:06 +01:00 committed by GitHub
commit 8b450d3f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1073 additions and 3454 deletions

View File

@ -254,7 +254,6 @@ public:
}
// handy to sum up per thread histograms. #pragma omp simd speeds up the loop by about factor 3 for LUTu (uint32_t).
template<typename U = T, typename = typename std::enable_if<std::is_same<U, std::uint32_t>::value>::type>
LUT<T> & operator+=(const LUT<T>& rhs)
{
if (rhs.size == this->size) {

View File

@ -941,12 +941,12 @@ void Color::rgbxyz (float r, float g, float b, float &x, float &y, float &z, con
z = ((xyz_rgb[2][0] * r + xyz_rgb[2][1] * g + xyz_rgb[2][2] * b)) ;
}
void Color::rgbxyY(float r, float g, float b, float &x, float &y, float &Y, float &xx, float &yy, float &zz, const double xyz_rgb[3][3])
void Color::rgbxyY(float r, float g, float b, float &x, float &y, float &Y, const float xyz_rgb[3][3])
{
xx = ((xyz_rgb[0][0] * r + xyz_rgb[0][1] * g + xyz_rgb[0][2] * b)) ;
yy = ((xyz_rgb[1][0] * r + xyz_rgb[1][1] * g + xyz_rgb[1][2] * b)) ;
zz = ((xyz_rgb[2][0] * r + xyz_rgb[2][1] * g + xyz_rgb[2][2] * b)) ;
float som = xx + yy + zz;
const float xx = xyz_rgb[0][0] * r + xyz_rgb[0][1] * g + xyz_rgb[0][2] * b;
const float yy = xyz_rgb[1][0] * r + xyz_rgb[1][1] * g + xyz_rgb[1][2] * b;
const float zz = xyz_rgb[2][0] * r + xyz_rgb[2][1] * g + xyz_rgb[2][2] * b;
const float som = xx + yy + zz;
x = xx / som;
y = yy / som;
Y = yy / 65535.f;

View File

@ -602,7 +602,7 @@ public:
* @param xyz_rgb[3][3] transformation matrix to use for the conversion
*/
static void rgbxyz (float r, float g, float b, float &x, float &y, float &z, const double xyz_rgb[3][3]);
static void rgbxyY(float r, float g, float b, float &x, float &y, float &Y, float &xx, float &yy, float &zz, const double xyz_rgb[3][3]);
static void rgbxyY(float r, float g, float b, float &x, float &y, float &Y, const float xyz_rgb[3][3]);
static void rgbxyz (float r, float g, float b, float &x, float &y, float &z, const float xyz_rgb[3][3]);
#ifdef __SSE2__
static void rgbxyz (vfloat r, vfloat g, vfloat b, vfloat &x, vfloat &y, vfloat &z, const vfloat xyz_rgb[3][3]);

View File

@ -3210,8 +3210,8 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul,
//calculate spectral data for blackbody at temp!
double ColorTemp::blackbody_spect(double wavelength, double temperature)
{
double wlm = wavelength * 1e-9; /* Wavelength in meters */
return (3.7417715247e-16 / pow(wlm, 5)) / //3.7417..= c1 = 2*Pi*h*c2 where h=Planck constant, c=velocity of light
const double wlm = wavelength * 1e-9; /* Wavelength in meters */
return (3.7417715247e-16 / rtengine::pow5(wlm)) / //3.7417..= c1 = 2*Pi*h*c2 where h=Planck constant, c=velocity of light
(xexp(1.438786e-2 / (wlm * temperature)) - 1.0); //1.4387..= c2 = h*c/k where k=Boltzmann constant
}
@ -3337,62 +3337,38 @@ void ColorTemp::spectrum_to_color_xyz_preset(const double* spec_color, const dou
void ColorTemp::spectrum_to_color_xyz_daylight(const double* spec_color, double _m1, double _m2, double &xx, double &yy, double &zz)
{
int i;
double lambda, X = 0, Y = 0, Z = 0, Yo = 0;
double lambda, X = 0, Y = 0, Z = 0;
for (i = 0, lambda = 350; lambda < 830.1; i++, lambda += 5) {
double Me;
double Mc;
Me = get_spectral_color(lambda, spec_color);
Mc = daylight_spect(lambda, _m1, _m2);
const double Me = spec_color[i];
const double Mc = daylight_spect(lambda, _m1, _m2);
X += Mc * cie_colour_match_jd[i][0] * Me;
Y += Mc * cie_colour_match_jd[i][1] * Me;
Z += Mc * cie_colour_match_jd[i][2] * Me;
}
for (i = 0, lambda = 350; lambda < 830.1; i++, lambda += 5) {
double Ms;
Ms = daylight_spect(lambda, _m1, _m2);
Yo += cie_colour_match_jd[i][1] * Ms;
}
xx = X / Yo;
yy = Y / Yo;
zz = Z / Yo;
xx = X / Y;
yy = 1.0;
zz = Z / Y;
}
//calculate XYZ from spectrum data (color) and illuminant : J.Desmis december 2011
void ColorTemp::spectrum_to_color_xyz_blackbody(const double* spec_color, double _temp, double &xx, double &yy, double &zz)
{
int i;
double lambda, X = 0, Y = 0, Z = 0, Yo = 0;
double lambda, X = 0, Y = 0, Z = 0;
for (i = 0, lambda = 350; lambda < 830.1; i++, lambda += 5) {
double Me;
double Mc;
Me = get_spectral_color(lambda, spec_color);
Mc = blackbody_spect(lambda, _temp);
const double Me = spec_color[i];
const double Mc = blackbody_spect(lambda, _temp);
X += Mc * cie_colour_match_jd[i][0] * Me;
Y += Mc * cie_colour_match_jd[i][1] * Me;
Z += Mc * cie_colour_match_jd[i][2] * Me;
}
for (i = 0, lambda = 350; lambda < 830.1; i++, lambda += 5) {
double Ms;
Ms = blackbody_spect(lambda, _temp);
Yo += cie_colour_match_jd[i][1] * Ms;
}
xx = X / Yo;
yy = Y / Yo;
zz = Z / Yo;
xx = X / Y;
yy = 1.0;
zz = Z / Y;
}
double ColorTemp::daylight_spect(double wavelength, double m1, double m2)
@ -3424,7 +3400,7 @@ double ColorTemp::daylight_spect(double wavelength, double m1, double m2)
// we can change step for temperature and increase number for T > 7500K if necessary
//these values Temp, x, y are references for all calculations and very precise.
//copyright J.Desmis august 2017 and june 2018
void ColorTemp::tempxy(bool separated, int &repref, float **Tx, float **Ty, float **Tz, float **Ta, float **Tb, float **TL, double *TX, double *TY, double *TZ, const procparams::WBParams & wbpar)
void ColorTemp::tempxy(bool separated, int repref, float **Tx, float **Ty, float **Tz, float **Ta, float **Tb, float **TL, double *TX, double *TY, double *TZ, const procparams::WBParams & wbpar)
{
const double* spec_colorforxcyc[] = {//color references
JDC468_BluH10_spect, JDC468_BluD6_spect, ColorchechCyaF3_spect, JDC468_BluM5_spect, // 0 3
@ -3483,7 +3459,7 @@ void ColorTemp::tempxy(bool separated, int &repref, float **Tx, float **Ty, floa
double ZZ;
} WbTxyz;
//probbaly can be "passed" with rawimagesource.cc but I don't know how to do.
WbTxyz Txyz[118] = {//temperature Xwb Zwb 118 values x wb and y wb are calculated after
constexpr WbTxyz Txyz[118] = {//temperature Xwb Zwb 118 values x wb and y wb are calculated after
{2001., 1.273842, 0.145295},
{2101., 1.244008, 0.167533},
{2201., 1.217338, 0.190697},
@ -3612,68 +3588,20 @@ void ColorTemp::tempxy(bool separated, int &repref, float **Tx, float **Ty, floa
double Zref;
} XYZref;
XYZref Refxyz[N_c + 1];
typedef struct XYZrefcat02 {
double Xrefcat;
double Yrefcat;
double Zrefcat;
} XYZrefcat02;
XYZrefcat02 Refxyzcat02[N_c + 1];
for (int i = 0; i < N_c; i++) {
Refxyz[i].Xref = 0.f;
Refxyz[i].Yref = 0.f;
Refxyz[i].Zref = 0.f;
Refxyzcat02[i].Xrefcat = 0.f;
Refxyzcat02[i].Yrefcat = 0.f;
Refxyzcat02[i].Zrefcat = 0.f;
}
struct chrom {
float chroab;
float chroa;
float chrob;
int nn;
float L;
bool operator()(const chrom& lchro, const chrom& rchro)
{
return lchro.chroab < rchro.chroab;
}
} ;
// chrom wbchro[N_c + 1];
double tempw = 5000.;
if (separated) {
tempw = Txyz[repref].Tem;
// tempw = 5004.;
const double tempw = Txyz[repref].Tem;
if (tempw <= INITIALBLACKBODY) {
// float aa = 0.f;
// float bb = 0.f;
for (int i = 0; i < N_c; i++) {
spectrum_to_color_xyz_blackbody(spec_colorforxcyc[i], tempw, TX[i], TY[i], TZ[i]);
/* float XX = TX[i] * 65535.f;
float YY = TY[i] * 65535.f;
float ZZ = TZ[i] * 65535.f;
float L, a, b;
Color::XYZ2Lab(XX, YY, ZZ, L, a, b);//only to see Lab values in console
printf("N=%i L=%f a=%f b=%f\n", i, L / 327.68f, a / 327.68f, b / 327.68f);
aa += (a / 327.68f);
bb += (b / 327.68f);
*/
}
/*
aa /= N_c;
bb /= N_c;
printf("aa=%f bb=%f\n", aa, bb);
*/
// }
} else {
double m11, m22, x_DD, y_DD, interm2;
@ -3689,97 +3617,21 @@ void ColorTemp::tempxy(bool separated, int &repref, float **Tx, float **Ty, floa
interm2 = (0.0241 + 0.2562 * x_DD - 0.734 * y_DD);
m11 = (-1.3515 - 1.7703 * x_DD + 5.9114 * y_DD) / interm2;
m22 = (0.03 - 31.4424 * x_DD + 30.0717 * y_DD) / interm2;
// float aa = 0.f;
// float bb = 0.f;
for (int i = 0; i < N_c; i++) {
spectrum_to_color_xyz_daylight(spec_colorforxcyc[i], m11, m22, TX[i], TY[i], TZ[i]);
/* float XX = TX[i] * 65535.f;
float YY = TY[i] * 65535.f;
float ZZ = TZ[i] * 65535.f;
float L, a, b;
Color::XYZ2Lab(XX, YY, ZZ, L, a, b);//only to see Lab values in console
// printf("N=%i L=%f a=%f b=%f\n", i, L / 327.68f, a / 327.6 8f, b / 327.68f);
aa += (a / 327.68f);
bb += (b / 327.68f);
wbchro[i].chroab = (sqrt(SQR(a) + SQR(b))) / 327.68f;
wbchro[i].chroa = a / 327.68f;
wbchro[i].chrob = b / 327.68f;
wbchro[i].nn = i;
*/
}
/*
std::sort(wbchro, wbchro + N_c + 1, wbchro[0]);
float ab5 = 0.f;
int n5 = 0;
float ab15 = 0.f;
int n15 = 0;
float ab30 = 0.f;
int n30 = 0;
float ab50 = 0.f;
int n50 = 0;
float ab70 = 0.f;
int n70 = 0;
float ab120 = 0.f;
int n120 = 0;
for (int i = 0; i < N_c; i++) {
if (wbchro[i].chroab < 5.f) {
ab5 += (wbchro[i].chroa + wbchro[i].chrob);
n5++;
} else if (wbchro[i].chroab < 15.f) {
ab15 += (wbchro[i].chroa + wbchro[i].chrob);
n15++;
} else if (wbchro[i].chroab < 30.f) {
ab30 += (wbchro[i].chroa + wbchro[i].chrob);
n30++;
} else if (wbchro[i].chroab < 50.f) {
ab50 += (wbchro[i].chroa + wbchro[i].chrob);
n50++;
} else if (wbchro[i].chroab < 70.f) {
ab70 += (wbchro[i].chroa + wbchro[i].chrob);
n70++;
} else if (wbchro[i].chroab < 120.f) {
ab120 += (wbchro[i].chroa + wbchro[i].chrob);
n120++;
}
printf("N=%i nn=%i chr=%f cha=%f chb=%f\n", i, wbchro[i].nn, wbchro[i].chroab, wbchro[i].chroa, wbchro[i].chrob);
}
printf("ab5=%f n5=%i\n", ab5 / n5, n5);
printf("ab15=%f n15=%i\n", ab15 / n15, n15);
printf("ab30=%f n30=%i\n", ab30 / n30, n30);
printf("ab50=%f n50=%i\n", ab50 / n50, n50);
printf("ab70=%f n70=%i\n", ab70 / n70, n70);
printf("ab120=%f n120=%i\n", ab120 / n120, n120);
aa /= N_c;
bb /= N_c;
printf("aa=%f bb=%f\n", aa, bb);
//very low 15 --, 16 -+, 17 + -, 18 +-, 20 ++, 22 -+, 73 ++, 98 ++, 99 -+, 101 -+, 129 ++, 130 -+, 131 --,
//low 8 +-, 9 --, 10 --, 12 --, 19 -+, 21 -+, 24 -+, 25 ++, 27 ++, 30 ++, 33++, 34 ++, 36 ++, 37++,38 +-,
*/
}
}
if (!separated) {
// std::string wbcat02Method = wbpar.wbcat02Method;
std::string wbcat02Method = "none";
} else {
for (int tt = 0; tt < N_t; tt++) {
tempw = Txyz[tt].Tem;
const double tempw = Txyz[tt].Tem;
if (tempw <= INITIALBLACKBODY) {
for (int i = 0; i < N_c; i++) {
spectrum_to_color_xyz_blackbody(spec_colorforxcyc[i], tempw, Refxyz[i].Xref, Refxyz[i].Yref, Refxyz[i].Zref);
}
} else {
double m11, m22, x_DD, y_DD, interm2;
double x_DD;
if (tempw <= 7000) {
x_DD = -4.6070e9 / (tempw * tempw * tempw) + 2.9678e6 / (tempw * tempw) + 0.09911e3 / tempw + 0.244063;
@ -3787,80 +3639,22 @@ void ColorTemp::tempxy(bool separated, int &repref, float **Tx, float **Ty, floa
x_DD = -2.0064e9 / (tempw * tempw * tempw) + 1.9018e6 / (tempw * tempw) + 0.24748e3 / tempw + 0.237040;
}
y_DD = -3.0 * x_DD * x_DD + 2.87 * x_DD - 0.275;
const double y_DD = -3.0 * x_DD * x_DD + 2.87 * x_DD - 0.275;
//calculate D -daylight in function of s0, s1, s2 and temp ==> x_D y_D
//S(lamda)=So(lambda)+m1*s1(lambda)+m2*s2(lambda)
interm2 = (0.0241 + 0.2562 * x_DD - 0.734 * y_DD);
m11 = (-1.3515 - 1.7703 * x_DD + 5.9114 * y_DD) / interm2;
m22 = (0.03 - 31.4424 * x_DD + 30.0717 * y_DD) / interm2;
const double interm2 = (0.0241 + 0.2562 * x_DD - 0.734 * y_DD);
const double m11 = (-1.3515 - 1.7703 * x_DD + 5.9114 * y_DD) / interm2;
const double m22 = (0.03 - 31.4424 * x_DD + 30.0717 * y_DD) / interm2;
for (int i = 0; i < N_c; i++) {
spectrum_to_color_xyz_daylight(spec_colorforxcyc[i], m11, m22, Refxyz[i].Xref, Refxyz[i].Yref, Refxyz[i].Zref);
}
}
//CAT02
float CAM02BB00 = 1.0, CAM02BB01 = 1.0, CAM02BB02 = 1.0, CAM02BB10 = 1.0, CAM02BB11 = 1.0, CAM02BB12 = 1.0, CAM02BB20 = 1.0, CAM02BB21 = 1.0, CAM02BB22 = 1.0; //for CIECAT02
float Xwb = Txyz[tt].XX;
float Ywb = 1.;
float Zwb = Txyz[tt].ZZ;
if (wbcat02Method == "icam") {//not used
icieCAT02float(Xwb, Ywb, Zwb, CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22, 1.0);
}
if (wbcat02Method == "cam") {
cieCAT02float(Xwb, Ywb, Zwb, CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22, 1.0);
}
if (wbcat02Method == "none") {
for (int i = 0; i < N_c; i++) {
Refxyzcat02[i].Xrefcat = CAM02BB00 * Refxyz[i].Xref + CAM02BB01 * Refxyz[i].Yref + CAM02BB02 * Refxyz[i].Zref ;
Refxyzcat02[i].Yrefcat = CAM02BB10 * Refxyz[i].Xref + CAM02BB11 * Refxyz[i].Yref + CAM02BB12 * Refxyz[i].Zref ;
Refxyzcat02[i].Zrefcat = CAM02BB20 * Refxyz[i].Xref + CAM02BB21 * Refxyz[i].Yref + CAM02BB22 * Refxyz[i].Zref;
}
}
//end CAT02
for (int i = 0; i < N_c; i++) {
/* float X = 65535.f * Refxyzcat02[i].Xrefcat;
float Y = 65535.f * Refxyzcat02[i].Yrefcat;
float Z = 65535.f * Refxyzcat02[i].Zrefcat;
float L, a, b;
Color::XYZ2Lab(X, Y, Z, L, a, b);
double som = (Refxyzcat02[i].Xrefcat + Refxyzcat02[i].Yrefcat + Refxyzcat02[i].Zrefcat);
L /= 327.68f;
a /= 327.68f;
b /= 327.68f;
Ta[i][tt] = a;
Tb[i][tt] = b;
TL[i][tt] = L;
TX[i][tt] = X;
TY[i][tt] = Y;
TZ[i][tt] = Z;
*/
//som = 1.;
// Tx[i][tt] = (float) Refxyz[i].Xref;
// Ty[i][tt] = (float) Refxyz[i].Yref;
// Tz[i][tt] = (float) Refxyz[i].Zref;
// if (wbpar.wbcat02Method == "none") {
if (wbcat02Method == "none") {
Tx[i][tt] = (float) Refxyz[i].Xref;
Ty[i][tt] = (float) Refxyz[i].Yref;
Tz[i][tt] = (float) Refxyz[i].Zref;
} else {
Tx[i][tt] = (float) Refxyzcat02[i].Xrefcat;
Ty[i][tt] = (float) Refxyzcat02[i].Yrefcat;
Tz[i][tt] = (float) Refxyzcat02[i].Zrefcat;
}
Tx[i][tt] = Refxyz[i].Xref;
Ty[i][tt] = Refxyz[i].Yref;
Tz[i][tt] = Refxyz[i].Zref;
}
}
}

View File

@ -54,7 +54,7 @@ public:
explicit ColorTemp (double e) : temp(-1.), green(-1.), equal (e), method("Custom") {}
ColorTemp (double t, double g, double e, const std::string &m);
ColorTemp (double mulr, double mulg, double mulb, double e);
static void tempxy(bool separated, int &repref, float **Tx, float **Ty, float **Tz, float **Ta, float **Tb, float **TL, double *TX, double *TY, double *TZ, const procparams::WBParams & wbpar);
static void tempxy(bool separated, int repref, float **Tx, float **Ty, float **Tz, float **Ta, float **Tb, float **TL, double *TX, double *TY, double *TZ, const procparams::WBParams & wbpar);
void update (const double rmul, const double gmul, const double bmul, const double equal, const double tempBias=0.0)
{

View File

@ -98,8 +98,7 @@ public:
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 retinexPrepareBuffers (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &retinexParams, multi_array2D<float, 4> &conversionBuffer, LUTu &lhist16RETI) {};
virtual void flushRawData () {};
virtual void flushRGB () {};
virtual void flush () = 0;
virtual void HLRecovery_Global (const procparams::ToneCurveParams &hrp) {};
virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {};
@ -124,7 +123,7 @@ public:
virtual ColorTemp getWB () const = 0;
virtual ColorTemp getSpotWB (std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, int tran, double equal) = 0;
virtual void WBauto(double &tempref, double &greenref, array2D<float> &redloc, array2D<float> &greenloc, array2D<float> &blueloc, int bfw, int bfh, double &avg_rm, double &avg_gm, double &avg_bm, double &tempitc, double &greenitc, float &studgood, bool &twotimes, const procparams::WBParams & wbpar, int begx, int begy, int yEn, int xEn, int cx, int cy, const procparams::ColorManagementParams &cmp, const procparams::RAWParams &raw) = 0;
virtual void getrgbloc(bool local, bool gamma, bool cat02, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w) = 0;
virtual void getrgbloc(int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w) = 0;
virtual double getDefGain () const
{

View File

@ -389,16 +389,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
}
}
// bool autowb0 = false;
// autowb0 = (params->wb.method == "autold" || params->wb.method == "aut" || params->wb.method == "autosdw" || params->wb.method == "autedgsdw" || params->wb.method == "autitcgreen" || params->wb.method == "autedgrob" || params->wb.method == "autedg" || params->wb.method == "autorobust");
// autowb0 = (params->wb.method == "autold" || params->wb.method == "autitcgreen");//in some cases autowb0 does not work ....params->wb.method still at "camera" instead of auto !!!
// printf("autowb0=%s \n", params->wb.method.c_str());
// if (autowb0) {
imgsrc->getrgbloc(false, false, false, 0, 0, fh, fw, 0, 0, fh, fw);
// }
if (todo & (M_INIT | M_LINDENOISE | M_HDR)) {
if (params->wb.method == "autitcgreen") {
imgsrc->getrgbloc(0, 0, fh, fw, 0, 0, fh, fw);
}
}
if ((todo & (M_RETINEX | M_INIT)) && params->retinex.enabled) {
bool dehacontlutili = false;
@ -416,8 +411,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
}
}
bool autowb = false;
autowb = (params->wb.method == "autold" || params->wb.method == "aut" || params->wb.method == "autosdw" || params->wb.method == "autedgsdw" || params->wb.method == "autitcgreen" || params->wb.method == "autedgrob" || params->wb.method == "autedg" || params->wb.method == "autorobust");
const bool autowb = (params->wb.method == "autold" || params->wb.method == "autitcgreen");
if (settings->verbose) {
printf("automethod=%s \n", params->wb.method.c_str());
}

View File

@ -1309,15 +1309,8 @@ const std::vector<WBEntry>& WBParams::getWbEntries()
static const std::vector<WBEntry> wb_entries = {
{"Camera", WBEntry::Type::CAMERA, M("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f},
// {"Auto", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f},
{"autitcgreen", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTOITCGREEN"), 0, 1.f, 1.f, 0.f},
{"autold", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTOOLD"), 0, 1.f, 1.f, 0.f},
// {"aut", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTODEM"), 0, 1.f, 1.f, 0.f},
// {"autedg", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTOEDGE"), 0, 1.f, 1.f, 0.f},
// {"autorobust", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTOROB"), 0, 1.f, 1.f, 0.f},
// {"autosdw", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTOSDW"), 0, 1.f, 1.f, 0.f},
// {"autedgsdw", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTOEDGESW"), 0, 1.f, 1.f, 0.f},
// {"autedgrob", WBEntry::Type::AUTO, M("TP_WBALANCE_AUTOEDGEROB"), 0, 1.f, 1.f, 0.f},
{"Daylight", WBEntry::Type::DAYLIGHT, M("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f},
{"Cloudy", WBEntry::Type::CLOUDY, M("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f},
{"Shade", WBEntry::Type::SHADE, M("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f},

File diff suppressed because it is too large Load Diff

View File

@ -130,8 +130,7 @@ public:
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 retinexPrepareBuffers (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &retinexParams, multi_array2D<float, 4> &conversionBuffer, LUTu &lhist16RETI) override;
void flushRawData () override;
void flushRGB () override;
void flush () override;
void HLRecovery_Global (const procparams::ToneCurveParams &hrp) override;
void refinement(int PassCount);
void setBorder(unsigned int rawBorder) override {border = rawBorder;}
@ -145,7 +144,7 @@ public:
void scaleColors (int winx, int winy, int winw, int winh, const procparams::RAWParams &raw, array2D<float> &rawData); // raw for cblack
void WBauto(double &tempref, double &greenref, array2D<float> &redloc, array2D<float> &greenloc, array2D<float> &blueloc, int bfw, int bfh, double &avg_rm, double &avg_gm, double &avg_bm, double &tempitc, double &greenitc, float &studgood, bool &twotimes, const procparams::WBParams & wbpar, int begx, int begy, int yEn, int xEn, int cx, int cy, const procparams::ColorManagementParams &cmp, const procparams::RAWParams &raw) override;
void getAutoWBMultipliersitc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const procparams::WBParams & wbpar, const procparams::ColorManagementParams &cmp, const procparams::RAWParams &raw) override;
void getrgbloc(bool local, bool gamma, bool cat02, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w) override;
void getrgbloc(int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w) override;
void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hrp, const procparams::RAWParams &raw) override;
eSensorType getSensorType () const override;

View File

@ -44,6 +44,12 @@ constexpr T pow4(T x)
return SQR(SQR(x));
}
template<typename T>
constexpr T pow5(T x)
{
return x * pow4(x);
}
template<typename T>
constexpr const T& min(const T& a)
{

View File

@ -801,8 +801,7 @@ private:
// commented out because it makes the application crash when batch processing...
// TODO: find a better place to flush rawData and rawRGB
if (flush) {
imgsrc->flushRawData();
imgsrc->flushRGB();
imgsrc->flush();
}
return true;

View File

@ -315,9 +315,6 @@ void StdImageSource::WBauto(double &tempref, double &greenref, array2D<float> &r
{
}
void StdImageSource::getrgbloc(bool local, bool gamma, bool cat02, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w)
{}
void StdImageSource::getAutoWBMultipliersitc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw)
{
if (redAWBMul != -1.) {
@ -366,7 +363,7 @@ ColorTemp StdImageSource::getSpotWB (std::vector<Coord2D> &red, std::vector<Coor
return ColorTemp (reds / rn * img_r, greens / gn * img_g, blues / bn * img_b, equal);
}
void StdImageSource::flushRGB() {
void StdImageSource::flush() {
img->allocate(0, 0);
};

View File

@ -58,7 +58,7 @@ public:
int load (const Glib::ustring &fname) override;
void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hrp, const procparams::RAWParams &raw) override;
void getrgbloc(bool local, bool gamma, bool cat02, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w) override;
void getrgbloc (int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w) override {};
ColorTemp getWB () const override
{
return wb;
@ -118,7 +118,7 @@ public:
void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) override { R = G = B = 0;}
void flushRGB () override;
void flush () override;
void captureSharpening(const procparams::CaptureSharpeningParams &sharpeningParams, bool showMask, double &conrastThreshold, double &radius) override {};
};

View File

@ -823,7 +823,6 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited)
nexttemp = pp->wb.temperature;
nextgreen = pp->wb.green;
printf("temp=%f green=%f\n", nexttemp, nextgreen);
if (pedited) {
degree->setEditedState (pedited->colorappearance.degree ? Edited : UnEdited);
degreeout->setEditedState (pedited->colorappearance.degreeout ? Edited : UnEdited);

View File

@ -20,12 +20,15 @@
#include <set>
#include <vector>
#if defined __has_include
#if __has_include(<gtkmm/enums.h>)
#include <gtkmm/enums.h>
#else
#include <gtkmm-3.0/gtkmm/enums.h>
#endif
#else
#include <gtkmm/enums.h>
#endif
#include "../rtengine/settings.h"
#include <exception>