From patchwork Tue Sep 23 19:06:55 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: 24442 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 DD37DC3331 for ; Tue, 23 Sep 2025 19:07:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1B27C6B605; Tue, 23 Sep 2025 21:07:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="QyzC8YBk"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1AB836B605 for ; Tue, 23 Sep 2025 21:07:05 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id BC7F744AF1 for ; Tue, 23 Sep 2025 19:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFCB4C4CEF5; Tue, 23 Sep 2025 19:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758654424; bh=n3plQx2gSYRqny6mDLwVPPbY+ll2yb/yiokZsOGyqjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QyzC8YBkV3xxgbBYvJzGByh1pUGyPRxzHhkCTaMBRo0HaUt7wNMSgmds6H7nGqB7F ZUMf6O9AKuCVbgWAWH2TuISCtBx5kAzLboIo5ZH6lJm8nrGj5po35Upl5a6uRuXIiG jbdY3xJ8bgtgYdOjIHFSsxPhePWV/N5xyTaTVU5sJXcmKjJL6pEcaUiw9HqPPEcTMZ 1go2KjioSvIX00RXErE/RSUTlXXjmkJJWFOJX2q9ssXvdbMVlar6SoZcFemVUt1aGE nVgubdxpZ7CZwya3DNs10GCS6SSRWXpxxbm9lIyQkrBsb2NBo1wYOuX9F19qB0Pe39 q4Vm0bxhutL3w== From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Hans de Goede Subject: [PATCH 3/5] ipa: software_isp: AGC: Raise exposure or gain not both at the same time Date: Tue, 23 Sep 2025 21:06:55 +0200 Message-ID: <20250923190657.21453-4-hansg@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250923190657.21453-1-hansg@kernel.org> References: <20250923190657.21453-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. Signed-off-by: Hans de Goede Reviewed-by: Milan Zamazal --- 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 94961f9fe..230616e62 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;