Show a patch.

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

{
    "id": 16146,
    "url": "https://patchwork.libcamera.org/api/patches/16146/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16146/",
    "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": "<20220603220712.73673-6-Rauch.Christian@gmx.de>",
    "date": "2022-06-03T22:07:12",
    "name": "[libcamera-devel,v6,5/5] libcamera: controls: Apply explicit fixed-sized Span type casts",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "cb01cdc5296a7074eb2e37f6e5e853977b964f16",
    "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/16146/mbox/",
    "series": [
        {
            "id": 3158,
            "url": "https://patchwork.libcamera.org/api/series/3158/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3158",
            "date": "2022-06-03T22:07:07",
            "name": "generate and use fixed-sized Span Control types",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/3158/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16146/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16146/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 32C42C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jun 2022 22:07:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A06465648;\n\tSat,  4 Jun 2022 00:07:21 +0200 (CEST)",
            "from mout.gmx.net (mout.gmx.net [212.227.15.15])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9D685633A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jun 2022 00:07:17 +0200 (CEST)",
            "from localhost.localdomain ([92.18.80.244]) by mail.gmx.net\n\t(mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id\n\t1N0oFz-1ncZQe0PpN-00whyL; Sat, 04 Jun 2022 00:07:17 +0200"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654294041;\n\tbh=ipm41GgrpnYmbo99+S/NkvHl94ueDeSphbQgeFOEPs0=;\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=WHo3yQFJbfRMc9Ea27OzqfaxLKZ5kWLP87fJoEjQ96NwG81FXQgA3cOkxWsAL50Rc\n\tD7AH6v8SmWJRNDJ+IYOrhioIExO+gMZIyjqV4JMgIp53o5AOnMLlktPWKezsiEg9tR\n\tQWCnHo4wXTxaTt6m32D05ew1PxHI/SzEXolbxVvbR5oxpUc5Nl9JSi6F/zQmFpiaEh\n\t9tDN09wo4HEGSHXTRqc1CwdQSbUOmgK6q9smhaC9dQJ+xQ5zh7BpD85oLeCHlvg611\n\tJgbVsEKanXL6h9PsHznocWvX35FDIDGtvCa7wXZApo5aJk1j0rQfcaXfsKuBpeTLsx\n\tHAFIxg0+YOoJA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;\n\ts=badeba3b8450; t=1654294037;\n\tbh=ipm41GgrpnYmbo99+S/NkvHl94ueDeSphbQgeFOEPs0=;\n\th=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;\n\tb=IhVxcyOlpbPKko+lopIoUsCE/l7pjUqEXBKuC6K8X2LeIm7D86uvEXfJySWK6aNsD\n\tWPwAoPOIRrsmsZi5Q1YiqGosFpp70vtiqWEG42Gmzd0GsEiSMoEK0jf6Z305hfBN0p\n\t4Y+2dCuUT3lDVeYvXyfcy9buFVFj5AkdGSYsQ+8c="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=gmx.net header.i=@gmx.net\n\theader.b=\"IhVxcyOl\"; dkim-atps=neutral",
        "X-UI-Sender-Class": "01bb95c1-4bf8-414a-932a-4f6e2808ef9c",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  3 Jun 2022 23:07:12 +0100",
        "Message-Id": "<20220603220712.73673-6-Rauch.Christian@gmx.de>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220603220712.73673-1-Rauch.Christian@gmx.de>",
        "References": "<20220603220712.73673-1-Rauch.Christian@gmx.de>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "quoted-printable",
        "X-Provags-ID": "V03:K1:mUuXzuAg3zEO8Rie98ECNkwkrKTewGaNCdx4SiFLE8jAcNJ2J+n\n\tOdGcLIYf5274FLpXLH4AFlLPc4wjtPPXMXYH6ZsEDIMBMEYh9KoskK56i+mmvilbZNMpbUa\n\tJoGcYVhn1ZKjJSnw1yNV+S6Sotwc8c8fCff6+7nwnBeTRDSXFXpDvbPyEHmTQdrcUdBM1wr\n\tAE17/5bLlbjIpZQszmP3A==",
        "X-Spam-Flag": "NO",
        "X-UI-Out-Filterresults": "notjunk:1; V03:K0:0p0eNOHLgHA=:hpzCg+nEgxN9iVruVOPfwh\n\tbzVZBp6Axpnh7AzMl5Pes+LTuEOB7TX5tQ9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CYMa5AKijDnnQiBmrecV39rb/RCHxTRPXMIm\n\tf77OeX9ps+T3mKFjZxzB2HhaGUynkSfdHgtbnHVIMKwa4jKsZBHTxsb9Q==",
        "Subject": "[libcamera-devel] [PATCH v6 5/5] 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                       |  6 +++---\n 4 files changed, 15 insertions(+), 14 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 780f58f7..e18bf36b 100644\n--- a/src/qcam/dng_writer.cpp\n+++ b/src/qcam/dng_writer.cpp\n@@ -438,7 +438,7 @@ int DNGWriter::write(const char *filename, const Camera *camera,\n \tconst double eps = 1e-2;\n\n \tif (metadata.contains(controls::ColourGains)) {\n-\t\tSpan<const float> const &colourGains =\n+\t\tSpan<const float, 2> const &colourGains =\n \t\t\t*metadata.get(controls::ColourGains);\n \t\tif (colourGains[0] > eps && colourGains[1] > eps) {\n \t\t\twbGain = Matrix3d::diag(colourGains[0], 1, colourGains[1]);\n@@ -447,7 +447,7 @@ int DNGWriter::write(const char *filename, const Camera *camera,\n \t\t}\n \t}\n \tif (metadata.contains(controls::ColourCorrectionMatrix)) {\n-\t\tSpan<const float> const &coeffs =\n+\t\tSpan<const float, 9> const &coeffs =\n \t\t\t*metadata.get(controls::ColourCorrectionMatrix);\n \t\tMatrix3d ccmSupplied(coeffs);\n \t\tif (ccmSupplied.determinant() > eps)\n@@ -517,7 +517,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",
        "v6",
        "5/5"
    ]
}