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 84m7CTn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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.