{"id":18360,"url":"https://patchwork.libcamera.org/api/1.1/patches/18360/?format=json","web_url":"https://patchwork.libcamera.org/patch/18360/","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":"<20230308164028.235638-4-jacopo.mondi@ideasonboard.com>","date":"2023-03-08T16:40:28","name":"[libcamera-devel,3/3] ipa: rkisp1: lsc: Move 'enable' to activeState","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"9d9f6fa9bd2d637d74ec36a8775f3f45f29ad610","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/1.1/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18360/mbox/","series":[{"id":3795,"url":"https://patchwork.libcamera.org/api/1.1/series/3795/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3795","date":"2023-03-08T16:40:25","name":"ipa: rkisp1: lsc: Enable/disable LSC","version":1,"mbox":"https://patchwork.libcamera.org/series/3795/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18360/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18360/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 5A350C329C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Mar 2023 16:40:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D69C562693;\n\tWed,  8 Mar 2023 17:40:47 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C08E7626CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Mar 2023 17:40:43 +0100 (CET)","from uno.homenet.telecomitalia.it\n\t(host-79-47-54-87.retail.telecomitalia.it [79.47.54.87])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1178F576;\n\tWed,  8 Mar 2023 17:40:42 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678293647;\n\tbh=iBNi0u69uVdRJlDumXUWDZNqrpAbl5ib8tzqFa8t/3c=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Di+tsk6QhM2C3cYARog6rXTwL8sB6NKCFAw9UJnYQSFXGXonzw90bZBxYcFwI8TsR\n\tjNObwvN0RyKMAk9kvJ4Jw6amqITSPcjeN026dgjVKJXDzXRX+kYkZwkujO47lQ2gC0\n\tm86mObnKWBdfwBAogh47tEQmRHN1QCeZb4q2VBm8dcLaf92Tl8tTS7mTvgjFY0Hp3/\n\tn/8Gv9dMtlYjurjSQaVSs2/LH3rlWN6UXM+3M/HKLB4wvoHtjTVyl48OGqLop0y99U\n\tAQlFD7Ekqeld9vi/IqEH4jAVo8uWIqn3lUbQRaIBm1dQe8oEcfKqDT/J9r5toLckUW\n\tE3l7CYyakT8kQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1678293643;\n\tbh=iBNi0u69uVdRJlDumXUWDZNqrpAbl5ib8tzqFa8t/3c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Frpb+AkSkXWRhNzWzCvTiYfcDMr2HXyIKMxH96+qhy5ncb2xPZUwZoSBsEoLZLKa8\n\t6dBd8fo5skxJ7oZa292LOSnGyRKEz2ZdIfxaBeAyKtl2AvClWrag+OlF9hQQxh3YwE\n\tDlz4GWT4QkU7fspHLNL3nbEZQ1V+F+fkox9wn2hs="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Frpb+AkS\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  8 Mar 2023 17:40:28 +0100","Message-Id":"<20230308164028.235638-4-jacopo.mondi@ideasonboard.com>","X-Mailer":"git-send-email 2.39.0","In-Reply-To":"<20230308164028.235638-1-jacopo.mondi@ideasonboard.com>","References":"<20230308164028.235638-1-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 3/3] ipa: rkisp1: lsc: Move 'enable' to\n\tactiveState","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>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Now that the LSC algorithm can be enabled and disabled at run-time,\nmove the 'enabled' flag from the context's configuration to the\nalgorithm's active state.\n\nThis allows to populate the LensShadingEnable metadata in the process()\nfunction implementation.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/dpf.cpp |  6 +++---\n src/ipa/rkisp1/algorithms/lsc.cpp | 13 +++++++++----\n src/ipa/rkisp1/algorithms/lsc.h   |  4 ++++\n src/ipa/rkisp1/ipa_context.h      |  4 ----\n 4 files changed, 16 insertions(+), 11 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp\nindex 5bd7e59f651c..8f181df5c6c4 100644\n--- a/src/ipa/rkisp1/algorithms/dpf.cpp\n+++ b/src/ipa/rkisp1/algorithms/dpf.cpp\n@@ -222,7 +222,7 @@ void Dpf::prepare(IPAContext &context, const uint32_t frame,\n \t\tparams->others.dpf_strength_config = strengthConfig_;\n \n \t\tconst auto &awb = context.configuration.awb;\n-\t\tconst auto &lsc = context.configuration.lsc;\n+\t\tconst auto &lsc = context.activeState.lsc;\n \t\tauto &mode = params->others.dpf_config.gain.mode;\n \n \t\t/*\n@@ -233,11 +233,11 @@ void Dpf::prepare(IPAContext &context, const uint32_t frame,\n \t\t * LSC modules automatically when they are enabled. Use that\n \t\t * mode of operation as it simplifies control of the DPF.\n \t\t */\n-\t\tif (awb.enabled && lsc.enabled)\n+\t\tif (awb.enabled && lsc.active)\n \t\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS;\n \t\telse if (awb.enabled)\n \t\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS;\n-\t\telse if (lsc.enabled)\n+\t\telse if (lsc.active)\n \t\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS;\n \t\telse\n \t\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED;\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex 0c9f6cbd1dec..8de49e4220ea 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -149,8 +149,6 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n \t\treturn -EINVAL;\n \t}\n \n-\tcontext.configuration.lsc.enabled = false;\n-\n \treturn 0;\n }\n \n@@ -290,12 +288,10 @@ void LensShadingCorrection::prepare(IPAContext &context,\n \t\tif (!lsc->enable) {\n \t\t\tdisableLSC(params);\n \t\t\tlsc->active = false;\n-\t\t\tcontext.configuration.lsc.enabled = false;\n \t\t\treturn;\n \t\t}\n \n \t\tlsc->active = true;\n-\t\tcontext.configuration.lsc.enabled = true;\n \t}\n \n \t/* Nothing more to do here if LSC is not active. */\n@@ -387,6 +383,15 @@ void LensShadingCorrection::prepare(IPAContext &context,\n \tlastCt_ = { ct, ct };\n }\n \n+void LensShadingCorrection::process(IPAContext &context,\n+\t\t\t\t    [[maybe_unused]] const uint32_t frame,\n+\t\t\t\t    [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t\t\t    [[maybe_unused]] const rkisp1_stat_buffer *stats,\n+\t\t\t\t    ControlList &metadata)\n+{\n+\tmetadata.set(controls::LensShadingEnable, context.activeState.lsc.active);\n+}\n+\n REGISTER_IPA_ALGORITHM(LensShadingCorrection, \"LensShadingCorrection\")\n \n } /* namespace ipa::rkisp1::algorithms */\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\nindex 4708065bcfb7..e9770f4027f4 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.h\n+++ b/src/ipa/rkisp1/algorithms/lsc.h\n@@ -29,6 +29,10 @@ public:\n \tvoid prepare(IPAContext &context, const uint32_t frame,\n \t\t     IPAFrameContext &frameContext,\n \t\t     rkisp1_params_cfg *params) override;\n+\tvoid process(IPAContext &context, const uint32_t frame,\n+\t\t     IPAFrameContext &frameContext,\n+\t\t     const rkisp1_stat_buffer *stats,\n+\t\t     ControlList &metadata) override;\n \n private:\n \tstruct Components {\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex ada995274ebf..bb72f0a40a12 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -30,10 +30,6 @@ struct IPASessionConfiguration {\n \t\tbool enabled;\n \t} awb;\n \n-\tstruct {\n-\t\tbool enabled;\n-\t} lsc;\n-\n \tstruct {\n \t\tutils::Duration minShutterSpeed;\n \t\tutils::Duration maxShutterSpeed;\n","prefixes":["libcamera-devel","3/3"]}