use loop index (#20307)

old-commit-hash: 8a966de2b6
This commit is contained in:
Dean Lee
2021-03-12 09:24:02 +08:00
committed by GitHub
parent 7b243b8747
commit 4dc07fe68c
+2 -2
View File
@@ -16,7 +16,7 @@ uint16_t get_lapmap_one(const int16_t *lap, int x_pitch, int y_pitch) {
int16_t max = 0;
int sum = 0;
for (int i = 0; i < size; ++i) {
const int16_t v = lap[i % x_pitch + (i / x_pitch) * x_pitch];
const int16_t v = lap[i];
sum += v;
if (v > max) max = v;
}
@@ -26,7 +26,7 @@ uint16_t get_lapmap_one(const int16_t *lap, int x_pitch, int y_pitch) {
// var of roi
int var = 0;
for (int i = 0; i < size; ++i) {
var += std::pow(lap[i % x_pitch + (i / x_pitch) * x_pitch] - mean, 2);
var += std::pow(lap[i] - mean, 2);
}
const float fvar = (float)var / size;