@@ -489,7 +489,7 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
[&](AgcMSV &) {
/* No constraint/exposure mode support. */
state.constraintMode = controls::AeConstraintModeEnum::ConstraintNormal;
- state.exposureMode = controls::AeExposureModeEnum::ExposureNormal;
+ state.exposureMode = controls::AeExposureModeEnum::ExposureMaximize;
state.automatic.yTarget = 0; /* Not supported. */
@@ -281,11 +281,20 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)
int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)
{
+ static const std::pair<std::string_view, controls::AeExposureModeEnum> modes[] = {
+ { "ExposureNormal", controls::ExposureNormal },
+ { "ExposureShort", controls::ExposureShort },
+ { "ExposureLong", controls::ExposureLong },
+ { "ExposureCustom", controls::ExposureCustom },
+ };
+
const ValueNode &exposureModes = tuningData[controls::AeExposureMode.name()];
if (exposureModes.isDictionary()) {
for (const auto &[modeName, modeValues] : exposureModes.asDict()) {
- auto it = AeExposureModeNameValueMap.find(modeName);
- if (it == AeExposureModeNameValueMap.end()) {
+ auto it = std::find_if(std::begin(modes), std::end(modes), [&name = modeName](const auto &m) {
+ return m.first == name;
+ });
+ if (it == std::end(modes)) {
LOG(AgcMeanLuminance, Warning)
<< "Skipping unknown exposure mode '" << modeName << "'";
continue;
@@ -326,13 +335,11 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)
}
}
- /*
- * If we don't have any exposure modes in the tuning data we create an
- * ExposureModeHelper in "maximize" mode.
- */
- if (exposureModeHelpers_.empty())
- exposureModeHelpers_.try_emplace(controls::ExposureNormal,
- ExposureModeHelper::Maximize{});
+ /* These need no configuration, so they are always available. */
+ exposureModeHelpers_.try_emplace(controls::ExposureMaximize,
+ ExposureModeHelper::Maximize{});
+ exposureModeHelpers_.try_emplace(controls::ExposureMinimize,
+ ExposureModeHelper::Minimize{});
return 0;
}
@@ -188,6 +188,12 @@ controls:
- name: ExposureCustom
value: 3
description: Custom exposure mode.
+ - name: ExposureMaximize
+ value: 4
+ description: Maximize exposure time.
+ - name: ExposureMinimize
+ value: 5
+ description: Minimize exposure time.
- ExposureValue:
type: float
Add two new `AeExposureMode` enumerators: "Minimize" and "Maximize". The already existing exposure modes depend on specific configuration in tuning files. These two new modes implement very simple exposure splitting behaviour: either minimize / maximize the used exposure time. The "staged" exposure modes limit the maximum exposure / gain to those of the last stage. This means that e.g. the exposure time will not be raised even if the application would allow it by explicitly changing `FrameDurationLimits`. Short of manual AGC it is not really possible to work around that on the application side. And having to modify tuning files is inconvenient. The new "Maximize" mode is a better fit to represent how `AgcMSV` operates, so adjust the reported exposure mode if that algorithm used. And lastly, change `AgcMeanLuminance::parseTuningData()` so that it always creates exposure mode helper instances for the two new modes as they require no configuration. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/ipa/libipa/agc.cpp | 2 +- src/ipa/libipa/agc_mean_luminance.cpp | 25 ++++++++++++++++--------- src/libcamera/control_ids_core.yaml | 6 ++++++ 3 files changed, 23 insertions(+), 10 deletions(-)