From patchwork Thu May 2 13:30:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 19982 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 32622BDE6B for ; Thu, 2 May 2024 13:31:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C1E5963420; Thu, 2 May 2024 15:31:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rc1OtWAB"; 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 54064633EB for ; Thu, 2 May 2024 15:31:14 +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 8FB67552; Thu, 2 May 2024 15:30:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1714656616; bh=nlTwzAI2D1DEwATSLTQTwHsnKc2sEQcJNqXjUi7cKuY=; h=From:To:Cc:Subject:Date:From; b=rc1OtWAB8fuepehwz6O1K5ylhMM4yqxdL9Y8qE9B5aMJ7ZXr2gQOJU5R/xb2z5Yjd SZ54+iyj7JDvfZjHZy3zKn+0ra4VcKV45sfakJG1XBbGpeuWzZ433Xni9g9lAERLjs 1UH+2gR4YlOSDbuo3bJa53fVrjWKoKFXtuZCoAUw= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally Subject: [PATCH v4 0/8] Centralise Agc into libipa Date: Thu, 2 May 2024 14:30:38 +0100 Message-Id: <20240502133046.1976565-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 4 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 AgcMeanLuminance base class ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance ipa: ipu3: Remove bespoke AGC functions from IPU3 ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance 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 | 282 ++++-------- 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 | 577 ++++++++++++++++++++++++ src/ipa/libipa/agc_mean_luminance.h | 96 ++++ src/ipa/libipa/exposure_mode_helper.cpp | 246 ++++++++++ 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 | 274 +++-------- 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, 1200 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