Show a patch.

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

{
    "id": 25625,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/25625/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25625/",
    "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": "<20260105-softisp-agc-v3-1-434f2053c549@mainlining.org>",
    "date": "2026-01-05T13:57:44",
    "name": "[v3] ipa: simple: fix minimal analog gain init",
    "commit_ref": "98e5e561502bdff0da6e58fe265846906bf72816",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d7a89ad8e7b3236cd683660548f7a84a0f3e299f",
    "submitter": {
        "id": 255,
        "url": "https://patchwork.libcamera.org/api/1.1/people/255/?format=api",
        "name": "Vasiliy Doylov",
        "email": "nekocwd@mainlining.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25625/mbox/",
    "series": [
        {
            "id": 5684,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5684/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5684",
            "date": "2026-01-05T13:57:44",
            "name": "[v3] ipa: simple: fix minimal analog gain init",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/5684/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25625/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25625/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 80EF1BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Jan 2026 13:57:50 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7AE5661F9F;\n\tMon,  5 Jan 2026 14:57:49 +0100 (CET)",
            "from mail.mainlining.org (mail.mainlining.org [5.75.144.95])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B55761F35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Jan 2026 14:57:47 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=mainlining.org header.i=@mainlining.org\n\theader.b=\"Z4BfCbKt\"; \n\tdkim=permerror (0-bit key) header.d=mainlining.org\n\theader.i=@mainlining.org header.b=\"cROYHTk8\"; \n\tdkim-atps=neutral",
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; s=202507r; d=mainlining.org;\n\tc=relaxed/relaxed; \n\th=To:Message-Id:Subject:Date:From; t=1767621466;\n\tbh=P6aC8/wJfDc3eZbabp7oMGX hXk1z3n/2GtV14rcaiuo=;\n\tb=Z4BfCbKt/tPOdMmv1UiVDes8qhS4oFJI/bC+HgexWKedSOTaer\n\t0yhyvw45wh3IbLEZ3UZ8YWSNG00qvPGtyrjT+HpOeF+O45NNmZ0kfIFDBOJWlk00I8NWzg+mKVR\n\tkCJ4pwphT8qaqSfnun26A7FPZT9T1V0g/qXWnhgrv2yw3LGES6nRstFZyxKTYbJElh1pPtMtcfE\n\tdz77z00GZ+f5wrO6dL8Whx/BYfruVQ6cAalnZxIWTN9XBhtQfYJZQM9Ix9KKf7PFTyWbLScK9Zi\n\tACePFwZiJjsGLs0K5lrWrvDAOkrUuMDfjXenPtnpR/hjl+ocyyEuXDw7PlzZvbP3cug==;",
            "v=1; a=ed25519-sha256; s=202507e; d=mainlining.org;\n\tc=relaxed/relaxed; \n\th=To:Message-Id:Subject:Date:From; t=1767621466;\n\tbh=P6aC8/wJfDc3eZbabp7oMGX hXk1z3n/2GtV14rcaiuo=;\n\tb=cROYHTk83khw3tq98snCwVNxguihUEmDUXE05qZopDKVbDwU+H\n\tcOnO5Lz+icW5fNZKds3eBmy9KLlG9dCnuhBA==;"
        ],
        "From": "Vasiliy Doylov <nekocwd@mainlining.org>",
        "Date": "Mon, 05 Jan 2026 16:57:44 +0300",
        "Subject": "[PATCH v3] ipa: simple: fix minimal analog gain init",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260105-softisp-agc-v3-1-434f2053c549@mainlining.org>",
        "X-B4-Tracking": "v=1; b=H4sIAFfDW2kC/33MSwrCMBSF4a2UOzaSh0ltR+5DHMTm0QualKQEp\n\tXTvpp0qDv8D51sg24Q2Q98skGzBjDHUEIcGhlEHbwma2sApV5RRSXJ0M+aJaD8Qpgxlw10Yfeq\n\tgPqZkHb527XqrPWKeY3rveGHb+tspjDDStoorSeVZCn15agwPDBj8MSYPG1b4H4BXoKNMWNUJ5\n\t4z8AtZ1/QDK3NxC7AAAAA==",
        "X-Change-ID": "20260105-softisp-agc-16d01cb3da49",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Vasiliy Doylov <nekocwd@mainlining.org>",
        "X-Mailer": "b4 0.14.3",
        "X-Developer-Signature": "v=1; a=openpgp-sha256; l=2700;\n\ti=nekocwd@mainlining.org; h=from:subject:message-id;\n\tbh=s0qQ1gzIuIiwsI8h3KTDHwEJsYF25Y1Uk//f/fs9mRU=;\n\tb=owGbwMvMwCXGd//xporA/cmMp9WSGDKjD0fN0L1+5Xu6nqUXc77tn6mLNZW7N6nmxvpYVulF9\n\txtejS3sKGVhEONikBVTZPlvuEjuwA1lz7rc1Gcwc1iZQIYwcHEKwESyvzD8L8hP6do+p/7p2t18\n\tS48W8MUteXawnNfi/U/9NTmlXhrfMxn+R0/8MMmihz1Oit9JrUNx7dv/Nd9vJZ41iXVZ4rX8qud\n\tSdgA=",
        "X-Developer-Key": "i=nekocwd@mainlining.org; a=openpgp;\n\tfpr=FF31A21EC0D823497E6D65E60EDFE3B27851BF63",
        "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": "On most imx sensors the formula seems to be:\n\nagain_float = 512.0 / (512.0 - again_ctrl_value)\n\nSo the minimum again of 0 makes sense and actually translates to a gain of 1.0.\nAnd the max gain of 400 leads to 512.0 / 112.0 = 4.57 which is about typical for\na maximum again. Since a minimum again value of 0 is actually normal, the special\nhandling of againMin == 0 is undesirable and this is actually causing problems\non these IMX sensors. again10 correctly gets set to 0 which is less then the\nadjusted againMin which causes the AGC code to not work properly.\n\nFix this by dropping the special handling of againMin == 0.\n\nSigned-off-by: Vasiliy Doylov <nekocwd@mainlining.org>\n---\nChanges in v3:\n- Expanded commit message\n- Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056068.html\n\nChanges in v2:\n- Drop old solution\n- Fix minimal analog gain initialisation\n- Link to v1: https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056045.html\n---\n src/ipa/simple/soft_simple.cpp | 19 +------------------\n 1 file changed, 1 insertion(+), 18 deletions(-)\n\n\n---\nbase-commit: 2861817f09c96a0660b88783eff159631e42030f\nchange-id: 20260105-softisp-agc-16d01cb3da49\n\nBest regards,",
    "diff": "diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex b147aca2..dde11666 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -237,26 +237,9 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n \t\t\t\tcamHelper_->blackLevel().value() / 256;\n \t\t}\n \t} else {\n-\t\t/*\n-\t\t * The camera sensor gain (g) is usually not equal to the value written\n-\t\t * into the gain register (x). But the way how the AGC algorithm changes\n-\t\t * the gain value to make the total exposure closer to the optimum\n-\t\t * assumes that g(x) is not too far from linear function. If the minimal\n-\t\t * gain is 0, the g(x) is likely to be far from the linear, like\n-\t\t * g(x) = a / (b * x + c). To avoid unexpected changes to the gain by\n-\t\t * the AGC algorithm (abrupt near one edge, and very small near the\n-\t\t * other) we limit the range of the gain values used.\n-\t\t */\n \t\tcontext_.configuration.agc.againMax = againMax;\n \t\tcontext_.configuration.agc.again10 = againDef;\n-\t\tif (againMin) {\n-\t\t\tcontext_.configuration.agc.againMin = againMin;\n-\t\t} else {\n-\t\t\tLOG(IPASoft, Warning)\n-\t\t\t\t<< \"Minimum gain is zero, that can't be linear\";\n-\t\t\tcontext_.configuration.agc.againMin =\n-\t\t\t\tstd::min(100, againMin / 2 + againMax / 2);\n-\t\t}\n+\t\tcontext_.configuration.agc.againMin = againMin;\n \t\tcontext_.configuration.agc.againMinStep = 1.0;\n \t}\n \n",
    "prefixes": [
        "v3"
    ]
}