Show a patch.

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

{
    "id": 16193,
    "url": "https://patchwork.libcamera.org/api/patches/16193/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16193/",
    "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": "<20220610120338.96883-5-Rauch.Christian@gmx.de>",
    "date": "2022-06-10T12:03:38",
    "name": "[libcamera-devel,v8,4/4] libcamera: controls: Apply explicit fixed-sized Span type casts",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a358875a43334b6d79c547a4343fd8a7c26da02c",
    "submitter": {
        "id": 111,
        "url": "https://patchwork.libcamera.org/api/people/111/?format=api",
        "name": "Christian Rauch",
        "email": "Rauch.Christian@gmx.de"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16193/mbox/",
    "series": [
        {
            "id": 3168,
            "url": "https://patchwork.libcamera.org/api/series/3168/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3168",
            "date": "2022-06-10T12:03:34",
            "name": "generate and use fixed-sized Span Control types",
            "version": 8,
            "mbox": "https://patchwork.libcamera.org/series/3168/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16193/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16193/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 4D8F6C3273\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Jun 2022 12:03:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2635D65647;\n\tFri, 10 Jun 2022 14:03:47 +0200 (CEST)",
            "from mout.gmx.net (mout.gmx.net [212.227.17.21])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 63FF7633A4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Jun 2022 14:03:42 +0200 (CEST)",
            "from localhost.localdomain ([92.18.80.244]) by mail.gmx.net\n\t(mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id\n\t1Mbir8-1nTKoS03lW-00dBpM; Fri, 10 Jun 2022 14:03:42 +0200"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654862627;\n\tbh=57RCMCH2ddS8uCZM3E90CIxLhQ7NCr8PSdJyCaYE2pE=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=Oaxcok5no9SXRsAkspXowejSgoTjBfXOBaESpgAQ+QA9mKkj6B5TCIkIzHq7nASLZ\n\tOU5NReTemVCtQOI7jGcnA+dDluDsDjARLBy5QdMMY3Kpd+qxq9UHtLPibS3mxaZKT2\n\tWVJIRG3HC+gONjLuNJbDBRzeHAq4zGu2fpmLFH08rYyst0kC56MZQB6qUG0EUdlvlH\n\ttf3HS7Ribh5GzG/qHuNxl5910w85TX4WKexrC5i/Dz2PZbLXd8vcPFtBNC8Fq/lljS\n\tDWWRzudtV/YxZXZ70NurY1KmxTOpBuVfJzBt1HqGFwPLHJlCHOsgbLOL2TiFanMYZv\n\to8RJ06Q42jybA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;\n\ts=badeba3b8450; t=1654862622;\n\tbh=57RCMCH2ddS8uCZM3E90CIxLhQ7NCr8PSdJyCaYE2pE=;\n\th=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;\n\tb=LZXdxKSnqSyPzY6o2rHi84acQGDHIDzIqQg9icUZXsQxKwbFII0z631OzKYB5yT/o\n\tWb3HdloWxWtfzLJuOE/7TZolZpyDJpwxYWPKtyHhAshov8Gw3eM5CnC7giBrX9c/Kz\n\tamE9guz6XVEWs9MlkE2yQOUjaKE9tb0BtehoT8Uc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=gmx.net header.i=@gmx.net\n\theader.b=\"LZXdxKSn\"; dkim-atps=neutral",
        "X-UI-Sender-Class": "01bb95c1-4bf8-414a-932a-4f6e2808ef9c",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 10 Jun 2022 13:03:38 +0100",
        "Message-Id": "<20220610120338.96883-5-Rauch.Christian@gmx.de>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220610120338.96883-1-Rauch.Christian@gmx.de>",
        "References": "<20220610120338.96883-1-Rauch.Christian@gmx.de>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "quoted-printable",
        "X-Provags-ID": "V03:K1:u1QfUdIYSEIwFXXbWte/JkcleX0EwVKw52hlNkvbKSySgbepGX9\n\tqKd5GjPqKoxedRx4KFKOLj+ReDy3dnfe0AqXTTBrkGBL5JC/yw4VX+NNZzoKZ4qjechdZbE\n\tst3onm5ypLlMLHfBXryk2WsuSoPk65E/HghWlwsJPQ7lK3RfEUj0IrHY2d3lI3LaOb/7sqZ\n\tU1JxeSvG7LnVCckSx+CNQ==",
        "X-Spam-Flag": "NO",
        "X-UI-Out-Filterresults": "notjunk:1; V03:K0:UHlmoPPN5p0=:oXJwetjbrPvk8IftyHQK+B\n\tB0SGfZVoRbch4fOb4JTYx+VOkSz8bLgT/Qu6cqKMPr20v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JdEZ04yXYOrE0\n\teSW94Coek/mkf7fKFJjPCuEVTvOUzUgMjKCsSxw+ywb+jM7VBLmPGRT9Q==",
        "Subject": "[libcamera-devel] [PATCH v8 4/4] libcamera: controls: Apply\n\texplicit fixed-sized Span type casts",
        "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>",
        "From": "Christian Rauch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Christian Rauch <Rauch.Christian@gmx.de>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The change of types of some Controls from variable- to fixed-sized requires\nexplicit casting of FrameDurationLimits, ColourGains and SensorBlackLevels.\n\nSigned-off-by: Christian Rauch <Rauch.Christian@gmx.de>\n---\n include/libcamera/controls.h                  |  2 +-\n src/ipa/raspberrypi/raspberrypi.cpp           | 19 ++++++++++---------\n .../pipeline/raspberrypi/raspberrypi.cpp      |  2 +-\n src/qcam/dng_writer.cpp                       |  2 +-\n 4 files changed, 13 insertions(+), 12 deletions(-)\n\n--\n2.34.1",
    "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 192be784..a19f1845 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -168,7 +168,7 @@ public:\n\n \t\tusing V = typename T::value_type;\n \t\tconst V *value = reinterpret_cast<const V *>(data().data());\n-\t\treturn { value, numElements_ };\n+\t\treturn T{ value, numElements_ };\n \t}\n\n #ifndef __DOXYGEN__\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex f65a0680..203ae613 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -505,18 +505,19 @@ void IPARPi::reportMetadata()\n\n \tAwbStatus *awbStatus = rpiMetadata_.GetLocked<AwbStatus>(\"awb.status\");\n \tif (awbStatus) {\n-\t\tlibcameraMetadata_.set(controls::ColourGains, { static_cast<float>(awbStatus->gain_r),\n-\t\t\t\t\t\t\t\tstatic_cast<float>(awbStatus->gain_b) });\n+\t\tlibcameraMetadata_.set(controls::ColourGains,\n+\t\t\t\t       Span<const float, 2>({ static_cast<float>(awbStatus->gain_r),\n+\t\t\t\t\t\t\t      static_cast<float>(awbStatus->gain_b) }));\n \t\tlibcameraMetadata_.set(controls::ColourTemperature, awbStatus->temperature_K);\n \t}\n\n \tBlackLevelStatus *blackLevelStatus = rpiMetadata_.GetLocked<BlackLevelStatus>(\"black_level.status\");\n \tif (blackLevelStatus)\n \t\tlibcameraMetadata_.set(controls::SensorBlackLevels,\n-\t\t\t\t       { static_cast<int32_t>(blackLevelStatus->black_level_r),\n-\t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_g),\n-\t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_g),\n-\t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_b) });\n+\t\t\t\t       Span<const int32_t, 4>({ blackLevelStatus->black_level_r,\n+\t\t\t\t\t\t\t\tblackLevelStatus->black_level_g,\n+\t\t\t\t\t\t\t\tblackLevelStatus->black_level_g,\n+\t\t\t\t\t\t\t\tblackLevelStatus->black_level_b }));\n\n \tFocusStatus *focusStatus = rpiMetadata_.GetLocked<FocusStatus>(\"focus.status\");\n \tif (focusStatus && focusStatus->num == 12) {\n@@ -821,7 +822,7 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\tif (gains[0] != 0.0f && gains[1] != 0.0f)\n \t\t\t\t/* A gain of 0.0f will switch back to auto mode. */\n \t\t\t\tlibcameraMetadata_.set(controls::ColourGains,\n-\t\t\t\t\t\t       { gains[0], gains[1] });\n+\t\t\t\t\t\t       Span<const float, 2>({ gains[0], gains[1] }));\n \t\t\tbreak;\n \t\t}\n\n@@ -1105,8 +1106,8 @@ void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur\n\n \t/* Return the validated limits via metadata. */\n \tlibcameraMetadata_.set(controls::FrameDurationLimits,\n-\t\t\t       { static_cast<int64_t>(minFrameDuration_.get<std::micro>()),\n-\t\t\t\t static_cast<int64_t>(maxFrameDuration_.get<std::micro>()) });\n+\t\t\t       Span<const int64_t, 2>({ static_cast<int64_t>(minFrameDuration_.get<std::micro>()),\n+\t\t\t\t\t\t\tstatic_cast<int64_t>(maxFrameDuration_.get<std::micro>()) }));\n\n \t/*\n \t * Calculate the maximum exposure time possible for the AGC to use.\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex a62afdd4..6efe7c3c 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1706,7 +1706,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &\n \t * V4L2_CID_NOTIFY_GAINS control (which means notifyGainsUnity_ is set).\n \t */\n \tif (notifyGainsUnity_ && controls.contains(libcamera::controls::ColourGains)) {\n-\t\tlibcamera::Span<const float> colourGains =\n+\t\tlibcamera::Span<const float, 2> colourGains =\n \t\t\t*controls.get(libcamera::controls::ColourGains);\n \t\t/* The control wants linear gains in the order B, Gb, Gr, R. */\n \t\tControlList ctrls(sensor_->controls());\ndiff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp\nindex 4b5d8276..23612be0 100644\n--- a/src/qcam/dng_writer.cpp\n+++ b/src/qcam/dng_writer.cpp\n@@ -514,7 +514,7 @@ int DNGWriter::write(const char *filename, const Camera *camera,\n \tuint32_t whiteLevel = (1 << info->bitsPerSample) - 1;\n\n \tif (metadata.contains(controls::SensorBlackLevels)) {\n-\t\tSpan<const int32_t> levels =\n+\t\tSpan<const int32_t, 4> levels =\n \t\t\t*metadata.get(controls::SensorBlackLevels);\n\n \t\t/*\n",
    "prefixes": [
        "libcamera-devel",
        "v8",
        "4/4"
    ]
}