[libcamera-devel,1/7] android: camera_device: Report COLOR_CORRECTION_ABERRATION_MODE
diff mbox series

Message ID 20210203162600.206297-2-jacopo@jmondi.org
State Accepted
Headers show
Series
  • android: Report all the missing metadata tags
Related show

Commit Message

Jacopo Mondi Feb. 3, 2021, 4:25 p.m. UTC
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the
presence of the ANDROID_COLOR_CORRECTION_ABERRATION_MODE result
metadata.

Report the only supported value of
ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF.

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

Comments

Niklas Söderlund Feb. 4, 2021, 9:21 a.m. UTC | #1
Hi Jacopo,

Thanks for your work.

On 2021-02-03 17:25:54 +0100, Jacopo Mondi wrote:
> The CaptureResultTest#testCameraCaptureResultAllKeys enforces the
> presence of the ANDROID_COLOR_CORRECTION_ABERRATION_MODE result
> metadata.
> 
> Report the only supported value of
> ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

As with this and the following patches I trust your calculations when 
updating the number and size of the added keys.

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

> ---
>  src/android/camera_device.cpp | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index a50b0ebfe60e..02908beb867e 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -708,7 +708,7 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
>  	 * Currently: 53 entries, 846 bytes of static metadata
>  	 */
>  	uint32_t numEntries = 53;
> -	uint32_t byteSize = 846;
> +	uint32_t byteSize = 850;
>  
>  	/*
>  	 * Calculate space occupation in bytes for dynamically built metadata
> @@ -1243,6 +1243,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  				  availableRequestKeys.size());
>  
>  	std::vector<int32_t> availableResultKeys = {
> +		ANDROID_COLOR_CORRECTION_ABERRATION_MODE,
>  		ANDROID_CONTROL_AE_ANTIBANDING_MODE,
>  		ANDROID_CONTROL_AE_LOCK,
>  		ANDROID_CONTROL_AE_MODE,
> @@ -1960,7 +1961,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
>  	 * Total bytes for JPEG metadata: 82
>  	 */
>  	std::unique_ptr<CameraMetadata> resultMetadata =
> -		std::make_unique<CameraMetadata>(40, 156);
> +		std::make_unique<CameraMetadata>(41, 157);
>  	if (!resultMetadata->isValid()) {
>  		LOG(HAL, Error) << "Failed to allocate static metadata";
>  		return nullptr;
> @@ -1972,7 +1973,11 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
>  	 * from libcamera::Request::metadata.
>  	 */
>  
> -	uint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;
> +	uint8_t value = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;
> +	resultMetadata->addEntry(ANDROID_COLOR_CORRECTION_ABERRATION_MODE,
> +				 &value, 1);
> +
> +	value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;
>  	resultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1);
>  
>  	value = ANDROID_CONTROL_AE_LOCK_OFF;
> -- 
> 2.30.0
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Feb. 4, 2021, 10:09 p.m. UTC | #2
Hi Jacopo,

Thank you for the patch.

On Wed, Feb 03, 2021 at 05:25:54PM +0100, Jacopo Mondi wrote:
> The CaptureResultTest#testCameraCaptureResultAllKeys enforces the
> presence of the ANDROID_COLOR_CORRECTION_ABERRATION_MODE result
> metadata.
> 
> Report the only supported value of
> ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

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

> ---
>  src/android/camera_device.cpp | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index a50b0ebfe60e..02908beb867e 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -708,7 +708,7 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
>  	 * Currently: 53 entries, 846 bytes of static metadata
>  	 */
>  	uint32_t numEntries = 53;
> -	uint32_t byteSize = 846;
> +	uint32_t byteSize = 850;
>  
>  	/*
>  	 * Calculate space occupation in bytes for dynamically built metadata
> @@ -1243,6 +1243,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  				  availableRequestKeys.size());
>  
>  	std::vector<int32_t> availableResultKeys = {
> +		ANDROID_COLOR_CORRECTION_ABERRATION_MODE,
>  		ANDROID_CONTROL_AE_ANTIBANDING_MODE,
>  		ANDROID_CONTROL_AE_LOCK,
>  		ANDROID_CONTROL_AE_MODE,
> @@ -1960,7 +1961,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
>  	 * Total bytes for JPEG metadata: 82
>  	 */
>  	std::unique_ptr<CameraMetadata> resultMetadata =
> -		std::make_unique<CameraMetadata>(40, 156);
> +		std::make_unique<CameraMetadata>(41, 157);
>  	if (!resultMetadata->isValid()) {
>  		LOG(HAL, Error) << "Failed to allocate static metadata";
>  		return nullptr;
> @@ -1972,7 +1973,11 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
>  	 * from libcamera::Request::metadata.
>  	 */
>  
> -	uint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;
> +	uint8_t value = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;
> +	resultMetadata->addEntry(ANDROID_COLOR_CORRECTION_ABERRATION_MODE,
> +				 &value, 1);
> +
> +	value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;
>  	resultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1);
>  
>  	value = ANDROID_CONTROL_AE_LOCK_OFF;

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index a50b0ebfe60e..02908beb867e 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -708,7 +708,7 @@  std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
 	 * Currently: 53 entries, 846 bytes of static metadata
 	 */
 	uint32_t numEntries = 53;
-	uint32_t byteSize = 846;
+	uint32_t byteSize = 850;
 
 	/*
 	 * Calculate space occupation in bytes for dynamically built metadata
@@ -1243,6 +1243,7 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 				  availableRequestKeys.size());
 
 	std::vector<int32_t> availableResultKeys = {
+		ANDROID_COLOR_CORRECTION_ABERRATION_MODE,
 		ANDROID_CONTROL_AE_ANTIBANDING_MODE,
 		ANDROID_CONTROL_AE_LOCK,
 		ANDROID_CONTROL_AE_MODE,
@@ -1960,7 +1961,7 @@  CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
 	 * Total bytes for JPEG metadata: 82
 	 */
 	std::unique_ptr<CameraMetadata> resultMetadata =
-		std::make_unique<CameraMetadata>(40, 156);
+		std::make_unique<CameraMetadata>(41, 157);
 	if (!resultMetadata->isValid()) {
 		LOG(HAL, Error) << "Failed to allocate static metadata";
 		return nullptr;
@@ -1972,7 +1973,11 @@  CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
 	 * from libcamera::Request::metadata.
 	 */
 
-	uint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;
+	uint8_t value = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;
+	resultMetadata->addEntry(ANDROID_COLOR_CORRECTION_ABERRATION_MODE,
+				 &value, 1);
+
+	value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;
 	resultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1);
 
 	value = ANDROID_CONTROL_AE_LOCK_OFF;