summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2021-03-08 22:39:37 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-09 00:50:42 +0200
commit18691c538b9dad777bd61fe8400289298c78ac10 (patch)
treeefbcebf6733e1e82fef69e55db33e6dc6c240c2a
parentf484857994075d0e4d33f8897cb3b47c7cf3fd6a (diff)
ipa: raspberrypi: Make CamHelpers return the frame delay for vblanking
For some sensors (e.g. imx477) we need to update the vblanking on the frame before the exposure. For this reason the GetDelays method must also return the number of frame delays for the vblanking control. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/ipa/raspberrypi/cam_helper.cpp4
-rw-r--r--src/ipa/raspberrypi/cam_helper.hpp11
-rw-r--r--src/ipa/raspberrypi/cam_helper_imx477.cpp7
-rw-r--r--src/ipa/raspberrypi/cam_helper_ov5647.cpp7
-rw-r--r--src/ipa/raspberrypi/raspberrypi.cpp6
5 files changed, 22 insertions, 13 deletions
diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp
index 2837fcce..0ae0baa0 100644
--- a/src/ipa/raspberrypi/cam_helper.cpp
+++ b/src/ipa/raspberrypi/cam_helper.cpp
@@ -95,7 +95,8 @@ void CamHelper::SetCameraMode(const CameraMode &mode)
initialized_ = true;
}
-void CamHelper::GetDelays(int &exposure_delay, int &gain_delay) const
+void CamHelper::GetDelays(int &exposure_delay, int &gain_delay,
+ int &vblank_delay) const
{
/*
* These values are correct for many sensors. Other sensors will
@@ -103,6 +104,7 @@ void CamHelper::GetDelays(int &exposure_delay, int &gain_delay) const
*/
exposure_delay = 2;
gain_delay = 1;
+ vblank_delay = 2;
}
bool CamHelper::SensorEmbeddedDataPresent() const
diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
index 14d70112..1b2d6eec 100644
--- a/src/ipa/raspberrypi/cam_helper.hpp
+++ b/src/ipa/raspberrypi/cam_helper.hpp
@@ -28,10 +28,10 @@ namespace RPiController {
// exposure time, and to convert between the sensor's gain codes and actual
// gains.
//
-// A method to return the number of frames of delay between updating exposure
-// and analogue gain and the changes taking effect. For many sensors these
-// take the values 2 and 1 respectively, but sensors that are different will
-// need to over-ride the default method provided.
+// A method to return the number of frames of delay between updating exposure,
+// analogue gain and vblanking, and for the changes to take effect. For many
+// sensors these take the values 2, 1 and 2 respectively, but sensors that are
+// different will need to over-ride the default method provided.
//
// A method to query if the sensor outputs embedded data that can be parsed.
//
@@ -72,7 +72,8 @@ public:
double maxFrameDuration) const;
virtual uint32_t GainCode(double gain) const = 0;
virtual double Gain(uint32_t gain_code) const = 0;
- virtual void GetDelays(int &exposure_delay, int &gain_delay) const;
+ virtual void GetDelays(int &exposure_delay, int &gain_delay,
+ int &vblank_delay) const;
virtual bool SensorEmbeddedDataPresent() const;
virtual unsigned int HideFramesStartup() const;
virtual unsigned int HideFramesModeSwitch() const;
diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp
index 419f8e77..73a5ca7d 100644
--- a/src/ipa/raspberrypi/cam_helper_imx477.cpp
+++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp
@@ -37,7 +37,8 @@ public:
CamHelperImx477();
uint32_t GainCode(double gain) const override;
double Gain(uint32_t gain_code) const override;
- void GetDelays(int &exposure_delay, int &gain_delay) const override;
+ void GetDelays(int &exposure_delay, int &gain_delay,
+ int &vblank_delay) const override;
bool SensorEmbeddedDataPresent() const override;
private:
@@ -63,10 +64,12 @@ double CamHelperImx477::Gain(uint32_t gain_code) const
return 1024.0 / (1024 - gain_code);
}
-void CamHelperImx477::GetDelays(int &exposure_delay, int &gain_delay) const
+void CamHelperImx477::GetDelays(int &exposure_delay, int &gain_delay,
+ int &vblank_delay) const
{
exposure_delay = 2;
gain_delay = 2;
+ vblank_delay = 3;
}
bool CamHelperImx477::SensorEmbeddedDataPresent() const
diff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp
index 75486e90..12be6bf9 100644
--- a/src/ipa/raspberrypi/cam_helper_ov5647.cpp
+++ b/src/ipa/raspberrypi/cam_helper_ov5647.cpp
@@ -17,7 +17,8 @@ public:
CamHelperOv5647();
uint32_t GainCode(double gain) const override;
double Gain(uint32_t gain_code) const override;
- void GetDelays(int &exposure_delay, int &gain_delay) const override;
+ void GetDelays(int &exposure_delay, int &gain_delay,
+ int &vblank_delay) const override;
unsigned int HideFramesStartup() const override;
unsigned int HideFramesModeSwitch() const override;
unsigned int MistrustFramesStartup() const override;
@@ -51,7 +52,8 @@ double CamHelperOv5647::Gain(uint32_t gain_code) const
return static_cast<double>(gain_code) / 16.0;
}
-void CamHelperOv5647::GetDelays(int &exposure_delay, int &gain_delay) const
+void CamHelperOv5647::GetDelays(int &exposure_delay, int &gain_delay,
+ int &vblank_delay) const
{
/*
* We run this sensor in a mode where the gain delay is bumped up to
@@ -59,6 +61,7 @@ void CamHelperOv5647::GetDelays(int &exposure_delay, int &gain_delay) const
*/
exposure_delay = 2;
gain_delay = 2;
+ vblank_delay = 2;
}
unsigned int CamHelperOv5647::HideFramesStartup() const
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 6348d071..741bff4c 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -342,14 +342,14 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,
* Pass out the sensor config to the pipeline handler in order
* to setup the staggered writer class.
*/
- int gainDelay, exposureDelay, sensorMetadata;
- helper_->GetDelays(exposureDelay, gainDelay);
+ int gainDelay, exposureDelay, vblankDelay, sensorMetadata;
+ helper_->GetDelays(exposureDelay, gainDelay, vblankDelay);
sensorMetadata = helper_->SensorEmbeddedDataPresent();
result->params |= ipa::RPi::ConfigSensorParams;
result->sensorConfig.gainDelay = gainDelay;
result->sensorConfig.exposureDelay = exposureDelay;
- result->sensorConfig.vblank = exposureDelay;
+ result->sensorConfig.vblank = vblankDelay;
result->sensorConfig.sensorMetadata = sensorMetadata;
}