mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 16:45:07 +03:00
ipa: rpi: agc: Add an AGC stable region
Add a small "stable region" parameter (defaulting to 2%) within which the AGC will not adjust the exposure it requests. It allows applications to configure the AGC to avoid continual micro-adjustments of exposure values if they are somehow sensitive to it. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
a04fe76a45
commit
9c90e56733
2 changed files with 8 additions and 0 deletions
|
@ -251,6 +251,8 @@ int AgcConfig::read(const libcamera::YamlObject ¶ms)
|
||||||
defaultExposureTime = params["default_exposure_time"].get<double>(1000) * 1us;
|
defaultExposureTime = params["default_exposure_time"].get<double>(1000) * 1us;
|
||||||
defaultAnalogueGain = params["default_analogue_gain"].get<double>(1.0);
|
defaultAnalogueGain = params["default_analogue_gain"].get<double>(1.0);
|
||||||
|
|
||||||
|
stableRegion = params["stable_region"].get<double>(0.02);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,6 +873,8 @@ bool AgcChannel::applyDigitalGain(double gain, double targetY, bool channelBound
|
||||||
void AgcChannel::filterExposure()
|
void AgcChannel::filterExposure()
|
||||||
{
|
{
|
||||||
double speed = config_.speed;
|
double speed = config_.speed;
|
||||||
|
double stableRegion = config_.stableRegion;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AGC adapts instantly if both shutter and gain are directly specified
|
* AGC adapts instantly if both shutter and gain are directly specified
|
||||||
* or we're in the startup phase.
|
* or we're in the startup phase.
|
||||||
|
@ -880,6 +884,9 @@ void AgcChannel::filterExposure()
|
||||||
speed = 1.0;
|
speed = 1.0;
|
||||||
if (!filtered_.totalExposure) {
|
if (!filtered_.totalExposure) {
|
||||||
filtered_.totalExposure = target_.totalExposure;
|
filtered_.totalExposure = target_.totalExposure;
|
||||||
|
} else if (filtered_.totalExposure * (1.0 - stableRegion) < target_.totalExposure &&
|
||||||
|
filtered_.totalExposure * (1.0 + stableRegion) > target_.totalExposure) {
|
||||||
|
/* Total exposure must change by more than this or we leave it alone. */
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* If close to the result go faster, to save making so many
|
* If close to the result go faster, to save making so many
|
||||||
|
|
|
@ -75,6 +75,7 @@ struct AgcConfig {
|
||||||
double baseEv;
|
double baseEv;
|
||||||
libcamera::utils::Duration defaultExposureTime;
|
libcamera::utils::Duration defaultExposureTime;
|
||||||
double defaultAnalogueGain;
|
double defaultAnalogueGain;
|
||||||
|
double stableRegion;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AgcChannel
|
class AgcChannel
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue