From patchwork Wed Nov 19 13:22:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 25080 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 D9390BD80A for ; Wed, 19 Nov 2025 13:22:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C398160A80; Wed, 19 Nov 2025 14:22:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Q2jEj8yg"; 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 EEE5A606A0 for ; Wed, 19 Nov 2025 14:22:25 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:5419:7bb:83a3:3d7a]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 263B2EB7; Wed, 19 Nov 2025 14:20:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1763558421; bh=EUFF+5Tt1WLXRFmfh6tmFJEPZXiSzTLfnbjhaxha52Y=; h=From:To:Cc:Subject:Date:From; b=Q2jEj8yg3a6atBx2In9zgozaPVZve4OObr3Lu2NB2QoKlYCZdz2wbC4qIaqoUXLIw NGOgIZYja5TsKZKVCOwgaTngmb/e7yb0TMgezKNzgDvWIH1I2Dkycqz6xZbd03cScu iQZUoi6ghcFjlfK+XKLf59zdRvDbX2WzvOtmumDA= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 0/4] libipa: agc: Fix constraints yTarget handling and add PWL support Date: Wed, 19 Nov 2025 14:22:09 +0100 Message-ID: <20251119132221.2088013-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.51.0 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" Hi all, This series introduces support for specifying the relativeLuminanceTarget based on the current lux level by using a PWL for the mapping. The typical use case is to ensure that images in a bright environment are regulated a tad brighter than images taken in a dark environment. This is a very subjective setting and should therefore be left to the user/camera designer. Mainlining this feature was already tried in [1] but got rejected at that time because there was no direct user of it. Meanwhile the lux algorithm got upstreamed and we have users that actually miss that feature. So I start another try of upstreaming it (patch 3). During implementation it turned out that the yTarget of AGC constraints never worked at all. So patche 4 fixes that and also adds PWL support for the constraints which is sensible to do if we support it for the relativeLuminanceTarget. Changes in v3: - Added patch 2 to fix the lux algorith and make it more future proof - Added back support for tuning files without relativeLuminanceTarget. - Improves "no lux level" warning handling Changes in v2: - Dropped patch 1 that implemented Pwl::swap() as the intended use can already be achieved using the autogenerated move assignment operator and move constructor together with std::move() - Dropped the addition of a initializer_list based constructor to Pwl as this can be achieved in a bit more verbose way already. - Added patch 1 that extends the yaml PWL reading code to support plain values. This also simplified the subsequent patches. Best regards, Stefan Stefan Klug (4): ipa: libipa: pwl: Allow to parse a plain yaml value as single point PWL ipa: rkisp1: lux: Properly handle frame context and active state ipa: libipa: agc_mean_luminance: Change luminance target to piecewise linear function ipa: libipa: agc_mean_luminance: Fix yTarget handling in constraints src/ipa/libipa/agc_mean_luminance.cpp | 108 +++++++++++++++++++++----- src/ipa/libipa/agc_mean_luminance.h | 18 +++-- src/ipa/libipa/pwl.cpp | 9 +++ src/ipa/rkisp1/algorithms/agc.cpp | 1 + src/ipa/rkisp1/algorithms/lux.cpp | 23 ++++-- src/ipa/rkisp1/algorithms/lux.h | 3 + src/ipa/rkisp1/algorithms/wdr.cpp | 3 +- src/ipa/rkisp1/ipa_context.h | 4 + 8 files changed, 139 insertions(+), 30 deletions(-)