[libcamera-devel] [PATCH v2 11/17] android: Filter preview streams on FPS

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Oct 6 03:45:25 CEST 2021


Hi Jacopo,

Thank you for the patch.

On Tue, Sep 07, 2021 at 09:41:01PM +0200, Jacopo Mondi wrote:
> Register as preview streams only streams capable of producing at least
> 30 FPS.
> 
> This requirement comes from inspecting the existing HAL implementation
> on Intel IPU3 platform.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
> Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
>  src/android/camera_capabilities.cpp | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> index c6791b9d6238..e5cfe67f9b73 100644
> --- a/src/android/camera_capabilities.cpp
> +++ b/src/android/camera_capabilities.cpp
> @@ -1259,6 +1259,21 @@ int CameraCapabilities::initializeStaticMetadata()
>  	std::vector<uint32_t> availableStreamConfigurations;
>  	availableStreamConfigurations.reserve(streamConfigurations_.size() * 4);
>  	for (const auto &entry : streamConfigurations_) {
> +		/*
> +		 * Filter out YUV streams not capable of running at 30 FPS.
> +		 *
> +		 * This requirement comes from inspecting the Intel IPU3
> +		 * HAL implementation but no reference has been found in the
> +		 * metadata documentation.

Does the requirement also come from CTS ? If so, could you please point
to the corresponding test(s) ? If not, why do we need this ?

> +		 *
> +		 * Calculate FPS as CTS does: see
> +		 * Camera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration()
> +		 */
> +		unsigned int fps = static_cast<unsigned int>
> +				   (floor(1e9 / entry.minFrameDurationNsec + 0.05f));
> +		if (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB && fps < 30)
> +			continue;
> +
>  		availableStreamConfigurations.push_back(entry.androidFormat);
>  		availableStreamConfigurations.push_back(entry.resolution.width);
>  		availableStreamConfigurations.push_back(entry.resolution.height);
> @@ -1271,6 +1286,11 @@ int CameraCapabilities::initializeStaticMetadata()
>  	std::vector<int64_t> minFrameDurations;
>  	minFrameDurations.reserve(streamConfigurations_.size() * 4);
>  	for (const auto &entry : streamConfigurations_) {
> +		unsigned int fps = static_cast<unsigned int>
> +				   (floor(1e9 / entry.minFrameDurationNsec + 0.05f));
> +		if (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB && fps < 30)
> +			continue;
> +
>  		minFrameDurations.push_back(entry.androidFormat);
>  		minFrameDurations.push_back(entry.resolution.width);
>  		minFrameDurations.push_back(entry.resolution.height);

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list