From patchwork Fri Jun 3 22:07:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rauch X-Patchwork-Id: 16146 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 32C42C3275 for ; Fri, 3 Jun 2022 22:07:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9A06465648; Sat, 4 Jun 2022 00:07:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1654294041; bh=ipm41GgrpnYmbo99+S/NkvHl94ueDeSphbQgeFOEPs0=; 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=WHo3yQFJbfRMc9Ea27OzqfaxLKZ5kWLP87fJoEjQ96NwG81FXQgA3cOkxWsAL50Rc D7AH6v8SmWJRNDJ+IYOrhioIExO+gMZIyjqV4JMgIp53o5AOnMLlktPWKezsiEg9tR QWCnHo4wXTxaTt6m32D05ew1PxHI/SzEXolbxVvbR5oxpUc5Nl9JSi6F/zQmFpiaEh 9tDN09wo4HEGSHXTRqc1CwdQSbUOmgK6q9smhaC9dQJ+xQ5zh7BpD85oLeCHlvg611 JgbVsEKanXL6h9PsHznocWvX35FDIDGtvCa7wXZApo5aJk1j0rQfcaXfsKuBpeTLsx HAFIxg0+YOoJA== Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9D685633A5 for ; Sat, 4 Jun 2022 00:07:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=gmx.net header.i=@gmx.net header.b="IhVxcyOl"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1654294037; bh=ipm41GgrpnYmbo99+S/NkvHl94ueDeSphbQgeFOEPs0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=IhVxcyOlpbPKko+lopIoUsCE/l7pjUqEXBKuC6K8X2LeIm7D86uvEXfJySWK6aNsD WPwAoPOIRrsmsZi5Q1YiqGosFpp70vtiqWEG42Gmzd0GsEiSMoEK0jf6Z305hfBN0p 4Y+2dCuUT3lDVeYvXyfcy9buFVFj5AkdGSYsQ+8c= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([92.18.80.244]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N0oFz-1ncZQe0PpN-00whyL; Sat, 04 Jun 2022 00:07:17 +0200 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 X-Provags-ID: V03:K1:mUuXzuAg3zEO8Rie98ECNkwkrKTewGaNCdx4SiFLE8jAcNJ2J+n OdGcLIYf5274FLpXLH4AFlLPc4wjtPPXMXYH6ZsEDIMBMEYh9KoskK56i+mmvilbZNMpbUa JoGcYVhn1ZKjJSnw1yNV+S6Sotwc8c8fCff6+7nwnBeTRDSXFXpDvbPyEHmTQdrcUdBM1wr AE17/5bLlbjIpZQszmP3A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:0p0eNOHLgHA=:hpzCg+nEgxN9iVruVOPfwh bzVZBp6Axpnh7AzMl5Pes+LTuEOB7TX5tQ9PrEljjN4653p2SFQXvMVqJ6kvg0MMcpzmNqil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HTxsb9Q== Subject: [libcamera-devel] [PATCH v6 5/5] 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 --- include/libcamera/controls.h | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 19 ++++++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 2 +- src/qcam/dng_writer.cpp | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) -- 2.34.1 diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 192be784..a19f1845 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -168,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__ diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index f65a0680..203ae613 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({ blackLevelStatus->black_level_r, + blackLevelStatus->black_level_g, + blackLevelStatus->black_level_g, + 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 a62afdd4..6efe7c3c 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1706,7 +1706,7 @@ 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); /* The control wants linear gains in the order B, Gb, Gr, R. */ ControlList ctrls(sensor_->controls()); diff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp index 780f58f7..e18bf36b 100644 --- a/src/qcam/dng_writer.cpp +++ b/src/qcam/dng_writer.cpp @@ -438,7 +438,7 @@ int DNGWriter::write(const char *filename, const Camera *camera, const double eps = 1e-2; if (metadata.contains(controls::ColourGains)) { - Span const &colourGains = + Span const &colourGains = *metadata.get(controls::ColourGains); if (colourGains[0] > eps && colourGains[1] > eps) { wbGain = Matrix3d::diag(colourGains[0], 1, colourGains[1]); @@ -447,7 +447,7 @@ int DNGWriter::write(const char *filename, const Camera *camera, } } if (metadata.contains(controls::ColourCorrectionMatrix)) { - Span const &coeffs = + Span const &coeffs = *metadata.get(controls::ColourCorrectionMatrix); Matrix3d ccmSupplied(coeffs); if (ccmSupplied.determinant() > eps) @@ -517,7 +517,7 @@ int DNGWriter::write(const char *filename, const Camera *camera, uint32_t whiteLevel = (1 << info->bitsPerSample) - 1; if (metadata.contains(controls::SensorBlackLevels)) { - Span levels = + Span levels = *metadata.get(controls::SensorBlackLevels); /*