Fix some value and code duplication in parameter initialization.

This commit is contained in:
Adam Reichold
2016-02-07 13:35:16 +01:00
parent d2c13ff1aa
commit 246115ecb2
2 changed files with 13 additions and 30 deletions

View File

@@ -41,8 +41,6 @@ const int numprof = 7;
void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image)
{
//gamutmap(lab);
if (monitorTransform) {
int W = lab->W;
@@ -386,15 +384,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
Image16* image = new Image16 (cw, ch);
float p1, p2, p3, p4, p5, p6; //primaries
//default primaries
p1 = 0.7347; //Prophoto primaries
p2 = 0.2653;
p3 = 0.1596;
p4 = 0.8404;
p5 = 0.0366;
p6 = 0.0001;
//double ga0,ga1,ga2,ga3,ga4,ga5=0.0,ga6=0.0;//gamma parameters
double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; //gamma parameters
double pwr;
double ts;
@@ -409,15 +399,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
//primaries for 7 working profiles ==> output profiles
// eventually to adapt primaries if RT used special profiles !
if(profi == "ProPhoto") {
p1 = 0.7347; //Prophoto primaries
p2 = 0.2653;
p3 = 0.1596;
p4 = 0.8404;
p5 = 0.0366;
p6 = 0.0001;
select_temp = 1;
} else if (profi == "WideGamut") {
if (profi == "WideGamut") {
p1 = 0.7350; //Widegamut primaries
p2 = 0.2650;
p3 = 0.1150;
@@ -465,6 +447,14 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
p5 = 0.1300;
p6 = 0.0350;
select_temp = 1;
} else {
p1 = 0.7347; //ProPhoto and default primaries
p2 = 0.2653;
p3 = 0.1596;
p4 = 0.8404;
p5 = 0.0366;
p6 = 0.0001;
select_temp = 1;
}
if (!freegamma) {//if Free gamma not selected

View File

@@ -2031,17 +2031,10 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float *
float interm = 0.f;
if(cp.lip3 && cp.lipp) {
// comparaison betwwen pixel and neighbours
float kneigh = 38.f;
float somm = 50.f;
if(cp.neigh == 0) {
kneigh = 38.f;
somm = 50.f;
} else if(cp.neigh == 1) {
kneigh = 28.f;
somm = 40.f;
}
// comparaison between pixel and neighbours
const auto neigh = cp.neigh == 1;
const auto kneigh = neigh ? 28.f : 38.f;
const auto somm = neigh ? 40.f : 50.f;
for (int dir = 1; dir < 4; dir++) { //neighbours proxi
koeLi[lvl * 3 + dir - 1][i * W_L + j] = (kneigh * koeLi[lvl * 3 + dir - 1][i * W_L + j] + 2.f * koeLi[lvl * 3 + dir - 1][(i - 1) * W_L + j] + 2.f * koeLi[lvl * 3 + dir - 1][(i + 1) * W_L + j]