Clean and format code

This commit is contained in:
Desmis
2019-09-22 10:37:35 +02:00
parent 7ec3b17d7b
commit c10453b4ce
2 changed files with 80 additions and 72 deletions

View File

@@ -877,9 +877,6 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L
if (!logli) {
useHslLin = true;
printf("logar\n");
} else {
printf("linear\n");
}
//empirical skip evaluation : very difficult because quasi all parameters interfere
@@ -894,7 +891,10 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L
// variance vart
//not too bad proposition
float divsca = 1.f;
if(scal >=3) divsca = sqrt(scal / 3.f);
if (scal >= 3) {
divsca = sqrt(scal / 3.f);
}
if (skip >= 4) {
//nei = (int)(0.1f * nei + 2.f); //not too bad
@@ -962,18 +962,24 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L
float *buffer = new float[W_L * H_L];
float kr = 1.f;//on FFTW
float kg = 1.f;//on Gaussianblur
for (int scale = scal - 1; scale >= 0; scale--) {
// printf("retscale=%f scale=%i \n", mulradiusfftw * RetinexScales[scale], scale);
//emprical adjustement between FFTW radius and Gaussainblur
//under 50 ==> 10.f
// 400 ==> 1.f
float sigm = 1.f;
if (settings->fftwsigma == false) { //empirical formula
sigm = RetinexScales[scale];
float ak = -9.f / 350.f;
float bk = 10.f - 50.f * ak;
kr = ak * sigm + bk;
if(sigm < 50.f) kr = 10.f;
if (sigm < 50.f) {
kr = 10.f;
}
//above 400 at 5000 ==> 20.f
if (sigm > 400.f) { //increase ==> 5000
float ka = 19.f / 4600.f;
@@ -982,6 +988,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L
float kga = -0.14f / 4600.f;//decrease
float kgb = 1.f - 400.f * kga;
kg = kga * sigm + kgb;
if (sigm > 5000.f) {
kr = ka * 5000.f + kb;
kg = kga * 5000.f + kgb;
@@ -992,6 +999,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L
kg = 1.f;
kr = sigm;
}
if (!fftw) {
#ifdef _OPENMP
#pragma omp parallel //disabled with FFTW
@@ -1008,15 +1016,13 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L
}
}
} else {
if (scale == scal - 1)
{
if (scale == scal - 1) {
if (settings->fftwsigma == false) { //empirical formula
ImProcFunctions::fftw_convol_blur2(src, out, W_L, H_L, (kr * RetinexScales[scale]), 0, 0);
} else {
ImProcFunctions::fftw_convol_blur2(src, out, W_L, H_L, (SQR(RetinexScales[scale])), 0, 0);
}
} else // reuse result of last iteration
{
} else { // reuse result of last iteration
// out was modified in last iteration => restore it
if (settings->fftwsigma == false) { //empirical formula
ImProcFunctions::fftw_convol_blur2(out, out, W_L, H_L, sqrtf(SQR(kr * RetinexScales[scale]) - SQR(kr * RetinexScales[scale + 1])), 0, 0);
@@ -1025,6 +1031,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L
}
}
}
if (scale == 1) { //equalize last scale with darkness and lightness
if (dar != 1.f || lig != 1.f) {
@@ -1227,8 +1234,6 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L
}
}
if(useHslLin) printf("Lineaiare!!!\n");
else printf("LOG\n");
#ifdef __SSE2__
vfloat pondv = F2V(pond);
@@ -1322,6 +1327,7 @@ else printf("LOG\n");
for (int j = 0; j < W_L; j++) {
luminance[i][j] = ble[i][j] * deltatran + mintran;
}
ble(0, 0);
guid(0, 0);
}
@@ -1447,10 +1453,12 @@ else printf("LOG\n");
for (int j = 0; j < W_L; j++) {
luminance[i][j] = ble[i][j] * deltatran + mintran;
}
ble(0, 0);
guid(0, 0);
}
delete [] buffer;
// src(0,0);
// out(0,0);