summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/controller/rpi/agc_channel.cpp
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2023-09-15 16:58:42 +0100
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-09-16 17:33:44 +0200
commitbeab3a229fa18379e65274aecab69a5d0c8b60a5 (patch)
tree57d36eacb4461271fc856600e5fbdcf5cd896205 /src/ipa/rpi/controller/rpi/agc_channel.cpp
parentb2cb498a1ac32ed7a659645e529f29e51e566d3f (diff)
ipa: rpi: agc: Implementation of multi-channel AGC
The switchMode, prepare and process methods are updated to implement multi-channel AGC correctly: * switchMode now invokes switchMode on all the channels (whether active or not). * prepare must find what channel the current frame is, and run on behalf of that channel. * process updates the most recent DeviceStatus and statistics for the channel of the frame that has just arrived, but generates updated values working through the active channels in round-robin fashion. One minor detail in process is that we don't want to change the DeviceStatus metadata of the current frame, so we now pass this to the AgcChannel's process method, rather than letting it find the DeviceStatus in the metadata. 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.cpp')
-rw-r--r--src/ipa/rpi/controller/rpi/agc_channel.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp
index f180b848..84eafe7d 100644
--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp
+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp
@@ -444,7 +444,7 @@ void AgcChannel::prepare(Metadata *imageMetadata)
}
}
-void AgcChannel::process(StatisticsPtr &stats, Metadata *imageMetadata)
+void AgcChannel::process(StatisticsPtr &stats, DeviceStatus const &deviceStatus, Metadata *imageMetadata)
{
frameCount_++;
/*
@@ -455,7 +455,7 @@ void AgcChannel::process(StatisticsPtr &stats, Metadata *imageMetadata)
/* Fetch the AWB status immediately, so that we can assume it's there. */
fetchAwbStatus(imageMetadata);
/* Get the current exposure values for the frame that's just arrived. */
- fetchCurrentExposure(imageMetadata);
+ fetchCurrentExposure(deviceStatus);
/* Compute the total gain we require relative to the current exposure. */
double gain, targetY;
computeGain(stats, imageMetadata, gain, targetY);
@@ -567,18 +567,11 @@ void AgcChannel::housekeepConfig()
<< meteringModeName_;
}
-void AgcChannel::fetchCurrentExposure(Metadata *imageMetadata)
+void AgcChannel::fetchCurrentExposure(DeviceStatus const &deviceStatus)
{
- std::unique_lock<Metadata> lock(*imageMetadata);
- DeviceStatus *deviceStatus =
- imageMetadata->getLocked<DeviceStatus>("device.status");
- if (!deviceStatus)
- LOG(RPiAgc, Fatal) << "No device metadata";
- current_.shutter = deviceStatus->shutterSpeed;
- current_.analogueGain = deviceStatus->analogueGain;
- AgcStatus *agcStatus =
- imageMetadata->getLocked<AgcStatus>("agc.status");
- current_.totalExposure = agcStatus ? agcStatus->totalExposureValue : 0s;
+ current_.shutter = deviceStatus.shutterSpeed;
+ current_.analogueGain = deviceStatus.analogueGain;
+ current_.totalExposure = 0s; /* this value is unused */
current_.totalExposureNoDG = current_.shutter * current_.analogueGain;
}