[libcamera-devel,v3,4/4] android: camera_device: Align style of active area size
diff mbox series

Message ID 20201228165203.53771-5-jacopo@jmondi.org
State Superseded
Delegated to: Jacopo Mondi
Headers show
Series
  • libcamera: Introduce sensor database
Related show

Commit Message

Jacopo Mondi Dec. 28, 2020, 4:52 p.m. UTC
Align the style of ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE property
registration with the one of the other sensor related properties.

Cosmetic change only, no functional changes intended.

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

Comments

Paul Elder Dec. 29, 2020, 4:19 a.m. UTC | #1
Hi Jacopo,

On Mon, Dec 28, 2020 at 05:52:03PM +0100, Jacopo Mondi wrote:
> Align the style of ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE property
> registration with the one of the other sensor related properties.

s/one/ones/

> 
> Cosmetic change only, no functional changes intended.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/android/camera_device.cpp | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 9ad417ee6c3a..b48c7b7c9d2b 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -883,26 +883,25 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,
>  				  physicalSize.data(), physicalSize.size());
>  
> +	std::vector<int32_t> activeAreaSize(4);
>  	if (properties.contains(properties::PixelArrayActiveAreas)) {
>  		const Span<const Rectangle> &rects =
>  			properties.get(properties::PixelArrayActiveAreas);
> -		std::vector<int32_t> data{
> +		activeAreaSize = {
>  			static_cast<int32_t>(rects[0].x),
>  			static_cast<int32_t>(rects[0].y),
>  			static_cast<int32_t>(rects[0].width),
>  			static_cast<int32_t>(rects[0].height),
>  		};
> -		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> -					  data.data(), data.size());
>  	} else {
>  		/*
>  		 * \todo Drop the default once the ov5670 and ov13858 drivers
>  		 * are updated to report the pixel array size.
>  		 */
> -		int32_t data[] = { 0, 0, 2560, 1920 };
> -		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> -					  data, 4);
> +		activeAreaSize = { 0, 0, 2560, 1920 };
>  	}
> +	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> +				  activeAreaSize.data(), 4);
>  
>  	int32_t sensitivityRange[] = {
>  		32, 2400,
> -- 
> 2.29.2
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Niklas Söderlund Dec. 29, 2020, 5:31 p.m. UTC | #2
Hi Jacopo,

Thanks for your work.

On 2020-12-28 17:52:03 +0100, Jacopo Mondi wrote:
> Align the style of ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE property
> registration with the one of the other sensor related properties.
> 
> Cosmetic change only, no functional changes intended.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

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

> ---
>  src/android/camera_device.cpp | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 9ad417ee6c3a..b48c7b7c9d2b 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -883,26 +883,25 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,
>  				  physicalSize.data(), physicalSize.size());
>  
> +	std::vector<int32_t> activeAreaSize(4);
>  	if (properties.contains(properties::PixelArrayActiveAreas)) {
>  		const Span<const Rectangle> &rects =
>  			properties.get(properties::PixelArrayActiveAreas);
> -		std::vector<int32_t> data{
> +		activeAreaSize = {
>  			static_cast<int32_t>(rects[0].x),
>  			static_cast<int32_t>(rects[0].y),
>  			static_cast<int32_t>(rects[0].width),
>  			static_cast<int32_t>(rects[0].height),
>  		};
> -		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> -					  data.data(), data.size());
>  	} else {
>  		/*
>  		 * \todo Drop the default once the ov5670 and ov13858 drivers
>  		 * are updated to report the pixel array size.
>  		 */
> -		int32_t data[] = { 0, 0, 2560, 1920 };
> -		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> -					  data, 4);
> +		activeAreaSize = { 0, 0, 2560, 1920 };
>  	}
> +	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> +				  activeAreaSize.data(), 4);
>  
>  	int32_t sensitivityRange[] = {
>  		32, 2400,
> -- 
> 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 9ad417ee6c3a..b48c7b7c9d2b 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -883,26 +883,25 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,
 				  physicalSize.data(), physicalSize.size());
 
+	std::vector<int32_t> activeAreaSize(4);
 	if (properties.contains(properties::PixelArrayActiveAreas)) {
 		const Span<const Rectangle> &rects =
 			properties.get(properties::PixelArrayActiveAreas);
-		std::vector<int32_t> data{
+		activeAreaSize = {
 			static_cast<int32_t>(rects[0].x),
 			static_cast<int32_t>(rects[0].y),
 			static_cast<int32_t>(rects[0].width),
 			static_cast<int32_t>(rects[0].height),
 		};
-		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
-					  data.data(), data.size());
 	} else {
 		/*
 		 * \todo Drop the default once the ov5670 and ov13858 drivers
 		 * are updated to report the pixel array size.
 		 */
-		int32_t data[] = { 0, 0, 2560, 1920 };
-		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
-					  data, 4);
+		activeAreaSize = { 0, 0, 2560, 1920 };
 	}
+	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
+				  activeAreaSize.data(), 4);
 
 	int32_t sensitivityRange[] = {
 		32, 2400,