From patchwork Fri Sep 19 09:40:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24426 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 93192C328C for ; Fri, 19 Sep 2025 09:41:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E6F836B5F1; Fri, 19 Sep 2025 11:41:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="R2pG337H"; 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 DDA0E6B59A for ; Fri, 19 Sep 2025 11:41:43 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4d54:eab8:98ca:163b]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id AF555842; Fri, 19 Sep 2025 11:40:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1758274823; bh=Hf8pcymcjtAho++wmGoIxgQhaksSfOG8IgrUvraKMos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R2pG337HyQSLGZflAmzw2gKv+UbQ+WVCD4ArMWoYwOBgu5YSfQImzJKgdG5fxUtkz 8jsOMsE0Nz0WSAHJ81a6FqcF8YQwedqGUhP9fuYwdqmyt8ab7EqI0SumxGpiW7DjTT aT+NFGs2dK/T3e0nrfM6rK+m7CgHRvJauqIOmZCU= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Daniel Scally , Paul Elder Subject: [PATCH v5 17/19] rkisp1: agc: Agc add yTarget to frame context Date: Fri, 19 Sep 2025 11:40:32 +0200 Message-ID: <20250919094041.183031-18-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250919094041.183031-1-stefan.klug@ideasonboard.com> References: <20250919094041.183031-1-stefan.klug@ideasonboard.com> 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" The upcoming WDR algorithm needs access to the effective yTarget value for its calculations. Add it to the frame context. Signed-off-by: Stefan Klug Reviewed-by: Daniel Scally Reviewed-by: Paul Elder --- Changes in v4: - Collected tags --- src/ipa/rkisp1/algorithms/agc.cpp | 5 +++++ src/ipa/rkisp1/ipa_context.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index d1b6bb7196f4..046a1ac9caa2 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -208,6 +208,8 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo) context.configuration.sensor.minAnalogueGain, context.configuration.sensor.maxAnalogueGain, {}); + context.activeState.agc.automatic.yTarget = effectiveYTarget(); + resetFrameCount(); return 0; @@ -375,6 +377,8 @@ void Agc::prepare(IPAContext &context, const uint32_t frame, frameContext.compress.gain = frameContext.agc.quantizationGain; } + frameContext.agc.yTarget = context.activeState.agc.automatic.yTarget; + if (frame > 0 && !frameContext.agc.updateMetering) return; @@ -627,6 +631,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, activeState.agc.automatic.exposure = newExposureTime / lineDuration; activeState.agc.automatic.gain = aGain; activeState.agc.automatic.quantizationGain = qGain; + activeState.agc.automatic.yTarget = effectiveYTarget(); /* * Expand the target frame duration so that we do not run faster than * the minimum frame duration when we have short exposures. diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h index 67427c01ac68..113b90428008 100644 --- a/src/ipa/rkisp1/ipa_context.h +++ b/src/ipa/rkisp1/ipa_context.h @@ -83,6 +83,7 @@ struct IPAActiveState { uint32_t exposure; double gain; double quantizationGain; + double yTarget; } automatic; bool autoExposureEnabled; @@ -139,6 +140,7 @@ struct IPAFrameContext : public FrameContext { double exposureValue; double quantizationGain; uint32_t vblank; + double yTarget; bool autoExposureEnabled; bool autoGainEnabled; controls::AeConstraintModeEnum constraintMode;