{"id":20030,"url":"https://patchwork.libcamera.org/api/1.1/patches/20030/?format=json","web_url":"https://patchwork.libcamera.org/patch/20030/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240509114448.3685285-1-paul.elder@ideasonboard.com>","date":"2024-05-09T11:44:48","name":"[v3] ipa: rkisp1: agc: Fix histogram construction","commit_ref":"f1522e94dfaedcde26280eb6387f2c6f2de66fd7","pull_url":null,"state":"accepted","archived":false,"hash":"d3678edfee873357af1b4c0f7614eb61b07a7977","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20030/mbox/","series":[{"id":4303,"url":"https://patchwork.libcamera.org/api/1.1/series/4303/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4303","date":"2024-05-09T11:44:48","name":"[v3] ipa: rkisp1: agc: Fix histogram construction","version":3,"mbox":"https://patchwork.libcamera.org/series/4303/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20030/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20030/checks/","tags":{},"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 114BFC3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 May 2024 11:45:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AD38863466;\n\tThu,  9 May 2024 13:45:02 +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 8F06863433\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 May 2024 13:45:01 +0200 (CEST)","from neptunite.hamster-moth.ts.net\n\t(h175-177-049-156.catv02.itscom.jp [175.177.49.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 60CF6904;\n\tThu,  9 May 2024 13:44:56 +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=\"VHVjlf0/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1715255098;\n\tbh=5ZbZowTN1Y+kvWOrxD8TaGc1okMfm0PmI9Eb3NqDzP4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=VHVjlf0/4XV3INwLZJ09sZTbth0lsiMyOI3OAqxjO0Kp3aHiX3dFs/DB2KGw8vabU\n\tRVxm0Hl8SfWBst5gUL9o9Oal0q3O7Zh2snhcb5pUVqIajdHEu1EGdZ10Q0dhai9THD\n\tMZrVvWPlcIeRiYOP4CHTLFQTCYfd44crk4e0bW+A=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Paul Elder <paul.elder@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"[PATCH v3] ipa: rkisp1: agc: Fix histogram construction","Date":"Thu,  9 May 2024 20:44:48 +0900","Message-Id":"<20240509114448.3685285-1-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.39.2","MIME-Version":"1.0","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>"},"content":"This histogram reported by the rkisp1 hardware is 20 bits, where the\nupper 16 bits are meaningful integer data and the lower 4 bits are\nfractional and meant to be discarded. Remove these 4 bits when\nconstruction the histogram.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nChanges in v3:\n- fix typo in commit message\n- add comment explaining the shift\n\nChanges in v2:\n- use a lambda function instead of the rshift parameter\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 3e98496b..5aad5c7c 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -277,7 +277,9 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \tconst rkisp1_cif_isp_stat *params = &stats->params;\n \tASSERT(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP);\n \n-\tHistogram hist({ params->hist.hist_bins, context.hw->numHistogramBins });\n+\t/* The lower 4 bits are fractional and meant to be discarded. */\n+\tHistogram hist({ params->hist.hist_bins, context.hw->numHistogramBins },\n+\t\t       [](uint32_t x) { return x >> 4; });\n \texpMeans_ = { params->ae.exp_mean, context.hw->numAeCells };\n \n \t/*\n","prefixes":["v3"]}