Show a patch.

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

{
    "id": 24782,
    "url": "https://patchwork.libcamera.org/api/patches/24782/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24782/",
    "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": "<20251024085130.995967-17-stefan.klug@ideasonboard.com>",
    "date": "2025-10-24T08:50:40",
    "name": "[v1,16/35] ipa: rkisp1: agc: Process frame duration at the right time",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e83833c5ed4b7fd0f019a9e780abfb666470c57f",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24782/mbox/",
    "series": [
        {
            "id": 5524,
            "url": "https://patchwork.libcamera.org/api/series/5524/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5524",
            "date": "2025-10-24T08:50:24",
            "name": "rkisp1: pipeline rework for PFC",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5524/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24782/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24782/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 18521C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Oct 2025 08:52:27 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D1648608C7;\n\tFri, 24 Oct 2025 10:52:26 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 65549608C3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Oct 2025 10:52:25 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:7edc:62f4:c118:1549])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id CFDA921D0; \n\tFri, 24 Oct 2025 10:50:39 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"PWa59Yl3\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761295839;\n\tbh=StDPAkMOQOA6KWKzAM3YzShSQyu0YbgvwZMApLh/oac=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=PWa59Yl3A66Xj1gH6KJDzAJYAbOBbphoGX8/8K+6cnJSpr+sNNRJhN/EejKtEP3Su\n\tK3PSLwkISGLva1JMJ1KeB0JNk2s1rjUk7VA+4m9tYoyE4bgqlr7xrffuP5vw3aaJfx\n\tZKOdlrIxSt8ehQAvAVVNhPrdGQhELHxsMvWajMlY=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v1 16/35] ipa: rkisp1: agc: Process frame duration at the\n\tright time",
        "Date": "Fri, 24 Oct 2025 10:50:40 +0200",
        "Message-ID": "<20251024085130.995967-17-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.48.1",
        "In-Reply-To": "<20251024085130.995967-1-stefan.klug@ideasonboard.com>",
        "References": "<20251024085130.995967-1-stefan.klug@ideasonboard.com>",
        "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": "The frame duration and vblank should not be calculated during process()\nbut within prepare(), where the data for that frame get's computed.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 20 ++++++++++----------\n src/ipa/rkisp1/algorithms/agc.h   |  3 +--\n 2 files changed, 11 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex c67106339ef8..5ce77b7672f2 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -383,6 +383,12 @@ void Agc::prepare(IPAContext &context, const uint32_t frame,\n \n \tframeContext.agc.yTarget = context.activeState.agc.automatic.yTarget;\n \n+\t/*\n+\t * Expand the target frame duration so that we do not run faster than\n+\t * the minimum frame duration when we have short exposures.\n+\t */\n+\tprocessFrameDuration(context, frameContext);\n+\n \tif (frame > 0 && !frameContext.agc.updateMetering)\n \t\treturn;\n \n@@ -511,11 +517,13 @@ double Agc::estimateLuminance(double gain) const\n  * Compute and populate vblank from the target frame duration.\n  */\n void Agc::processFrameDuration(IPAContext &context,\n-\t\t\t       IPAFrameContext &frameContext,\n-\t\t\t       utils::Duration frameDuration)\n+\t\t\t       IPAFrameContext &frameContext)\n {\n \tIPACameraSensorInfo &sensorInfo = context.sensorInfo;\n \tutils::Duration lineDuration = context.configuration.sensor.lineDuration;\n+\tutils::Duration frameDuration = frameContext.agc.exposure * lineDuration;\n+\n+\tframeDuration = std::max(frameDuration, frameContext.agc.minFrameDuration);\n \n \tframeContext.agc.vblank = (frameDuration / lineDuration) - sensorInfo.outputSize.height;\n \n@@ -539,8 +547,6 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t  ControlList &metadata)\n {\n \tif (!stats) {\n-\t\tprocessFrameDuration(context, frameContext,\n-\t\t\t\t     frameContext.agc.minFrameDuration);\n \t\tfillMetadata(context, frameContext, metadata);\n \t\treturn;\n \t}\n@@ -641,12 +647,6 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \tactiveState.agc.automatic.gain = aGain;\n \tactiveState.agc.automatic.quantizationGain = qGain;\n \tactiveState.agc.automatic.yTarget = effectiveYTarget();\n-\t/*\n-\t * Expand the target frame duration so that we do not run faster than\n-\t * the minimum frame duration when we have short exposures.\n-\t */\n-\tprocessFrameDuration(context, frameContext,\n-\t\t\t     std::max(frameContext.agc.minFrameDuration, newExposureTime));\n \n \tfillMetadata(context, frameContext, metadata);\n \texpMeans_ = {};\ndiff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\nindex 7867eed9c4e3..4432711f43af 100644\n--- a/src/ipa/rkisp1/algorithms/agc.h\n+++ b/src/ipa/rkisp1/algorithms/agc.h\n@@ -51,8 +51,7 @@ private:\n \t\t\t  ControlList &metadata);\n \tdouble estimateLuminance(double gain) const override;\n \tvoid processFrameDuration(IPAContext &context,\n-\t\t\t\t  IPAFrameContext &frameContext,\n-\t\t\t\t  utils::Duration frameDuration);\n+\t\t\t\t  IPAFrameContext &frameContext);\n \n \tSpan<const uint8_t> expMeans_;\n \tSpan<const uint8_t> weights_;\n",
    "prefixes": [
        "v1",
        "16/35"
    ]
}