From patchwork Fri Apr 19 05:58:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 19909 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 52C5BBE08B for ; Fri, 19 Apr 2024 05:59:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8DDD5633EE; Fri, 19 Apr 2024 07:59:02 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lJI6LnWH"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E432E633ED for ; Fri, 19 Apr 2024 07:59:00 +0200 (CEST) Received: from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp [175.177.49.156]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5F876827; Fri, 19 Apr 2024 07:58:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713506292; bh=iarPo9S3bA3OgStjoO+Ax1O065cvvo0+dtpAugwfpP8=; h=From:To:Cc:Subject:Date:From; b=lJI6LnWHmZwD/69qT3o+i8iBYDAFfWaBkSMXPE5HvdNsfpgY18+ps/YnDLamFMziP 8gAs12ZmkLhCESsYgfzA8Ro5RObP4CS/4CtfrtjsnwxjkI6UGbAXRaj9s0ieJi59vt j7AeykTtkbpFeSjUXpU2cWJfSoAllt9LL4H4HDgc= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder Subject: [PATCH v2] ipa: rkisp1: agc: Fix histogram construction Date: Fri, 19 Apr 2024 14:58:49 +0900 Message-Id: <20240419055849.1086196-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This histogram reported by the rkisp1 hardware is 20 bits, where the upper 16 bits are meaningful integer data and the lower 4 bits are fractional and meant to be discarded. Remove thse 4 bits when construction the histogram. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Daniel Scally Reviewed-by: Laurent Pinchart --- This was meant to be in the same series as "[PATCH v2] ipa: libipa: histogram: Add transform parameter to constructor" This depends on v2 of "Centralise Agc into libipa". Changes in v2: - use a lambda function instead of the rshift parameter --- src/ipa/rkisp1/algorithms/agc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 27b6f2c1..26526f5e 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -278,7 +278,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, const rkisp1_cif_isp_stat *params = &stats->params; ASSERT(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP); - Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins }); + Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins }, + [](uint32_t x) { return x >> 4; }); expMeans_ = { params->ae.exp_mean, context.hw->numAeCells }; /*