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

Message ID 20230203091734.22803-4-naush@raspberrypi.com
State Accepted
Headers show
Series
  • Raspberry Pi: Generalise statistics
Related show

Commit Message

Naushir Patuck Feb. 3, 2023, 9:17 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>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/ipa/raspberrypi/controller/rpi/awb.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

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. */