[v5,27/47] ipa: libipa: agc: Store digital gain
diff mbox series

Message ID 20260817114349.994123-28-barnabas.pocze@ideasonboard.com
State Superseded
Headers show
Series
  • ipa: libipa: agc rework
Related show

Commit Message

Barnabás Pőcze Aug. 17, 2026, 11:43 a.m. UTC
While digital gain support is not implemented yet, start by storing
the suggested digital gain in the active state.

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

Comments

Stefan Klug Aug. 20, 2026, 10:32 a.m. UTC | #1
Hi Barnabás,

Quoting Barnabás Pőcze (2026-08-17 13:43:28)
> While digital gain support is not implemented yet, start by storing
> the suggested digital gain in the active state.
> 
> 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 | 7 ++++++-
>  src/ipa/libipa/agc.h   | 1 +
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
> index ea7e095b0d..41c9949f54 100644
> --- a/src/ipa/libipa/agc.cpp
> +++ b/src/ipa/libipa/agc.cpp
> @@ -129,6 +129,9 @@ namespace agc {
>   * \var agc::ActiveState::automatic.quantizationGain
>   * \brief Automatic quantization gain multiplier
>   *
> + * \var agc::ActiveState::automatic.digitalGain
> + * \brief Automatic digital gain multiplier
> + *
>   * \var agc::ActiveState::automatic.yTarget
>   * \brief Automatically determined luminance target
>   *
> @@ -355,6 +358,7 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
>         state.automatic.gain = session.minAnalogueGain;
>         state.automatic.exposure = defExposure;
>         state.automatic.quantizationGain = 1;
> +       state.automatic.digitalGain = 1;
>         state.automatic.yTarget = impl_.effectiveYTarget(0, 1);
>         state.manual.gain = state.automatic.gain;
>         state.manual.exposure = state.automatic.exposure;
> @@ -633,13 +637,14 @@ void AgcAlgorithm::process(const agc::Session &session, agc::ActiveState &state,
>         state.automatic.exposure = newEv.exposureTime / lineDuration;
>         state.automatic.gain = newEv.analogueGain;
>         state.automatic.quantizationGain = newEv.quantizationGain;
> +       state.automatic.digitalGain = newEv.digitalGain;
>         state.automatic.yTarget = newEv.yTarget;
>  
>         LOG(Agc, Debug)
>                 << "exposure-time:" << newEv.exposureTime
>                 << " analogue-gain:" << state.automatic.gain
>                 << " quantization-gain:" << state.automatic.quantizationGain
> -               << " digital-gain:" << newEv.digitalGain;
> +               << " digital-gain:" << state.automatic.digitalGain;
>  
>         /*
>          * Expand the target frame duration so that we do not run faster than
> diff --git a/src/ipa/libipa/agc.h b/src/ipa/libipa/agc.h
> index 66aa0eacb0..612ac539da 100644
> --- a/src/ipa/libipa/agc.h
> +++ b/src/ipa/libipa/agc.h
> @@ -52,6 +52,7 @@ struct ActiveState {
>                 uint32_t exposure;
>                 double gain;
>                 double quantizationGain;
> +               double digitalGain;
>                 double yTarget;
>         } automatic;
>  
> -- 
> 2.55.0
>

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index ea7e095b0d..41c9949f54 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -129,6 +129,9 @@  namespace agc {
  * \var agc::ActiveState::automatic.quantizationGain
  * \brief Automatic quantization gain multiplier
  *
+ * \var agc::ActiveState::automatic.digitalGain
+ * \brief Automatic digital gain multiplier
+ *
  * \var agc::ActiveState::automatic.yTarget
  * \brief Automatically determined luminance target
  *
@@ -355,6 +358,7 @@  int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
 	state.automatic.gain = session.minAnalogueGain;
 	state.automatic.exposure = defExposure;
 	state.automatic.quantizationGain = 1;
+	state.automatic.digitalGain = 1;
 	state.automatic.yTarget = impl_.effectiveYTarget(0, 1);
 	state.manual.gain = state.automatic.gain;
 	state.manual.exposure = state.automatic.exposure;
@@ -633,13 +637,14 @@  void AgcAlgorithm::process(const agc::Session &session, agc::ActiveState &state,
 	state.automatic.exposure = newEv.exposureTime / lineDuration;
 	state.automatic.gain = newEv.analogueGain;
 	state.automatic.quantizationGain = newEv.quantizationGain;
+	state.automatic.digitalGain = newEv.digitalGain;
 	state.automatic.yTarget = newEv.yTarget;
 
 	LOG(Agc, Debug)
 		<< "exposure-time:" << newEv.exposureTime
 		<< " analogue-gain:" << state.automatic.gain
 		<< " quantization-gain:" << state.automatic.quantizationGain
-		<< " digital-gain:" << newEv.digitalGain;
+		<< " digital-gain:" << state.automatic.digitalGain;
 
 	/*
 	 * Expand the target frame duration so that we do not run faster than
diff --git a/src/ipa/libipa/agc.h b/src/ipa/libipa/agc.h
index 66aa0eacb0..612ac539da 100644
--- a/src/ipa/libipa/agc.h
+++ b/src/ipa/libipa/agc.h
@@ -52,6 +52,7 @@  struct ActiveState {
 		uint32_t exposure;
 		double gain;
 		double quantizationGain;
+		double digitalGain;
 		double yTarget;
 	} automatic;