[v2,2/4] libcamera: software_isp: Drop unnecessary sanity check
diff mbox series

Message ID 20240529070248.12186-3-umang.jain@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: converter: Replace usage of stream index by Stream pointer
Related show

Commit Message

Umang Jain May 29, 2024, 7:02 a.m. UTC
Currently the soft-isp outputs a single output stream. Hence,
drop the unnecessary check for stream indexes.

Another reason to drop is actually the stream indexes is meant to be
unique in outputs std::map<>, hence checking for unique stream indexes
is redundant.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 src/libcamera/software_isp/software_isp.cpp | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Kieran Bingham May 29, 2024, 11:05 a.m. UTC | #1
Quoting Umang Jain (2024-05-29 08:02:46)
> Currently the soft-isp outputs a single output stream. Hence,
> drop the unnecessary check for stream indexes.
> 
> Another reason to drop is actually the stream indexes is meant to be
> unique in outputs std::map<>, hence checking for unique stream indexes
> is redundant.

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

> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  src/libcamera/software_isp/software_isp.cpp | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
> index c9b6be56..ac10d82d 100644
> --- a/src/libcamera/software_isp/software_isp.cpp
> +++ b/src/libcamera/software_isp/software_isp.cpp
> @@ -267,12 +267,9 @@ int SoftwareIsp::exportBuffers(unsigned int output, unsigned int count,
>  int SoftwareIsp::queueBuffers(FrameBuffer *input,
>                               const std::map<unsigned int, FrameBuffer *> &outputs)
>  {
> -       unsigned int mask = 0;
> -
>         /*
>          * Validate the outputs as a sanity check: at least one output is
> -        * required, all outputs must reference a valid stream and no two
> -        * outputs can reference the same stream.
> +        * required, all outputs must reference a valid stream.
>          */
>         if (outputs.empty())
>                 return -EINVAL;
> @@ -282,10 +279,6 @@ int SoftwareIsp::queueBuffers(FrameBuffer *input,
>                         return -EINVAL;
>                 if (index >= 1) /* only single stream atm */
>                         return -EINVAL;
> -               if (mask & (1 << index))
> -                       return -EINVAL;
> -
> -               mask |= 1 << index;
>         }
>  
>         process(input, outputs.at(0));
> -- 
> 2.44.0
>

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
index c9b6be56..ac10d82d 100644
--- a/src/libcamera/software_isp/software_isp.cpp
+++ b/src/libcamera/software_isp/software_isp.cpp
@@ -267,12 +267,9 @@  int SoftwareIsp::exportBuffers(unsigned int output, unsigned int count,
 int SoftwareIsp::queueBuffers(FrameBuffer *input,
 			      const std::map<unsigned int, FrameBuffer *> &outputs)
 {
-	unsigned int mask = 0;
-
 	/*
 	 * Validate the outputs as a sanity check: at least one output is
-	 * required, all outputs must reference a valid stream and no two
-	 * outputs can reference the same stream.
+	 * required, all outputs must reference a valid stream.
 	 */
 	if (outputs.empty())
 		return -EINVAL;
@@ -282,10 +279,6 @@  int SoftwareIsp::queueBuffers(FrameBuffer *input,
 			return -EINVAL;
 		if (index >= 1) /* only single stream atm */
 			return -EINVAL;
-		if (mask & (1 << index))
-			return -EINVAL;
-
-		mask |= 1 << index;
 	}
 
 	process(input, outputs.at(0));