[libcamera-devel] [PATCH v3 08/14] ipa: ipu3: agc: Use filtered exposure values

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Oct 21 23:02:21 CEST 2021


Quoting Jean-Michel Hautbois (2021-10-21 17:43:55)
> We are filtering the exposure value to limit the gain to apply, but we
> are not using the result.
> 
> Fix it.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois at ideasonboard.com>


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

> ---
>  src/ipa/ipu3/algorithms/agc.cpp | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
> index 984aed53..f5bb3328 100644
> --- a/src/ipa/ipu3/algorithms/agc.cpp
> +++ b/src/ipa/ipu3/algorithms/agc.cpp
> @@ -158,17 +158,17 @@ void Agc::lockExposureGain(uint32_t &exposure, double &gain)
>  
>                 utils::Duration newExposure = 0.0s;
>                 if (currentShutter < maxShutterSpeed) {
> -                       exposure = std::clamp<uint32_t>(exposure * currentExposure_ / currentExposureNoDg_,
> +                       exposure = std::clamp<uint32_t>(exposure * filteredExposure_ / currentExposureNoDg_,
>                                                         minExposureLines_,
>                                                         maxExposureLines_);
> -                       newExposure = currentExposure_ / exposure;
> -                       gain = std::clamp(gain * currentExposure_ / newExposure,
> +                       newExposure = filteredExposure_ / exposure;
> +                       gain = std::clamp(gain * filteredExposure_ / newExposure,
>                                           kMinGain, kMaxGain);
>                 } else {
> -                       gain = std::clamp(gain * currentExposure_ / currentExposureNoDg_,
> +                       gain = std::clamp(gain * filteredExposure_ / currentExposureNoDg_,
>                                           kMinGain, kMaxGain);
> -                       newExposure = currentExposure_ / gain;
> -                       exposure = std::clamp<uint32_t>(exposure * currentExposure_ / newExposure,
> +                       newExposure = filteredExposure_ / gain;
> +                       exposure = std::clamp<uint32_t>(exposure * filteredExposure_ / newExposure,
>                                                         minExposureLines_,
>                                                         maxExposureLines_);
>                 }
> -- 
> 2.32.0
>


More information about the libcamera-devel mailing list