mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-16 17:05:08 +03:00
ipa: rkisp1: Move shutter speed and analogue gain limits from agc to sensor
The limits for the shutter speed and analogue gain are stored in IPASessionConfiguration::agc. While they're related to the AGC, they are properties of the sensor, and are stored in the session configuration by the IPA module, not the AGC algorithm. Move them to the IPASessionConfiguration::sensor structure where they belong. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
02bc2a8a24
commit
00b650b6b8
4 changed files with 32 additions and 26 deletions
|
@ -74,7 +74,8 @@ Agc::Agc()
|
||||||
int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)
|
int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)
|
||||||
{
|
{
|
||||||
/* Configure the default exposure and gain. */
|
/* Configure the default exposure and gain. */
|
||||||
context.activeState.agc.gain = std::max(context.configuration.agc.minAnalogueGain, kMinAnalogueGain);
|
context.activeState.agc.gain = std::max(context.configuration.sensor.minAnalogueGain,
|
||||||
|
kMinAnalogueGain);
|
||||||
context.activeState.agc.exposure = 10ms / context.configuration.sensor.lineDuration;
|
context.activeState.agc.exposure = 10ms / context.configuration.sensor.lineDuration;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -202,13 +203,13 @@ void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext,
|
||||||
/* Use the highest of the two gain estimates. */
|
/* Use the highest of the two gain estimates. */
|
||||||
double evGain = std::max(yGain, iqMeanGain);
|
double evGain = std::max(yGain, iqMeanGain);
|
||||||
|
|
||||||
utils::Duration minShutterSpeed = configuration.agc.minShutterSpeed;
|
utils::Duration minShutterSpeed = configuration.sensor.minShutterSpeed;
|
||||||
utils::Duration maxShutterSpeed = std::min(configuration.agc.maxShutterSpeed,
|
utils::Duration maxShutterSpeed = std::min(configuration.sensor.maxShutterSpeed,
|
||||||
kMaxShutterSpeed);
|
kMaxShutterSpeed);
|
||||||
|
|
||||||
double minAnalogueGain = std::max(configuration.agc.minAnalogueGain,
|
double minAnalogueGain = std::max(configuration.sensor.minAnalogueGain,
|
||||||
kMinAnalogueGain);
|
kMinAnalogueGain);
|
||||||
double maxAnalogueGain = std::min(configuration.agc.maxAnalogueGain,
|
double maxAnalogueGain = std::min(configuration.sensor.maxAnalogueGain,
|
||||||
kMaxAnalogueGain);
|
kMaxAnalogueGain);
|
||||||
|
|
||||||
/* Consider within 1% of the target as correctly exposed. */
|
/* Consider within 1% of the target as correctly exposed. */
|
||||||
|
|
|
@ -28,21 +28,11 @@ namespace libcamera::ipa::rkisp1 {
|
||||||
* \var IPASessionConfiguration::agc
|
* \var IPASessionConfiguration::agc
|
||||||
* \brief AGC parameters configuration of the IPA
|
* \brief AGC parameters configuration of the IPA
|
||||||
*
|
*
|
||||||
* \var IPASessionConfiguration::agc.minShutterSpeed
|
|
||||||
* \brief Minimum shutter speed supported with the configured sensor
|
|
||||||
*
|
|
||||||
* \var IPASessionConfiguration::agc.maxShutterSpeed
|
|
||||||
* \brief Maximum shutter speed supported with the configured sensor
|
|
||||||
*
|
|
||||||
* \var IPASessionConfiguration::agc.minAnalogueGain
|
|
||||||
* \brief Minimum analogue gain supported with the configured sensor
|
|
||||||
*
|
|
||||||
* \var IPASessionConfiguration::agc.maxAnalogueGain
|
|
||||||
* \brief Maximum analogue gain supported with the configured sensor
|
|
||||||
*
|
|
||||||
* \var IPASessionConfiguration::agc.measureWindow
|
* \var IPASessionConfiguration::agc.measureWindow
|
||||||
* \brief AGC measure window
|
* \brief AGC measure window
|
||||||
*
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* \var IPASessionConfiguration::hw
|
* \var IPASessionConfiguration::hw
|
||||||
* \brief RkISP1-specific hardware information
|
* \brief RkISP1-specific hardware information
|
||||||
*
|
*
|
||||||
|
@ -77,6 +67,18 @@ namespace libcamera::ipa::rkisp1 {
|
||||||
* \var IPASessionConfiguration::sensor
|
* \var IPASessionConfiguration::sensor
|
||||||
* \brief Sensor-specific configuration of the IPA
|
* \brief Sensor-specific configuration of the IPA
|
||||||
*
|
*
|
||||||
|
* \var IPASessionConfiguration::sensor.minShutterSpeed
|
||||||
|
* \brief Minimum shutter speed supported with the sensor
|
||||||
|
*
|
||||||
|
* \var IPASessionConfiguration::sensor.maxShutterSpeed
|
||||||
|
* \brief Maximum shutter speed supported with the sensor
|
||||||
|
*
|
||||||
|
* \var IPASessionConfiguration::sensor.minAnalogueGain
|
||||||
|
* \brief Minimum analogue gain supported with the sensor
|
||||||
|
*
|
||||||
|
* \var IPASessionConfiguration::sensor.maxAnalogueGain
|
||||||
|
* \brief Maximum analogue gain supported with the sensor
|
||||||
|
*
|
||||||
* \var IPASessionConfiguration::sensor.defVBlank
|
* \var IPASessionConfiguration::sensor.defVBlank
|
||||||
* \brief The default vblank value of the sensor
|
* \brief The default vblank value of the sensor
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,10 +22,6 @@ namespace ipa::rkisp1 {
|
||||||
|
|
||||||
struct IPASessionConfiguration {
|
struct IPASessionConfiguration {
|
||||||
struct {
|
struct {
|
||||||
utils::Duration minShutterSpeed;
|
|
||||||
utils::Duration maxShutterSpeed;
|
|
||||||
double minAnalogueGain;
|
|
||||||
double maxAnalogueGain;
|
|
||||||
struct rkisp1_cif_isp_window measureWindow;
|
struct rkisp1_cif_isp_window measureWindow;
|
||||||
} agc;
|
} agc;
|
||||||
|
|
||||||
|
@ -39,6 +35,11 @@ struct IPASessionConfiguration {
|
||||||
} lsc;
|
} lsc;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
utils::Duration minShutterSpeed;
|
||||||
|
utils::Duration maxShutterSpeed;
|
||||||
|
double minAnalogueGain;
|
||||||
|
double maxAnalogueGain;
|
||||||
|
|
||||||
int32_t defVBlank;
|
int32_t defVBlank;
|
||||||
utils::Duration lineDuration;
|
utils::Duration lineDuration;
|
||||||
Size size;
|
Size size;
|
||||||
|
|
|
@ -256,10 +256,12 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,
|
||||||
*
|
*
|
||||||
* \todo take VBLANK into account for maximum shutter speed
|
* \todo take VBLANK into account for maximum shutter speed
|
||||||
*/
|
*/
|
||||||
context_.configuration.agc.minShutterSpeed = minExposure * context_.configuration.sensor.lineDuration;
|
context_.configuration.sensor.minShutterSpeed =
|
||||||
context_.configuration.agc.maxShutterSpeed = maxExposure * context_.configuration.sensor.lineDuration;
|
minExposure * context_.configuration.sensor.lineDuration;
|
||||||
context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain);
|
context_.configuration.sensor.maxShutterSpeed =
|
||||||
context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);
|
maxExposure * context_.configuration.sensor.lineDuration;
|
||||||
|
context_.configuration.sensor.minAnalogueGain = camHelper_->gain(minGain);
|
||||||
|
context_.configuration.sensor.maxAnalogueGain = camHelper_->gain(maxGain);
|
||||||
|
|
||||||
for (auto const &algo : algorithms()) {
|
for (auto const &algo : algorithms()) {
|
||||||
int ret = algo->configure(context_, info);
|
int ret = algo->configure(context_, info);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue