[v3,07/19] libipa: agc_mean_luminance: Fix constraint logging
diff mbox series

Message ID 20250815102945.1602071-8-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 debug log statements in constraintClampGain() are after the
assignment of gain. So they correctly log when the constraint applies,
but the gain values logged are the same. Fix that.

Fixes: 42e18c96bcb7 ("libipa: agc_mean_luminance: Add debug logging")
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

---

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

Comments

Dan Scally Aug. 15, 2025, 10:46 a.m. UTC | #1
Hi Stefan

On 15/08/2025 11:29, Stefan Klug wrote:
> The debug log statements in constraintClampGain() are after the
> assignment of gain. So they correctly log when the constraint applies,
> but the gain values logged are the same. Fix that.
> 
> Fixes: 42e18c96bcb7 ("libipa: agc_mean_luminance: Add debug logging")
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> 

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

> ---
> 
> Changes in v3:
> - Added this patch
> ---
>   src/ipa/libipa/agc_mean_luminance.cpp | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
> index ff96a381ffce..fce1a5064870 100644
> --- a/src/ipa/libipa/agc_mean_luminance.cpp
> +++ b/src/ipa/libipa/agc_mean_luminance.cpp
> @@ -488,18 +488,18 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
>   
>   		if (constraint.bound == AgcConstraint::Bound::Lower &&
>   		    newGain > gain) {
> -			gain = newGain;
>   			LOG(AgcMeanLuminance, Debug)
>   				<< "Apply lower bound: " << gain << " to "
>   				<< newGain;
> +			gain = newGain;
>   		}
>   
>   		if (constraint.bound == AgcConstraint::Bound::Upper &&
>   		    newGain < gain) {
> -			gain = newGain;
>   			LOG(AgcMeanLuminance, Debug)
>   				<< "Apply upper bound: " << gain << " to "
>   				<< newGain;
> +			gain = newGain;
>   		}
>   	}
>
Kieran Bingham Aug. 15, 2025, 11:01 a.m. UTC | #2
Quoting Stefan Klug (2025-08-15 11:29:27)
> The debug log statements in constraintClampGain() are after the
> assignment of gain. So they correctly log when the constraint applies,
> but the gain values logged are the same. Fix that.
> 
> Fixes: 42e18c96bcb7 ("libipa: agc_mean_luminance: Add debug logging")
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> 

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
> 
> Changes in v3:
> - Added this patch
> ---
>  src/ipa/libipa/agc_mean_luminance.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
> index ff96a381ffce..fce1a5064870 100644
> --- a/src/ipa/libipa/agc_mean_luminance.cpp
> +++ b/src/ipa/libipa/agc_mean_luminance.cpp
> @@ -488,18 +488,18 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
>  
>                 if (constraint.bound == AgcConstraint::Bound::Lower &&
>                     newGain > gain) {
> -                       gain = newGain;
>                         LOG(AgcMeanLuminance, Debug)
>                                 << "Apply lower bound: " << gain << " to "
>                                 << newGain;
> +                       gain = newGain;
>                 }
>  
>                 if (constraint.bound == AgcConstraint::Bound::Upper &&
>                     newGain < gain) {
> -                       gain = newGain;
>                         LOG(AgcMeanLuminance, Debug)
>                                 << "Apply upper bound: " << gain << " to "
>                                 << newGain;
> +                       gain = newGain;
>                 }
>         }
>  
> -- 
> 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 ff96a381ffce..fce1a5064870 100644
--- a/src/ipa/libipa/agc_mean_luminance.cpp
+++ b/src/ipa/libipa/agc_mean_luminance.cpp
@@ -488,18 +488,18 @@  double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
 
 		if (constraint.bound == AgcConstraint::Bound::Lower &&
 		    newGain > gain) {
-			gain = newGain;
 			LOG(AgcMeanLuminance, Debug)
 				<< "Apply lower bound: " << gain << " to "
 				<< newGain;
+			gain = newGain;
 		}
 
 		if (constraint.bound == AgcConstraint::Bound::Upper &&
 		    newGain < gain) {
-			gain = newGain;
 			LOG(AgcMeanLuminance, Debug)
 				<< "Apply upper bound: " << gain << " to "
 				<< newGain;
+			gain = newGain;
 		}
 	}