mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-21 15:53:54 +03:00
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>
This commit is contained in:
parent
f484857994
commit
18691c538b
5 changed files with 22 additions and 13 deletions
|
@ -95,7 +95,8 @@ void CamHelper::SetCameraMode(const CameraMode &mode)
|
||||||
initialized_ = true;
|
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
|
* 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;
|
exposure_delay = 2;
|
||||||
gain_delay = 1;
|
gain_delay = 1;
|
||||||
|
vblank_delay = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CamHelper::SensorEmbeddedDataPresent() const
|
bool CamHelper::SensorEmbeddedDataPresent() const
|
||||||
|
|
|
@ -28,10 +28,10 @@ namespace RPiController {
|
||||||
// exposure time, and to convert between the sensor's gain codes and actual
|
// exposure time, and to convert between the sensor's gain codes and actual
|
||||||
// gains.
|
// gains.
|
||||||
//
|
//
|
||||||
// A method to return the number of frames of delay between updating exposure
|
// 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
|
// analogue gain and vblanking, and for the changes to take effect. For many
|
||||||
// take the values 2 and 1 respectively, but sensors that are different will
|
// sensors these take the values 2, 1 and 2 respectively, but sensors that are
|
||||||
// need to over-ride the default method provided.
|
// different will need to over-ride the default method provided.
|
||||||
//
|
//
|
||||||
// A method to query if the sensor outputs embedded data that can be parsed.
|
// A method to query if the sensor outputs embedded data that can be parsed.
|
||||||
//
|
//
|
||||||
|
@ -72,7 +72,8 @@ public:
|
||||||
double maxFrameDuration) const;
|
double maxFrameDuration) const;
|
||||||
virtual uint32_t GainCode(double gain) const = 0;
|
virtual uint32_t GainCode(double gain) const = 0;
|
||||||
virtual double Gain(uint32_t gain_code) 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 bool SensorEmbeddedDataPresent() const;
|
||||||
virtual unsigned int HideFramesStartup() const;
|
virtual unsigned int HideFramesStartup() const;
|
||||||
virtual unsigned int HideFramesModeSwitch() const;
|
virtual unsigned int HideFramesModeSwitch() const;
|
||||||
|
|
|
@ -37,7 +37,8 @@ public:
|
||||||
CamHelperImx477();
|
CamHelperImx477();
|
||||||
uint32_t GainCode(double gain) const override;
|
uint32_t GainCode(double gain) const override;
|
||||||
double Gain(uint32_t gain_code) 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;
|
bool SensorEmbeddedDataPresent() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -63,10 +64,12 @@ double CamHelperImx477::Gain(uint32_t gain_code) const
|
||||||
return 1024.0 / (1024 - gain_code);
|
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;
|
exposure_delay = 2;
|
||||||
gain_delay = 2;
|
gain_delay = 2;
|
||||||
|
vblank_delay = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CamHelperImx477::SensorEmbeddedDataPresent() const
|
bool CamHelperImx477::SensorEmbeddedDataPresent() const
|
||||||
|
|
|
@ -17,7 +17,8 @@ public:
|
||||||
CamHelperOv5647();
|
CamHelperOv5647();
|
||||||
uint32_t GainCode(double gain) const override;
|
uint32_t GainCode(double gain) const override;
|
||||||
double Gain(uint32_t gain_code) 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 HideFramesStartup() const override;
|
||||||
unsigned int HideFramesModeSwitch() const override;
|
unsigned int HideFramesModeSwitch() const override;
|
||||||
unsigned int MistrustFramesStartup() 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;
|
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
|
* 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;
|
exposure_delay = 2;
|
||||||
gain_delay = 2;
|
gain_delay = 2;
|
||||||
|
vblank_delay = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CamHelperOv5647::HideFramesStartup() const
|
unsigned int CamHelperOv5647::HideFramesStartup() const
|
||||||
|
|
|
@ -342,14 +342,14 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,
|
||||||
* Pass out the sensor config to the pipeline handler in order
|
* Pass out the sensor config to the pipeline handler in order
|
||||||
* to setup the staggered writer class.
|
* to setup the staggered writer class.
|
||||||
*/
|
*/
|
||||||
int gainDelay, exposureDelay, sensorMetadata;
|
int gainDelay, exposureDelay, vblankDelay, sensorMetadata;
|
||||||
helper_->GetDelays(exposureDelay, gainDelay);
|
helper_->GetDelays(exposureDelay, gainDelay, vblankDelay);
|
||||||
sensorMetadata = helper_->SensorEmbeddedDataPresent();
|
sensorMetadata = helper_->SensorEmbeddedDataPresent();
|
||||||
|
|
||||||
result->params |= ipa::RPi::ConfigSensorParams;
|
result->params |= ipa::RPi::ConfigSensorParams;
|
||||||
result->sensorConfig.gainDelay = gainDelay;
|
result->sensorConfig.gainDelay = gainDelay;
|
||||||
result->sensorConfig.exposureDelay = exposureDelay;
|
result->sensorConfig.exposureDelay = exposureDelay;
|
||||||
result->sensorConfig.vblank = exposureDelay;
|
result->sensorConfig.vblank = vblankDelay;
|
||||||
result->sensorConfig.sensorMetadata = sensorMetadata;
|
result->sensorConfig.sensorMetadata = sensorMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue