[1/5] libcamera: software_isp: Use a specific integer type for black level
diff mbox series

Message ID 20240423182000.1527425-2-mzamazal@redhat.com
State Superseded
Headers show
Series
  • Software ISP levels cleanup
Related show

Commit Message

Milan Zamazal April 23, 2024, 6:19 p.m. UTC
The documented range of values corresponds to uint8_t, so let's use that
type.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/ipa/simple/black_level.cpp | 3 ++-
 src/ipa/simple/black_level.h   | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart April 25, 2024, 5:17 p.m. UTC | #1
Hi Milan,

Thank you for the patch.

On Tue, Apr 23, 2024 at 08:19:56PM +0200, Milan Zamazal wrote:
> The documented range of values corresponds to uint8_t, so let's use that
> type.
> 
> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
> ---
>  src/ipa/simple/black_level.cpp | 3 ++-
>  src/ipa/simple/black_level.h   | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/ipa/simple/black_level.cpp b/src/ipa/simple/black_level.cpp
> index c7e8d8b7..a9ab12a3 100644
> --- a/src/ipa/simple/black_level.cpp
> +++ b/src/ipa/simple/black_level.cpp
> @@ -8,6 +8,7 @@
>  #include "black_level.h"
>  
>  #include <numeric>
> +#include <stdint.h>

This should go to black_level.h, as you're using the type there. With
that,

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

>  
>  #include <libcamera/base/log.h>
>  
> @@ -43,7 +44,7 @@ BlackLevel::BlackLevel()
>   * \return The black level, in the range from 0 (minimum) to 255 (maximum).
>   * If the black level couldn't be determined yet, return 0.
>   */
> -unsigned int BlackLevel::get() const
> +uint8_t BlackLevel::get() const
>  {
>  	return blackLevelSet_ ? blackLevel_ : 0;
>  }
> diff --git a/src/ipa/simple/black_level.h b/src/ipa/simple/black_level.h
> index 7e37757e..85bc5d8e 100644
> --- a/src/ipa/simple/black_level.h
> +++ b/src/ipa/simple/black_level.h
> @@ -17,11 +17,11 @@ class BlackLevel
>  {
>  public:
>  	BlackLevel();
> -	unsigned int get() const;
> +	uint8_t get() const;
>  	void update(SwIspStats::Histogram &yHistogram);
>  
>  private:
> -	unsigned int blackLevel_;
> +	uint8_t blackLevel_;
>  	bool blackLevelSet_;
>  };
>

Patch
diff mbox series

diff --git a/src/ipa/simple/black_level.cpp b/src/ipa/simple/black_level.cpp
index c7e8d8b7..a9ab12a3 100644
--- a/src/ipa/simple/black_level.cpp
+++ b/src/ipa/simple/black_level.cpp
@@ -8,6 +8,7 @@ 
 #include "black_level.h"
 
 #include <numeric>
+#include <stdint.h>
 
 #include <libcamera/base/log.h>
 
@@ -43,7 +44,7 @@  BlackLevel::BlackLevel()
  * \return The black level, in the range from 0 (minimum) to 255 (maximum).
  * If the black level couldn't be determined yet, return 0.
  */
-unsigned int BlackLevel::get() const
+uint8_t BlackLevel::get() const
 {
 	return blackLevelSet_ ? blackLevel_ : 0;
 }
diff --git a/src/ipa/simple/black_level.h b/src/ipa/simple/black_level.h
index 7e37757e..85bc5d8e 100644
--- a/src/ipa/simple/black_level.h
+++ b/src/ipa/simple/black_level.h
@@ -17,11 +17,11 @@  class BlackLevel
 {
 public:
 	BlackLevel();
-	unsigned int get() const;
+	uint8_t get() const;
 	void update(SwIspStats::Histogram &yHistogram);
 
 private:
-	unsigned int blackLevel_;
+	uint8_t blackLevel_;
 	bool blackLevelSet_;
 };