Show a patch.

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

{
    "id": 22415,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/22415/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22415/",
    "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": "<20241219175729.293782-8-stefan.klug@ideasonboard.com>",
    "date": "2024-12-19T17:57:24",
    "name": "[v6,7/9] libtuning: Add initial AWB module",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "0da91d6e123e45b038a22e81834c0cd111f09c9b",
    "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/22415/mbox/",
    "series": [
        {
            "id": 4919,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4919/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4919",
            "date": "2024-12-19T17:57:17",
            "name": "rkisp1: Add manual colour temperature control",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/4919/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22415/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22415/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 51A26C3308\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Dec 2024 17:57:57 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F187F68489;\n\tThu, 19 Dec 2024 18:57:56 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3DDCB68480\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Dec 2024 18:57:53 +0100 (CET)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:783:85f9:c998:cb11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 71C076D6;\n\tThu, 19 Dec 2024 18:57:14 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"kjvx/ZVi\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734631034;\n\tbh=E3YVIewT5sPLsLIs5Ro7gZMwWTnCo66a55NNviKQzdM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=kjvx/ZVio41xT7VywHVYTa5i4jtF02Z6/qiffZ7o62IY0jdgJMbVy4adXkUdamTC2\n\tgwj80aEvfWZMwHjBuJjkaZPDZ7b1XT9+2wDT5Zbf0m3tId1ddA3dAQ5JXDxRTiNgf9\n\tMlm570dxbGDbl64AR3dfQ764sF5ty8WSQpUpwwVI=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Subject": "[PATCH v6 7/9] libtuning: Add initial AWB module",
        "Date": "Thu, 19 Dec 2024 18:57:24 +0100",
        "Message-ID": "<20241219175729.293782-8-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20241219175729.293782-1-stefan.klug@ideasonboard.com>",
        "References": "<20241219175729.293782-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": "This AWB module uses the awb function from Raspberry Pi to calculate the\nneeded white balance gains per colour temperature. It stores these gains\nin the tuning file.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../tuning/libtuning/modules/awb/__init__.py  |  6 ++++\n utils/tuning/libtuning/modules/awb/awb.py     | 36 +++++++++++++++++++\n utils/tuning/libtuning/modules/awb/rkisp1.py  | 27 ++++++++++++++\n 3 files changed, 69 insertions(+)\n create mode 100644 utils/tuning/libtuning/modules/awb/__init__.py\n create mode 100644 utils/tuning/libtuning/modules/awb/awb.py\n create mode 100644 utils/tuning/libtuning/modules/awb/rkisp1.py",
    "diff": "diff --git a/utils/tuning/libtuning/modules/awb/__init__.py b/utils/tuning/libtuning/modules/awb/__init__.py\nnew file mode 100644\nindex 000000000000..2d67f10cfc4f\n--- /dev/null\n+++ b/utils/tuning/libtuning/modules/awb/__init__.py\n@@ -0,0 +1,6 @@\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+#\n+# Copyright (C) 2024, Ideas On Board\n+\n+from libtuning.modules.awb.awb import AWB\n+from libtuning.modules.awb.rkisp1 import AWBRkISP1\ndiff --git a/utils/tuning/libtuning/modules/awb/awb.py b/utils/tuning/libtuning/modules/awb/awb.py\nnew file mode 100644\nindex 000000000000..c154cf3b8609\n--- /dev/null\n+++ b/utils/tuning/libtuning/modules/awb/awb.py\n@@ -0,0 +1,36 @@\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+#\n+# Copyright (C) 2024, Ideas On Board\n+\n+import logging\n+\n+from ..module import Module\n+\n+from libtuning.ctt_awb import awb\n+import numpy as np\n+\n+logger = logging.getLogger(__name__)\n+\n+\n+class AWB(Module):\n+    type = 'awb'\n+    hr_name = 'AWB (Base)'\n+    out_name = 'GenericAWB'\n+\n+    def __init__(self, *, debug: list):\n+        super().__init__()\n+\n+        self.debug = debug\n+\n+    def do_calculation(self, images):\n+        logger.info('Starting AWB calculation')\n+\n+        imgs = [img for img in images if img.macbeth is not None]\n+\n+        gains, _, _ = awb(imgs, None, None, False)\n+        gains = np.reshape(gains, (-1, 3))\n+\n+        return [{\n+                    'ct': int(v[0]),\n+                    'gains': [float(1.0 / v[1]), float(1.0 / v[2])]\n+                } for v in gains]\ndiff --git a/utils/tuning/libtuning/modules/awb/rkisp1.py b/utils/tuning/libtuning/modules/awb/rkisp1.py\nnew file mode 100644\nindex 000000000000..0c95843b83d3\n--- /dev/null\n+++ b/utils/tuning/libtuning/modules/awb/rkisp1.py\n@@ -0,0 +1,27 @@\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+#\n+# Copyright (C) 2024, Ideas On Board\n+#\n+# AWB module for tuning rkisp1\n+\n+from .awb import AWB\n+\n+import libtuning as lt\n+\n+\n+class AWBRkISP1(AWB):\n+    hr_name = 'AWB (RkISP1)'\n+    out_name = 'Awb'\n+\n+    def __init__(self, **kwargs):\n+        super().__init__(**kwargs)\n+\n+    def validate_config(self, config: dict) -> bool:\n+        return True\n+\n+    def process(self, config: dict, images: list, outputs: dict) -> dict:\n+        output = {}\n+\n+        output['colourGains'] = self.do_calculation(images)\n+\n+        return output\n",
    "prefixes": [
        "v6",
        "7/9"
    ]
}