From patchwork Wed Apr 17 13:15:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 19892 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 00E48C3213 for ; Wed, 17 Apr 2024 13:15:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0749963362; Wed, 17 Apr 2024 15:15:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jkFXDKiF"; 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 5721361B54 for ; Wed, 17 Apr 2024 15:15:55 +0200 (CEST) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 24F0363F; Wed, 17 Apr 2024 15:15:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713359708; bh=+6pULuwZ55CRph587RNOErHCvT9jGHOAdzV62aRhEl8=; h=From:To:Cc:Subject:Date:From; b=jkFXDKiFL4ZcZFTx4jk9F2F/yLfMafUA24oG7CYh2dJUq37pM8jNW/mPlOrL1gMc/ WrICvZ7KNKpNijlpwq64jlKL+8Cq39O11W4pQHSLUD7fZ7d4PXQPpLXSARcFDxoQOj Bz+txJkSvHLITdTa9Eskaq+vYsXzsULeQ8wr5MFs= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally Subject: [PATCH v2 0/8] Centralise Agc into libipa Date: Wed, 17 Apr 2024 14:15:28 +0100 Message-Id: <20240417131536.484129-1-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 all Version 2 of the centralised AGC series. As before the series **does** alter the calculated shutter time and gain for both the IPU3 and RkISP1 compared to their bespoke implementations, for two reasons: 1. A bug in the way they were implemented meant that an over-exposed image was corrected more slowly than an under-exposed one. This is fixed and will improve both IPAs' response to a too-bright image. 2. The default kRelativeLuminanceTarget is centrally set to 0.16 which matches the value from the IPU3 implementation. In the RkISP1 implementation that value was set to 0.4 with a \todo to see why they were different. Without those two changes, the shutter time and gain calculated after this series matches those calculated by their independent implementations. The second point still requires some discussion I believe; it could be that the different mechanisms through which we estimate luminance (which are enforced by the different statistics we get from the hardware) means we can't have a single target and need to have one for each algorithm...or perhaps I'm missing something. Thanks Dan Daniel Scally (7): ipa: libipa: Allow creation of empty Histogram libcamera: controls: Generate enum value-name maps ipa: libipa: Add MeanLuminanceAgc base class ipa: ipu3: Derive ipu3::algorithms::Agc from MeanLuminanceAgc ipa: ipu3: Remove bespoke AGC functions from IPU3 ipa: rkisp1: Derive rkisp1::algorithms::Agc from MeanLuminanceAgc ipa: rkisp1: Remove bespoke Agc functions Paul Elder (1): ipa: libipa: Add ExposureModeHelper include/libcamera/control_ids.h.in | 2 + include/libcamera/property_ids.h.in | 2 + src/ipa/ipu3/algorithms/agc.cpp | 283 ++++-------- src/ipa/ipu3/algorithms/agc.h | 27 +- src/ipa/ipu3/ipa_context.cpp | 3 + src/ipa/ipu3/ipa_context.h | 5 + src/ipa/ipu3/ipu3.cpp | 3 +- src/ipa/libipa/agc_mean_luminance.cpp | 581 ++++++++++++++++++++++++ src/ipa/libipa/agc_mean_luminance.h | 91 ++++ src/ipa/libipa/exposure_mode_helper.cpp | 257 +++++++++++ src/ipa/libipa/exposure_mode_helper.h | 53 +++ src/ipa/libipa/histogram.cpp | 9 + src/ipa/libipa/histogram.h | 1 + src/ipa/libipa/meson.build | 4 + src/ipa/rkisp1/algorithms/agc.cpp | 275 +++-------- src/ipa/rkisp1/algorithms/agc.h | 16 +- src/ipa/rkisp1/ipa_context.h | 5 + src/ipa/rkisp1/rkisp1.cpp | 3 +- utils/gen-controls.py | 19 + 19 files changed, 1212 insertions(+), 427 deletions(-) create mode 100644 src/ipa/libipa/agc_mean_luminance.cpp create mode 100644 src/ipa/libipa/agc_mean_luminance.h create mode 100644 src/ipa/libipa/exposure_mode_helper.cpp create mode 100644 src/ipa/libipa/exposure_mode_helper.h