[libcamera-devel,3/3] android: capabilities: Add static black levels
diff mbox series

Message ID 20211221052117.2665228-4-paul.elder@ideasonboard.com
State New
Delegated to: Paul Elder
Headers show
Series
  • android: Plumb static black levels
Related show

Commit Message

Paul Elder Dec. 21, 2021, 5:21 a.m. UTC
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 <paul.elder@ideasonboard.com>
---
 src/android/camera_capabilities.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch
diff mbox series

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<int32_t> blackLevels = { 0, 0, 0, 0 };
+	if (properties.contains(properties::SensorFixedBlackLevels)) {
+		const Span<const int32_t> &vals =
+			properties.get(properties::SensorFixedBlackLevels);
+		blackLevels = std::vector<int32_t>(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,