[libcamera-devel] [PATCH 08/10] libcamera: src: ipa: raspberrypi: agc: Fix uninitialised members in status_

David Plowman david.plowman at raspberrypi.com
Mon Nov 16 17:49:16 CET 2020


Use memset in the constructor, it is tidier and initialises
everything.

Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
---
 src/ipa/raspberrypi/controller/rpi/agc.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp
index 7c7944e8..1037f968 100644
--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp
@@ -157,14 +157,13 @@ Agc::Agc(Controller *controller)
 	  exposure_mode_(nullptr), constraint_mode_(nullptr),
 	  frame_count_(0), lock_count_(0)
 {
+	// Setting status_.total_exposure_value_ to zero initially tells us
+	// it's not been calculated yet (i.e. Process hasn't yet run).
+	memset(&status_, 0, sizeof(status_));
 	ev_ = status_.ev = 1.0;
-	flicker_period_ = status_.flicker_period = 0.0;
-	fixed_shutter_ = status_.fixed_shutter = 0;
-	fixed_analogue_gain_ = status_.fixed_analogue_gain = 0.0;
-	// set to zero initially, so we can tell it's not been calculated
-	status_.total_exposure_value = 0.0;
-	status_.target_exposure_value = 0.0;
-	status_.locked = false;
+	flicker_period_ = 0.0;
+	fixed_shutter_ = 0;
+	fixed_analogue_gain_ = 0.0;
 }
 
 char const *Agc::Name() const
-- 
2.20.1



More information about the libcamera-devel mailing list