@@ -400,16 +400,27 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, cons
if (session.autoAllowed) {
config.ctrlMap[&controls::ExposureValue] = ControlInfo(-8.0f, 8.0f, 0.0f);
- for (const auto &[id, info] : impl_.controls())
- config.ctrlMap[id] = info;
+ {
+ std::vector<ControlValue> options;
+ for (const auto &[id, _] : impl_.constraintModes())
+ options.emplace_back(id);
+
+ config.ctrlMap[&controls::AeConstraintMode] = ControlInfo(options);
+ }
+
+ {
+ std::vector<ControlValue> options;
+ for (const auto &[id, _] : impl_.exposureModeHelpers())
+ options.emplace_back(id);
+
+ config.ctrlMap[&controls::AeExposureMode] = ControlInfo(options);
+ }
} else {
config.ctrlMap.erase(&controls::ExposureValue);
-
- for (const auto &[id, info] : impl_.controls())
- config.ctrlMap.erase(id);
+ config.ctrlMap.erase(&controls::AeConstraintMode);
+ config.ctrlMap.erase(&controls::AeExposureMode);
}
-
return 0;
}
@@ -237,8 +237,6 @@ int AgcMeanLuminance::parseConstraint(const ValueNode &modeDict, int32_t id)
int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)
{
- std::vector<ControlValue> availableConstraintModes;
-
const ValueNode &constraintModes = tuningData[controls::AeConstraintMode.name()];
if (constraintModes.isDictionary()) {
for (const auto &[modeName, modeDict] : constraintModes.asDict()) {
@@ -258,8 +256,6 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)
int ret = parseConstraint(modeDict, it->second);
if (ret)
return ret;
-
- availableConstraintModes.push_back(it->second);
}
}
@@ -278,18 +274,13 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)
};
constraintModes_[controls::ConstraintNormal].push_back(std::move(constraint));
- availableConstraintModes.push_back(controls::ConstraintNormal);
}
- controls_[&controls::AeConstraintMode] = ControlInfo(availableConstraintModes);
-
return 0;
}
int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)
{
- std::vector<ControlValue> availableExposureModes;
-
const ValueNode &exposureModes = tuningData[controls::AeExposureMode.name()];
if (exposureModes.isDictionary()) {
for (const auto &[modeName, modeValues] : exposureModes.asDict()) {
@@ -332,7 +323,6 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)
}
exposureModeHelpers_.try_emplace(it->second, stages);
- availableExposureModes.push_back(it->second);
}
}
@@ -342,14 +332,11 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)
* in the ExposureModeHelper simply driving the exposure time as high as
* possible before touching gain.
*/
- if (availableExposureModes.empty()) {
+ if (exposureModeHelpers_.empty()) {
exposureModeHelpers_.try_emplace(controls::ExposureNormal,
Span<std::pair<utils::Duration, double>>{});
- availableExposureModes.push_back(controls::ExposureNormal);
}
- controls_[&controls::AeExposureMode] = ControlInfo(availableExposureModes);
-
return 0;
}
@@ -473,11 +460,6 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,
* \brief Get the ExposureModeHelpers that have been parsed from tuning data
*/
-/**
- * \fn AgcMeanLuminance::controls()
- * \brief Get the controls that have been generated after parsing tuning data
- */
-
/**
* \brief Estimate the initial gain needed to achieve a relative luminance
* target
@@ -13,8 +13,6 @@
#include <libcamera/base/utils.h>
-#include <libcamera/controls.h>
-
#include "libcamera/internal/value_node.h"
#include "exposure_mode_helper.h"
@@ -63,11 +61,6 @@ public:
return exposureModeHelpers_;
}
- ControlInfoMap::Map controls()
- {
- return controls_;
- }
-
struct Params {
const Traits &traits;
const Histogram &yHist;
@@ -108,7 +101,6 @@ private:
std::vector<AgcConstraint> additionalConstraints_;
std::map<int32_t, std::vector<AgcConstraint>> constraintModes_;
std::map<int32_t, ExposureModeHelper> exposureModeHelpers_;
- ControlInfoMap::Map controls_;
};
} /* namespace ipa */
The `AgcMeanLuminance` type does not do any actual control handling, so let's remove the `ControlInfoMap::Map` member, and let the user handle that using the `constraintModes()` / `exposureModeHelpers()` getters. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/ipa/libipa/agc.cpp | 23 +++++++++++++++++------ src/ipa/libipa/agc_mean_luminance.cpp | 20 +------------------- src/ipa/libipa/agc_mean_luminance.h | 8 -------- 3 files changed, 18 insertions(+), 33 deletions(-)