summaryrefslogtreecommitdiff
path: root/src/ipa
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa')
-rw-r--r--src/ipa/raspberrypi/controller/rpi/agc.cpp10
-rw-r--r--src/ipa/raspberrypi/raspberrypi.cpp11
2 files changed, 19 insertions, 2 deletions
diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp
index a30e50c1..46dcc81a 100644
--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp
@@ -403,6 +403,12 @@ void Agc::switchMode(CameraMode const &cameraMode,
void Agc::prepare(Metadata *imageMetadata)
{
+ Duration totalExposureValue = status_.totalExposureValue;
+ AgcStatus delayedStatus;
+
+ if (!imageMetadata->get("agc.delayed_status", delayedStatus))
+ totalExposureValue = delayedStatus.totalExposureValue;
+
status_.digitalGain = 1.0;
fetchAwbStatus(imageMetadata); /* always fetch it so that Process knows it's been done */
@@ -413,8 +419,8 @@ void Agc::prepare(Metadata *imageMetadata)
Duration actualExposure = deviceStatus.shutterSpeed *
deviceStatus.analogueGain;
if (actualExposure) {
- status_.digitalGain = status_.totalExposureValue / actualExposure;
- LOG(RPiAgc, Debug) << "Want total exposure " << status_.totalExposureValue;
+ status_.digitalGain = totalExposureValue / actualExposure;
+ LOG(RPiAgc, Debug) << "Want total exposure " << totalExposureValue;
/*
* Never ask for a gain < 1.0, and also impose
* some upper limit. Make it customisable?
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 3157805c..0f914f84 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -1031,6 +1031,17 @@ void IPARPi::prepareISP(const ISPConfig &data)
}
/*
+ * AGC wants to know the algorithm status from the time it actioned the
+ * sensor exposure/gain changes. So fetch it from the metadata list
+ * indexed by the IPA cookie returned, and put it in the current frame
+ * metadata.
+ */
+ AgcStatus agcStatus;
+ RPiController::Metadata &delayedMetadata = rpiMetadata_[data.delayContext];
+ if (!delayedMetadata.get<AgcStatus>("agc.status", agcStatus))
+ rpiMetadata.set("agc.delayed_status", agcStatus);
+
+ /*
* This may overwrite the DeviceStatus using values from the sensor
* metadata, and may also do additional custom processing.
*/