{"id":16329,"url":"https://patchwork.libcamera.org/api/1.1/patches/16329/?format=json","web_url":"https://patchwork.libcamera.org/patch/16329/","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":"<20220622151918.451635-6-fsylvestre@baylibre.com>","date":"2022-06-22T15:19:18","name":"[libcamera-devel,5/5] ipa: rkisp1: Add support of Defect Pixel Cluster Correction control","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"b9a6ba89f599d8146288449f943d5b9b892b46a0","submitter":{"id":123,"url":"https://patchwork.libcamera.org/api/1.1/people/123/?format=json","name":"Florian Sylvestre","email":"fsylvestre@baylibre.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16329/mbox/","series":[{"id":3208,"url":"https://patchwork.libcamera.org/api/1.1/series/3208/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3208","date":"2022-06-22T15:19:13","name":"Add GSL, LSC and DPCC tuning support for rkisp1","version":1,"mbox":"https://patchwork.libcamera.org/series/3208/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16329/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16329/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 14D6CBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jun 2022 15:19:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 90CBB65643;\n\tWed, 22 Jun 2022 17:19:32 +0200 (CEST)","from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 69CA465635\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jun 2022 17:19:26 +0200 (CEST)","by mail-wm1-x32a.google.com with SMTP id e5so9451772wma.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jun 2022 08:19:26 -0700 (PDT)","from BL087.. ([2a01:e34:eea9:e630:4175:47f:ec:c265])\n\tby smtp.gmail.com with ESMTPSA id\n\tbi11-20020a05600c3d8b00b0039c362311d2sm1745388wmb.9.2022.06.22.08.19.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 22 Jun 2022 08:19:25 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655911172;\n\tbh=oKrAJXDSGX9TwezqpW6j9CcYhJJXAGFLa7L0WV21B48=;\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=pdw+VJN/x+weA9FyOZu/8YMJQAUQC3cr7fkKeOyqxZyct0U2mgT3kqphmhs509Br2\n\tuvljPNTXsQLa52byppoXMYThyYfx2r/zshWefNXxiIKh9djQBybjQEidtNmLZUrwxX\n\tV6uyNCwLgAQ2WSAKL7I4EGirLGlyo03pt6+Cm9fN0PciUgJ9oy4Vf4Zt1/O1Ajnohr\n\t6/WtFKtrHkKJZbdTXS+IjNbn5xTOsqTAK450Ix9MfW7zs8AfVB//pplsbrRuEO1f20\n\tcqvQRgdJtUiV1380Vpk/BtzqebeD4AKA+wWqHLIWbL6pemVhBFoFr50o32DTshMDpW\n\t/Qf++TLdJ2dRw==","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=K3mocUXbefz47SFp+9TlUYh33KB+Qe1ha2RZFxPqELU=;\n\tb=zDDFQcRHEslTsrchgAONrbkqTomVEN3CzV0Dloc+BPu+JZyHJ9zeBcJLHJFRjJk/Kr\n\ti+VCxIEqTGoUV0AisZHzfWaDO/cY5eCZyhvkt+udYfIcAgONKY2jfj4iaytAP5KDSmvZ\n\tBVqgItt84oLQtTf3/clivgHrFsqfat4nDu1bADXS2uFCCCj8uRf4Y+jAf0XS8YBwLIij\n\tsTL2mW/f3xio1Sydb+CsQMI6m23qeJPv77hgI/2qQR8mw52UvhBp+tK4nDOIHZYgwb0Z\n\trskCiIQl2I2ReVHDA5+EcGbZ3ESMlgv0PXJcwxnZttdzEvwSaV/cXqU36Wz1AMe2+77P\n\txqdw=="],"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=\"zDDFQcRH\"; \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=K3mocUXbefz47SFp+9TlUYh33KB+Qe1ha2RZFxPqELU=;\n\tb=3J6DcQJ3PnA+4LghLfcbpBiXkqb1T/PfrVkb/JaLC2yMboIA2HDDnfhidgVCnY3KP/\n\t4kFUBfDrwIWJxQcLrzlm/HIu6izdGeWM0VJ+0P3uYLZ8U099x2KwhoW6FE0eVWYzd8cg\n\thwC7RovQT+64xd+OFCYkRkjaqMg63elC2yjed6JGX1MlyrWK2ypAPgwQrOkGXTM/5eYG\n\tyq3eCnPG0J1rS9z+0UMODAzID8XGB9y/n5ldcn3bNQwLBKNF/bFUIICBI5b3WF96Mkj7\n\tZYEfSwvPVsG36t7wgNrIlH+wijeXFTX9zkwlTAB9hWgCPBUgnvgAGEm7LRtQfQlgQYdI\n\t5uXQ==","X-Gm-Message-State":"AJIora/fDEWDJ0QcZYJ2Ll03ys6xvMohSuSAWnXGwYfUyetJsy2H3WjL\n\tu0IWDzg1dvBlBKHxALojZjyfgk+hVY8LuQ==","X-Google-Smtp-Source":"AGRyM1uW5bAHkYbcwqFnUl+k8lZV7GStjoeiQ5VZzriIMP+Xv0YcmYBG1nSs7JiJaajUXYLASzc/Iw==","X-Received":"by 2002:a7b:cb58:0:b0:39e:f121:f7d4 with SMTP id\n\tv24-20020a7bcb58000000b0039ef121f7d4mr4535360wmj.174.1655911165693; \n\tWed, 22 Jun 2022 08:19:25 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 22 Jun 2022 17:19:18 +0200","Message-Id":"<20220622151918.451635-6-fsylvestre@baylibre.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220622151918.451635-1-fsylvestre@baylibre.com>","References":"<20220622151918.451635-1-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 5/5] ipa: rkisp1: Add support of Defect\n\tPixel Cluster Correction 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 Defect Pixel Cluster Correction algorithm is responsible to minimize\nthe impact of defective pixels. The on-the-fly method is actually used,\nbased on coefficient provided by the tuning file.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n---\n src/ipa/rkisp1/algorithms/dpcc.cpp    | 273 ++++++++++++++++++++++++++\n src/ipa/rkisp1/algorithms/dpcc.h      |  35 ++++\n src/ipa/rkisp1/algorithms/meson.build |   1 +\n src/ipa/rkisp1/data/ov5640.yaml       |  60 ++++++\n src/ipa/rkisp1/rkisp1.cpp             |   1 +\n 5 files changed, 370 insertions(+)\n create mode 100644 src/ipa/rkisp1/algorithms/dpcc.cpp\n create mode 100644 src/ipa/rkisp1/algorithms/dpcc.h","diff":"diff --git a/src/ipa/rkisp1/algorithms/dpcc.cpp b/src/ipa/rkisp1/algorithms/dpcc.cpp\nnew file mode 100644\nindex 00000000..0c78ba9d\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/dpcc.cpp\n@@ -0,0 +1,273 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021-2022, Ideas On Board\n+ *\n+ * lsc.cpp - RkISP1 Defect Pixel Cluster Correction control\n+ */\n+\n+#include \"dpcc.h\"\n+\n+#include <libcamera/base/log.h>\n+\n+#include \"libcamera/internal/yaml_parser.h\"\n+#include \"linux/rkisp1-config.h\"\n+\n+/**\n+ * \\file dpcc.h\n+ */\n+\n+namespace libcamera {\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+/**\n+ * \\class DefectPixelClusterCorrection\n+ * \\brief RkISP1 Defect Pixel Cluster Correction control\n+ *\n+ * Depending of the sensor quality, some pixels can be defective and then\n+ * appear significantly brighter or darker than the other pixels.\n+ *\n+ * The Defect Pixel Cluster Correction algorithms is responsible to minimize\n+ * the impact of the pixels.\n+ * This can be done with algorithms applied at run time (on-the-fly method) or\n+ * with a table of defective pixels. Only first method is supported for the\n+ * moment.\n+ */\n+\n+LOG_DEFINE_CATEGORY(RkISP1Dpcc)\n+\n+DefectPixelClusterCorrection::DefectPixelClusterCorrection()\n+\t: tuningParameters_(false)\n+{\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::init\n+ */\n+int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,\n+\t\t\t\t       const YamlObject &tuningData)\n+{\n+\tbool fixedSet = tuningData[\"fixed-set\"].get<bool>(true);\n+\ttuning_.set_use =\n+\t\tfixedSet ? RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET : 0;\n+\n+\t/* Get all defined sets to apply (up to 3). */\n+\tconst YamlObject &setsObject = tuningData[\"sets\"];\n+\tif (!setsObject.isList()) {\n+\t\tLOG(RkISP1Dpcc, Error)\n+\t\t\t<< \"'sets' list parameternot found in tuning file\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (setsObject.size() > RKISP1_CIF_ISP_DPCC_METHODS_MAX) {\n+\t\tLOG(RkISP1Dpcc, Error)\n+\t\t\t<< \"'sets' size in tuning file (\" << setsObject.size()\n+\t\t\t<< \") exceed HW maximum capacity(3)\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\ttuning_.ro_limits = 0;\n+\ttuning_.rnd_offs = 0;\n+\n+\tfor (std::size_t i = 0; i < setsObject.size(); ++i) {\n+\t\tuint16_t value;\n+\n+\t\t/* Enable set if described in Yaml tuning file. */\n+\t\ttuning_.set_use |= 0x1 << i;\n+\n+\t\t/* Disable all methods by default. */\n+\t\ttuning_.methods[i].method = 0;\n+\n+\t\t/* PG Method */\n+\t\tconst YamlObject &pgObject = setsObject[i][\"pg-factor\"];\n+\t\ttuning_.methods[i].pg_fac = 0;\n+\n+\t\tif (pgObject.contains(\"green\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_PG_GREEN_ENABLE;\n+\n+\t\t\tvalue = pgObject[\"green\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].pg_fac |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_PG_FAC_G(value);\n+\t\t}\n+\n+\t\tif (pgObject.contains(\"red-blue\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_PG_RED_BLUE_ENABLE;\n+\n+\t\t\tvalue = pgObject[\"red-blue\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].pg_fac |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_PG_FAC_RB(value);\n+\t\t}\n+\n+\t\t/* RO Method */\n+\t\tconst YamlObject &roObject = setsObject[i][\"ro-limits\"];\n+\n+\t\tif (roObject.contains(\"green\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RO_GREEN_ENABLE;\n+\n+\t\t\tvalue = roObject[\"green\"].get<uint16_t>(0);\n+\t\t\ttuning_.ro_limits |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_RO_LIMITS_n_G(i, value);\n+\t\t}\n+\n+\t\tif (roObject.contains(\"red-blue\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RO_RED_BLUE_ENABLE;\n+\n+\t\t\tvalue = roObject[\"red-blue\"].get<uint16_t>(0);\n+\t\t\ttuning_.ro_limits |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_RO_LIMITS_n_RB(i, value);\n+\t\t}\n+\n+\t\t/* RG Method */\n+\t\tconst YamlObject &rgObject = setsObject[i][\"rg-factor\"];\n+\t\ttuning_.methods[i].rg_fac = 0;\n+\n+\t\tif (rgObject.contains(\"green\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RG_GREEN_ENABLE;\n+\n+\t\t\tvalue = rgObject[\"green\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].rg_fac |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_RG_FAC_G(value);\n+\t\t}\n+\n+\t\tif (rgObject.contains(\"red-blue\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RG_RED_BLUE_ENABLE;\n+\n+\t\t\tvalue = rgObject[\"red-blue\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].rg_fac |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_RG_FAC_RB(value);\n+\t\t}\n+\n+\t\t/* RND Method */\n+\t\tconst YamlObject &rndOffsetsObject = setsObject[i][\"rnd-offsets\"];\n+\n+\t\tif (rndOffsetsObject.contains(\"green\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE;\n+\n+\t\t\tvalue = rndOffsetsObject[\"green\"].get<uint16_t>(0);\n+\t\t\ttuning_.rnd_offs |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_RND_OFFS_n_G(i, value);\n+\t\t}\n+\n+\t\tif (rndOffsetsObject.contains(\"red-blue\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE;\n+\n+\t\t\tvalue = rndOffsetsObject[\"red-blue\"].get<uint16_t>(0);\n+\t\t\ttuning_.rnd_offs |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(i, value);\n+\t\t}\n+\n+\t\tconst YamlObject &rndThresholdObject = setsObject[i][\"rnd-threshold\"];\n+\t\ttuning_.methods[i].rnd_thresh = 0;\n+\n+\t\tif (rndThresholdObject.contains(\"green\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE;\n+\n+\t\t\tvalue = rndThresholdObject[\"green\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].rnd_thresh |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_RND_THRESH_G(value);\n+\t\t}\n+\n+\t\tif (rndThresholdObject.contains(\"red-blue\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE;\n+\n+\t\t\tvalue = rndThresholdObject[\"red-blue\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].rnd_thresh |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_RND_THRESH_RB(value);\n+\t\t}\n+\n+\t\t/* LC Method */\n+\t\tconst YamlObject &lcThresholdObject = setsObject[i][\"line-threshold\"];\n+\t\ttuning_.methods[i].line_thresh = 0;\n+\n+\t\tif (lcThresholdObject.contains(\"green\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE;\n+\n+\t\t\tvalue = lcThresholdObject[\"green\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].line_thresh |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_LINE_THRESH_G(value);\n+\t\t}\n+\n+\t\tif (lcThresholdObject.contains(\"red-blue\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE;\n+\n+\t\t\tvalue = lcThresholdObject[\"red-blue\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].line_thresh |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(value);\n+\t\t}\n+\n+\t\tconst YamlObject &lcTMadFactorObject = setsObject[i][\"line-mad-factor\"];\n+\t\ttuning_.methods[i].line_mad_fac = 0;\n+\n+\t\tif (lcTMadFactorObject.contains(\"green\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE;\n+\n+\t\t\tvalue = lcTMadFactorObject[\"green\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].line_mad_fac |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_G(value);\n+\t\t}\n+\n+\t\tif (lcTMadFactorObject.contains(\"red-blue\")) {\n+\t\t\ttuning_.methods[i].method |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE;\n+\n+\t\t\tvalue = lcTMadFactorObject[\"red-blue\"].get<uint16_t>(0);\n+\t\t\ttuning_.methods[i].line_mad_fac |=\n+\t\t\t\tRKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_RB(value);\n+\t\t}\n+\t}\n+\n+\ttuningParameters_ = true;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n+void DefectPixelClusterCorrection::prepare(IPAContext &context,\n+\t\t\t\t\t   rkisp1_params_cfg *params)\n+{\n+\tif (context.frameContext.frameCount > 0)\n+\t\treturn;\n+\n+\tif (!tuningParameters_)\n+\t\treturn;\n+\n+\tparams->others.dpcc_config.mode =\n+\t\tRKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE;\n+\tparams->others.dpcc_config.output_mode =\n+\t\tRKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER |\n+\t\tRKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_RB_CENTER;\n+\tparams->others.dpcc_config.rnd_offs = tuning_.rnd_offs;\n+\tparams->others.dpcc_config.ro_limits = tuning_.ro_limits;\n+\tparams->others.dpcc_config.set_use = tuning_.set_use;\n+\n+\tfor (std::size_t i = 0; i < RKISP1_CIF_ISP_DPCC_METHODS_MAX; ++i) {\n+\t\tmemcpy(&params->others.dpcc_config.methods[i],\n+\t\t       &tuning_.methods[i],\n+\t\t       sizeof(rkisp1_cif_isp_dpcc_methods_config));\n+\t}\n+\n+\tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_DPCC;\n+\tparams->module_ens |= RKISP1_CIF_ISP_MODULE_DPCC;\n+\tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_DPCC;\n+}\n+\n+REGISTER_IPA_ALGORITHM(DefectPixelClusterCorrection)\n+\n+} /* namespace ipa::rkisp1::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/algorithms/dpcc.h b/src/ipa/rkisp1/algorithms/dpcc.h\nnew file mode 100644\nindex 00000000..6c6c6aaa\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/dpcc.h\n@@ -0,0 +1,35 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021-2022, Ideas On Board\n+ *\n+ * dpcc.h - RkISP1 Defect Pixel Cluster Correction  control\n+ */\n+\n+#pragma once\n+\n+#include <linux/rkisp1-config.h>\n+\n+#include \"algorithm.h\"\n+\n+namespace libcamera {\n+\n+struct IPACameraSensorInfo;\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+class DefectPixelClusterCorrection : public Algorithm\n+{\n+public:\n+\tDefectPixelClusterCorrection();\n+\t~DefectPixelClusterCorrection() = default;\n+\n+\tint init(IPAContext &context, const YamlObject &tuningData) override;\n+\tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n+\n+private:\n+\tbool tuningParameters_;\n+\trkisp1_cif_isp_dpcc_config tuning_;\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 64e11dce..87007493 100644\n--- a/src/ipa/rkisp1/algorithms/meson.build\n+++ b/src/ipa/rkisp1/algorithms/meson.build\n@@ -4,6 +4,7 @@ rkisp1_ipa_algorithms = files([\n     'agc.cpp',\n     'awb.cpp',\n     'blc.cpp',\n+    'dpcc.cpp',\n     'gsl.cpp',\n     'lsc.cpp',\n ])\ndiff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\nindex 154ed3b5..51228218 100644\n--- a/src/ipa/rkisp1/data/ov5640.yaml\n+++ b/src/ipa/rkisp1/data/ov5640.yaml\n@@ -97,4 +97,64 @@ algorithms:\n             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n           ]\n+  - DefectPixelClusterCorrection:\n+      fixed-set: false\n+      sets:\n+        # PG, LC, RO, RND, RG\n+        - line-threshold:\n+            green: 8\n+            red-blue: 8\n+          line-mad-factor:\n+            green: 4\n+            red-blue: 4\n+          pg-factor:\n+            green: 8\n+            red-blue: 8\n+          rnd-threshold:\n+            green: 10\n+            red-blue: 10\n+          rg-factor:\n+            green: 32\n+            red-blue: 32\n+          ro-limits:\n+            green: 1\n+            red-blue: 1\n+          rnd-offsets:\n+            green: 2\n+            red-blue: 2\n+        # PG, LC, RO\n+        - line-threshold:\n+            green: 24\n+            red-blue: 32\n+          line-mad-factor:\n+            green: 16\n+            red-blue: 24\n+          pg-factor:\n+            green: 6\n+            red-blue: 8\n+          ro-limits:\n+            green: 2\n+            red-blue: 2\n+        # PG, LC, RO, RND, RG\n+        - line-threshold:\n+            green: 32\n+            red-blue: 32\n+          line-mad-factor:\n+            green: 4\n+            red-blue: 4\n+          pg-factor:\n+            green: 10\n+            red-blue: 10\n+          rnd-threshold:\n+            green: 6\n+            red-blue: 8\n+          rg-factor:\n+            green: 4\n+            red-blue: 4\n+          ro-limits:\n+            green: 1\n+            red-blue: 2\n+          rnd-offsets:\n+            green: 2\n+            red-blue: 2\n ...\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 996edc0a..a32bb9d1 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -31,6 +31,7 @@\n #include \"algorithms/algorithm.h\"\n #include \"algorithms/awb.h\"\n #include \"algorithms/blc.h\"\n+#include \"algorithms/dpcc.h\"\n #include \"algorithms/gsl.h\"\n #include \"algorithms/lsc.h\"\n #include \"libipa/camera_sensor_helper.h\"\n","prefixes":["libcamera-devel","5/5"]}