summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipa/raspberrypi/cam_helper.cpp11
-rw-r--r--src/ipa/raspberrypi/cam_helper.hpp3
-rw-r--r--src/ipa/raspberrypi/controller/camera_mode.h2
-rw-r--r--src/ipa/raspberrypi/raspberrypi.cpp6
4 files changed, 22 insertions, 0 deletions
diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp
index 3c6afce7..8f64e014 100644
--- a/src/ipa/raspberrypi/cam_helper.cpp
+++ b/src/ipa/raspberrypi/cam_helper.cpp
@@ -129,6 +129,17 @@ bool CamHelper::SensorEmbeddedDataPresent() const
return false;
}
+double CamHelper::GetModeSensitivity([[maybe_unused]] const CameraMode &mode) const
+{
+ /*
+ * Most sensors have the same sensitivity in every mode, but this
+ * method can be overridden for those that do not. Note that it is
+ * called before mode_ is set, so it must return the sensitivity
+ * of the mode that is passed in.
+ */
+ return 1.0;
+}
+
unsigned int CamHelper::HideFramesStartup() const
{
/*
diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
index 200cc83f..0643b77a 100644
--- a/src/ipa/raspberrypi/cam_helper.hpp
+++ b/src/ipa/raspberrypi/cam_helper.hpp
@@ -41,6 +41,8 @@ namespace RPiController {
//
// A method to query if the sensor outputs embedded data that can be parsed.
//
+// A method to return the sensitivity of a given camera mode.
+//
// A parser to parse the embedded data buffers provided by some sensors (for
// example, the imx219 does; the ov5647 doesn't). This allows us to know for
// sure the exposure and gain of the frame we're looking at. CamHelper
@@ -84,6 +86,7 @@ public:
virtual void GetDelays(int &exposure_delay, int &gain_delay,
int &vblank_delay) const;
virtual bool SensorEmbeddedDataPresent() const;
+ virtual double GetModeSensitivity(const CameraMode &mode) const;
virtual unsigned int HideFramesStartup() const;
virtual unsigned int HideFramesModeSwitch() const;
virtual unsigned int MistrustFramesStartup() const;
diff --git a/src/ipa/raspberrypi/controller/camera_mode.h b/src/ipa/raspberrypi/controller/camera_mode.h
index 65888230..e2b82828 100644
--- a/src/ipa/raspberrypi/controller/camera_mode.h
+++ b/src/ipa/raspberrypi/controller/camera_mode.h
@@ -41,6 +41,8 @@ struct CameraMode {
libcamera::Transform transform;
// minimum and maximum fame lengths in units of lines
uint32_t min_frame_length, max_frame_length;
+ // sensitivity of this mode
+ double sensitivity;
};
#ifdef __cplusplus
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index b08602f4..48e11c69 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -325,6 +325,12 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo)
*/
mode_.min_frame_length = sensorInfo.minFrameLength;
mode_.max_frame_length = sensorInfo.maxFrameLength;
+
+ /*
+ * Some sensors may have different sensitivities in different modes;
+ * the CamHelper will know the correct value.
+ */
+ mode_.sensitivity = helper_->GetModeSensitivity(mode_);
}
int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,