[libcamera-devel,07/16] android: capabilities: Use per-configuration durations
diff mbox series

Message ID 20210827120757.110615-8-jacopo@jmondi.org
State Superseded
Headers show
Series
  • IPU3 control info update and HAL frame durations
Related show

Commit Message

Jacopo Mondi Aug. 27, 2021, 12:07 p.m. UTC
Use the per-configuration stream durations as collected during
initializeStreamConfigurations() to populate the
ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT static metadata.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_capabilities.cpp | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

Comments

Paul Elder Aug. 31, 2021, 2:24 a.m. UTC | #1
Hi Jacopo,

On Fri, Aug 27, 2021 at 02:07:48PM +0200, Jacopo Mondi wrote:
> Use the per-configuration stream durations as collected during
> initializeStreamConfigurations() to populate the
> ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT static metadata.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/android/camera_capabilities.cpp | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> index c45d74189aaa..061e65241806 100644
> --- a/src/android/camera_capabilities.cpp
> +++ b/src/android/camera_capabilities.cpp
> @@ -1269,19 +1269,16 @@ int CameraCapabilities::initializeStaticMetadata()
>  	staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_STALL_DURATIONS,
>  				  availableStallDurations);
>  
> -	/* Use the minimum frame duration for all the YUV/RGB formats. */
> -	if (minFrameDurationNsec > 0) {
> -		std::vector<int64_t> minFrameDurations;
> -		minFrameDurations.reserve(streamConfigurations_.size() * 4);
> -		for (const auto &entry : streamConfigurations_) {
> -			minFrameDurations.push_back(entry.androidFormat);
> -			minFrameDurations.push_back(entry.resolution.width);
> -			minFrameDurations.push_back(entry.resolution.height);
> -			minFrameDurations.push_back(minFrameDurationNsec);
> -		}
> -		staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,
> -					  minFrameDurations);
> +	std::vector<int64_t> minFrameDurations;
> +	minFrameDurations.reserve(streamConfigurations_.size() * 4);
> +	for (const auto &entry : streamConfigurations_) {
> +		minFrameDurations.push_back(entry.androidFormat);
> +		minFrameDurations.push_back(entry.resolution.width);
> +		minFrameDurations.push_back(entry.resolution.height);
> +		minFrameDurations.push_back(entry.minFrameDurationNsec);

Ooh, a subtle change. I see this picks up the per-configuration min
frame duration, though.

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

>  	}
> +	staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,
> +				  minFrameDurations);
>  
>  	uint8_t croppingType = ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY;
>  	staticMetadata_->addEntry(ANDROID_SCALER_CROPPING_TYPE, croppingType);
> -- 
> 2.32.0
>
Umang Jain Sept. 1, 2021, 7:51 a.m. UTC | #2
Hi Jacopo,


On 8/27/21 5:37 PM, Jacopo Mondi wrote:
> Use the per-configuration stream durations as collected during
> initializeStreamConfigurations() to populate the
> ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT static metadata.
>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>   src/android/camera_capabilities.cpp | 21 +++++++++------------
>   1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> index c45d74189aaa..061e65241806 100644
> --- a/src/android/camera_capabilities.cpp
> +++ b/src/android/camera_capabilities.cpp
> @@ -1269,19 +1269,16 @@ int CameraCapabilities::initializeStaticMetadata()
>   	staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_STALL_DURATIONS,
>   				  availableStallDurations);
>   
> -	/* Use the minimum frame duration for all the YUV/RGB formats. */
> -	if (minFrameDurationNsec > 0) {
> -		std::vector<int64_t> minFrameDurations;
> -		minFrameDurations.reserve(streamConfigurations_.size() * 4);
> -		for (const auto &entry : streamConfigurations_) {
> -			minFrameDurations.push_back(entry.androidFormat);
> -			minFrameDurations.push_back(entry.resolution.width);
> -			minFrameDurations.push_back(entry.resolution.height);
> -			minFrameDurations.push_back(minFrameDurationNsec);
> -		}
> -		staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,
> -					  minFrameDurations);
> +	std::vector<int64_t> minFrameDurations;
> +	minFrameDurations.reserve(streamConfigurations_.size() * 4);
> +	for (const auto &entry : streamConfigurations_) {
> +		minFrameDurations.push_back(entry.androidFormat);
> +		minFrameDurations.push_back(entry.resolution.width);
> +		minFrameDurations.push_back(entry.resolution.height);
> +		minFrameDurations.push_back(entry.minFrameDurationNsec);


Nice, was expecting this somewhere down the line

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

>   	}
> +	staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,
> +				  minFrameDurations);
>   
>   	uint8_t croppingType = ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY;
>   	staticMetadata_->addEntry(ANDROID_SCALER_CROPPING_TYPE, croppingType);

Patch
diff mbox series

diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
index c45d74189aaa..061e65241806 100644
--- a/src/android/camera_capabilities.cpp
+++ b/src/android/camera_capabilities.cpp
@@ -1269,19 +1269,16 @@  int CameraCapabilities::initializeStaticMetadata()
 	staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_STALL_DURATIONS,
 				  availableStallDurations);
 
-	/* Use the minimum frame duration for all the YUV/RGB formats. */
-	if (minFrameDurationNsec > 0) {
-		std::vector<int64_t> minFrameDurations;
-		minFrameDurations.reserve(streamConfigurations_.size() * 4);
-		for (const auto &entry : streamConfigurations_) {
-			minFrameDurations.push_back(entry.androidFormat);
-			minFrameDurations.push_back(entry.resolution.width);
-			minFrameDurations.push_back(entry.resolution.height);
-			minFrameDurations.push_back(minFrameDurationNsec);
-		}
-		staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,
-					  minFrameDurations);
+	std::vector<int64_t> minFrameDurations;
+	minFrameDurations.reserve(streamConfigurations_.size() * 4);
+	for (const auto &entry : streamConfigurations_) {
+		minFrameDurations.push_back(entry.androidFormat);
+		minFrameDurations.push_back(entry.resolution.width);
+		minFrameDurations.push_back(entry.resolution.height);
+		minFrameDurations.push_back(entry.minFrameDurationNsec);
 	}
+	staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,
+				  minFrameDurations);
 
 	uint8_t croppingType = ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY;
 	staticMetadata_->addEntry(ANDROID_SCALER_CROPPING_TYPE, croppingType);