From f8f07f9468c6618b73710e3d341ce59ce08ccc08 Mon Sep 17 00:00:00 2001 From: Jean-Michel Hautbois Date: Thu, 4 Nov 2021 10:58:07 +0100 Subject: ipa: ipu3: agc: Improve gain calculation When an image is partially saturated, its brightness is not increasing linearly when the shutter time or gain increases. It is a big issue with a backlight as the algorithm is fading to darkness right now. Introduce a function to estimate the brightness of the frame, based on the current exposure/gain and loop on it several times to estimate it again and approach the non linear function. Inspired-by: 7de5506c30b3 ("libcamera: src: ipa: raspberrypi: agc: Improve gain update calculation for partly saturated images") Signed-off-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder Reviewed-by: Umang Jain --- src/ipa/ipu3/algorithms/agc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ipa/ipu3/algorithms/agc.h') diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h index 99c60d46..8f99dab9 100644 --- a/src/ipa/ipu3/algorithms/agc.h +++ b/src/ipa/ipu3/algorithms/agc.h @@ -34,7 +34,11 @@ private: void measureBrightness(const ipu3_uapi_stats_3a *stats, const ipu3_uapi_grid_config &grid); void filterExposure(); - void computeExposure(IPAFrameContext &frameContext); + void computeExposure(IPAFrameContext &frameContext, double currentYGain); + double computeInitialY(IPAFrameContext &frameContext, + const ipu3_uapi_grid_config &grid, + const ipu3_uapi_stats_3a *stats, + double currentYGain); uint64_t frameCount_; -- cgit v1.2.1