summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/cam_helper.hpp
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-01-19 15:30:46 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-01-20 14:13:50 +0200
commit92b8ccc42a0f3ad323c79bde3c132d6956011239 (patch)
treec0e5beff20fd126387ba78d26977bdc37b2c61cf /src/ipa/raspberrypi/cam_helper.hpp
parent6232ec3c164102eb59c2deec9facb6552b55cca0 (diff)
libcamera: raspberrypi: Add control of sensor vblanking
Add support for setting V4L2_CID_VBLANK appropriately when setting V4L2_CID_EXPOSURE. This will allow adaptive framerates during viewfinder use cases (e.g. when the exposure time goes above 33ms, we can reduce the framerate to lower than 30fps). The minimum and maximum frame durations are provided via libcamera controls, and will prioritise exposure time limits over any AGC request. V4L2_CID_VBLANK is controlled through the staggered writer, just like the exposure and gain controls. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/raspberrypi/cam_helper.hpp')
-rw-r--r--src/ipa/raspberrypi/cam_helper.hpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
index 044c2866..b1739a57 100644
--- a/src/ipa/raspberrypi/cam_helper.hpp
+++ b/src/ipa/raspberrypi/cam_helper.hpp
@@ -62,12 +62,15 @@ class CamHelper
{
public:
static CamHelper *Create(std::string const &cam_name);
- CamHelper(MdParser *parser);
+ CamHelper(MdParser *parser, unsigned int maxFrameLength,
+ unsigned int frameIntegrationDiff);
virtual ~CamHelper();
void SetCameraMode(const CameraMode &mode);
MdParser &Parser() const { return *parser_; }
uint32_t ExposureLines(double exposure_us) const;
double Exposure(uint32_t exposure_lines) const; // in us
+ virtual uint32_t GetVBlanking(double &exposure_us, double minFrameDuration,
+ 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;
@@ -76,10 +79,20 @@ public:
virtual unsigned int HideFramesModeSwitch() const;
virtual unsigned int MistrustFramesStartup() const;
virtual unsigned int MistrustFramesModeSwitch() const;
+
protected:
MdParser *parser_;
CameraMode mode_;
+
+private:
bool initialized_;
+ /* Largest possible frame length, in units of lines. */
+ unsigned int maxFrameLength_;
+ /*
+ * Smallest difference between the frame length and integration time,
+ * in units of lines.
+ */
+ unsigned int frameIntegrationDiff_;
};
// This is for registering camera helpers with the system, so that the