Merge pull request #5850 from Beep6581/cppcheck_cleanups

make some files cppcheck clean
This commit is contained in:
Ingo Weyrich 2020-07-17 14:54:54 +02:00 committed by GitHub
commit 5935a3ef88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 645 additions and 1012 deletions

View File

@ -2108,17 +2108,17 @@ float ImProcFunctions::Mad(const float * DataList, const int datalen)
}
//find median of histogram
int median = 0, count = 0;
int lmedian = 0, count = 0;
while (count < datalen / 2) {
count += histo[median];
++median;
count += histo[lmedian];
++lmedian;
}
int count_ = count - histo[median - 1];
int count_ = count - histo[lmedian - 1];
// interpolate
return (((median - 1) + (datalen / 2 - count_) / (static_cast<float>(count - count_))) / 0.6745f);
return ((lmedian - 1) + (datalen / 2 - count_) / (static_cast<float>(count - count_))) / 0.6745f;
}
float ImProcFunctions::MadRgb(const float * DataList, const int datalen)
@ -2141,18 +2141,18 @@ float ImProcFunctions::MadRgb(const float * DataList, const int datalen)
}
//find median of histogram
int median = 0, count = 0;
int lmedian = 0, count = 0;
while (count < datalen / 2) {
count += histo[median];
++median;
count += histo[lmedian];
++lmedian;
}
int count_ = count - histo[median - 1];
int count_ = count - histo[lmedian - 1];
// interpolate
delete[] histo;
return (((median - 1) + (datalen / 2 - count_) / (static_cast<float>(count - count_))) / 0.6745f);
return ((lmedian - 1) + (datalen / 2 - count_) / (static_cast<float>(count - count_))) / 0.6745f;
}

View File

@ -1770,10 +1770,10 @@ static void region_grow( int x, int y, image_double angles, struct point * reg,
int xx,yy,i;
/* check parameters */
if( x < 0 || y < 0 || x >= (int) angles->xsize || y >= (int) angles->ysize )
error("region_grow: (x,y) out of the image.");
if( angles == NULL || angles->data == NULL )
error("region_grow: invalid image 'angles'.");
if( x < 0 || y < 0 || x >= (int) angles->xsize || y >= (int) angles->ysize )
error("region_grow: (x,y) out of the image.");
if( reg == NULL ) error("region_grow: invalid 'reg'.");
if( reg_size == NULL ) error("region_grow: invalid pointer 'reg_size'.");
if( reg_angle == NULL ) error("region_grow: invalid pointer 'reg_angle'.");

View File

@ -1189,27 +1189,6 @@ void Color::computeBWMixerConstants (const Glib::ustring &setting, const Glib::u
float koymcp = 0.f;
if(setting == "ROYGCBPM-Abs" || setting == "ROYGCBPM-Rel") {
float obM = 0.f;
float ogM = 0.f;
float orM = 0.f;
float ybM = 0.f;
float yrM = 0.f;
float ygM = 0.f;
float mgM = 0.f;
float mrM = 0.f;
float mbM = 0.f;
float pgM = 0.f;
float prM = 0.f;
float pbM = 0.f;
float crM = 0.f;
float cgM = 0.f;
float cbM = 0.f;
//printf("mixred=%f\n",mixerRed);
float fcompl = 1.f;
if (complement && algo == "SP") {
@ -1220,17 +1199,16 @@ void Color::computeBWMixerConstants (const Glib::ustring &setting, const Glib::u
// ponderate filters: report to R=G=B=33
// I ponder RGB channel, not only orange or yellow or cyan, etc...it's my choice !
if(mixerOrange != 33) {
if (algo == "SP") { //special
if (mixerOrange >= 33) {
orM = fcompl * (mixerOrange * 0.67f - 22.11f) / 100.f;
} else {
orM = fcompl * (-0.3f * mixerOrange + 9.9f) / 100.f;
}
if (mixerOrange != 33.f) {
float ogM = 0.f;
float orM = 0.f;
if (mixerOrange >= 33) {
if (algo == "SP") { //special
if (mixerOrange > 33.f) {
orM = fcompl * (mixerOrange * 0.67f - 22.11f) / 100.f;
ogM = fcompl * (-0.164f * mixerOrange + 5.412f) / 100.f;
} else {
orM = fcompl * (-0.3f * mixerOrange + 9.9f) / 100.f;
ogM = fcompl * (0.4f * mixerOrange - 13.2f) / 100.f;
}
} else if (algo == "LI") { //linear
@ -1238,30 +1216,24 @@ void Color::computeBWMixerConstants (const Glib::ustring &setting, const Glib::u
ogM = fcompl * (0.5f * mixerOrange - 16.5f) / 100.f;
}
if(complement) {
obM = (-0.492f * mixerOrange + 16.236f) / 100.f;
}
const float obM = complement ? (-0.492f * mixerOrange + 16.236f) / 100.f : 0.f;
mixerRed += orM;
mixerGreen += ogM;
mixerBlue += obM;
koymcp += (orM + ogM + obM);
// printf("mixred+ORange=%f\n",mixerRed);
}
if(mixerYellow != 33) {
if (mixerYellow != 33.f) {
float yrM = 0.f;
if (algo == "SP") {
yrM = fcompl * (-0.134f * mixerYellow + 4.422f) / 100.f; //22.4
} else if (algo == "LI") {
yrM = fcompl * (0.5f * mixerYellow - 16.5f) / 100.f; //22.4
}
ygM = fcompl * (0.5f * mixerYellow - 16.5f ) / 100.f;
if(complement) {
ybM = (-0.492f * mixerYellow + 16.236f) / 100.f;
}
const float ygM = fcompl * (0.5f * mixerYellow - 16.5f ) / 100.f;
const float ybM = complement ? (-0.492f * mixerYellow + 16.236f) / 100.f : 0.f;
mixerRed += yrM;
mixerGreen += ygM;
@ -1269,17 +1241,15 @@ void Color::computeBWMixerConstants (const Glib::ustring &setting, const Glib::u
koymcp += (yrM + ygM + ybM);
}
if(mixerMagenta != 33) {
if (mixerMagenta != 33.f) {
float mrM = 0.f;
float mbM = 0.f;
if (algo == "SP") {
if(mixerMagenta >= 33) {
if (mixerMagenta > 33.f) {
mrM = fcompl * ( 0.67f * mixerMagenta - 22.11f) / 100.f;
} else {
mrM = fcompl * (-0.3f * mixerMagenta + 9.9f) / 100.f;
}
if(mixerMagenta >= 33) {
mbM = fcompl * (-0.164f * mixerMagenta + 5.412f) / 100.f;
} else {
mrM = fcompl * (-0.3f * mixerMagenta + 9.9f) / 100.f;
mbM = fcompl * ( 0.4f * mixerMagenta - 13.2f) / 100.f;
}
} else if (algo == "LI") {
@ -1287,9 +1257,7 @@ void Color::computeBWMixerConstants (const Glib::ustring &setting, const Glib::u
mbM = fcompl * (0.5f * mixerMagenta - 16.5f) / 100.f;
}
if(complement) {
mgM = (-0.492f * mixerMagenta + 16.236f) / 100.f;
}
const float mgM = complement ? (-0.492f * mixerMagenta + 16.236f) / 100.f : 0.f;
mixerRed += mrM;
mixerGreen += mgM;
@ -1297,18 +1265,16 @@ void Color::computeBWMixerConstants (const Glib::ustring &setting, const Glib::u
koymcp += (mrM + mgM + mbM);
}
if(mixerPurple != 33) {
if (mixerPurple != 33.f) {
float prM = 0.f;
if (algo == "SP") {
prM = fcompl * (-0.134f * mixerPurple + 4.422f) / 100.f;
} else if (algo == "LI") {
prM = fcompl * (0.5f * mixerPurple - 16.5f) / 100.f;
}
pbM = fcompl * (0.5f * mixerPurple - 16.5f) / 100.f;
if(complement) {
pgM = (-0.492f * mixerPurple + 16.236f) / 100.f;
}
const float pbM = fcompl * (0.5f * mixerPurple - 16.5f) / 100.f;
const float pgM = complement ? (-0.492f * mixerPurple + 16.236f) / 100.f : 0.f;
mixerRed += prM;
mixerGreen += pgM;
@ -1316,18 +1282,16 @@ void Color::computeBWMixerConstants (const Glib::ustring &setting, const Glib::u
koymcp += (prM + pgM + pbM);
}
if(mixerCyan != 33) {
if (mixerCyan != 33.f) {
float cgM = 0.f;
if (algo == "SP") {
cgM = fcompl * (-0.134f * mixerCyan + 4.422f) / 100.f;
} else if (algo == "LI") {
cgM = fcompl * (0.5f * mixerCyan - 16.5f) / 100.f;
}
cbM = fcompl * (0.5f * mixerCyan - 16.5f) / 100.f;
if(complement) {
crM = (-0.492f * mixerCyan + 16.236f) / 100.f;
}
const float cbM = fcompl * (0.5f * mixerCyan - 16.5f) / 100.f;
const float crM = complement ? (-0.492f * mixerCyan + 16.236f) / 100.f : 0.f;
mixerRed += crM;
mixerGreen += cgM;
@ -1496,74 +1460,53 @@ void Color::interpolateRGBColor (float realL, float iplow, float iphigh, int alg
const float xl, const float yl, const float zl, const float x2, const float y2, const float z2,
const double xyz_rgb[3][3], const double rgb_xyz[3][3], float &ro, float &go, float &bo)
{
float X1, Y1, Z1, X2, Y2, Z2, X, Y, Z, XL, YL, ZL;
float L1 = 0.f, L2, LL, a_1 = 0.f, b_1 = 0.f, a_2 = 0.f, b_2 = 0.f, a_L, b_L;
// converting color 1 to Lab (image)
Color::rgbxyz(r1, g1, b1, X1, Y1, Z1, xyz_rgb);
float L1 = 0.f, a_1 = 0.f, b_1 = 0.f, a_2 = 0.f, b_2 = 0.f, a_L = 0.f, b_L = 0.f;
if (algm == 1) {//use H interpolate
// converting color 1 to Lab (image)
float X1, Y1, Z1;
Color::rgbxyz(r1, g1, b1, X1, Y1, Z1, xyz_rgb);
Color::XYZ2Lab(X1, Y1, Z1, L1, a_1, b_1);
//Color::Lab2Lch(a_1, b_1, c_1, h_1) ;
}
// converting color l lab(low) first color
if (twoc == 0) { // 2 colours
//Color::rgbxyz(rl, gl, bl, XL, YL, ZL, xyz_rgb);
XL = xl;
YL = yl;
ZL = zl;
if(algm <= 1) {//use H interpolate
Color::XYZ2Lab(XL, YL, ZL, LL, a_L, b_L);
if (algm == 1) {//use H interpolate
float unused;
Color::XYZ2Lab(xl, yl, zl, unused, a_L, b_L);
}
}
// converting color 2 to lab (universal or high)
X2 = x2;
Y2 = y2;
Z2 = z2;
if (algm == 1) {
Color::XYZ2Lab(X2, Y2, Z2, L2, a_2, b_2);
//Color::Lab2Lch(a_2, b_2, c_2, h_2) ;
float unused;
Color::XYZ2Lab(x2, y2, z2, unused, a_2, b_2);
}
float cal, calH, calm;
cal = calH = calm = 1.f - chromat;
float med = 1.f;
float medH = 0.f;
float calan;
calan = chromat;
float calby;
calby = luma;
float cal, calH;
cal = calH = 1.f - chromat;
if (twoc == 0) { // 2 colours
calan = chromat;
//calculate new balance chroma
constexpr float med = 1.f;
if (realL > iplow && realL <= med) {
cal = realL * calan / (iplow - med) - med * calan / (iplow - med);
cal = realL * chromat / (iplow - med) - chromat / (iplow - med);
} else if (realL <= iplow) {
cal = realL * calan / iplow;
cal = realL * chromat / iplow;
}
if (realL > medH && realL <= iphigh) {
calH = realL * calan / (iphigh - medH) - medH * calan / (iphigh - medH);
if (realL > 0.f && realL <= iphigh) {
calH = realL * chromat / iphigh;
} else if (realL > iphigh) {
calH = realL * calan; //*(iphigh-1.f) - calan*(iphigh-1.f);//it is better without transition in highlight
calH = realL * chromat; //*(iphigh-1.f) - chromat*(iphigh-1.f);//it is better without transition in highlight
}
}
float aaH, bbH;
if (algm <= 1) {
if (twoc == 0 && metchrom == 3) { // 2 colours only with special "ab"
if (algm == 1) {
aaH = a_1 + (a_2 - a_1) * calH;
bbH = b_1 + (b_2 - b_1) * calH; //pass to line after
const float aaH = a_1 + (a_2 - a_1) * calH;
const float bbH = b_1 + (b_2 - b_1) * calH; //pass to line after
a_1 = aaH + (a_L - aaH) * cal * balance;
b_1 = bbH + (b_L - bbH) * cal * balance;
}
@ -1572,25 +1515,24 @@ void Color::interpolateRGBColor (float realL, float iplow, float iphigh, int alg
a_1 = a_1 + (a_2 - a_1) * balance;
b_1 = b_1 + (b_2 - b_1) * balance;
} else if (metchrom == 1) {
a_1 = a_1 + (a_2 - a_1) * calan * balance;
b_1 = b_1 + (b_2 - b_1) * calan * balance;
a_1 = a_1 + (a_2 - a_1) * chromat * balance;
b_1 = b_1 + (b_2 - b_1) * chromat * balance;
} else if (metchrom == 2) {
a_1 = a_1 + (a_2 - a_1) * calan * balance;
b_1 = b_1 + (b_2 - b_1) * calby * balance;
a_1 = a_1 + (a_2 - a_1) * chromat * balance;
b_1 = b_1 + (b_2 - b_1) * luma * balance;
}
}
}
float X, Y, Z;
Color::Lab2XYZ(L1, a_1, b_1, X, Y, Z);
Color::xyz2rgb(X, Y, Z, ro, go, bo, rgb_xyz);// ro go bo in gamut
}
void Color::calcGamma (double pwr, double ts, int mode, GammaValues &gamma)
void Color::calcGamma (double pwr, double ts, GammaValues &gamma)
{
//from Dcraw (D.Coffin)
int i;
double g[6], bnd[2] = {0., 0.};
double g[6], bnd[2] = {};
g[0] = pwr;
g[1] = ts;
@ -1598,7 +1540,7 @@ void Color::calcGamma (double pwr, double ts, int mode, GammaValues &gamma)
bnd[g[1] >= 1.] = 1.;
if (g[1] && (g[1] - 1.) * (g[0] - 1.) <= 0.) {
for (i = 0; i < 99; i++) {
for (int i = 0; i < 99; i++) {
g[2] = (bnd[0] + bnd[1]) / 2.;
if (g[0]) {
@ -1621,7 +1563,6 @@ void Color::calcGamma (double pwr, double ts, int mode, GammaValues &gamma)
g[5] = 1. / (g[1] * SQR(g[3]) / 2. + 1. - g[2] - g[3] - g[2] * g[3] * (log(g[3]) - 1.)) - 1.;
}
if (!mode--) {
gamma[0] = g[0];
gamma[1] = g[1];
gamma[2] = g[2];
@ -1629,8 +1570,6 @@ void Color::calcGamma (double pwr, double ts, int mode, GammaValues &gamma)
gamma[4] = g[4];
gamma[5] = g[5];
gamma[6] = 0.;
return;
}
}
void Color::gammaf2lut (LUTf &gammacurve, float gamma, float start, float slope, float divisor, float factor)
{
@ -2039,7 +1978,7 @@ void Color::Lch2Luv(float c, float h, float &u, float &v)
* columns of the matrix p=xyz_rgb are RGB tristimulus primaries in XYZ
* c is the color fixed on the boundary; and m=0 for c=0, m=1 for c=255
*/
void Color::gamutmap(float &X, float &Y, float &Z, const double p[3][3])
void Color::gamutmap(float &X, float Y, float &Z, const double p[3][3])
{
float u = 4 * X / (X + 15 * Y + 3 * Z) - u0;
float v = 9 * Y / (X + 15 * Y + 3 * Z) - v0;
@ -2076,91 +2015,28 @@ void Color::gamutmap(float &X, float &Y, float &Z, const double p[3][3])
Z = (12 - 3 * u - 20 * v) * Y / (4 * v);
}
void Color::skinred ( double J, double h, double sres, double Sp, float dred, float protect_red, int sk, float rstprotection, float ko, double &s)
{
float factorskin, factorsat, factor, factorskinext, interm;
float scale = 100.0f / 100.1f; //reduction in normal zone
float scaleext = 1.0f; //reduction in transition zone
float deltaHH = 0.3f; //HH value transition : I have choice 0.3 radians
float HH;
bool doskin = false;
//rough correspondence between h (JC) and H (lab) that has relatively little importance because transitions that blur the correspondence is not linear
if ((float)h > 8.6f && (float)h <= 74.f ) {
HH = (1.15f / 65.4f) * (float)h - 0.0012f; //H > 0.15 H<1.3
doskin = true;
} else if((float)h > 0.f && (float)h <= 8.6f ) {
HH = (0.19f / 8.6f ) * (float)h - 0.04f; //H>-0.04 H < 0.15
doskin = true;
} else if((float)h > 355.f && (float)h <= 360.f) {
HH = (0.11f / 5.0f ) * (float)h - 7.96f; //H>-0.15 <-0.04
doskin = true;
} else if((float)h > 74.f && (float)h < 95.f ) {
HH = (0.30f / 21.0f) * (float)h + 0.24285f; //H>1.3 H<1.6
doskin = true;
}
if(doskin) {
float chromapro = sres / Sp;
if(sk == 1) { //in C mode to adapt dred to J
if (J < 16.0) {
dred = 40.0f;
} else if(J < 22.0) {
dred = 2.5f * (float)J;
} else if(J < 60.0) {
dred = 55.0f;
} else if(J < 70.0) {
dred = -1.5f * (float)J + 145.0f;
} else {
dred = 40.0f;
}
}
if(chromapro > 0.0) {
Color::scalered ( rstprotection, chromapro, 0.0, HH, deltaHH, scale, scaleext); //Scale factor
}
if(chromapro > 1.0) {
interm = (chromapro - 1.0f) * 100.0f;
factorskin = 1.0f + (interm * scale) / 100.0f;
factorskinext = 1.0f + (interm * scaleext) / 100.0f;
} else {
factorskin = chromapro ;
factorskinext = chromapro ;
}
factorsat = chromapro;
factor = factorsat;
Color::transitred ( HH, s, dred, factorskin, protect_red, factorskinext, deltaHH, factorsat, factor); //transition
s *= factor;
} else {
s = ko * sres;
}
}
void Color::skinredfloat ( float J, float h, float sres, float Sp, float dred, float protect_red, int sk, float rstprotection, float ko, float &s)
{
float HH;
bool doskin = false;
//rough correspondence between h (JC) and H (lab) that has relatively little importance because transitions that blur the correspondence is not linear
if ((float)h > 8.6f && (float)h <= 74.f ) {
HH = (1.15f / 65.4f) * (float)h - 0.0012f; //H > 0.15 H<1.3
if (h > 8.6f && h <= 74.f) {
HH = (1.15f / 65.4f) * h - 0.0012f; //H > 0.15 H<1.3
doskin = true;
} else if((float)h > 0.f && (float)h <= 8.6f ) {
HH = (0.19f / 8.6f ) * (float)h - 0.04f; //H>-0.04 H < 0.15
} else if(h > 0.f && h <= 8.6f) {
HH = (0.19f / 8.6f) * h - 0.04f; //H>-0.04 H < 0.15
doskin = true;
} else if((float)h > 355.f && (float)h <= 360.f) {
HH = (0.11f / 5.0f ) * (float)h - 7.96f; //H>-0.15 <-0.04
} else if(h > 355.f && h <= 360.f) {
HH = (0.11f / 5.0f) * h - 7.96f; //H>-0.15 <-0.04
doskin = true;
} else if((float)h > 74.f && (float)h < 95.f ) {
HH = (0.30f / 21.0f) * (float)h + 0.24285f; //H>1.3 H<1.6
} else if(h > 74.f && h < 95.f ) {
HH = (0.30f / 21.0f) * h + 0.24285f; //H>1.3 H<1.6
doskin = true;
}
if(doskin) {
float factorskin, factorsat, factor, factorskinext;
float factorskin, factor, factorskinext;
float deltaHH = 0.3f; //HH value transition : I have choice 0.3 radians
float chromapro = sres / Sp;
@ -2182,7 +2058,7 @@ void Color::skinredfloat ( float J, float h, float sres, float Sp, float dred, f
float scale = 0.999000999f; // 100.0f/100.1f; reduction in normal zone
float scaleext = 1.0f; //reduction in transition zone
Color::scalered ( rstprotection, chromapro, 0.0, HH, deltaHH, scale, scaleext);//Scale factor
float interm = (chromapro - 1.0f);
const float interm = chromapro - 1.0f;
factorskin = 1.0f + (interm * scale);
factorskinext = 1.0f + (interm * scaleext);
} else {
@ -2190,21 +2066,14 @@ void Color::skinredfloat ( float J, float h, float sres, float Sp, float dred, f
factorskinext = chromapro ;
}
factorsat = chromapro;
factor = factorsat;
Color::transitred ( HH, s, dred, factorskin, protect_red, factorskinext, deltaHH, factorsat, factor); //transition
factor = chromapro;
Color::transitred ( HH, s, dred, factorskin, protect_red, factorskinext, deltaHH, chromapro, factor); //transition
s *= factor;
} else {
s = ko * sres;
}
}
void Color::scalered ( const float rstprotection, const float param, const float limit, const float HH, const float deltaHH, float &scale, float &scaleext)
{
if(rstprotection < 99.9999f) {
@ -2262,32 +2131,21 @@ void Color::transitred (const float HH, float const Chprov1, const float dred, c
void Color::AllMunsellLch(bool lumaMuns, float Lprov1, float Loldd, float HH, float Chprov1, float CC, float &correctionHuechroma, float &correctlum)
{
bool contin1, contin2;
float correctionHue = 0.0, correctionHueLum = 0.0;
bool correctL;
if (CC >= 6.f && CC < 140.f) { //if C > 140 we say C=140 (only in Prophoto ...with very large saturation)
constexpr float huelimit[8] = { -2.48f, -0.55f, 0.44f, 1.52f, 1.87f, 3.09f, -0.27f, 0.44f}; //limits hue of blue-purple, red-yellow, green-yellow, red-purple
if(CC >= 6.0 && CC < 140) { //if C > 140 we say C=140 (only in Prophoto ...with very large saturation)
static const float huelimit[8] = { -2.48, -0.55, 0.44, 1.52, 1.87, 3.09, -0.27, 0.44}; //limits hue of blue-purple, red-yellow, green-yellow, red-purple
Chprov1 = rtengine::LIM(Chprov1, 6.f, 140.f);
if (Chprov1 > 140.f) {
Chprov1 = 139.f; //limits of LUTf
}
if (Chprov1 < 6.f) {
Chprov1 = 6.f;
}
for(int zo = 1; zo <= 4; zo++) {
for (int zo = 1; zo <= 4; ++zo) {
if (HH > huelimit[2 * zo - 2] && HH < huelimit[2 * zo - 1]) {
//zone=zo;
contin1 = contin2 = false;
correctL = false;
bool correctL = false;
float correctionHue = 0.f, correctionHueLum = 0.f;
MunsellLch (Lprov1, HH, Chprov1, CC, correctionHue, zo, correctionHueLum, correctL); //munsell chroma correction
correctionHuechroma = correctionHue; //preserve
if(lumaMuns) {
bool contin1 = false;
float correctlumprov = 0.f;
float correctlumprov2 = 0.f;
if(correctL) {
//for Munsell luminance correction
@ -2296,27 +2154,20 @@ void Color::AllMunsellLch(bool lumaMuns, float Lprov1, float Loldd, float HH, fl
correctL = false;
}
correctionHueLum = 0.0;
correctionHue = 0.0;
if(fabs(Lprov1 - Loldd) > 6.0) {
if (std::fabs(Lprov1 - Loldd) > 6.f) {
correctionHueLum = 0.f;
correctionHue = 0.f;
// correction if delta L significative..Munsell luminance
MunsellLch (Loldd, HH, Chprov1, Chprov1, correctionHue, zo, correctionHueLum, correctL);
if(correctL) {
correctlumprov2 = correctionHueLum;
contin2 = true;
correctL = false;
}
correctionHueLum = 0.0;
if(contin1 && contin2) {
correctlum = correctlumprov2 - correctlumprov;
if(contin1) {
correctlum = correctionHueLum - correctlumprov;
}
}
}
}
break;
}
}
}
}
@ -2337,9 +2188,6 @@ void Color::AllMunsellLch(bool lumaMuns, float Lprov1, float Loldd, float HH, fl
void Color::AllMunsellLch(float Lprov1, float HH, float Chprov1, float CC, float &correctionHuechroma)
{
float correctionHue = 0.f, correctionHueLum = 0.f;
bool correctL;
if(CC >= 6.f && CC < 140.f) { //if C > 140 we say C=140 (only in Prophoto ...with very large saturation)
static const float huelimit[8] = { -2.48f, -0.55f, 0.44f, 1.52f, 1.87f, 3.09f, -0.27f, 0.44f}; //limits hue of blue-purple, red-yellow, green-yellow, red-purple
@ -2352,7 +2200,8 @@ void Color::AllMunsellLch(float Lprov1, float HH, float Chprov1, float CC, float
for(int zo = 1; zo <= 4; zo++) {
if(HH > huelimit[2 * zo - 2] && HH < huelimit[2 * zo - 1]) {
//zone=zo;
correctL = false;
float correctionHue = 0.f, correctionHueLum = 0.f;
bool correctL = false;
MunsellLch (Lprov1, HH, Chprov1, CC, correctionHue, zo, correctionHueLum, correctL); //munsell chroma correction
correctionHuechroma = correctionHue; //preserve
break;
@ -2761,8 +2610,6 @@ void Color::gamutLchonly (float2 sincosval, float &Lprov1, float &Chprov1, const
*/
void Color::LabGamutMunsell(float *labL, float *laba, float *labb, const int N, bool corMunsell, bool lumaMuns, bool isHLEnabled, bool gamut, const double wip[3][3])
{
float correctlum = 0.f;
float correctionHuechroma = 0.f;
#ifdef __SSE2__
// precalculate H and C using SSE
float HHBuffer[N];
@ -2815,8 +2662,8 @@ void Color::LabGamutMunsell(float *labL, float *laba, float *labb, const int N,
}
labL[j] = Lprov1 * 327.68f;
correctionHuechroma = 0.f;
correctlum = 0.f;
float correctionHuechroma = 0.f;
float correctlum = 0.f;
if(corMunsell)
AllMunsellLch(lumaMuns, Lprov1, Loldd, HH, Chprov1, Coldd, correctionHuechroma, correctlum);

View File

@ -1006,8 +1006,6 @@ public:
* @brief Get the gamma curves' parameters used by LCMS2
* @param pwr gamma value [>1]
* @param ts slope [0 ; 20]
* @param mode [always 0]
* @imax imax [always 0]
* @param gamma a pointer to an array of 6 double gamma values:
* gamma0 used in ip2Lab2rgb [0 ; 1], usually near 0.5 (return value)
* gamma1 used in ip2Lab2rgb [0 ; 20], can be superior to 20, but it's quite unusual(return value)
@ -1016,7 +1014,7 @@ public:
* gamma4 used in ip2Lab2rgb [0 ; 1], usually near 0.03(return value)
* gamma5 used in ip2Lab2rgb [0 ; 1], usually near 0.5 (return value)
*/
static void calcGamma (double pwr, double ts, int mode, GammaValues &gamma);
static void calcGamma (double pwr, double ts, GammaValues &gamma);
/**
@ -1468,9 +1466,7 @@ public:
static void scalered ( float rstprotection, float param, float limit, float HH, float deltaHH, float &scale, float &scaleext);
static void transitred (float HH, float Chprov1, float dred, float factorskin, float protect_red, float factorskinext, float deltaHH, float factorsat, float &factor);
static void skinred ( double J, double h, double sres, double Sp, float dred, float protect_red, int sk, float rstprotection, float ko, double &s);
static void skinredfloat ( float J, float h, float sres, float Sp, float dred, float protect_red, int sk, float rstprotection, float ko, float &s);
// static void scaleredcdbl ( float skinprot, float param, float limit, float HH, float deltaHH, float &scale,float &scaleext);
static inline void pregamutlab(float lum, float hue, float &chr) //big approximation to limit gamut (Prophoto) before good gamut procedure for locallab chroma, to avoid crash
{
@ -1801,11 +1797,11 @@ public:
/**
* @brief Gamut correction in the XYZ color space
* @param X X channel input value and corrected output value [0 ; 65535]
* @param Y Y channel input value and corrected output value [0 ; 65535]
* @param Y Y channel input value[0 ; 65535]
* @param Z Z channel input value and corrected output value [0 ; 65535]
* @param p working profile
*/
static void gamutmap(float &X, float &Y, float &Z, const double p[3][3]);
static void gamutmap(float &X, float Y, float &Z, const double p[3][3]);
/**

View File

@ -29,7 +29,6 @@
#include "improcfun.h"
#include "LUT.h"
#include "opthelper.h"
#include "boxblur.h"
#include "rt_math.h"
#include "settings.h"
@ -247,8 +246,7 @@ void fillLut(LUTf &irangefn, int level, double dirpyrThreshold, float mult, floa
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void idirpyr_eq_channel_loc(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float mult, const float blurcb, const double dirpyrThreshold, float ** hue, float ** chrom, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev, bool multiThread)
void idirpyr_eq_channel_loc(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float mult, const double dirpyrThreshold, float ** hue, float ** chrom, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev, bool multiThread)
{
LUTf irangefn(0x20000);
fillLut(irangefn, level, dirpyrThreshold, mult, skinprot);
@ -258,35 +256,10 @@ void idirpyr_eq_channel_loc(float ** data_coarse, float ** data_fine, float ** b
#endif
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
float hipass = (data_fine[i][j] - data_coarse[i][j]);
const float hipass = data_fine[i][j] - data_coarse[i][j];
buffer[i][j] += irangefn[hipass + 0x10000] * hipass;
}
}
if(blurcb > 0.f && choice == 0 && level != 5) {
float multbis;
if (level == 4 && mult > 1.f) {
multbis = 1.f + 0.65f * (mult - 1.f);
} else if (level == 5 && mult > 1.f) {
multbis = 1.f + 0.45f * (mult - 1.f);
} else {
multbis = mult; //multbis to reduce artifacts for high values mult
}
AlignedBuffer<float> blurbufcbdl(width * height);
float rad = 0.05f * blurcb * fabs((level + 1) * (multbis - 1.f)) / scaleprev;
// printf("rad=%f level=%i\n", rad, level);
#ifdef _OPENMP
#pragma omp parallel if (multiThread)
#endif
// rtengine::boxblur<float, float>(buffer, buffer, blurbufcbdl.data, rad, rad, width, height);
rtengine::boxblur(buffer, buffer, rad, width, height, false);
blurbufcbdl.resize(0);
}
irangefn.clear();
}
void idirpyr_eq_channel(const float * const * data_coarse, const float * const * data_fine, float ** buffer, int width, int height, int level, float mult, const double dirpyrThreshold, const float * const * hue, const float * const * chrom, const double skinprot, float b_l, float t_l, float t_r)
@ -552,7 +525,7 @@ void ImProcFunctions::dirpyr_equalizercam(const CieImage *ncie, float ** src, fl
}
}
void ImProcFunctions::cbdl_local_temp(float ** src, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const float mergeL, const float contres, const float blurcb, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev, bool multiThread)
void ImProcFunctions::cbdl_local_temp(float ** src, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const float mergeL, const float contres, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev, bool multiThread)
{
constexpr int maxlevelloc = 6;
constexpr int scalesloc[maxlevelloc] = {1, 2, 4, 8, 16, 32};
@ -663,13 +636,12 @@ void ImProcFunctions::cbdl_local_temp(float ** src, float ** loctemp, int srcwid
for (int level = lastlevel - 1; level > 0; level--) {
idirpyr_eq_channel_loc(dirpyrlo[level], dirpyrlo[level - 1], residbuff, srcwidth, srcheight, level, multi[level], blurcb, dirpyrThreshold, nullptr, nullptr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice, scaleprev, multiThread);
idirpyr_eq_channel_loc(dirpyrlo[level], dirpyrlo[level - 1], residbuff, srcwidth, srcheight, level, multi[level], dirpyrThreshold, nullptr, nullptr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice, scaleprev, multiThread);
}
scale = scalesloc[0];
idirpyr_eq_channel_loc(dirpyrlo[0], src, residbuff, srcwidth, srcheight, 0, multi[0], blurcb, dirpyrThreshold, nullptr, nullptr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice, scaleprev, multiThread);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
idirpyr_eq_channel_loc(dirpyrlo[0], src, residbuff, srcwidth, srcheight, 0, multi[0], dirpyrThreshold, nullptr, nullptr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice, scaleprev, multiThread);
array2D<float> loct(srcwidth, srcheight);
#ifdef _OPENMP

View File

@ -281,7 +281,6 @@ void RawImageSource::fast_demosaic()
int right = min(left + TS, W - bord + 2);
#ifdef __SSE2__
int j, cc;
__m128 wtuv, wtdv, wtlv, wtrv;
__m128 greenv, tempv, absv, abs2v;
__m128 c16v = _mm_set1_ps( 16.0f );
@ -302,7 +301,7 @@ void RawImageSource::fast_demosaic()
float wtu, wtd, wtl, wtr;
#ifdef __SSE2__
selmask = (vmask)_mm_andnot_ps( (__m128)selmask, (__m128)andmask);
int j, cc;
for (j = left, cc = 0; j < right - 3; j += 4, cc += 4) {
tempv = LVFU(rawData[i][j]);
absv = vabsf(LVFU(rawData[i - 1][j]) - LVFU(rawData[i + 1][j]));
@ -421,16 +420,12 @@ void RawImageSource::fast_demosaic()
temp1v = LVFU(redtile[rr * TS + cc]);
temp2v = greenv - zd25v * (greensumv - LVFU(redtile[(rr - 1) * TS + cc]) - LVFU(redtile[(rr + 1) * TS + cc]) - LVFU(redtile[rr * TS + cc - 1]) - LVFU(redtile[rr * TS + cc + 1]));
// temp2v = greenv - zd25v*((LVFU(greentile[(rr-1)*TS+cc])-LVFU(redtile[(rr-1)*TS+cc]))+(LVFU(greentile[(rr+1)*TS+cc])-LVFU(redtile[(rr+1)*TS+cc]))+
// (LVFU(greentile[rr*TS+cc-1])-LVFU(redtile[rr*TS+cc-1]))+(LVFU(greentile[rr*TS+cc+1])-LVFU(redtile[rr*TS+cc+1])));
_mm_storeu_ps( &redtile[rr * TS + cc], vself(selmask, temp1v, temp2v));
temp1v = LVFU(bluetile[rr * TS + cc]);
temp2v = greenv - zd25v * (greensumv - LVFU(bluetile[(rr - 1) * TS + cc]) - LVFU(bluetile[(rr + 1) * TS + cc]) - LVFU(bluetile[rr * TS + cc - 1]) - LVFU(bluetile[rr * TS + cc + 1]));
// temp2v = greenv - zd25v*((LVFU(greentile[(rr-1)*TS+cc])-LVFU(bluetile[(rr-1)*TS+cc]))+(LVFU(greentile[(rr+1)*TS+cc])-LVFU(bluetile[(rr+1)*TS+cc]))+
// (LVFU(greentile[rr*TS+cc-1])-LVFU(bluetile[rr*TS+cc-1]))+(LVFU(greentile[rr*TS+cc+1])-LVFU(bluetile[rr*TS+cc+1])));
_mm_storeu_ps( &bluetile[rr * TS + cc], vself(selmask, temp1v, temp2v));
}
@ -450,7 +445,7 @@ void RawImageSource::fast_demosaic()
for (int i = top + 2, rr = 2; i < bottom - 2; i++, rr++) {
#ifdef __SSE2__
int j, cc;
for (j = left + 2, cc = 2; j < right - 5; j += 4, cc += 4) {
_mm_storeu_ps(&red[i][j], vmaxf(LVFU(redtile[rr * TS + cc]), ZEROV));
_mm_storeu_ps(&green[i][j], vmaxf(LVFU(greentile[rr * TS + cc]), ZEROV));

View File

@ -351,7 +351,7 @@ cmsHPROFILE rtengine::ProfileContent::toProfile() const
double slope = slopetag == 0 ? eps : slopetag;
GammaValues g_b; //gamma parameters
Color::calcGamma(pwr, ts, 0, g_b); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
Color::calcGamma(pwr, ts, g_b); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
cmsFloat64Number gammaParams[7]; //gamma parameters
gammaParams[4] = g_b[3] * ts;
gammaParams[0] = gammatag;

View File

@ -109,22 +109,22 @@ public:
} tmp;
tmp.f = f;
int32_t sign = (tmp.i >> 16) & 0x00008000;
const int32_t lsign = (tmp.i >> 16) & 0x00008000;
int32_t exponent = ((tmp.i >> 23) & 0x000000ff) - (127 - 15);
int32_t mantissa = tmp.i & 0x007fffff;
if (exponent <= 0) {
if (exponent < -10) {
return (uint16_t)sign;
return (uint16_t)lsign;
}
mantissa = (mantissa | 0x00800000) >> (1 - exponent);
if (mantissa & 0x00001000)
mantissa += 0x00002000;
return (uint16_t)(sign | (mantissa >> 13));
return (uint16_t)(lsign | (mantissa >> 13));
} else if (exponent == 0xff - (127 - 15)) {
if (mantissa == 0) {
return (uint16_t)(sign | 0x7c00);
return (uint16_t)(lsign | 0x7c00);
} else {
return (uint16_t)(sign | 0x7c00 | (mantissa >> 13));
return (uint16_t)(lsign | 0x7c00 | (mantissa >> 13));
}
}
if (mantissa & 0x00001000) {
@ -135,9 +135,9 @@ public:
}
}
if (exponent > 30) {
return (uint16_t)(sign | 0x7c00); // infinity with the same sign as f.
return (uint16_t)(lsign | 0x7c00); // infinity with the same sign as f.
}
return (uint16_t)(sign | (exponent << 10) | (mantissa >> 13));
return (uint16_t)(lsign | (exponent << 10) | (mantissa >> 13));
}
// From DNG SDK dng_utils.h
@ -148,13 +148,13 @@ public:
uint32_t i;
} tmp;
int32_t sign = (halfValue >> 15) & 0x00000001;
const int32_t lsign = (halfValue >> 15) & 0x00000001;
int32_t exponent = (halfValue >> 10) & 0x0000001f;
int32_t mantissa = halfValue & 0x000003ff;
if (exponent == 0) {
if (mantissa == 0) {
// Plus or minus zero
tmp.i = (uint32_t) (sign << 31);
tmp.i = (uint32_t) (lsign << 31);
return tmp.f;
} else {
// Denormalized number -- renormalize it
@ -168,7 +168,7 @@ public:
} else if (exponent == 31) {
if (mantissa == 0) {
// Positive or negative infinity, convert to maximum (16 bit) values.
tmp.i = (uint32_t)((sign << 31) | ((0x1eL + 127 - 15) << 23) | (0x3ffL << 13));
tmp.i = (uint32_t)((lsign << 31) | ((0x1eL + 127 - 15) << 23) | (0x3ffL << 13));
return tmp.f;
} else {
// Nan -- Just set to zero.
@ -179,19 +179,19 @@ public:
exponent += (127 - 15);
mantissa <<= 13;
// Assemble sign, exponent and mantissa.
tmp.i = (uint32_t) ((sign << 31) | (exponent << 23) | mantissa);
tmp.i = (uint32_t) ((lsign << 31) | (exponent << 23) | mantissa);
return tmp.f;
}
inline uint32_t DNG_FP24ToFloat(const uint8_t * input)
{
int32_t sign = (input [0] >> 7) & 0x01;
int32_t exponent = (input [0] ) & 0x7F;
const int32_t lsign = (input[0] >> 7) & 0x01;
int32_t exponent = input[0] & 0x7F;
int32_t mantissa = (((int32_t) input[1]) << 8) | input[2];
if (exponent == 0) {
if (mantissa == 0) {
// Plus or minus zero
return (uint32_t) (sign << 31);
return (uint32_t) (lsign << 31);
} else {
// Denormalized number -- renormalize it
while (!(mantissa & 0x00010000)) {
@ -204,7 +204,7 @@ public:
} else if (exponent == 127) {
if (mantissa == 0) {
// Positive or negative infinity, convert to maximum (24 bit) values.
return (uint32_t) ((sign << 31) | ((0x7eL + 128 - 64) << 23) | (0xffffL << 7));
return (uint32_t) ((lsign << 31) | ((0x7eL + 128 - 64) << 23) | (0xffffL << 7));
} else {
// Nan -- Just set to zero.
return 0;
@ -214,7 +214,7 @@ public:
exponent += (128 - 64);
mantissa <<= 7;
// Assemble sign, exponent and mantissa.
return (uint32_t) ((sign << 31) | (exponent << 23) | mantissa);
return (uint32_t) ((lsign << 31) | (exponent << 23) | mantissa);
}
void normalizeFloat(float srcMinVal, float srcMaxVal) override;

View File

@ -254,9 +254,9 @@ public:
void fftw_tile_blur(int GW, int GH, int tilssize , int max_numblox_W, int min_numblox_W, float **tmp1, int numThreads, double radius);
void maskforretinex(int sp, int before, float ** luminance, float ** out, int W_L, int H_L, int skip,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili,
const LocCCmaskCurve & locccmasretiCurve, bool lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool lhmasretiutili,
int llretiMask, bool retiMasktmap, bool retiMask, float rad, float lap, bool pde, float gamm, float slop, float chro, float blend,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
const LUTf & lmaskretilocalcurve, bool localmaskretiutili,
LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread,
bool delt, const float hueref, const float chromaref, const float lumaref,
float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance, float balanceh, float lumask);
@ -269,8 +269,8 @@ public:
void MSRLocal(int call, int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, const float* const *originalLuminance,
const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve,
const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
const LocCCmaskCurve & locccmasretiCurve, bool lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool lhmasretiutili, int llretiMask,
const LUTf & lmaskretilocalcurve, bool localmaskretiutili,
LabImage * transformed, bool retiMasktmap, bool retiMask,
bool delt, const float hueref, const float chromaref, const float lumaref,
float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance, float balanceh, float lumask);
@ -424,7 +424,7 @@ public:
float MadRgb(const float * DataList, int datalen);
// pyramid wavelet
void cbdl_local_temp(float ** src, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const float mergeL, const float contres, const float blurcb, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale, bool multiThread);
void cbdl_local_temp(float ** src, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const float mergeL, const float contres, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale, bool multiThread);
void dirpyr_equalizer(const float * const * src, float ** dst, int srcwidth, int srcheight, const float * const * l_a, const float * const * l_b, const double * mult, double dirpyrThreshold, double skinprot, float b_l, float t_l, float t_r, int scale); //Emil's directional pyramid wavelet
void dirpyr_equalizercam(const CieImage* ncie, float ** src, float ** dst, int srcwidth, int srcheight, const float * const * h_p, const float * const * C_p, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scale); //Emil's directional pyramid wavelet
void defringe(LabImage* lab);

View File

@ -485,8 +485,7 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw,
}
GammaValues g_a; //gamma parameters
constexpr int mode = 0;
Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
cmsFloat64Number gammaParams[7];

View File

@ -161,7 +161,7 @@ void calcGammaLut(double gamma, double ts, LUTf &gammaLut)
std::swap(pwr, gamm);
}
rtengine::Color::calcGamma(pwr, ts, 0, g_a); // call to calcGamma with selected gamma and slope
rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope
const double start = gamm2 < 1. ? g_a[2] : g_a[3];
const double add = g_a[4];
@ -392,7 +392,6 @@ struct local_params {
int chro, cont, sens, sensh, senscb, sensbn, senstm, sensex, sensexclu, sensden, senslc, senssf, senshs, senscolor;
float clarityml;
float contresid;
float blurcbdl;
bool deltaem;
float struco;
float strengrid;
@ -988,7 +987,6 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
int local_sensicb = locallab.spots.at(sp).sensicb;
float local_clarityml = (float) locallab.spots.at(sp).clarityml;
float local_contresid = (float) locallab.spots.at(sp).contresid;
int local_blurcbdl = 0; //(float) locallab.spots.at(sp).blurcbdl;
int local_contrast = locallab.spots.at(sp).contrast;
float local_lightness = (float) locallab.spots.at(sp).lightness;
float labgridALowloc = locallab.spots.at(sp).labgridALow;
@ -1238,7 +1236,6 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
lp.senscb = local_sensicb;
lp.clarityml = local_clarityml;
lp.contresid = local_contresid;
lp.blurcbdl = local_blurcbdl;
lp.cont = local_contrast;
lp.ligh = local_lightness;
lp.lowA = labgridALowloc;
@ -10780,7 +10777,7 @@ void ImProcFunctions::Lab_Local(
lp.mulloc[5] = 1.001f;
}
ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, lp.mulloc, 1.f, lp.threshol, lp.clarityml, lp.contresid, lp.blurcbdl, skinprot, false, b_l, t_l, t_r, b_r, choice, sk, multiThread);
ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, lp.mulloc, 1.f, lp.threshol, lp.clarityml, lp.contresid, skinprot, false, b_l, t_l, t_r, b_r, choice, sk, multiThread);
if (lp.softradiuscb > 0.f) {
softproc(origcbdl.get(), loctemp.get(), lp.softradiuscb, bfh, bfw, 0.001, 0.00001, 0.5f, sk, multiThread, 1);
@ -10819,7 +10816,7 @@ void ImProcFunctions::Lab_Local(
}
choice = 1;
ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, multc, rtengine::max(lp.chromacb, 1.f), lp.threshol, clarich, 0.f, lp.blurcbdl, skinprot, false, b_l, t_l, t_r, b_r, choice, sk, multiThread);
ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, multc, rtengine::max(lp.chromacb, 1.f), lp.threshol, clarich, 0.f, skinprot, false, b_l, t_l, t_r, b_r, choice, sk, multiThread);
float minC = loctemp->L[0][0] - std::sqrt(SQR(loctemp->a[0][0]) + SQR(loctemp->b[0][0]));

View File

@ -74,7 +74,7 @@ void calcGammaLut(double gamma, double ts, LUTf &gammaLut)
std::swap(pwr, gamm);
}
rtengine::Color::calcGamma(pwr, ts, 0, g_a); // call to calcGamma with selected gamma and slope
rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope
const double start = gamm2 < 1. ? g_a[2] : g_a[3];
const double add = g_a[4];
@ -779,9 +779,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, float ** out, int W_L, int H_L, int skip,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili,
const LocCCmaskCurve & locccmasretiCurve, bool lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool lhmasretiutili,
int llretiMask, bool retiMasktmap, bool retiMask, float rad, float lap, bool pde, float gamm, float slop, float chro, float blend,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
const LUTf & lmaskretilocalcurve, bool localmaskretiutili,
LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread,
bool delt, const float hueref, const float chromaref, const float lumaref,
float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance, float balanceh, float lumask)
@ -1127,23 +1127,20 @@ void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, flo
void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, const float* const *originalLuminance,
const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve,
const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
const LocCCmaskCurve & locccmasretiCurve, bool lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool lhmasretiutili, int llretiMask,
const LUTf & lmaskretilocalcurve, bool localmaskretiutili,
LabImage * transformed, bool retiMasktmap, bool retiMask,
bool delt, const float hueref, const float chromaref, const float lumaref,
float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance, float balanceh, float lumask)
{
BENCHFUN
bool py = true;
if (py) {//enabled
float mean, stddv, maxtr, mintr;
mean = 0.f;
stddv = 0.f;
maxtr = 0.f;
mintr = 0.f;
float delta;
constexpr float eps = 2.f;
bool useHslLin = false;
const float offse = loc.spots.at(sp).offs;
@ -1187,7 +1184,7 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
//nei = (int)(0.1f * nei + 2.f); //not too bad
nei = (int)(nei / (1.5f * skip)) / divsca;
vart *= sqrt(skip);
} else if (skip > 1 && skip < 4) {
} else if (skip > 1) {
//nei = (int)(0.3f * nei + 2.f);
nei = (int)(nei / skip) / divsca;
vart *= sqrt(skip);
@ -1238,10 +1235,8 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
pond /= log(elogt);
}
float kr = 1.f;//on FFTW
float kr;//on FFTW
float kg = 1.f;//on Gaussianblur
std::unique_ptr<float[]> buffer;
buffer.reset(new float[W_L * H_L]);
for (int scale = scal - 1; scale >= 0; --scale) {
// printf("retscale=%f scale=%i \n", mulradiusfftw * RetinexScales[scale], scale);
@ -1279,7 +1274,7 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
kg = 1.f;
kr = sigm;
}
printf("call=%i\n", call);
if (!fftw) { // || (fftw && call != 2)) {
if (scale == scal - 1) {
gaussianBlur(src, out, W_L, H_L, kg * RetinexScales[scale], true);
@ -1319,7 +1314,6 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
}
}
}
}
#ifdef _OPENMP
@ -1359,26 +1353,8 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
}
// srcBuffer.reset();
if (scal == 1) {//only if user select scal = 1
float kval = 1.f;
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int y = 0; y < H_L; ++y) {
for (int x = 0; x < W_L; ++x) {
float threslow = threslum * 163.f;
if (src[y][x] < threslow) {
kval = src[y][x] / threslow;
}
}
}
const float threslow = threslum * 163.f;
#ifdef _OPENMP
#pragma omp parallel for
@ -1386,27 +1362,27 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
for (int y = 0; y < H_L; ++y) {
for (int x = 0; x < W_L; ++x) {
float buf = (src[y][x] - out[y][x]) * value_1;
const float srcVal = src[y][x];
const float kval = rtengine::min(srcVal / threslow, 1.f);
float buf = (srcVal - out[y][x]) * value_1;
buf *= (buf > 0.f) ? lig : dar;
luminance[y][x] = LIM(src[y][x] + (1.f + kval) * buf, -32768.f, 32768.f);
luminance[y][x] = LIM(srcVal + (1.f + kval) * buf, -32768.f, 32768.f);
}
}
double avg = 0.f;
int ng = 0;
#ifdef _OPENMP
#pragma omp parallel for
#pragma omp parallel for reduction(+:avg)
#endif
for (int i = 0; i < H_L; i++) {
for (int j = 0; j < W_L; j++) {
avg += luminance[i][j];
ng++;
}
}
avg /= ng;
avg /= H_L * W_L;
avg /= 32768.f;
avg = LIM01(avg);
float contreal = 0.5f * vart;
@ -1422,14 +1398,14 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
#pragma omp parallel for
#endif
for (int i = 0; i < H_L; i++)
for (int i = 0; i < H_L; i++) {
for (int j = 0; j < W_L; j++) {
float buf = LIM01(luminance[i][j] / 32768.f);
buf = reti_contrast.getVal(buf);
buf *= 32768.f;
luminance[i][j] = buf;
}
}
}
srcBuffer.reset();
@ -1442,7 +1418,6 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
stddv = 0.f;
mean_stddv2(luminance, mean, stddv, W_L, H_L, maxtr, mintr);
// printf("mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", mean, stddv, delta, maxtr, mintr);
if (locRETtransCcurve && mean != 0.f && stddv != 0.f) { //if curve
float asig = 0.166666f / stddv;
@ -1503,9 +1478,7 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
maxi = maxtr - epsil;
}
delta = maxi - mini;
// printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr);
float delta = maxi - mini;
if (!delta) {
delta = 1.0f;
}
@ -1614,8 +1587,6 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
delete [] copylumBuffer;
copylumBuffer = nullptr;
// printf("mean=%f std=%f maxtr=%f mintr=%f\n", mean, stddv, maxtr, mintr);
} else {
#ifdef _OPENMP
#pragma omp for schedule(dynamic,16)
@ -1657,4 +1628,3 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
Tmax = maxtr;
}
}
}

View File

@ -285,15 +285,15 @@ void calcFrameBrightnessFactor(unsigned int frame, uint32_t datalen, LUTu *histo
for (int i = 0; i < 4; ++i) {
//find median of histogram
uint32_t median = 0, count = 0;
uint32_t lmedian = 0, count = 0;
while (count < datalen / 2) {
count += (*histo[i])[median];
++median;
count += (*histo[i])[lmedian];
++lmedian;
}
const float weight = (count - datalen / 2.f) / (*histo[i])[median - 1];
medians[i] = rtengine::intp(weight, (float)(median - 2), (float)(median - 1));
const float weight = (count - datalen / 2.f) / (*histo[i])[lmedian - 1];
medians[i] = rtengine::intp(weight, (float)(lmedian - 2), (float)(lmedian - 1));
}
for (int i = 0; i < 4; ++i) {

View File

@ -686,7 +686,7 @@ enum ProcEventCode {
EvLocallabcontresid = 660,
Evlocallabnoiselumf0 = 661,
Evlocallabnoiselumf2 = 662,
EvLocallabblurcbdl = 663,
//EvLocallabblurcbdl = 663,
Evlocallabblendmaskcb = 664,
Evlocallabradmaskcb = 665,
Evlocallabchromaskcb = 666,

View File

@ -3686,7 +3686,6 @@ LocallabParams::LocallabSpot::LocallabSpot() :
sensicb(60),
clarityml(0.1),
contresid(0),
blurcbdl(0.),
softradiuscb(0.0),
enacbMask(false),
CCmaskcbcurve{
@ -4309,7 +4308,6 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const
&& sensicb == other.sensicb
&& clarityml == other.clarityml
&& contresid == other.contresid
&& blurcbdl == other.blurcbdl
&& softradiuscb == other.softradiuscb
&& enacbMask == other.enacbMask
&& CCmaskcbcurve == other.CCmaskcbcurve
@ -5833,7 +5831,6 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || spot_edited->sensicb, "Locallab", "Sensicb_" + index_str, spot.sensicb, keyFile);
saveToKeyfile(!pedited || spot_edited->clarityml, "Locallab", "Clarityml_" + index_str, spot.clarityml, keyFile);
saveToKeyfile(!pedited || spot_edited->contresid, "Locallab", "Contresid_" + index_str, spot.contresid, keyFile);
saveToKeyfile(!pedited || spot_edited->blurcbdl, "Locallab", "Blurcbdl_" + index_str, spot.blurcbdl, keyFile);
saveToKeyfile(!pedited || spot_edited->softradiuscb, "Locallab", "Softradiuscb_" + index_str, spot.softradiuscb, keyFile);
saveToKeyfile(!pedited || spot_edited->enacbMask, "Locallab", "EnacbMask_" + index_str, spot.enacbMask, keyFile);
saveToKeyfile(!pedited || spot_edited->CCmaskcbcurve, "Locallab", "CCmaskcbCurve_" + index_str, spot.CCmaskcbcurve, keyFile);
@ -7577,7 +7574,6 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Locallab", "Sensicb_" + index_str, pedited, spot.sensicb, spotEdited.sensicb);
assignFromKeyfile(keyFile, "Locallab", "Clarityml_" + index_str, pedited, spot.clarityml, spotEdited.clarityml);
assignFromKeyfile(keyFile, "Locallab", "Contresid_" + index_str, pedited, spot.contresid, spotEdited.contresid);
assignFromKeyfile(keyFile, "Locallab", "Blurcbdl_" + index_str, pedited, spot.blurcbdl, spotEdited.blurcbdl);
assignFromKeyfile(keyFile, "Locallab", "Softradiuscb_" + index_str, pedited, spot.softradiuscb, spotEdited.softradiuscb);
assignFromKeyfile(keyFile, "Locallab", "EnacbMask_" + index_str, pedited, spot.enacbMask, spotEdited.enacbMask);
assignFromKeyfile(keyFile, "Locallab", "CCmaskcbCurve_" + index_str, pedited, spot.CCmaskcbcurve, spotEdited.CCmaskcbcurve);

View File

@ -1397,7 +1397,6 @@ struct LocallabParams {
int sensicb;
double clarityml;
int contresid;
double blurcbdl;
double softradiuscb;
bool enacbMask;
std::vector<double> CCmaskcbcurve;

View File

@ -1717,10 +1717,8 @@ void RawImageSource::retinexPrepareBuffers(const ColorManagementParams& cmp, con
std::swap(pwr, gamm);
}
int mode = 0;
Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope
Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope
// printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4);
double start;
double add;
@ -1984,13 +1982,12 @@ void RawImageSource::retinex(const ColorManagementParams& cmp, const RetinexPara
double gamm = deh.gam;
double gamm2 = gamm;
double ts = deh.slope;
int mode = 0;
if (gamm2 < 1.) {
std::swap(pwr, gamm);
}
Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope
Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope
double mul = 1. + g_a[4];
double add;

View File

@ -690,7 +690,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
LUMINANCECURVE, // EvLocallabcontresid
LUMINANCECURVE, // Evlocallabnoiselumf0
LUMINANCECURVE, // Evlocallabnoiselumf2
LUMINANCECURVE, // Evlocallabblurcbdl
0, // Evlocallabblurcbdl
LUMINANCECURVE, // Evlocallabblendmaskcb
LUMINANCECURVE, // Evlocallabradmaskcb
LUMINANCECURVE, // Evlocallabchromaskcb

View File

@ -1180,7 +1180,6 @@ void ImProcFunctions::ToneMapFattal02(Imagefloat *rgb, const FattalToneMappingPa
scale = (oldMedian == 0.f || newMedian == 0.f) ? 65535.f : (oldMedian / newMedian); // avoid Nan
} else {
scale = 65535.f;
{
float ratio = 0.f;
int ww, hh;

View File

@ -309,7 +309,6 @@ ControlSpotPanel::ControlSpotPanel():
sigc::mem_fun(
*this, &ControlSpotPanel::qualityMethodChanged));
ctboxqualitymethod->pack_start(*qualityMethod_);
// pack_start(*ctboxqualitymethod);
if (showtooltip) {
expTransGrad_->set_tooltip_text(M("TP_LOCALLAB_TRANSIT_TOOLTIP"));
@ -319,21 +318,9 @@ ControlSpotPanel::ControlSpotPanel():
if (showtooltip) {
transit_->set_tooltip_text(M("TP_LOCALLAB_TRANSIT_TOOLTIP"));
}
if (showtooltip) {
transitweak_->set_tooltip_text(M("TP_LOCALLAB_TRANSITWEAK_TOOLTIP"));
}
if (showtooltip) {
feather_->set_tooltip_text(M("TP_LOCALLAB_FEATH_TOOLTIP"));
}
if (showtooltip) {
transitgrad_->set_tooltip_text(M("TP_LOCALLAB_TRANSITGRAD_TOOLTIP"));
}
if (showtooltip) {
scopemask_->set_tooltip_text(M("TP_LOCALLAB_SCOPEMASK_TOOLTIP"));
}

View File

@ -470,9 +470,8 @@ void HistogramRGBArea::updateBackBuffer (int r, int g, int b, const Glib::ustrin
cc->set_antialias(Cairo::ANTIALIAS_NONE);
cc->set_line_width (1.0 * s);
double xpos;
if ( r != -1 && g != -1 && b != -1 ) {
double xpos;
if (needRed) {
// Red
cc->set_source_rgb(1.0, 0.0, 0.0);

View File

@ -881,8 +881,7 @@ void ICCProfileCreator::savePressed()
double ts = slope;
double slope2 = slope == 0 ? eps : slope;
int mode = 0;
rtengine::Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
rtengine::Color::calcGamma(pwr, ts, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
ga[4] = g_a[3] * ts;
//printf("g_a.gamma0=%f g_a.gamma1=%f g_a.gamma2=%f g_a.gamma3=%f g_a.gamma4=%f\n", g_a.gamma0,g_a.gamma1,g_a.gamma2,g_a.gamma3,g_a.gamma4);
ga[0] = gamma;

View File

@ -1093,7 +1093,6 @@ private:
Gtk::Frame* const levFrame;
Adjuster* const chromacbdl;
Adjuster* const threshold;
Adjuster* const blurcbdl;
Adjuster* const clarityml;
Adjuster* const contresid;
Adjuster* const softradiuscb;

View File

@ -438,159 +438,63 @@ void LocallabTone::setDefaults(const rtengine::procparams::ProcParams* defParams
void LocallabTone::adjusterChanged(Adjuster* a, double newval)
{
if (isLocActivated && exp->getEnabled()) {
if (isLocActivated && exp->getEnabled() && listener) {
const auto spName = " (" + escapeHtmlChars(spotName) + ")";
if (a == amount) {
if (listener) {
listener->panelChanged(Evlocallabamount,
amount->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == stren) {
if (listener) {
listener->panelChanged(Evlocallabstren,
stren->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == gamma) {
if (listener) {
listener->panelChanged(Evlocallabgamma,
gamma->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == satur) {
if (listener) {
listener->panelChanged(Evlocallabsatur,
satur->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == estop) {
if (listener) {
listener->panelChanged(Evlocallabestop,
estop->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == scaltm) {
if (listener) {
listener->panelChanged(Evlocallabscaltm,
scaltm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == rewei) {
if (listener) {
listener->panelChanged(Evlocallabrewei,
rewei->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == softradiustm) {
if (listener) {
listener->panelChanged(Evlocallabsoftradiustm,
softradiustm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == sensitm) {
if (listener) {
listener->panelChanged(Evlocallabsensitm,
sensitm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == blendmasktm) {
if (listener) {
listener->panelChanged(Evlocallabblendmasktm,
blendmasktm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == lapmasktm) {
if (listener) {
listener->panelChanged(Evlocallablapmasktm,
lapmasktm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == radmasktm) {
if (listener) {
listener->panelChanged(Evlocallabradmasktm,
radmasktm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == chromasktm) {
if (listener) {
listener->panelChanged(Evlocallabchromasktm,
chromasktm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == gammasktm) {
if (listener) {
listener->panelChanged(Evlocallabgammasktm,
gammasktm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == slomasktm) {
if (listener) {
listener->panelChanged(Evlocallabslomasktm,
slomasktm->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
listener->panelChanged(Evlocallabamount, amount->getTextValue() + spName);
} else if (a == stren) {
listener->panelChanged(Evlocallabstren, stren->getTextValue() + spName);
} else if (a == gamma) {
listener->panelChanged(Evlocallabgamma, gamma->getTextValue() + spName);
} else if (a == satur) {
listener->panelChanged(Evlocallabsatur, satur->getTextValue() + spName);
} else if (a == estop) {
listener->panelChanged(Evlocallabestop, estop->getTextValue() + spName);
} else if (a == scaltm) {
listener->panelChanged(Evlocallabscaltm, scaltm->getTextValue() + spName);
} else if (a == rewei) {
listener->panelChanged(Evlocallabrewei, rewei->getTextValue() + spName);
} else if (a == softradiustm) {
listener->panelChanged(Evlocallabsoftradiustm, softradiustm->getTextValue() + spName);
} else if (a == sensitm) {
listener->panelChanged(Evlocallabsensitm, sensitm->getTextValue() + spName);
} else if (a == blendmasktm) {
listener->panelChanged(Evlocallabblendmasktm, blendmasktm->getTextValue() + spName);
} else if (a == lapmasktm) {
listener->panelChanged(Evlocallablapmasktm, lapmasktm->getTextValue() + spName);
} else if (a == radmasktm) {
listener->panelChanged(Evlocallabradmasktm, radmasktm->getTextValue() + spName);
} else if (a == chromasktm) {
listener->panelChanged(Evlocallabchromasktm, chromasktm->getTextValue() + spName);
} else if (a == gammasktm) {
listener->panelChanged(Evlocallabgammasktm, gammasktm->getTextValue() + spName);
} else if (a == slomasktm) {
listener->panelChanged(Evlocallabslomasktm, slomasktm->getTextValue() + spName);
}
}
}
void LocallabTone::curveChanged(CurveEditor* ce)
{
if (isLocActivated && exp->getEnabled()) {
if (isLocActivated && exp->getEnabled() && listener) {
const auto spName = M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")";
if (ce == CCmasktmshape) {
if (listener) {
listener->panelChanged(EvlocallabCCmasktmshape,
M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (ce == LLmasktmshape) {
if (listener) {
listener->panelChanged(EvlocallabLLmasktmshape,
M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (ce == HHmasktmshape) {
if (listener) {
listener->panelChanged(EvlocallabHHmasktmshape,
M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (ce == Lmasktmshape) {
if (listener) {
listener->panelChanged(EvlocallabLmasktmshape,
M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")");
}
listener->panelChanged(EvlocallabCCmasktmshape, spName);
} else if (ce == LLmasktmshape) {
listener->panelChanged(EvlocallabLLmasktmshape, spName);
} else if (ce == HHmasktmshape) {
listener->panelChanged(EvlocallabHHmasktmshape, spName);
} else if (ce == Lmasktmshape) {
listener->panelChanged(EvlocallabLmasktmshape, spName);
}
}
}
void LocallabTone::enabledChanged()
{
if (isLocActivated) {
if (listener) {
if (exp->getEnabled()) {
listener->panelChanged(EvLocenatonemap,
M("GENERAL_ENABLED") + " (" + escapeHtmlChars(spotName) + ")");
} else {
listener->panelChanged(EvLocenatonemap,
M("GENERAL_DISABLED") + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (isLocActivated && listener) {
listener->panelChanged(EvLocenatonemap, (exp->getEnabled() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"))
+ " (" + escapeHtmlChars(spotName) + ")");
}
}
@ -3686,7 +3590,6 @@ LocallabCBDL::LocallabCBDL():
levFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LEVFRA")))),
chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0., 1.5, 0.01, 0.))),
threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 1., 0.01, 0.2))),
blurcbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURCBDL"), 0., 100., 0.1, 0.))),
clarityml(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARITYML"), 0.1, 100., 0.1, 0.1))),
contresid(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTRESID"), -100, 100, 1, 0))),
softradiuscb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.5, 0.))),
@ -3722,8 +3625,6 @@ LocallabCBDL::LocallabCBDL():
threshold->setAdjusterListener(this);
blurcbdl->setAdjusterListener(this);
clarityml->setAdjusterListener(this);
contresid->setAdjusterListener(this);
@ -3806,7 +3707,6 @@ LocallabCBDL::LocallabCBDL():
levBox->pack_start(*threshold);
levFrame->add(*levBox);
pack_start(*levFrame);
// pack_start(*blurcbdl);
Gtk::Frame* const residFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_RESID")));
residFrame->set_label_align(0.025, 0.5);
ToolParamBlock* const residBox = Gtk::manage(new ToolParamBlock());
@ -3932,7 +3832,6 @@ void LocallabCBDL::read(const rtengine::procparams::ProcParams* pp, const Params
chromacbdl->setValue(spot.chromacbdl);
threshold->setValue(spot.threshold);
blurcbdl->setValue(spot.blurcbdl);
clarityml->setValue(spot.clarityml);
contresid->setValue((double)spot.contresid);
softradiuscb->setValue(spot.softradiuscb);
@ -3976,7 +3875,6 @@ void LocallabCBDL::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped
spot.chromacbdl = chromacbdl->getValue();
spot.threshold = threshold->getValue();
spot.blurcbdl = blurcbdl->getValue();
spot.clarityml = clarityml->getValue();
spot.contresid = contresid->getIntValue();
spot.softradiuscb = softradiuscb->getValue();
@ -4011,7 +3909,6 @@ void LocallabCBDL::setDefaults(const rtengine::procparams::ProcParams* defParams
chromacbdl->setDefault(defSpot.chromacbdl);
threshold->setDefault(defSpot.threshold);
blurcbdl->setDefault(defSpot.blurcbdl);
clarityml->setDefault(defSpot.clarityml);
contresid->setDefault((double)defSpot.contresid);
softradiuscb->setDefault(defSpot.softradiuscb);
@ -4058,13 +3955,6 @@ void LocallabCBDL::adjusterChanged(Adjuster* a, double newval)
}
}
if (a == blurcbdl) {
if (listener) {
listener->panelChanged(EvLocallabblurcbdl,
blurcbdl->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
}
}
if (a == clarityml) {
if (listener) {
listener->panelChanged(EvLocallabclarityml,

View File

@ -1452,7 +1452,6 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
locallab.spots.at(j).sensicb = locallab.spots.at(j).sensicb && pSpot.sensicb == otherSpot.sensicb;
locallab.spots.at(j).clarityml = locallab.spots.at(j).clarityml && pSpot.clarityml == otherSpot.clarityml;
locallab.spots.at(j).contresid = locallab.spots.at(j).contresid && pSpot.contresid == otherSpot.contresid;
locallab.spots.at(j).blurcbdl = locallab.spots.at(j).blurcbdl && pSpot.blurcbdl == otherSpot.blurcbdl;
locallab.spots.at(j).softradiuscb = locallab.spots.at(j).softradiuscb && pSpot.softradiuscb == otherSpot.softradiuscb;
locallab.spots.at(j).enacbMask = locallab.spots.at(j).enacbMask && pSpot.enacbMask == otherSpot.enacbMask;
locallab.spots.at(j).CCmaskcbcurve = locallab.spots.at(j).CCmaskcbcurve && pSpot.CCmaskcbcurve == otherSpot.CCmaskcbcurve;
@ -4717,10 +4716,6 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.locallab.spots.at(i).contresid = mods.locallab.spots.at(i).contresid;
}
if (locallab.spots.at(i).blurcbdl) {
toEdit.locallab.spots.at(i).blurcbdl = mods.locallab.spots.at(i).blurcbdl;
}
if (locallab.spots.at(i).softradiuscb) {
toEdit.locallab.spots.at(i).softradiuscb = mods.locallab.spots.at(i).softradiuscb;
}
@ -6483,7 +6478,6 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) :
sensicb(v),
clarityml(v),
contresid(v),
blurcbdl(v),
softradiuscb(v),
enacbMask(v),
CCmaskcbcurve(v),
@ -6981,7 +6975,6 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v)
CCmaskcbcurve = v;
LLmaskcbcurve = v;
HHmaskcbcurve = v;
blurcbdl = v;
blendmaskcb = v;
radmaskcb = v;
chromaskcb = v;

View File

@ -810,7 +810,6 @@ public:
bool sensicb;
bool clarityml;
bool contresid;
bool blurcbdl;
bool softradiuscb;
bool enacbMask;
bool CCmaskcbcurve;