From b608984e78824f8738a089136721b1fe54016248 Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Mon, 14 Feb 2022 17:51:36 +0800 Subject: ipa: ipu3: af: Auto focus for dw9719 Surface Go2 VCM Since VCM for surface Go 2 (dw9719) had been successfully driven, this Af module can be used to control the VCM and determine the focus value based on the IPU3 AF state. Based on the values from the IPU3 AF buffer, the variance of each focus step is determined and a greedy approach is used to find the maximum variance of the AF state and an appropriate focus value. The grid configuration is implemented as a context. Also, the grid parameter- AF_MIN_BLOCK_WIDTH is set to 4 (default is 3) since if the default value is used, x_start (x_start > 640) will be at an incorrect location of the image (rightmost of the sensor). Signed-off-by: Kate Hsuan Tested-by: Jean-Michel Hautbois Reviewed-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- src/ipa/ipu3/ipa_context.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/ipa/ipu3/ipa_context.cpp') diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp index 9c4ec936..1b59c918 100644 --- a/src/ipa/ipu3/ipa_context.cpp +++ b/src/ipa/ipu3/ipa_context.cpp @@ -69,6 +69,29 @@ namespace libcamera::ipa::ipu3 { * \brief Number of cells on one line including the ImgU padding */ +/** + * \var IPASessionConfiguration::af + * \brief AF grid configuration of the IPA + * + * \var IPASessionConfiguration::af.afGrid + * \brief AF scene grid configuration. + */ + +/** + * \var IPAFrameContext::af + * \brief Context for the Automatic Focus algorithm + * + * \struct IPAFrameContext::af + * \var IPAFrameContext::af.focus + * \brief Current position of the lens + * + * \var IPAFrameContext::af.maxVariance + * \brief The maximum variance of the current image. + * + * \var IPAFrameContext::af.stable + * \brief It is set to true, if the best focus is found. + */ + /** * \var IPASessionConfiguration::agc * \brief AGC parameters configuration of the IPA -- cgit v1.2.1