From patchwork Fri Sep 30 01:55:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17471 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 DF6C8C0DA4 for ; Fri, 30 Sep 2022 01:55:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 20C3B62395; Fri, 30 Sep 2022 03:55:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664502951; bh=7nwjN01hjkxdj3VCdp0d6pb0vcb3tVMM/HCDGHxYcV0=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rUr93SYj8IBdocwNZ8NTH16AXySTGE5QEtzBsTX0jjjatPjBe6Gyp0S607+sJrAEH HW/9n0hWbdaMHfSaJKJDyqe//BK+9WHIiqsgcGrFEE3WJbOnggu5H5FvjPTino5MdF 8MTFNiZBBiE2RTwNWgRgBPYSY99YE2TIVWO/1amkfVaDJ54DnrNSrSbbBRNJD6GAD4 aAIq2msP+yRX4fsxKHN3FHPLbFywlQLQBxGHyTVlSCvadVPpeZiObqQinKbhR4gY3a 0RedEeFy6euxKqHwSQGLz6mNFGZBtyK5svsLb2HnkXZCMdLTakPLkAKB13kl+j0BOS vXSWv8fSUm94Q== 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 A75A661F76 for ; Fri, 30 Sep 2022 03:55:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ExDXzw98"; 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 06EDA47C; Fri, 30 Sep 2022 03:55:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664502949; bh=7nwjN01hjkxdj3VCdp0d6pb0vcb3tVMM/HCDGHxYcV0=; h=From:To:Cc:Subject:Date:From; b=ExDXzw98uYS6kg0hw4FBWQD4eJTINuO3LACKsNSjuISPC3kIsXOW6AYrm55fF86BK jeaI5X8njHHinMPj1kL9tJO4kVe6FNQMlXNNPQpS9933vEhZMnSUL1MCwZUcLqa57A T4/PbMvxHnDanGslIArlbDx8CuWrEFercO3vBkUo= To: libcamera-devel@lists.libcamera.org Date: Fri, 30 Sep 2022 04:55:47 +0300 Message-Id: <20220930015547.29911-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: rkisp1: Remove initialized_ flags from algorithms 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" Multiple algorithms have an initialized_ flag that they set to true at the end of the init() function, and check at the beginning of prepare() to skip preparation. This serves no real purpose, as the flag can only be false if init() fails, in which case the IPA module initialization as a whole will fail. Drop the initialized_ flags. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/ipa/rkisp1/algorithms/dpcc.cpp | 7 +------ src/ipa/rkisp1/algorithms/dpcc.h | 1 - src/ipa/rkisp1/algorithms/dpf.cpp | 7 +------ src/ipa/rkisp1/algorithms/dpf.h | 1 - src/ipa/rkisp1/algorithms/gsl.cpp | 5 ----- src/ipa/rkisp1/algorithms/gsl.h | 1 - src/ipa/rkisp1/algorithms/lsc.cpp | 8 +------- src/ipa/rkisp1/algorithms/lsc.h | 2 -- 8 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/dpcc.cpp b/src/ipa/rkisp1/algorithms/dpcc.cpp index 53aa1d93e42b..3d6b87e62239 100644 --- a/src/ipa/rkisp1/algorithms/dpcc.cpp +++ b/src/ipa/rkisp1/algorithms/dpcc.cpp @@ -189,7 +189,7 @@ bool parseMethod(const YamlObject &yamlMethod, const Method &method, } /* namespace */ DefectPixelClusterCorrection::DefectPixelClusterCorrection() - : initialized_(false), config_({}) + : config_({}) { } @@ -250,8 +250,6 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context, } } - initialized_ = true; - return 0; } @@ -266,9 +264,6 @@ void DefectPixelClusterCorrection::prepare([[maybe_unused]] IPAContext &context, if (frame > 0) return; - if (!initialized_) - return; - params->others.dpcc_config = config_; params->module_en_update |= RKISP1_CIF_ISP_MODULE_DPCC; diff --git a/src/ipa/rkisp1/algorithms/dpcc.h b/src/ipa/rkisp1/algorithms/dpcc.h index 894c0249f35d..b1fac7d1bb37 100644 --- a/src/ipa/rkisp1/algorithms/dpcc.h +++ b/src/ipa/rkisp1/algorithms/dpcc.h @@ -25,7 +25,6 @@ public: rkisp1_params_cfg *params) override; private: - bool initialized_; rkisp1_cif_isp_dpcc_config config_; }; diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp index f7bc371da52e..82d4f7fecc67 100644 --- a/src/ipa/rkisp1/algorithms/dpf.cpp +++ b/src/ipa/rkisp1/algorithms/dpf.cpp @@ -35,7 +35,7 @@ namespace ipa::rkisp1::algorithms { LOG_DEFINE_CATEGORY(RkISP1Dpf) Dpf::Dpf() - : initialized_(false), config_({}), strengthConfig_({}) + : config_({}), strengthConfig_({}) { } @@ -166,8 +166,6 @@ int Dpf::init([[maybe_unused]] IPAContext &context, strengthConfig_.g = fSObject["g"].get(64); strengthConfig_.b = fSObject["b"].get(64); - initialized_ = true; - return 0; } @@ -219,9 +217,6 @@ void Dpf::queueRequest(IPAContext &context, void Dpf::prepare(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, rkisp1_params_cfg *params) { - if (!initialized_) - return; - if (frame == 0) { params->others.dpf_config = config_; params->others.dpf_strength_config = strengthConfig_; diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h index e232cad4ee87..58f29f74e84b 100644 --- a/src/ipa/rkisp1/algorithms/dpf.h +++ b/src/ipa/rkisp1/algorithms/dpf.h @@ -30,7 +30,6 @@ public: rkisp1_params_cfg *params) override; private: - bool initialized_; struct rkisp1_cif_isp_dpf_config config_; struct rkisp1_cif_isp_dpf_strength_config strengthConfig_; }; diff --git a/src/ipa/rkisp1/algorithms/gsl.cpp b/src/ipa/rkisp1/algorithms/gsl.cpp index 9cbad02038c4..a80fed589bb2 100644 --- a/src/ipa/rkisp1/algorithms/gsl.cpp +++ b/src/ipa/rkisp1/algorithms/gsl.cpp @@ -49,7 +49,6 @@ LOG_DEFINE_CATEGORY(RkISP1Gsl) static constexpr unsigned int kDegammaXIntervals = 16; GammaSensorLinearization::GammaSensorLinearization() - : initialized_(false) { } @@ -111,7 +110,6 @@ int GammaSensorLinearization::init([[maybe_unused]] IPAContext &context, return -EINVAL; } - initialized_ = true; return 0; } @@ -126,9 +124,6 @@ void GammaSensorLinearization::prepare([[maybe_unused]] IPAContext &context, if (frame > 0) return; - if (!initialized_) - return; - params->others.sdg_config.xa_pnts.gamma_dx0 = gammaDx_[0]; params->others.sdg_config.xa_pnts.gamma_dx1 = gammaDx_[1]; diff --git a/src/ipa/rkisp1/algorithms/gsl.h b/src/ipa/rkisp1/algorithms/gsl.h index 5024b6835949..0f1116a7b1f2 100644 --- a/src/ipa/rkisp1/algorithms/gsl.h +++ b/src/ipa/rkisp1/algorithms/gsl.h @@ -25,7 +25,6 @@ public: rkisp1_params_cfg *params) override; private: - bool initialized_; uint32_t gammaDx_[2]; std::vector curveYr_; std::vector curveYg_; diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp index 44245caa705e..102535bd11a4 100644 --- a/src/ipa/rkisp1/algorithms/lsc.cpp +++ b/src/ipa/rkisp1/algorithms/lsc.cpp @@ -89,7 +89,6 @@ static std::vector parseTable(const YamlObject &tuningData, } LensShadingCorrection::LensShadingCorrection() - : initialized_(false) { } @@ -114,8 +113,6 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context, gbData_.empty() || bData_.empty()) return -EINVAL; - initialized_ = true; - return 0; } @@ -125,7 +122,7 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context, int LensShadingCorrection::configure(IPAContext &context, [[maybe_unused]] const IPACameraSensorInfo &configInfo) { - context.configuration.lsc.enabled = initialized_; + context.configuration.lsc.enabled = true; return 0; } @@ -139,9 +136,6 @@ void LensShadingCorrection::prepare(IPAContext &context, const uint32_t frame, if (frame > 0) return; - if (!initialized_) - return; - struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config; const Size &size = context.configuration.sensor.size; Size totalSize{}; diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h index da957d3e3103..6c052669d80f 100644 --- a/src/ipa/rkisp1/algorithms/lsc.h +++ b/src/ipa/rkisp1/algorithms/lsc.h @@ -26,8 +26,6 @@ public: rkisp1_params_cfg *params) override; private: - bool initialized_; - std::vector rData_; std::vector grData_; std::vector gbData_;