From patchwork Tue Aug 16 19:17:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rauch X-Patchwork-Id: 17142 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 122C6C3275 for ; Tue, 16 Aug 2022 19:17:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F2D0261FBC; Tue, 16 Aug 2022 21:17:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660677477; bh=5Pyj2DASryP86s3YkFxon0LC9V9lzauKvYDWz8IAw9o=; 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=n5JlqE9f5l6kYGKG4BZCwGulsgVph1vFL0MGkojS+b7/ToIc5NwPaMoi/HrFZktaL CUFbh8ZIie3wr0+lJhRgJ/Ez1tdVit5hrClnGBSjNkUEvmOEt2wsfBIoLm9Mf3/388 /z9sx2AVM3PAJg7z3A7A84VJmauwjaZegZJ3EjlwECu13W1MuIlVEjHpFRbjVQNm6k Dnmioq4FccG6FXBqrInNVMFT3dEXHPssJmW5LKFBDAN+X2kUjZZOnwfhC957cNcVz5 CU4fy4gDsxOc6weorp1Yqy6mEK+ZLZSqeNhg5ZvKixOQS5obHvsz6D9qlaZA7zLWNg kSkOG/Soqs8JA== Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CE47161FBC for ; Tue, 16 Aug 2022 21:17:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=gmx.net header.i=@gmx.net header.b="RNbXHV6j"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1660677474; bh=5Pyj2DASryP86s3YkFxon0LC9V9lzauKvYDWz8IAw9o=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=RNbXHV6j0V9/YJYN8Wv4N9svrfrGxmwdujosRy/C2xSVLbfohP7aGgkDuJCenabzw T2suCeFV5UEVj3pq+C4Hn9SIOA1dqIwClkpu93bs6n5/6XMhCAcnACtxe4puzftCKL 4XdzIjDoHURcINQbmb+yKQXGKG9W/m4a6sL4e8os= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from voyager ([88.152.184.103]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MUowb-1nxFqN1bBh-00QmLw; Tue, 16 Aug 2022 21:17:54 +0200 To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Aug 2022 21:17:52 +0200 Message-Id: <20220816191752.109151-2-Rauch.Christian@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220816191752.109151-1-Rauch.Christian@gmx.de> References: <20220816191752.109151-1-Rauch.Christian@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:2KkrT4GXtpai0aDchKGxlvMZ6/pgSsy+coewrDrqJn7xSRAE1WV vKKu2MmvkQpW5t8PMzZIxAHbQAhYIUeqx00v7507ewCRkkHgfgA1/ZG1C5YAnBZyU7Zt04L 133yJJz0AyYb/bmhVZgTdg1ns6ZUTT+7QxK9nCXNP6lNe5qBfjgsL279OoOIMBcjWRkhD/Z otzLnUVgIpP60VPuCM5bw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:qSFogDzO1Wg=:AGIaPOukc01SJlopJGxYd+ S9t+wu220pVyzGwPY3xL6h7OX+9eJ/9CFlVU32fM87A8wtxcN2PG7W7G0BAE81cai0DoZNIOP k1bUgd9c15QttGlKt3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era-devel] [PATCH v2 1/1] libcamera: set ControlInfo for 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" Some control properties are typed with a Span to store an array of values. Currently those are ColourGains, SensorBlackLevels, ColourCorrectionMatrix and FrameDurationLimits. The value range and defaults in the ControlInfo of those Controls is currently defined as scalar. This prevents accessing the ControlInfo via the native Span type. By defining the ControlInfo in terms of Spans, we can avoid this issue. Signed-off-by: Christian Rauch --- src/ipa/ipu3/ipu3.cpp | 6 +++--- src/ipa/raspberrypi/raspberrypi.cpp | 14 +++++++++++--- test/serialization/ipa_data_serializer_test.cpp | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) -- 2.34.1 diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index e37b2fa0..0439cd9d 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -273,9 +273,9 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo, frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); } - controls[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0], - frameDurations[1], - frameDurations[2]); + controls[&controls::FrameDurationLimits] = ControlInfo{ Span({ frameDurations[0], frameDurations[0] }), + Span({ frameDurations[1], frameDurations[1] }), + Span({ frameDurations[2], frameDurations[2] }) }; *ipaControls = ControlInfoMap(std::move(controls), controls::controls); } diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 69c73f8c..175b6b88 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -82,15 +82,23 @@ static const ControlInfoMap::Map ipaControls{ { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) }, { &controls::ExposureValue, ControlInfo(-8.0f, 8.0f, 0.0f) }, { &controls::AwbEnable, ControlInfo(false, true) }, - { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, + { &controls::ColourGains, ControlInfo{ Span({ 0, 0 }), Span({ 32, 32 }), Span({ 0, 0 }) } }, { &controls::AwbMode, ControlInfo(controls::AwbModeValues) }, { &controls::Brightness, ControlInfo(-1.0f, 1.0f, 0.0f) }, { &controls::Contrast, ControlInfo(0.0f, 32.0f, 1.0f) }, { &controls::Saturation, ControlInfo(0.0f, 32.0f, 1.0f) }, { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) }, - { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, + { &controls::ColourCorrectionMatrix, ControlInfo{ + Span({ -16, -16, -16, -16, -16, -16, -16, -16, -16 }), + Span({ 16, 16, 16, 16, 16, 16, 16, 16, 16 }), + Span({ 1, 0, 0, 0, 1, 0, 0, 0, 1 }), + } }, { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, - { &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) }, + { &controls::FrameDurationLimits, ControlInfo{ + Span({ 33333, 33333 }), + Span({ 120000, 120000 }), + Span({ 33333, 33333 }), + } }, { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) } }; diff --git a/test/serialization/ipa_data_serializer_test.cpp b/test/serialization/ipa_data_serializer_test.cpp index d2050a86..e9e29bd5 100644 --- a/test/serialization/ipa_data_serializer_test.cpp +++ b/test/serialization/ipa_data_serializer_test.cpp @@ -36,7 +36,7 @@ static const ControlInfoMap Controls = ControlInfoMap({ { &controls::AeEnable, ControlInfo(false, true) }, { &controls::ExposureTime, ControlInfo(0, 999999) }, { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, - { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, + { &controls::ColourGains, ControlInfo{ Span({ 0, 0 }), Span({ 32, 32 }), Span({ 0, 0 }) } }, { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, }, controls::controls);