From patchwork Tue Sep 30 15:04:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 24536 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 5661AC328C for ; Tue, 30 Sep 2025 15:04:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 457626B614; Tue, 30 Sep 2025 17:04:44 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="GJgZZivJ"; dkim-atps=neutral Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B8C46B5F9 for ; Tue, 30 Sep 2025 17:04:39 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 67C7D62892; Tue, 30 Sep 2025 15:04:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9F00C4CEF0; Tue, 30 Sep 2025 15:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1759244678; bh=Ytqc3j+RlSAjQpfzFAAH1QPOZnlUEEjm1YxgWtn6q3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJgZZivJi5oP2uJZaO4sw+LwwM+MFmCUHWPfgcbpndLzKlf4puHxaaKkfOnc2vmA7 kVrN+Qb9XaCbOSAlya+4J4eDPMCy9TSB7i7k3UWimVobx5mkfTprW150nleiuH28Ua X1lnpyJy88xrhjs2NlZaOG8bKoBY4MDUxDepntwgsIQ6klN3vuCOf8+2+dozmMVEy2 4NdukgxlN2RNVjCEexGdLzer11987ttXnTn2jVLR+CV4Xxv6DfEOyPqv7ivysgOcbT ZAJl9F4kTnL7TTZy5cbD2WFW7t1SKklQbXAiue20IJDcNTtMQJjn5xjfKNfw17Ewgy YILNQiqLwigKg== From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Hans de Goede , Milan Zamazal , Kieran Bingham Subject: [PATCH v4 3/6] ipa: software_isp: AGC: Raise exposure or gain not both at the same time Date: Tue, 30 Sep 2025 17:04:25 +0200 Message-ID: <20250930150428.11101-4-hansg@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930150428.11101-1-hansg@kernel.org> References: <20250930150428.11101-1-hansg@kernel.org> 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" Raise either exposure or gain; not both at the same time. Before this change when the last exposure raise is done, hitting exposure-max, gain would be increased at the same time. Reviewed-by: Milan Zamazal Tested-by: Milan Zamazal Tested-by: Kieran Bingham Signed-off-by: Hans de Goede --- src/ipa/simple/algorithms/agc.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ipa/simple/algorithms/agc.cpp b/src/ipa/simple/algorithms/agc.cpp index 1fc8d7f42..f7f734514 100644 --- a/src/ipa/simple/algorithms/agc.cpp +++ b/src/ipa/simple/algorithms/agc.cpp @@ -56,12 +56,13 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou double &again = frameContext.sensor.gain; if (exposureMSV < kExposureOptimal - kExposureSatisfactory) { - next = exposure * kExpNumeratorUp / kExpDenominator; - if (next - exposure < 1) - exposure += 1; - else - exposure = next; - if (exposure >= context.configuration.agc.exposureMax) { + if (exposure < context.configuration.agc.exposureMax) { + next = exposure * kExpNumeratorUp / kExpDenominator; + if (next - exposure < 1) + exposure += 1; + else + exposure = next; + } else { next = again * kExpNumeratorUp / kExpDenominator; if (next - again < context.configuration.agc.againMinStep) again += context.configuration.agc.againMinStep;