From patchwork Tue Sep 27 02:36:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17430 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 19062C0DA4 for ; Tue, 27 Sep 2022 02:37:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C0EF9622A4; Tue, 27 Sep 2022 04:37:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664246249; bh=1ZTMVZVGzQtgvJ31xn75MgNd1NZ0xA5ltcPWjKkZ88Q=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=rGCRvgyZzeXGzWX4KWPxBM/3SC3ovlTjgQPsU19tfYcE6vIU7vbuiOIaHVyOuGdP0 lNKMAH7uNQ/vNg4Ivu8pQzGB+CZZXPAms5wRUCOqmYbUfbmhXruz/KpkFXcAP/K5jf azFElLeOYJMMh/F2u+sfSpaLkACbUPWfm+K3VAO9fIABsznLLD2xTYA/ZNybkgRq0g 97wnAFX3qaJ4Oy6bGQSJvVMHwkDqCgcVISFzAe6MzeJ2NVxvuahaStfvxVeD95+LAc Fn5eOrUgoQWjrDBzYcap3N0QVF+fGPsDaqTpE52S2RQa32llhbC+E/ffNo4ih8dcA9 mP0oYew1CCPmQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5BD21622A9 for ; Tue, 27 Sep 2022 04:37:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JprMLA/e"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D50A5E5 for ; Tue, 27 Sep 2022 04:37:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664246247; bh=1ZTMVZVGzQtgvJ31xn75MgNd1NZ0xA5ltcPWjKkZ88Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JprMLA/evL/s8YF0PK8rL3EY9o4PyjkdSQRLsdHJ6QS5BVOVSU//8J5X8CDO8uRiY M3e1tr+k9xrqnZ+D2cJ3IE4CUNEdeWpQDPb9IElkApte61GRDH8zFNfJeZPvGv4FNy XJe8/AvEfXejaLel+Q7EG+uWsGATa3G+i4PUaTiw= To: libcamera-devel@lists.libcamera.org Date: Tue, 27 Sep 2022 05:36:28 +0300 Message-Id: <20220927023642.12341-20-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927023642.12341-1-laurent.pinchart@ideasonboard.com> References: <20220927023642.12341-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 19/33] ipa: rkisp1: Use frame number passed to Algorithm::prepare() 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: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now that the Algorithm::prepare() function takes a frame number, we can use it to replace the IPAActiveState::frameCount member. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/ipa/rkisp1/algorithms/agc.cpp | 5 ++--- src/ipa/rkisp1/algorithms/awb.cpp | 5 ++--- src/ipa/rkisp1/algorithms/blc.cpp | 6 +++--- src/ipa/rkisp1/algorithms/dpcc.cpp | 6 +++--- src/ipa/rkisp1/algorithms/dpf.cpp | 4 ++-- src/ipa/rkisp1/algorithms/gsl.cpp | 6 +++--- src/ipa/rkisp1/algorithms/lsc.cpp | 5 ++--- src/ipa/rkisp1/ipa_context.cpp | 9 --------- src/ipa/rkisp1/ipa_context.h | 2 -- src/ipa/rkisp1/rkisp1.cpp | 3 --- 10 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 7219cc5c37ab..87fc5d1ffec7 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -327,12 +327,11 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, /** * \copydoc libcamera::ipa::Algorithm::prepare */ -void Agc::prepare(IPAContext &context, - [[maybe_unused]] const uint32_t frame, +void Agc::prepare(IPAContext &context, const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, rkisp1_params_cfg *params) { - if (context.activeState.frameCount > 0) + if (frame > 0) return; /* Configure the measurement window. */ diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 2bd9ef779bc3..78398927e462 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -74,8 +74,7 @@ uint32_t Awb::estimateCCT(double red, double green, double blue) /** * \copydoc libcamera::ipa::Algorithm::prepare */ -void Awb::prepare(IPAContext &context, - [[maybe_unused]] const uint32_t frame, +void Awb::prepare(IPAContext &context, const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, rkisp1_params_cfg *params) { @@ -88,7 +87,7 @@ void Awb::prepare(IPAContext &context, params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_AWB_GAIN; /* If we already have configured the gains and window, return. */ - if (context.activeState.frameCount > 0) + if (frame > 0) return; /* Configure the gains to apply. */ diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp index 0f7226cf217d..15324fb11861 100644 --- a/src/ipa/rkisp1/algorithms/blc.cpp +++ b/src/ipa/rkisp1/algorithms/blc.cpp @@ -65,12 +65,12 @@ int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context, /** * \copydoc libcamera::ipa::Algorithm::prepare */ -void BlackLevelCorrection::prepare(IPAContext &context, - [[maybe_unused]] const uint32_t frame, +void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context, + const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, rkisp1_params_cfg *params) { - if (context.activeState.frameCount > 0) + if (frame > 0) return; if (!tuningParameters_) diff --git a/src/ipa/rkisp1/algorithms/dpcc.cpp b/src/ipa/rkisp1/algorithms/dpcc.cpp index 7c14ace0abee..53aa1d93e42b 100644 --- a/src/ipa/rkisp1/algorithms/dpcc.cpp +++ b/src/ipa/rkisp1/algorithms/dpcc.cpp @@ -258,12 +258,12 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context, /** * \copydoc libcamera::ipa::Algorithm::prepare */ -void DefectPixelClusterCorrection::prepare(IPAContext &context, - [[maybe_unused]] const uint32_t frame, +void DefectPixelClusterCorrection::prepare([[maybe_unused]] IPAContext &context, + const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, rkisp1_params_cfg *params) { - if (context.activeState.frameCount > 0) + if (frame > 0) return; if (!initialized_) diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp index b8c837c21243..b8d0c7b85639 100644 --- a/src/ipa/rkisp1/algorithms/dpf.cpp +++ b/src/ipa/rkisp1/algorithms/dpf.cpp @@ -207,7 +207,7 @@ void Dpf::queueRequest(IPAContext &context, /** * \copydoc libcamera::ipa::Algorithm::prepare */ -void Dpf::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame, +void Dpf::prepare(IPAContext &context, const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, rkisp1_params_cfg *params) { @@ -216,7 +216,7 @@ void Dpf::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame, auto &dpf = context.activeState.dpf; - if (context.activeState.frameCount == 0) { + if (frame == 0) { params->others.dpf_config = config_; params->others.dpf_strength_config = strengthConfig_; diff --git a/src/ipa/rkisp1/algorithms/gsl.cpp b/src/ipa/rkisp1/algorithms/gsl.cpp index 879ca2973e8a..9cbad02038c4 100644 --- a/src/ipa/rkisp1/algorithms/gsl.cpp +++ b/src/ipa/rkisp1/algorithms/gsl.cpp @@ -118,12 +118,12 @@ int GammaSensorLinearization::init([[maybe_unused]] IPAContext &context, /** * \copydoc libcamera::ipa::Algorithm::prepare */ -void GammaSensorLinearization::prepare(IPAContext &context, - [[maybe_unused]] const uint32_t frame, +void GammaSensorLinearization::prepare([[maybe_unused]] IPAContext &context, + const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, rkisp1_params_cfg *params) { - if (context.activeState.frameCount > 0) + if (frame > 0) return; if (!initialized_) diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp index 9c717bc5f99e..44245caa705e 100644 --- a/src/ipa/rkisp1/algorithms/lsc.cpp +++ b/src/ipa/rkisp1/algorithms/lsc.cpp @@ -132,12 +132,11 @@ int LensShadingCorrection::configure(IPAContext &context, /** * \copydoc libcamera::ipa::Algorithm::prepare */ -void LensShadingCorrection::prepare(IPAContext &context, - [[maybe_unused]] const uint32_t frame, +void LensShadingCorrection::prepare(IPAContext &context, const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, rkisp1_params_cfg *params) { - if (context.activeState.frameCount > 0) + if (frame > 0) return; if (!initialized_) diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp index e9846742ee4f..78a785f5f982 100644 --- a/src/ipa/rkisp1/ipa_context.cpp +++ b/src/ipa/rkisp1/ipa_context.cpp @@ -192,15 +192,6 @@ namespace libcamera::ipa::rkisp1 { * \brief Analogue gain multiplier */ -/** - * \var IPAActiveState::frameCount - * \brief Counter of requests queued to the IPA module - * - * The counter is reset to 0 when the IPA module is configured, and is - * incremented for each request being queued, after calling the - * Algorithm::prepare() function of all algorithms. - */ - /** * \struct IPAFrameContext * \brief Per-frame context for algorithms diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h index 9a84b7adda45..c7041ea2a214 100644 --- a/src/ipa/rkisp1/ipa_context.h +++ b/src/ipa/rkisp1/ipa_context.h @@ -88,8 +88,6 @@ struct IPAActiveState { uint32_t exposure; double gain; } sensor; - - unsigned int frameCount; }; struct IPAFrameContext : public FrameContext { diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index b7c1ecfee4c8..5409c2d5219e 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -259,8 +259,6 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info, context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain); context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain); - context_.activeState.frameCount = 0; - for (auto const &algo : algorithms()) { int ret = algo->configure(context_, info); if (ret) @@ -323,7 +321,6 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) algo->prepare(context_, frame, frameContext, params); paramsBufferReady.emit(frame); - context_.activeState.frameCount++; } void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,