@@ -39,6 +39,17 @@ LOG_DEFINE_CATEGORY(RkISP1Agc)
* \brief A mean-based auto-exposure algorithm
*/
+namespace {
+
+/*
+ * The maximum digital gain that the compress algorithm can supply. This is
+ * a workaround as we don't have support for inter-algorithm dependencies.
+ * \todo Implement using proper dependencies
+ */
+constexpr double kAgcMaxDigitalGain = 64.0;
+
+} /* namespace */
+
int Agc::parseMeteringModes(IPAContext &context, const ValueNode &tuningData)
{
if (!tuningData.isDictionary())
@@ -167,6 +178,16 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)
.sensorControls = context.sensorControls,
.ctrlMap = context.ctrlMap,
.autoAllowed = !context.configuration.raw,
+ /*
+ * \todo The Compress algo must come after Agc in the tuning
+ * file to pick up the digital gain in prepare(). But as it is
+ * after Agc we can't query
+ * context.configuration.compress.supported here as the Compress
+ * algo is not configured yet. Therefore enable digital gain
+ * unconditionally for now. It won't effectively be enabled if
+ * the tuning file doesn't contain a maxDigitalGain > 1.
+ */
+ .maxDigitalGain = kAgcMaxDigitalGain
});
if (ret)
return ret;
@@ -213,7 +234,7 @@ void Agc::prepare(IPAContext &context, const uint32_t frame,
if (context.configuration.compress.supported) {
frameContext.compress.enable = true;
- frameContext.compress.gain = frameContext.agc.quantizationGain;
+ frameContext.compress.gain = frameContext.agc.quantizationGain * frameContext.agc.digitalGain;
}
if (frame > 0 && !frameContext.agc.updateMetering)
Add digital gain support by using the compress modules to apply gain. Note: the Compress module must be placed *after* the Agc module in the tuning file for this to work correctly. Eventually this constraint should be modeled in code. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- src/ipa/rkisp1/algorithms/agc.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)