@@ -34,7 +34,7 @@ namespace ipa {
* Number of frames for which to run the algorithm at full speed, before slowing
* down to prevent large and jarring changes in exposure from frame to frame.
*/
-static constexpr uint32_t kNumStartupFrames = 10;
+static constexpr uint32_t kDefaultNumStartupFrames = 10;
/*
* Default relative luminance target
@@ -144,7 +144,8 @@ static constexpr double kMaxRelativeLuminanceTarget = 0.95;
*/
AgcMeanLuminance::AgcMeanLuminance()
- : exposureCompensation_(1.0), frameCount_(0), filteredExposure_(0s),
+ : numStartupFrames_(kDefaultNumStartupFrames), regulationSpeed_(0.2),
+ exposureCompensation_(1.0), frameCount_(0), filteredExposure_(0s),
relativeLuminanceTarget_(0)
{
}
@@ -554,10 +555,10 @@ double AgcMeanLuminance::effectiveYTarget() const
*/
utils::Duration AgcMeanLuminance::filterExposure(utils::Duration exposureValue)
{
- double speed = 0.2;
+ double speed = regulationSpeed_;
/* Adapt instantly if we are in startup phase. */
- if (frameCount_ < kNumStartupFrames)
+ if (frameCount_ < numStartupFrames_)
speed = 1.0;
/*
@@ -649,6 +650,22 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex,
* their configure() function.
*/
+/**
+ * \var AgcMeanLuminance::numStartupFrames_
+ * \brief The number of startup frames
+ *
+ * During this number of frames after startup, the regulation is very aggressive
+ * to reach the target value within one or two cycles.
+ *
+ * \var AgcMeanLuminance::regulationSpeed_
+ * The regulation speed. This controls the speed at which new target values are
+ * applied. The new target value is calculated as:
+ *
+ * \code{.unparsed}
+ * value = target * speed + oldValue * (1.0 - speed)
+ * \endcode
+ */
+
} /* namespace ipa */
} /* namespace libcamera */
@@ -42,6 +42,7 @@ public:
double yTarget;
};
+protected:
void configure(utils::Duration lineDuration, const CameraSensorHelper *sensorHelper);
int parseTuningData(const YamlObject &tuningData);
@@ -79,6 +80,9 @@ public:
frameCount_ = 0;
}
+ uint32_t numStartupFrames_;
+ double regulationSpeed_;
+
private:
virtual double estimateLuminance(const double gain) const = 0;
The rkisp1 has now a good synchronization between sensor settings/isp params and stats. It can therefore benefit from a faster regulation. To do that without breaking others IPAs that use AgcMeanLuminance, move regulation speed and startup frames into member variables that can be set at runtime. As this requires the introduction of a protected access modifier. This was added, so that most of the previously public functions are now also protected, because public visibility is not needed. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- src/ipa/libipa/agc_mean_luminance.cpp | 25 +++++++++++++++++++++---- src/ipa/libipa/agc_mean_luminance.h | 4 ++++ 2 files changed, 25 insertions(+), 4 deletions(-)