From patchwork Wed Jun 1 23:17:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rauch X-Patchwork-Id: 16127 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 35771C3256 for ; Wed, 1 Jun 2022 23:18:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0EEC165637; Thu, 2 Jun 2022 01:18:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1654125499; bh=dYd4SEO/wKUUSY9mxAYDnNUBt2P9MmuPdq+E3WZUQhc=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=fNjqzZhSXM/uzQRVco8/lbq1lDO8PSsuwwDrQziihg5YgDniK3VGg+1kEWHpBPE6f rMBzj/bdvK/MzCtA1cRW/eOSsBF31el1KOT08wo9SEluY4gdnx3b9bGlpJ8DKLfvY5 XyKXoXRHSoRTT1yhaas/CRwEa+jvxcpvWYDQeQoJK+qzJ6wIX88GQJZo7mS2KtDzyx e8ILF0c9HhnLnVD6RCWYNENYCSzKSdX/j5wgD7Oid1bJp9E10jIndQ03xCMvb9PqU+ dhbccKnUi8sXJJ7SBmJT/UQZuTxgf8wCZBixzCWf1TJJQ+sgQZum4Elfu1fyXt3AW2 BRck5R6JfnvPw== Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A81EC60414 for ; Thu, 2 Jun 2022 01:18:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=gmx.net header.i=@gmx.net header.b="PYSm5P3I"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1654125495; bh=dYd4SEO/wKUUSY9mxAYDnNUBt2P9MmuPdq+E3WZUQhc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=PYSm5P3IxbFCv7t23iJEsJCLK5TIqyQ0WhU9R1WRiex9EZRsKIGEp7BYToLf2Rgd+ nPN5f/GZCAlzrhH+6QCbiMWQU4Cxzqcjga2Cx+cGKXDDfjig2SRDqAZFw5pjY2UpTT GGz9Lo5wgp4DHs5o3K0MGM2kXO43ePWB1xAFH3Uw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([92.18.80.244]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MnJlc-1nUsHT0mOK-00jFUa; Thu, 02 Jun 2022 01:18:15 +0200 To: libcamera-devel@lists.libcamera.org Date: Thu, 2 Jun 2022 00:17:59 +0100 Message-Id: <20220601231802.16735-2-Rauch.Christian@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220601231802.16735-1-Rauch.Christian@gmx.de> References: <20220601231802.16735-1-Rauch.Christian@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Op+qXHQQEKBCOheyQk/oTn6rNWtA5UwB5UlmUjMIYdkyMgHP7di GTqa8hPOhtizsErYUJc4d6FmDKg3uQLDpR/6RLDVKdM93tz5MndGZOmil4q2yfH0I1VeJUf HiktF/DUbp48Nx7fS7mxVgTUlJ83ZnHzxYcNokjzYttDxyQ0I2FRbnKn8lONWoRFIjhBf3o Hb1hBKo2LkULtcs5BOGFQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:c+PSh9tbOF0=:2Z85xk1X2cmusSkETqZGmE iSGhRldlUkP0MunAj8EN/XDeISBEne9zx7xrqukBqV2sJo8eDez8Kat+z7bclfL0OmF8jpu+S YqffFRKI6FNiNqBPVjozSrFvnGKytR+gFIT2b1vKe28OcrQOOHgfM7yFiiCwNiOsIBKraZuPN 9yGxuwARLj5gBaRGQrY4BNtnP7jXzHIvvWcwEHZotV92hzpou8fYFBTDSjEStp38ccPL/zVFo y9f3MpDnCsUD9wqAKW4aF8gul0O/bEiQ8B02QyEBitYS+ppS0PzvxLaS231YXyAxQ7gKIw1Cx ZAYy2AnXgehCfW8707KfrAWF/zwrOABKGOBcf96B0010O5EfrOm9qyrv7QzkV1OR/1nktemU6 et8DbvCmtaLj4WYlCtrs9HluGrck9bqK/pGIoRWIxpdPO2fC7+NKtIhi5xF1FjxiiI4M+gbl5 GhrQyfqiZJtkg5L+dnbKP1bWaDBZhQncJTQ+ad4VK1Pd5m8cbLcmR98JmyEAE0pMwEu8HI0Ih 3AAECtmTMUdmrZPLbx3wAtYIquvMzAr/qyp5nijaPOpbDWzv0ANM9sXSwRuRCoDvETPuQ32pG a4nS2WgLGyCGNCB2i4aNGeh1EwAYbsRKFr22eTRyNrQKrCovcxtP/+H6TTfZkeFfz1ApZYdqf sCQQQglAIl+4VVVbpL/BUvhWYMmpWN3XZ5kVdwSruB4f+9PYfl6SJyZWy0+dJzKO1AgK+obDA /x5QbaNnj5uds6wCoG2US1Zhdje9JqGzmH4RdvINLXPo9I+9BUz7Wb9rO4ydYwyBmShcZQQsg 70/2SvGYusRa2BsQcz29wu9T78BIqdS0IcauyZ7BECC7P6GrUm9ltg3g2gBUI785Ba8rR1WLO QuG4uPBIhvSo2PSIBRMdTYGyQP8TVfQUMKVA824BdVAlWewh8KZiBMNXfPQCeiUSHQPd5F0Kc uAuNN1MIWKvDGpIktM7MijPFBd6W5egr+VtpezJwrHhaE3PMQ92hxRAVjP5JGyQLhfljCuH2q bz3zfQGzmGlCh8PQwXndqMiDvO241jpTEJiG//ugDQGoIVG2nlhfq6Z8qryS1+N0cGd+EZrcV vIHQpJRKJnJnY48NTJFJhOKLNb+88M6fG4boLxkJdf4kEVShlYpnoqpxg== Subject: [libcamera-devel] [PATCH v5 1/4] libcamera: controls: Use std::optional to handle invalid control values X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christian Rauch via libcamera-devel From: Christian Rauch Reply-To: Christian Rauch Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Previously, ControlList::get() would use default constructed objects to indicate that a ControlList does not have the requested Control. This has several disadvantages: 1) It requires types to be default constructible, 2) it does not differentiate between a default constructed object and an object that happens to have the same state as a default constructed object. std::optional additionally stores the information if the object is valid or not, and therefore is more expressive than a default constructed object. Signed-off-by: Christian Rauch --- include/libcamera/controls.h | 7 ++++--- src/cam/main.cpp | 4 ++-- src/ipa/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 9 ++++----- .../pipeline/raspberrypi/raspberrypi.cpp | 10 ++++++---- src/qcam/dng_writer.cpp | 15 +++++++++------ 6 files changed, 26 insertions(+), 21 deletions(-) -- 2.34.1 diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 665bcac1..363e7809 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -167,7 +168,7 @@ public: using V = typename T::value_type; const V *value = reinterpret_cast(data().data()); - return { value, numElements_ }; + return T{ value, numElements_ }; } #ifndef __DOXYGEN__ @@ -373,11 +374,11 @@ public: bool contains(unsigned int id) const; template - T get(const Control &ctrl) const + std::optional get(const Control &ctrl) const { const ControlValue *val = find(ctrl.id()); if (!val) - return T{}; + return std::nullopt; return val->get(); } diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 79875ed7..9b773931 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -301,7 +301,7 @@ std::string CamApp::cameraName(const Camera *camera) * is only used if the location isn't present or is set to External. */ if (props.contains(properties::Location)) { - switch (props.get(properties::Location)) { + switch (props.get(properties::Location).value_or(int32_t{})) { case properties::CameraLocationFront: addModel = false; name = "Internal front camera "; @@ -321,7 +321,7 @@ std::string CamApp::cameraName(const Camera *camera) * If the camera location is not availble use the camera model * to build the camera name. */ - name = "'" + props.get(properties::Model) + "' "; + name = "'" + props.get(properties::Model).value_or(std::string{}) + "' "; } name += "(" + camera->id() + ")"; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 3b126bb5..00600a2e 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -939,7 +939,7 @@ void IPARPi::returnEmbeddedBuffer(unsigned int bufferId) void IPARPi::prepareISP(const ISPConfig &data) { - int64_t frameTimestamp = data.controls.get(controls::SensorTimestamp); + int64_t frameTimestamp = data.controls.get(controls::SensorTimestamp).value_or(int64_t{}); RPiController::Metadata lastMetadata; Span embeddedBuffer; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index fd989e61..1e9e5081 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1145,7 +1145,7 @@ int PipelineHandlerIPU3::registerCameras() /* Convert the sensor rotation to a transformation */ int32_t rotation = 0; if (data->properties_.contains(properties::Rotation)) - rotation = data->properties_.get(properties::Rotation); + rotation = data->properties_.get(properties::Rotation).value_or(int32_t{}); else LOG(IPU3, Warning) << "Rotation control not exposed by " << cio2->sensor()->id() @@ -1331,7 +1331,7 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer) request->metadata().set(controls::draft::PipelineDepth, 3); /* \todo Actually apply the scaler crop region to the ImgU. */ if (request->controls().contains(controls::ScalerCrop)) - cropRegion_ = request->controls().get(controls::ScalerCrop); + cropRegion_ = request->controls().get(controls::ScalerCrop).value_or(Rectangle{}); request->metadata().set(controls::ScalerCrop, cropRegion_); if (frameInfos_.tryComplete(info)) @@ -1424,7 +1424,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer) return; } - ipa_->processStatsBuffer(info->id, request->metadata().get(controls::SensorTimestamp), + ipa_->processStatsBuffer(info->id, request->metadata().get(controls::SensorTimestamp).value_or(int64_t{}), info->statBuffer->cookie(), info->effectiveSensorControls); } @@ -1458,8 +1458,7 @@ void IPU3CameraData::frameStart(uint32_t sequence) if (!request->controls().contains(controls::draft::TestPatternMode)) return; - const int32_t testPatternMode = request->controls().get( - controls::draft::TestPatternMode); + const int32_t testPatternMode = request->controls().get(controls::draft::TestPatternMode).value_or(int32_t{}); int ret = cio2_.sensor()->setTestPatternMode( static_cast(testPatternMode)); diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index adc397e8..556af882 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -365,7 +365,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() * error means the platform can never run. Let's just print a warning * and continue regardless; the rotation is effectively set to zero. */ - int32_t rotation = data_->sensor_->properties().get(properties::Rotation); + int32_t rotation = data_->sensor_->properties().get(properties::Rotation).value_or(int32_t{}); bool success; Transform rotationTransform = transformFromRotation(rotation, &success); if (!success) @@ -1706,7 +1706,9 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList & * V4L2_CID_NOTIFY_GAINS control (which means notifyGainsUnity_ is set). */ if (notifyGainsUnity_ && controls.contains(libcamera::controls::ColourGains)) { - libcamera::Span colourGains = controls.get(libcamera::controls::ColourGains); + libcamera::Span colourGains = + controls.get(libcamera::controls::ColourGains).\ + value_or(libcamera::Span({ 0, 0 })); /* The control wants linear gains in the order B, Gb, Gr, R. */ ControlList ctrls(sensor_->controls()); std::array gains{ @@ -2041,7 +2043,7 @@ Rectangle RPiCameraData::scaleIspCrop(const Rectangle &ispCrop) const void RPiCameraData::applyScalerCrop(const ControlList &controls) { if (controls.contains(controls::ScalerCrop)) { - Rectangle nativeCrop = controls.get(controls::ScalerCrop); + Rectangle nativeCrop = controls.get(controls::ScalerCrop).value_or(Rectangle{}); if (!nativeCrop.width || !nativeCrop.height) nativeCrop = { 0, 0, 1, 1 }; @@ -2079,7 +2081,7 @@ void RPiCameraData::fillRequestMetadata(const ControlList &bufferControls, Request *request) { request->metadata().set(controls::SensorTimestamp, - bufferControls.get(controls::SensorTimestamp)); + bufferControls.get(controls::SensorTimestamp).value_or(int64_t{})); request->metadata().set(controls::ScalerCrop, scalerCrop_); } diff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp index 34c8df5a..e119ca52 100644 --- a/src/qcam/dng_writer.cpp +++ b/src/qcam/dng_writer.cpp @@ -392,7 +392,7 @@ int DNGWriter::write(const char *filename, const Camera *camera, TIFFSetField(tif, TIFFTAG_MAKE, "libcamera"); if (cameraProperties.contains(properties::Model)) { - std::string model = cameraProperties.get(properties::Model); + std::string model = cameraProperties.get(properties::Model).value_or(std::string{}); TIFFSetField(tif, TIFFTAG_MODEL, model.c_str()); /* \todo set TIFFTAG_UNIQUECAMERAMODEL. */ } @@ -438,7 +438,8 @@ int DNGWriter::write(const char *filename, const Camera *camera, const double eps = 1e-2; if (metadata.contains(controls::ColourGains)) { - Span const &colourGains = metadata.get(controls::ColourGains); + Span const &colourGains = + metadata.get(controls::ColourGains).value_or(libcamera::Span({ 0, 0 })); if (colourGains[0] > eps && colourGains[1] > eps) { wbGain = Matrix3d::diag(colourGains[0], 1, colourGains[1]); neutral[0] = 1.0 / colourGains[0]; /* red */ @@ -446,7 +447,8 @@ int DNGWriter::write(const char *filename, const Camera *camera, } } if (metadata.contains(controls::ColourCorrectionMatrix)) { - Span const &coeffs = metadata.get(controls::ColourCorrectionMatrix); + Span const &coeffs = + metadata.get(controls::ColourCorrectionMatrix).value_or(Span({ 0, 0, 0, 0, 0, 0, 0, 0, 0 })); Matrix3d ccmSupplied(coeffs); if (ccmSupplied.determinant() > eps) ccm = ccmSupplied; @@ -515,7 +517,8 @@ int DNGWriter::write(const char *filename, const Camera *camera, uint32_t whiteLevel = (1 << info->bitsPerSample) - 1; if (metadata.contains(controls::SensorBlackLevels)) { - Span levels = metadata.get(controls::SensorBlackLevels); + Span levels = + metadata.get(controls::SensorBlackLevels).value_or(Span({ 0, 0, 0, 0 })); /* * The black levels control is specified in R, Gr, Gb, B order. @@ -593,13 +596,13 @@ int DNGWriter::write(const char *filename, const Camera *camera, TIFFSetField(tif, EXIFTAG_DATETIMEDIGITIZED, strTime); if (metadata.contains(controls::AnalogueGain)) { - float gain = metadata.get(controls::AnalogueGain); + float gain = metadata.get(controls::AnalogueGain).value_or(float{}); uint16_t iso = std::min(std::max(gain * 100, 0.0f), 65535.0f); TIFFSetField(tif, EXIFTAG_ISOSPEEDRATINGS, 1, &iso); } if (metadata.contains(controls::ExposureTime)) { - float exposureTime = metadata.get(controls::ExposureTime) / 1e6; + float exposureTime = metadata.get(controls::ExposureTime).value_or(float{}) / 1e6; TIFFSetField(tif, EXIFTAG_EXPOSURETIME, exposureTime); } From patchwork Wed Jun 1 23:18:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rauch X-Patchwork-Id: 16128 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 232D9C326D for ; Wed, 1 Jun 2022 23:18:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6D16C65640; Thu, 2 Jun 2022 01:18:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1654125499; bh=zcOLN4jTQsCp6vUKu3Yx2tGvQEPJLyoWBisxOznYHvg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=iSy+lAF9VzIfrIRYBHNcmNhIHA4Rv/AwzETtFfSQTGLP6Y4URD9ABI64DbIurK2O7 Sh+93v9sRiWmuZRIW9aKB/Zto5sXDTpqIxdzg9SfXQe9OfaOw6Xmv2lkvsvF+nFFlo nvb5CuQq62+NwXjlBcvmzsBcEkK+Ysd3T2QIj0LiD71nZ7Qsvkd24tIxXT5YGbsJ9J dUk77jvrJj2CIDP9oNVEElQx2Yi8hJ47Tt0f4ojlEaXvXyEJdcZ0Pz71UFi6Ad5ETL CtVx/YAC7/tF+4w5/v9ZKncpcN3gQvVW+W+CCRoav5JJPikkHxh8JeBvBa+AsW/Ohr ezf4p8mYB2srw== Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 187A66559A for ; Thu, 2 Jun 2022 01:18:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=gmx.net header.i=@gmx.net header.b="YLxOH5fD"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1654125495; bh=zcOLN4jTQsCp6vUKu3Yx2tGvQEPJLyoWBisxOznYHvg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=YLxOH5fDz4Z10FPYiv8W2vDTwMvvLFLx7GbuD+GsjMGkx3bBiPRtS4g1NzhNO163y MEFNaWjXtBLuqh7BVv310AHlqKjh9kR7j5EE5pmMRvpDBmLuV7tBQnzPUDVDBC9fal ytzG3j1Qbr3J3768yEYymn/t+/3o6XtOtQ4iDRmM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([92.18.80.244]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MoO6C-1nTlHj2Bq4-00okjI; Thu, 02 Jun 2022 01:18:15 +0200 To: libcamera-devel@lists.libcamera.org Date: Thu, 2 Jun 2022 00:18:00 +0100 Message-Id: <20220601231802.16735-3-Rauch.Christian@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220601231802.16735-1-Rauch.Christian@gmx.de> References: <20220601231802.16735-1-Rauch.Christian@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:s2PcrFHzj+/gVUnAfhiHzzN9LtlpsroVzFKbRGY0oGxyovhBtNj roD7rn6nB0qxN+Xfh803XRLDFSc64Up8Q0PIrLTsrBdO+NN4IBfqRs5ZiToT4Oo6wjEb7e4 8mSSiZg8qhkj/9D+RG41+u5VL4545Ftcs4fFpk22wrHvlpRB9CMOwsNyDZuz6LyHkHVea+q +ccOf64mFQ0DbGdj2U3EA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:j45yyDPePNw=:qtF+7REW1ZXl8ai9DMyMrI /4ydVDLj0E9a8iorIsA7a3LmGTGOud9Q0ZOphxdHfu4cz/4W9cnDH6jNK3BmDWu1eak4pXQMt LH2NcYx/RN2WHxMwlnD6InAS6ycKji0hOoJM9dgqUagduEaev2F78iz5XtzzX27ACfR+1SEEY k6l4Qt+dZWHptsnbniU9CB9Ha07rYVA/dPj6tLzNYPJ8zNM9SXzBjBgZjeCM5YTALsty7XS9U UJfWlK+TmHegLFR6Mt5hU2AhaVEzQ1lpLWz+jFvWu2h+WdkwVJQcsn6B+/VOIZwSYP/sl0FTv GJiN71JCUYxOvYiqrF6CzLdoF3YagwHDorAaaxZQF4yUqn47GFKqZrpnKZBqK6JTza1EL0dFN bF4PO86WY/wwuNN6nq77riJfk6RVq2L01wXFrvcGQs1m4rJLkoMJ4yJrsDX/JQgwnfVwukhn3 ho7bJauZLP35hSs7SDgjVPeawyqciSWYg/2U/bRfm4MC9vi8iwUS+5WmaBWpJpTP6ow4n6oOh dEQpR3mNVvpT0hbnl/RYqwo8sgFAd1VmEGZOArpSFObK09ss+etzDmjOiEjjldhdunpds6VY9 MwdwCu3gEkDN1ezk2zTB6118j1/fbkVd/xJWenNqGoUT/pReNtnBdUOxB8jjmkKFcjr9byebp OCv5m46D6GR6wPsgmwWZeYAAxVBnUkGapZ5Ia0aSoQTQOWnqfbtp2LNcQzEL/N5PGIMfOUtpK t8CPqyC5hnYvBpS3qIfsLkYPgi8xdEjUKxGmjccrBPGaHB6RhAezbX8McOL8ioU1dYIchQ7hc 7UnRJTJG54aSASIYEZs05p1O+ey50z3hudZDVgjdzpeIZnyia46nFhLTi/8EgTuj9sIyZRKFZ Ly6TNXBOu2jYzlRuhtHJiTxHyvyElDmSVZk2MWdEUVoZBYVzI0/ogM4ATzIjTIDKGlzyqNE+A BG68v/Dpb+YEXOWq2RDZ9wSbPaM6tlQ0/AMPgGBQbYEZtUfP3zg0yL5aHJgymSkGF9maEctIB UFx4JNMSi3/oK9O54OKEWmr4dnDI/454SAoekXjZCslvW1+TGd5AKfXpNbMdQilsxhtMIvO3F 0xxIZyg0kdXk0t3eIAZz/DcNt+mUtAgdKflBChRUMGvFEgmzrSsiaI0qw== Subject: [libcamera-devel] [PATCH v5 2/4] libcamera: controls: Define size of array controls as a shape vector X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christian Rauch via libcamera-devel From: Christian Rauch Reply-To: Christian Rauch Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This follows the convention in other Tensor APIs. Since all tensors are represented as a Span with a single dimension, values provided in 'size' are interpreted as fixed-size Spans, while an empty array ("[]") will be interpreted as variable-sized Span. Signed-off-by: Christian Rauch Reviewed-by: Jacopo Mondi --- src/libcamera/control_ids.yaml | 4 ++-- src/libcamera/property_ids.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.34.1 diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index cd1d4512..f707c1f5 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -291,7 +291,7 @@ controls: transformation. The 3x3 matrix is stored in conventional reading order in an array of 9 floating point values. - size: [3x3] + size: [3,3] - ScalerCrop: type: Rectangle @@ -515,7 +515,7 @@ controls: the window where the focal distance for the objects shown in that part of the image are closest to the camera. - size: [n] + size: [] - AfTrigger: type: int32_t diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index 11b7ebdc..a87485d7 100644 --- a/src/libcamera/property_ids.yaml +++ b/src/libcamera/property_ids.yaml @@ -497,7 +497,7 @@ controls: - PixelArrayOpticalBlackRectangles: type: Rectangle - size: [n] + size: [] description: | The pixel array region(s) which contain optical black pixels considered valid for calibration purposes. @@ -592,7 +592,7 @@ controls: - PixelArrayActiveAreas: type: Rectangle - size: [n] + size: [] description: | The PixelArrayActiveAreas property defines the (possibly multiple and overlapping) portions of the camera sensor readable pixel matrix From patchwork Wed Jun 1 23:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rauch X-Patchwork-Id: 16129 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 79CE1C326E for ; Wed, 1 Jun 2022 23:18:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C370E65641; Thu, 2 Jun 2022 01:18:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1654125499; bh=ATeKyqRnHw9iVa0bTgA+UNdA5iARog/YOYpAYY2+Gv0=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=w/Bwbl2oBcYQMJZbOJudJKCs2wyGQAoZSaxa46aZxIaD3UUbPE032fmN2k71G2eQm SSNzRt46wdG/unfcbbnSWKPc8uh2bxd+qPoVhyQMnyBUb+rZlEG1I77ujHXFJn+Uph aje0oomV09w/aWFd4LRjcWOQpkbwW0xbSnV9I4HUOTS8mdqorgYmqD0sPT/riqoRsb /RXoDPi6YU56yhg3Y1Ol1Wm/YjMCz1InhCdaKhak8BngxEPMSvbotuNBEWWlFALoH+ q0132JAXJ+ssN92gLRMLeWCQWIuHRal5HfR+uZ7nUb/GM+2YVuNVS5RRaed/g+SCGj kcRMhr9v0cV5w== Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FAA165632 for ; Thu, 2 Jun 2022 01:18:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=gmx.net header.i=@gmx.net header.b="ED6AoOGm"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1654125496; bh=ATeKyqRnHw9iVa0bTgA+UNdA5iARog/YOYpAYY2+Gv0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ED6AoOGmKmjE/qfhSJwV2ACzqDIZ3eDxTap0UnEUtKr6nNLp9+8IY3ovKqf5t29+7 oPod3HNTMui8dHbO18hUr8J0Vz0R3G43Kdeonjk7D2RZjf2aN7nhFC80qORwoghZs2 2Yg9BR4N/yLR5w9EHFxHwCvgASlggFNvYSZIx9lY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([92.18.80.244]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MfYPY-1nKzrL3JtI-00fzHs; Thu, 02 Jun 2022 01:18:15 +0200 To: libcamera-devel@lists.libcamera.org Date: Thu, 2 Jun 2022 00:18:01 +0100 Message-Id: <20220601231802.16735-4-Rauch.Christian@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220601231802.16735-1-Rauch.Christian@gmx.de> References: <20220601231802.16735-1-Rauch.Christian@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:khRDyhaHiqHSr2y8aNEkv0c27ogfUhr32bCokD3fpXQbhYx8ORC ImGdYdaDRuhSGyKvcZLhXLbKGs0XhkXvcAFpGKW5UL1MAl2B1CLeUvX/aHsUhM8YAzTn23O jfvC8awfxYqpXH1oSDMDdw8fvBg8qZQy/AIrXRBUMS73uXF5pn/HYhSlsRCHF7HsGuGqEbU df/ZwUDVbVJRhy+YJUk1w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:/g4I5oSw5/s=:AdIhL/1EBP39/x1yd27y8N 0U6G8Xbqqj9Kp1GfRWm2ekMvXqYaNzJF9NE1KAhRcmjA0dJMMYylfhtdTTATlXo5Be1QDCPDz o7f661cjIrBmOKDFnt052WC1EhZa61DfBExCV92EaxdFC+DJrMN5gwQ+2Hd4+NW5aX9lFYQqD 5ExqCKboDW4BwOUXzC9iRJdbf/7bWFaRdU65Y2kSqIfw2VwIZnqlLcjAcarhShoWzVtofervY 59wJWL/1pt7NkDdbo/FAbsQJP4kvy6l/Lcm+S7wKYrF4rnuksJJeakS3XNHzrt1UcNSyKJnBS 1bicsKR8sbM+WlL7n8RZ837nLFinH0o571Poej4R0j8Y88TPC4AnNgdBn3VDGPFHISqDDlW7U bBxrsDRrOuz1bjf5Id6L2Zf6aOK3jmIgh6pl3bZBpzwR4GjQE8o0oBYz4P7rrNclyLTf7fliL oQhY5YNlSdm5W2HnzHfo2iNnKm67fdh6c9aCmXsQfjO/lZxwYn7HY2Aa1a2qTVUFNUU7gByK4 YadbblYWbE0rBBQWZy5Ez3XQ87evB1n3zhzm7l7K+baR8P2QHo4rd0G/BfOGFfzfOM2BodDlT Jbn3tQsFEz0vv3DtgHbUSbStuHsjRZuoquCwKWqXdtA/i7tHBpobZGbWkuH7ajdkeZ22ymZ09 UwJz/qdvSSOv8XuvTNvKpzkeIGKiY8cMcK2zR4yH8stqlJ/EPMtRuJAyDxmKtCjbcsp2C6pNC cs3/5UbZtH/ekf7jhy9OGWWG+QchuRa+yz2p2cNVfUgB1TSqA4e7lIJ/VLzKWqF4K2XTgL/ah cZ0VtAgFPCDz3cuN8KnzvzWy+a5pIP5xdqjyp675jadrKRe3ho3nwU6nT5qL8SFAlm/o4V8jN 9kqIMl421jOXVkqcMXbsLNOgrN3GIoJ51sFzYeUvFFoQ80vrQsbkraBk4Dy2KqIcEqWnX+F6O tcARSj1CnVe8XerGtU2FOlAeXIU3dTzP9ogEwhQk/bOHIdxxs+Yd+QVrLE4O/fPxlXK0BHvh9 +2CUFNzIvQRnLwjYkORei0oZ6ALbQHqRhxmIUSzB+iKMpD4f3u4V1DD3iPj+KIHKpTaFcdzPA mJzTvjRP0V3sdYLvjxeeSBpZYU3aduGTfZitPTcqUbGif8CeoRn97quvA== Subject: [libcamera-devel] [PATCH v5 3/4] libcamera: controls: Generate fixed- and variable-sized Span Controls X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christian Rauch via libcamera-devel From: Christian Rauch Reply-To: Christian Rauch Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This defines Controls with a 'size' as either variable-sized Span or as fixed-sized Span. Signed-off-by: Christian Rauch Reviewed-by: Jacopo Mondi --- utils/gen-controls.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) -- 2.34.1 diff --git a/utils/gen-controls.py b/utils/gen-controls.py index 3f99b5e2..c9e79a22 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -7,6 +7,7 @@ # gen-controls.py - Generate control definitions from YAML import argparse +import math import string import sys import yaml @@ -22,6 +23,25 @@ def format_description(description): return '\n'.join([(line and ' * ' or ' *') + line for line in description]) +def get_ctrl_type(ctrl): + ctrl_type = ctrl['type'] + ctrl_size_arr = ctrl.get('size') + ctrl_is_span = ctrl_size_arr is not None + + if ctrl_type == 'string': + return 'std::string' + elif ctrl_is_span: + ctrl_span_size = math.prod(ctrl_size_arr) if len(ctrl_size_arr) > 0 else None + if ctrl_span_size: + # fixed-sized Span + return f"Span" + else: + # variable-sized Span + return f"Span" + else: + return ctrl_type + + def generate_cpp(controls): enum_doc_start_template = string.Template('''/** * \\enum ${name}Enum @@ -50,11 +70,7 @@ ${description} name, ctrl = ctrl.popitem() id_name = snake_case(name).upper() - ctrl_type = ctrl['type'] - if ctrl_type == 'string': - ctrl_type = 'std::string' - elif ctrl.get('size'): - ctrl_type = 'Span' % ctrl_type + ctrl_type = get_ctrl_type(ctrl) info = { 'name': name, @@ -135,11 +151,7 @@ def generate_h(controls): ids.append('\t' + id_name + ' = ' + str(id_value) + ',') - ctrl_type = ctrl['type'] - if ctrl_type == 'string': - ctrl_type = 'std::string' - elif ctrl.get('size'): - ctrl_type = 'Span' % ctrl_type + ctrl_type = get_ctrl_type(ctrl) info = { 'name': name, From patchwork Wed Jun 1 23:18:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rauch X-Patchwork-Id: 16130 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 20110C326F for ; Wed, 1 Jun 2022 23:18:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5A05565643; Thu, 2 Jun 2022 01:18:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1654125500; bh=9jrZMPAxGAv+cComYWDwcLi+XVv2D7JD4nqcULpKv2s=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nTK7RgipkfaLqzEJEP2LVQvObLsjOamPNx6vCY1ox78gVQ10W9kkOEFtfJ7Mf7KQ2 6BOyLczJr1W+hb/M7qnQMe4Yvk8zNJqeIt7e4P41CXeNJFUM5Fifx8F9OXzwhIzS1d ArHwtZiV6Rng4hyLkHY5hFzKsDQqki+YLuyqhd95t7wiLJmtPjqrnZY6g5rlVa/5ch QS02UikBuY49btdLKMMqEhcPhzCN+ChXqm7qPhszR7I9R4K1Zav1T61plOWN5y+W5w dwZQdZDz3bXSCaLyjw6IUw/bmahhNvota015HNSfqQRJ3v1diL4VdJRnt85Kq81pcM g+rwXl8vJ/v9Q== Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 923FA65633 for ; Thu, 2 Jun 2022 01:18:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=gmx.net header.i=@gmx.net header.b="FS5SowBD"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1654125496; bh=9jrZMPAxGAv+cComYWDwcLi+XVv2D7JD4nqcULpKv2s=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=FS5SowBDLUFGXXrPkAF4vexMswvrmwuxYFVLy5q8YCUVGhkzKMbo8Ke4e76UyxuBu wKGuOVndV8hXlaaTlZBETdYSbtv5+4e5aQcKvj2c0DPV2xfHxJkvWJzNSWW3qnoiKS XMNoCyabRobq2buARZlrnGcrt5kZJV1x4Y+Tjb1Q= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([92.18.80.244]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N9Mtg-1nhzJc0EeC-015KkG; Thu, 02 Jun 2022 01:18:16 +0200 To: libcamera-devel@lists.libcamera.org Date: Thu, 2 Jun 2022 00:18:02 +0100 Message-Id: <20220601231802.16735-5-Rauch.Christian@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220601231802.16735-1-Rauch.Christian@gmx.de> References: <20220601231802.16735-1-Rauch.Christian@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:N1Bb9Bu9/QY0qxxGTU1wEItAuEyXaXXjC/GoD2ndqH2P1SnwGfv yQ37TX5hwniioGsi5Q+/QBXXbftxCDwqSgcz9ZdZqwwrHbJEB9ai1TLX4TR97GHcWZ7qij9 6YU/uweV0hoRxyE/rh1aEoWqCf5NR5tufqKA756nZ5g/UBAjIrjARyHM+sgrbtWj1RLQzKt XiP6FzFMt0CsIwKKSLo1w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lAB8M/NbZT4=:bx7IRQFPq7M66p7BCaX09X XyGZIlvcsl47F7xUDA6be8HN2Igvt9ts98hsu9QV/05vapaL65fCRxn11yv8woTDq+tN4VzPi 84m7CTnl19HUTtq0ipq159fELhuQ363n1gsJ/fkT3QhyT+SUQe0qNzSFncexvDHSlX5O9pbDX MIGpysLXGmFYURDhxss1/kvlPSgf22tYyq6ngic1U3ZE5J/YqcxkWKxhN3UEsyU9y3fuYudSH FJ5ZHk7eAdAHw3vfTKCCGvyJQb7rjH1Xt7SR3l/0t5ByJkecnY0U2qHCuqiCmXAogpnQt4YPz ajDSUiF19+belsTfBWOhyb0quTSJZmJEv/s/TyOuIksBXGNCF2MbAWcfxj8AE260sG7GVGD+5 G2/c6Ytqe5VVgZDmEpI0mPGTnN5um+93DaoI66yAH5CZ6knZOcE/EujkwFU9cce1Z9YbE5okB kq+A+vHkEdNeJbfrFy8fQ0wqorDgATtmtJV1C7EdQFrEA5eL+ATRMEfUgWMN7gs2LsdWQaWqd A208Zon4sdx4RITF0eufXlPKRGrvenr0Gr5mjNW2L2/QMXo/sApKpsMtyYVsPK75MBOLenWRu 2U3zQqufA4oKaQcoHgHRegAHUYA2iG6tdpWZJUaWgyneBLdwdASGmU3hrIgoxqBTTveaIGozQ deTFulxflTB6ye1FRjyioNPimjADRT0e5j3tijA12Ihkg+oHIimGhSCxdnb4uzNf3qyOk+Z3G Amj9wmGechN6+Pb1BCY2T1qgYmO6XALw/VlLxji4/4BtPf6zw5eC9YcsO+25V5tJ2nDcCwM3v U3V3QaiBVrlUf+BWRSJE6tMW1UXNtuK3X1/Xmz+4CtGruX0W8E6DYwmAR7uXgZUnlFGe7mMt+ KIt5swBXTX7YcYn07OVKRRP9BuSRXQd+2d1evj7clg/Xw1ffxP/r70bdw47eI+wny+i/2js9o XwrEnWNzVNDOcalNvifmWjYXGnMB/rbiAzl+jCtqZOMdE21x5MqAHOa1tMTs9Gmlv8JKwCCFv 953yEAe8lci1JFiExoOojve5qXnbZpeO39FHzliR56a2aUNJ5QQwkc1oLm25qtZmj18KfT+lo BRIiG2O18eqyXHO63TAFn9WuS/77/Xc3OSxd70tOtDPvroZaK9kk0jjBA== Subject: [libcamera-devel] [PATCH v5 4/4] libcamera: controls: Apply explicit fixed-sized Span type casts X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christian Rauch via libcamera-devel From: Christian Rauch Reply-To: Christian Rauch Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The change of types of some Controls from variable- to fixed-sized requires explicit casting of FrameDurationLimits, ColourGains and SensorBlackLevels. Signed-off-by: Christian Rauch --- src/ipa/raspberrypi/raspberrypi.cpp | 19 ++++++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 4 ++-- src/qcam/dng_writer.cpp | 12 ++++++------ 3 files changed, 18 insertions(+), 17 deletions(-) -- 2.34.1 diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 00600a2e..54a16ac2 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -505,18 +505,19 @@ void IPARPi::reportMetadata() AwbStatus *awbStatus = rpiMetadata_.GetLocked("awb.status"); if (awbStatus) { - libcameraMetadata_.set(controls::ColourGains, { static_cast(awbStatus->gain_r), - static_cast(awbStatus->gain_b) }); + libcameraMetadata_.set(controls::ColourGains, + Span({ static_cast(awbStatus->gain_r), + static_cast(awbStatus->gain_b) })); libcameraMetadata_.set(controls::ColourTemperature, awbStatus->temperature_K); } BlackLevelStatus *blackLevelStatus = rpiMetadata_.GetLocked("black_level.status"); if (blackLevelStatus) libcameraMetadata_.set(controls::SensorBlackLevels, - { static_cast(blackLevelStatus->black_level_r), - static_cast(blackLevelStatus->black_level_g), - static_cast(blackLevelStatus->black_level_g), - static_cast(blackLevelStatus->black_level_b) }); + Span({ static_cast(blackLevelStatus->black_level_r), + static_cast(blackLevelStatus->black_level_g), + static_cast(blackLevelStatus->black_level_g), + static_cast(blackLevelStatus->black_level_b) })); FocusStatus *focusStatus = rpiMetadata_.GetLocked("focus.status"); if (focusStatus && focusStatus->num == 12) { @@ -821,7 +822,7 @@ void IPARPi::queueRequest(const ControlList &controls) if (gains[0] != 0.0f && gains[1] != 0.0f) /* A gain of 0.0f will switch back to auto mode. */ libcameraMetadata_.set(controls::ColourGains, - { gains[0], gains[1] }); + Span({ gains[0], gains[1] })); break; } @@ -1105,8 +1106,8 @@ void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur /* Return the validated limits via metadata. */ libcameraMetadata_.set(controls::FrameDurationLimits, - { static_cast(minFrameDuration_.get()), - static_cast(maxFrameDuration_.get()) }); + Span({ static_cast(minFrameDuration_.get()), + static_cast(maxFrameDuration_.get()) })); /* * Calculate the maximum exposure time possible for the AGC to use. diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 556af882..af7c8927 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1706,9 +1706,9 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList & * V4L2_CID_NOTIFY_GAINS control (which means notifyGainsUnity_ is set). */ if (notifyGainsUnity_ && controls.contains(libcamera::controls::ColourGains)) { - libcamera::Span colourGains = + libcamera::Span colourGains = controls.get(libcamera::controls::ColourGains).\ - value_or(libcamera::Span({ 0, 0 })); + value_or(libcamera::Span({ 0, 0 })); /* The control wants linear gains in the order B, Gb, Gr, R. */ ControlList ctrls(sensor_->controls()); std::array gains{ diff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp index e119ca52..030432e3 100644 --- a/src/qcam/dng_writer.cpp +++ b/src/qcam/dng_writer.cpp @@ -438,8 +438,8 @@ int DNGWriter::write(const char *filename, const Camera *camera, const double eps = 1e-2; if (metadata.contains(controls::ColourGains)) { - Span const &colourGains = - metadata.get(controls::ColourGains).value_or(libcamera::Span({ 0, 0 })); + Span const &colourGains = + metadata.get(controls::ColourGains).value_or(libcamera::Span({ 0, 0 })); if (colourGains[0] > eps && colourGains[1] > eps) { wbGain = Matrix3d::diag(colourGains[0], 1, colourGains[1]); neutral[0] = 1.0 / colourGains[0]; /* red */ @@ -447,8 +447,8 @@ int DNGWriter::write(const char *filename, const Camera *camera, } } if (metadata.contains(controls::ColourCorrectionMatrix)) { - Span const &coeffs = - metadata.get(controls::ColourCorrectionMatrix).value_or(Span({ 0, 0, 0, 0, 0, 0, 0, 0, 0 })); + Span const &coeffs = + metadata.get(controls::ColourCorrectionMatrix).value_or(Span({ 0, 0, 0, 0, 0, 0, 0, 0, 0 })); Matrix3d ccmSupplied(coeffs); if (ccmSupplied.determinant() > eps) ccm = ccmSupplied; @@ -517,8 +517,8 @@ int DNGWriter::write(const char *filename, const Camera *camera, uint32_t whiteLevel = (1 << info->bitsPerSample) - 1; if (metadata.contains(controls::SensorBlackLevels)) { - Span levels = - metadata.get(controls::SensorBlackLevels).value_or(Span({ 0, 0, 0, 0 })); + Span levels = + metadata.get(controls::SensorBlackLevels).value_or(Span({ 0, 0, 0, 0 })); /* * The black levels control is specified in R, Gr, Gb, B order.