[{"id":36044,"web_url":"https://patchwork.libcamera.org/comment/36044/","msgid":"<a9f55fc9-8f72-4465-a783-3d5bfddceb1e@kernel.org>","date":"2025-09-29T21:01:27","subject":"Re: [PATCH v5 5/7] ipa: simple: awb: Use correct type in\n\tstd::accumulate","submitter":{"id":239,"url":"https://patchwork.libcamera.org/api/people/239/","name":"Hans de Goede","email":"hansg@kernel.org"},"content":"Hi,\n\nOn 29-Sep-25 10:19 PM, Milan Zamazal wrote:\n> The result type of the std::accumulate() call is uint64_t; let's use the\n> same type for the initial value (rather than the default int) to prevent\n> summing up the values in a different integer type.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n\nThanks, patch looks good to me:\n\nReviewed-by: Hans de Goede <hansg@kernel.org>\n\nRegards,\n\nHans\n\n\n\n> ---\n>  src/ipa/simple/algorithms/awb.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp\n> index b1eb7d310..fb21396ef 100644\n> --- a/src/ipa/simple/algorithms/awb.cpp\n> +++ b/src/ipa/simple/algorithms/awb.cpp\n> @@ -68,7 +68,7 @@ void Awb::process(IPAContext &context,\n>  \t * rather than from the sensor range.\n>  \t */\n>  \tconst uint64_t nPixels = std::accumulate(\n> -\t\thistogram.begin(), histogram.end(), 0);\n> +\t\thistogram.begin(), histogram.end(), uint64_t(0));\n>  \tconst uint64_t offset = blackLevel * nPixels;\n>  \tconst uint64_t minValid = 1;\n>  \tconst uint64_t sumR = stats->sumR_ > offset / 4 ? stats->sumR_ - offset / 4 : minValid;","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 7FAA9C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Sep 2025 21:01:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C5426B601;\n\tMon, 29 Sep 2025 23:01:34 +0200 (CEST)","from tor.source.kernel.org (tor.source.kernel.org\n\t[IPv6:2600:3c04:e001:324:0:1991:8:25])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 223606B5C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Sep 2025 23:01:33 +0200 (CEST)","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id 7262F60217;\n\tMon, 29 Sep 2025 21:01:31 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 3E28BC113D0;\n\tMon, 29 Sep 2025 21:01:30 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=kernel.org header.i=@kernel.org\n\theader.b=\"qfo+G2mz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1759179691;\n\tbh=ac/sfjKHzC0iJzpCN70RK8QTtMtIvrTvrxObbnba838=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=qfo+G2mza3OWWRJ3vQxO7DU2ZjiR8UXYFX3DwuRfDWWMTH0tngCM+P9r2drQgWfss\n\tZS+iTbi9XzTHGdu4HK/MpqOdE64F33W4TwB1AT87WEDLkCeIN0MDrD5/27ZjPBCKGB\n\tK2bX8Zy9OW0pjY3ZhAmjEs+AA4rnvF0cJcCMNsQIOOAFP1ApYUmmJ7Vd/bEDj1NbGE\n\tC7zJHR9/StoKNJDlsMFfk0S2hdKw/TWzWfshZGC92U9f144k9qOXPg4QeR9PrStZZl\n\ttryJ3L0m7emWd5SADXvNuMPRnLMKLDA7wyZWLVEK1odqT1OsseHqDdWIZmVY2/q9NJ\n\tHhyONui+ptBdw==","Message-ID":"<a9f55fc9-8f72-4465-a783-3d5bfddceb1e@kernel.org>","Date":"Mon, 29 Sep 2025 23:01:27 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v5 5/7] ipa: simple: awb: Use correct type in\n\tstd::accumulate","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"pobrn@protonmail.com, mail@maciej.szmigiero.name","References":"<20250929201924.45019-1-mzamazal@redhat.com>\n\t<20250929201924.45019-6-mzamazal@redhat.com>","From":"Hans de Goede <hansg@kernel.org>","Content-Language":"en-US, nl","In-Reply-To":"<20250929201924.45019-6-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36046,"web_url":"https://patchwork.libcamera.org/comment/36046/","msgid":"<be9dbb19-4380-4d71-b457-9cee02c0fb29@ideasonboard.com>","date":"2025-09-30T08:36:12","subject":"Re: [PATCH v5 5/7] ipa: simple: awb: Use correct type in\n\tstd::accumulate","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2025. 09. 29. 22:19 keltezéssel, Milan Zamazal írta:\n> The result type of the std::accumulate() call is uint64_t; let's use the\n> same type for the initial value (rather than the default int) to prevent\n> summing up the values in a different integer type.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\n>   src/ipa/simple/algorithms/awb.cpp | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp\n> index b1eb7d310..fb21396ef 100644\n> --- a/src/ipa/simple/algorithms/awb.cpp\n> +++ b/src/ipa/simple/algorithms/awb.cpp\n> @@ -68,7 +68,7 @@ void Awb::process(IPAContext &context,\n>   \t * rather than from the sensor range.\n>   \t */\n>   \tconst uint64_t nPixels = std::accumulate(\n> -\t\thistogram.begin(), histogram.end(), 0);\n> +\t\thistogram.begin(), histogram.end(), uint64_t(0));\n>   \tconst uint64_t offset = blackLevel * nPixels;\n>   \tconst uint64_t minValid = 1;\n>   \tconst uint64_t sumR = stats->sumR_ > offset / 4 ? stats->sumR_ - offset / 4 : minValid;\n> --\n> 2.51.0\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 7B6DFC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Sep 2025 08:36:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F2A356B60F;\n\tTue, 30 Sep 2025 10:36:19 +0200 (CEST)","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 C96A86B5AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Sep 2025 10:36:16 +0200 (CEST)","from [192.168.33.11] (185.221.142.146.nat.pool.zt.hu\n\t[185.221.142.146])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 23F7C228;\n\tTue, 30 Sep 2025 10:34:48 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"kKydWWQ5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759221288;\n\tbh=U/9mku3YQTWnH4bvYXPDEU0LiFxw2vIH/gKyMqeqfeU=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=kKydWWQ5XrzInUsYcRMV0Pa12vKPA1oz8EyEfoDSDgG5fRsvbP++V6I0tBr8sFH9M\n\tPG5RxFYpT4CX6yhDkFStO4lXNMrr8HN5hjcFrAjkeUkbUW5TPTMms93xNnzZtf04Fs\n\tZwr7/jL/ENkccWYOOLiVk/0lQzmF7CUmlNayjRSI=","Message-ID":"<be9dbb19-4380-4d71-b457-9cee02c0fb29@ideasonboard.com>","Date":"Tue, 30 Sep 2025 10:36:12 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v5 5/7] ipa: simple: awb: Use correct type in\n\tstd::accumulate","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"mail@maciej.szmigiero.name, hansg@kernel.org","References":"<20250929201924.45019-1-mzamazal@redhat.com>\n\t<Ip3-10GQ2qRdiYL4NwG2mSL62oAhTzclCHwyombQ9fq1tw_dMy7zf19MPAGz92ebA0qlKVfLc4-nubFrlPl1rw==@protonmail.internalid>\n\t<20250929201924.45019-6-mzamazal@redhat.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250929201924.45019-6-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]