Show a patch.

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

{
    "id": 20896,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/20896/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20896/",
    "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": "<20240813084451.44099-4-stefan.klug@ideasonboard.com>",
    "date": "2024-08-13T08:44:20",
    "name": "[v4,3/6] ipa: rkisp1: awb: Implement ColourTemperature control",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b584170a8f4602c02ae83fc37bc435df35f0919a",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20896/mbox/",
    "series": [
        {
            "id": 4514,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4514/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4514",
            "date": "2024-08-13T08:44:17",
            "name": "rkisp1: Add manual colour temperature control",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/4514/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20896/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20896/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 3F06FC32A9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Aug 2024 08:45:14 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E4921633C0;\n\tTue, 13 Aug 2024 10:45:13 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AFA57633B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2024 10:45:11 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:7025:8d00:1ffd:751a])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C8A2827;\n\tTue, 13 Aug 2024 10:44:14 +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=\"WHSO9KC9\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723538654;\n\tbh=/KOBVKAao58HbFs5enY7FFTibZIebIgtD3qfN8Dq52s=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=WHSO9KC9z7Th48Z/Of+bL3/AbCk4kVIDyT8mOZhfPNQjaGeUxf1RksHwgQwv/BIDx\n\thwpfhtImCDCOyR+M/3TfpUsCzyDxU8E5TViGIalYlQSOVfTsdDkAAljLUD7fUqJV71\n\t1PbCE+PETr9sQ7LtwbE47p+cRpn7ktwk/WTCFeBk=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v4 3/6] ipa: rkisp1: awb: Implement ColourTemperature control",
        "Date": "Tue, 13 Aug 2024 10:44:20 +0200",
        "Message-ID": "<20240813084451.44099-4-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240813084451.44099-1-stefan.klug@ideasonboard.com>",
        "References": "<20240813084451.44099-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": "There are many use-cases (tuning-validation, working in static\nenvironments) where a manual ColourTemperature control is helpful.\nImplement that by interpolating and applying the white balance gains\nfrom the tuning file according to the requested colour temperature. If\ncolour gains are provided on the same request, they take precedence. As\nthe colour temperature reported in the metadata is always based on the\nmeasurements, we don't have to touch that.\n\nNote that in the automatic case, the colour gains are still based on the\ngray world model and the ones from the tuning file get ignored.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/awb.cpp | 22 +++++++++++++++++++++-\n 1 file changed, 21 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex c23f749c192b..d482eda5b541 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -31,6 +31,10 @@ namespace ipa::rkisp1::algorithms {\n \n LOG_DEFINE_CATEGORY(RkISP1Awb)\n \n+constexpr int32_t kMinColourTemperature = 2500;\n+constexpr int32_t kMaxColourTemperature = 10000;\n+constexpr int32_t kDefaultColourTemperature = 6500;\n+\n /* Minimum mean value below which AWB can't operate. */\n constexpr double kMeanMinThreshold = 2.0;\n \n@@ -42,8 +46,13 @@ Awb::Awb()\n /**\n  * \\copydoc libcamera::ipa::Algorithm::init\n  */\n-int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n+int Awb::init(IPAContext &context, const YamlObject &tuningData)\n {\n+\tauto &cmap = context.ctrlMap;\n+\tcmap[&controls::ColourTemperature] = ControlInfo(kMinColourTemperature,\n+\t\t\t\t\t\t\t kMaxColourTemperature,\n+\t\t\t\t\t\t\t kDefaultColourTemperature);\n+\n \tMatrixInterpolator<double, 2, 1> gains;\n \tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n \tif (ret < 0)\n@@ -113,6 +122,17 @@ void Awb::queueRequest(IPAContext &context,\n \t\t\t<< \", blue: \" << awb.gains.manual.blue;\n \t}\n \n+\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n+\tif (colourTemperature && !awb.autoEnabled && gains_ && !colourGains) {\n+\t\tMatrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n+\t\tawb.gains.manual.red = gains[0][0];\n+\t\tawb.gains.manual.blue = gains[1][0];\n+\n+\t\tLOG(RkISP1Awb, Debug)\n+\t\t\t<< \"Set colour gains to red: \" << awb.gains.manual.red\n+\t\t\t<< \", blue: \" << awb.gains.manual.blue;\n+\t}\n+\n \tframeContext.awb.autoEnabled = awb.autoEnabled;\n \n \tif (!awb.autoEnabled) {\n",
    "prefixes": [
        "v4",
        "3/6"
    ]
}