From patchwork Fri Feb 21 09:20:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22815 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 EE9C2BDCC1 for ; Fri, 21 Feb 2025 09:21:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 55374686A8; Fri, 21 Feb 2025 10:21:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lSdcB1sf"; 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 6FF4B6185B for ; Fri, 21 Feb 2025 10:21:07 +0100 (CET) Received: from neptunite.hamster-moth.ts.net (unknown [IPv6:2404:7a81:160:2100:d97a:61eb:567:25d8]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E59F7E0D; Fri, 21 Feb 2025 10:19:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740129583; bh=9s6Qi9hDRORFEx1NEf4E9JAWGDlFOXxn1ZWVTj6Xz+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lSdcB1sfR9jSMKqmMQsi5h0Z59glIhtSMp9g4RMGz5OrSaJJLdGui6nxMGJh52sos +ubRGbmH2aDoPvbNrEY9nrjA72u2rnEDoNuVkCbpda82kVa3ndcTqU/6gAjNkGVbNw matK783gfhSYC9ME12mgFdcY0QLacGHfohyaMKEk= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Kieran Bingham , isaac.scott@ideasonboard.com, Paul Elder , Umang Jain , Daniel Scally , Jacopo Mondi Subject: [PATCH v2 1/3] ipa: rkisp1: Initialise AGC from FrameDurationLimits controls Date: Fri, 21 Feb 2025 18:20:43 +0900 Message-Id: <20250221092045.3896021-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250221092045.3896021-1-paul.elder@ideasonboard.com> References: <20250221092045.3896021-1-paul.elder@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" From: Kieran Bingham 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 Signed-off-by: Paul Elder Reviewed-by: Umang Jain Reviewed-by: Daniel Scally Reviewed-by: Jacopo Mondi Reviewed-by: Paul Elder --- Changes in v2: - recover from bitrot - add a todo for moving handling control infos related to exposure/frame-duration from the IPA to the agc algo --- src/ipa/rkisp1/algorithms/agc.cpp | 9 +++------ src/ipa/rkisp1/rkisp1.cpp | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 9a558a1ce29a..03dc56c96996 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -188,12 +188,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.maxExposureTime; + /* 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 2ffdd99b158a..0e761249d27c 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -435,9 +435,9 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo, frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); } - ctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0], - frameDurations[1], - frameDurations[2]); + /* \todo Move this (and other agc-related controls) to agc */ + 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);