[v2,24/35] pipeline: rksip1: Move isRaw up in scope
diff mbox series

Message ID 20251023144841.403689-25-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Full dewarper support on imx8mp
Related show

Commit Message

Stefan Klug Oct. 23, 2025, 2:48 p.m. UTC
In raw mode the number of configurations is actively limited to 1. It is
therefore safe to move isRaw up one level to simplify the code and
prepare for later use.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Umang Jain Oct. 25, 2025, 12:48 p.m. UTC | #1
On Thu, Oct 23, 2025 at 04:48:25PM +0200, Stefan Klug wrote:
> In raw mode the number of configurations is actively limited to 1. It is
> therefore safe to move isRaw up one level to simplify the code and
> prepare for later use.

I think this is not the case. This patch will only set isRaw = true,
only [config_.size() > 1] and there is a raw stream. When only 1 stream
is requested  [config_.size() == 1] which is a raw one,
isRaw will remain to false.

> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 0b31b8077c8d..35cb54c812bc 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -559,28 +559,22 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
>  	 * Simultaneous capture of raw and processed streams isn't possible. If
>  	 * there is any raw stream, cap the number of streams to one.
>  	 */
> +	bool isRaw = false;
>  	if (config_.size() > 1) {
>  		for (const auto &cfg : config_) {
>  			if (PixelFormatInfo::info(cfg.pixelFormat).colourEncoding ==
>  			    PixelFormatInfo::ColourEncodingRAW) {
>  				config_.resize(1);
>  				status = Adjusted;
> +				isRaw = true;
>  				break;
>  			}
>  		}
>  	}
>  
>  	bool useDewarper = false;
> -	if (pipe->dewarper_) {
> -		/*
> -		 * Platforms with dewarper support, such as i.MX8MP, support
> -		 * only a single stream. We can inspect config_[0] only here.
> -		 */
> -		bool isRaw = PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding ==
> -			     PixelFormatInfo::ColourEncodingRAW;
> -		if (!isRaw)
> -			useDewarper = true;
> -	}
> +	if (pipe->dewarper_ && !isRaw)
> +		useDewarper = true;
>  
>  	/*
>  	 * If there are more than one stream in the configuration figure out the
> -- 
> 2.48.1
>
Barnabás Pőcze Oct. 27, 2025, 3:02 p.m. UTC | #2
Hi

2025. 10. 23. 16:48 keltezéssel, Stefan Klug írta:
> In raw mode the number of configurations is actively limited to 1. It is
> therefore safe to move isRaw up one level to simplify the code and
> prepare for later use.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
>   src/libcamera/pipeline/rkisp1/rkisp1.cpp | 14 ++++----------
>   1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 0b31b8077c8d..35cb54c812bc 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -559,28 +559,22 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
>   	 * Simultaneous capture of raw and processed streams isn't possible. If
>   	 * there is any raw stream, cap the number of streams to one.
>   	 */
> +	bool isRaw = false;
>   	if (config_.size() > 1) {
>   		for (const auto &cfg : config_) {
>   			if (PixelFormatInfo::info(cfg.pixelFormat).colourEncoding ==
>   			    PixelFormatInfo::ColourEncodingRAW) {
>   				config_.resize(1);
>   				status = Adjusted;
> +				isRaw = true;
>   				break;
>   			}
>   		}
>   	}
> 
>   	bool useDewarper = false;

  = pipe->dewarper_ && !isRaw

?

> -	if (pipe->dewarper_) {
> -		/*
> -		 * Platforms with dewarper support, such as i.MX8MP, support
> -		 * only a single stream. We can inspect config_[0] only here.
> -		 */
> -		bool isRaw = PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding ==
> -			     PixelFormatInfo::ColourEncodingRAW;
> -		if (!isRaw)
> -			useDewarper = true;
> -	}
> +	if (pipe->dewarper_ && !isRaw)
> +		useDewarper = true;
> 
>   	/*
>   	 * If there are more than one stream in the configuration figure out the
> --
> 2.48.1
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 0b31b8077c8d..35cb54c812bc 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -559,28 +559,22 @@  CameraConfiguration::Status RkISP1CameraConfiguration::validate()
 	 * Simultaneous capture of raw and processed streams isn't possible. If
 	 * there is any raw stream, cap the number of streams to one.
 	 */
+	bool isRaw = false;
 	if (config_.size() > 1) {
 		for (const auto &cfg : config_) {
 			if (PixelFormatInfo::info(cfg.pixelFormat).colourEncoding ==
 			    PixelFormatInfo::ColourEncodingRAW) {
 				config_.resize(1);
 				status = Adjusted;
+				isRaw = true;
 				break;
 			}
 		}
 	}
 
 	bool useDewarper = false;
-	if (pipe->dewarper_) {
-		/*
-		 * Platforms with dewarper support, such as i.MX8MP, support
-		 * only a single stream. We can inspect config_[0] only here.
-		 */
-		bool isRaw = PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding ==
-			     PixelFormatInfo::ColourEncodingRAW;
-		if (!isRaw)
-			useDewarper = true;
-	}
+	if (pipe->dewarper_ && !isRaw)
+		useDewarper = true;
 
 	/*
 	 * If there are more than one stream in the configuration figure out the