libcamera: software_isp: Add AGC disable control

Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
Vasiliy Doylov 2025-03-16 22:12:10 +03:00
parent 9613459d30
commit 9f2edfa764
Signed by: NekoCWD
GPG key ID: B7BE22D44474A582
2 changed files with 13 additions and 0 deletions

View file

@ -44,6 +44,7 @@ Agc::Agc()
int Agc::init(IPAContext &context,
[[maybe_unused]] const YamlObject &tuningData)
{
context.ctrlMap[&controls::AeEnable] = ControlInfo(false, true, true);
context.ctrlMap[&controls::Brightness] = ControlInfo(0.0f, 2.0f, 1.0f);
return 0;
}
@ -52,6 +53,7 @@ int Agc::configure(IPAContext &context,
[[maybe_unused]] const IPAConfigInfo &configInfo)
{
context.activeState.knobs.brightness = std::optional<double>();
context.activeState.knobs.ae_enabled = std::optional<bool>();
return 0;
}
@ -62,10 +64,15 @@ void Agc::queueRequest(typename Module::Context &context,
const ControlList &controls)
{
const auto &brightness = controls.get(controls::Brightness);
const auto &ae_enabled = controls.get(controls::AeEnable);
if (brightness.has_value()) {
context.activeState.knobs.brightness = brightness;
LOG(IPASoftExposure, Debug) << "Setting brightness to " << brightness.value();
}
if (ae_enabled.has_value()) {
context.activeState.knobs.ae_enabled = ae_enabled;
LOG(IPASoftExposure, Debug) << "Setting ae_enable to " << ae_enabled.value();
}
}
void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, double exposureMSV)
@ -132,6 +139,10 @@ void Agc::process(IPAContext &context,
const SwIspStats *stats,
ControlList &metadata)
{
const auto ae_enable = context.activeState.knobs.ae_enabled.value_or(true);
if (!ae_enable)
return;
utils::Duration exposureTime =
context.configuration.agc.lineDuration * frameContext.sensor.exposure;
metadata.set(controls::ExposureTime, exposureTime.get<std::micro>());

View file

@ -66,6 +66,8 @@ struct IPAActiveState {
std::optional<float> saturation;
/* 0..2 range, 1.0 = normal */
std::optional<double> brightness;
/* 0..1 range, 1 = normal */
std::optional<bool> ae_enabled;
} knobs;
};