{"id":15655,"url":"https://patchwork.libcamera.org/api/1.1/patches/15655/?format=json","web_url":"https://patchwork.libcamera.org/patch/15655/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220408014231.231083-4-Rauch.Christian@gmx.de>","date":"2022-04-08T01:42:30","name":"[libcamera-devel,v3,3/4] apply explicit fixed-sized Span type casts","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"2e5f45ac7d7287c67ff7d90e9b9a86e9c7d0663a","submitter":{"id":111,"url":"https://patchwork.libcamera.org/api/1.1/people/111/?format=json","name":"Christian Rauch","email":"Rauch.Christian@gmx.de"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15655/mbox/","series":[{"id":3045,"url":"https://patchwork.libcamera.org/api/1.1/series/3045/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3045","date":"2022-04-08T01:42:28","name":"generate and use fixed-sized Span Control types","version":3,"mbox":"https://patchwork.libcamera.org/series/3045/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15655/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15655/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 7C48DC326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Apr 2022 01:42:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8F0FF65652;\n\tFri,  8 Apr 2022 03:42:38 +0200 (CEST)","from mout.gmx.net (mout.gmx.net [212.227.17.22])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ECFAE65641\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Apr 2022 03:42:35 +0200 (CEST)","from localhost.localdomain ([92.10.251.63]) by mail.gmx.net\n\t(mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id\n\t1N63RQ-1o5C7v28am-016QZH; Fri, 08 Apr 2022 03:42:35 +0200"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649382158;\n\tbh=OCbDJ7RSFLjMPLMkGk9bWWJ6Mx0JwZXcnyjk3bi70qI=;\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=V7a1Vv7Cl63na1dguxTEdk/ASU35+9e2tAWUQwzfnjOcfSdFAgHfLBIGilOmlq7A7\n\tQdAVuQdr/b3gdZBHDGGMmoPODLrj2/Wxq9o1VcjAohmAbGTuI5W0OauX6uN3XUUaeg\n\tVEUU0HgkFHll3dllY56AIYeRXoWTnH18h+Jjb9Se9q0KzeIkJ8hm7mJNrc1rep7OrT\n\taLLYB+tGQY/Unj4Etx2HGqtWzq72bknul5DGxHN2FTzuiYEtAzoJLXX3KBZ72kY525\n\t6sCFGZsm0mfxq8pxkfo0e7lSj0M4tAwiXBmUtTE9uBvvC3AwhFpgXU0qOQrArMEZv0\n\t02f+Cn+HgmsxQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;\n\ts=badeba3b8450; t=1649382155;\n\tbh=OCbDJ7RSFLjMPLMkGk9bWWJ6Mx0JwZXcnyjk3bi70qI=;\n\th=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;\n\tb=jMHqo95r8IoJ46se2acSS/D4cv40ZGZpBkFpGwySTf7lMajDbNo9U3nH4nWkyg8FK\n\tpkcgu+kGPkGniA8FsmmkTISfQkcyV4wgsL2SHtl9w8ksOz7yowqJKbuNaVjBJ5UeGf\n\t+/k2pEJvo9X07e9IfnAdq6WJNt6Ksb1ds3XGSl80="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=gmx.net header.i=@gmx.net\n\theader.b=\"jMHqo95r\"; dkim-atps=neutral","X-UI-Sender-Class":"01bb95c1-4bf8-414a-932a-4f6e2808ef9c","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  8 Apr 2022 02:42:30 +0100","Message-Id":"<20220408014231.231083-4-Rauch.Christian@gmx.de>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220408014231.231083-1-Rauch.Christian@gmx.de>","References":"<20220408014231.231083-1-Rauch.Christian@gmx.de>","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","X-Provags-ID":"V03:K1:4MkCzefP3WxK74Nf8D5bqXR/5AMTla6+FGcLYGpkxvZZRJ2ygvF\n\tdBAGBsUeE9zVqXrzobto/Qd6rJoFS7uFLQddv6pFcY29Ojqfd1mLF/2C20fMijplYvZf2HL\n\ta/ZzXx5tfi6TZDjdePcq8Fca09Wq6WjRan4/sbTf10utML3u6rOoM1X8WH0dNY4CFjktSU2\n\tkL+2gaGeG5nEb2VzimQFw==","X-Spam-Flag":"NO","X-UI-Out-Filterresults":"notjunk:1; V03:K0:0qPSGG8ZJgc=:XSukAi2h6SenPQWfvAqxbc\n\tKQB41xrjWCzugovt6HtGGiBJANPKuJhr9Bd8wOe/9QwUI6tRo2ogsrG5LrcPtBfZXOq7U4jn/\n\tMW0pjowL3m9HgMPCd/R1aEHOVutp8GQb6K9FH3YOFORV3PpdPaOFl+6tPbdTj/6vTWDnOcGt6\n\tGOXIeTktcokROiYLFNFvYeqe5yNHczm+0EY1tH2tclr5Xthj4ED+IkRn2ZzTrJTBp8ZdU0ofw\n\t4Yvg5bmFnECTQUvNHq9Ukz9ZqCbVEgSaphJMCSrowiFwgJ5rbvWHPHxKFH/ookS0X45K+SpTb\n\txTa84847unEEx60+isy4FGJ+Ce9suOad52RKuZAI998zWqqaJXxP1CSSNYYyrB30cdctplfF4\n\t6IUc4jVGWtxFxazwmJKQHXdIVAswGdyBjkhIAV+JuiygF5XxazpGgwJ/d3Ym862esPnfoGJjf\n\tBHxOT44S6Mj72rpfi/rUjK5TesUQRs/9kSSQrs+jl3q6K1NszG8XTTO/qEoE224x/0EjHshs2\n\tNSloN0igZloxkCwTbxSQFlkrReJarjAzBYYCi1j0OU+pPC1SMETL5e9ZE3W1ToIY35irjzyuh\n\twYGsINYG9s2TOdpxRLOFpeC5RGTgVlFM1VhLPxC9Zwfr5KjdPNHzWnHgmZCkM/U26hIo1mQno\n\t6up0D42ES0zw5acIkMS+BCm35ajuNow6FLhRc9G39s+6rRrekcyO85jFZLGivmNE4uM18Djvr\n\tmDvCuXesOeIRdux78FqEqjIQJWSqZ8/wrubLL9rEg//OHjmXLAMXT2y/1c5rpT/hQz881oD74\n\tuKpz5mNWNCXq4jRYcYLeVknTTHgNCPK9QNSnFCTZ/cNTptePnHHFhsny/8RkeGQ3Z1qg2bgyj\n\tWSV51PHMaWsw+111eJ7/EflIkTNBwjUAZhra/wfGY5WaLEXTcgBAyKf2nBE8PI9fKoYh7TV6T\n\thhzIiLjboVm3lfIQTn07xYLmvEESO6b+Aez/nMHcFF3m37O0LEqpyYZDakoxo0cjXjB/g+JqL\n\tzCcqQWOnSfYPDJdSn+wwJb7J/F6TJmYpeImZtlFrcQEFqKpFczVUG01n6+zIkHySTwwPhsX0Z\n\tlccYAYMLB53AgM=","Subject":"[libcamera-devel] [PATCH v3 3/4] apply explicit fixed-sized Span\n\ttype 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 src/ipa/raspberrypi/raspberrypi.cpp            | 18 +++++++++---------\n .../pipeline/raspberrypi/raspberrypi.cpp       |  2 +-\n src/qcam/dng_writer.cpp                        |  6 +++---\n 3 files changed, 13 insertions(+), 13 deletions(-)\n\n--\n2.25.1","diff":"diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 89767a9d..5a5cdf66 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -500,18 +500,18 @@ 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, Span<const float, 2>({ static_cast<float>(awbStatus->gain_r),\n+\t\t\t\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>({ static_cast<int32_t>(blackLevelStatus->black_level_r),\n+\t\t\t\t\t\t\t\tstatic_cast<int32_t>(blackLevelStatus->black_level_g),\n+\t\t\t\t\t\t\t\tstatic_cast<int32_t>(blackLevelStatus->black_level_g),\n+\t\t\t\t\t\t\t\tstatic_cast<int32_t>(blackLevelStatus->black_level_b) }));\n\n \tFocusStatus *focusStatus = rpiMetadata_.GetLocked<FocusStatus>(\"focus.status\");\n \tif (focusStatus && focusStatus->num == 12) {\n@@ -816,7 +816,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@@ -1100,8 +1100,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 d6148724..0fa294d4 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1696,7 +1696,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 = controls.get(libcamera::controls::ColourGains);\n+\t\tlibcamera::Span<const float, 2> colourGains = 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());\n \t\tstd::array<int32_t, 4> gains{\ndiff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp\nindex 34c8df5a..2fb527d8 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 = metadata.get(controls::ColourGains);\n+\t\tSpan<const float, 2> const &colourGains = 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 \t\t\tneutral[0] = 1.0 / colourGains[0]; /* red */\n@@ -446,7 +446,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 = metadata.get(controls::ColourCorrectionMatrix);\n+\t\tSpan<const float, 9> const &coeffs = metadata.get(controls::ColourCorrectionMatrix);\n \t\tMatrix3d ccmSupplied(coeffs);\n \t\tif (ccmSupplied.determinant() > eps)\n \t\t\tccm = ccmSupplied;\n@@ -515,7 +515,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 = metadata.get(controls::SensorBlackLevels);\n+\t\tSpan<const int32_t, 4> levels = metadata.get(controls::SensorBlackLevels);\n\n \t\t/*\n \t\t * The black levels control is specified in R, Gr, Gb, B order.\n","prefixes":["libcamera-devel","v3","3/4"]}