From patchwork Thu Sep 25 22:17:05 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: 24465 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 6B4D8BDB1C for ; Thu, 25 Sep 2025 22:17:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EE3A66B601; Fri, 26 Sep 2025 00:17:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="lhjpssgI"; 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 2522E69367 for ; Fri, 26 Sep 2025 00:17:17 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id D96A24057B; Thu, 25 Sep 2025 22:17:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA2ECC4CEF7; Thu, 25 Sep 2025 22:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758838635; bh=doDwnVpI3Y2qcYJ1FHiqEpl0+kdSx6c6kK2Df8Avxew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhjpssgI4D/q9AHqyV7zwPlVUKL4X3nodn1athKhuy+G0z3hnOv/SZw421jeEqpVk rY659GEaXu8Xe/SAHM5hKmyv94sMs3aG9MGRiq8SuWzAGnTb/ZQ0eZcliYDbgCs2II vbz0LSLzP53BEOWmNXj/o8FYF66c7pZznuvJAb0zPCW5XM+PcKdZdxCuCP8cW/jTAA nm5v4pfy/0/94OQ1fErYInJrqVg2NhPpeHxuY1MuzeinpjODhkI1FmoybEAFw2grP4 gfWx+JNDDooXooA6GVkUauRDB/uoYoywdU4i48GFMkZaeuhxDcMhErEYHNj3cZz4f1 bSNxI8sE+EUAw== From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Hans de Goede , Milan Zamazal , Kieran Bingham Subject: [PATCH v2 3/6] ipa: software_isp: AGC: Raise exposure or gain not both at the same time Date: Fri, 26 Sep 2025 00:17:05 +0200 Message-ID: <20250925221708.7471-4-hansg@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250925221708.7471-1-hansg@kernel.org> References: <20250925221708.7471-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;