[v2,4/9] libipa: agc_mean_luminance: Add debug logging
diff mbox series

Message ID 20250411123641.2144530-5-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Wdr preparations
Related show

Commit Message

Stefan Klug April 11, 2025, 12:36 p.m. UTC
When debugging the AEGC it is important to know when the constraints
apply. As this is important information for anyone doing tuning file
optimization, add it upstream.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>

---

Changes in v2:
- Collected tags
---
 src/ipa/libipa/agc_mean_luminance.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Paul Elder May 11, 2025, 7:12 p.m. UTC | #1
Quoting Stefan Klug (2025-04-11 14:36:32)
> When debugging the AEGC it is important to know when the constraints
> apply. As this is important information for anyone doing tuning file
> optimization, add it upstream.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>

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

> 
> ---
> 
> Changes in v2:
> - Collected tags
> ---
>  src/ipa/libipa/agc_mean_luminance.cpp | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
> index f617fde81101..9154f083a510 100644
> --- a/src/ipa/libipa/agc_mean_luminance.cpp
> +++ b/src/ipa/libipa/agc_mean_luminance.cpp
> @@ -468,12 +468,16 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
>                                  hist.interQuantileMean(constraint.qLo, constraint.qHi);
>  
>                 if (constraint.bound == AgcConstraint::Bound::Lower &&
> -                   newGain > gain)
> +                   newGain > gain) {
>                         gain = newGain;
> +                       LOG(AgcMeanLuminance, Debug) << "Apply lower bound: " << gain << " to " << newGain;
> +               }
>  
>                 if (constraint.bound == AgcConstraint::Bound::Upper &&
> -                   newGain < gain)
> +                   newGain < gain) {
>                         gain = newGain;
> +                       LOG(AgcMeanLuminance, Debug) << "Apply upper bound: " << gain << " to " << newGain;
> +               }
>         }
>  
>         return gain;
> -- 
> 2.43.0
>
Laurent Pinchart May 11, 2025, 10:24 p.m. UTC | #2
Hi Stefan,

Thank you for the patch.

On Fri, Apr 11, 2025 at 02:36:32PM +0200, Stefan Klug wrote:
> When debugging the AEGC it is important to know when the constraints
> apply. As this is important information for anyone doing tuning file
> optimization, add it upstream.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> 
> ---
> 
> Changes in v2:
> - Collected tags
> ---
>  src/ipa/libipa/agc_mean_luminance.cpp | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
> index f617fde81101..9154f083a510 100644
> --- a/src/ipa/libipa/agc_mean_luminance.cpp
> +++ b/src/ipa/libipa/agc_mean_luminance.cpp
> @@ -468,12 +468,16 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
>  				 hist.interQuantileMean(constraint.qLo, constraint.qHi);
>  
>  		if (constraint.bound == AgcConstraint::Bound::Lower &&
> -		    newGain > gain)
> +		    newGain > gain) {
>  			gain = newGain;
> +			LOG(AgcMeanLuminance, Debug) << "Apply lower bound: " << gain << " to " << newGain;

			LOG(AgcMeanLuminance, Debug)
				<< "Apply lower bound: " << gain << " to "
				<< newGain;

The same comment applies to the upper bound.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +		}
>  
>  		if (constraint.bound == AgcConstraint::Bound::Upper &&
> -		    newGain < gain)
> +		    newGain < gain) {
>  			gain = newGain;
> +			LOG(AgcMeanLuminance, Debug) << "Apply upper bound: " << gain << " to " << newGain;
> +		}
>  	}
>  
>  	return gain;

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
index f617fde81101..9154f083a510 100644
--- a/src/ipa/libipa/agc_mean_luminance.cpp
+++ b/src/ipa/libipa/agc_mean_luminance.cpp
@@ -468,12 +468,16 @@  double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
 				 hist.interQuantileMean(constraint.qLo, constraint.qHi);
 
 		if (constraint.bound == AgcConstraint::Bound::Lower &&
-		    newGain > gain)
+		    newGain > gain) {
 			gain = newGain;
+			LOG(AgcMeanLuminance, Debug) << "Apply lower bound: " << gain << " to " << newGain;
+		}
 
 		if (constraint.bound == AgcConstraint::Bound::Upper &&
-		    newGain < gain)
+		    newGain < gain) {
 			gain = newGain;
+			LOG(AgcMeanLuminance, Debug) << "Apply upper bound: " << gain << " to " << newGain;
+		}
 	}
 
 	return gain;