<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thank you for your patch.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 7 Dec 2020 at 18:02, David Plowman <<a href="mailto:david.plowman@raspberrypi.com">david.plowman@raspberrypi.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We add a GetConvergenceFrames method to the AwbAlgorithm class which<br>
can be called when the AWB is started from scratch. It suggests how<br>
many frames should be dropped before displaying any (while the AWB<br>
converges).<br>
<br>
The Raspberry Pi specific implementation makes this customisable from<br>
the tuning file.<br>
<br>
Signed-off-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank">david.plowman@raspberrypi.com</a>><br>
---<br>
src/ipa/raspberrypi/controller/awb_algorithm.hpp | 1 +<br>
src/ipa/raspberrypi/controller/rpi/awb.cpp | 13 +++++++++++++<br>
src/ipa/raspberrypi/controller/rpi/awb.hpp | 2 ++<br>
3 files changed, 16 insertions(+)<br>
<br>
diff --git a/src/ipa/raspberrypi/controller/awb_algorithm.hpp b/src/ipa/raspberrypi/controller/awb_algorithm.hpp<br>
index 5be0c9f4..84ae313b 100644<br>
--- a/src/ipa/raspberrypi/controller/awb_algorithm.hpp<br>
+++ b/src/ipa/raspberrypi/controller/awb_algorithm.hpp<br>
@@ -15,6 +15,7 @@ class AwbAlgorithm : public Algorithm<br>
public:<br>
AwbAlgorithm(Controller *controller) : Algorithm(controller) {}<br>
// An AWB algorithm must provide the following:<br>
+ virtual unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const = 0;<br>
virtual void SetMode(std::string const &mode_name) = 0;<br>
virtual void SetManualGains(double manual_r, double manual_b) = 0;<br>
};<br>
diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp<br>
index 020825e3..6b359ac5 100644<br>
--- a/src/ipa/raspberrypi/controller/rpi/awb.cpp<br>
+++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp<br>
@@ -59,6 +59,7 @@ void AwbConfig::Read(boost::property_tree::ptree const ¶ms)<br>
bayes = params.get<int>("bayes", 1);<br>
frame_period = params.get<uint16_t>("frame_period", 10);<br>
startup_frames = params.get<uint16_t>("startup_frames", 10);<br>
+ convergence_frames = params.get<unsigned int>("convergence_frames", 3);<br>
speed = params.get<double>("speed", 0.05);<br>
if (params.get_child_optional("ct_curve"))<br>
read_ct_curve(ct_r, ct_b, params.get_child("ct_curve"));<br>
@@ -165,6 +166,18 @@ void Awb::Initialise()<br>
prev_sync_results_ = sync_results_;<br>
}<br>
<br>
+unsigned int Awb::GetConvergenceFrames(unsigned int mistrust_frames) const<br>
+{<br>
+ // If colour gains have been explicitly set, there is no convergence<br>
+ // to happen, so no need to drop any frames - return zero.<br>
+ // Otherwise, any frames for which we have been told not to trust the<br>
+ // statistics must be added to our own count.<br>
+ if (manual_r_ && manual_b_)<br>
+ return 0;<br>
+ else<br>
+ return config_.convergence_frames + mistrust_frames;<br>
+}<br>
+<br></blockquote><div><br></div><div>Similar to the comment on the AGC patch, could you not leave mistrust_frames
out and do the addition of mistrust frames in the IPA? Either way,</div><div><br></div><div>Reviewed-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</a>></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
void Awb::SetMode(std::string const &mode_name)<br>
{<br>
std::unique_lock<std::mutex> lock(settings_mutex_);<br>
diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp<br>
index 545d85a8..d86b9598 100644<br>
--- a/src/ipa/raspberrypi/controller/rpi/awb.hpp<br>
+++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp<br>
@@ -37,6 +37,7 @@ struct AwbConfig {<br>
uint16_t frame_period;<br>
// number of initial frames for which speed taken as 1.0 (maximum)<br>
uint16_t startup_frames;<br>
+ unsigned int convergence_frames; // approx number of frames to converge<br>
double speed; // IIR filter speed applied to algorithm results<br>
bool fast; // "fast" mode uses a 16x16 rather than 32x32 grid<br>
Pwl ct_r; // function maps CT to r (= R/G)<br>
@@ -82,6 +83,7 @@ public:<br>
char const *Name() const override;<br>
void Initialise() override;<br>
void Read(boost::property_tree::ptree const ¶ms) override;<br>
+ unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const override;<br>
void SetMode(std::string const &name) override;<br>
void SetManualGains(double manual_r, double manual_b) override;<br>
void SwitchMode(CameraMode const &camera_mode, Metadata *metadata) override;<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
libcamera-devel mailing list<br>
<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a><br>
<a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
</blockquote></div></div>