Show a patch.

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

{
    "id": 20497,
    "url": "https://patchwork.libcamera.org/api/patches/20497/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20497/",
    "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": "<20240701144122.3418955-5-stefan.klug@ideasonboard.com>",
    "date": "2024-07-01T14:38:27",
    "name": "[4/5] ipa: rkisp1: blc: Report sensor black levels in metadata",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d19c4fed725bc001bd8908c118a23827d21c93c1",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20497/mbox/",
    "series": [
        {
            "id": 4433,
            "url": "https://patchwork.libcamera.org/api/series/4433/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4433",
            "date": "2024-07-01T14:38:23",
            "name": "ipa: Add black level to camera sensor helpers",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4433/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20497/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20497/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 24892BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Jul 2024 14:41:51 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D87B063334;\n\tMon,  1 Jul 2024 16:41:50 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 286CD63339\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2024 16:41:48 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:89b2:f6c7:b29b:4e5c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 66BFB289;\n\tMon,  1 Jul 2024 16:41:21 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"K7O8/wsv\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719844881;\n\tbh=gvU6lB7So5TEcjJYig+GviVf7c2kQ+bRxqYyOHh8Zvk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=K7O8/wsvT9u2WhjDS6aJci/78vtxpblGggW8q/tCZG4ZsEdM5e+M57IeMBsLA27LR\n\tnXD61KsbEau6atxiLyx05CmAR6OQPeUBe4a4BTx7vGM3khQTOVhRKPACoBxFVr3cSU\n\tQgJduHphS0kqXxjiqK1ug/C3FMcqhkjm8CiHcu2o=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH 4/5] ipa: rkisp1: blc: Report sensor black levels in metadata",
        "Date": "Mon,  1 Jul 2024 16:38:27 +0200",
        "Message-ID": "<20240701144122.3418955-5-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240701144122.3418955-1-stefan.klug@ideasonboard.com>",
        "References": "<20240701144122.3418955-1-stefan.klug@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "For the tuning process it is necessary to know the sensor black levels.\nAdd them to the metadata.\n\nAdditionally enable raw support for this algorithm and add it to\nuncalibrated.yaml, so that black levels get reported when capturing\ntuning images.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/blc.cpp     | 19 +++++++++++++++++++\n src/ipa/rkisp1/algorithms/blc.h       |  5 ++++-\n src/ipa/rkisp1/data/uncalibrated.yaml |  1 +\n 3 files changed, 24 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\nindex 0c39c3b47da5..a9f76b87d15a 100644\n--- a/src/ipa/rkisp1/algorithms/blc.cpp\n+++ b/src/ipa/rkisp1/algorithms/blc.cpp\n@@ -9,6 +9,8 @@\n \n #include <libcamera/base/log.h>\n \n+#include <libcamera/control_ids.h>\n+\n #include \"libcamera/internal/yaml_parser.h\"\n \n /**\n@@ -38,6 +40,7 @@ LOG_DEFINE_CATEGORY(RkISP1Blc)\n BlackLevelCorrection::BlackLevelCorrection()\n \t: tuningParameters_(false)\n {\n+\tsupportsRaw_ = true;\n }\n \n /**\n@@ -107,6 +110,22 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n \tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_BLS;\n }\n \n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::process\n+ */\n+void BlackLevelCorrection::process([[maybe_unused]] IPAContext &context,\n+\t\t\t\t   [[maybe_unused]] const uint32_t frame,\n+\t\t\t\t   [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t\t\t   [[maybe_unused]] const rkisp1_stat_buffer *stats,\n+\t\t\t\t   [[maybe_unused]] ControlList &metadata)\n+{\n+\tmetadata.set(controls::SensorBlackLevels,\n+\t\t     { static_cast<int32_t>(blackLevelRed_),\n+\t\t       static_cast<int32_t>(blackLevelGreenR_),\n+\t\t       static_cast<int32_t>(blackLevelGreenB_),\n+\t\t       static_cast<int32_t>(blackLevelBlue_) });\n+}\n+\n REGISTER_IPA_ALGORITHM(BlackLevelCorrection, \"BlackLevelCorrection\")\n \n } /* namespace ipa::rkisp1::algorithms */\ndiff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\nindex 460ebcc15739..4ecac233f88b 100644\n--- a/src/ipa/rkisp1/algorithms/blc.h\n+++ b/src/ipa/rkisp1/algorithms/blc.h\n@@ -23,7 +23,10 @@ public:\n \tvoid prepare(IPAContext &context, const uint32_t frame,\n \t\t     IPAFrameContext &frameContext,\n \t\t     rkisp1_params_cfg *params) override;\n-\n+\tvoid process(IPAContext &context, const uint32_t frame,\n+\t\t     IPAFrameContext &frameContext,\n+\t\t     const rkisp1_stat_buffer *stats,\n+\t\t     ControlList &metadata) override;\n private:\n \tbool tuningParameters_;\n \tint16_t blackLevelRed_;\ndiff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml\nindex a7bbd8d84263..609012967e02 100644\n--- a/src/ipa/rkisp1/data/uncalibrated.yaml\n+++ b/src/ipa/rkisp1/data/uncalibrated.yaml\n@@ -5,4 +5,5 @@ version: 1\n algorithms:\n   - Agc:\n   - Awb:\n+  - BlackLevelCorrection:\n ...\n",
    "prefixes": [
        "4/5"
    ]
}