Show a patch.

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

{
    "id": 20495,
    "url": "https://patchwork.libcamera.org/api/patches/20495/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20495/",
    "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": "<20240701144122.3418955-3-stefan.klug@ideasonboard.com>",
    "date": "2024-07-01T14:38:25",
    "name": "[2/5] ipa: rkisp1: Move camHelper into IPAContext",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "330e7e27ffead2a77fff6343e2cec02ae946a633",
    "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/20495/mbox/",
    "series": [
        {
            "id": 4433,
            "url": "https://patchwork.libcamera.org/api/series/4433/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4433",
            "date": "2024-07-01T14:38:23",
            "name": "ipa: Add black level to camera sensor helpers",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4433/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20495/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20495/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 5BDEABEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Jul 2024 14:41:45 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0521162E25;\n\tMon,  1 Jul 2024 16:41:45 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0654D62E24\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2024 16:41:43 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:89b2:f6c7:b29b:4e5c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B6403289;\n\tMon,  1 Jul 2024 16:41:15 +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=\"n4qUt8df\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719844875;\n\tbh=AfrMtpKNsw/KZaxtWd/pLBBlLylDbrflNDNoDiMXIkw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=n4qUt8dfm2vnOTIMM+14LA21eiMfsLxT0b9yHnAinK3gFp102umEgswz5VHc92rq8\n\tYq2iKtApmvnS0o340PS12RDt+5BaVqWjFeECO9UY2ToPehBV1ODTmjwTf0kCUqeiqy\n\t8hjzA4igMC+XP3zNLObDy0D13ofR3U64kb3lLN94=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH 2/5] ipa: rkisp1: Move camHelper into IPAContext",
        "Date": "Mon,  1 Jul 2024 16:38:25 +0200",
        "Message-ID": "<20240701144122.3418955-3-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240701144122.3418955-1-stefan.klug@ideasonboard.com>",
        "References": "<20240701144122.3418955-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>\n---\n src/ipa/rkisp1/ipa_context.h |  4 ++++\n src/ipa/rkisp1/rkisp1.cpp    | 26 ++++++++++++--------------\n 2 files changed, 16 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 8602b408870e..d2dd6a904b59 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -16,6 +16,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 +179,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": [
        "2/5"
    ]
}