[{"id":13225,"web_url":"https://patchwork.libcamera.org/comment/13225/","msgid":"<20201015232239.vdwp223ebld5ibqx@oden.dyn.berto.se>","date":"2020-10-15T23:22:39","subject":"Re: [libcamera-devel] [PATCH v2 09/11] ipa: raspberrypi: Re-use\n\titerator variable","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Kieran,\n\nOn 2020-10-15 23:37:48 +0100, Kieran Bingham wrote:\n> 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\n> scoped iterator declaration in the majority of cases, except the first\n> where it is declared in the loop scope before the function scope, and\n> later which aliases a new declaration.\n> \n> Re-use the existing iterator variable for consistency, and to prevent\n> variable aliasing.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/ipa/raspberrypi/controller/rpi/alsc.cpp | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n> index 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> -- \n> 2.25.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 AAD9DBE174\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Oct 2020 23:22:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 757CE60F61;\n\tFri, 16 Oct 2020 01:22:42 +0200 (CEST)","from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B683360E36\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Oct 2020 01:22:41 +0200 (CEST)","by mail-lj1-x244.google.com with SMTP id m20so546112ljj.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Oct 2020 16:22:41 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tb15sm217986ljp.117.2020.10.15.16.22.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 15 Oct 2020 16:22:40 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"04sisWAn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=jzAwPiL1+KpmmQrjn6Xs821xmR9WAYfoJZAW6jybELM=;\n\tb=04sisWAn6tllXQtq1ftH5Sr2uMmQL5M9CYS/3l9hLYnCeUwCwLe+xNOdhsniC0QIUG\n\twRprpLIko1jq2NX7kAVyYBYqpJJzZTmZIJCvBm72t8Maoe1JLcEhT9JAcNOcvo32lsJT\n\t6fxvi6LxIwLON7fCwkDsnuFKQOdeTPqw94IQM5IUq7UReb2Jnk/VAUngTYy6UJNFgbDn\n\tUkIKnJLevMfEFDYBtpjx++6JgZ/AsGRpvOCm+arZHTh+zCRrX/LX08jpkEqC7sdcd81P\n\toDlN3RUP2Y8K4+d4IN8SNAIxHiBdnQCcY4WsPSLllG/rWV4KNyu09xxOQo763Aod9JHx\n\tSz7Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=jzAwPiL1+KpmmQrjn6Xs821xmR9WAYfoJZAW6jybELM=;\n\tb=fYjx2GRuN+6RKqNRyLpH/kaHns/PtV+gRcGS3pLSIr3Gt3kVXX41wQ4zfEKAkT2jFX\n\tqOO4zB3fPcLtkPGvxixkHB/Aei2k6uyk/qeeXpnj5rNOOWOccn6t5YpkGvveXP0Qizha\n\tEV66toqul2XCd2XgyX9oQQlexGYeEnjayw/nar/YDzvk6CBFLVWW+BHiquOUbHQx6Els\n\tCqFEXbB6HeVRVH4TsjTIQaGHEiFJekhdLfgtCqXzfoxjXtiQ5NtYn3BeUsSJAEn4fkuK\n\tzpV5eAwhgFAPelppGYIfdWhfesLuvkyNECJgmSkrdRTi/t0iSeeunZdlKpbGWEJzHHeJ\n\tUanA==","X-Gm-Message-State":"AOAM531TIG7j8m2GTHZ7WxI4SpmM9M0MH7ch0WGwgVlvRlkRG/Oi9ztF\n\tERDhFM111M38ez+149RL/OPYIcDAvbpNRA==","X-Google-Smtp-Source":"ABdhPJxVr3WtnBBYUalDVGksG+TIvgpy/bsXoqbBDfLXh19aQ8d2ThUSnvdPjTVql22ZNKkfEKeb7Q==","X-Received":"by 2002:a2e:8059:: with SMTP id p25mr369913ljg.306.1602804161098;\n\tThu, 15 Oct 2020 16:22:41 -0700 (PDT)","Date":"Fri, 16 Oct 2020 01:22:39 +0200","From":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20201015232239.vdwp223ebld5ibqx@oden.dyn.berto.se>","References":"<20201015223750.58563-1-kieran.bingham@ideasonboard.com>\n\t<20201015223750.58563-10-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201015223750.58563-10-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]