[{"id":34203,"web_url":"https://patchwork.libcamera.org/comment/34203/","msgid":"<174705983451.2888.14558268018607031474@pyrite.rasen.tech>","date":"2025-05-12T14:23:54","subject":"Re: [PATCH 5/8] ipa: rkisp1: Switch histogram to RGB combined mode","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Stefan,\n\nThanks for the patch.\n\nQuoting Stefan Klug (2025-04-11 15:04:12)\n> The Y mode of the histogram get's captured at the ISP output, before the\n\ns/get's/gets/\n\n> output formatter.  This has the side effect, that the first and the last\n\ns/,//\n\n> bins of are empty in case of limited YUV range.  Another side effect is\n\ns/bins of/bins/\n\n> that gamma and GWDR processing is included in the histogram which makes\n> algorithm development very difficult. In RGB mode the histogram is taken\n> after xtalk (CCM) and is therefore independent of gamma and WDR. The\n> limited range issue also does not apply. In the ISP reference it is\n> however stated that \"it is not possible to calculate a luminance or\n> grayscale histogram from an RGB histogram since the position information\n> is lost during its generation\".\n\nHm, I see, so we need to use RGB mode so that we can tap before gamma and wdr.\nThose are both probably nasty to reverse. It's probably better to use RGB mode\nthen. I suppose in the future we should use hist64, though the rk3399 will be\nstuck with this.\n\n> During testing the RGB histogram provided good data and better\n> algorithmic stability at a possible (but not measured) inaccuracy.\n\nGood, we get better data :)\n\n> Another option would be to pass the color space information into the IPA\n> and strip the histogram accordingly. For ease of implementation switch to\n> the RGB mode.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/rkisp1/algorithms/agc.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 0e4fd3663167..a2c8d5403ba2 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -379,7 +379,7 @@ void Agc::prepare(IPAContext &context, const uint32_t frame,\n>         hstConfig.setEnabled(true);\n>  \n>         hstConfig->meas_window = context.configuration.agc.measureWindow;\n> -       hstConfig->mode = RKISP1_CIF_ISP_HISTOGRAM_MODE_Y_HISTOGRAM;\n> +       hstConfig->mode = RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED;\n>  \n>         Span<uint8_t> weights{\n>                 hstConfig->hist_weight,\n> -- \n> 2.43.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 22B62C3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 May 2025 14:24:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4930B68B40;\n\tMon, 12 May 2025 16:23:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A088614E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 May 2025 16:23:57 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2001:861:3a80:3300:4f2f:8c2c:b3ef:17d4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68EFB6AF;\n\tMon, 12 May 2025 16:23:42 +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=\"kSZvrYOq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747059822;\n\tbh=1qWojEOq+O3NeRLoYlq3CbF2tLfedV6ta0znRXof7iA=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=kSZvrYOqwIwmtvkaPH20xn7xDL0zX7mB2pJEn7YzQk4s9k+/vAFbRQ0hd0hW0mi3x\n\t2aGUzFT2WDXLFirCG9Q0wrSNRg9QGZYTc3tj359Hbr0Y9oXmSxkAmTNlIyvRr0CU3Z\n\t6NFsxeD2Gwtb76gFfQtRPyjqduAHRJELnsxtUJAg=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250411130423.2164577-6-stefan.klug@ideasonboard.com>","References":"<20250411130423.2164577-1-stefan.klug@ideasonboard.com>\n\t<20250411130423.2164577-6-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH 5/8] ipa: rkisp1: Switch histogram to RGB combined mode","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 12 May 2025 16:23:54 +0200","Message-ID":"<174705983451.2888.14558268018607031474@pyrite.rasen.tech>","User-Agent":"alot/0.0.0","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>"}}]