Show a patch.

GET /api/1.1/patches/19142/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 19142,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19142/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19142/",
    "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": "<20231013074841.16972-19-naush@raspberrypi.com>",
    "date": "2023-10-13T07:48:39",
    "name": "[libcamera-devel,v2,18/20] ipa: rpi: denoise: Support different denoise configurations",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "0ca01119f6e593308926d609892531372ff7a23b",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19142/mbox/",
    "series": [
        {
            "id": 4049,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4049/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4049",
            "date": "2023-10-13T07:48:21",
            "name": "Raspberry Pi: Preliminary PiSP support",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4049/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19142/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19142/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 654D7C32C2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Oct 2023 07:49:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D5AFF6299A;\n\tFri, 13 Oct 2023 09:49:09 +0200 (CEST)",
            "from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 43A086299B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Oct 2023 09:49:00 +0200 (CEST)",
            "by mail-wm1-x330.google.com with SMTP id\n\t5b1f17b1804b1-405524e6769so11287685e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Oct 2023 00:49:00 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tm16-20020a7bca50000000b003fee6e170f9sm1791890wml.45.2023.10.13.00.48.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 13 Oct 2023 00:48:59 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1697183350;\n\tbh=a45WmFNuorh7GWBgUQj37lz3xuS4EXguvzLOZ0lzpJQ=;\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=lkIU19GRIQijDt2hbhgjpWnINY+bNbrM9NiGviP3l+3JWF9wbQ3cKI1o2ABVk4n0D\n\t+I3H08UDrXc5cw/xOTBhxUzLHdvlY3ro9AuUuaI2hfDQRYb5KIGqyJNZ/Ps//sjQzC\n\t/jqwZuwMb1u4fIZT9+nzWZA36qnPnrmK5KnT1mrPD0jeuG62INvyb+hKUtsllXbzyE\n\tQMLdE0UsYznR+CO5ZFu1A/A9jWr4KPMiMcQL1sPR5B/sroJ9vDkh1fRzGRdKxR5cpe\n\tarSMUzHwziCQIDo3hHk4FyaQNUAwRCdEC5tHBMzxQUScarhPmGNMWxx2qqB1KMe2R0\n\t3Zog0wM2tVzAg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1697183339; x=1697788139;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=ZNgXgb+Cnl0XP4aIcikz0avyv8rl0oeOdAohyVFJnWw=;\n\tb=PFnT9zpy3YpxAPqkHWivjPj61mKqVhbuahcKTH2ihRj9fM6gdBjCvL8wJyc0zOEJoB\n\tyva/tcIipXr2M6m8x+Ld9Ied93qVRXy7VlC7v+mzfJq7AyX6kNK01FXg8POHZBAQK/No\n\tT50qErT9mVGXaecruOns5fQ5nUVLrg2eW9RFBHwomHOm9QCQB6iAsMy8XVwIe9wRKtDz\n\tZwBy9/IzhSRvvywmCRVnSi5IUmS0+9oCJqoHdngbA2abDZCbDHt21cor8swgHKEVMf0b\n\tkagAiz88z+nh4dTHEV91zuyEg0E4ZuEJdexZPw8pMieSbzePrh9fsutddZhABCvT6lfw\n\tKmPg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"PFnT9zpy\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1697183339; x=1697788139;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=ZNgXgb+Cnl0XP4aIcikz0avyv8rl0oeOdAohyVFJnWw=;\n\tb=k8gUffokxFaduKxoIhvFLAy/9oMlb55A2KCvJsJEBsWL0Ge79Na24agy7tTWcO3PDw\n\tuexzU6CmGpaMcbZrMkcnAsE+ACOjAoAJRt0YgcHOvgQzmAHEh42X63DaqXcyNC0NBuJN\n\tzpkEulkD8YwYMscPG45SNBJolHmGiNOx03FbUMk4fk22V3unK0wifZPGd9Ic0bB80ksZ\n\t+L6x00hfFxJkTXu0vmEzuLnA7VYf1Djy/Mud49cGD1RUdj9H2KpH4upw2RJ2rkkZa9Gw\n\tv1qKpuzw3R1aKFdjhJoENWpLIWn+yF4hAMB5OxY3n+WNMgU8a9x4LmLiQ3OVcQZDELPp\n\t9u1A==",
        "X-Gm-Message-State": "AOJu0YzRyCePaEzLW1Pmpv59ggUP0vxMJJpr9pHKDjT303LDtWytrPHt\n\t/cSNoh07l8VBVVU28pt4ar6827yTvmDPEJyNHxcF9g==",
        "X-Google-Smtp-Source": "AGHT+IGwNWo953gy74z4vhMlZ2v70DM6FnBG6yJG5+WrIQByv5Dg0jKvf2GqDYkeH1jVVHbtXacDOg==",
        "X-Received": "by 2002:a7b:c4cc:0:b0:402:f91e:df80 with SMTP id\n\tg12-20020a7bc4cc000000b00402f91edf80mr19174916wmk.3.1697183339464; \n\tFri, 13 Oct 2023 00:48:59 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 13 Oct 2023 08:48:39 +0100",
        "Message-Id": "<20231013074841.16972-19-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20231013074841.16972-1-naush@raspberrypi.com>",
        "References": "<20231013074841.16972-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 18/20] ipa: rpi: denoise: Support\n\tdifferent denoise configurations",
        "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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: David Plowman <david.plowman@raspberrypi.com>\n\nSome use cases may require stronger, or different, denosie settings to\nothers. For example, the way frames are accumulated during single\nexposure HDR means that we may want stronger denoise.\n\nThis commit adds such support for different configurations that can be\ndefined in the tuning file.\n\nOlder tuning files, or files where there is only a single\nconfiguration, load only the \"normal\" denoise configuration.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/controller/denoise_algorithm.h |   4 +\n src/ipa/rpi/controller/rpi/denoise.cpp     | 130 ++++++++++++++-------\n src/ipa/rpi/controller/rpi/denoise.h       |  36 +++---\n 3 files changed, 113 insertions(+), 57 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/controller/denoise_algorithm.h b/src/ipa/rpi/controller/denoise_algorithm.h\nindex 52009ba95661..444cbc259889 100644\n--- a/src/ipa/rpi/controller/denoise_algorithm.h\n+++ b/src/ipa/rpi/controller/denoise_algorithm.h\n@@ -6,6 +6,8 @@\n  */\n #pragma once\n \n+#include <string>\n+\n #include \"algorithm.h\"\n \n namespace RPiController {\n@@ -18,6 +20,8 @@ public:\n \tDenoiseAlgorithm(Controller *controller) : Algorithm(controller) {}\n \t/* A Denoise algorithm must provide the following: */\n \tvirtual void setMode(DenoiseMode mode) = 0;\n+\t/* Some platforms may not be able to define this, so supply a default. */\n+\tvirtual void setConfig([[maybe_unused]] std::string const &name) {}\n };\n \n } /* namespace RPiController */\ndiff --git a/src/ipa/rpi/controller/rpi/denoise.cpp b/src/ipa/rpi/controller/rpi/denoise.cpp\nindex 440ee4425534..154ee604ddd0 100644\n--- a/src/ipa/rpi/controller/rpi/denoise.cpp\n+++ b/src/ipa/rpi/controller/rpi/denoise.cpp\n@@ -21,6 +21,45 @@ LOG_DEFINE_CATEGORY(RPiDenoise)\n \n #define NAME \"rpi.denoise\"\n \n+int DenoiseConfig::read(const libcamera::YamlObject &params)\n+{\n+\tsdnEnable = params.contains(\"sdn\");\n+\tif (sdnEnable) {\n+\t\tauto &sdnParams = params[\"sdn\"];\n+\t\tsdnDeviation = sdnParams[\"deviation\"].get<double>(3.2);\n+\t\tsdnStrength = sdnParams[\"strength\"].get<double>(0.25);\n+\t\tsdnDeviation2 = sdnParams[\"deviation2\"].get<double>(sdnDeviation);\n+\t\tsdnDeviationNoTdn = sdnParams[\"deviation_no_tdn\"].get<double>(sdnDeviation);\n+\t\tsdnStrengthNoTdn = sdnParams[\"strength_no_tdn\"].get<double>(sdnStrength);\n+\t\tsdnTdnBackoff = sdnParams[\"backoff\"].get<double>(0.75);\n+\t}\n+\n+\tcdnEnable = params.contains(\"cdn\");\n+\tif (cdnEnable) {\n+\t\tauto &cdnParams = params[\"cdn\"];\n+\t\tcdnDeviation = cdnParams[\"deviation\"].get<double>(120);\n+\t\tcdnStrength = cdnParams[\"strength\"].get<double>(0.2);\n+\t}\n+\n+\ttdnEnable = params.contains(\"tdn\");\n+\tif (tdnEnable) {\n+\t\tauto &tdnParams = params[\"tdn\"];\n+\t\ttdnDeviation = tdnParams[\"deviation\"].get<double>(0.5);\n+\t\ttdnThreshold = tdnParams[\"threshold\"].get<double>(0.75);\n+\t} else if (sdnEnable) {\n+\t\t/*\n+\t\t * If SDN is enabled but TDN isn't, overwrite all the SDN settings\n+\t\t * with the \"no TDN\" versions. This makes it easier to enable or\n+\t\t * disable TDN in the tuning file without editing all the other\n+\t\t * parameters.\n+\t\t */\n+\t\tsdnDeviation = sdnDeviation2 = sdnDeviationNoTdn;\n+\t\tsdnStrength = sdnStrengthNoTdn;\n+\t}\n+\n+\treturn 0;\n+}\n+\n Denoise::Denoise(Controller *controller)\n \t: DenoiseAlgorithm(controller), mode_(DenoiseMode::ColourHighQuality)\n {\n@@ -33,39 +72,26 @@ char const *Denoise::name() const\n \n int Denoise::read(const libcamera::YamlObject &params)\n {\n-\tsdnEnable_ = params.contains(\"sdn\");\n-\tif (sdnEnable_) {\n-\t\tauto &sdnParams = params[\"sdn\"];\n-\t\tsdnDeviation_ = sdnParams[\"deviation\"].get<double>(3.2);\n-\t\tsdnStrength_ = sdnParams[\"strength\"].get<double>(0.25);\n-\t\tsdnDeviation2_ = sdnParams[\"deviation2\"].get<double>(sdnDeviation_);\n-\t\tsdnDeviationNoTdn_ = sdnParams[\"deviation_no_tdn\"].get<double>(sdnDeviation_);\n-\t\tsdnStrengthNoTdn_ = sdnParams[\"strength_no_tdn\"].get<double>(sdnStrength_);\n-\t\tsdnTdnBackoff_ = sdnParams[\"backoff\"].get<double>(0.75);\n+\tif (!params.contains(\"normal\")) {\n+\t\tconfigs_[\"normal\"].read(params);\n+\t\tcurrentConfig_ = &configs_[\"normal\"];\n+\n+\t\treturn 0;\n \t}\n \n-\tcdnEnable_ = params.contains(\"cdn\");\n-\tif (cdnEnable_) {\n-\t\tauto &cdnParams = params[\"cdn\"];\n-\t\tcdnDeviation_ = cdnParams[\"deviation\"].get<double>(120);\n-\t\tcdnStrength_ = cdnParams[\"strength\"].get<double>(0.2);\n+\tfor (const auto &[key, value] : params.asDict()) {\n+\t\tif (configs_[key].read(value)) {\n+\t\t\tLOG(RPiDenoise, Error) << \"Failed to read denoise config \" << key;\n+\t\t\treturn -EINVAL;\n+\t\t}\n \t}\n \n-\ttdnEnable_ = params.contains(\"tdn\");\n-\tif (tdnEnable_) {\n-\t\tauto &tdnParams = params[\"tdn\"];\n-\t\ttdnDeviation_ = tdnParams[\"deviation\"].get<double>(0.5);\n-\t\ttdnThreshold_ = tdnParams[\"threshold\"].get<double>(0.75);\n-\t} else if (sdnEnable_) {\n-\t\t/*\n-\t\t * If SDN is enabled but TDN isn't, overwrite all the SDN settings\n-\t\t * with the \"no TDN\" versions. This makes it easier to enable or\n-\t\t * disable TDN in the tuning file without editing all the other\n-\t\t * parameters.\n-\t\t */\n-\t\tsdnDeviation_ = sdnDeviation2_ = sdnDeviationNoTdn_;\n-\t\tsdnStrength_ = sdnStrengthNoTdn_;\n+\tauto it = configs_.find(\"normal\");\n+\tif (it == configs_.end()) {\n+\t\tLOG(RPiDenoise, Error) << \"No normal denoise settings found\";\n+\t\treturn -EINVAL;\n \t}\n+\tcurrentConfig_ = &it->second;\n \n \treturn 0;\n }\n@@ -78,9 +104,9 @@ void Denoise::switchMode([[maybe_unused]] CameraMode const &cameraMode,\n \t\t\t [[maybe_unused]] Metadata *metadata)\n {\n \t/* A mode switch effectively resets temporal denoise and it has to start over. */\n-\tcurrentSdnDeviation_ = sdnDeviationNoTdn_;\n-\tcurrentSdnStrength_ = sdnStrengthNoTdn_;\n-\tcurrentSdnDeviation2_ = sdnDeviationNoTdn_;\n+\tcurrentSdnDeviation_ = currentConfig_->sdnDeviationNoTdn;\n+\tcurrentSdnStrength_ = currentConfig_->sdnStrengthNoTdn;\n+\tcurrentSdnDeviation2_ = currentConfig_->sdnDeviationNoTdn;\n }\n \n void Denoise::prepare(Metadata *imageMetadata)\n@@ -97,11 +123,11 @@ void Denoise::prepare(Metadata *imageMetadata)\n \tif (mode_ == DenoiseMode::Off)\n \t\treturn;\n \n-\tif (sdnEnable_) {\n+\tif (currentConfig_->sdnEnable) {\n \t\tstruct SdnStatus sdn;\n \t\tsdn.noiseConstant = noiseStatus.noiseConstant * currentSdnDeviation_;\n \t\tsdn.noiseSlope = noiseStatus.noiseSlope * currentSdnDeviation_;\n-\t\tsdn.noiseConstant2 = noiseStatus.noiseConstant * sdnDeviation2_;\n+\t\tsdn.noiseConstant2 = noiseStatus.noiseConstant * currentConfig_->sdnDeviation2;\n \t\tsdn.noiseSlope2 = noiseStatus.noiseSlope * currentSdnDeviation2_;\n \t\tsdn.strength = currentSdnStrength_;\n \t\timageMetadata->set(\"sdn.status\", sdn);\n@@ -113,17 +139,17 @@ void Denoise::prepare(Metadata *imageMetadata)\n \t\t\t<< \" slope2 \" << sdn.noiseSlope2;\n \n \t\t/* For the next frame, we back off the SDN parameters as TDN ramps up. */\n-\t\tdouble f = sdnTdnBackoff_;\n-\t\tcurrentSdnDeviation_ = f * currentSdnDeviation_ + (1 - f) * sdnDeviation_;\n-\t\tcurrentSdnStrength_ = f * currentSdnStrength_ + (1 - f) * sdnStrength_;\n-\t\tcurrentSdnDeviation2_ = f * currentSdnDeviation2_ + (1 - f) * sdnDeviation2_;\n+\t\tdouble f = currentConfig_->sdnTdnBackoff;\n+\t\tcurrentSdnDeviation_ = f * currentSdnDeviation_ + (1 - f) * currentConfig_->sdnDeviation;\n+\t\tcurrentSdnStrength_ = f * currentSdnStrength_ + (1 - f) * currentConfig_->sdnStrength;\n+\t\tcurrentSdnDeviation2_ = f * currentSdnDeviation2_ + (1 - f) * currentConfig_->sdnDeviation2;\n \t}\n \n-\tif (tdnEnable_) {\n+\tif (currentConfig_->tdnEnable) {\n \t\tstruct TdnStatus tdn;\n-\t\ttdn.noiseConstant = noiseStatus.noiseConstant * tdnDeviation_;\n-\t\ttdn.noiseSlope = noiseStatus.noiseSlope * tdnDeviation_;\n-\t\ttdn.threshold = tdnThreshold_;\n+\t\ttdn.noiseConstant = noiseStatus.noiseConstant * currentConfig_->tdnDeviation;\n+\t\ttdn.noiseSlope = noiseStatus.noiseSlope * currentConfig_->tdnDeviation;\n+\t\ttdn.threshold = currentConfig_->tdnThreshold;\n \t\timageMetadata->set(\"tdn.status\", tdn);\n \t\tLOG(RPiDenoise, Debug)\n \t\t\t<< \"programmed tdn threshold \" << tdn.threshold\n@@ -131,10 +157,10 @@ void Denoise::prepare(Metadata *imageMetadata)\n \t\t\t<< \" slope \" << tdn.noiseSlope;\n \t}\n \n-\tif (cdnEnable_ && mode_ != DenoiseMode::ColourOff) {\n+\tif (currentConfig_->cdnEnable && mode_ != DenoiseMode::ColourOff) {\n \t\tstruct CdnStatus cdn;\n-\t\tcdn.threshold = cdnDeviation_ * noiseStatus.noiseSlope + noiseStatus.noiseConstant;\n-\t\tcdn.strength = cdnStrength_;\n+\t\tcdn.threshold = currentConfig_->cdnDeviation * noiseStatus.noiseSlope + noiseStatus.noiseConstant;\n+\t\tcdn.strength = currentConfig_->cdnStrength;\n \t\timageMetadata->set(\"cdn.status\", cdn);\n \t\tLOG(RPiDenoise, Debug)\n \t\t\t<< \"programmed cdn threshold \" << cdn.threshold\n@@ -148,6 +174,22 @@ void Denoise::setMode(DenoiseMode mode)\n \tmode_ = mode;\n }\n \n+void Denoise::setConfig(std::string const &name)\n+{\n+\tauto it = configs_.find(name);\n+\tif (it == configs_.end()) {\n+\t\t/*\n+\t\t * Some platforms may have no need for different denoise settings, so we only issue\n+\t\t * a warning if there clearly are several configurations.\n+\t\t */\n+\t\tif (configs_.size() > 1)\n+\t\t\tLOG(RPiDenoise, Warning) << \"No denoise config found for \" << name;\n+\t\telse\n+\t\t\tLOG(RPiDenoise, Debug) << \"No denoise config found for \" << name;\n+\t} else\n+\t\tcurrentConfig_ = &it->second;\n+}\n+\n // Register algorithm with the system.\n static Algorithm *Create(Controller *controller)\n {\ndiff --git a/src/ipa/rpi/controller/rpi/denoise.h b/src/ipa/rpi/controller/rpi/denoise.h\nindex 88b37663e569..92ff4f93edf2 100644\n--- a/src/ipa/rpi/controller/rpi/denoise.h\n+++ b/src/ipa/rpi/controller/rpi/denoise.h\n@@ -6,6 +6,9 @@\n  */\n #pragma once\n \n+#include <map>\n+#include <string>\n+\n #include \"algorithm.h\"\n #include \"denoise_algorithm.h\"\n \n@@ -13,6 +16,23 @@ namespace RPiController {\n \n // Algorithm to calculate correct denoise settings.\n \n+struct DenoiseConfig {\n+\tdouble sdnDeviation;\n+\tdouble sdnStrength;\n+\tdouble sdnDeviation2;\n+\tdouble sdnDeviationNoTdn;\n+\tdouble sdnStrengthNoTdn;\n+\tdouble sdnTdnBackoff;\n+\tdouble cdnDeviation;\n+\tdouble cdnStrength;\n+\tdouble tdnDeviation;\n+\tdouble tdnThreshold;\n+\tbool tdnEnable;\n+\tbool sdnEnable;\n+\tbool cdnEnable;\n+\tint read(const libcamera::YamlObject &params);\n+};\n+\n class Denoise : public DenoiseAlgorithm\n {\n public:\n@@ -23,22 +43,12 @@ public:\n \tvoid switchMode(CameraMode const &cameraMode, Metadata *metadata) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \tvoid setMode(DenoiseMode mode) override;\n+\tvoid setConfig(std::string const &name) override;\n \n private:\n-\tdouble sdnDeviation_;\n-\tdouble sdnStrength_;\n-\tdouble sdnDeviation2_;\n-\tdouble sdnDeviationNoTdn_;\n-\tdouble sdnStrengthNoTdn_;\n-\tdouble sdnTdnBackoff_;\n-\tdouble cdnDeviation_;\n-\tdouble cdnStrength_;\n-\tdouble tdnDeviation_;\n-\tdouble tdnThreshold_;\n+\tstd::map<std::string, DenoiseConfig> configs_;\n+\tDenoiseConfig *currentConfig_;\n \tDenoiseMode mode_;\n-\tbool tdnEnable_;\n-\tbool sdnEnable_;\n-\tbool cdnEnable_;\n \n \t/* SDN parameters attenuate over time if TDN is running. */\n \tdouble currentSdnDeviation_;\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "18/20"
    ]
}