Show a patch.

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

{
    "id": 12695,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12695/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12695/",
    "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": "<20210623123657.58776-1-umang.jain@ideasonboard.com>",
    "date": "2021-06-23T12:36:57",
    "name": "[libcamera-devel,v2] ipa: ipu3: Use libcamera::utils::Duration helper class for durations",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b56a4edf57781edb225ba5d5080441e1cd19a2e4",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12695/mbox/",
    "series": [
        {
            "id": 2170,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2170/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2170",
            "date": "2021-06-23T12:36:57",
            "name": "[libcamera-devel,v2] ipa: ipu3: Use libcamera::utils::Duration helper class for durations",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2170/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12695/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12695/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 3BBE8C321B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Jun 2021 12:37:07 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A971E68933;\n\tWed, 23 Jun 2021 14:37:06 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 726F668932\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jun 2021 14:37:05 +0200 (CEST)",
            "from perceval.ideasonboard.com (unknown [103.251.226.162])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DCC8949A;\n\tWed, 23 Jun 2021 14:37:03 +0200 (CEST)"
        ],
        "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=\"HdtCoLI5\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624451825;\n\tbh=BPVPNlly+c+LFh52s4gJ0m7WPqcNA7LbSQNL/1x6/XY=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=HdtCoLI5/yQ7LexkWFKLqHZ8bWoPODkrwA6QW+t41Pd+TrEAOTxol1DGE4SssAl6B\n\t37gefN8P07fcqeHlwJCpdQ7QvvjDE3j9sjcoHbWzfRWw8wEAxxQbqBsSGEpoOsKdWP\n\t5NX3mUhbdtd3GNpj+Y9ka0+os7VaF1SWKY8CjuaQ=",
        "From": "Umang Jain <umang.jain@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 23 Jun 2021 18:06:57 +0530",
        "Message-Id": "<20210623123657.58776-1-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] ipa: ipu3: Use\n\tlibcamera::utils::Duration helper class for durations",
        "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": "std::chrono::Duration is provided quite conveniently by\nlibcamera::utils::Duration wrapper. Port IPAIPU3 to use that\nfor duration-type entities (such as exposure time), such that\nit becomes consistent with rest of the codebase.\n\nThe commit doesn't introduce any functional changes.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/ipu3/ipu3_agc.cpp | 19 ++++++++++---------\n src/ipa/ipu3/ipu3_agc.h   | 16 ++++++++++------\n 2 files changed, 20 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/src/ipa/ipu3/ipu3_agc.cpp b/src/ipa/ipu3/ipu3_agc.cpp\nindex 8ca95013..c476a60d 100644\n--- a/src/ipa/ipu3/ipu3_agc.cpp\n+++ b/src/ipa/ipu3/ipu3_agc.cpp\n@@ -19,6 +19,8 @@\n \n namespace libcamera {\n \n+using namespace std::literals::chrono_literals;\n+\n namespace ipa::ipu3 {\n \n LOG_DEFINE_CATEGORY(IPU3Agc)\n@@ -51,9 +53,9 @@ static constexpr uint8_t kCellSize = 8;\n IPU3Agc::IPU3Agc()\n \t: frameCount_(0), lastFrame_(0), converged_(false),\n \t  updateControls_(false), iqMean_(0.0), gamma_(1.0),\n-\t  lineDuration_(0.0), maxExposureTime_(0.0),\n-\t  prevExposure_(0.0), prevExposureNoDg_(0.0),\n-\t  currentExposure_(0.0), currentExposureNoDg_(0.0)\n+\t  lineDuration_(0s), maxExposureTime_(0s),\n+\t  prevExposure_(0s), prevExposureNoDg_(0s),\n+\t  currentExposure_(0s), currentExposureNoDg_(0s)\n {\n }\n \n@@ -61,8 +63,7 @@ void IPU3Agc::initialise(struct ipu3_uapi_grid_config &bdsGrid, const IPACameraS\n {\n \taeGrid_ = bdsGrid;\n \n-\t/* line duration in microseconds */\n-\tlineDuration_ = sensorInfo.lineLength * 1000000ULL / static_cast<double>(sensorInfo.pixelRate);\n+\tlineDuration_ = sensorInfo.lineLength * 1.0s / sensorInfo.pixelRate;\n \tmaxExposureTime_ = kMaxExposure * lineDuration_;\n }\n \n@@ -113,7 +114,7 @@ void IPU3Agc::processBrightness(const ipu3_uapi_stats_3a *stats)\n void IPU3Agc::filterExposure()\n {\n \tdouble speed = 0.2;\n-\tif (prevExposure_ == 0.0) {\n+\tif (prevExposure_ == 0s) {\n \t\t/* DG stands for digital gain.*/\n \t\tprevExposure_ = currentExposure_;\n \t\tprevExposureNoDg_ = currentExposureNoDg_;\n@@ -162,20 +163,20 @@ void IPU3Agc::lockExposureGain(uint32_t &exposure, uint32_t &gain)\n \t\tdouble newGain = kEvGainTarget * knumHistogramBins / iqMean_;\n \n \t\t/* extracted from Rpi::Agc::computeTargetExposure */\n-\t\tdouble currentShutter = exposure * lineDuration_;\n+\t\tlibcamera::utils::Duration currentShutter = exposure * lineDuration_;\n \t\tcurrentExposureNoDg_ = currentShutter * gain;\n \t\tLOG(IPU3Agc, Debug) << \"Actual total exposure \" << currentExposureNoDg_\n \t\t\t\t    << \" Shutter speed \" << currentShutter\n \t\t\t\t    << \" Gain \" << gain;\n \t\tcurrentExposure_ = currentExposureNoDg_ * newGain;\n-\t\tdouble maxTotalExposure = maxExposureTime_ * kMaxGain;\n+\t\tlibcamera::utils::Duration maxTotalExposure = maxExposureTime_ * kMaxGain;\n \t\tcurrentExposure_ = std::min(currentExposure_, maxTotalExposure);\n \t\tLOG(IPU3Agc, Debug) << \"Target total exposure \" << currentExposure_;\n \n \t\t/* \\todo: estimate if we need to desaturate */\n \t\tfilterExposure();\n \n-\t\tdouble newExposure = 0.0;\n+\t\tlibcamera::utils::Duration newExposure = 0.0s;\n \t\tif (currentShutter < maxExposureTime_) {\n \t\t\texposure = std::clamp(static_cast<uint32_t>(exposure * currentExposure_ / currentExposureNoDg_), kMinExposure, kMaxExposure);\n \t\t\tnewExposure = currentExposure_ / exposure;\ndiff --git a/src/ipa/ipu3/ipu3_agc.h b/src/ipa/ipu3/ipu3_agc.h\nindex f3d40557..a5a78233 100644\n--- a/src/ipa/ipu3/ipu3_agc.h\n+++ b/src/ipa/ipu3/ipu3_agc.h\n@@ -14,6 +14,8 @@\n \n #include <libcamera/geometry.h>\n \n+#include \"libcamera/internal/utils.h\"\n+\n #include \"libipa/algorithm.h\"\n \n namespace libcamera {\n@@ -22,6 +24,8 @@ struct IPACameraSensorInfo;\n \n namespace ipa::ipu3 {\n \n+using utils::Duration;\n+\n class IPU3Agc : public Algorithm\n {\n public:\n@@ -51,13 +55,13 @@ private:\n \tdouble iqMean_;\n \tdouble gamma_;\n \n-\tdouble lineDuration_;\n-\tdouble maxExposureTime_;\n+\tDuration lineDuration_;\n+\tDuration maxExposureTime_;\n \n-\tdouble prevExposure_;\n-\tdouble prevExposureNoDg_;\n-\tdouble currentExposure_;\n-\tdouble currentExposureNoDg_;\n+\tDuration prevExposure_;\n+\tDuration prevExposureNoDg_;\n+\tDuration currentExposure_;\n+\tDuration currentExposureNoDg_;\n };\n \n } /* namespace ipa::ipu3 */\n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}