clean code

This commit is contained in:
Desmis 2019-05-01 08:52:37 +02:00
parent c8f24b4335
commit 24c44dec11
2 changed files with 42 additions and 41 deletions

View File

@ -47,6 +47,7 @@ void ImProcFunctions::localContrast(LabImage *lab, float **destination, const Lo
const float light = localContrastParams.lightness; const float light = localContrastParams.lightness;
array2D<float> buf(width, height); array2D<float> buf(width, height);
const float sigma = localContrastParams.radius / scale; const float sigma = localContrastParams.radius / scale;
// printf("wi%i he=%i am=%f da=%f li=%f si=%f\n", width, height, a, dark, light, sigma);
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel if(multiThread) #pragma omp parallel if(multiThread)
#endif #endif

View File

@ -1670,72 +1670,72 @@ void ImProcFunctions::InverseBlurNoise_Local(const struct local_params & lp, co
#pragma omp for schedule(dynamic,16) #pragma omp for schedule(dynamic,16)
#endif #endif
for (int y = 0; y < transformed->H; y++) { for (int y = 0; y < transformed->H; y++) {
int loy = cy + y; int loy = cy + y;
for (int x = 0; x < transformed->W; x++) { for (int x = 0; x < transformed->W; x++) {
int lox = cx + x; int lox = cx + x;
int zone; int zone;
float localFactor; float localFactor;
if (lp.shapmet == 0) { if (lp.shapmet == 0) {
calcTransition(lox, loy, ach, lp, zone, localFactor); calcTransition(lox, loy, ach, lp, zone, localFactor);
} else if (lp.shapmet == 1) { } else if (lp.shapmet == 1) {
calcTransitionrect(lox, loy, ach, lp, zone, localFactor); calcTransitionrect(lox, loy, ach, lp, zone, localFactor);
} }
float rL = origblur->L[y][x] / 327.68f; float rL = origblur->L[y][x] / 327.68f;
float dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); float dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL));
float reducdE; float reducdE;
calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensbn , reducdE); calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensbn , reducdE);
switch (zone) { switch (zone) {
case 0: { // outside selection and outside transition zone => full effect, no transition case 0: { // outside selection and outside transition zone => full effect, no transition
float difL = tmp1->L[y][x] - original->L[y][x]; float difL = tmp1->L[y][x] - original->L[y][x];
transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE); transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE);
if (!lp.actsp) { if (!lp.actsp) {
transformed->a[y][x] = CLIPC(tmp1->a[y][x]); transformed->a[y][x] = CLIPC(tmp1->a[y][x]);
transformed->b[y][x] = CLIPC(tmp1->b[y][x]); transformed->b[y][x] = CLIPC(tmp1->b[y][x]);
}
break;
} }
break; case 1: { // inside transition zone
} float difL = tmp1->L[y][x] - original->L[y][x];
float difa = tmp1->a[y][x] - original->a[y][x];
float difb = tmp1->b[y][x] - original->b[y][x];
case 1: { // inside transition zone float factorx = 1.f - localFactor;
float difL = tmp1->L[y][x] - original->L[y][x]; difL *= factorx;
float difa = tmp1->a[y][x] - original->a[y][x]; difa *= factorx;
float difb = tmp1->b[y][x] - original->b[y][x]; difb *= factorx;
float factorx = 1.f - localFactor; transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE);
difL *= factorx;
difa *= factorx;
difb *= factorx;
transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE); if (!lp.actsp) {
if (!lp.actsp) { transformed->a[y][x] = CLIPC(original->a[y][x] + difa);
transformed->b[y][x] = CLIPC(original->b[y][x] + difb);
}
transformed->a[y][x] = CLIPC(original->a[y][x] + difa); break;
transformed->b[y][x] = CLIPC(original->b[y][x] + difb);
} }
break; case 2: { // inside selection => no effect, keep original values
} transformed->L[y][x] = original->L[y][x];
case 2: { // inside selection => no effect, keep original values if (!lp.actsp) {
transformed->L[y][x] = original->L[y][x];
if (!lp.actsp) { transformed->a[y][x] = original->a[y][x];
transformed->b[y][x] = original->b[y][x];
transformed->a[y][x] = original->a[y][x]; }
transformed->b[y][x] = original->b[y][x];
} }
} }
} }
} }
} }
}
delete origblur; delete origblur;
} }