[v5,23/24] ipa: libipa: agc: Do not run slower than 15fps by default
diff mbox series

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

Commit Message

Barnabás Pőcze Oct. 29, 2026, 12:58 p.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>
---
 src/ipa/libipa/agc.cpp | 12 ++++++++++++
 src/ipa/libipa/agc.h   |  4 ++++
 2 files changed, 16 insertions(+)

Comments

Jacopo Mondi Oct. 29, 2026, 3:55 p.m. UTC | #1
Hi Barnabás

On Thu, Oct 29, 2026 at 01:58:43PM +0100, Barnabás Pőcze wrote:
> 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>
> ---
>  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 775dc12002..60e8614777 100644
> --- a/src/ipa/libipa/agc.cpp
> +++ b/src/ipa/libipa/agc.cpp
> @@ -564,6 +564,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));
> @@ -733,6 +735,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_;

A struct for a single field might not be necessary, but not a big deal

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

>  };
>
>  } /* namespace ipa */
> --
> 2.56.0
>

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index 775dc12002..60e8614777 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -564,6 +564,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));
@@ -733,6 +735,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 */