summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/controller/rpi/agc_channel.h
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2023-09-15 16:58:44 +0100
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-09-16 17:33:44 +0200
commit7127954aaa5fe9938743cbc41a328027697aba8a (patch)
treeea3c7247036e8ec3eb00675162811db596630de4 /src/ipa/rpi/controller/rpi/agc_channel.h
parent7927c4473529dc5a469cf6c707f1989e86792896 (diff)
ipa: rpi: agc: Use channel constraints in the AGC algorithm
Whenever we run Agc::process(), we store the most recent total exposure requested for each channel. With these values we can apply the channel constraints after time-filtering the requested total exposure, but before working out how much digital gain is needed. 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: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi/controller/rpi/agc_channel.h')
-rw-r--r--src/ipa/rpi/controller/rpi/agc_channel.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ipa/rpi/controller/rpi/agc_channel.h b/src/ipa/rpi/controller/rpi/agc_channel.h
index ceaab12f..ae826fa8 100644
--- a/src/ipa/rpi/controller/rpi/agc_channel.h
+++ b/src/ipa/rpi/controller/rpi/agc_channel.h
@@ -21,6 +21,8 @@
namespace RPiController {
+using AgcChannelTotalExposures = std::vector<libcamera::utils::Duration>;
+
struct AgcMeteringMode {
std::vector<double> weights;
int read(const libcamera::YamlObject &params);
@@ -95,7 +97,8 @@ public:
void disableAuto();
void switchMode(CameraMode const &cameraMode, Metadata *metadata);
void prepare(Metadata *imageMetadata);
- void process(StatisticsPtr &stats, DeviceStatus const &deviceStatus, Metadata *imageMetadata);
+ void process(StatisticsPtr &stats, DeviceStatus const &deviceStatus, Metadata *imageMetadata,
+ const AgcChannelTotalExposures &channelTotalExposures);
private:
bool updateLockStatus(DeviceStatus const &deviceStatus);
@@ -107,7 +110,8 @@ private:
double &gain, double &targetY);
void computeTargetExposure(double gain);
void filterExposure();
- bool applyDigitalGain(double gain, double targetY);
+ bool applyChannelConstraints(const AgcChannelTotalExposures &channelTotalExposures);
+ bool applyDigitalGain(double gain, double targetY, bool channelBound);
void divideUpExposure();
void writeAndFinish(Metadata *imageMetadata, bool desaturate);
libcamera::utils::Duration limitShutter(libcamera::utils::Duration shutter);