[libcamera-devel,v2,5/9] android: camera_device: Report ColorFilterArrangement
diff mbox series

Message ID 20201218164754.81422-6-jacopo@jmondi.org
State Accepted
Delegated to: Jacopo Mondi
Headers show
Series
  • libcamera: Introduce sensor database
Related show

Commit Message

Jacopo Mondi Dec. 18, 2020, 4:47 p.m. UTC
Report the ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT property
inspecting the draft property reported by the libcamera Camera.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 3 +++
 1 file changed, 3 insertions(+)

Comments

Laurent Pinchart Dec. 23, 2020, 4:06 a.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Fri, Dec 18, 2020 at 05:47:50PM +0100, Jacopo Mondi wrote:
> Report the ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT property
> inspecting the draft property reported by the libcamera Camera.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/android/camera_device.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 1c7bf4ed8073..bad8a51ae7f7 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -897,7 +897,10 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,
>  				  &sensitivityRange, 2);
>  
> +	/* Report the color filter arrangement: default it to GRBG. */

How about not adding ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT at all
when libcamera doesn't report the property ? This metadata tag is only
mandatory when raw capture is supported, and for sensors that don't
support capturing the Bayer pattern, we won't be able to support raw
capture.

>  	uint16_t filterArr = ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG;
> +	if (properties.contains(properties::draft::ColorFilterArrangement))
> +		filterArr = properties.get(properties::draft::ColorFilterArrangement);
>  	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
>  				  &filterArr, 1);
>

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 1c7bf4ed8073..bad8a51ae7f7 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -897,7 +897,10 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,
 				  &sensitivityRange, 2);
 
+	/* Report the color filter arrangement: default it to GRBG. */
 	uint16_t filterArr = ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG;
+	if (properties.contains(properties::draft::ColorFilterArrangement))
+		filterArr = properties.get(properties::draft::ColorFilterArrangement);
 	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
 				  &filterArr, 1);