<div dir="auto"><div>Hi David,<div dir="auto"><br></div><div dir="auto">Thank you for the patch.</div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 26 Nov 2020, 2:23 pm David Plowman, <<a href="mailto:david.plowman@raspberrypi.com">david.plowman@raspberrypi.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">AGC, when paused, sets the last exposure/gain it wrote to be its<br>
"fixed" values and will therefore continue to return them. When<br>
resumed, we clear them so that both will float again.<br>
<br>
This approach is better because AGC can be paused and we can<br>
subsequently change (for example) the exposure and the gain won't<br>
float again.<br>
<br>
Signed-off-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank" rel="noreferrer">david.plowman@raspberrypi.com</a>><br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Reviewed-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</a>></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/ipa/raspberrypi/controller/rpi/agc.cpp | 24 ++++++++++++++++++++++<br>
src/ipa/raspberrypi/controller/rpi/agc.hpp | 4 ++++<br>
2 files changed, 28 insertions(+)<br>
<br>
diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp<br>
index 30a1c1c1..9da18c31 100644<br>
--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp<br>
+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp<br>
@@ -184,6 +184,26 @@ void Agc::Read(boost::property_tree::ptree const ¶ms)<br>
exposure_mode_ = &config_.exposure_modes[exposure_mode_name_];<br>
constraint_mode_name_ = config_.default_constraint_mode;<br>
constraint_mode_ = &config_.constraint_modes[constraint_mode_name_];<br>
+ // Set up the "last shutter/gain" values, in case AGC starts "disabled".<br>
+ status_.shutter_time = config_.default_exposure_time;<br>
+ status_.analogue_gain = config_.default_analogue_gain;<br>
+}<br>
+<br>
+bool Agc::IsPaused() const<br>
+{<br>
+ return false;<br>
+}<br>
+<br>
+void Agc::Pause()<br>
+{<br>
+ fixed_shutter_ = status_.shutter_time;<br>
+ fixed_analogue_gain_ = status_.analogue_gain;<br>
+}<br>
+<br>
+void Agc::Resume()<br>
+{<br>
+ fixed_shutter_ = 0;<br>
+ fixed_analogue_gain_ = 0;<br>
}<br>
<br>
void Agc::SetEv(double ev)<br>
@@ -199,11 +219,15 @@ void Agc::SetFlickerPeriod(double flicker_period)<br>
void Agc::SetFixedShutter(double fixed_shutter)<br>
{<br>
fixed_shutter_ = fixed_shutter;<br>
+ // Set this in case someone calls Pause() straight after.<br>
+ status_.shutter_time = fixed_shutter;<br>
}<br>
<br>
void Agc::SetFixedAnalogueGain(double fixed_analogue_gain)<br>
{<br>
fixed_analogue_gain_ = fixed_analogue_gain;<br>
+ // Set this in case someone calls Pause() straight after.<br>
+ status_.analogue_gain = fixed_analogue_gain;<br>
}<br>
<br>
void Agc::SetMeteringMode(std::string const &metering_mode_name)<br>
diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp b/src/ipa/raspberrypi/controller/rpi/agc.hpp<br>
index 47ebb324..95db1812 100644<br>
--- a/src/ipa/raspberrypi/controller/rpi/agc.hpp<br>
+++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp<br>
@@ -70,6 +70,10 @@ public:<br>
Agc(Controller *controller);<br>
char const *Name() const override;<br>
void Read(boost::property_tree::ptree const ¶ms) override;<br>
+ // AGC handles "pausing" for itself.<br>
+ bool IsPaused() const override;<br>
+ void Pause() override;<br>
+ void Resume() override;<br>
void SetEv(double ev) override;<br>
void SetFlickerPeriod(double flicker_period) override;<br>
void SetFixedShutter(double fixed_shutter) override; // microseconds<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
libcamera-devel mailing list<br>
<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank" rel="noreferrer">libcamera-devel@lists.libcamera.org</a><br>
<a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
</blockquote></div></div></div>