Show a patch.

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

{
    "id": 19852,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19852/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19852/",
    "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": "<20240405144729.2992219-3-paul.elder@ideasonboard.com>",
    "date": "2024-04-05T14:47:26",
    "name": "[2/5] ipa: rkisp1: agc: Add digital gain",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6da1010286504e5e75d9525a4fce0528065ed8a0",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19852/mbox/",
    "series": [
        {
            "id": 4251,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4251/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4251",
            "date": "2024-04-05T14:47:24",
            "name": "ipa: rkisp1: Improve AGC (plumbing)",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4251/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19852/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19852/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 DA8A5C32C9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 Apr 2024 14:47:52 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4780063352;\n\tFri,  5 Apr 2024 16:47:52 +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 98D8261C2F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Apr 2024 16:47:48 +0200 (CEST)",
            "from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp\n\t[175.177.49.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DA05D63B;\n\tFri,  5 Apr 2024 16:47:08 +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=\"mutSa9rX\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1712328430;\n\tbh=VWM+ow7U8AHZqhwKyG/s1eLJfjCpgQ/SKy+k21i1blU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=mutSa9rX38yBc8Jkh7UVV5w7ltA2cwL0R5Ys6CPMu+1PfM+2rSSYpmozqh/pspjeg\n\tewWv2Mo5Ec0VlwmBlvYH6EffzSgSJINbNMqCGMDuatEVuHDAmXJ20O4TnH1dG/9RIX\n\tG9a/9EvzYAcRtjvmWjueRX4rAqJuwfH4w3mWitNU=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Paul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[PATCH 2/5] ipa: rkisp1: agc: Add digital gain",
        "Date": "Fri,  5 Apr 2024 23:47:26 +0900",
        "Message-Id": "<20240405144729.2992219-3-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20240405144729.2992219-1-paul.elder@ideasonboard.com>",
        "References": "<20240405144729.2992219-1-paul.elder@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": "Add support to the rkisp1 AGC to set digital gain.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 5 +++++\n src/ipa/rkisp1/ipa_context.h      | 3 +++\n src/ipa/rkisp1/rkisp1.cpp         | 2 ++\n 3 files changed, 10 insertions(+)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex fd47ba4e..7220f00a 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -10,6 +10,7 @@\n #include <algorithm>\n #include <chrono>\n #include <cmath>\n+#include <tuple>\n \n #include <libcamera/base/log.h>\n #include <libcamera/base/utils.h>\n@@ -152,8 +153,10 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n \tcontext.activeState.agc.automatic.gain = context.configuration.sensor.minAnalogueGain;\n \tcontext.activeState.agc.automatic.exposure =\n \t\t10ms / context.configuration.sensor.lineDuration;\n+\tcontext.activeState.agc.automatic.dgain = 1;\n \tcontext.activeState.agc.manual.gain = context.activeState.agc.automatic.gain;\n \tcontext.activeState.agc.manual.exposure = context.activeState.agc.automatic.exposure;\n+\tcontext.activeState.agc.manual.dgain = 1;\n \tcontext.activeState.agc.autoEnabled = !context.configuration.raw;\n \n \t/*\n@@ -237,6 +240,7 @@ void Agc::prepare(IPAContext &context, const uint32_t frame,\n \tif (frameContext.agc.autoEnabled) {\n \t\tframeContext.agc.exposure = context.activeState.agc.automatic.exposure;\n \t\tframeContext.agc.gain = context.activeState.agc.automatic.gain;\n+\t\tframeContext.agc.dgain = context.activeState.agc.automatic.dgain;\n \t}\n \n \t/* \\todo Remove this when we can set the below with controls */\n@@ -380,6 +384,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t/* Update the estimated exposure and gain. */\n \tactiveState.agc.automatic.exposure = shutterTime / context.configuration.sensor.lineDuration;\n \tactiveState.agc.automatic.gain = aGain;\n+\tactiveState.agc.automatic.dgain = dGain;\n \n \tfillMetadata(context, frameContext, metadata);\n }\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 256b75eb..a70c7eb3 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -61,10 +61,12 @@ struct IPAActiveState {\n \t\tstruct {\n \t\t\tuint32_t exposure;\n \t\t\tdouble gain;\n+\t\t\tdouble dgain;\n \t\t} manual;\n \t\tstruct {\n \t\t\tuint32_t exposure;\n \t\t\tdouble gain;\n+\t\t\tdouble dgain;\n \t\t} automatic;\n \n \t\tbool autoEnabled;\n@@ -110,6 +112,7 @@ struct IPAFrameContext : public FrameContext {\n \tstruct {\n \t\tuint32_t exposure;\n \t\tdouble gain;\n+\t\tdouble dgain;\n \t\tbool autoEnabled;\n \t} agc;\n \ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex b0bbcd8c..d66dfdd7 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -446,10 +446,12 @@ void IPARkISP1::setControls(unsigned int frame)\n \tIPAFrameContext &frameContext = context_.frameContexts.get(frame);\n \tuint32_t exposure = frameContext.agc.exposure;\n \tuint32_t gain = camHelper_->gainCode(frameContext.agc.gain);\n+\tuint32_t dgain = camHelper_->gainCode(frameContext.agc.dgain);\n \n \tControlList ctrls(sensorControls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n \tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain));\n+\tctrls.set(V4L2_CID_DIGITAL_GAIN, static_cast<int32_t>(dgain));\n \n \tsetSensorControls.emit(frame, ctrls);\n }\n",
    "prefixes": [
        "2/5"
    ]
}