Patch Detail
Show a patch.
GET /api/1.1/patches/16970/?format=api
{ "id": 16970, "url": "https://patchwork.libcamera.org/api/1.1/patches/16970/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16970/", "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": "<20220804141228.417211-4-fsylvestre@baylibre.com>", "date": "2022-08-04T14:12:28", "name": "[libcamera-devel,3/3] ipa: rkisp1: Add support of De-noise Pre-Filter control", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "582a245bcdd4d662aecc0e23b7b7348032ab216a", "submitter": { "id": 123, "url": "https://patchwork.libcamera.org/api/1.1/people/123/?format=api", "name": "Florian Sylvestre", "email": "fsylvestre@baylibre.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16970/mbox/", "series": [ { "id": 3374, "url": "https://patchwork.libcamera.org/api/1.1/series/3374/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3374", "date": "2022-08-04T14:12:25", "name": "Add DPF tuning support for RkISP1", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3374/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16970/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16970/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 E97A0C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 4 Aug 2022 14:12:38 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 502156332E;\n\tThu, 4 Aug 2022 16:12:38 +0200 (CEST)", "from mail-wr1-x431.google.com (mail-wr1-x431.google.com\n\t[IPv6:2a00:1450:4864:20::431])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 91EBB63311\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Aug 2022 16:12:36 +0200 (CEST)", "by mail-wr1-x431.google.com with SMTP id p10so21214863wru.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 04 Aug 2022 07:12:36 -0700 (PDT)", "from BL087.. ([2a01:e34:eea9:e630:d073:c231:2c43:c9cf])\n\tby smtp.gmail.com with ESMTPSA id\n\ti5-20020a05600c2d8500b003a325bd8517sm1616948wmg.5.2022.08.04.07.12.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 04 Aug 2022 07:12:35 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659622358;\n\tbh=wH7rzW/+BaraxMFQKRklQha3CW/AjxAjszhiAJZf6BU=;\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=oLUEWID4DjyES1lWaWiL9sgBfHDyQXxUJbuY+JAQ0eYgdBQoKpiM/VrAD3M8tMOnL\n\tMYNq3Zb6+flb0Y2lcHhv9uuyaeX1nXcOkitlTreD83Hy+CMgzX6rCi7APhj4zNmT2N\n\tn0JjCqgxgbdx7tbMzvAVzY6845rhDxSFJaxWFj0vf1ANE+ozYNl/1sKGD8A5l6/dT2\n\tgeLm6TVoO7NxDbmnNPN55QB39NLfcmlqq4cV66dqnvLVNq4Tl4Fhv2dlo5lfuTN+82\n\tHKeqBxwMPgl+8EkBnRX2jUw4e6hnIk3C1ahhYpYp70CRJqDIuDMd//bSpvCKb9pcyD\n\tKiaSfQ3Tcmqew==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20210112.gappssmtp.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=LsRyEh2w4YzccXRhjaKZLslt8FZlM+HdwBZkHR+63HY=;\n\tb=IwVVk9UsJfGXg9TV1Ja9Sn96ZZskmW6B59FEr+20LyxqHMbQmDzsWUmafEMByIhFsg\n\tTYfC82dpP0xsroIGwdm7haAdETyVOI9t5vyj1dzTjFpBdUqDa+ttDRbPhdsqLTm2g2Q0\n\tNb4mOrPNx7BXrin9CwUTLfuYt9Ef6Q3oK7pV1OeV1g9dOEhZqWd/7Wj9wNB5vRj8jtyF\n\tFKIHsfs1cusrS6w90PZVleQMPJ+LdFdcvm5BarIWvXst9twFo1Zwo8YlVhS6NJzC5xeb\n\t3niCZbrDe2mmUzTEvrKirDBJKfhrnqa69clI9OEj3GsplXViFn7vgMuXN18wKa/Lib9N\n\tFVBw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20210112.gappssmtp.com\n\theader.i=@baylibre-com.20210112.gappssmtp.com header.b=\"IwVVk9Us\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=LsRyEh2w4YzccXRhjaKZLslt8FZlM+HdwBZkHR+63HY=;\n\tb=4ePAI6Ch0fxKYpnipvPC03EE/BsmFlGvCo4Hh8SarjhVVIAbzMQOXnwE4L/L+swVN0\n\tHdo2RhZlSR3ds0FGf1oRmsYp3xQ5k6zkg2vtBEbfBWp7O/Lga0vUYopjR1yCNQR20H2l\n\tZOc6FtiY1ss8bTwNvFI8o1j0DliuX8Aa4WXRldDCsqOaVJk3cy+H9MgEPBhB4cxmWb4+\n\tEC8v0SRsSJTBoZEpLUbArMDBwwXmX15opq2bCiiRhXba0KgzKuurM2FCVNIuFas54Rn0\n\tqgZBEi75t+u5yWToxUHRaGvHVGVdLSulfHekpSsmAkJRQdRWj2330m2OGqpyhj7K2huD\n\tswnw==", "X-Gm-Message-State": "ACgBeo0geC6CjhZc+xyfWMJkd5Qy21s8v1g3cLUPFY6SN2xZIK+VF8h+\n\tEu7PnYSKYhKGURWOGn7QkiH77ARYCgiw8j1s", "X-Google-Smtp-Source": "AA6agR6Gh5zYc1EooS24X68XxRXucusrNlPJi2C8tW053yp/VpHoxK7uEVDOFijYkrPBoXAgD5xM0A==", "X-Received": "by 2002:a5d:430d:0:b0:210:2ce0:e2a9 with SMTP id\n\th13-20020a5d430d000000b002102ce0e2a9mr1576171wrq.627.1659622355684; \n\tThu, 04 Aug 2022 07:12:35 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 4 Aug 2022 16:12:28 +0200", "Message-Id": "<20220804141228.417211-4-fsylvestre@baylibre.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220804141228.417211-1-fsylvestre@baylibre.com>", "References": "<20220804141228.417211-1-fsylvestre@baylibre.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 3/3] ipa: rkisp1: Add support of De-noise\n\tPre-Filter control", "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": "Florian Sylvestre via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Florian Sylvestre <fsylvestre@baylibre.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The De-noise pre-filter algorithm is a bilateral filter which combines a range\nfilter and a domain filter. The De-noise pre-filter is applied before\ndemosaicing.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n---\n src/ipa/rkisp1/algorithms/dpf.cpp | 279 ++++++++++++++++++++++++++\n src/ipa/rkisp1/algorithms/dpf.h | 36 ++++\n src/ipa/rkisp1/algorithms/meson.build | 1 +\n src/ipa/rkisp1/data/ov5640.yaml | 11 +\n src/ipa/rkisp1/ipa_context.cpp | 11 +\n src/ipa/rkisp1/ipa_context.h | 5 +\n 6 files changed, 343 insertions(+)\n create mode 100644 src/ipa/rkisp1/algorithms/dpf.cpp\n create mode 100644 src/ipa/rkisp1/algorithms/dpf.h", "diff": "diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp\nnew file mode 100644\nindex 00000000..d99bb728\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/dpf.cpp\n@@ -0,0 +1,279 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021-2022, Ideas On Board\n+ *\n+ * dpf.cpp - RkISP1 De-noise Pre-Filter control\n+ */\n+\n+#include \"dpf.h\"\n+\n+#include <cmath>\n+\n+#include <libcamera/base/log.h>\n+\n+#include <libcamera/control_ids.h>\n+#include \"linux/rkisp1-config.h\"\n+\n+/**\n+ * \\file dpf.h\n+ */\n+\n+namespace libcamera {\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+/**\n+ * \\class Dpf\n+ * \\brief RkISP1 De-noise Pre-Filter control\n+ *\n+ * The De-noise pre-filter algorithm is a bilateral filter which combines a\n+ * range filter and a domain filter. The De-noise pre-filter is applied before\n+ * demosaicing.\n+ */\n+\n+LOG_DEFINE_CATEGORY(RkISP1Dpf)\n+\n+Dpf::Dpf()\n+\t: initialized_(false), config_({}), strength_config_({})\n+{\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::init\n+ */\n+int Dpf::init([[maybe_unused]] IPAContext &context,\n+\t const YamlObject &tuningData)\n+{\n+\tstd::vector<double> values;\n+\n+\t/*\n+\t * The domain kernel is configured with a 9x9 kernel for the green\n+\t * pixels, and a 13x9 or 9x9 kernel for red and blue pixels.\n+\t */\n+\tconst YamlObject &dFObject = tuningData[\"DomainFilter\"];\n+\tif (!dFObject.isDictionary()) {\n+\t\tLOG(RkISP1Dpf, Error)\n+\t\t\t<< \"Issue while parsing 'DomainFilter' in tuning \"\n+\t\t\t<< \"file: entry must be a dictionary\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/*\n+\t * For the green component, we have the 9x9 kernel specified\n+\t * as 6 coefficients:\n+\t * Y\n+\t * ^\n+\t * 4 | 6 5 4 5 6\n+\t * 3 | 5 3 3 5\n+\t * 2 | 5 3 2 3 5\n+\t * 1 | 3 1 1 3\n+\t * 0 - 4 2 0 2 4\n+\t * -1 | 3 1 1 3\n+\t * -2 | 5 3 2 3 5\n+\t * -3 | 5 3 3 5\n+\t * -4 | 6 5 4 5 6\n+\t * +---------|--------> X\n+\t * -4....-1 0 1 2 3 4\n+\t */\n+\tvalues = dFObject[\"g\"].getList<double>().value_or(utils::defopt);\n+\tif (values.size() != RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS) {\n+\t\tLOG(RkISP1Dpf, Error)\n+\t\t\t<< \"Invalid 'DomainFilter:g': expected \"\n+\t\t\t<< RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS\n+\t\t\t<< \" elements, got \" << values.size();\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (unsigned int i = 0; i < values.size(); ++i) {\n+\t\tconfig_.g_flt.spatial_coeff[i] = std::round(values[i] * 16);\n+\t}\n+\n+\tconfig_.g_flt.gr_enable = true;\n+\tconfig_.g_flt.gb_enable = true;\n+\n+\t/*\n+\t * For the red and blue components, we have the 13x9 kernel specified\n+\t * as 6 coefficients:\n+\t *\n+\t * Y\n+\t * ^\n+\t * 4 | 6 5 4 3 4 5 6\n+\t * |\n+\t * 2 | 5 4 2 1 2 4 5\n+\t * |\n+\t * 0 - 5 3 1 0 1 3 5\n+\t * |\n+\t * -2 | 5 4 2 1 2 4 5\n+\t * |\n+\t * -4 | 6 5 4 3 4 5 6\n+\t * +-------------|------------> X\n+\t * -6 -4 -2 0 2 4 6\n+\t *\n+\t * For a 9x9 kernel, columns -6 and -6 are dropped, so coefficient\n+\t * number 6 is not used.\n+\t */\n+\tvalues = dFObject[\"rb\"].getList<double>().value_or(utils::defopt);\n+\tif (values.size() != RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS &&\n+\t values.size() != RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS - 1) {\n+\t\tLOG(RkISP1Dpf, Error)\n+\t\t\t<< \"Invalid 'DomainFilter:rb': expected \"\n+\t\t\t<< RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS - 1\n+\t\t\t<< \" or \" << RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS\n+\t\t\t<< \" elements, got \" << values.size();\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tconfig_.rb_flt.fltsize = values.size() == RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS\n+\t\t\t ? RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9\n+\t\t\t : RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9;\n+\n+\tfor (unsigned int i = 0; i < values.size(); ++i) {\n+\t\tconfig_.rb_flt.spatial_coeff[i] = std::round(values[i] * 16);\n+\t}\n+\n+\tconfig_.rb_flt.r_enable = true;\n+\tconfig_.rb_flt.b_enable = true;\n+\n+\t/*\n+\t * The range kernel is configured with a noise level lookup table (NLL)\n+\t * which stores a piecewise linear function that characterizes the\n+\t * sensor noise profile as a noise level function curve (NLF).\n+\t */\n+\tconst YamlObject &rFObject = tuningData[\"RangeFilter\"];\n+\tif (!rFObject.isDictionary()) {\n+\t\tLOG(RkISP1Dpf, Error)\n+\t\t\t<< \"Issue while parsing 'RangeFilter' in tuning \"\n+\t\t\t<< \"file: entry must be a dictionary\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tvalues = rFObject[\"coeff\"].getList<double>().value_or(utils::defopt);\n+\tif (values.size() != RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS) {\n+\t\tLOG(RkISP1Dpf, Error)\n+\t\t\t<< \"Invalid 'RangeFilter:coeff': expected \"\n+\t\t\t<< RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS\n+\t\t\t<< \" elements, got \" << values.size();\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (unsigned int i = 0; i < values.size(); ++i) {\n+\t\tconfig_.nll.coeff[i] = std::round(values[i] * 1024);\n+\t}\n+\n+\tstd::string scaleMode = rFObject[\"scale-mode\"].get<std::string>(\"\");\n+\tif (scaleMode != \"linear\" && scaleMode != \"logarithmic\") {\n+\t\tLOG(RkISP1Dpf, Error)\n+\t\t\t<< \"Invalid 'RangeFilter:scale-mode': expected \"\n+\t\t\t<< \"'linear' or 'logarithmic' value, got \"\n+\t\t\t<< scaleMode;\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tconfig_.nll.scale_mode = scaleMode == \"linear\"\n+\t\t\t ? RKISP1_CIF_ISP_NLL_SCALE_LINEAR\n+\t\t\t : RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC;\n+\n+\tconst YamlObject &fSObject = tuningData[\"FilterStrength\"];\n+\tif (!fSObject.isDictionary()) {\n+\t\tLOG(RkISP1Dpf, Error)\n+\t\t\t<< \"Issue while parsing 'FilterStrength' in tuning \"\n+\t\t\t<< \"file: entry must be a dictionary\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tstrength_config_.r = fSObject[\"r\"].get<uint16_t>(64);\n+\tstrength_config_.g = fSObject[\"g\"].get<uint16_t>(64);\n+\tstrength_config_.b = fSObject[\"b\"].get<uint16_t>(64);\n+\n+\tinitialized_ = true;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::queueRequest\n+ */\n+void Dpf::queueRequest(IPAContext &context,\n+\t\t [[maybe_unused]] const uint32_t frame,\n+\t\t const ControlList &controls)\n+{\n+\tauto &dpf = context.frameContext.dpf;\n+\n+\tconst auto &denoise = controls.get(controls::draft::NoiseReductionMode);\n+\tif (denoise) {\n+\t\tLOG(RkISP1Dpf, Debug) << \"Set denoise to \" << *denoise;\n+\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\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\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}\n+\t}\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n+void Dpf::prepare(IPAContext &context, rkisp1_params_cfg *params)\n+{\n+\tauto &dpf = context.frameContext.dpf;\n+\tauto &awb = context.configuration.awb;\n+\tauto &lsc = context.configuration.lsc;\n+\tauto &dpf_config = params->others.dpf_config;\n+\tauto &dpf_strength_config = params->others.dpf_strength_config;\n+\n+\tif ((context.frameContext.frameCount > 0) && (!dpf.updateParams))\n+\t\treturn;\n+\n+\tif (!initialized_)\n+\t\treturn;\n+\n+\t/*\n+\t * We must copy the static configuration each time we modify a\n+\t * parameter in the config because the strucure is zeroed between each\n+\t * call.\n+\t */\n+\tdpf_config = config_;\n+\tdpf_strength_config = strength_config_;\n+\n+\tif (dpf.updateParams) {\n+\t\tif (!dpf.denoise || (!awb.enabled && !lsc.enabled)) {\n+\t\t\tdpf_config.gain.mode =\n+\t\t\t\tRKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED;\n+\t\t} else if (awb.enabled && lsc.enabled) {\n+\t\t\tdpf_config.gain.mode =\n+\t\t\t\tRKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS;\n+\t\t} else if (awb.enabled) {\n+\t\t\tdpf_config.gain.mode =\n+\t\t\t\tRKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS;\n+\t\t} else { /* lsc.enabled only */\n+\t\t\tdpf_config.gain.mode =\n+\t\t\t\tRKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS;\n+\t\t}\n+\t}\n+\n+\tdpf.updateParams = false;\n+\n+\tuint32_t flags = RKISP1_CIF_ISP_MODULE_DPF |\n+\t\t\t RKISP1_CIF_ISP_MODULE_DPF_STRENGTH;\n+\tparams->module_en_update |= flags;\n+\tparams->module_ens |= flags;\n+\tparams->module_cfg_update |= flags;\n+}\n+\n+REGISTER_IPA_ALGORITHM(Dpf, \"Dpf\")\n+\n+} /* namespace ipa::rkisp1::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h\nnew file mode 100644\nindex 00000000..c8b8419a\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/dpf.h\n@@ -0,0 +1,36 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021-2022, Ideas On Board\n+ *\n+ * dpf.h - RkISP1 De-noise Pre-Filter control\n+ */\n+\n+#pragma once\n+\n+#include <sys/types.h>\n+\n+#include \"algorithm.h\"\n+\n+namespace libcamera {\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+class Dpf : public Algorithm\n+{\n+public:\n+\tDpf();\n+\t~Dpf() = default;\n+\n+\tint init(IPAContext &context, const YamlObject &tuningData) override;\n+\tvoid queueRequest(IPAContext &context, const uint32_t frame,\n+\t\t\t const ControlList &controls) override;\n+\tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n+\n+private:\n+\tbool initialized_;\n+\tstruct rkisp1_cif_isp_dpf_config config_;\n+\tstruct rkisp1_cif_isp_dpf_strength_config strength_config_;\n+};\n+\n+} /* namespace ipa::rkisp1::algorithms */\n+} /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build\nindex e48974b4..e1492dd5 100644\n--- a/src/ipa/rkisp1/algorithms/meson.build\n+++ b/src/ipa/rkisp1/algorithms/meson.build\n@@ -5,6 +5,7 @@ rkisp1_ipa_algorithms = files([\n 'awb.cpp',\n 'blc.cpp',\n 'cproc.cpp',\n+ 'dpf.cpp',\n 'dpcc.cpp',\n 'filter.cpp',\n 'gsl.cpp',\ndiff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\nindex 93d7d1e7..69c6ad97 100644\n--- a/src/ipa/rkisp1/data/ov5640.yaml\n+++ b/src/ipa/rkisp1/data/ov5640.yaml\n@@ -11,6 +11,17 @@ algorithms:\n Gb: 256\n B: 256\n - ColorProcessing:\n+ - Dpf:\n+ DomainFilter:\n+ g: [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]\n+ rb: [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]\n+ RangeFilter:\n+ coeff: [ 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999 ]\n+ scale-mode: \"linear\"\n+ FilterStrength:\n+ r: 64\n+ g: 64\n+ b: 64\n - GammaSensorLinearization:\n x-intervals: [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]\n y:\ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex c90bf992..3b92e95e 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -165,6 +165,17 @@ namespace libcamera::ipa::rkisp1 {\n * \\brief Indicates if ISP parameters need to be updated\n */\n \n+/**\n+ * \\var IPAFrameContext::dpf\n+ * \\brief Context for the De-noise Pre-Filter algorithm\n+ *\n+ * \\var IPAFrameContext::dpf.denoise\n+ * \\brief Indicates if de-noise is activated\n+ *\n+ * \\var IPAFrameContext::dpf.updateParams\n+ * \\brief Indicates if ISP parameters need to be updated\n+ */\n+\n /**\n * \\var IPAFrameContext::filter\n * \\brief Context for the Filter algorithm\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 0cd6aadb..3a743ac3 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -69,6 +69,11 @@ struct IPAFrameContext {\n \t\tbool updateParams;\n \t} cproc;\n \n+\tstruct {\n+\t\tbool denoise;\n+\t\tbool updateParams;\n+\t} dpf;\n+\n \tstruct {\n \t\tuint8_t denoise;\n \t\tuint8_t sharpness;\n", "prefixes": [ "libcamera-devel", "3/3" ] }