[libcamera-devel] [PATCH v2 12/13] android: camera_device: Handle COLOR_CORRECTION_ABERRATION_MODE

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Oct 21 15:20:52 CEST 2020


Hi Jacopo,

On 20/10/2020 19:05, Jacopo Mondi wrote:
> Register the ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
> static metadata property inspecting the values retuned by the pipeline
> handler.
> 
> Reserve in the static metadata pack enough space to support all the 3
> available color correction aberration modes Android defines.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  src/android/camera_device.cpp | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index a4d9e6ddc519..af26ebce29bb 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -553,7 +553,7 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
>  	 * Currently: 51 entries, 687 bytes of static metadata
>  	 */
>  	uint32_t numEntries = 51;
> -	uint32_t byteSize = 691;
> +	uint32_t byteSize = 693;
>  
>  	/*
>  	 * Calculate space occupation in bytes for dynamically built metadata
> @@ -595,12 +595,18 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  	const ControlInfoMap &controlsInfo = camera_->controls();
>  
>  	/* Color correction static metadata. */
> -	std::vector<uint8_t> aberrationModes = {
> -		ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF,
> -	};
> -	staticMetadata_->addEntry(ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES,
> -				  aberrationModes.data(),
> -				  aberrationModes.size());
> +	{
> +		std::vector<uint8_t> data(3);
> +		const auto &infoMap = controlsInfo.find(&controls::draft::ColorCorrectionAberrationMode);
> +		if (infoMap != controlsInfo.end()) {
> +			for (const auto &value : infoMap->second.values())
> +				data.push_back(value.get<int32_t>());
> +		} else {
> +			data.push_back(ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF);
> +		}
> +		staticMetadata_->addEntry(ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES,
> +					  data.data(), data.size());
> +	}

Same comments as the preceding patch, but I won't block this here:

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

>  
>  	/* Control static metadata. */
>  	std::vector<uint8_t> aeAvailableAntiBandingModes = {
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list