Show a patch.

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

{
    "id": 22224,
    "url": "https://patchwork.libcamera.org/api/patches/22224/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22224/",
    "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": "<20241206145242.827886-8-stefan.klug@ideasonboard.com>",
    "date": "2024-12-06T14:52:27",
    "name": "[v5,7/8] libtuning: Add initial AWB module",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f590dff36771a9ade7faabb0796e7914538b592c",
    "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/22224/mbox/",
    "series": [
        {
            "id": 4857,
            "url": "https://patchwork.libcamera.org/api/series/4857/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4857",
            "date": "2024-12-06T14:52:20",
            "name": "rkisp1: Add manual colour temperature control",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/4857/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22224/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22224/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 C1EACBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Dec 2024 14:53:08 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 76E9F67E21;\n\tFri,  6 Dec 2024 15:53:08 +0100 (CET)",
            "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 3583E66179\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Dec 2024 15:53:07 +0100 (CET)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:3543:aebe:e043:ef86])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B7C92641;\n\tFri,  6 Dec 2024 15:52:37 +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=\"Me5HeoLj\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733496757;\n\tbh=oG9BRNds5/JmYJBTC/Vd4tha/uR9fHvsfr7GftDGUWM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Me5HeoLjircsGSNxTwOfKbndmMpNXbCGuyxJVce/sqdx1csxXCVK2SFs92bK7GhCT\n\tVhahTZdwyPzU6U3D16uJvFgJlfacyv71agI72lCrh/Netlg3HnwHT25Yf0iMzq9frh\n\t4dVx3uhbJpPZb2PF7F3g/FqHOzfe8HsOi25eGHRM=",
        "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 v5 7/8] libtuning: Add initial AWB module",
        "Date": "Fri,  6 Dec 2024 15:52:27 +0100",
        "Message-ID": "<20241206145242.827886-8-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20241206145242.827886-1-stefan.klug@ideasonboard.com>",
        "References": "<20241206145242.827886-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..e3ddeb50c9a1\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['gains'] = self.do_calculation(images)\n+\n+        return output\n",
    "prefixes": [
        "v5",
        "7/8"
    ]
}