[{"id":26537,"web_url":"https://patchwork.libcamera.org/comment/26537/","msgid":"<167776520742.93391.16718373539812427129@Monstersaurus>","date":"2023-03-02T13:53:27","subject":"Re: [libcamera-devel] [PATCH] ipa: raspberrypi: agc: Fix overflow\n\tin Y value calculation","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting David Plowman via libcamera-devel (2023-03-02 12:57:31)\n\nI hope this makes it at least into patchwork:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>","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 7A689BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Mar 2023 13:53:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C59456269C;\n\tThu,  2 Mar 2023 14:53:32 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C1426267E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Mar 2023 14:53:30 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1FCF856A;\n\tThu,  2 Mar 2023 14:53:30 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1677765212;\n\tbh=N3zg0+3wiMt6/Q2S5HNsAm6fqL8+wY6j9yRFmfh/3XU=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=OuGAgDndzhvTEN2dk4RMwiETKjbr44kyHxWO3FkY/Gbc0bS+q2kwpmun0R5rtJrMf\n\tMpsep2+QUzFsI2O0loaBbSS5k1GOlrgnde7/plj2RRJbPlwuJ7+4V3QCDbggPnT4h9\n\tYPjngx/3rRxuEgi2KlDohU4C2wk/zByBLIYdLPY/edooEViB/vR99npbE9cT3vqc6h\n\t/p1+0THL7X/0fnhf3ontosQiKypF2akOq86jb+6vQPjCDzmH+Bt0EyanSu9pEjK1cn\n\tufkyFj7ijD3D1Uja1VTunWdU06I9bq1rTnXD6xmUYTNV53lEWQWL55oIEW13uAihIs\n\tbzUAHQETLUgNw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1677765210;\n\tbh=N3zg0+3wiMt6/Q2S5HNsAm6fqL8+wY6j9yRFmfh/3XU=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=rXtiB6U38+Wqun5TcHPxE7E06UTrjXDrdwqVNbXv9k1sz/ytLGAEwJ40+r+nyEftZ\n\tKLuWzG1ecGimoarW5nPQQdPib8RBeLJkjpa0iM/Nq0LmCSNbjK5NZaDZ6gi/ME05+I\n\tTKamufdG5uHL+T0dNvrmrCsriwQb+0lTm4brO2Rw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"rXtiB6U3\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<mailman.54.1677761855.25031.libcamera-devel@lists.libcamera.org>","References":"<mailman.54.1677761855.25031.libcamera-devel@lists.libcamera.org>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 02 Mar 2023 13:53:27 +0000","Message-ID":"<167776520742.93391.16718373539812427129@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH] ipa: raspberrypi: agc: Fix overflow\n\tin Y value calculation","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26538,"web_url":"https://patchwork.libcamera.org/comment/26538/","msgid":"<mailman.59.1677765433.25031.libcamera-devel@lists.libcamera.org>","date":"2023-03-02T13:56:58","subject":"Re: [libcamera-devel] [PATCH] ipa: raspberrypi: agc: Fix overflow\n\tin Y value calculation","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nThanks for fixing this.\n\n\nOn Thu, 2 Mar 2023 at 12:57, David Plowman via libcamera-devel <\nlibcamera-devel@lists.libcamera.org> wrote:\n\n> The maxVal variable in the computeInitialY function needs to be a\n> uint64_t, otherwise the subsequent multiplications in the function\n> can overflow on relatively high resolution images (when the counts in\n> the regions go over 16 bits).\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n>\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\nPS: patchwork does seem to have correctly recognised Kieran's tag (\nhttps://patchwork.libcamera.org/patch/18330/)\n\n\n> ---\n>  src/ipa/raspberrypi/controller/rpi/agc.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> index ea0c82b5..4ea0dd41 100644\n> --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> @@ -584,7 +584,7 @@ void Agc::fetchAwbStatus(Metadata *imageMetadata)\n>  static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb,\n>                               double weights[], double gain)\n>  {\n> -       constexpr unsigned int maxVal = 1 <<\n> Statistics::NormalisationFactorPow2;\n> +       constexpr uint64_t maxVal = 1 <<\n> Statistics::NormalisationFactorPow2;\n>         /*\n>          * Note how the calculation below means that equal weights give you\n>          * \"average\" metering (i.e. all pixels equally important).\n> --\n> 2.30.2\n>\n>","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 4C33ABE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Mar 2023 13:57:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B0C6F626C0;\n\tThu,  2 Mar 2023 14:57:13 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1677765433;\n\tbh=OXZj3rgLRwlLvdTK2szKWGTGKggsowa7iJiWwBLcHN0=;\n\th=References:In-Reply-To:Date:To:List-Id:List-Post:From:Cc:\n\tList-Subscribe:List-Unsubscribe:List-Archive:Reply-To:List-Help:\n\tSubject:From;\n\tb=k0xlyf+nIlXJlxNxFN9zfVo6o8poMWzsGYt0rySZurGGSYamzkdTLio9BCt2YtWnC\n\tgOXqAE8FWhlqxYCCBnhuxP6FdTPqkk9vF6bWrMHsNnFrFK3HZgxsgATmWcMgks8aPy\n\tLUGD5FtfvCqlroSOFDaHok4LL0bTNkrrWBlte/g7Ites79gjLHITwzQtImntTXu087\n\ttCXHjKVCvjTYFvhancSFE+iWuGjpRskv0F+b33Q+GdcmJzDK507fqfqcBWequ3l7Ca\n\toj6YNrD/LZMorgHqN7uuLu8Bcd4cqnWtFyKU3HqyGHryu/7dN85MmNBGPaepQbzPKP\n\tlPZPnRuMZaN6A==","References":"<mailman.54.1677761855.25031.libcamera-devel@lists.libcamera.org>","In-Reply-To":"<mailman.54.1677761855.25031.libcamera-devel@lists.libcamera.org>","Date":"Thu, 2 Mar 2023 13:56:58 +0000","To":"David Plowman <david.plowman@raspberrypi.com>","MIME-Version":"1.0","Message-ID":"<mailman.59.1677765433.25031.libcamera-devel@lists.libcamera.org>","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Precedence":"list","Cc":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","X-BeenThere":"libcamera-devel@lists.libcamera.org","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","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/>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","Subject":"Re: [libcamera-devel] [PATCH] ipa: raspberrypi: agc: Fix overflow\n\tin Y value calculation","Content-Type":"message/rfc822","Content-Disposition":"inline","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]