{"id":17331,"url":"https://patchwork.libcamera.org/api/patches/17331/?format=json","web_url":"https://patchwork.libcamera.org/patch/17331/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220908014200.28728-23-laurent.pinchart@ideasonboard.com>","date":"2022-09-08T01:41:50","name":"[libcamera-devel,v4,22/32] ipa: rkisp1: dpf: Store per-frame information in frame context","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7d0114c17033ad3c00ea3d4400d9d77b8a5c04e6","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17331/mbox/","series":[{"id":3476,"url":"https://patchwork.libcamera.org/api/series/3476/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3476","date":"2022-09-08T01:41:28","name":"ipa: Frame context queue, IPU3 & RkISP consolidation, and RkISP1 improvements","version":4,"mbox":"https://patchwork.libcamera.org/series/3476/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17331/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17331/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 CEAC5C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Sep 2022 01:42:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7EE79620F2;\n\tThu,  8 Sep 2022 03:42:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B6D33620E1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Sep 2022 03:42:48 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4408D888\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Sep 2022 03:42:48 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662601371;\n\tbh=jn9Ivw3zGegi1jns95YpkXteO+PkORxCdYTrqghI6UM=;\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:\n\tFrom;\n\tb=tlqgEYPPPeAbDgpqEWE3d+JlboMlBUfKeHfTZ9SI51h4nypbNvmfHtcDHph7asK9Q\n\tkVLoZ7hKt/oQ9bdGFz1tpmE020R2bP3PSiZp+o9Hn76Ko+jDSYOXqN3ZbAfADTBZUo\n\t/XyfpIkRXVfRVVWwcgLd3SW8soKA9zFfM1iPm2DO6BKtvjyGEH16UNpd6dQz6CC47+\n\tJxBT2isz0jWkxM46ujbQwGJ1OLudXOM//YhppwvaI9UuWwaXzyw37WXophj2hIT6jm\n\tYzocJUrqgurDEvvCuQnIMYoQrPKaDJkbUE6uie/rX4nKbXIqbNNdVl5eyp8fyP0BcD\n\tzvigyZgrpM8mw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662601368;\n\tbh=jn9Ivw3zGegi1jns95YpkXteO+PkORxCdYTrqghI6UM=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=P0OGZ3JEr8HvsgH2FrRDYBREnGJLYWLPCz5KtEAHxJvPW/dSR154iwmhE8oxpeJhe\n\tVeRNpJXHzjpeBi13EG+n5ZbpoC3L8sM/gmOdyVnqayaQeswR4oUYwpvO/0dLOVNqsD\n\tbKG9yj+xUD1JDNcyJ8O4G5I4Mn0cnrBlQFwAXrVY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"P0OGZ3JE\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  8 Sep 2022 04:41:50 +0300","Message-Id":"<20220908014200.28728-23-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220908014200.28728-1-laurent.pinchart@ideasonboard.com>","References":"<20220908014200.28728-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 22/32] ipa: rkisp1: dpf: Store\n\tper-frame information in frame context","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Rework the algorithm's usage of the active state, to store the value of\ncontrols for the last queued request in the queueRequest() function, and\nstore a copy of the values in the corresponding frame context. The\nlatter is used in the prepare() function to populate the ISP parameters\nwith values corresponding to the right frame.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/dpf.cpp | 22 +++++++++++-----------\n src/ipa/rkisp1/ipa_context.cpp    | 15 ++++++++++++---\n src/ipa/rkisp1/ipa_context.h      |  6 +++++-\n 3 files changed, 28 insertions(+), 15 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp\nindex 94c35c36570c..5d44480c5059 100644\n--- a/src/ipa/rkisp1/algorithms/dpf.cpp\n+++ b/src/ipa/rkisp1/algorithms/dpf.cpp\n@@ -176,10 +176,11 @@ int Dpf::init([[maybe_unused]] IPAContext &context,\n  */\n void Dpf::queueRequest(IPAContext &context,\n \t\t       [[maybe_unused]] const uint32_t frame,\n-\t\t       [[maybe_unused]] RkISP1FrameContext &frameContext,\n+\t\t       RkISP1FrameContext &frameContext,\n \t\t       const ControlList &controls)\n {\n \tauto &dpf = context.activeState.dpf;\n+\tbool update = false;\n \n \tconst auto &denoise = controls.get(controls::draft::NoiseReductionMode);\n \tif (denoise) {\n@@ -188,34 +189,35 @@ void Dpf::queueRequest(IPAContext &context,\n \t\tswitch (*denoise) {\n \t\tcase controls::draft::NoiseReductionModeOff:\n \t\t\tdpf.denoise = false;\n-\t\t\tdpf.updateParams = true;\n+\t\t\tupdate = true;\n \t\t\tbreak;\n \t\tcase controls::draft::NoiseReductionModeMinimal:\n \t\tcase controls::draft::NoiseReductionModeHighQuality:\n \t\tcase controls::draft::NoiseReductionModeFast:\n \t\t\tdpf.denoise = true;\n-\t\t\tdpf.updateParams = true;\n+\t\t\tupdate = true;\n \t\t\tbreak;\n \t\tdefault:\n \t\t\tLOG(RkISP1Dpf, Error)\n \t\t\t\t<< \"Unsupported denoise value \"\n \t\t\t\t<< *denoise;\n+\t\t\tbreak;\n \t\t}\n \t}\n+\n+\tframeContext.dpf.denoise = dpf.denoise;\n+\tframeContext.dpf.update = update;\n }\n \n /**\n  * \\copydoc libcamera::ipa::Algorithm::prepare\n  */\n void Dpf::prepare(IPAContext &context, const uint32_t frame,\n-\t\t  [[maybe_unused]] RkISP1FrameContext &frameContext,\n-\t\t  rkisp1_params_cfg *params)\n+\t\t  RkISP1FrameContext &frameContext, rkisp1_params_cfg *params)\n {\n \tif (!initialized_)\n \t\treturn;\n \n-\tauto &dpf = context.activeState.dpf;\n-\n \tif (frame == 0) {\n \t\tparams->others.dpf_config = config_;\n \t\tparams->others.dpf_strength_config = strengthConfig_;\n@@ -245,12 +247,10 @@ void Dpf::prepare(IPAContext &context, const uint32_t frame,\n \t\t\t\t\t     RKISP1_CIF_ISP_MODULE_DPF_STRENGTH;\n \t}\n \n-\tif (dpf.updateParams) {\n+\tif (frameContext.dpf.update) {\n \t\tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_DPF;\n-\t\tif (dpf.denoise)\n+\t\tif (frameContext.dpf.denoise)\n \t\t\tparams->module_ens |= RKISP1_CIF_ISP_MODULE_DPF;\n-\n-\t\tdpf.updateParams = false;\n \t}\n }\n \ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex 936b77709417..b0210a978559 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -168,9 +168,6 @@ namespace libcamera::ipa::rkisp1 {\n  *\n  * \\var IPAActiveState::dpf.denoise\n  * \\brief Indicates if denoise is activated\n- *\n- * \\var IPAActiveState::dpf.updateParams\n- * \\brief Indicates if ISP parameters need to be updated\n  */\n \n /**\n@@ -251,6 +248,18 @@ namespace libcamera::ipa::rkisp1 {\n  * compared to the previous frame\n  */\n \n+/**\n+ * \\var RkISP1FrameContext::dpf\n+ * \\brief Denoise Pre-Filter parameters for this frame\n+ *\n+ * \\var RkISP1FrameContext::dpf.denoise\n+ * \\brief Indicates if denoise is activated\n+ *\n+ * \\var RkISP1FrameContext::dpf.update\n+ * \\brief Indicates if the denoise pre-filter parameters have been updated\n+ * compared to the previous frame\n+ */\n+\n /**\n  * \\var RkISP1FrameContext::sensor\n  * \\brief Sensor configuration that used been used for this frame\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 78edb607d039..c22e1f099c23 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -79,7 +79,6 @@ struct IPAActiveState {\n \n \tstruct {\n \t\tbool denoise;\n-\t\tbool updateParams;\n \t} dpf;\n \n \tstruct {\n@@ -113,6 +112,11 @@ struct RkISP1FrameContext : public FrameContext {\n \t\tbool update;\n \t} cproc;\n \n+\tstruct {\n+\t\tbool denoise;\n+\t\tbool update;\n+\t} dpf;\n+\n \tstruct {\n \t\tuint32_t exposure;\n \t\tdouble gain;\n","prefixes":["libcamera-devel","v4","22/32"]}