From patchwork Mon Sep 14 14:02:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 28266 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 DB160C335C for ; Mon, 14 Sep 2026 14:04:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 49AFE686E9; Mon, 14 Sep 2026 16:04:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DEjuW/2T"; 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 EE9E7686E4 for ; Mon, 14 Sep 2026 16:04:26 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:a279:75fa:1f6c:7f40]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0055D512; Mon, 14 Sep 2026 16:02:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1789394567; bh=T4CSUUoDZUeDsp32OtDdQSjsm7rtiO8pQp+ARUN9oSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEjuW/2TaDmJG3z2qhCuoobzpEwPcZNLRwUXGlUYdiW33gKITdOMstLVqgYh+G7QA yiBzLGcSEEvlfAytO/D9D0BY7g3+Eshx16PaV2imLrTf4PFhoJanbf/1YAyU9HxKWy cJutjJr1g97e9lVlTVvRWdaAb4z/9Dln5eA2O19k= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v3 22/41] libipa: agc: Populate frameContext in queueRequest() in auto mode Date: Mon, 14 Sep 2026 16:02:35 +0200 Message-ID: <20260914140309.3354666-23-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260914140309.3354666-1-stefan.klug@ideasonboard.com> References: <20260914140309.3354666-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" In case of a param buffer underrun computeParams() is not called on a frame. At the moment this causes a "ERROR AgcMeanLuminance agc_mean_luminance.cpp:689 Effective exposure value is 0. This is a bug in AGC and must be fixed for proper operation." log message, when processStats() is called on such a frame because frameContext.gain is 0. Fix that by initializing all the values in queueRequest(). Signed-off-by: Stefan Klug Reviewed-by: Paul Elder --- Changes in v3: - Manually rebased as agc was moved to libipa - Changed commit message to better reflect the issue that this fixes Changes in v2: - Collected tag --- src/ipa/libipa/agc.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp index 9016e5f68ab7..a2438cb49d1b 100644 --- a/src/ipa/libipa/agc.cpp +++ b/src/ipa/libipa/agc.cpp @@ -608,12 +608,18 @@ void AgcAlgorithm::queueRequest(const agc::Session &session, agc::ActiveState &s frameContext.autoExposureEnabled = state.autoExposureEnabled; frameContext.autoGainEnabled = state.autoGainEnabled; - if (!frameContext.autoExposureEnabled) + if (frameContext.autoExposureEnabled) + frameContext.exposure = state.automatic.exposure; + else frameContext.exposure = state.manual.exposure; - if (!frameContext.autoGainEnabled) + if (frameContext.autoGainEnabled) + frameContext.gain = state.automatic.gain; + else frameContext.gain = state.manual.gain; - if (!frameContext.autoExposureEnabled && !frameContext.autoGainEnabled) + if (frameContext.autoExposureEnabled || frameContext.autoGainEnabled) + frameContext.quantizationGain = state.automatic.quantizationGain; + else frameContext.quantizationGain = 1.0; const auto &exposureMode = controls.get(controls::AeExposureMode);