[v7,18/19] ipa: libipa: agc: Do not run slower than 15fps by default
diff mbox series

Message ID 20261109094954.341480-19-barnabas.pocze@ideasonboard.com
State Superseded
Headers show
Series
  • ipa: libipa: agc: Take exposure margin into account
Related show

Commit Message

Barnabás Pőcze Nov. 9, 2026, 9:49 a.m. UTC
If the tuning file defines no exposure modes, then the "Maximize" mode will
be implicitly instantiated and used. But in this case, do not let the camera
run slower than 15fps, by default, unless the user explicitly requests it
using `FrameDurationLimits`.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/ipa/libipa/agc.cpp | 12 ++++++++++++
 src/ipa/libipa/agc.h   |  4 ++++
 2 files changed, 16 insertions(+)

Comments

Stefan Klug Nov. 9, 2026, 12:36 p.m. UTC | #1
Hi Barnabás,

Quoting Barnabás Pőcze (2026-11-09 10:49:53)
> If the tuning file defines no exposure modes, then the "Maximize" mode will
> be implicitly instantiated and used. But in this case, do not let the camera
> run slower than 15fps, by default, unless the user explicitly requests it
> using `FrameDurationLimits`.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>

Best regards,
Stefan

> ---
>  src/ipa/libipa/agc.cpp | 12 ++++++++++++
>  src/ipa/libipa/agc.h   |  4 ++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
> index 94d3ffa42d..017e4d42fe 100644
> --- a/src/ipa/libipa/agc.cpp
> +++ b/src/ipa/libipa/agc.cpp
> @@ -615,6 +615,8 @@ int AgcAlgorithm::init(const ValueNode &tuningData, CameraSensorHelper *sensor,
>                 if (ret)
>                         return ret;
>  
> +               tuning_.hasExposureModes = !agcConfig.exposureModeHelpers.empty();
> +
>                 addFallbacks(agcConfig);
>  
>                 impl_.emplace<AgcMeanLuminance>(std::move(agcConfig));
> @@ -784,6 +786,16 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
>                 state.minFrameDuration = std::clamp(
>                         utils::Duration(1.0s / 30),
>                         session.minFrameDuration, session.maxFrameDuration);
> +
> +               if (!tuning_.hasExposureModes) {
> +                       /*
> +                        * By default do not run slower than 15fps
> +                        * if no exposure modes are defined.
> +                        */
> +                       state.maxFrameDuration = std::clamp(
> +                               utils::Duration(1.0s / 15),
> +                               state.minFrameDuration, session.maxFrameDuration);
> +               }
>         }
>  
>         /* \todo Move this to the `Camera` class. */
> diff --git a/src/ipa/libipa/agc.h b/src/ipa/libipa/agc.h
> index 3ca36aea64..d8057720d0 100644
> --- a/src/ipa/libipa/agc.h
> +++ b/src/ipa/libipa/agc.h
> @@ -163,6 +163,10 @@ private:
>  
>         std::variant<AgcMSV, AgcMeanLuminance> impl_;
>         CameraSensorHelper *sensor_ = nullptr;
> +
> +       struct {
> +               bool hasExposureModes = false;
> +       } tuning_;
>  };
>  
>  } /* namespace ipa */
> -- 
> 2.56.0
>

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index 94d3ffa42d..017e4d42fe 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -615,6 +615,8 @@  int AgcAlgorithm::init(const ValueNode &tuningData, CameraSensorHelper *sensor,
 		if (ret)
 			return ret;
 
+		tuning_.hasExposureModes = !agcConfig.exposureModeHelpers.empty();
+
 		addFallbacks(agcConfig);
 
 		impl_.emplace<AgcMeanLuminance>(std::move(agcConfig));
@@ -784,6 +786,16 @@  int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
 		state.minFrameDuration = std::clamp(
 			utils::Duration(1.0s / 30),
 			session.minFrameDuration, session.maxFrameDuration);
+
+		if (!tuning_.hasExposureModes) {
+			/*
+			 * By default do not run slower than 15fps
+			 * if no exposure modes are defined.
+			 */
+			state.maxFrameDuration = std::clamp(
+				utils::Duration(1.0s / 15),
+				state.minFrameDuration, session.maxFrameDuration);
+		}
 	}
 
 	/* \todo Move this to the `Camera` class. */
diff --git a/src/ipa/libipa/agc.h b/src/ipa/libipa/agc.h
index 3ca36aea64..d8057720d0 100644
--- a/src/ipa/libipa/agc.h
+++ b/src/ipa/libipa/agc.h
@@ -163,6 +163,10 @@  private:
 
 	std::variant<AgcMSV, AgcMeanLuminance> impl_;
 	CameraSensorHelper *sensor_ = nullptr;
+
+	struct {
+		bool hasExposureModes = false;
+	} tuning_;
 };
 
 } /* namespace ipa */