From patchwork Thu Sep 23 08:16:13 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: 13891 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 E2800BF01C for ; Thu, 23 Sep 2021 08:16:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9C82D69193; Thu, 23 Sep 2021 10:16:31 +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="CWmmqfrt"; 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 4B1EE687DC for ; Thu, 23 Sep 2021 10:16:30 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:392e:dcd2:2bf6:d61c]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D69F445E; Thu, 23 Sep 2021 10:16:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1632384989; bh=BVFLUwmi6o4ZLqd+YKANQY1a6VSVgNUnyB/3GAoZzpM=; h=From:To:Cc:Subject:Date:From; b=CWmmqfrt5ZymCWKuqkFCv2tqG8RRBUk58Dx9VaGBBI8JVuegAgmtzdGYiDRFD8nwl eLERou6xEwgsvv6om4Aj1nqEpzR9EmZDI9jV8Bh06B3pnbo6BR/EqB2/+KRtdSeU9y JwSKeAUkBicirVWWoNrLYCcPnR6sMBHEjK2K8rbw= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Thu, 23 Sep 2021 10:16:13 +0200 Message-Id: <20210923081625.60276-1-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 00/12] Improve ImgU statistics usage 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 everybody ! Here is a series, solving quite a few issues and clarifying most of the ImgU statistics format. The first part has already been sent before and was titled "Move and improve AWB structures" and those did not change since the latest v8 of it: - Patch 1/12 moves the AWB structures to be able to use those from the ipa::ipu3::algorithms namespace (by AGC at least). - Patch 2/12 renames the stats region structure to make it clear it is an accumulator structure. - Patch 3/12 is improving the Accumulator structure to have the same layout as the IPAFrameContext::awb structure. - Patch 4/12 is now only focusing on AWB name usage. We worked, together with Laurent (thanks !) on the AWB grid limits, and ImgU statistics format. There was differences between public API [0] and the kernel doc which needed clarifications (who is correct ?). After quite a few investigations, we discovered a bug in the kernel, for low resolutions [1] and this leads to patches 5/12 and 6/12, the latest reusing the proposal from Laurent in "ipa: ipu3: Split width and height loops in calculateBdsGrid()" but adapting it to the limit names. Next patches are here to solve bugs in AWB by configuring the proportion of unsaturated zones (7/12), using the right gain multipliers (8/12) and taking care of padding in the AWB loop (9/12). As we are improving AWB, I cherry-picked patch 10/12 from another branch already proposed before to use the black level correction in the ImgU with default values (probably good enough for now). Next, as AGC is using the AWB statistics for its algorithm, rewrite the loop to simplify it and take care of padding too (11/12). And we can finally move the Ipu3AwbCell out from the Awb class, to use it with the (yet to be in v2) patch from the kernel [2]. [0] https://chromium.googlesource.com/chromiumos/platform/arc-camera/+/refs/heads/master/hal/intel/include/ia_imaging/awb_public.h [1] https://lore.kernel.org/linux-media/20210916172504.677919-1-jeanmichel.hautbois@ideasonboard.com/ [2] https://lore.kernel.org/linux-media/20210831185140.77400-1-jeanmichel.hautbois@ideasonboard.com/ Jean-Michel Hautbois (12): ipa: ipu3: Move the AWB stats structures ipa: ipu3: Rename IspStatsRegion to Accumulator ipa: ipu3: Change Accumulator structure layout ipa: ipu3: awb: Make the naming consistent ipa: ipu3: Change the limits of the AWB stats ipa: ipu3: Change limits and split loops in calculateBdsGrid() ipa: ipu3: awb: Correct the relevant zones proportion ipa: ipu3: awb: Correct the gain multipliers ipa: ipu3: awb: Use the line stride for the stats ipa: ipu3: awb: Introduce Black Level Correction ipa: ipu3: agc: Rewrite and simplify the brightness loop ipa: ipu3: Replace ipa::ipu3::algorithms::Ipu3AwbCell include/linux/intel-ipu3.h | 28 ++++- src/ipa/ipu3/algorithms/agc.cpp | 52 +++----- src/ipa/ipu3/algorithms/agc.h | 2 + src/ipa/ipu3/algorithms/awb.cpp | 204 +++++++++++++++++++------------- src/ipa/ipu3/algorithms/awb.h | 42 +++---- src/ipa/ipu3/ipu3.cpp | 70 ++++++----- 6 files changed, 228 insertions(+), 170 deletions(-)