From patchwork Tue Dec 21 05:21:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15195 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 255B5BE080 for ; Tue, 21 Dec 2021 05:21:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CD0B9608E9; Tue, 21 Dec 2021 06:21:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="r3I7P/0g"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EB353608FB for ; Tue, 21 Dec 2021 06:21:37 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C2AD2881; Tue, 21 Dec 2021 06:21:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640064097; bh=VOQfVebVjXwrTly6/GGhEjKGuvOlMczEomtQdFuSBas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r3I7P/0g5ETMhz5wz4DuQErEGBdwDftrrz0EkP3CYQsrwzUEfxRE7oYqvptYhtN36 76gsRSqgQwUw1CghBzRrgh+RJ+LnB1MM0jjsvkrl32x4gJ/dNCfLcVnvXcxV57TnpK se/6sQ/BK5Mo9KLZiWuxDYbFeqlQZDvurEH1JMJU= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 23:21:14 -0600 Message-Id: <20211221052117.2665228-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211221052117.2665228-1-paul.elder@ideasonboard.com> References: <20211221052117.2665228-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] properties: Add SensorFixedBlackLevels 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a property to store the black levels, which are the zero light values for each color channel specified in the CFA. We already have a similar control that reports dynamic black levels, but we also need a static one. Bug: https://bugs.libcamera.org/show_bug.cgi?id=48 Signed-off-by: Paul Elder --- src/libcamera/property_ids.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index 12ecbce5..99067144 100644 --- a/src/libcamera/property_ids.yaml +++ b/src/libcamera/property_ids.yaml @@ -678,6 +678,23 @@ controls: \todo Turn this property into a "maximum control value" for the ScalerCrop control once "dynamic" controls have been implemented. + - SensorFixedBlackLevels: + type: int32_t + size: [4] + description: | + A fixed black level offset for each of the color filter arrangement + (CFA) mosaic channels. + + This property specifies the zero light value for each of the CFA mosaic + channels in the camera sensor. + + The values are given in the same order as channels listed for the CFA + layout key i.e. the nth value given corresponds to the black level + offset for the nth color channel listed in the CFA. If the CFA is MONO, + all four channels shall have the same values. + + \sa ColorFilterArrangement + # ---------------------------------------------------------------------------- # Draft properties section From patchwork Tue Dec 21 05:21:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15196 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 074B7C3258 for ; Tue, 21 Dec 2021 05:21:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6AF3360900; Tue, 21 Dec 2021 06:21:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Sx4qrh7N"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DBADC608E9 for ; Tue, 21 Dec 2021 06:21:38 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E46A6FD2; Tue, 21 Dec 2021 06:21:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640064098; bh=lvzxjxk8Y7gghV6xWsurAK6br6ca/jZZX4EQ/+9ClTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sx4qrh7N+TQ4I/mlgcmkF8NOMSfCU57MeFCgK/GCuowZfilnlItjBFkKfVDaq02RW sC7WBVLVUOBnb2yPRaxfG8AiEVQeK2IZ6MtEtCibxG/6n4s9q3AulLGkKilxbbdXXy EP61pMPF2I2YM0p+D39l03ObMbmLaKgyUSuarOYo= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 23:21:15 -0600 Message-Id: <20211221052117.2665228-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211221052117.2665228-1-paul.elder@ideasonboard.com> References: <20211221052117.2665228-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] camera_sensor_properties: Add blackLevels 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add an entry to the sensor database for the static black levels. As these are approximate static values for the black levels, they can reasonably be tied to the sensor model. Thus add it to the sensor database. Bug: https://bugs.libcamera.org/show_bug.cgi?id=48 Signed-off-by: Paul Elder --- .../libcamera/internal/camera_sensor_properties.h | 2 ++ src/libcamera/camera_sensor.cpp | 1 + src/libcamera/camera_sensor_properties.cpp | 13 +++++++++++++ 3 files changed, 16 insertions(+) diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h index 1ee3cb99..91826e2d 100644 --- a/include/libcamera/internal/camera_sensor_properties.h +++ b/include/libcamera/internal/camera_sensor_properties.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -20,6 +21,7 @@ struct CameraSensorProperties { Size unitCellSize; std::map testPatternModes; + std::array blackLevels; }; } /* namespace libcamera */ diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index c3999d35..f9dd00bb 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -306,6 +306,7 @@ void CameraSensor::initStaticProperties() /* Register the properties retrieved from the sensor database. */ properties_.set(properties::UnitCellSize, staticProps_->unitCellSize); + properties_.set(properties::SensorFixedBlackLevels, staticProps_->blackLevels); initTestPatternModes(); } diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp index 48305ac4..d4485f45 100644 --- a/src/libcamera/camera_sensor_properties.cpp +++ b/src/libcamera/camera_sensor_properties.cpp @@ -41,6 +41,11 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties) * \brief Map that associates the TestPattern control value with the indexes of * the corresponding sensor test pattern modes as returned by * V4L2_CID_TEST_PATTERN. + * + * \var CameraSensorProperties::blackLevels + * \brief Fixed black level offset for each of the four color filter + * arrangement (CFA) mosaic channels, specified in the same order as the order + * of color filters. */ /** @@ -69,6 +74,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen * 9: "Resolution Pattern" */ }, + .blackLevels = {}, } }, { "imx219", { .unitCellSize = { 1120, 1120 }, @@ -79,6 +85,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, { controls::draft::TestPatternModePn9, 4 }, }, + .blackLevels = {}, } }, { "imx258", { .unitCellSize = { 1120, 1120 }, @@ -89,10 +96,12 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, { controls::draft::TestPatternModePn9, 4 }, }, + .blackLevels = {}, } }, { "ov5647", { .unitCellSize = { 1400, 1400 }, .testPatternModes = {}, + .blackLevels = {}, } }, { "ov5670", { .unitCellSize = { 1120, 1120 }, @@ -100,6 +109,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeOff, 0 }, { controls::draft::TestPatternModeColorBars, 1 }, }, + .blackLevels = {}, } }, { "ov5693", { .unitCellSize = { 1400, 1400 }, @@ -112,6 +122,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen * Rolling Bar". */ }, + .blackLevels = {}, } }, { "ov8865", { .unitCellSize = { 1400, 1400 }, @@ -126,6 +137,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen * 5: "Color squares with rolling bar" */ }, + .blackLevels = {}, } }, { "ov13858", { .unitCellSize = { 1120, 1120 }, @@ -133,6 +145,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeOff, 0 }, { controls::draft::TestPatternModeColorBars, 1 }, }, + .blackLevels = {}, } }, }; From patchwork Tue Dec 21 05:21:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15197 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 136D2BE080 for ; Tue, 21 Dec 2021 05:21:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C1F4A608ED; Tue, 21 Dec 2021 06:21:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Dlgn4tlV"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D2FD4608A2 for ; Tue, 21 Dec 2021 06:21:39 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0D98D101E; Tue, 21 Dec 2021 06:21:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640064099; bh=uBFR11xKqXOmJgRca5o3ENHlVxF4uUpFvAtKkooXDh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dlgn4tlVVJgTl3uB/FzcsqT+mkd5wPsviHNZl/m7hYvVr1oLcmJ9IGvhbzSHtgK7l T6bbPcsxfjKZgFlOLKvalO29UKP0gpcni2egoDdFb3tkNo7gsjFzS92D7vcSuZ9WMy Qy4e1SFPmict//QJRpfYCJpv2qdVDrfWN5p5NdrA= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 23:21:16 -0600 Message-Id: <20211221052117.2665228-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211221052117.2665228-1-paul.elder@ideasonboard.com> References: <20211221052117.2665228-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] android: capabilities: Add static black levels 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Plumb SENSOR_BLACK_LEVEL_PATTERN into the static metadata. Get the information from the sensor database. Note that nothing is added to the capability detector, as black level pattern will always be added to the static metadata. Add a comment to document it. Bug: https://bugs.libcamera.org/show_bug.cgi?id=48 Signed-off-by: Paul Elder --- src/android/camera_capabilities.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index bc62a928..c716f4bf 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1342,6 +1342,16 @@ int CameraCapabilities::initializeStaticMetadata() whiteLevel); availableCharacteristicsKeys_.insert(ANDROID_SENSOR_INFO_WHITE_LEVEL); + /* This is required for FULL. */ + std::vector blackLevels = { 0, 0, 0, 0 }; + if (properties.contains(properties::SensorFixedBlackLevels)) { + const Span &vals = + properties.get(properties::SensorFixedBlackLevels); + blackLevels = std::vector(vals.begin(), vals.end()); + } + staticMetadata_->addEntry(ANDROID_SENSOR_BLACK_LEVEL_PATTERN, blackLevels); + availableCharacteristicsKeys_.insert(ANDROID_SENSOR_BLACK_LEVEL_PATTERN); + /* Statistics static metadata. */ uint8_t faceDetectMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF; staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES,