Show a patch.

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

{
    "id": 25624,
    "url": "https://patchwork.libcamera.org/api/patches/25624/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25624/",
    "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": "<20260105-softisp-agc-v2-1-9013e693ffd5@mainlining.org>",
    "date": "2026-01-05T12:41:35",
    "name": "[v2] ipa: simple: fix minimal analog gain init",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d7a89ad8e7b3236cd683660548f7a84a0f3e299f",
    "submitter": {
        "id": 255,
        "url": "https://patchwork.libcamera.org/api/people/255/?format=api",
        "name": "Vasiliy Doylov",
        "email": "nekocwd@mainlining.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25624/mbox/",
    "series": [
        {
            "id": 5683,
            "url": "https://patchwork.libcamera.org/api/series/5683/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5683",
            "date": "2026-01-05T12:41:35",
            "name": "[v2] ipa: simple: fix minimal analog gain init",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5683/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25624/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25624/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 0BA68BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Jan 2026 12:41:39 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D94FA61FBF;\n\tMon,  5 Jan 2026 13:41:37 +0100 (CET)",
            "from mail.mainlining.org (mail.mainlining.org [5.75.144.95])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 437EA61F35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Jan 2026 13:41:36 +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=\"gxdN1j6R\"; \n\tdkim=permerror (0-bit key) header.d=mainlining.org\n\theader.i=@mainlining.org header.b=\"LJG+v2d+\"; \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=1767616895;\n\tbh=YHjvv4w3CRFhovlni3IRLXD OklS5XYPkV8hcn+7u9ug=;\n\tb=gxdN1j6RRdj0pLpP1PlH+47V6VIfXuuKD+O8xt5YFWkchsC/uA\n\tb7NAnWWYCZK9mVJ057VO1u9SpBnqGCLdBrX5VzDDH/AFPDYOWT9KohqmWAlYEDQRQOCADLtYIKZ\n\t6YuRySTvCm3o3xBan7RXpylsi36JFGfxs2SSiCBnhxk0Bv9I2LxNuAt7O4L3oWAahIoTGdNziou\n\tkrK0TuTWaAThSIMDAk10recOP+Q34QcLJ1fILAjYiVKbV3D9gY0a0JcDzo6up3XgONsEuEaWMtc\n\tnY+aTyEUSeUuuqRaWNZtrgoRvpDlwasiDFefenuN84ywCIQ1PJQjmDrpeSISykOMFJA==;",
            "v=1; a=ed25519-sha256; s=202507e; d=mainlining.org;\n\tc=relaxed/relaxed; \n\th=To:Message-Id:Subject:Date:From; t=1767616895;\n\tbh=YHjvv4w3CRFhovlni3IRLXD OklS5XYPkV8hcn+7u9ug=;\n\tb=LJG+v2d+0s2/1ibRPtx6GJCtCNwTn5C4a6tQEu3S4QHau/Q4cs\n\tu/gfhKNjvp4b3oNn/HUdVjISTtQsMPyYT7Bw==;"
        ],
        "From": "Vasiliy Doylov <nekocwd@mainlining.org>",
        "Date": "Mon, 05 Jan 2026 15:41:35 +0300",
        "Subject": "[PATCH v2] 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-v2-1-9013e693ffd5@mainlining.org>",
        "X-B4-Tracking": "v=1; b=H4sIAH6xW2kC/23MQQ7CIBCF4as0s3YMUKHqynuYLhAonUShgYZoG\n\tu4udu3yf8n7Nsgukctw7TZIrlCmGFqIQwdm1sE7JNsaBBOKcSYxx2mlvKD2BrmyjJtHb/XpAu2\n\txJDfRe9fuY+uZ8hrTZ8cL/63/ncKR4zAooSSTZ9nr20tTeFKg4I8xeRhrrV8dsD6DqwAAAA==",
        "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=2204;\n\ti=nekocwd@mainlining.org; h=from:subject:message-id;\n\tbh=s8L2NzmuwKOGjyJ/vr3euP0ERdEOlXZdojkxgKWJNDA=;\n\tb=owGbwMvMwCXGd//xporA/cmMp9WSGDKjN9YH6K7/r/DDO/LT59jOiApelutOXg95A/5on8+p4\n\tfzJXXeho5SFQYyLQVZMkeW/4SK5AzeUPetyU5/BzGFlAhnCwMUpABPJC2T4H11vuVZt28yXzLYT\n\tyoJ39hiI5p/TeK/Cp+R4NN/SKHLxSYb//g4SSzXUJtQHJKt+PXtA4nnGsfmJrVpzNi3uTbjds/4\n\tzDwA=",
        "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 default 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 max sensor gain.\n\nSigned-off-by: Vasiliy Doylov <nekocwd@mainlining.org>\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": [
        "v2"
    ]
}