| Message ID | 20261026132045.269007-21-barnabas.pocze@ideasonboard.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
Hi Barnabás On Mon, Oct 26, 2026 at 02:20:42PM +0100, Barnabás Pőcze wrote: > Move the setup of common controls to the end of `configure()`, so > that it happens after everything has been configured and calculated. Makes sense > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Thanks j > --- > src/ipa/libipa/agc.cpp | 82 +++++++++++++++++++++--------------------- > 1 file changed, 41 insertions(+), 41 deletions(-) > > diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp > index d52d798f8f..cf2ae19737 100644 > --- a/src/ipa/libipa/agc.cpp > +++ b/src/ipa/libipa/agc.cpp > @@ -686,47 +686,6 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, > config.ctrlMap.erase(&controls::AeConstraintMode); > config.ctrlMap.erase(&controls::AeExposureMode); > > - /* \todo Move this to the `Camera` class. */ > - config.ctrlMap[&controls::AeEnable] = ControlInfo{ > - false, session.autoAllowed, session.autoAllowed > - }; > - config.ctrlMap[&controls::AnalogueGain] = ControlInfo{ > - minGain, maxGain, defGain > - }; > - config.ctrlMap[&controls::ExposureTime] = ControlInfo{ > - static_cast<int32_t>(minExposure * lineDurationUs), > - static_cast<int32_t>(maxExposure * lineDurationUs), > - static_cast<int32_t>(defExposure * lineDurationUs), > - }; > - config.ctrlMap[&controls::FrameDurationLimits] = ControlInfo{ > - static_cast<int64_t>(session.minFrameDuration.get<std::micro>()), > - static_cast<int64_t>(session.maxFrameDuration.get<std::micro>()), > - std::span<const int64_t, 2>{ { > - static_cast<int64_t>(state.minFrameDuration.get<std::micro>()), > - static_cast<int64_t>(state.maxFrameDuration.get<std::micro>()), > - } }, > - }; > - > - const auto add = [&](const ControlId &cid, const auto &automatic, const auto &manual) { > - std::array<ControlValue, 2> values; > - size_t count = 0; > - > - if (session.autoAllowed) > - values[count++] = ControlValue(automatic); > - > - values[count++] = ControlValue(manual); > - > - config.ctrlMap[&cid] = ControlInfo{ > - { values.data(), count }, > - ControlValue(session.autoAllowed ? automatic : manual), > - }; > - }; > - > - add(controls::ExposureTimeMode, > - controls::ExposureTimeModeAuto, controls::ExposureTimeModeManual); > - add(controls::AnalogueGainMode, > - controls::AnalogueGainModeAuto, controls::AnalogueGainModeManual); > - > std::visit(utils::overloaded{ > [&](AgcMSV &) { > /* No constraint mode support. */ > @@ -773,6 +732,47 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, > }, > }, impl_); > > + /* \todo Move this to the `Camera` class. */ > + config.ctrlMap[&controls::AeEnable] = ControlInfo{ > + false, session.autoAllowed, session.autoAllowed > + }; > + config.ctrlMap[&controls::AnalogueGain] = ControlInfo{ > + minGain, maxGain, defGain > + }; > + config.ctrlMap[&controls::ExposureTime] = ControlInfo{ > + static_cast<int32_t>(minExposure * lineDurationUs), > + static_cast<int32_t>(maxExposure * lineDurationUs), > + static_cast<int32_t>(defExposure * lineDurationUs), > + }; > + config.ctrlMap[&controls::FrameDurationLimits] = ControlInfo{ > + static_cast<int64_t>(session.minFrameDuration.get<std::micro>()), > + static_cast<int64_t>(session.maxFrameDuration.get<std::micro>()), > + std::span<const int64_t, 2>{ { > + static_cast<int64_t>(state.minFrameDuration.get<std::micro>()), > + static_cast<int64_t>(state.maxFrameDuration.get<std::micro>()), > + } }, > + }; > + > + const auto add = [&](const ControlId &cid, const auto &automatic, const auto &manual) { > + std::array<ControlValue, 2> values; > + size_t count = 0; > + > + if (session.autoAllowed) > + values[count++] = ControlValue(automatic); > + > + values[count++] = ControlValue(manual); > + > + config.ctrlMap[&cid] = ControlInfo{ > + { values.data(), count }, > + ControlValue(session.autoAllowed ? automatic : manual), > + }; > + }; > + > + add(controls::ExposureTimeMode, > + controls::ExposureTimeModeAuto, controls::ExposureTimeModeManual); > + add(controls::AnalogueGainMode, > + controls::AnalogueGainModeAuto, controls::AnalogueGainModeManual); > + > return 0; > } > > -- > 2.56.0 >
Quoting Barnabás Pőcze (2026-10-26 13:20:42) > Move the setup of common controls to the end of `configure()`, so > that it happens after everything has been configured and calculated. Eeep, that sounds like there might have been a hidden bug in there ? Certainly helps to set things up /after/ doing the calculations as far as I can see. Though I guess as long as lineDurationUs is correct - that might be the only variable? > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > --- > src/ipa/libipa/agc.cpp | 82 +++++++++++++++++++++--------------------- > 1 file changed, 41 insertions(+), 41 deletions(-) > > diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp > index d52d798f8f..cf2ae19737 100644 > --- a/src/ipa/libipa/agc.cpp > +++ b/src/ipa/libipa/agc.cpp > @@ -686,47 +686,6 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, > config.ctrlMap.erase(&controls::AeConstraintMode); > config.ctrlMap.erase(&controls::AeExposureMode); > > - /* \todo Move this to the `Camera` class. */ > - config.ctrlMap[&controls::AeEnable] = ControlInfo{ > - false, session.autoAllowed, session.autoAllowed > - }; > - config.ctrlMap[&controls::AnalogueGain] = ControlInfo{ > - minGain, maxGain, defGain > - }; > - config.ctrlMap[&controls::ExposureTime] = ControlInfo{ > - static_cast<int32_t>(minExposure * lineDurationUs), > - static_cast<int32_t>(maxExposure * lineDurationUs), > - static_cast<int32_t>(defExposure * lineDurationUs), > - }; > - config.ctrlMap[&controls::FrameDurationLimits] = ControlInfo{ > - static_cast<int64_t>(session.minFrameDuration.get<std::micro>()), > - static_cast<int64_t>(session.maxFrameDuration.get<std::micro>()), > - std::span<const int64_t, 2>{ { > - static_cast<int64_t>(state.minFrameDuration.get<std::micro>()), > - static_cast<int64_t>(state.maxFrameDuration.get<std::micro>()), > - } }, > - }; > - > - const auto add = [&](const ControlId &cid, const auto &automatic, const auto &manual) { > - std::array<ControlValue, 2> values; > - size_t count = 0; > - > - if (session.autoAllowed) > - values[count++] = ControlValue(automatic); > - > - values[count++] = ControlValue(manual); > - > - config.ctrlMap[&cid] = ControlInfo{ > - { values.data(), count }, > - ControlValue(session.autoAllowed ? automatic : manual), > - }; > - }; > - > - add(controls::ExposureTimeMode, > - controls::ExposureTimeModeAuto, controls::ExposureTimeModeManual); > - add(controls::AnalogueGainMode, > - controls::AnalogueGainModeAuto, controls::AnalogueGainModeManual); > - > std::visit(utils::overloaded{ > [&](AgcMSV &) { > /* No constraint mode support. */ > @@ -773,6 +732,47 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, > }, > }, impl_); > > + /* \todo Move this to the `Camera` class. */ I'm not sure if this comment still applies ? But that's not because of this patch so: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > + config.ctrlMap[&controls::AeEnable] = ControlInfo{ > + false, session.autoAllowed, session.autoAllowed > + }; > + config.ctrlMap[&controls::AnalogueGain] = ControlInfo{ > + minGain, maxGain, defGain > + }; > + config.ctrlMap[&controls::ExposureTime] = ControlInfo{ > + static_cast<int32_t>(minExposure * lineDurationUs), > + static_cast<int32_t>(maxExposure * lineDurationUs), > + static_cast<int32_t>(defExposure * lineDurationUs), > + }; > + config.ctrlMap[&controls::FrameDurationLimits] = ControlInfo{ > + static_cast<int64_t>(session.minFrameDuration.get<std::micro>()), > + static_cast<int64_t>(session.maxFrameDuration.get<std::micro>()), > + std::span<const int64_t, 2>{ { > + static_cast<int64_t>(state.minFrameDuration.get<std::micro>()), > + static_cast<int64_t>(state.maxFrameDuration.get<std::micro>()), > + } }, > + }; > + > + const auto add = [&](const ControlId &cid, const auto &automatic, const auto &manual) { > + std::array<ControlValue, 2> values; > + size_t count = 0; > + > + if (session.autoAllowed) > + values[count++] = ControlValue(automatic); > + > + values[count++] = ControlValue(manual); > + > + config.ctrlMap[&cid] = ControlInfo{ > + { values.data(), count }, > + ControlValue(session.autoAllowed ? automatic : manual), > + }; > + }; > + > + add(controls::ExposureTimeMode, > + controls::ExposureTimeModeAuto, controls::ExposureTimeModeManual); > + add(controls::AnalogueGainMode, > + controls::AnalogueGainModeAuto, controls::AnalogueGainModeManual); > + > return 0; > } > > -- > 2.56.0 >
2026. 10. 27. 12:58 keltezéssel, Kieran Bingham írta: > Quoting Barnabás Pőcze (2026-10-26 13:20:42) >> Move the setup of common controls to the end of `configure()`, so >> that it happens after everything has been configured and calculated. > > Eeep, that sounds like there might have been a hidden bug in there ? > > Certainly helps to set things up /after/ doing the calculations as far > as I can see. Though I guess as long as lineDurationUs is correct - that > might be the only variable? As far as I can tell there was no bug, it is mainly motivated by the new frame duration constraint changes in the later changes, i.e. to ensure that the controls are set up after those have been calculated. > > >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> >> --- >> src/ipa/libipa/agc.cpp | 82 +++++++++++++++++++++--------------------- >> 1 file changed, 41 insertions(+), 41 deletions(-) >> >> diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp >> index d52d798f8f..cf2ae19737 100644 >> --- a/src/ipa/libipa/agc.cpp >> +++ b/src/ipa/libipa/agc.cpp >> @@ -686,47 +686,6 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, >> config.ctrlMap.erase(&controls::AeConstraintMode); >> config.ctrlMap.erase(&controls::AeExposureMode); >> >> - /* \todo Move this to the `Camera` class. */ >> - config.ctrlMap[&controls::AeEnable] = ControlInfo{ >> - false, session.autoAllowed, session.autoAllowed >> - }; >> - config.ctrlMap[&controls::AnalogueGain] = ControlInfo{ >> - minGain, maxGain, defGain >> - }; >> - config.ctrlMap[&controls::ExposureTime] = ControlInfo{ >> - static_cast<int32_t>(minExposure * lineDurationUs), >> - static_cast<int32_t>(maxExposure * lineDurationUs), >> - static_cast<int32_t>(defExposure * lineDurationUs), >> - }; >> - config.ctrlMap[&controls::FrameDurationLimits] = ControlInfo{ >> - static_cast<int64_t>(session.minFrameDuration.get<std::micro>()), >> - static_cast<int64_t>(session.maxFrameDuration.get<std::micro>()), >> - std::span<const int64_t, 2>{ { >> - static_cast<int64_t>(state.minFrameDuration.get<std::micro>()), >> - static_cast<int64_t>(state.maxFrameDuration.get<std::micro>()), >> - } }, >> - }; >> - >> - const auto add = [&](const ControlId &cid, const auto &automatic, const auto &manual) { >> - std::array<ControlValue, 2> values; >> - size_t count = 0; >> - >> - if (session.autoAllowed) >> - values[count++] = ControlValue(automatic); >> - >> - values[count++] = ControlValue(manual); >> - >> - config.ctrlMap[&cid] = ControlInfo{ >> - { values.data(), count }, >> - ControlValue(session.autoAllowed ? automatic : manual), >> - }; >> - }; >> - >> - add(controls::ExposureTimeMode, >> - controls::ExposureTimeModeAuto, controls::ExposureTimeModeManual); >> - add(controls::AnalogueGainMode, >> - controls::AnalogueGainModeAuto, controls::AnalogueGainModeManual); >> - >> std::visit(utils::overloaded{ >> [&](AgcMSV &) { >> /* No constraint mode support. */ >> @@ -773,6 +732,47 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, >> }, >> }, impl_); >> >> + /* \todo Move this to the `Camera` class. */ > > I'm not sure if this comment still applies ? I think so. > > But that's not because of this patch so: > > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > >> + config.ctrlMap[&controls::AeEnable] = ControlInfo{ >> + false, session.autoAllowed, session.autoAllowed >> + }; >> + config.ctrlMap[&controls::AnalogueGain] = ControlInfo{ >> + minGain, maxGain, defGain >> + }; >> + config.ctrlMap[&controls::ExposureTime] = ControlInfo{ >> + static_cast<int32_t>(minExposure * lineDurationUs), >> + static_cast<int32_t>(maxExposure * lineDurationUs), >> + static_cast<int32_t>(defExposure * lineDurationUs), >> + }; >> + config.ctrlMap[&controls::FrameDurationLimits] = ControlInfo{ >> + static_cast<int64_t>(session.minFrameDuration.get<std::micro>()), >> + static_cast<int64_t>(session.maxFrameDuration.get<std::micro>()), >> + std::span<const int64_t, 2>{ { >> + static_cast<int64_t>(state.minFrameDuration.get<std::micro>()), >> + static_cast<int64_t>(state.maxFrameDuration.get<std::micro>()), >> + } }, >> + }; >> + >> + const auto add = [&](const ControlId &cid, const auto &automatic, const auto &manual) { >> + std::array<ControlValue, 2> values; >> + size_t count = 0; >> + >> + if (session.autoAllowed) >> + values[count++] = ControlValue(automatic); >> + >> + values[count++] = ControlValue(manual); >> + >> + config.ctrlMap[&cid] = ControlInfo{ >> + { values.data(), count }, >> + ControlValue(session.autoAllowed ? automatic : manual), >> + }; >> + }; >> + >> + add(controls::ExposureTimeMode, >> + controls::ExposureTimeModeAuto, controls::ExposureTimeModeManual); >> + add(controls::AnalogueGainMode, >> + controls::AnalogueGainModeAuto, controls::AnalogueGainModeManual); >> + >> return 0; >> } >> >> -- >> 2.56.0 >>
diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp index d52d798f8f..cf2ae19737 100644 --- a/src/ipa/libipa/agc.cpp +++ b/src/ipa/libipa/agc.cpp @@ -686,47 +686,6 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, config.ctrlMap.erase(&controls::AeConstraintMode); config.ctrlMap.erase(&controls::AeExposureMode); - /* \todo Move this to the `Camera` class. */ - config.ctrlMap[&controls::AeEnable] = ControlInfo{ - false, session.autoAllowed, session.autoAllowed - }; - config.ctrlMap[&controls::AnalogueGain] = ControlInfo{ - minGain, maxGain, defGain - }; - config.ctrlMap[&controls::ExposureTime] = ControlInfo{ - static_cast<int32_t>(minExposure * lineDurationUs), - static_cast<int32_t>(maxExposure * lineDurationUs), - static_cast<int32_t>(defExposure * lineDurationUs), - }; - config.ctrlMap[&controls::FrameDurationLimits] = ControlInfo{ - static_cast<int64_t>(session.minFrameDuration.get<std::micro>()), - static_cast<int64_t>(session.maxFrameDuration.get<std::micro>()), - std::span<const int64_t, 2>{ { - static_cast<int64_t>(state.minFrameDuration.get<std::micro>()), - static_cast<int64_t>(state.maxFrameDuration.get<std::micro>()), - } }, - }; - - const auto add = [&](const ControlId &cid, const auto &automatic, const auto &manual) { - std::array<ControlValue, 2> values; - size_t count = 0; - - if (session.autoAllowed) - values[count++] = ControlValue(automatic); - - values[count++] = ControlValue(manual); - - config.ctrlMap[&cid] = ControlInfo{ - { values.data(), count }, - ControlValue(session.autoAllowed ? automatic : manual), - }; - }; - - add(controls::ExposureTimeMode, - controls::ExposureTimeModeAuto, controls::ExposureTimeModeManual); - add(controls::AnalogueGainMode, - controls::AnalogueGainModeAuto, controls::AnalogueGainModeManual); - std::visit(utils::overloaded{ [&](AgcMSV &) { /* No constraint mode support. */ @@ -773,6 +732,47 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, }, }, impl_); + /* \todo Move this to the `Camera` class. */ + config.ctrlMap[&controls::AeEnable] = ControlInfo{ + false, session.autoAllowed, session.autoAllowed + }; + config.ctrlMap[&controls::AnalogueGain] = ControlInfo{ + minGain, maxGain, defGain + }; + config.ctrlMap[&controls::ExposureTime] = ControlInfo{ + static_cast<int32_t>(minExposure * lineDurationUs), + static_cast<int32_t>(maxExposure * lineDurationUs), + static_cast<int32_t>(defExposure * lineDurationUs), + }; + config.ctrlMap[&controls::FrameDurationLimits] = ControlInfo{ + static_cast<int64_t>(session.minFrameDuration.get<std::micro>()), + static_cast<int64_t>(session.maxFrameDuration.get<std::micro>()), + std::span<const int64_t, 2>{ { + static_cast<int64_t>(state.minFrameDuration.get<std::micro>()), + static_cast<int64_t>(state.maxFrameDuration.get<std::micro>()), + } }, + }; + + const auto add = [&](const ControlId &cid, const auto &automatic, const auto &manual) { + std::array<ControlValue, 2> values; + size_t count = 0; + + if (session.autoAllowed) + values[count++] = ControlValue(automatic); + + values[count++] = ControlValue(manual); + + config.ctrlMap[&cid] = ControlInfo{ + { values.data(), count }, + ControlValue(session.autoAllowed ? automatic : manual), + }; + }; + + add(controls::ExposureTimeMode, + controls::ExposureTimeModeAuto, controls::ExposureTimeModeManual); + add(controls::AnalogueGainMode, + controls::AnalogueGainModeAuto, controls::AnalogueGainModeManual); + return 0; }
Move the setup of common controls to the end of `configure()`, so that it happens after everything has been configured and calculated. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/ipa/libipa/agc.cpp | 82 +++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 41 deletions(-)