<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thank you for your work.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 27 May 2021 at 09:45, 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">Initialise it to the usual value of 1, until such time as we have a<br>
mechanism that allows us to discover the correct value.<br>
<br>
The CamHelper class also gets a method to return this sensitivity<br>
value. This method is virtual so that it can be overridden for<br>
specific sensors. Once the correct value is obtainable elsewhere, this<br>
can be removed.<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/cam_helper.cpp           |  5 +++++<br>
 src/ipa/raspberrypi/cam_helper.hpp           |  3 +++<br>
 src/ipa/raspberrypi/controller/camera_mode.h |  2 ++<br>
 src/ipa/raspberrypi/raspberrypi.cpp          | 12 ++++++++++++<br>
 4 files changed, 22 insertions(+)<br>
<br>
diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp<br>
index 09917f3c..71ea21ff 100644<br>
--- a/src/ipa/raspberrypi/cam_helper.cpp<br>
+++ b/src/ipa/raspberrypi/cam_helper.cpp<br>
@@ -128,6 +128,11 @@ bool CamHelper::SensorEmbeddedDataPresent() const<br>
        return false;<br>
 }<br>
<br>
+double CamHelper::Sensitivity() const<br>
+{<br>
+       return mode_.sensitivity;<br>
+}<br>
+<br>
 unsigned int CamHelper::HideFramesStartup() const<br>
 {<br>
        /*<br>
diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp<br>
index a52f3f0b..14c4714c 100644<br>
--- a/src/ipa/raspberrypi/cam_helper.hpp<br>
+++ b/src/ipa/raspberrypi/cam_helper.hpp<br>
@@ -39,6 +39,8 @@ namespace RPiController {<br>
 //<br>
 // A method to query if the sensor outputs embedded data that can be parsed.<br>
 //<br>
+// A method to return the sensitivity of the current camera mode.<br>
+//<br>
 // A parser to parse the embedded data buffers provided by some sensors (for<br>
 // example, the imx219 does; the ov5647 doesn't). This allows us to know for<br>
 // sure the exposure and gain of the frame we're looking at. CamHelper<br>
@@ -81,6 +83,7 @@ public:<br>
        virtual void GetDelays(int &exposure_delay, int &gain_delay,<br>
                               int &vblank_delay) const;<br>
        virtual bool SensorEmbeddedDataPresent() const;<br>
+       virtual double Sensitivity() const;<br>
        virtual unsigned int HideFramesStartup() const;<br>
        virtual unsigned int HideFramesModeSwitch() const;<br>
        virtual unsigned int MistrustFramesStartup() const;<br>
diff --git a/src/ipa/raspberrypi/controller/camera_mode.h b/src/ipa/raspberrypi/controller/camera_mode.h<br>
index 256438c9..326f4f20 100644<br>
--- a/src/ipa/raspberrypi/controller/camera_mode.h<br>
+++ b/src/ipa/raspberrypi/controller/camera_mode.h<br>
@@ -39,6 +39,8 @@ struct CameraMode {<br>
        libcamera::Transform transform;<br>
        // minimum and maximum fame lengths in units of lines<br>
        uint32_t min_frame_length, max_frame_length;<br>
+       // sensitivity of this mode<br>
+       double sensitivity;<br>
 };<br>
<br>
 #ifdef __cplusplus<br>
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp<br>
index e5bb8159..da42d279 100644<br>
--- a/src/ipa/raspberrypi/raspberrypi.cpp<br>
+++ b/src/ipa/raspberrypi/raspberrypi.cpp<br>
@@ -321,6 +321,12 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo)<br>
         */<br>
        mode_.min_frame_length = sensorInfo.minFrameLength;<br>
        mode_.max_frame_length = sensorInfo.maxFrameLength;<br>
+<br>
+       /*<br>
+        * For now, initialise the mode sensitivity to the usual value of 1.<br>
+        * \todo Obtain the correct sensitivity number automatically.<br>
+        */<br>
+       mode_.sensitivity = 1.0;<br>
 }<br>
<br>
 int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,<br>
@@ -379,6 +385,12 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,<br>
        /* Pass the camera mode to the CamHelper to setup algorithms. */<br>
        helper_->SetCameraMode(mode_);<br>
<br>
+       /*<br>
+        * For now, the CamHelper knows the sensitivity correctly.<br>
+        * \todo This can be removed once the sensitivity is initialised properly.<br>
+        */<br>
+       mode_.sensitivity = helper_->Sensitivity();<br>
+<br></blockquote><div><br></div><div>I'm afraid I don't quite follow the logic here.  setMode sets the sensitivity in mode_,</div><div>then this gets updated via the helper to the same value.  Obviously some of this is</div><div>placeholder code right now, but could you explain how this may be expected to work</div><div>eventually?</div><div><br></div><div>Another related question, do we need to involve the CamHelper at all?  Could we do</div><div>everything in the setMode function?</div><div><br></div><div>Thanks,</div><div>Naush</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">
        if (firstStart_) {<br>
                /* Supply initial values for frame durations. */<br>
                applyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration);<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">-- <br>
2.20.1<br>
<br>
</blockquote></div></div>