Show a patch.

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

{
    "id": 14602,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14602/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14602/",
    "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": "<20211113084947.21892-13-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2021-11-13T08:49:45",
    "name": "[libcamera-devel,v5,12/14] ipa: ipu3: Cache line duration at configure call",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6069b48fb54a902b5c3f4dafb121432bdf85ec71",
    "submitter": {
        "id": 75,
        "url": "https://patchwork.libcamera.org/api/1.1/people/75/?format=api",
        "name": "Jean-Michel Hautbois",
        "email": "jeanmichel.hautbois@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14602/mbox/",
    "series": [
        {
            "id": 2717,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2717/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2717",
            "date": "2021-11-13T08:49:33",
            "name": "IPA: IPU3: Introduce per-frame controls",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/2717/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14602/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14602/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 1BBC1C3252\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 13 Nov 2021 08:50:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BEEF26038A;\n\tSat, 13 Nov 2021 09:50:03 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 560F760368\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 13 Nov 2021 09:49:53 +0100 (CET)",
            "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:4d35:9445:6881:4ffd])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0591414D4;\n\tSat, 13 Nov 2021 09:49:53 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"cX3UEMWo\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636793393;\n\tbh=md1LCPt5ebZQvuvRwPSooLkR8Dk9lhGjoAEseT2yuNs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cX3UEMWoG57jDPo2w/tCyg+0OQDmc6XfSynrpUtofwuE2hf7M1UNOWIi65UciuVK9\n\t/LodPjveHnuRVgiaaKYX/UWkGc2D3QQcZGCSYJc9D81tSnJkkdBX5jvbuQCehF/Hty\n\tDVfh4S1dg3S/cq9WBV6BtTcpnCfSqr+p76KiFYuA=",
        "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 13 Nov 2021 09:49:45 +0100",
        "Message-Id": "<20211113084947.21892-13-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20211113084947.21892-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20211113084947.21892-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v5 12/14] ipa: ipu3: Cache line duration\n\tat configure call",
        "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": "We use the line duration several times in the IPAIPU3. Instead of\nrecalculating it each time, cache the value as a utils::Duration.\nExposureTime and FrameDuration units are in micro-seconds, cast the\nDuration accordingly.\n\nAs sensorInfo is no longer used in updateSessionConfiguration remove the\nreference to it.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/ipa/ipu3/ipu3.cpp | 29 +++++++++++++----------------\n 1 file changed, 13 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex d3195de6..f1597f78 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -148,8 +148,7 @@ private:\n \tvoid updateControls(const IPACameraSensorInfo &sensorInfo,\n \t\t\t    const ControlInfoMap &sensorControls,\n \t\t\t    ControlInfoMap *ipaControls);\n-\tvoid updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n-\t\t\t\t\tconst ControlInfoMap &sensorControls);\n+\tvoid updateSessionConfiguration(const ControlInfoMap &sensorControls);\n \tvoid processControls(unsigned int frame, const ControlList &controls);\n \tvoid fillParams(unsigned int frame, ipu3_uapi_params *params);\n \tvoid parseStatistics(unsigned int frame,\n@@ -174,6 +173,8 @@ private:\n \tuint32_t minGain_;\n \tuint32_t maxGain_;\n \n+\tutils::Duration lineDuration_;\n+\n \t/* Interface to the Camera Helper */\n \tstd::unique_ptr<CameraSensorHelper> camHelper_;\n \n@@ -188,16 +189,12 @@ private:\n  * \\brief Compute IPASessionConfiguration using the sensor information and the\n  * sensor V4L2 controls\n  */\n-void IPAIPU3::updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n-\t\t\t\t\t const ControlInfoMap &sensorControls)\n+void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\n {\n \tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n \tint32_t minExposure = v4l2Exposure.min().get<int32_t>();\n \tint32_t maxExposure = v4l2Exposure.max().get<int32_t>();\n \n-\tutils::Duration lineDuration = sensorInfo.lineLength * 1.0s\n-\t\t\t\t     / sensorInfo.pixelRate;\n-\n \tconst ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\n \tint32_t minGain = v4l2Gain.min().get<int32_t>();\n \tint32_t maxGain = v4l2Gain.max().get<int32_t>();\n@@ -209,8 +206,8 @@ void IPAIPU3::updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n \t *\n \t * \\todo take VBLANK into account for maximum shutter speed\n \t */\n-\tcontext_.configuration.agc.minShutterSpeed = minExposure * lineDuration;\n-\tcontext_.configuration.agc.maxShutterSpeed = maxExposure * lineDuration;\n+\tcontext_.configuration.agc.minShutterSpeed = minExposure * lineDuration_;\n+\tcontext_.configuration.agc.maxShutterSpeed = maxExposure * lineDuration_;\n \tcontext_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain);\n \tcontext_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);\n }\n@@ -239,11 +236,10 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,\n \t * exposure min, max and default and convert it from lines to\n \t * microseconds.\n \t */\n-\tdouble lineDuration = sensorInfo.lineLength / (sensorInfo.pixelRate / 1e6);\n \tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n-\tint32_t minExposure = v4l2Exposure.min().get<int32_t>() * lineDuration;\n-\tint32_t maxExposure = v4l2Exposure.max().get<int32_t>() * lineDuration;\n-\tint32_t defExposure = v4l2Exposure.def().get<int32_t>() * lineDuration;\n+\tint32_t minExposure = v4l2Exposure.min().get<int32_t>() * lineDuration_.get<std::micro>();\n+\tint32_t maxExposure = v4l2Exposure.max().get<int32_t>() * lineDuration_.get<std::micro>();\n+\tint32_t defExposure = v4l2Exposure.def().get<int32_t>() * lineDuration_.get<std::micro>();\n \tcontrols[&controls::ExposureTime] = ControlInfo(minExposure, maxExposure,\n \t\t\t\t\t\t\tdefExposure);\n \n@@ -463,11 +459,13 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n \n \tcalculateBdsGrid(configInfo.bdsOutputSize);\n \n+\tlineDuration_ = sensorInfo_.lineLength * 1.0s / sensorInfo_.pixelRate;\n+\n \t/* Update the camera controls using the new sensor settings. */\n \tupdateControls(sensorInfo_, ctrls_, ipaControls);\n \n \t/* Update the IPASessionConfiguration using the sensor settings. */\n-\tupdateSessionConfiguration(sensorInfo_, ctrls_);\n+\tupdateSessionConfiguration(ctrls_);\n \n \tfor (auto const &algo : algorithms_) {\n \t\tint ret = algo->configure(context_, configInfo);\n@@ -627,8 +625,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \tsetControls(frame);\n \n \t/* \\todo Use VBlank value calculated from each frame exposure. */\n-\tint64_t frameDuration = sensorInfo_.lineLength * (defVBlank_ + sensorInfo_.outputSize.height) /\n-\t\t\t\t(sensorInfo_.pixelRate / 1e6);\n+\tint64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height) * lineDuration_.get<std::micro>();\n \tctrls.set(controls::FrameDuration, frameDuration);\n \n \tctrls.set(controls::ColourTemperature, context_.frameContext.awb.temperatureK);\n",
    "prefixes": [
        "libcamera-devel",
        "v5",
        "12/14"
    ]
}