[libcamera-devel,1/2] ipa: raspberrypi: AWB: Remove unused code
diff mbox series

Message ID 20210225170141.5184-2-david.plowman@raspberrypi.com
State Accepted
Commit b8bd37c6af39e2095e7b0d88279a3d91fe58e12c
Headers show
Series
  • Raspberry Pi AWB tidying
Related show

Commit Message

David Plowman Feb. 25, 2021, 5:01 p.m. UTC
Some more code from pre-libcamera versions is removed. There is no
functional change.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/raspberrypi/controller/rpi/awb.cpp | 4 +---
 src/ipa/raspberrypi/controller/rpi/awb.hpp | 7 +------
 2 files changed, 2 insertions(+), 9 deletions(-)

Comments

Naushir Patuck Feb. 26, 2021, 8:05 a.m. UTC | #1
Hi David,

Thank you for your patch.

On Thu, 25 Feb 2021 at 17:01, David Plowman <david.plowman@raspberrypi.com>
wrote:

> Some more code from pre-libcamera versions is removed. There is no
> functional change.
>
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
>

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>


> ---
>  src/ipa/raspberrypi/controller/rpi/awb.cpp | 4 +---
>  src/ipa/raspberrypi/controller/rpi/awb.hpp | 7 +------
>  2 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp
> b/src/ipa/raspberrypi/controller/rpi/awb.cpp
> index bb637f10..791a7039 100644
> --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp
> +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp
> @@ -21,8 +21,6 @@ LOG_DEFINE_CATEGORY(RPiAwb)
>  #define AWB_STATS_SIZE_X DEFAULT_AWB_REGIONS_X
>  #define AWB_STATS_SIZE_Y DEFAULT_AWB_REGIONS_Y
>
> -const double Awb::RGB::INVALID = -1.0;
> -
>  // todo - the locking in this algorithm needs some tidying up as has been
> done
>  // elsewhere (ALSC and AGC).
>
> @@ -340,7 +338,7 @@ static void generate_stats(std::vector<Awb::RGB>
> &zones,
>                            double min_G)
>  {
>         for (int i = 0; i < AWB_STATS_SIZE_X * AWB_STATS_SIZE_Y; i++) {
> -               Awb::RGB zone; // this is "invalid", unless R gets
> overwritten later
> +               Awb::RGB zone;
>                 double counted = stats[i].counted;
>                 if (counted >= min_pixels) {
>                         zone.G = stats[i].g_sum / counted;
> diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp
> b/src/ipa/raspberrypi/controller/rpi/awb.hpp
> index 45ba9e25..2fe59c37 100644
> --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp
> +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp
> @@ -90,21 +90,16 @@ public:
>         void Prepare(Metadata *image_metadata) override;
>         void Process(StatisticsPtr &stats, Metadata *image_metadata)
> override;
>         struct RGB {
> -               RGB(double _R = INVALID, double _G = INVALID,
> -                   double _B = INVALID)
> +               RGB(double _R = -1.0, double _G = -1.0, double _B = -1.0)
>                         : R(_R), G(_G), B(_B)
>                 {
>                 }
>                 double R, G, B;
> -               static const double INVALID;
> -               bool Valid() const { return G != INVALID; }
> -               bool Invalid() const { return G == INVALID; }
>                 RGB &operator+=(RGB const &other)
>                 {
>                         R += other.R, G += other.G, B += other.B;
>                         return *this;
>                 }
> -               RGB Square() const { return RGB(R * R, G * G, B * B); }
>         };
>
>  private:
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>
Kieran Bingham Feb. 26, 2021, 9:50 a.m. UTC | #2
Hi David,

On 25/02/2021 17:01, David Plowman wrote:
> Some more code from pre-libcamera versions is removed. There is no
> functional change.

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

> 
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> ---
>  src/ipa/raspberrypi/controller/rpi/awb.cpp | 4 +---
>  src/ipa/raspberrypi/controller/rpi/awb.hpp | 7 +------
>  2 files changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp
> index bb637f10..791a7039 100644
> --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp
> +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp
> @@ -21,8 +21,6 @@ LOG_DEFINE_CATEGORY(RPiAwb)
>  #define AWB_STATS_SIZE_X DEFAULT_AWB_REGIONS_X
>  #define AWB_STATS_SIZE_Y DEFAULT_AWB_REGIONS_Y
>  
> -const double Awb::RGB::INVALID = -1.0;
> -
>  // todo - the locking in this algorithm needs some tidying up as has been done
>  // elsewhere (ALSC and AGC).
>  
> @@ -340,7 +338,7 @@ static void generate_stats(std::vector<Awb::RGB> &zones,
>  			   double min_G)
>  {
>  	for (int i = 0; i < AWB_STATS_SIZE_X * AWB_STATS_SIZE_Y; i++) {
> -		Awb::RGB zone; // this is "invalid", unless R gets overwritten later
> +		Awb::RGB zone;
>  		double counted = stats[i].counted;
>  		if (counted >= min_pixels) {
>  			zone.G = stats[i].g_sum / counted;
> diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp
> index 45ba9e25..2fe59c37 100644
> --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp
> +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp
> @@ -90,21 +90,16 @@ public:
>  	void Prepare(Metadata *image_metadata) override;
>  	void Process(StatisticsPtr &stats, Metadata *image_metadata) override;
>  	struct RGB {
> -		RGB(double _R = INVALID, double _G = INVALID,
> -		    double _B = INVALID)
> +		RGB(double _R = -1.0, double _G = -1.0, double _B = -1.0)
>  			: R(_R), G(_G), B(_B)
>  		{
>  		}
>  		double R, G, B;
> -		static const double INVALID;
> -		bool Valid() const { return G != INVALID; }
> -		bool Invalid() const { return G == INVALID; }
>  		RGB &operator+=(RGB const &other)
>  		{
>  			R += other.R, G += other.G, B += other.B;
>  			return *this;
>  		}
> -		RGB Square() const { return RGB(R * R, G * G, B * B); }
>  	};
>  
>  private:
>

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp
index bb637f10..791a7039 100644
--- a/src/ipa/raspberrypi/controller/rpi/awb.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp
@@ -21,8 +21,6 @@  LOG_DEFINE_CATEGORY(RPiAwb)
 #define AWB_STATS_SIZE_X DEFAULT_AWB_REGIONS_X
 #define AWB_STATS_SIZE_Y DEFAULT_AWB_REGIONS_Y
 
-const double Awb::RGB::INVALID = -1.0;
-
 // todo - the locking in this algorithm needs some tidying up as has been done
 // elsewhere (ALSC and AGC).
 
@@ -340,7 +338,7 @@  static void generate_stats(std::vector<Awb::RGB> &zones,
 			   double min_G)
 {
 	for (int i = 0; i < AWB_STATS_SIZE_X * AWB_STATS_SIZE_Y; i++) {
-		Awb::RGB zone; // this is "invalid", unless R gets overwritten later
+		Awb::RGB zone;
 		double counted = stats[i].counted;
 		if (counted >= min_pixels) {
 			zone.G = stats[i].g_sum / counted;
diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp
index 45ba9e25..2fe59c37 100644
--- a/src/ipa/raspberrypi/controller/rpi/awb.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp
@@ -90,21 +90,16 @@  public:
 	void Prepare(Metadata *image_metadata) override;
 	void Process(StatisticsPtr &stats, Metadata *image_metadata) override;
 	struct RGB {
-		RGB(double _R = INVALID, double _G = INVALID,
-		    double _B = INVALID)
+		RGB(double _R = -1.0, double _G = -1.0, double _B = -1.0)
 			: R(_R), G(_G), B(_B)
 		{
 		}
 		double R, G, B;
-		static const double INVALID;
-		bool Valid() const { return G != INVALID; }
-		bool Invalid() const { return G == INVALID; }
 		RGB &operator+=(RGB const &other)
 		{
 			R += other.R, G += other.G, B += other.B;
 			return *this;
 		}
-		RGB Square() const { return RGB(R * R, G * G, B * B); }
 	};
 
 private: