From patchwork Wed Apr 24 12:49:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 19936 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 DE59DC3200 for ; Wed, 24 Apr 2024 12:49:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 75297633FC; Wed, 24 Apr 2024 14:49:37 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HSrILq13"; 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 AA3B161B43 for ; Wed, 24 Apr 2024 14:49:34 +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 7F6596B3; Wed, 24 Apr 2024 14:48:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713962922; bh=ZUNZl5UhDsY5KSxEosO1H8saHQVKNagcGpOlAkq4i7w=; h=From:To:Cc:Subject:Date:From; b=HSrILq13qOJWT0mgWuKRhm7iBpzN2GnrzovVqT15ibwqFb4fcVnk+OyN2q3vCrOHP 9UaloD2mjR3WXQ2MXVwk5OeIJIW15U6oSN189rt2j+4+wT1pej9G4E1HZDhIcI4d1P qkJT7yMzD9nfAttNeLKNMYyIq+wPzbBR9f1ZRWxQ= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally Subject: [PATCH v3 0/8] Centralise Agc into libipa Date: Wed, 24 Apr 2024 13:49:09 +0100 Message-Id: <20240424124917.1250837-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 3 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 | 590 ++++++++++++++++++++++++ src/ipa/libipa/agc_mean_luminance.h | 90 ++++ 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, 1207 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