Show a patch.

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

{
    "id": 20509,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/20509/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20509/",
    "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": "<20240703135000.242227-3-stefan.klug@ideasonboard.com>",
    "date": "2024-07-03T13:49:50",
    "name": "[v3,2/6] ipa: rkisp1: Move camHelper into IPAContext",
    "commit_ref": "3df0f0f2b819ba2ddcf55bcca57db4b937d8a545",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e24ffd6e049f07f523ebc033aefabfcac592ef6c",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20509/mbox/",
    "series": [
        {
            "id": 4436,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4436/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4436",
            "date": "2024-07-03T13:49:48",
            "name": "ipa: Add black level to camera sensor helpers",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/4436/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20509/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20509/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 B100CBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Jul 2024 13:50:14 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5E3F5632EA;\n\tWed,  3 Jul 2024 15:50:14 +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 155A462E27\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jul 2024 15:50:12 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:9263:c199:9587:576])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A1848A9;\n\tWed,  3 Jul 2024 15:49:43 +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=\"e2DM5XC9\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720014583;\n\tbh=G383aHbw8E7pTJIMKzLg+UXFUSpS+FMnr4iJpel8N8U=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=e2DM5XC9qq2O1WVpqJ59yOx2XoSG+m5lcd2p3aXQiiQ9UH33jvaaYqHUKzz3S5s+H\n\tsWgeAxe5Znk7WRTWE9nWj9ECdt1AZ4UYkJ91Cg2UHSR2AjdQZNFPqVZojncWHlykkY\n\tMOMiMjU2ZeRh7bO2iLWxC7rxoRJ09jmysepal9Hs=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[PATCH v3 2/6] ipa: rkisp1: Move camHelper into IPAContext",
        "Date": "Wed,  3 Jul 2024 15:49:50 +0200",
        "Message-ID": "<20240703135000.242227-3-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240703135000.242227-1-stefan.klug@ideasonboard.com>",
        "References": "<20240703135000.242227-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": "To be able to query the black levels, the black level correction\nalgorithm needs access to the camera sensor helper. Allow this by moving\nthe camHelper_ member from IPARkISP1 into IPAContext.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/ipa/rkisp1/ipa_context.h |  6 ++++++\n src/ipa/rkisp1/rkisp1.cpp    | 26 ++++++++++++--------------\n 2 files changed, 18 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 8602b408870e..1d0e9030af1c 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -8,6 +8,8 @@\n \n #pragma once\n \n+#include <memory>\n+\n #include <linux/rkisp1-config.h>\n \n #include <libcamera/base/utils.h>\n@@ -16,6 +18,7 @@\n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n \n+#include <libipa/camera_sensor_helper.h>\n #include <libipa/fc_queue.h>\n #include <libipa/matrix.h>\n \n@@ -178,6 +181,9 @@ struct IPAContext {\n \tFCQueue<IPAFrameContext> frameContexts;\n \n \tControlInfoMap::Map ctrlMap;\n+\n+\t/* Interface to the Camera Helper */\n+\tstd::unique_ptr<CameraSensorHelper> camHelper;\n };\n \n } /* namespace ipa::rkisp1 */\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex d31cdbab020b..23e0826cc335 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -29,7 +29,6 @@\n #include \"libcamera/internal/yaml_parser.h\"\n \n #include \"algorithms/algorithm.h\"\n-#include \"libipa/camera_sensor_helper.h\"\n \n #include \"ipa_context.h\"\n \n@@ -81,9 +80,6 @@ private:\n \n \tControlInfoMap sensorControls_;\n \n-\t/* Interface to the Camera Helper */\n-\tstd::unique_ptr<CameraSensorHelper> camHelper_;\n-\n \t/* Local parameter storage */\n \tstruct IPAContext context_;\n };\n@@ -115,7 +111,7 @@ const ControlInfoMap::Map rkisp1Controls{\n } /* namespace */\n \n IPARkISP1::IPARkISP1()\n-\t: context_({ {}, {}, {}, { kMaxFrameContexts }, {} })\n+\t: context_({ {}, {}, {}, { kMaxFrameContexts }, {}, {} })\n {\n }\n \n@@ -147,8 +143,8 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \n \tLOG(IPARkISP1, Debug) << \"Hardware revision is \" << hwRevision;\n \n-\tcamHelper_ = CameraSensorHelperFactoryBase::create(settings.sensorModel);\n-\tif (!camHelper_) {\n+\tcontext_.camHelper = CameraSensorHelperFactoryBase::create(settings.sensorModel);\n+\tif (!context_.camHelper) {\n \t\tLOG(IPARkISP1, Error)\n \t\t\t<< \"Failed to create camera sensor helper for \"\n \t\t\t<< settings.sensorModel;\n@@ -250,8 +246,10 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \t\tminExposure * context_.configuration.sensor.lineDuration;\n \tcontext_.configuration.sensor.maxShutterSpeed =\n \t\tmaxExposure * context_.configuration.sensor.lineDuration;\n-\tcontext_.configuration.sensor.minAnalogueGain = camHelper_->gain(minGain);\n-\tcontext_.configuration.sensor.maxAnalogueGain = camHelper_->gain(maxGain);\n+\tcontext_.configuration.sensor.minAnalogueGain =\n+\t\tcontext_.camHelper->gain(minGain);\n+\tcontext_.configuration.sensor.maxAnalogueGain =\n+\t\tcontext_.camHelper->gain(maxGain);\n \n \tcontext_.configuration.raw = std::any_of(streamConfig.begin(), streamConfig.end(),\n \t\t[](auto &cfg) -> bool {\n@@ -352,7 +350,7 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n \tframeContext.sensor.exposure =\n \t\tsensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>();\n \tframeContext.sensor.gain =\n-\t\tcamHelper_->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n+\t\tcontext_.camHelper->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n \n \tControlList metadata(controls::controls);\n \n@@ -389,9 +387,9 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n \n \t/* Compute the analogue gain limits. */\n \tconst ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\n-\tfloat minGain = camHelper_->gain(v4l2Gain.min().get<int32_t>());\n-\tfloat maxGain = camHelper_->gain(v4l2Gain.max().get<int32_t>());\n-\tfloat defGain = camHelper_->gain(v4l2Gain.def().get<int32_t>());\n+\tfloat minGain = context_.camHelper->gain(v4l2Gain.min().get<int32_t>());\n+\tfloat maxGain = context_.camHelper->gain(v4l2Gain.max().get<int32_t>());\n+\tfloat defGain = context_.camHelper->gain(v4l2Gain.def().get<int32_t>());\n \tctrlMap.emplace(std::piecewise_construct,\n \t\t\tstd::forward_as_tuple(&controls::AnalogueGain),\n \t\t\tstd::forward_as_tuple(minGain, maxGain, defGain));\n@@ -436,7 +434,7 @@ void IPARkISP1::setControls(unsigned int frame)\n \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 gain = context_.camHelper->gainCode(frameContext.agc.gain);\n \n \tControlList ctrls(sensorControls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n",
    "prefixes": [
        "v3",
        "2/6"
    ]
}