From patchwork Sat Sep 27 18:00:01 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: 24481 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 0976AC32A9 for ; Sat, 27 Sep 2025 18:00:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 914116B5AA; Sat, 27 Sep 2025 20:00:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="hZqT/+IA"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 918046B5A2 for ; Sat, 27 Sep 2025 20:00:13 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 3E03544A46; Sat, 27 Sep 2025 18:00:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 053CCC4CEF8; Sat, 27 Sep 2025 18:00:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758996012; bh=doDwnVpI3Y2qcYJ1FHiqEpl0+kdSx6c6kK2Df8Avxew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZqT/+IAAb3h75Kk5r2L21NihEnhsLK4iLvC0/YlkclKxo3NwIfNANCpddnEdWxAc +Pd5QF5UFI6OY7VLCOL4Sr/hpNKlsZvjuxZG0fsDo0Hgx1OlV4FQLNCtxpwnix8+Qb vCV8zOzzgcDvgZCTQUbEB4VQP0qYAXuYXsHfw6PWIwC8BGj/9QVDMr5Ou56mIs/wvt Gw6t/6IiLAL2A8UyuUGCPHeRZY4/QOP46ro91US7ueVqbbcwDJFzA7kCSWk+iMa9oe Y4qAgO6exNFbBNiodv2n/2bjpSF85qnmFxX3zHBO+uLFNyY3b+1lIkwpVumM6TX7LO U9W8OHK9VaAoQ== From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Hans de Goede , Milan Zamazal , Kieran Bingham Subject: [PATCH v3 3/6] ipa: software_isp: AGC: Raise exposure or gain not both at the same time Date: Sat, 27 Sep 2025 20:00:01 +0200 Message-ID: <20250927180004.84620-4-hansg@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250927180004.84620-1-hansg@kernel.org> References: <20250927180004.84620-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 1fc8d7f4..f7f73451 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;