summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-11-04 16:43:28 +0100
committerJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-11-15 11:00:05 +0100
commit93af8ea616d318c3c2790f739081044ae285359a (patch)
tree9073b69beaac9d5682825db711956041d8d3a83f /src
parentf8f07f9468c6618b73710e3d341ce59ce08ccc08 (diff)
ipa: ipu3: agc: Update previous exposure value
Previously, the exposure value was calculated based on the estimated shutter time and gain applied. Now that we have the real values for the current frame, use those before estimating the next one and rename the variable accordingly. As the exposure value is updated in the beginning of the computation, there is no need to initialize effectiveExposureValue anymore in the configure call, and it can be a local variable and not a class variable anymore. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/ipa/ipu3/algorithms/agc.cpp26
-rw-r--r--src/ipa/ipu3/algorithms/agc.h1
2 files changed, 9 insertions, 18 deletions
diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index 2a482107..db76d6ef 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -80,8 +80,7 @@ static constexpr double kNormalizedLumaTarget = 0.16;
Agc::Agc()
: frameCount_(0), iqMean_(0.0), lineDuration_(0s), minExposureLines_(0),
- maxExposureLines_(0), filteredExposure_(0s), currentExposure_(0s),
- prevExposureValue_(0s)
+ maxExposureLines_(0), filteredExposure_(0s), currentExposure_(0s)
{
}
@@ -112,10 +111,6 @@ int Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)
context.frameContext.agc.gain = minAnalogueGain_;
context.frameContext.agc.exposure = minExposureLines_;
- prevExposureValue_ = context.frameContext.agc.gain
- * context.frameContext.agc.exposure
- * lineDuration_;
-
return 0;
}
@@ -224,6 +219,13 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double currentYGain)
/* Calculate the shutter time in seconds */
utils::Duration currentShutter = exposure * lineDuration_;
+
+ /*
+ * Update the exposure value for the next computation using the values
+ * of exposure and gain really used by the sensor.
+ */
+ utils::Duration effectiveExposureValue = currentShutter * analogueGain;
+
LOG(IPU3Agc, Debug) << "Actual total exposure " << currentShutter * analogueGain
<< " Shutter speed " << currentShutter
<< " Gain " << analogueGain
@@ -233,7 +235,7 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double currentYGain)
* Calculate the current exposure value for the scene as the latest
* exposure value applied multiplied by the new estimated gain.
*/
- currentExposure_ = prevExposureValue_ * evGain;
+ currentExposure_ = effectiveExposureValue * evGain;
utils::Duration minShutterSpeed = minExposureLines_ * lineDuration_;
utils::Duration maxShutterSpeed = maxExposureLines_ * lineDuration_;
@@ -265,16 +267,6 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double currentYGain)
/* Update the estimated exposure and gain. */
frameContext.agc.exposure = shutterTime / lineDuration_;
frameContext.agc.gain = stepGain;
-
- /*
- * Update the exposure value for the next process call.
- *
- * \todo Obtain the values of the exposure time and analog gain
- * that were actually used by the sensor, either from embedded
- * data when available, or from the delayed controls
- * infrastructure in case a slow down caused a mismatch.
- */
- prevExposureValue_ = shutterTime * analogueGain;
}
/**
diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h
index 8f99dab9..17a5d1d9 100644
--- a/src/ipa/ipu3/algorithms/agc.h
+++ b/src/ipa/ipu3/algorithms/agc.h
@@ -53,7 +53,6 @@ private:
utils::Duration filteredExposure_;
utils::Duration currentExposure_;
- utils::Duration prevExposureValue_;
uint32_t stride_;
};