[libcamera-devel] android: Plumb lens filter density
diff mbox series

Message ID 20210916095109.3500965-1-paul.elder@ideasonboard.com
State New
Delegated to: Paul Elder
Headers show
Series
  • [libcamera-devel] android: Plumb lens filter density
Related show

Commit Message

Paul Elder Sept. 16, 2021, 9:51 a.m. UTC
Plumb the lens filter density android control through the HAL. Hardcode
the template and result controls to zero, and ignore the request
control. Report only the zero filter density in the static metadata.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 src/android/camera_capabilities.cpp | 11 +++++++++++
 src/android/camera_device.cpp       |  3 +++
 2 files changed, 14 insertions(+)

Patch
diff mbox series

diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
index cf0ce0b3..40b74274 100644
--- a/src/android/camera_capabilities.cpp
+++ b/src/android/camera_capabilities.cpp
@@ -734,6 +734,7 @@  int CameraCapabilities::initializeStaticMetadata()
 		ANDROID_JPEG_MAX_SIZE,
 		ANDROID_LENS_FACING,
 		ANDROID_LENS_INFO_AVAILABLE_APERTURES,
+		ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES,
 		ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS,
 		ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION,
 		ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION,
@@ -787,6 +788,7 @@  int CameraCapabilities::initializeStaticMetadata()
 		ANDROID_JPEG_THUMBNAIL_QUALITY,
 		ANDROID_JPEG_THUMBNAIL_SIZE,
 		ANDROID_LENS_APERTURE,
+		ANDROID_LENS_FILTER_DENSITY,
 		ANDROID_LENS_OPTICAL_STABILIZATION_MODE,
 		ANDROID_NOISE_REDUCTION_MODE,
 		ANDROID_SCALER_CROP_REGION,
@@ -824,6 +826,7 @@  int CameraCapabilities::initializeStaticMetadata()
 		ANDROID_JPEG_THUMBNAIL_QUALITY,
 		ANDROID_JPEG_THUMBNAIL_SIZE,
 		ANDROID_LENS_APERTURE,
+		ANDROID_LENS_FILTER_DENSITY,
 		ANDROID_LENS_FOCAL_LENGTH,
 		ANDROID_LENS_FOCUS_DISTANCE,
 		ANDROID_LENS_OPTICAL_STABILIZATION_MODE,
@@ -1241,6 +1244,11 @@  int CameraCapabilities::initializeStaticMetadata()
 	staticMetadata_->addEntry(ANDROID_LENS_INFO_AVAILABLE_APERTURES,
 				  lensApertures);
 
+	/* Only required for FULL, but it's hardcoded anyway. */
+	std::vector<float> availableFilterDensities = { 0 };
+	staticMetadata_->addEntry(ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES,
+				  availableFilterDensities);
+
 	uint8_t lensFacing;
 	switch (facing_) {
 	default:
@@ -1543,6 +1551,9 @@  std::unique_ptr<CameraMetadata> CameraCapabilities::requestTemplatePreview() con
 	float lensAperture = 2.53 / 100;
 	requestTemplate->addEntry(ANDROID_LENS_APERTURE, lensAperture);
 
+	float filterDensity = 0.0f;
+	requestTemplate->addEntry(ANDROID_LENS_FILTER_DENSITY, filterDensity);
+
 	uint8_t opticalStabilization = ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF;
 	requestTemplate->addEntry(ANDROID_LENS_OPTICAL_STABILIZATION_MODE,
 				  opticalStabilization);
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index c1f8847f..724b39b1 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1428,6 +1428,9 @@  CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons
 	if (settings.getEntry(ANDROID_LENS_APERTURE, &entry))
 		resultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1);
 
+	float filterDensity = 0.0f;
+	resultMetadata->addEntry(ANDROID_LENS_FILTER_DENSITY, filterDensity);
+
 	float focal_length = 1.0;
 	resultMetadata->addEntry(ANDROID_LENS_FOCAL_LENGTH, focal_length);