Show a patch.

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

{
    "id": 10909,
    "url": "https://patchwork.libcamera.org/api/patches/10909/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10909/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20210120083449.642418-6-naush@raspberrypi.com>",
    "date": "2021-01-20T08:34:49",
    "name": "[libcamera-devel,5/5] ipa: raspberrypi: Handle control::NoiseReductionMode in the controller",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9e7e6039e2a1a51093133cf9da47ae74db842f77",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/10909/mbox/",
    "series": [
        {
            "id": 1587,
            "url": "https://patchwork.libcamera.org/api/series/1587/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1587",
            "date": "2021-01-20T08:34:44",
            "name": "Raspberry Pi: Colour denoise",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1587/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10909/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10909/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 A51F5C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Jan 2021 08:35:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6C3D568188;\n\tWed, 20 Jan 2021 09:35:02 +0100 (CET)",
            "from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n\t[IPv6:2a00:1450:4864:20::336])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3070560312\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jan 2021 09:35:00 +0100 (CET)",
            "by mail-wm1-x336.google.com with SMTP id c128so2039074wme.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jan 2021 00:35:00 -0800 (PST)",
            "from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\t33sm2809284wrn.35.2021.01.20.00.34.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 20 Jan 2021 00:34:58 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"ohr+48li\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=ViC63ieoHqyOFUdYo8HZrN27zywpSAcoAyfde3DdBlI=;\n\tb=ohr+48li8UAyefkFeRhMpJ0Hv0f4RfXziOIzx/0J/uDnXC1J4sWKCmtMVp/1Hh9tAn\n\tqqVLLiroHrumal1xzOuuluKLOWiajDmQNQFmqGH/m8xT7JZqVtaWGr9EqQkMm8IrW8He\n\t/VuQ3zcaf6g/7RlzPb8fj5E4RFJDZBtn5oYTQ3umAHSvM45o/zDrfyfUdbD887NVS8k9\n\tcb9Yc37U73vRudvq/3bEVJuLzVJ20CJXdeNrNkwS7RKu7eDtxXSxkZPe/puKr1wPGkli\n\tS31vBNn2gLHCFRX7Ie3JvFGFl0akQM2sJhAFVfrgBPiVjy+ie9OSXZvnRNhI7g0BxDSA\n\tsn/g==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=ViC63ieoHqyOFUdYo8HZrN27zywpSAcoAyfde3DdBlI=;\n\tb=sKrRNTTHQNtAhrSDtYYdoSQvbxdpj5TmR58ZTXqR33cVH3Fl5K69ltFdbmp2pCI907\n\t43glcji1a8UjdiPsJQ1XNNXAFFW81gDR6UaTjfeTaXkBCNSkT17X5sRBpJnfszzq+ycA\n\tCyER0k6i/eXdn+aJdjeANfw3tYOfG85WgkHlgXVmd7HFcTP6arwtm7eUmAP6gMDfjtL9\n\tNWnvQ412E25T99cXKfMbWLRhZ5VTSmgoOevmjn0/feWMBwf6LTQpy/nUHzQ1tJmeVyFz\n\tvZbBF8ak92UXWfxd0jCi43I7zZ6x3LehdHr4H7LsiTLTjzEkSBSPnLHkI5jSHR8YXsk+\n\tQNIA==",
        "X-Gm-Message-State": "AOAM5333H7UgxiPcmWzqnnNLpr/WW3+Vh5chO/O64ygvKmOqSfQ67eb7\n\tqcYMjmcOXiOAmTQoveA0TY0pxpZkXWs5Og==",
        "X-Google-Smtp-Source": "ABdhPJxIT+6BfhIviWZCiNj/SZhIQYYFcmgjjd1wqPbGNixVJVEV+DMVL1jTG9cUUrl5n46Tm5jb/A==",
        "X-Received": "by 2002:a7b:c1d7:: with SMTP id\n\ta23mr3186218wmj.149.1611131699714; \n\tWed, 20 Jan 2021 00:34:59 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 20 Jan 2021 08:34:49 +0000",
        "Message-Id": "<20210120083449.642418-6-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210120083449.642418-1-naush@raspberrypi.com>",
        "References": "<20210120083449.642418-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 5/5] ipa: raspberrypi: Handle\n\tcontrol::NoiseReductionMode in the controller",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The application provided noise reduction mode gets passed into the\ndenoise controller.  The denoise controller in turn returns the mode to\nthe IPA which now sets up the colour denoise processing appropriately.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 47 ++++++++++++++++++++++++++++-\n 1 file changed, 46 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 8af3d603a3ff..91041fa68930 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -43,6 +43,7 @@\n #include \"contrast_algorithm.hpp\"\n #include \"contrast_status.h\"\n #include \"controller.hpp\"\n+#include \"denoise_algorithm.hpp\"\n #include \"dpc_status.h\"\n #include \"focus_status.h\"\n #include \"geq_status.h\"\n@@ -553,7 +554,8 @@ bool IPARPi::validateIspControls()\n \t\tV4L2_CID_USER_BCM2835_ISP_DENOISE,\n \t\tV4L2_CID_USER_BCM2835_ISP_SHARPEN,\n \t\tV4L2_CID_USER_BCM2835_ISP_DPC,\n-\t\tV4L2_CID_USER_BCM2835_ISP_LENS_SHADING\n+\t\tV4L2_CID_USER_BCM2835_ISP_LENS_SHADING,\n+\t\tV4L2_CID_USER_BCM2835_ISP_CDN,\n \t};\n \n \tfor (auto c : ctrls) {\n@@ -603,6 +605,14 @@ 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::Fast },\n+\t{ controls::draft::NoiseReductionModeHighQuality, RPiController::DenoiseMode::HighQuality },\n+\t{ controls::draft::NoiseReductionModeMinimal, RPiController::DenoiseMode::Fast },\n+\t{ controls::draft::NoiseReductionModeZSL, RPiController::DenoiseMode::HighQuality },\n+};\n+\n void IPARPi::queueRequest(const ControlList &controls)\n {\n \t/* Clear the return metadata buffer. */\n@@ -806,6 +816,22 @@ void IPARPi::queueRequest(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\tASSERT(sdn);\n+\n+\t\t\tint32_t idx = ctrl.second.get<int32_t>();\n+\t\t\tif (DenoiseModeTable.count(idx)) {\n+\t\t\t\tsdn->SetMode(DenoiseModeTable.at(idx));\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\t\tbreak;\n+\t\t}\n+\n \t\tdefault:\n \t\t\tLOG(IPARPI, Warning)\n \t\t\t\t<< \"Ctrl \" << controls::controls.at(ctrl.first)->name()\n@@ -1052,9 +1078,28 @@ void IPARPi::applyDenoise(const struct SdnStatus *denoiseStatus, ControlList &ct\n \tdenoise.strength.num = 1000 * denoiseStatus->strength;\n \tdenoise.strength.den = 1000;\n \n+\t/* Set the CDN mode to match the SDN operating mode. */\n+\tbcm2835_isp_cdn cdn;\n+\tswitch (denoiseStatus->mode) {\n+\tcase RPiController::DenoiseMode::Fast:\n+\t\tcdn.enabled = 1;\n+\t\tcdn.mode = CDN_MODE_FAST;\n+\t\tbreak;\n+\tcase RPiController::DenoiseMode::HighQuality:\n+\t\tcdn.enabled = 1;\n+\t\tcdn.mode = CDN_MODE_HIGH_QUALITY;\n+\t\tbreak;\n+\tdefault:\n+\t\tcdn.enabled = 0;\n+\t}\n+\n \tControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&denoise),\n \t\t\t\t\t    sizeof(denoise) });\n \tctrls.set(V4L2_CID_USER_BCM2835_ISP_DENOISE, c);\n+\n+\tc = ControlValue(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&cdn),\n+\t\t\t\t\t      sizeof(cdn) });\n+\tctrls.set(V4L2_CID_USER_BCM2835_ISP_CDN, c);\n }\n \n void IPARPi::applySharpen(const struct SharpenStatus *sharpenStatus, ControlList &ctrls)\n",
    "prefixes": [
        "libcamera-devel",
        "5/5"
    ]
}