From patchwork Thu Aug 12 16:52:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 13332 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 D768EC3242 for ; Thu, 12 Aug 2021 16:52:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 53901688A2; Thu, 12 Aug 2021 18:52:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="v5Qh6ZVJ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C5376888D for ; Thu, 12 Aug 2021 18:52:47 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:3d6d:7284:3c48:5edc]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 45C0C8AF; Thu, 12 Aug 2021 18:52:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1628787167; bh=ldM25BW6pc6QgpkW3YWFgxB8a+1jnLuUKpXxZWRqAfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v5Qh6ZVJ93eHRSn+eoAnt8Xbv77rMy5ZCn8R7h0x79taX7T5DyhCb2zNnuTi1WGZj F/Yqh45Ub759Npc9yRwZe6fPP53FGeSIzryzq95w6MDiMFewPz0UVAdxMT34RcHBfk UlUwvbvZQoQ/JBUar+FfnWzfXs5kZ2SuHt4U4obA= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Thu, 12 Aug 2021 18:52:37 +0200 Message-Id: <20210812165243.276977-5-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210812165243.276977-1-jeanmichel.hautbois@ideasonboard.com> References: <20210812165243.276977-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 04/10] ipa: ipu3: Introduce a prepare() call to Algorithm 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" When a new ipu3_uapi_params buffer is ready, IPAIPU3 receives a EventFillParams. When this is called, the algorithms should fill every field in the parameter structure they need to update. Demonstrate it by adding a loop on the prepare() call in IPAIPU3 and let the Grid algorithm update the grid field. This leads to removing this same update from the Awb algorithm. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- src/ipa/ipu3/algorithms/algorithm.h | 2 ++ src/ipa/ipu3/algorithms/grid.cpp | 6 ++++++ src/ipa/ipu3/algorithms/grid.h | 1 + src/ipa/ipu3/ipu3.cpp | 3 +++ src/ipa/ipu3/ipu3_awb.cpp | 1 - 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ipa/ipu3/algorithms/algorithm.h b/src/ipa/ipu3/algorithms/algorithm.h index c1b37276..b571f55a 100644 --- a/src/ipa/ipu3/algorithms/algorithm.h +++ b/src/ipa/ipu3/algorithms/algorithm.h @@ -26,6 +26,8 @@ public: { return 0; } + + virtual void prepare([[maybe_unused]] IPAContext &context, [[maybe_unused]] ipu3_uapi_params ¶ms) {} }; } /* namespace ipa::ipu3 */ diff --git a/src/ipa/ipu3/algorithms/grid.cpp b/src/ipa/ipu3/algorithms/grid.cpp index 3578f41b..e42a760d 100644 --- a/src/ipa/ipu3/algorithms/grid.cpp +++ b/src/ipa/ipu3/algorithms/grid.cpp @@ -78,6 +78,12 @@ int Grid::configure(IPAContext &context, const IPAConfigInfo &configInfo) return 0; } +void Grid::prepare(IPAContext &context, ipu3_uapi_params ¶ms) +{ + /* Update the IPU3 parameters with new calculated grid */ + params.acc_param.awb.config.grid = context.configuration.grid.bdsGrid; +} + } /* namespace ipa::ipu3::algorithms */ } /* namespace libcamera */ diff --git a/src/ipa/ipu3/algorithms/grid.h b/src/ipa/ipu3/algorithms/grid.h index b4a51b42..89399bd2 100644 --- a/src/ipa/ipu3/algorithms/grid.h +++ b/src/ipa/ipu3/algorithms/grid.h @@ -19,6 +19,7 @@ public: ~Grid() = default; int configure(IPAContext &context, const IPAConfigInfo &configInfo) override; + void prepare(IPAContext &context, ipu3_uapi_params ¶ms) override; }; } /* namespace ipa::ipu3::algorithms */ diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index ef7fec86..394a7a45 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -305,6 +305,9 @@ void IPAIPU3::processControls([[maybe_unused]] unsigned int frame, void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params) { + for (auto const &algo : algorithms_) + algo->prepare(context_, params_); + if (agcAlgo_->updateControls()) awbAlgo_->updateWbParameters(params_, agcAlgo_->gamma()); diff --git a/src/ipa/ipu3/ipu3_awb.cpp b/src/ipa/ipu3/ipu3_awb.cpp index 4ee5ee6f..911760b3 100644 --- a/src/ipa/ipu3/ipu3_awb.cpp +++ b/src/ipa/ipu3/ipu3_awb.cpp @@ -159,7 +159,6 @@ void IPU3Awb::initialise(ipu3_uapi_params ¶ms, const Size &bdsOutputSize, st params.acc_param.awb.config.rgbs_thr_r = 8191; params.acc_param.awb.config.rgbs_thr_gb = 8191; params.acc_param.awb.config.rgbs_thr_b = 8191 | IPU3_UAPI_AWB_RGBS_THR_B_EN | IPU3_UAPI_AWB_RGBS_THR_B_INCL_SAT; - params.acc_param.awb.config.grid = bdsGrid; awbGrid_ = bdsGrid; params.use.acc_bnr = 1;