From patchwork Fri Oct 22 07:32:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 14236 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 527BABF415 for ; Fri, 22 Oct 2021 07:32:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1858968F62; Fri, 22 Oct 2021 09:32:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="B/lQ3OA6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 41B3360128 for ; Fri, 22 Oct 2021 09:32:54 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:22cc:3af6:5ccb:8367]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C37DD51D; Fri, 22 Oct 2021 09:32:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634887973; bh=3JDNiRlG7kW16Xoaxo9IKKpVWcjDA7twkJUuks0VxHU=; h=From:To:Cc:Subject:Date:From; b=B/lQ3OA6lhAlV2c23qFXP30zDhB6knt0m6KM2orKF5PI0yMJ9FG7z+yVp4CwB2SUH QDnExHasXmXS1lDK6SUH87w2HT/fPSjQIPBDCr35LwQv03ltlcOc6925kcrk6a8mSI pDXUTYw1by/JSOaqTbfN6Lzu0/zLqQB0sFd7actw= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Fri, 22 Oct 2021 09:32:35 +0200 Message-Id: <20211022073249.35084-1-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 00/14] ipa: ipu3: Fix AGC bugs X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello, I did not know how to title this series, so I have decided to make it appealing somehow . There will probably be another patch series on top to remove all the exposure in a number of lines and use only time values in AGC, and it should include the usage of VBLANK too, as we are now limiting the exposure time to the current VBLANK and not modifying it at all. Changes: v4: - Change variable names as asked in v2 for patch 3/14 (saturation under 90%) - Adress comments in some patches - Correct a bug in "[12/14] ipa: ipu3: agc: Refactor condition on exposure correction" and reword the LOG message instead of removing it. v3: - Patch 11/13 => keep the test on the small exposure/gain change - split simplification of the division for exposure/gains with a separat patch to apply filtered values first - mostly comments adressed v2: - using a structure in IPASessionConfiguration to store the sensor limits and pass those to the AGC - most of the corrections asked are applied, including the nicer division between exposure and gain proposal from Laurent - the analogue gain set in the driver might be off the limits we would expect (minimum of 0 or more than 16 for instance) so it is clamped. There are multiple things here. First, we want to use the saturation ratio included in the AWB statistics. To make it relevant, we need to set a threshold to decide what is a saturated cell (patch 1/14) and use this ratio to avoid including too much saturated cells in the Grey World computation (3/14). While debugging it, it appeared we are not setting the frameContext variables before IPAIPU3::start() is called, while we are setting controls in it which use the frameContext (2/14). We have a small patch 4/14 which is here to lower the limit under which we are not calculating the red and blue gains for white balance. Then, from patch 5/14 to 14/14 it is multiple fixes like renaming variables, changing the way the exposure and gains are calculated, etc. All of those should make the algorithm easier to follow, and the documentation should be added on top of that, in the coming shortly v2 of "Document IPU3 IPA". Jean-Michel Hautbois (14): ipa: ipu3: awb: Set a threshold for the green saturation ipa: ipu3: set frameContext before controls ipa: ipu3: awb: Use saturation under 90% ipa: ipu3: awb: Change minimal green threshold value ipa: ipu3: agc: Rename exposure values properly ipa: ipu3: agc: Change exposure limits ipa: ipu3: agc: Change analogue gain limits ipa: ipu3: agc: Use filtered exposure values ipa: ipu3: agc: Simplify division of exposure/gain ipa: ipu3: agc: Rename gains properly ipa: ipu3: agc: Introduce previous exposure value ipa: ipu3: agc: Refactor condition on exposure correction ipa: ipu3: agc: Remove unused variables ipa: ipu3: Use sensor limits for analogue gain src/ipa/ipu3/algorithms/agc.cpp | 152 ++++++++++++++++++-------------- src/ipa/ipu3/algorithms/agc.h | 11 ++- src/ipa/ipu3/algorithms/awb.cpp | 64 ++++++++++++-- src/ipa/ipu3/algorithms/awb.h | 1 + src/ipa/ipu3/ipa_context.h | 9 ++ src/ipa/ipu3/ipu3.cpp | 64 ++++++++++++-- 6 files changed, 213 insertions(+), 88 deletions(-)