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

Message ID 20261109161246.513264-18-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 Nov. 9, 2026, 4:12 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>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/ipa/libipa/agc.cpp | 11 +++++++++++
 src/ipa/libipa/agc.h   |  4 ++++
 2 files changed, 15 insertions(+)

Comments

Stefan Klug Nov. 9, 2026, 4:25 p.m. UTC | #1
Quoting Barnabás Pőcze (2026-11-09 17:12:44)
> 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>

My tag got lost in v8 but is still valid :-)

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

Best regards,
Stefan

> ---
>  src/ipa/libipa/agc.cpp | 11 +++++++++++
>  src/ipa/libipa/agc.h   |  4 ++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
> index bed725e185..2326de53cb 100644
> --- a/src/ipa/libipa/agc.cpp
> +++ b/src/ipa/libipa/agc.cpp
> @@ -313,6 +313,7 @@ int AgcAlgorithm::init(const ValueNode &tuningData, CameraSensorHelper *sensor,
>                 if (!agcConfig)
>                         return -EINVAL;
>  
> +               tuning_.hasExposureModes = !agcConfig->exposureModeHelpers.empty();
>                 impl_.emplace<AgcMeanLuminance>(std::move(*agcConfig));
>         } else {
>                 impl_.emplace<AgcMSV>();
> @@ -480,6 +481,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 bed725e185..2326de53cb 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -313,6 +313,7 @@  int AgcAlgorithm::init(const ValueNode &tuningData, CameraSensorHelper *sensor,
 		if (!agcConfig)
 			return -EINVAL;
 
+		tuning_.hasExposureModes = !agcConfig->exposureModeHelpers.empty();
 		impl_.emplace<AgcMeanLuminance>(std::move(*agcConfig));
 	} else {
 		impl_.emplace<AgcMSV>();
@@ -480,6 +481,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 */