{"id":10086,"url":"https://patchwork.libcamera.org/api/patches/10086/?format=json","web_url":"https://patchwork.libcamera.org/patch/10086/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201016090014.64703-10-kieran.bingham@ideasonboard.com>","date":"2020-10-16T09:00:12","name":"[libcamera-devel,v3,09/11] ipa: raspberrypi: Re-use iterator variable","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"1a2dfa8c57e59b28cbcb6f16b4def2c70b1cc921","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10086/mbox/","series":[{"id":1379,"url":"https://patchwork.libcamera.org/api/series/1379/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1379","date":"2020-10-16T09:00:03","name":"Shadowed Variables","version":3,"mbox":"https://patchwork.libcamera.org/series/1379/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10086/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10086/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 634C1BDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 16 Oct 2020 09:00:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2EF3D6113C;\n\tFri, 16 Oct 2020 11:00:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2546C610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Oct 2020 11:00:22 +0200 (CEST)","from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A6716A43;\n\tFri, 16 Oct 2020 11:00:21 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DP+N329N\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1602838821;\n\tbh=ykEv1uQkwC0mGpDH/2uuOR3LCzq8sLz2nKmZrlQiKKk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DP+N329NFR+r5VZAK7LvrU5RIGgt/w8PCP6VVjGmtVBg/nIEZL+d2m6UQnJZmj0nQ\n\tffZj7GjLEPy5C5wwZeXHGWdZ1B0tATfsoEwTlrd9NfvIOEuxFyQHZg3OFTYj/DpIAG\n\t17bmT8sG/jSHj5ULjBuEyJeEeg/zfHJlwweXuUeQ=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Fri, 16 Oct 2020 10:00:12 +0100","Message-Id":"<20201016090014.64703-10-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20201016090014.64703-1-kieran.bingham@ideasonboard.com>","References":"<20201016090014.64703-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 09/11] ipa: raspberrypi: Re-use\n\titerator variable","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The function gauss_seidel2_SOR() makes use of a function scoped iterator\n'i', for several loops, and has a precedence of re-using the function\nscoped iterator declaration in the majority of cases, except the first\nwhere it is declared in the loop scope before the function scope, and\nlater which aliases a new declaration.\n\nRe-use the existing iterator variable for consistency, and to prevent\nvariable aliasing.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/ipa/raspberrypi/controller/rpi/alsc.cpp | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\nindex 42fbc8a476ad..183a0c953b9f 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n@@ -606,9 +606,9 @@ static double gauss_seidel2_SOR(double const M[XY][4], double omega,\n \t\t\t\tdouble lambda[XY])\n {\n \tdouble old_lambda[XY];\n-\tfor (int i = 0; i < XY; i++)\n-\t\told_lambda[i] = lambda[i];\n \tint i;\n+\tfor (i = 0; i < XY; i++)\n+\t\told_lambda[i] = lambda[i];\n \tlambda[0] = compute_lambda_bottom_start(0, M, lambda);\n \tfor (i = 1; i < X; i++)\n \t\tlambda[i] = compute_lambda_bottom(i, M, lambda);\n@@ -628,7 +628,7 @@ static double gauss_seidel2_SOR(double const M[XY][4], double omega,\n \t\tlambda[i] = compute_lambda_bottom(i, M, lambda);\n \tlambda[0] = compute_lambda_bottom_start(0, M, lambda);\n \tdouble max_diff = 0;\n-\tfor (int i = 0; i < XY; i++) {\n+\tfor (i = 0; i < XY; i++) {\n \t\tlambda[i] = old_lambda[i] + (lambda[i] - old_lambda[i]) * omega;\n \t\tif (fabs(lambda[i] - old_lambda[i]) > fabs(max_diff))\n \t\t\tmax_diff = lambda[i] - old_lambda[i];\n","prefixes":["libcamera-devel","v3","09/11"]}