Show a patch.

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

{
    "id": 26786,
    "url": "https://patchwork.libcamera.org/api/patches/26786/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26786/",
    "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": "<20260520084631.3440-1-david.plowman@raspberrypi.com>",
    "date": "2026-05-20T08:44:51",
    "name": "[v1] ipa: rpi: agc: Clamp digital gain to avoid saturation issues",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e75fceb7b3da88c9de94e0cf81ccd2cd569035ed",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26786/mbox/",
    "series": [
        {
            "id": 5958,
            "url": "https://patchwork.libcamera.org/api/series/5958/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5958",
            "date": "2026-05-20T08:44:51",
            "name": "[v1] ipa: rpi: agc: Clamp digital gain to avoid saturation issues",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5958/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26786/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26786/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 22776BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 May 2026 08:46:36 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CCFCB62FEC;\n\tWed, 20 May 2026 10:46:35 +0200 (CEST)",
            "from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A97762FB1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 May 2026 10:46:34 +0200 (CEST)",
            "by mail-wm1-x331.google.com with SMTP id\n\t5b1f17b1804b1-48984d29fe3so50773695e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 May 2026 01:46:34 -0700 (PDT)",
            "from davidp-pi5.pitowers.org\n\t([2a00:1098:3142:1f:88ea:c658:5b20:5e46])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-48fe5cab818sm397888535e9.14.2026.05.20.01.46.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 20 May 2026 01:46:33 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"VLi5gl+u\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1779266793; x=1779871593;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=0TNnQQuRZgvX93hig0Bt1QH7dApXyB7b9HO3dA6S3zw=;\n\tb=VLi5gl+uKzgprQG0mEdkonhMhlgjHcB7bHbk6/re1ixFekazD9RhCHn4vFtHQVv9u6\n\t64pr/5wAsEgMlix/SWDh8nAhPCS6PeVI3rHZC2AkYf0z03nS/BpI/c13DV3ba1GYn30d\n\tpvSGhx1vjs+vrc8x04ZlWq4cUlDMetLnFeChbsmdeNM4spvXAThO4fXq/9AQXz3wLgfa\n\tK/DfUalDyrqRIbxdKGG7yd3Su0AJNs0JgeIlJKCJ/Cl35F1e3txVFsFrEm8d0RusIK/r\n\ttDniWNmeH+cWlZ1Klr59de2LGE08m4ClxX7p2GBB2hu/QhoGzlqNwxxEZIXS6ztP8fZS\n\tw/yg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1779266793; x=1779871593;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=0TNnQQuRZgvX93hig0Bt1QH7dApXyB7b9HO3dA6S3zw=;\n\tb=GCINPzsld42FvWc3qjVrxaHP5j5cLm51aLb+WPcyamBNg9nstZHSkWKZ8IcFiaeJDe\n\tcIRkDXbtvovVKqQORmk7XahNsxr6qm6NAmO7FJy+UHdD5qe879uFFPG7WXuP0ibtcQyp\n\thL3lZxn8fdNTrqMCwlymM2CdqKL+aGmcADYZVYoHUruF8cLazuo4g1yPfiGNY3PrmGq7\n\tWhA9s89qC9nhkNEltkxuOoB24kuUe8/QBvxhqBPDmki/lS49zwZN1wiJ/cBA//SYSwxe\n\t6JDpVrP04CIGkIxLVr/E+kmEGtrL4zZm+jSeaS95/cHIas7CFyvz+WvevUyrwhfFAFiA\n\t6SQw==",
        "X-Gm-Message-State": "AOJu0YwUwMwOndJPhohzLS9jHNlhnWi86kN2ebStcJGGoiMj9uOCuDef\n\tdsMAA66BSHOB8gbw+Lf9/vucX0YKsQCw0CvtjeKISL2lGBHSDzZ1Kh749eDXmqTW2gA7m1sPee4\n\tUjBo/V6c=",
        "X-Gm-Gg": "Acq92OF+lOzD7BW22bPZIQVfNMNTnU/ojmXgsS/NTVDW1bP+VyvoA66WtX93sNJ+VyE\n\tSft/q5HRvbQu7sJAa4M81abW9IUp2fXC92wf4c3lkYcPwkQQAdrxK3HpbEnB0YAuAQQ6xtX3YLS\n\tOclGPOTHV8fOZJZsiLfPZbasJ59iAB1G/yv6rUs9Vg8S816K1ioOhmS77ccP0vSxJnrcK3XCJbS\n\tandv2//dN2Fv09g+lRyD2ozLNXscW/MOidzQpNrMG60I2QLt5XrlrjYGR3ErLTUM9FmObwYX5Cl\n\t9KOGHwKdnvXdA7zFsaewWdJ6iDVsV9Igd4PbXgiSrEXRz0DkytEmMaIGLXmVek3WmPXqt/qGEMp\n\tYvQvwomCHJxZDNDbEv7lJi/2q353AU6c48CpYkoQsb18O368NarhItGNbkdKIgZXB4KMLU+YiQf\n\tSgsAw42NbvtLA6jbCv83lrVnrq8DUrugmQMEEMlh3dbmrZB4qrGV8Cw7KRDQGS0jLmm3TeKJa0w\n\tfxB8LhqmNN6xIom3lthtYwdR/OYktVOQDNXt8RSwjnEkqb4gunwVntVDc7YQwg=",
        "X-Received": "by 2002:a05:600c:a406:b0:48e:82cc:4d4c with SMTP id\n\t5b1f17b1804b1-48fe6514939mr280677245e9.23.1779266793299; \n\tWed, 20 May 2026 01:46:33 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "David Plowman <david.plowman@raspberrypi.com>",
        "Subject": "[PATCH v1] ipa: rpi: agc: Clamp digital gain to avoid saturation\n\tissues",
        "Date": "Wed, 20 May 2026 09:44:51 +0100",
        "Message-ID": "<20260520084631.3440-1-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.47.3",
        "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": "Digital gain is used to adjust overall image exposure when the target\nexposure cannot be achieved (for example, cannot go high enough). But\nwhen the target exposure is lower than we can achieve, the digital\ngain was being set to values less than unity, causing saturation\nproblems.\n\nThe fix is simply to clamp the digital gain at the bottom to 1.0,\nresulting in images that, while \"too bright\", saturate correctly.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/rpi/controller/rpi/agc_channel.cpp | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp\nindex cf0e77bd..c9462eed 100644\n--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp\n+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n@@ -941,8 +941,8 @@ void AgcChannel::divideUpExposure()\n \t/* Finally work out the digital gain that we will need. */\n \tfiltered_.totalExposureNoDG = analogueGain * exposureTime;\n \tdouble digitalGain = filtered_.totalExposure / filtered_.totalExposureNoDG;\n-\t/* Limit dg by what is allowed. */\n-\tdigitalGain = std::min(digitalGain, config_.maxDigitalGain);\n+\t/* Limit dg by what is allowed (and to 1.0 to avoid saturation issues). */\n+\tdigitalGain = std::clamp(digitalGain, 1.0, config_.maxDigitalGain);\n \t/* Update total exposure, in case the dg went down. */\n \tfiltered_.totalExposure = filtered_.totalExposureNoDG * digitalGain;\n \n",
    "prefixes": [
        "v1"
    ]
}