Show a patch.

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

{
    "id": 19165,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19165/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19165/",
    "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": "<20231020084002.30665-5-naush@raspberrypi.com>",
    "date": "2023-10-20T08:40:00",
    "name": "[libcamera-devel,v1,4/6] ipa: rpi: vc4: Move denoise control handling into the VC4 derived IPA",
    "commit_ref": "4e7c26b19724ffc1174bb131de2b56d85e83127f",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d467d122ccf3a37a38b577ff9453eb52ac269432",
    "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/19165/mbox/",
    "series": [
        {
            "id": 4054,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4054/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4054",
            "date": "2023-10-20T08:39:56",
            "name": "Raspberry Pi: Preliminary PiSP support (round 2)",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4054/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19165/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19165/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 2E940C32B7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 Oct 2023 08:40:35 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A5A1862989;\n\tFri, 20 Oct 2023 10:40:33 +0200 (CEST)",
            "from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 331BA62985\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Oct 2023 10:40:30 +0200 (CEST)",
            "by mail-wm1-x32b.google.com with SMTP id\n\t5b1f17b1804b1-4084b0223ccso4282825e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Oct 2023 01:40:30 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tr3-20020adff103000000b0032d9337e7d1sm1213356wro.11.2023.10.20.01.40.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 20 Oct 2023 01:40:29 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1697791233;\n\tbh=TtHxFJeL4MD/PFY+wPrML5jb4cdVF6jM6t7lvNU07D0=;\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=wBjtl3lZYpqkKEmz+sJ6w9pYyaz6D9gWkGnpKqFIbRvYUplmNHaFbgt0w+17Dtume\n\th4Un9TYVdR4awdT523HMoTB4wvLpir7M0CEZXGb8awU4A7eKiVyU/70cwOiUp7jN/h\n\t/c3+tRjn9Gw9CSSd+SoJOQzeq4bpO1IuzaQxDgXY4/hhMMn9Kme7Zhkgl+f2KyVKSX\n\tWEGGfb3jjHP0yTIqucIrl5/8QyIskcwEnTlBbIQoGnXpPU9yjY/ivbFIEUoDquwoBp\n\tSCT9JnpOKYR5mr6aFAmpawDvmX8MaUh8Z16HDEtVKjJ+Z9BiY9p5aBjhQMNAnmjAYP\n\tvYCZg8WkVhlqw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1697791229; x=1698396029;\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=THs8OugOrZxgqGgWsO6DaNgV0gChhONcOouxjenHTMQ=;\n\tb=T/iEajdaqTzyBeyA9tMXDP+rEw8MCini12gLUFKe27gsVXSxihqrC//hhUTkanIzEz\n\tHItoiwi4IF1mSuzeBrg7Y5QB/zoqD9PnEDcjYfCQ8HzwgNvrPSy9r3Xq2XdWZzojwgob\n\tL7gW/BLMgtRKREaYaYI+0fR1BjGeXHvWfDCW6ixpo76nv9MY/6ekEODlgbVcuyRIKPHf\n\t3srxAZdFliGpBdTqtST5RdYgBmz8Z8v1ppA9eCnrt4iYCF6OoPRWodv3JTNwoo+478Pn\n\t1WNjFbcCbzGoc81Xg0UEKXHgGEtZeb0Z7B7Tyb6LWRWPZiXTK6OY12nogLN2qW4Vr7jv\n\tR63w=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"T/iEajda\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1697791229; x=1698396029;\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=THs8OugOrZxgqGgWsO6DaNgV0gChhONcOouxjenHTMQ=;\n\tb=pUxy6+ilYEmw6yu9tzM+KOowXAx042hd6y/p3liAfeK+7cfrNAZf+uKi766SVJX6Zu\n\tdFXRzImtMUD1x/c/wYcx0nh8r2LPgM0TnTXfaq6zppY/37Xamu14VK2ScQv1igPJ4Wqv\n\tutmaqLy5G83XYYtKKYqX0B8rj0h/KPOldR6WQG+/ixU2C+NlG8rtMLHk9I9LNpUeCfg/\n\tCBYoqPtxZ6eALq2e9Wm54f/WgYR/YD3XMpBpGU1CZnG81kcAa7LBJlpabkzSpJhHGaOq\n\tVjz+HSBX5OeH+Oe6Owoazgwxd6DWar/vnmF9rkdyM0Tuq2yMO2nnSnURoYgfklmBzkwY\n\tgCEw==",
        "X-Gm-Message-State": "AOJu0YxRIj9gYbiAdPN0pfne2ttSi6PhlPnsVXSEXwjvUBvliZmfd2TC\n\tryw3R2CGALOBwLl12dt8RRtdzARaji+p5GvV3XEGdQ==",
        "X-Google-Smtp-Source": "AGHT+IFdd25n/bnE8tmforA6yc2GQNZxcxT9JONvW9CTWo5Dmaekh4YiGPFJ+3dUsFWg0RwJlddLuw==",
        "X-Received": "by 2002:a05:600c:1910:b0:401:b2c7:34a8 with SMTP id\n\tj16-20020a05600c191000b00401b2c734a8mr986585wmq.7.1697791229602; \n\tFri, 20 Oct 2023 01:40:29 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 20 Oct 2023 09:40:00 +0100",
        "Message-Id": "<20231020084002.30665-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20231020084002.30665-1-naush@raspberrypi.com>",
        "References": "<20231020084002.30665-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 4/6] ipa: rpi: vc4: Move denoise\n\tcontrol handling into the VC4 derived IPA",
        "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": "Since noise control handling differs between the VC4 and PiSP IPAs,\nmove the current denoise control handler from ipa base into the vc4 IPA\nderived class.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 41 ++++-----------------------------\n src/ipa/rpi/vc4/vc4.cpp         | 35 ++++++++++++++++++++++++++--\n 2 files changed, 37 insertions(+), 39 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex f28eb36b7a44..2583c6226f44 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -643,14 +643,6 @@ static const std::map<int32_t, std::string> AwbModeTable = {\n \t{ controls::AwbCustom, \"custom\" },\n };\n \n-static const std::map<int32_t, RPiController::DenoiseMode> DenoiseModeTable = {\n-\t{ controls::draft::NoiseReductionModeOff, RPiController::DenoiseMode::Off },\n-\t{ controls::draft::NoiseReductionModeFast, RPiController::DenoiseMode::ColourFast },\n-\t{ controls::draft::NoiseReductionModeHighQuality, RPiController::DenoiseMode::ColourHighQuality },\n-\t{ controls::draft::NoiseReductionModeMinimal, RPiController::DenoiseMode::ColourOff },\n-\t{ controls::draft::NoiseReductionModeZSL, RPiController::DenoiseMode::ColourHighQuality },\n-};\n-\n static const std::map<int32_t, RPiController::AfAlgorithm::AfMode> AfModeTable = {\n \t{ controls::AfModeManual, RPiController::AfAlgorithm::AfModeManual },\n \t{ controls::AfModeAuto, RPiController::AfAlgorithm::AfModeAuto },\n@@ -1032,36 +1024,11 @@ void IpaBase::applyControls(const ControlList &controls)\n \t\t\tbreak;\n \t\t}\n \n-\t\tcase controls::NOISE_REDUCTION_MODE: {\n-\t\t\tRPiController::DenoiseAlgorithm *sdn = dynamic_cast<RPiController::DenoiseAlgorithm *>(\n-\t\t\t\tcontroller_.getAlgorithm(\"SDN\"));\n-\t\t\t/* Some platforms may have a combined \"denoise\" algorithm instead. */\n-\t\t\tif (!sdn)\n-\t\t\t\tsdn = dynamic_cast<RPiController::DenoiseAlgorithm *>(\n-\t\t\t\tcontroller_.getAlgorithm(\"denoise\"));\n-\t\t\tif (!sdn) {\n-\t\t\t\tLOG(IPARPI, Warning)\n-\t\t\t\t\t<< \"Could not set NOISE_REDUCTION_MODE - no SDN algorithm\";\n-\t\t\t\tbreak;\n-\t\t\t}\n-\n-\t\t\tint32_t idx = ctrl.second.get<int32_t>();\n-\t\t\tauto mode = DenoiseModeTable.find(idx);\n-\t\t\tif (mode != DenoiseModeTable.end()) {\n-\t\t\t\tsdn->setMode(mode->second);\n-\n-\t\t\t\t/*\n-\t\t\t\t * \\todo If the colour denoise is not going to run due to an\n-\t\t\t\t * analysis image resolution or format mismatch, we should\n-\t\t\t\t * report the status correctly in the metadata.\n-\t\t\t\t */\n-\t\t\t\tlibcameraMetadata_.set(controls::draft::NoiseReductionMode, idx);\n-\t\t\t} else {\n-\t\t\t\tLOG(IPARPI, Error) << \"Noise reduction mode \" << idx\n-\t\t\t\t\t\t   << \" not recognised\";\n-\t\t\t}\n+\t\tcase controls::NOISE_REDUCTION_MODE:\n+\t\t\t/* Handled below in handleControls() */\n+\t\t\tlibcameraMetadata_.set(controls::draft::NoiseReductionMode,\n+\t\t\t\t\t       ctrl.second.get<int32_t>());\n \t\t\tbreak;\n-\t\t}\n \n \t\tcase controls::AF_MODE:\n \t\t\tbreak; /* We already handled this one above */\ndiff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp\nindex 4a4d720ce7dd..354b901bb796 100644\n--- a/src/ipa/rpi/vc4/vc4.cpp\n+++ b/src/ipa/rpi/vc4/vc4.cpp\n@@ -11,6 +11,7 @@\n #include <linux/bcm2835-isp.h>\n \n #include <libcamera/base/log.h>\n+#include <libcamera/control_ids.h>\n #include <libcamera/ipa/ipa_module_info.h>\n \n #include \"common/ipa_base.h\"\n@@ -247,9 +248,39 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)\n \treturn statistics;\n }\n \n-void IpaVc4::handleControls([[maybe_unused]] const ControlList &controls)\n+void IpaVc4::handleControls(const ControlList &controls)\n {\n-\t/* No controls require any special updates to the hardware configuration. */\n+\tstatic const std::map<int32_t, RPiController::DenoiseMode> DenoiseModeTable = {\n+\t\t{ controls::draft::NoiseReductionModeOff, RPiController::DenoiseMode::Off },\n+\t\t{ controls::draft::NoiseReductionModeFast, RPiController::DenoiseMode::ColourFast },\n+\t\t{ controls::draft::NoiseReductionModeHighQuality, RPiController::DenoiseMode::ColourHighQuality },\n+\t\t{ controls::draft::NoiseReductionModeMinimal, RPiController::DenoiseMode::ColourOff },\n+\t\t{ controls::draft::NoiseReductionModeZSL, RPiController::DenoiseMode::ColourHighQuality },\n+\t};\n+\n+\tfor (auto const &ctrl : controls) {\n+\t\tswitch (ctrl.first) {\n+\t\tcase controls::NOISE_REDUCTION_MODE: {\n+\t\t\tRPiController::DenoiseAlgorithm *sdn = dynamic_cast<RPiController::DenoiseAlgorithm *>(\n+\t\t\t\tcontroller_.getAlgorithm(\"SDN\"));\n+\t\t\t/* Some platforms may have a combined \"denoise\" algorithm instead. */\n+\t\t\tif (!sdn)\n+\t\t\t\tsdn = dynamic_cast<RPiController::DenoiseAlgorithm *>(\n+\t\t\t\tcontroller_.getAlgorithm(\"denoise\"));\n+\t\t\tif (!sdn) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set NOISE_REDUCTION_MODE - no SDN algorithm\";\n+\t\t\t\treturn;\n+\t\t\t}\n+\n+\t\t\tint32_t idx = ctrl.second.get<int32_t>();\n+\t\t\tauto mode = DenoiseModeTable.find(idx);\n+\t\t\tif (mode != DenoiseModeTable.end())\n+\t\t\t\tsdn->setMode(mode->second);\n+\t\t\tbreak;\n+\t\t}\n+\t\t}\n+\t}\n }\n \n bool IpaVc4::validateIspControls()\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "4/6"
    ]
}