Show a patch.

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

{
    "id": 27174,
    "url": "https://patchwork.libcamera.org/api/patches/27174/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27174/",
    "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": "<20260703122543.1991189-16-paul.elder@ideasonboard.com>",
    "date": "2026-07-03T12:25:21",
    "name": "[RFC,15/19] utils: tuning: libtuning: image: Enable images missing some metadata",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "5a6c622e7b0765687fa1def52a6c84d611760abe",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27174/mbox/",
    "series": [
        {
            "id": 6035,
            "url": "https://patchwork.libcamera.org/api/series/6035/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6035",
            "date": "2026-07-03T12:25:06",
            "name": "Add support for rkisp2",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6035/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/27174/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27174/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 B4B31C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jul 2026 12:26:54 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6D95465FED;\n\tFri,  3 Jul 2026 14:26:54 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8856E65FE2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jul 2026 14:26:53 +0200 (CEST)",
            "from neptunite.hamster-moth.ts.net (unknown\n\t[IPv6:2404:7a81:160:2100:a2cc:2f45:3bd7:2589])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AAED68E0;\n\tFri,  3 Jul 2026 14:26:04 +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=\"ttfNjBkn\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783081567;\n\tbh=FCiGnoB4Og2o4qyO7umIfuJjmc37YufL40KZPeR89kE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ttfNjBknqTHg0h/C2WNO675WYHhpjQT3qFIhzvr0TVMO/rie7VWUjW//X2gXhkWtf\n\tOsgTjG5iP+siuZqhcNSuavKJoopbHQKA+Jsp/Tyc4nsqZPF1IhPV8lu8o8Aam7E4Au\n\tTFVs++NxFnucrBcFdtMk9+OzaPxHv4zxxyBlADsU=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "laurent.pinchart@ideasonboard.com",
        "Cc": "Paul Elder <paul.elder@ideasonboard.com>, michael.riesch@collabora.com, \n\txuhf@rock-chips.com, stefan.klug@ideasonboard.com,\n\tkieran.bingham@ideasonboard.com, dan.scally@ideasonboard.com,\n\tjacopo.mondi@ideasonboard.com, nicolas.dufresne@collabora.com,\n\tlibcamera-devel@lists.libcamera.org",
        "Subject": "[RFC PATCH 15/19] utils: tuning: libtuning: image: Enable images\n\tmissing some metadata",
        "Date": "Fri,  3 Jul 2026 21:25:21 +0900",
        "Message-ID": "<20260703122543.1991189-16-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.47.2",
        "In-Reply-To": "<20260703122543.1991189-1-paul.elder@ideasonboard.com>",
        "References": "<20260703122543.1991189-1-paul.elder@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": "Some pipeline handlers, like the rkisp2 pipeline handler, are capable of\ntaking raw images but cannot set:\n- exposure time\n- gain\n- black level\nyet as they have not been implemented for raw mode yet. Arguably black\nmode will never be supported in raw mode as it bypasses the ISP\ncompletely and black level subtraction is in the ISP.\n\nThis prevents the images from being used for tuning in the current\nlibtuning-based tuning scripts as it requires exposure time and iso and\nblack level, so modify libtuning to allow images with no exposure time\nand iso and black level.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n utils/tuning/libtuning/image.py | 25 ++++++++++++++++++++-----\n 1 file changed, 20 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/utils/tuning/libtuning/image.py b/utils/tuning/libtuning/image.py\nindex ecd334bdc67f..b1ada0d0867c 100644\n--- a/utils/tuning/libtuning/image.py\n+++ b/utils/tuning/libtuning/image.py\n@@ -70,12 +70,27 @@ class Image:\n         white = metadata[f'Exif.{subimage}.WhiteLevel'].value\n         self.sigbits = int(white).bit_length()\n         self.fmt = (self.sigbits - 4) // 2\n-        self.exposure = int(metadata[f'Exif.{photo}.ExposureTime'].value * 1000000)\n-        self.againQ8 = metadata[f'Exif.{photo}.ISOSpeedRatings'].value * 256 / 100\n-        self.againQ8_norm = self.againQ8 / 256\n+\n+        self.exposure = None\n+        exposure_key = f'Exif.{photo}.ExposureTime'\n+        if exposure_key in metadata:\n+            self.exposure = int(metadata[exposure_key].value * 1000000)\n+\n+        self.againQ8 = None\n+        self.againQ8_norm = None\n+        iso_key = f'Exif.{photo}.ISOSpeedRatings'\n+        if iso_key in metadata:\n+            self.againQ8 = metadata[iso_key].value * 256 / 100\n+            self.againQ8_norm = self.againQ8 / 256\n+\n+        self.blacklevel = 0\n+        self.blacklevel_16 = 0\n+        bl_key = f'Exif.{subimage}.BlackLevel'\n+        if bl_key in metadata:\n+            self.blacklevel = int(metadata[bl_key].value[0])\n+            self.blacklevel_16 = self.blacklevel << (16 - self.sigbits)\n+\n         self.camName = metadata['Exif.Image.Model'].value\n-        self.blacklevel = int(metadata[f'Exif.{subimage}.BlackLevel'].value[0])\n-        self.blacklevel_16 = self.blacklevel << (16 - self.sigbits)\n \n         # Channel order depending on bayer pattern\n         # The key is the order given by exif, where 0 is R, 1 is G, and 2 is B\n",
    "prefixes": [
        "RFC",
        "15/19"
    ]
}