Patch Detail
Show a patch.
GET /api/1.1/patches/17435/?format=api
{ "id": 17435, "url": "https://patchwork.libcamera.org/api/1.1/patches/17435/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17435/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220927023642.12341-25-laurent.pinchart@ideasonboard.com>", "date": "2022-09-27T02:36:33", "name": "[libcamera-devel,v5,24/33] ipa: rkisp1: filter: Store per-frame information in frame context", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "3b418d8cbc0790d16f74f3e3d56ddc870be4154e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17435/mbox/", "series": [ { "id": 3506, "url": "https://patchwork.libcamera.org/api/1.1/series/3506/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3506", "date": "2022-09-27T02:36:09", "name": "ipa: Frame context queue, IPU3 & RkISP consolidation, and RkISP1 improvements", "version": 5, "mbox": "https://patchwork.libcamera.org/series/3506/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17435/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17435/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 6AE3FC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Sep 2022 02:37:41 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0564E622E8;\n\tTue, 27 Sep 2022 04:37:41 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B7AB762268\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Sep 2022 04:37:37 +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 30FA0E5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Sep 2022 04:37:37 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664246261;\n\tbh=UlmoKdWfvwRreP4dtGHvpH32FV97sx3ax0ZcEdVQmGU=;\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=1CB9txdd8pJpMFjIceK+G2TrYQCCWMGKdYv6TKPmjStyd9yznhk5CwNHwxgs56fQ8\n\tSyY6HMzNGpEhZ8f/Idyu3i/Ubua8/NAr9QMg0laAmwYSFevM/9lzh13oJzqyiNwE0Y\n\tXKol3xdITxqBxzgMXcCA9/Ytx9gka+uvZoG8jzFdhDSf/ASPqYcU27+0Fq20EE9miE\n\tDn71K/IPOOCtK1SyKM3AuQeWhcMyRLs0eZqqJLfixsbj9NOxxo+OpgQOhB42rS0v+2\n\tsR1uh8TOihSukCaURKez8dtFregd93kpMrBQ824y42QZg+pC4bSa62wceX3Ddzybp5\n\t8eEDP1nUBUaqQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664246257;\n\tbh=UlmoKdWfvwRreP4dtGHvpH32FV97sx3ax0ZcEdVQmGU=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=VusSu2EUhgIwMq31HAyRZPDBLm15c1BS1pvqPZlb2HWZ9C2Jnf6lirWbZxvjTB1IM\n\t8Ncki0/Fs3cLzDBcN9SgoRHhn4U8qQP8nnc9SGtZANQ8dYMncUhsQfIevUp9ydL/O5\n\txRa3qg77tyCV6zcV50UdDQlfR+homop95UyDxyHw=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"VusSu2EU\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 27 Sep 2022 05:36:33 +0300", "Message-Id": "<20220927023642.12341-25-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", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 24/33] ipa: rkisp1: filter: 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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\nChanges since v4:\n\n- Only update parameters when values have changed\n---\n src/ipa/rkisp1/algorithms/filter.cpp | 49 +++++++++++++++++-----------\n src/ipa/rkisp1/ipa_context.cpp | 18 ++++++++--\n src/ipa/rkisp1/ipa_context.h | 7 +++-\n 3 files changed, 51 insertions(+), 23 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/filter.cpp b/src/ipa/rkisp1/algorithms/filter.cpp\nindex 837560eb20a6..4b89c05a52c4 100644\n--- a/src/ipa/rkisp1/algorithms/filter.cpp\n+++ b/src/ipa/rkisp1/algorithms/filter.cpp\n@@ -44,15 +44,20 @@ static constexpr uint32_t kFiltModeDefault = 0x000004f2;\n */\n void Filter::queueRequest(IPAContext &context,\n \t\t\t [[maybe_unused]] const uint32_t frame,\n-\t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t\t IPAFrameContext &frameContext,\n \t\t\t const ControlList &controls)\n {\n \tauto &filter = context.activeState.filter;\n+\tbool update = false;\n \n \tconst auto &sharpness = controls.get(controls::Sharpness);\n \tif (sharpness) {\n-\t\tfilter.sharpness = std::round(std::clamp(*sharpness, 0.0f, 10.0f));\n-\t\tfilter.updateParams = true;\n+\t\tunsigned int value = std::round(std::clamp(*sharpness, 0.0f, 10.0f));\n+\n+\t\tif (filter.sharpness != value) {\n+\t\t\tfilter.sharpness = value;\n+\t\t\tupdate = true;\n+\t\t}\n \n \t\tLOG(RkISP1Filter, Debug) << \"Set sharpness to \" << *sharpness;\n \t}\n@@ -63,42 +68,48 @@ void Filter::queueRequest(IPAContext &context,\n \n \t\tswitch (*denoise) {\n \t\tcase controls::draft::NoiseReductionModeOff:\n-\t\t\tfilter.denoise = 0;\n-\t\t\tfilter.updateParams = true;\n+\t\t\tif (filter.denoise != 0) {\n+\t\t\t\tfilter.denoise = 0;\n+\t\t\t\tupdate = true;\n+\t\t\t}\n \t\t\tbreak;\n \t\tcase controls::draft::NoiseReductionModeMinimal:\n-\t\t\tfilter.denoise = 1;\n-\t\t\tfilter.updateParams = true;\n+\t\t\tif (filter.denoise != 1) {\n+\t\t\t\tfilter.denoise = 1;\n+\t\t\t\tupdate = true;\n+\t\t\t}\n \t\t\tbreak;\n \t\tcase controls::draft::NoiseReductionModeHighQuality:\n \t\tcase controls::draft::NoiseReductionModeFast:\n-\t\t\tfilter.denoise = 3;\n-\t\t\tfilter.updateParams = true;\n+\t\t\tif (filter.denoise != 3) {\n+\t\t\t\tfilter.denoise = 3;\n+\t\t\t\tupdate = true;\n+\t\t\t}\n \t\t\tbreak;\n \t\tdefault:\n \t\t\tLOG(RkISP1Filter, 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.filter.denoise = filter.denoise;\n+\tframeContext.filter.sharpness = filter.sharpness;\n+\tframeContext.filter.update = update;\n }\n \n /**\n * \\copydoc libcamera::ipa::Algorithm::prepare\n */\n-void Filter::prepare(IPAContext &context,\n+void Filter::prepare([[maybe_unused]] IPAContext &context,\n \t\t [[maybe_unused]] const uint32_t frame,\n-\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n-\t\t rkisp1_params_cfg *params)\n+\t\t IPAFrameContext &frameContext, rkisp1_params_cfg *params)\n {\n-\tauto &filter = context.activeState.filter;\n-\n \t/* Check if the algorithm configuration has been updated. */\n-\tif (!filter.updateParams)\n+\tif (!frameContext.filter.update)\n \t\treturn;\n \n-\tfilter.updateParams = false;\n-\n \tstatic constexpr uint16_t filt_fac_sh0[] = {\n \t\t0x04, 0x07, 0x0a, 0x0c, 0x10, 0x14, 0x1a, 0x1e, 0x24, 0x2a, 0x30\n \t};\n@@ -147,8 +158,8 @@ void Filter::prepare(IPAContext &context,\n \t\t0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3\n \t};\n \n-\tuint8_t denoise = filter.denoise;\n-\tuint8_t sharpness = filter.sharpness;\n+\tuint8_t denoise = frameContext.filter.denoise;\n+\tuint8_t sharpness = frameContext.filter.sharpness;\n \tauto &flt_config = params->others.flt_config;\n \n \tflt_config.fac_sh0 = filt_fac_sh0[sharpness];\ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex c7cd007b2428..4380634e272d 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -179,9 +179,6 @@ namespace libcamera::ipa::rkisp1 {\n *\n * \\var IPAActiveState::filter.sharpness\n * \\brief Sharpness level\n- *\n- * \\var IPAActiveState::filter.updateParams\n- * \\brief Indicates if ISP parameters need to be updated\n */\n \n /**\n@@ -260,6 +257,21 @@ namespace libcamera::ipa::rkisp1 {\n * compared to the previous frame\n */\n \n+/**\n+ * \\var IPAFrameContext::filter\n+ * \\brief Filter parameters for this frame\n+ *\n+ * \\struct IPAFrameContext::filter.denoise\n+ * \\brief Denoising level\n+ *\n+ * \\var IPAFrameContext::filter.sharpness\n+ * \\brief Sharpness level\n+ *\n+ * \\var IPAFrameContext::filter.updateParams\n+ * \\brief Indicates if the filter parameters have been updated compared to the\n+ * previous frame\n+ */\n+\n /**\n * \\var IPAFrameContext::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 81b632a15960..9a16dd6cf108 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -85,7 +85,6 @@ struct IPAActiveState {\n \tstruct {\n \t\tuint8_t denoise;\n \t\tuint8_t sharpness;\n-\t\tbool updateParams;\n \t} filter;\n };\n \n@@ -118,6 +117,12 @@ struct IPAFrameContext : public FrameContext {\n \t\tbool update;\n \t} dpf;\n \n+\tstruct {\n+\t\tuint8_t denoise;\n+\t\tuint8_t sharpness;\n+\t\tbool update;\n+\t} filter;\n+\n \tstruct {\n \t\tuint32_t exposure;\n \t\tdouble gain;\n", "prefixes": [ "libcamera-devel", "v5", "24/33" ] }