Show a patch.

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

{
    "id": 19531,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19531/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19531/",
    "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": "<20240223155954.4139705-4-kieran.bingham@ideasonboard.com>",
    "date": "2024-02-23T15:59:54",
    "name": "[3/3] libipa: camera_sensor_helper: Fix rounding of gainCode",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "88c43d51d5955699d4076ccda69051fbf355c030",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19531/mbox/",
    "series": [
        {
            "id": 4177,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4177/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4177",
            "date": "2024-02-23T15:59:51",
            "name": "libipa: Fix CameraSensorHelper gain helpers",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4177/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19531/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19531/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 EB851C32C3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Feb 2024 16:00:03 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E427E62866;\n\tFri, 23 Feb 2024 17:00:02 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 23D7E62816\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Feb 2024 16:59:59 +0100 (CET)",
            "from Monstersaurus.local\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AF9FD2E7;\n\tFri, 23 Feb 2024 16:59:49 +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=\"TVUBMTq1\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1708703989;\n\tbh=Y3YxmmeF46WG/5fwXqKKqRGzQJss5z0d9THRQASv5KY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=TVUBMTq1MC1GjEyytvg1BstwwaNUSmwz8Gf0/giYRzx/5equ392c0lQcCLEKKf4xp\n\t1Z8IzPIwUzgBJiOzDRlJpFkksipB9QqeybKA9A1gM3fOfQgtl8ZUtRUb2tc2nJB1o5\n\tc9MOH/ysezITDgcmMJ7zhT2k85wbwIR+1qj1UZyA=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Subject": "[PATCH 3/3] libipa: camera_sensor_helper: Fix rounding of gainCode",
        "Date": "Fri, 23 Feb 2024 15:59:54 +0000",
        "Message-Id": "<20240223155954.4139705-4-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240223155954.4139705-1-kieran.bingham@ideasonboard.com>",
        "References": "<20240223155954.4139705-1-kieran.bingham@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": "The implementation of gainCode for both Exponential and Linear gain\nmodels does not generate a gainCode that matches the result of the\nreverse operation.\n\nThis can be seen by converting sequential gainCodes to a gain\nand converting that back to the gainCode. The values do not\ntranslate back due to rounding errors.\n\nCorrect the rounding error and ensure that gainCode translation\nproduces accurate bi-directional conversions from the perspective\nof the gainCode.\n\nThis fixes the IMX290, IMX296, IMX327 and IMX335 which use the\nExponential gain model helpers, as well as IMX219 IMX258 and IMX477\nwhich use the Linear gain model helpers.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/libipa/camera_sensor_helper.cpp | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp\nindex a925b37b9f7c..39e10d86a2c7 100644\n--- a/src/ipa/libipa/camera_sensor_helper.cpp\n+++ b/src/ipa/libipa/camera_sensor_helper.cpp\n@@ -64,13 +64,13 @@ uint32_t CameraSensorHelper::gainCode(double gain) const\n \tcase AnalogueGainLinear:\n \t\tASSERT(k.linear.m0 == 0 || k.linear.m1 == 0);\n \n-\t\treturn (k.linear.c0 - k.linear.c1 * gain) /\n-\t\t       (k.linear.m1 * gain - k.linear.m0);\n+\t\treturn std::round((k.linear.c0 - k.linear.c1 * gain) /\n+\t\t\t\t  (k.linear.m1 * gain - k.linear.m0));\n \n \tcase AnalogueGainExponential:\n \t\tASSERT(k.exp.a != 0 && k.exp.m != 0);\n \n-\t\treturn std::log2(gain / k.exp.a) / k.exp.m;\n+\t\treturn std::round(std::log2(gain / k.exp.a) / k.exp.m);\n \n \tdefault:\n \t\tASSERT(false);\n",
    "prefixes": [
        "3/3"
    ]
}