[libcamera-devel,v3,3/5] ipa: raspberrypi: awb: Delay release of the statistics buffer
diff mbox series

Message ID 20221213114836.15473-4-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
Release the statistics buffer after running the through the AWB calculations.
Only the "counted" statistics are copied out to a local structure, so keeping
the statistics buffer allows the algorithm to see the "uncounted" statistics as
well.

This is currently handled by hard-coding the total number of statistics regions
regions based on the structure definition in the bcm2835_isp_stats structure.

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

Comments

Kieran Bingham Jan. 30, 2023, 1:21 p.m. UTC | #1
Quoting Naushir Patuck via libcamera-devel (2022-12-13 11:48:34)
> Release the statistics buffer after running the through the AWB calculations.
> Only the "counted" statistics are copied out to a local structure, so keeping
> the statistics buffer allows the algorithm to see the "uncounted" statistics as
> well.
> 
> This is currently handled by hard-coding the total number of statistics regions
> regions based on the structure definition in the bcm2835_isp_stats structure.
> 
> 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/rpi/awb.cpp | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp
> index 4f6af4ba98dc..04d1c8783654 100644
> --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp
> +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp
> @@ -427,11 +427,6 @@ void Awb::prepareStats()
>          */
>         generateStats(zones_, statistics_->awb_stats, config_.minPixels,
>                       config_.minG);
> -       /*
> -        * we're done with these; we may as well relinquish our hold on the
> -        * pointer.
> -        */
> -       statistics_.reset();
>         /*
>          * apply sensitivities, so values appear to come from our "canonical"
>          * sensor.
> @@ -728,6 +723,11 @@ void Awb::doAwb()
>                         << " with gains r " << asyncResults_.gainR
>                         << " and b " << asyncResults_.gainB;
>         }
> +       /*
> +        * we're done with these; we may as well relinquish our hold on the
> +        * pointer.
> +        */
> +       statistics_.reset();
>  }
>  
>  /* Register algorithm with the system. */
> -- 
> 2.25.1
>

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp
index 4f6af4ba98dc..04d1c8783654 100644
--- a/src/ipa/raspberrypi/controller/rpi/awb.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp
@@ -427,11 +427,6 @@  void Awb::prepareStats()
 	 */
 	generateStats(zones_, statistics_->awb_stats, config_.minPixels,
 		      config_.minG);
-	/*
-	 * we're done with these; we may as well relinquish our hold on the
-	 * pointer.
-	 */
-	statistics_.reset();
 	/*
 	 * apply sensitivities, so values appear to come from our "canonical"
 	 * sensor.
@@ -728,6 +723,11 @@  void Awb::doAwb()
 			<< " with gains r " << asyncResults_.gainR
 			<< " and b " << asyncResults_.gainB;
 	}
+	/*
+	 * we're done with these; we may as well relinquish our hold on the
+	 * pointer.
+	 */
+	statistics_.reset();
 }
 
 /* Register algorithm with the system. */