[libcamera-devel,2/3] android: capabilties: Rationalize get[YUV|Raw]Resolution names
diff mbox series

Message ID 20210715153241.63971-3-jacopo@jmondi.org
State Superseded
Headers show
Series
  • android: Drive-by cleanups
Related show

Commit Message

Jacopo Mondi July 15, 2021, 3:32 p.m. UTC
The getYUVResolutions() and getRawResolutions() functions are called
from the initializeStreamConfigurations() function, which is called by
initialize().

Rationalize the function naming scheme by renaming the two functions to
initializeYUVResolutions() and initializeRawResolution().

Cosmetic change only.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_capabilities.cpp | 14 ++++++++------
 src/android/camera_capabilities.h   |  6 +++---
 2 files changed, 11 insertions(+), 9 deletions(-)

Comments

Umang Jain July 23, 2021, 1:32 p.m. UTC | #1
HI Jacopo

Thanks for the patch.

On 7/15/21 9:02 PM, Jacopo Mondi wrote:
> The getYUVResolutions() and getRawResolutions() functions are called
> from the initializeStreamConfigurations() function, which is called by
> initialize().
>
> Rationalize the function naming scheme by renaming the two functions to
> initializeYUVResolutions() and initializeRawResolution().
>
> Cosmetic change only.
>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   src/android/camera_capabilities.cpp | 14 ++++++++------
>   src/android/camera_capabilities.h   |  6 +++---
>   2 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> index 6543c2bbc6c3..15e54192adff 100644
> --- a/src/android/camera_capabilities.cpp
> +++ b/src/android/camera_capabilities.cpp
> @@ -138,8 +138,9 @@ int CameraCapabilities::initialize(std::shared_ptr<libcamera::Camera> camera,
>   	return initializeStaticMetadata();
>   }
>   
> -std::vector<Size> CameraCapabilities::getYUVResolutions(const PixelFormat &pixelFormat,
> -							const std::vector<Size> &resolutions)
> +std::vector<Size>
> +CameraCapabilities::initializeYUVResolutions(const PixelFormat &pixelFormat,
> +					     const std::vector<Size> &resolutions)
>   {
>   	std::vector<Size> supportedResolutions;
>   	std::unique_ptr<CameraConfiguration> cameraConfig =
> @@ -164,7 +165,8 @@ std::vector<Size> CameraCapabilities::getYUVResolutions(const PixelFormat &pixel
>   	return supportedResolutions;
>   }
>   
> -std::vector<Size> CameraCapabilities::getRawResolutions(const libcamera::PixelFormat &pixelFormat)
> +std::vector<Size>
> +CameraCapabilities::initializeRawResolutions(const libcamera::PixelFormat &pixelFormat)
>   {
>   	std::unique_ptr<CameraConfiguration> cameraConfig =
>   		camera_->generateConfiguration({ StreamRole::Raw });
> @@ -323,10 +325,10 @@ int CameraCapabilities::initializeStreamConfigurations()
>   		std::vector<Size> resolutions;
>   		const PixelFormatInfo &info = PixelFormatInfo::info(mappedFormat);
>   		if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)
> -			resolutions = getRawResolutions(mappedFormat);
> +			resolutions = initializeRawResolutions(mappedFormat);
>   		else
> -			resolutions = getYUVResolutions(mappedFormat,
> -							cameraResolutions);
> +			resolutions = initializeYUVResolutions(mappedFormat,
> +							       cameraResolutions);
>   
>   		for (const Size &res : resolutions) {
>   			streamConfigurations_.push_back({ res, androidFormat });
> diff --git a/src/android/camera_capabilities.h b/src/android/camera_capabilities.h
> index e72bf084cd65..e7aa46c0a689 100644
> --- a/src/android/camera_capabilities.h
> +++ b/src/android/camera_capabilities.h
> @@ -43,10 +43,10 @@ private:
>   	};
>   
>   	std::vector<libcamera::Size>
> -	getYUVResolutions(const libcamera::PixelFormat &pixelFormat,
> -			  const std::vector<libcamera::Size> &resolutions);
> +	initializeYUVResolutions(const libcamera::PixelFormat &pixelFormat,
> +				 const std::vector<libcamera::Size> &resolutions);
>   	std::vector<libcamera::Size>
> -	getRawResolutions(const libcamera::PixelFormat &pixelFormat);
> +	initializeRawResolutions(const libcamera::PixelFormat &pixelFormat);
>   	int initializeStreamConfigurations();
>   
>   	int initializeStaticMetadata();
Laurent Pinchart July 23, 2021, 1:37 p.m. UTC | #2
Hi Jacopo,

Thank you for the patch.

On Thu, Jul 15, 2021 at 05:32:40PM +0200, Jacopo Mondi wrote:
> The getYUVResolutions() and getRawResolutions() functions are called
> from the initializeStreamConfigurations() function, which is called by
> initialize().
> 
> Rationalize the function naming scheme by renaming the two functions to
> initializeYUVResolutions() and initializeRawResolution().

There's a difference between initializeStreamConfigurations() and the
get*Resolutions() functions, in the sense that the former performs
initialization of CameraCapabilities, and the latter retrieve and return
supported resolutions without modifying CameraCapabilities.

I don't have a strong opinion, so if you think these names are better,

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

> Cosmetic change only.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/android/camera_capabilities.cpp | 14 ++++++++------
>  src/android/camera_capabilities.h   |  6 +++---
>  2 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> index 6543c2bbc6c3..15e54192adff 100644
> --- a/src/android/camera_capabilities.cpp
> +++ b/src/android/camera_capabilities.cpp
> @@ -138,8 +138,9 @@ int CameraCapabilities::initialize(std::shared_ptr<libcamera::Camera> camera,
>  	return initializeStaticMetadata();
>  }
>  
> -std::vector<Size> CameraCapabilities::getYUVResolutions(const PixelFormat &pixelFormat,
> -							const std::vector<Size> &resolutions)
> +std::vector<Size>
> +CameraCapabilities::initializeYUVResolutions(const PixelFormat &pixelFormat,
> +					     const std::vector<Size> &resolutions)
>  {
>  	std::vector<Size> supportedResolutions;
>  	std::unique_ptr<CameraConfiguration> cameraConfig =
> @@ -164,7 +165,8 @@ std::vector<Size> CameraCapabilities::getYUVResolutions(const PixelFormat &pixel
>  	return supportedResolutions;
>  }
>  
> -std::vector<Size> CameraCapabilities::getRawResolutions(const libcamera::PixelFormat &pixelFormat)
> +std::vector<Size>
> +CameraCapabilities::initializeRawResolutions(const libcamera::PixelFormat &pixelFormat)
>  {
>  	std::unique_ptr<CameraConfiguration> cameraConfig =
>  		camera_->generateConfiguration({ StreamRole::Raw });
> @@ -323,10 +325,10 @@ int CameraCapabilities::initializeStreamConfigurations()
>  		std::vector<Size> resolutions;
>  		const PixelFormatInfo &info = PixelFormatInfo::info(mappedFormat);
>  		if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)
> -			resolutions = getRawResolutions(mappedFormat);
> +			resolutions = initializeRawResolutions(mappedFormat);
>  		else
> -			resolutions = getYUVResolutions(mappedFormat,
> -							cameraResolutions);
> +			resolutions = initializeYUVResolutions(mappedFormat,
> +							       cameraResolutions);
>  
>  		for (const Size &res : resolutions) {
>  			streamConfigurations_.push_back({ res, androidFormat });
> diff --git a/src/android/camera_capabilities.h b/src/android/camera_capabilities.h
> index e72bf084cd65..e7aa46c0a689 100644
> --- a/src/android/camera_capabilities.h
> +++ b/src/android/camera_capabilities.h
> @@ -43,10 +43,10 @@ private:
>  	};
>  
>  	std::vector<libcamera::Size>
> -	getYUVResolutions(const libcamera::PixelFormat &pixelFormat,
> -			  const std::vector<libcamera::Size> &resolutions);
> +	initializeYUVResolutions(const libcamera::PixelFormat &pixelFormat,
> +				 const std::vector<libcamera::Size> &resolutions);
>  	std::vector<libcamera::Size>
> -	getRawResolutions(const libcamera::PixelFormat &pixelFormat);
> +	initializeRawResolutions(const libcamera::PixelFormat &pixelFormat);
>  	int initializeStreamConfigurations();
>  
>  	int initializeStaticMetadata();

Patch
diff mbox series

diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
index 6543c2bbc6c3..15e54192adff 100644
--- a/src/android/camera_capabilities.cpp
+++ b/src/android/camera_capabilities.cpp
@@ -138,8 +138,9 @@  int CameraCapabilities::initialize(std::shared_ptr<libcamera::Camera> camera,
 	return initializeStaticMetadata();
 }
 
-std::vector<Size> CameraCapabilities::getYUVResolutions(const PixelFormat &pixelFormat,
-							const std::vector<Size> &resolutions)
+std::vector<Size>
+CameraCapabilities::initializeYUVResolutions(const PixelFormat &pixelFormat,
+					     const std::vector<Size> &resolutions)
 {
 	std::vector<Size> supportedResolutions;
 	std::unique_ptr<CameraConfiguration> cameraConfig =
@@ -164,7 +165,8 @@  std::vector<Size> CameraCapabilities::getYUVResolutions(const PixelFormat &pixel
 	return supportedResolutions;
 }
 
-std::vector<Size> CameraCapabilities::getRawResolutions(const libcamera::PixelFormat &pixelFormat)
+std::vector<Size>
+CameraCapabilities::initializeRawResolutions(const libcamera::PixelFormat &pixelFormat)
 {
 	std::unique_ptr<CameraConfiguration> cameraConfig =
 		camera_->generateConfiguration({ StreamRole::Raw });
@@ -323,10 +325,10 @@  int CameraCapabilities::initializeStreamConfigurations()
 		std::vector<Size> resolutions;
 		const PixelFormatInfo &info = PixelFormatInfo::info(mappedFormat);
 		if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)
-			resolutions = getRawResolutions(mappedFormat);
+			resolutions = initializeRawResolutions(mappedFormat);
 		else
-			resolutions = getYUVResolutions(mappedFormat,
-							cameraResolutions);
+			resolutions = initializeYUVResolutions(mappedFormat,
+							       cameraResolutions);
 
 		for (const Size &res : resolutions) {
 			streamConfigurations_.push_back({ res, androidFormat });
diff --git a/src/android/camera_capabilities.h b/src/android/camera_capabilities.h
index e72bf084cd65..e7aa46c0a689 100644
--- a/src/android/camera_capabilities.h
+++ b/src/android/camera_capabilities.h
@@ -43,10 +43,10 @@  private:
 	};
 
 	std::vector<libcamera::Size>
-	getYUVResolutions(const libcamera::PixelFormat &pixelFormat,
-			  const std::vector<libcamera::Size> &resolutions);
+	initializeYUVResolutions(const libcamera::PixelFormat &pixelFormat,
+				 const std::vector<libcamera::Size> &resolutions);
 	std::vector<libcamera::Size>
-	getRawResolutions(const libcamera::PixelFormat &pixelFormat);
+	initializeRawResolutions(const libcamera::PixelFormat &pixelFormat);
 	int initializeStreamConfigurations();
 
 	int initializeStaticMetadata();