Show a patch.

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

{
    "id": 15565,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15565/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15565/",
    "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": "<20220328092433.69856-3-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2022-03-28T09:24:30",
    "name": "[libcamera-devel,v4,2/5] ipa: rkisp1: Introduce Black Level Correction",
    "commit_ref": "13c1e48e8ec6bce55585f042c695e47f2873c58c",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f45f1c075c2c96d5542a3575c984084decc2be4b",
    "submitter": {
        "id": 75,
        "url": "https://patchwork.libcamera.org/api/1.1/people/75/?format=api",
        "name": "Jean-Michel Hautbois",
        "email": "jeanmichel.hautbois@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15565/mbox/",
    "series": [
        {
            "id": 3005,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3005/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3005",
            "date": "2022-03-28T09:24:28",
            "name": "IPA RkISP1 awb and misc improvements",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3005/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15565/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15565/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 11E82C3265\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Mar 2022 09:24:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EE35465637;\n\tMon, 28 Mar 2022 11:24:43 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 33603633A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Mar 2022 11:24:42 +0200 (CEST)",
            "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:4f49:c672:4655:7dbb])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A10F39BC;\n\tMon, 28 Mar 2022 11:24:41 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648459483;\n\tbh=UwVmOCPbIGlpJyWAKcp8WXSU74Dwkh6Bx/98nnUbxrs=;\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=1AZx2VS5Etd1RXB//cAvjfeXo5SX8r0e0/4JqivdF7Eop5D+oDUspb3d3xRjTmW6j\n\tlsCQJtdOKoIJMhPd3n4jp1Nw/TfWYdtsspqWeoKwNppxyAZpzMxvnfMRz4CLzSISCy\n\tAzAGLliM/uq9nw8FgxyqTLoLVNTWlXvYdeZI8UrSU/YixlPm/LVXAhVksETCEkJ9Rz\n\ti+0yTA6lRQzjQU+yuVRcbpGG/AGFxxwRNZ4ZzrGwNwI15P9ZVo9NUg5YY+5vW2e/c8\n\tcaw6KdRoCsqIuVxQHIJOBZj5NrCCU3rx/SRuhHSsFC5m5/hOj0joJMx7BvOWXj7Fgw\n\t/94Hhtep+3xgA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648459481;\n\tbh=UwVmOCPbIGlpJyWAKcp8WXSU74Dwkh6Bx/98nnUbxrs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=c6d3euPwzrLd492Izz52sR/mzyNXhcNAd4UFZQkqm9/Bn+41rUYrJ1TlDEoWTEiMw\n\t/92z5aWz34qxLDVQiLEKzA+W3K4M61sj5giSvHpg8wk3QMJdTdOUJIHNlGpVplMj5K\n\t6JUZjl3bWYCKZpfhDoSLavaBXd/qlJwnS26UTZVc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"c6d3euPw\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 28 Mar 2022 11:24:30 +0200",
        "Message-Id": "<20220328092433.69856-3-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20220328092433.69856-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20220328092433.69856-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 2/5] ipa: rkisp1: Introduce Black Level\n\tCorrection",
        "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": "Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "In order to have the proper pixel levels, apply a fixed black level\ncorrection, based on the imx219 tuning file in RPi. The value is 4096 on\n16 bits, and the pipeline for RkISP1 is on 12 bits, scale it.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nTested-by: Peter Griffin <peter.griffin@linaro.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/blc.cpp     | 57 +++++++++++++++++++++++++++\n src/ipa/rkisp1/algorithms/blc.h       | 30 ++++++++++++++\n src/ipa/rkisp1/algorithms/meson.build |  1 +\n src/ipa/rkisp1/rkisp1.cpp             |  2 +\n 4 files changed, 90 insertions(+)\n create mode 100644 src/ipa/rkisp1/algorithms/blc.cpp\n create mode 100644 src/ipa/rkisp1/algorithms/blc.h",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\nnew file mode 100644\nindex 00000000..0c5948ff\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/blc.cpp\n@@ -0,0 +1,57 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021-2022, Ideas On Board\n+ *\n+ * blc.cpp - RkISP1 Black Level Correction control\n+ */\n+\n+#include \"blc.h\"\n+\n+/**\n+ * \\file blc.h\n+ */\n+\n+namespace libcamera {\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+/**\n+ * \\class BlackLevelCorrection\n+ * \\brief RkISP1 Black Level Correction control\n+ *\n+ * The pixels output by the camera normally include a black level, because\n+ * sensors do not always report a signal level of '0' for black. Pixels at or\n+ * below this level should be considered black. To achieve that, the RkISP BLC\n+ * algorithm subtracts a configurable offset from all pixels.\n+ *\n+ * The black level can be measured at runtime from an optical dark region of the\n+ * camera sensor, or measured during the camera tuning process. The first option\n+ * isn't currently supported.\n+ */\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n+void BlackLevelCorrection::prepare(IPAContext &context,\n+\t\t\t\t   rkisp1_params_cfg *params)\n+{\n+\tif (context.frameContext.frameCount > 0)\n+\t\treturn;\n+\t/*\n+\t * Substract fixed values taken from imx219 tuning file.\n+\t * \\todo Use a configuration file for it ?\n+\t */\n+\tparams->others.bls_config.enable_auto = 0;\n+\tparams->others.bls_config.fixed_val.r = 256;\n+\tparams->others.bls_config.fixed_val.gr = 256;\n+\tparams->others.bls_config.fixed_val.gb = 256;\n+\tparams->others.bls_config.fixed_val.b = 256;\n+\n+\tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_BLS;\n+\tparams->module_ens |= RKISP1_CIF_ISP_MODULE_BLS;\n+\tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_BLS;\n+}\n+\n+} /* namespace ipa::rkisp1::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\nnew file mode 100644\nindex 00000000..69874d8f\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/blc.h\n@@ -0,0 +1,30 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021-2022, Ideas On Board\n+ *\n+ * blc.h - RkISP1 Black Level 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 BlackLevelCorrection : public Algorithm\n+{\n+public:\n+\tBlackLevelCorrection() = default;\n+\t~BlackLevelCorrection() = default;\n+\n+\tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\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 a19c1a4f..27c97731 100644\n--- a/src/ipa/rkisp1/algorithms/meson.build\n+++ b/src/ipa/rkisp1/algorithms/meson.build\n@@ -2,4 +2,5 @@\n \n rkisp1_ipa_algorithms = files([\n     'agc.cpp',\n+    'blc.cpp',\n ])\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 493811d9..83ed21be 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -27,6 +27,7 @@\n \n #include \"algorithms/agc.h\"\n #include \"algorithms/algorithm.h\"\n+#include \"algorithms/blc.h\"\n #include \"libipa/camera_sensor_helper.h\"\n \n #include \"ipa_context.h\"\n@@ -120,6 +121,7 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n \n \t/* Construct our Algorithms */\n \talgorithms_.push_back(std::make_unique<algorithms::Agc>());\n+\talgorithms_.push_back(std::make_unique<algorithms::BlackLevelCorrection>());\n \n \treturn 0;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "2/5"
    ]
}