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

Message ID 20201223174709.45457-6-jacopo@jmondi.org
State Accepted
Delegated to: Jacopo Mondi
Headers show
Series
  • android: support ColorFilterArrangement property
Related show

Commit Message

Jacopo Mondi Dec. 23, 2020, 5:47 p.m. UTC
Conditionally 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 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart Dec. 27, 2020, 11:08 a.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Wed, Dec 23, 2020 at 06:47:08PM +0100, Jacopo Mondi wrote:
> Conditionally 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 | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index b4618a680f41..920baab254b6 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -897,9 +897,12 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,
>  				  &sensitivityRange, 2);
>  
> -	uint16_t filterArr = ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG;
> -	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
> -				  &filterArr, 1);
> +	/* Report the color filter arrangement: default it to GRBG. */

I think your forgot to update the comment, as there's no default
anymore. The code itself is fine. With this addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +	if (properties.contains(properties::draft::ColorFilterArrangement)) {
> +		uint8_t filterArr = properties.get(properties::draft::ColorFilterArrangement);
> +		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
> +					  &filterArr, 1);
> +	}
>  
>  	int64_t exposureTimeRange[] = {
>  		100000, 200000000,
Niklas Söderlund Dec. 27, 2020, 11:14 a.m. UTC | #2
Hi Jacopo,

Thanks for your work.

On 2020-12-23 18:47:08 +0100, Jacopo Mondi wrote:
> Conditionally 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>

With Laurent's comment about the default value in the comment addressed,

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/android/camera_device.cpp | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index b4618a680f41..920baab254b6 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -897,9 +897,12 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,
>  				  &sensitivityRange, 2);
>  
> -	uint16_t filterArr = ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG;
> -	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
> -				  &filterArr, 1);
> +	/* Report the color filter arrangement: default it to GRBG. */
> +	if (properties.contains(properties::draft::ColorFilterArrangement)) {
> +		uint8_t filterArr = properties.get(properties::draft::ColorFilterArrangement);
> +		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
> +					  &filterArr, 1);
> +	}
>  
>  	int64_t exposureTimeRange[] = {
>  		100000, 200000000,
> -- 
> 2.29.2
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index b4618a680f41..920baab254b6 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -897,9 +897,12 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,
 				  &sensitivityRange, 2);
 
-	uint16_t filterArr = ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG;
-	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
-				  &filterArr, 1);
+	/* Report the color filter arrangement: default it to GRBG. */
+	if (properties.contains(properties::draft::ColorFilterArrangement)) {
+		uint8_t filterArr = properties.get(properties::draft::ColorFilterArrangement);
+		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
+					  &filterArr, 1);
+	}
 
 	int64_t exposureTimeRange[] = {
 		100000, 200000000,