[{"id":36048,"web_url":"https://patchwork.libcamera.org/comment/36048/","msgid":"<880c1ac5-9a7b-4c5f-ad8a-344f369fd83d@ideasonboard.com>","date":"2025-09-30T08:42:01","subject":"Re: [PATCH v5 3/7] libcamera: software_isp: Pass correct\n\ty-coordinate to stats","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 window set by SwStatsCpu::setWindow is relative to the processed\n> image area.  But debayering passes the processed line y-coordinate to\n> the stats relative to the whole image area.  This can result in\n> gathering stats from a wrong image area or in not gathering stats at\n> all.\n> \n> Let's pass the correct y-coordinate to the stats processing methods.\n> \n> Bug: https://bugs.libcamera.org/show_bug.cgi?id=280\n> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> Reviewed-by: Hans de Goede <hansg@kernel.org>\n> ---\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\n>   src/libcamera/software_isp/debayer_cpu.cpp | 12 +++++++-----\n>   1 file changed, 7 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\n> index bcaaa5dee..09d171d6b 100644\n> --- a/src/libcamera/software_isp/debayer_cpu.cpp\n> +++ b/src/libcamera/software_isp/debayer_cpu.cpp\n> @@ -661,7 +661,7 @@ void DebayerCpu::memcpyNextLine(const uint8_t *linePointers[])\n> \n>   void DebayerCpu::process2(const uint8_t *src, uint8_t *dst)\n>   {\n> -\tunsigned int yEnd = window_.y + window_.height;\n> +\tunsigned int yEnd = window_.height;\n>   \t/* Holds [0] previous- [1] current- [2] next-line */\n>   \tconst uint8_t *linePointers[3];\n> \n> @@ -676,13 +676,16 @@ void DebayerCpu::process2(const uint8_t *src, uint8_t *dst)\n>   \t\t/* window_.y == 0, use the next line as prev line */\n>   \t\tlinePointers[1] = src + inputConfig_.stride;\n>   \t\tlinePointers[2] = src;\n> -\t\t/* Last 2 lines also need special handling */\n> +\t\t/*\n> +\t\t * Last 2 lines also need special handling.\n> +\t\t * (And configure() ensures that yEnd >= 2.)\n> +\t\t */\n>   \t\tyEnd -= 2;\n>   \t}\n> \n>   \tsetupInputMemcpy(linePointers);\n> \n> -\tfor (unsigned int y = window_.y; y < yEnd; y += 2) {\n> +\tfor (unsigned int y = 0; y < yEnd; y += 2) {\n>   \t\tshiftLinePointers(linePointers, src);\n>   \t\tmemcpyNextLine(linePointers);\n>   \t\tstats_->processLine0(y, linePointers);\n> @@ -716,7 +719,6 @@ void DebayerCpu::process2(const uint8_t *src, uint8_t *dst)\n> \n>   void DebayerCpu::process4(const uint8_t *src, uint8_t *dst)\n>   {\n> -\tconst unsigned int yEnd = window_.y + window_.height;\n>   \t/*\n>   \t * This holds pointers to [0] 2-lines-up [1] 1-line-up [2] current-line\n>   \t * [3] 1-line-down [4] 2-lines-down.\n> @@ -734,7 +736,7 @@ void DebayerCpu::process4(const uint8_t *src, uint8_t *dst)\n> \n>   \tsetupInputMemcpy(linePointers);\n> \n> -\tfor (unsigned int y = window_.y; y < yEnd; y += 4) {\n> +\tfor (unsigned int y = 0; y < window_.height; y += 4) {\n>   \t\tshiftLinePointers(linePointers, src);\n>   \t\tmemcpyNextLine(linePointers);\n>   \t\tstats_->processLine0(y, linePointers);\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 664CDC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Sep 2025 08:42:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DD3296B61A;\n\tTue, 30 Sep 2025 10:42:07 +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 9A32D6B5AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Sep 2025 10:42:04 +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 6CC87228;\n\tTue, 30 Sep 2025 10:40:36 +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=\"WFRtjSBh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759221636;\n\tbh=uOarVIgxFLGHsMrXwIvse5nD1yHr93paEL1d3827JXw=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=WFRtjSBhXBxJwQD6C2GFz4n2jqAT65G6B6iHwvwVLbTzOgPROTFOxW9CuJMCJ6diF\n\tPHVONRPQ2LDHaiOo/CTjYcSuYWOwT/le143z5VlxhDrf3QI4haVkfI6naz1hygnr+I\n\tlZ2l21PP6ZvWHaLVsQohCePlrxwve/yp7/E6cMSo=","Message-ID":"<880c1ac5-9a7b-4c5f-ad8a-344f369fd83d@ideasonboard.com>","Date":"Tue, 30 Sep 2025 10:42:01 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v5 3/7] libcamera: software_isp: Pass correct\n\ty-coordinate to stats","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<V9QhIByx2JuoFp7aDcX20c_Hk8fmj9XvEEpVh6mduAxrjMCCwxM6lSFWYQ7pc2yG3KbJDk46slLblFODYAc3ow==@protonmail.internalid>\n\t<20250929201924.45019-4-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-4-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>"}}]