Show a patch.

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

{
    "id": 24464,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/24464/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24464/",
    "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": "<20250925221708.7471-3-hansg@kernel.org>",
    "date": "2025-09-25T22:17:04",
    "name": "[v2,2/6] ipa: software_isp: AGC: Do not lower gain below 1.0",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0a08a8e5b5aca34c84a947bee03f6c3ebb4efebe",
    "submitter": {
        "id": 239,
        "url": "https://patchwork.libcamera.org/api/1.1/people/239/?format=api",
        "name": "Hans de Goede",
        "email": "hansg@kernel.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24464/mbox/",
    "series": [
        {
            "id": 5459,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5459/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5459",
            "date": "2025-09-25T22:17:02",
            "name": "ipa: software_isp: AGC: Fox AGC oscillation bug",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5459/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24464/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24464/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 55C2FC32A9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Sep 2025 22:17:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EFCCB6B5FE;\n\tFri, 26 Sep 2025 00:17:22 +0200 (CEST)",
            "from sea.source.kernel.org (sea.source.kernel.org\n\t[IPv6:2600:3c0a:e001:78e:0:1991:8:25])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F6BF6B5AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Sep 2025 00:17:15 +0200 (CEST)",
            "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby sea.source.kernel.org (Postfix) with ESMTP id 5AEEC455BE;\n\tThu, 25 Sep 2025 22:17:14 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 2C88DC4CEF0;\n\tThu, 25 Sep 2025 22:17:12 +0000 (UTC)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=kernel.org header.i=@kernel.org\n\theader.b=\"b5TJOizj\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1758838634;\n\tbh=GsN3qabD8oF/CaS4DCismqZlNWjuYJsUJrbdjorqqsM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=b5TJOizjxR+t+odZfyENHJxvzsa+cvVXzIM45WnzZjJRIJPHLElzwlwiZZ2wV61kN\n\tufUEEGpz5c6ppaRoYMAnnk//U2F3d0BlDMxXaFhtGQ2Z/bzMVpNtbhe33v0WQ++84W\n\tFH1Pu+NQKyK72+N/BnLjVHqvXrtUJIIz8WYmPinw8c97Gu6uvaVlpsl084gc9nxZ2Z\n\tONiwZXvbV/VU/40zXqZyCVUchdt9xsLz9Qy1WaEXakMmt2x0G34cDE4mJ10bGEvY/P\n\tYy7xQjimCTi7E+qUXf2pxU3BQKLlWalTMHWQMX3aKVDpcvdtm6R6lRPLqEoC5no+OZ\n\tS89yTSjRIN6ew==",
        "From": "Hans de Goede <hansg@kernel.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Hans de Goede <hansg@kernel.org>, Milan Zamazal <mzamazal@redhat.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH v2 2/6] ipa: software_isp: AGC: Do not lower gain below 1.0",
        "Date": "Fri, 26 Sep 2025 00:17:04 +0200",
        "Message-ID": "<20250925221708.7471-3-hansg@kernel.org>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20250925221708.7471-1-hansg@kernel.org>",
        "References": "<20250925221708.7471-1-hansg@kernel.org>",
        "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": "At the moment when the overall image brightness is considered too high\nthe AGC code will lower the gain all the way down to againMin before\nconsidering lowering the exposure.\n\nWhat should happen instead is lower the gain no lower than 1.0 and after\nthat lower the exposure instead of lowering the gain.\n\nOtherwise there might be a heavily overexposed image (e.g. all white)\nwhich then is made less white by a gain < 1.0 which is no good.\n\nWhen there is no sensor-helper, assume the driver reported default-gain\nvalue is close to a gain of 1.0 .\n\nWhile at it also remove the weird limitation to only lower the gain\nwhen exposure is set to the maximum. As long as the gain is higher\nthan the default gain, the gain should be lowered first.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nTested-by: Milan Zamazal <mzamazal@redhat.com>\nTested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Hans de Goede <hansg@kernel.org>\n---\nChanges in v2:\n- Use a gain of 1.0 as low-limit instead of always using the default-gain,\n  falling back to the default if there is no sensor-helper for the sensor.\n---\n src/ipa/simple/algorithms/agc.cpp | 3 +--\n src/ipa/simple/ipa_context.h      | 2 +-\n src/ipa/simple/soft_simple.cpp    | 3 +++\n 3 files changed, 5 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/ipa/simple/algorithms/agc.cpp b/src/ipa/simple/algorithms/agc.cpp\nindex c46bb0eb..1fc8d7f4 100644\n--- a/src/ipa/simple/algorithms/agc.cpp\n+++ b/src/ipa/simple/algorithms/agc.cpp\n@@ -71,8 +71,7 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou\n \t}\n \n \tif (exposureMSV > kExposureOptimal + kExposureSatisfactory) {\n-\t\tif (exposure == context.configuration.agc.exposureMax &&\n-\t\t    again > context.configuration.agc.againMin) {\n+\t\tif (again > context.configuration.agc.again10) {\n \t\t\tnext = again * kExpNumeratorDown / kExpDenominator;\n \t\t\tif (again - next < context.configuration.agc.againMinStep)\n \t\t\t\tagain -= context.configuration.agc.againMinStep;\ndiff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\nindex a471b80a..468fccab 100644\n--- a/src/ipa/simple/ipa_context.h\n+++ b/src/ipa/simple/ipa_context.h\n@@ -28,7 +28,7 @@ struct IPASessionConfiguration {\n \tfloat gamma;\n \tstruct {\n \t\tint32_t exposureMin, exposureMax;\n-\t\tdouble againMin, againMax, againMinStep;\n+\t\tdouble againMin, againMax, again10, againMinStep;\n \t\tutils::Duration lineDuration;\n \t} agc;\n \tstruct {\ndiff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex e70439ee..b147aca2 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -216,10 +216,12 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n \n \tint32_t againMin = gainInfo.min().get<int32_t>();\n \tint32_t againMax = gainInfo.max().get<int32_t>();\n+\tint32_t againDef = gainInfo.def().get<int32_t>();\n \n \tif (camHelper_) {\n \t\tcontext_.configuration.agc.againMin = camHelper_->gain(againMin);\n \t\tcontext_.configuration.agc.againMax = camHelper_->gain(againMax);\n+\t\tcontext_.configuration.agc.again10 = camHelper_->gain(1.0);\n \t\tcontext_.configuration.agc.againMinStep =\n \t\t\t(context_.configuration.agc.againMax -\n \t\t\t context_.configuration.agc.againMin) /\n@@ -246,6 +248,7 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\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",
    "prefixes": [
        "v2",
        "2/6"
    ]
}