Show a patch.

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

{
    "id": 24480,
    "url": "https://patchwork.libcamera.org/api/patches/24480/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24480/",
    "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": "<20250927180004.84620-3-hansg@kernel.org>",
    "date": "2025-09-27T18:00:00",
    "name": "[v3,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/people/239/?format=api",
        "name": "Hans de Goede",
        "email": "hansg@kernel.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24480/mbox/",
    "series": [
        {
            "id": 5462,
            "url": "https://patchwork.libcamera.org/api/series/5462/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5462",
            "date": "2025-09-27T17:59:58",
            "name": "ipa: software_isp: AGC: Fox AGC oscillation bug",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/5462/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24480/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24480/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 3BA97BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Sep 2025 18:00:21 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 929F46B5F0;\n\tSat, 27 Sep 2025 20:00:18 +0200 (CEST)",
            "from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C938E6B5FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Sep 2025 20:00:11 +0200 (CEST)",
            "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id D6BFE601AA;\n\tSat, 27 Sep 2025 18:00:10 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 758CDC4CEF8;\n\tSat, 27 Sep 2025 18:00:09 +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=\"nN+Z3ZMk\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1758996010;\n\tbh=GsN3qabD8oF/CaS4DCismqZlNWjuYJsUJrbdjorqqsM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=nN+Z3ZMkgWIIiDG/4TZD3DJkAQIHnLhRJaFn7OnyLXIODoNemlDqcfPK3IHDs9kPM\n\tam2bZ4EmRru+NZTWMWor/R6hySXYdGqWz2iD5sTnaEjCTbVzMaY3tOwhHn1iMg7LDg\n\tFWCnAk4p4MeUUGfbmhJhNBvUx+hC7unh29GRxIuyTDRJxPUObPlh21QZOHBy9waChq\n\tINeJiJ33F1ETeTk0Oa6l57SzDoTtfS2VKxMvzMVYzlhxakh2lY7qw1LBHAJ2qWemOQ\n\tOfcdw5242bKkrDvLUm9e1pR+YbwLo7ieGZujG5iF8XxXcrErUtX19fUUjrFpGndGkp\n\tW9Nk4d5tTnsQA==",
        "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 v3 2/6] ipa: software_isp: AGC: Do not lower gain below 1.0",
        "Date": "Sat, 27 Sep 2025 20:00:00 +0200",
        "Message-ID": "<20250927180004.84620-3-hansg@kernel.org>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20250927180004.84620-1-hansg@kernel.org>",
        "References": "<20250927180004.84620-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": [
        "v3",
        "2/6"
    ]
}