[v3,15/19] libipa: agc_mean_luminance: Introduce effectiveYTarget() accessor
diff mbox series

Message ID 20250815102945.1602071-16-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Implement WDR algorithm
Related show

Commit Message

Stefan Klug Aug. 15, 2025, 10:29 a.m. UTC
The upcoming WDR algorithm needs to know the effective y target (Which
includes the current ExposureValue). Add a accessor for that.

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

---

Changes in v3:
- Added this patch
---
 src/ipa/libipa/agc_mean_luminance.cpp | 16 ++++++++++++++--
 src/ipa/libipa/agc_mean_luminance.h   |  2 ++
 2 files changed, 16 insertions(+), 2 deletions(-)

Comments

Dan Scally Aug. 18, 2025, 7:56 a.m. UTC | #1
Morning Stefan

On 15/08/2025 11:29, Stefan Klug wrote:
> The upcoming WDR algorithm needs to know the effective y target (Which
> includes the current ExposureValue). Add a accessor for that.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> 
> ---

Looks ok:

Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>

> 
> Changes in v3:
> - Added this patch
> ---
>   src/ipa/libipa/agc_mean_luminance.cpp | 16 ++++++++++++++--
>   src/ipa/libipa/agc_mean_luminance.h   |  2 ++
>   2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
> index 6c7cf0038b16..2bfafe9b2d02 100644
> --- a/src/ipa/libipa/agc_mean_luminance.cpp
> +++ b/src/ipa/libipa/agc_mean_luminance.cpp
> @@ -458,8 +458,7 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,
>    */
>   double AgcMeanLuminance::estimateInitialGain() const
>   {
> -	double yTarget = std::min(relativeLuminanceTarget_ * exposureCompensation_,
> -				  kMaxRelativeLuminanceTarget);
> +	double yTarget = effectiveYTarget();
>   	double yGain = 1.0;
>   
>   	/*
> @@ -521,6 +520,19 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
>   	return gain;
>   }
>   
> +/**
> + * \brief Get the currently effective y target
> + *
> + * This function return the current y target including exposure compensation.
> + *
> + * \return The y target value
> + */
> +double AgcMeanLuminance::effectiveYTarget() const
> +{
> +	return std::min(relativeLuminanceTarget_ * exposureCompensation_,
> +			kMaxRelativeLuminanceTarget);
> +}
> +
>   /**
>    * \brief Apply a filter on the exposure value to limit the speed of changes
>    * \param[in] exposureValue The target exposure from the AGC algorithm
> diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h
> index fbb526f6ae8e..950b7b893754 100644
> --- a/src/ipa/libipa/agc_mean_luminance.h
> +++ b/src/ipa/libipa/agc_mean_luminance.h
> @@ -72,6 +72,8 @@ public:
>   	calculateNewEv(uint32_t constraintModeIndex, uint32_t exposureModeIndex,
>   		       const Histogram &yHist, utils::Duration effectiveExposureValue);
>   
> +	double effectiveYTarget() const;
> +
>   	void resetFrameCount()
>   	{
>   		frameCount_ = 0;
Paul Elder Sept. 5, 2025, 10:42 a.m. UTC | #2
Quoting Stefan Klug (2025-08-15 19:29:35)
> The upcoming WDR algorithm needs to know the effective y target (Which
> includes the current ExposureValue). Add a accessor for that.

s/a /an /

> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> 
> ---
> 
> Changes in v3:
> - Added this patch
> ---
>  src/ipa/libipa/agc_mean_luminance.cpp | 16 ++++++++++++++--
>  src/ipa/libipa/agc_mean_luminance.h   |  2 ++
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
> index 6c7cf0038b16..2bfafe9b2d02 100644
> --- a/src/ipa/libipa/agc_mean_luminance.cpp
> +++ b/src/ipa/libipa/agc_mean_luminance.cpp
> @@ -458,8 +458,7 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,
>   */
>  double AgcMeanLuminance::estimateInitialGain() const
>  {
> -       double yTarget = std::min(relativeLuminanceTarget_ * exposureCompensation_,
> -                                 kMaxRelativeLuminanceTarget);
> +       double yTarget = effectiveYTarget();
>         double yGain = 1.0;
>  
>         /*
> @@ -521,6 +520,19 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
>         return gain;
>  }
>  
> +/**
> + * \brief Get the currently effective y target
> + *
> + * This function return the current y target including exposure compensation.

s/return/returns/

Reviewed-by: Paul ELder <paul.elder@ideasonboard.com>

> + *
> + * \return The y target value
> + */
> +double AgcMeanLuminance::effectiveYTarget() const
> +{
> +       return std::min(relativeLuminanceTarget_ * exposureCompensation_,
> +                       kMaxRelativeLuminanceTarget);
> +}
> +
>  /**
>   * \brief Apply a filter on the exposure value to limit the speed of changes
>   * \param[in] exposureValue The target exposure from the AGC algorithm
> diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h
> index fbb526f6ae8e..950b7b893754 100644
> --- a/src/ipa/libipa/agc_mean_luminance.h
> +++ b/src/ipa/libipa/agc_mean_luminance.h
> @@ -72,6 +72,8 @@ public:
>         calculateNewEv(uint32_t constraintModeIndex, uint32_t exposureModeIndex,
>                        const Histogram &yHist, utils::Duration effectiveExposureValue);
>  
> +       double effectiveYTarget() const;
> +
>         void resetFrameCount()
>         {
>                 frameCount_ = 0;
> -- 
> 2.48.1
>

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
index 6c7cf0038b16..2bfafe9b2d02 100644
--- a/src/ipa/libipa/agc_mean_luminance.cpp
+++ b/src/ipa/libipa/agc_mean_luminance.cpp
@@ -458,8 +458,7 @@  void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,
  */
 double AgcMeanLuminance::estimateInitialGain() const
 {
-	double yTarget = std::min(relativeLuminanceTarget_ * exposureCompensation_,
-				  kMaxRelativeLuminanceTarget);
+	double yTarget = effectiveYTarget();
 	double yGain = 1.0;
 
 	/*
@@ -521,6 +520,19 @@  double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
 	return gain;
 }
 
+/**
+ * \brief Get the currently effective y target
+ *
+ * This function return the current y target including exposure compensation.
+ *
+ * \return The y target value
+ */
+double AgcMeanLuminance::effectiveYTarget() const
+{
+	return std::min(relativeLuminanceTarget_ * exposureCompensation_,
+			kMaxRelativeLuminanceTarget);
+}
+
 /**
  * \brief Apply a filter on the exposure value to limit the speed of changes
  * \param[in] exposureValue The target exposure from the AGC algorithm
diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h
index fbb526f6ae8e..950b7b893754 100644
--- a/src/ipa/libipa/agc_mean_luminance.h
+++ b/src/ipa/libipa/agc_mean_luminance.h
@@ -72,6 +72,8 @@  public:
 	calculateNewEv(uint32_t constraintModeIndex, uint32_t exposureModeIndex,
 		       const Histogram &yHist, utils::Duration effectiveExposureValue);
 
+	double effectiveYTarget() const;
+
 	void resetFrameCount()
 	{
 		frameCount_ = 0;