Show a patch.

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

{
    "id": 14995,
    "url": "https://patchwork.libcamera.org/api/patches/14995/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14995/",
    "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": "<20211202180410.518232-2-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2021-12-02T18:04:05",
    "name": "[libcamera-devel,v1,1/6] ipa: rkisp1: Introduce sensor degamma",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "8934306f13913a65c9b135acfe73c084b8e0b116",
    "submitter": {
        "id": 75,
        "url": "https://patchwork.libcamera.org/api/people/75/?format=api",
        "name": "Jean-Michel Hautbois",
        "email": "jeanmichel.hautbois@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14995/mbox/",
    "series": [
        {
            "id": 2805,
            "url": "https://patchwork.libcamera.org/api/series/2805/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2805",
            "date": "2021-12-02T18:04:04",
            "name": "IPA RkISP1 awb and misc improvements",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2805/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14995/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14995/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 431B3BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Dec 2021 18:04:20 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E49B66084B;\n\tThu,  2 Dec 2021 19:04:19 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D5F7060592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Dec 2021 19:04:15 +0100 (CET)",
            "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:7fc3:78ca:aeee:c4f2])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7BF1AB7E;\n\tThu,  2 Dec 2021 19:04:15 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ayDZiJ5r\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638468255;\n\tbh=TWRUo73KAeS8Br40wdAGYHlWvicaxPYZSA9tHc1RSMA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ayDZiJ5ruRA8+XZ2pSYKSNqiAKQvClvhpCzJw9pqTMdOWTTPLC+rM4T5VIuI6K/lg\n\twCKe1eezEnuSttu+AugnFq6gS1rOvSBbmLN4dyvv6G/qswh3T3bKS0BZNGtTUMoreR\n\tJBNF+JR7vz/hT3yTO8EusxdE8labnErgJVb/QNbI=",
        "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  2 Dec 2021 19:04:05 +0100",
        "Message-Id": "<20211202180410.518232-2-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20211202180410.518232-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20211202180410.518232-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 1/6] ipa: rkisp1: Introduce sensor\n\tdegamma",
        "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": "The RkISP1 has a sensor degamma control. Introduce the algorithm, but\nonly implement the prepare function as it is a static table to be set.\nThe table used is the one found in the imx219 tuning data in RPi as this\nis the only sensor I have right now and it looks like a decent default\ntable.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/meson.build |  1 +\n src/ipa/rkisp1/algorithms/sdg.cpp     | 49 +++++++++++++++++++++++++++\n src/ipa/rkisp1/algorithms/sdg.h       | 30 ++++++++++++++++\n src/ipa/rkisp1/rkisp1.cpp             |  2 ++\n 4 files changed, 82 insertions(+)\n create mode 100644 src/ipa/rkisp1/algorithms/sdg.cpp\n create mode 100644 src/ipa/rkisp1/algorithms/sdg.h",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build\nindex a19c1a4fa..0678518d8 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+    'sdg.cpp',\n ])\ndiff --git a/src/ipa/rkisp1/algorithms/sdg.cpp b/src/ipa/rkisp1/algorithms/sdg.cpp\nnew file mode 100644\nindex 000000000..3f6b3e205\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/sdg.cpp\n@@ -0,0 +1,49 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021, Ideas On Board\n+ *\n+ * sdg.cpp - Sensor degamma control algorithm\n+ */\n+\n+#include \"sdg.h\"\n+\n+/**\n+ * \\file sdg.h\n+ */\n+\n+namespace libcamera {\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+/**\n+ * \\class SensorDeGamma\n+ * \\brief A sensor degamma algorithm\n+ */\n+\n+static const uint16_t imx219DeGammaCurve[] = { 0, 583, 957, 1299, 1609, 1877,\n+\t\t\t\t\t       2123, 2350, 2540, 2859, 3101, 3293,\n+\t\t\t\t\t       3429, 3666, 3823, 3963, 4095 };\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n+void SensorDeGamma::prepare([[maybe_unused]] IPAContext &context,\n+\t\t\t    rkisp1_params_cfg *params)\n+{\n+\tfor (uint32_t i = 0; i < RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE; i++) {\n+\t\tparams->others.sdg_config.curve_r.gamma_y[i] = imx219DeGammaCurve[i];\n+\t\tparams->others.sdg_config.curve_b.gamma_y[i] = imx219DeGammaCurve[i];\n+\t\tparams->others.sdg_config.curve_g.gamma_y[i] = imx219DeGammaCurve[i];\n+\t}\n+\n+\tparams->others.sdg_config.xa_pnts.gamma_dx0 = 0x44444444;\n+\tparams->others.sdg_config.xa_pnts.gamma_dx1 = 0x44444444;\n+\n+\tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_SDG;\n+\tparams->module_ens |= RKISP1_CIF_ISP_MODULE_SDG;\n+\tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_SDG;\n+}\n+\n+} /* namespace ipa::rkisp1::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/algorithms/sdg.h b/src/ipa/rkisp1/algorithms/sdg.h\nnew file mode 100644\nindex 000000000..24c41627a\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/sdg.h\n@@ -0,0 +1,30 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021, Ideas On Board\n+ *\n+ * sdg.h - Sensor degamma control algorithm\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 SensorDeGamma : public Algorithm\n+{\n+public:\n+\tSensorDeGamma() = default;\n+\t~SensorDeGamma() = 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/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 2d79f15fe..07f1f1c87 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/sdg.h\"\n #include \"libipa/camera_sensor_helper.h\"\n \n #include \"ipa_context.h\"\n@@ -126,6 +127,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::SensorDeGamma>());\n \n \treturn 0;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "1/6"
    ]
}