From patchwork Mon Jul 4 23:32:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rauch X-Patchwork-Id: 16541 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 AAE00C3273 for ; Mon, 4 Jul 2022 23:32:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5534F63312; Tue, 5 Jul 2022 01:32:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656977558; bh=qdkppGAt8GGAkIW4ikxxbmnaUy8g9qZLK3Flsvri9Po=; 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=SjuAQFDMBvvTOEUHnN0Su196RLfw4MF1V5PO3MBywyl+oHyZpcwG3A7iiTxok5NzQ zTadlgQ4Ng5rSNdOrW+YwBavPesfZNHUxh6aZSL3tYPLDvDatvRYxrrBU2Ybl3k7FQ kerv3N4BlI2pL7Rb4/mIhSePUXPCjsLK/iN5JArjynjL7h4TKRDssZKsVszomzvvBH fGdNBA0ge67VAQKVgBt6IH4z+V05iJqTVQ/CG1gkUFHca1Oyc0swfQ+G8bMI7OhimS LY7S98T+/HkOz/EBZFXTzP+H5iw4VskwoZGf0jkOaWyKJgicHcCD2b4yby02aOeInA OEIyIFgPl5D/w== Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 998296330C for ; Tue, 5 Jul 2022 01:32:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=gmx.net header.i=@gmx.net header.b="DNs4v97k"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656977554; bh=qdkppGAt8GGAkIW4ikxxbmnaUy8g9qZLK3Flsvri9Po=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=DNs4v97kzwUqiDBiw4luqv60XYDYkD7VU7XXLfvt3T+vwWTDM+/bqKvR8HAN0WbZW 5Ao1hCISkDLqu9NiRmXVUK6HXRR42ADQPRZJ1NiOCGrwmL4VP5Vh3Non7miWTl9JZe y5vKgmRY7ZsphaHAg/bpa8ERWZL0cJFjWqKD0rFw= 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 1N1Obh-1nRulV0ckl-012slJ; Tue, 05 Jul 2022 01:32:34 +0200 To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jul 2022 00:32:17 +0100 Message-Id: <20220704233217.54769-5-Rauch.Christian@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704233217.54769-1-Rauch.Christian@gmx.de> References: <20220704233217.54769-1-Rauch.Christian@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:7iGohiHwf4goJ8QSBa2b5vs3GqQZLSC43gEm+OFgl7eE1EZVs3w iPMBIVCPoAeE38cq1GjUnKzPNZe0kvYtukYa6mvCdTP4s9K8xoOyTvB82zyiOaRuxpLpz8a iBvL+MEWoy8UTpmlIbzO2kNmO3LYp8MeUmjsY70V0ddnRtoQJetermTenq5eyT4fQ9v/aFs W13c+x2NdWSGYvJk+DNjg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lR1VDFReXY8=:5KFSP0n3LU1Etao7ho9RLe DPlvTI7xDogeILMtxOmW//0vpslnaZKz4HHrdSO2n73H/I2U+qv+PJB0cSGUNzIiCdc5bYbhO IKsxOC6ph3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CH v9 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 --- include/libcamera/controls.h | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 19 ++++++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 2 +- src/qcam/dng_writer.cpp | 2 +- 4 files changed, 13 insertions(+), 12 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 c7492a77..baaa1e08 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -559,18 +559,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) { @@ -875,7 +876,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; } @@ -1159,8 +1160,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 28f054cb..d88aa256 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1717,7 +1717,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 4b5d8276..23612be0 100644 --- a/src/qcam/dng_writer.cpp +++ b/src/qcam/dng_writer.cpp @@ -514,7 +514,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); /*