From b3b3e58b947b525a1f7e27d523cae4f847c57e11 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 26 Apr 2012 09:46:52 +0200 Subject: harris: Another pointer arithmetic style fix in calc_window_sum --- harris.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/harris.c b/harris.c index 8602e0a..55c5414 100644 --- a/harris.c +++ b/harris.c @@ -106,7 +106,7 @@ multiply(int *deriv_x, int *deriv_y, int width, int height) struct mat2 * calc_window_sum(struct mat2 *m, int width, int height, int wsize) { - struct mat2 *avg, *v, *r; + struct mat2 *avg, *v; float w; int x, y, i, j; @@ -114,7 +114,6 @@ calc_window_sum(struct mat2 *m, int width, int height, int wsize) if (!avg) return NULL; - r = avg; for (y = 0; y < height; ++y) { for (x = 0; x < width; ++x) { for (i = -wsize/2; i < wsize/2; ++i) { @@ -124,17 +123,17 @@ calc_window_sum(struct mat2 *m, int width, int height, int wsize) w = (M_1_PI * 1.0 / (2.0 * 0.16) * exp(- i*i - j*j / 0.16)); - r->a1 += w * v->a1; - r->a2 += w * v->a2; - r->b1 += w * v->b1; - r->b2 += w * v->b2; + avg->a1 += w * v->a1; + avg->a2 += w * v->a2; + avg->b1 += w * v->b1; + avg->b2 += w * v->b2; } } - ++r; + ++avg; } } - return avg; + return avg - width*height; } gboolean -- cgit