From patchwork Thu Oct 15 22:37:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10070 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D2C5FBEEDF for ; Thu, 15 Oct 2020 22:38:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9C47A60F61; Fri, 16 Oct 2020 00:38:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ITb5i+Yz"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 09F9D600F2 for ; Fri, 16 Oct 2020 00:37:59 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8BE3A11F0; Fri, 16 Oct 2020 00:37:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801478; bh=ILnjv7HyuM/fDmq1H7u9a25fAgMZDE8gkRwGbL7yWdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ITb5i+YzosIYqF0hUuJ12KeeJbfMp22uwVAjDPseA45XJxzGcKCtHXT0n73F768PX XFrsA5y2UllWHTGvgatYnxNfrW8zBZB57bCrDKC2CAeKEKPAZRuyscKGU+t/O/5E9t ClPdBBM63/AJ5oM2i2G2xVy6aOTEFM0bwKGPRAys= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:48 +0100 Message-Id: <20201015223750.58563-10-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 09/11] ipa: raspberrypi: Re-use iterator variable X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The function gauss_seidel2_SOR() makes use of a function scoped iterator 'i', for several loops, and has a precedence of re-using the function scoped iterator declaration in the majority of cases, except the first where it is declared in the loop scope before the function scope, and later which aliases a new declaration. Re-use the existing iterator variable for consistency, and to prevent variable aliasing. Signed-off-by: Kieran Bingham Reviewed-by: David Plowman Reviewed-by: Niklas Söderlund --- src/ipa/raspberrypi/controller/rpi/alsc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp index 42fbc8a476ad..183a0c953b9f 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp @@ -606,9 +606,9 @@ static double gauss_seidel2_SOR(double const M[XY][4], double omega, double lambda[XY]) { double old_lambda[XY]; - for (int i = 0; i < XY; i++) - old_lambda[i] = lambda[i]; int i; + for (i = 0; i < XY; i++) + old_lambda[i] = lambda[i]; lambda[0] = compute_lambda_bottom_start(0, M, lambda); for (i = 1; i < X; i++) lambda[i] = compute_lambda_bottom(i, M, lambda); @@ -628,7 +628,7 @@ static double gauss_seidel2_SOR(double const M[XY][4], double omega, lambda[i] = compute_lambda_bottom(i, M, lambda); lambda[0] = compute_lambda_bottom_start(0, M, lambda); double max_diff = 0; - for (int i = 0; i < XY; i++) { + for (i = 0; i < XY; i++) { lambda[i] = old_lambda[i] + (lambda[i] - old_lambda[i]) * omega; if (fabs(lambda[i] - old_lambda[i]) > fabs(max_diff)) max_diff = lambda[i] - old_lambda[i];