[libcamera-devel,v3,2/5] ipa: raspberrypi: histogram: Add a constructor for an empty histogram
diff mbox series

Message ID 20221213114836.15473-3-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Raspberry Pi: Generalise statistics
Related show

Commit Message

Naushir Patuck Dec. 13, 2022, 11:48 a.m. UTC
Add a default constructor to the RPiController::Histogram class that creates
an empty histogram. Since this is a cumulative histogram, push a value of 0 into
the first (and only) bin to signify this.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/raspberrypi/controller/histogram.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Kieran Bingham Jan. 30, 2023, 1:20 p.m. UTC | #1
Quoting Naushir Patuck via libcamera-devel (2022-12-13 11:48:33)
> Add a default constructor to the RPiController::Histogram class that creates
> an empty histogram. Since this is a cumulative histogram, push a value of 0 into
> the first (and only) bin to signify this.
> 
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

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

> ---
>  src/ipa/raspberrypi/controller/histogram.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/ipa/raspberrypi/controller/histogram.h b/src/ipa/raspberrypi/controller/histogram.h
> index 66a68b087964..6b3e3a9e68e4 100644
> --- a/src/ipa/raspberrypi/controller/histogram.h
> +++ b/src/ipa/raspberrypi/controller/histogram.h
> @@ -20,6 +20,11 @@ namespace RPiController {
>  class Histogram
>  {
>  public:
> +       Histogram()
> +       {
> +               cumulative_.push_back(0);
> +       }
> +
>         template<typename T> Histogram(T *histogram, int num)
>         {
>                 assert(num);
> -- 
> 2.25.1
>

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/controller/histogram.h b/src/ipa/raspberrypi/controller/histogram.h
index 66a68b087964..6b3e3a9e68e4 100644
--- a/src/ipa/raspberrypi/controller/histogram.h
+++ b/src/ipa/raspberrypi/controller/histogram.h
@@ -20,6 +20,11 @@  namespace RPiController {
 class Histogram
 {
 public:
+	Histogram()
+	{
+		cumulative_.push_back(0);
+	}
+
 	template<typename T> Histogram(T *histogram, int num)
 	{
 		assert(num);