From patchwork Mon Oct 14 15:47:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 21621 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 8D6F4C32F4 for ; Mon, 14 Oct 2024 15:47:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 425FF6537E; Mon, 14 Oct 2024 17:47:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BJEdn5HW"; 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 94D1465369 for ; Mon, 14 Oct 2024 17:47:51 +0200 (CEST) Received: from Monstersaurus.lgs-net.com (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7EDFB96C; Mon, 14 Oct 2024 17:46:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728920770; bh=l7aBtW6B8/jw4kmSGSQUraVQF3wy1M4OCs95YqoDPH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJEdn5HWjCEoS32sheKb0pnBBjUtK2sey12M1gLWRmdz+xf4mJqX3eKeB00mCYra0 g22C93vGlk3CM5aR7HPgwxOs2IlFzEoip/OnTVfuYpzxwT+26H9T5sIDMDLNII/gII sOW1ucqQ6OjxrEkrtZ+4PzPsaf/7E2Xp+L2AzOkQ= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits controls Date: Mon, 14 Oct 2024 16:47:45 +0100 Message-Id: <20241014154747.2295253-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241014154747.2295253-1-kieran.bingham@ideasonboard.com> References: <20241014154747.2295253-1-kieran.bingham@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 IPA calculates and reports the FrameDurationLimits to applications by configuring the ControlInfo accordingly during IPARkISP1::updateControls() We later need to know these limits during Agc::configure() for initialising the ActiveState of the AGC implementation with the limits. Store the FrameDurationLimits ControlInfo in the ControlInfoMap which is now present in the IPAContext so that it is commonly available for the AGC algorithm, removing the 'todo' accordingly. Signed-off-by: Kieran Bingham Reviewed-by: Umang Jain Reviewed-by: Daniel Scally Reviewed-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/ipa/rkisp1/algorithms/agc.cpp | 9 +++------ src/ipa/rkisp1/rkisp1.cpp | 5 ++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 17d074d9c03e..33f902862c4a 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -178,12 +178,9 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo) context.activeState.agc.meteringMode = static_cast(meteringModes_.begin()->first); - /* - * \todo This should probably come from FrameDurationLimits instead, - * except it's computed in the IPA and not here so we'd have to - * recompute it. - */ - context.activeState.agc.maxFrameDuration = context.configuration.sensor.maxShutterSpeed; + /* Limit the frame duration to match current initialisation */ + ControlInfo &frameDurationLimits = context.ctrlMap[&controls::FrameDurationLimits]; + context.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get()); /* * Define the measurement window for AGC as a centered rectangle diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 9e161cabdea4..47777ece783f 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -432,9 +432,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo, frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); } - ctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0], - frameDurations[1], - frameDurations[2]); + context_.ctrlMap[&controls::FrameDurationLimits] = + ControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]); ctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end()); *ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);