MSRLocal(): Fix a race

This commit is contained in:
Ingo Weyrich
2020-07-17 10:48:52 +02:00
parent 6cb29be31c
commit 2d402a4bae

View File

@@ -1384,20 +1384,18 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
}
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;