From patchwork Fri Oct 22 07:32:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 14244 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 74416BF415 for ; Fri, 22 Oct 2021 07:33:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0D5AA68F5C; Fri, 22 Oct 2021 09:33:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TofM8+Gp"; 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 BF4F668F5F for ; Fri, 22 Oct 2021 09:32:55 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:22cc:3af6:5ccb:8367]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6F24F51D; Fri, 22 Oct 2021 09:32:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634887975; bh=OhFZNy72TZun+WkypWA4XRCIcYlrh0lqNLNyg/J5reI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TofM8+GpL44t/Tx6HEoBD9Tuvjbf9Ada561a91Zw80vxdQ9vlrrv+KXYK3lGe/mAx DDFxOGJu+0GApFEaZtQvdTxaJ2admSz8KwHUHKiiTHQQycqHz8vX3ULRRf/li3CN9G vZBsmJNl/34m4oNhdJPi3EkEaEvzTcyvKeeoBHbs= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Fri, 22 Oct 2021 09:32:43 +0200 Message-Id: <20211022073249.35084-9-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211022073249.35084-1-jeanmichel.hautbois@ideasonboard.com> References: <20211022073249.35084-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 08/14] ipa: ipu3: agc: Use filtered exposure values 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" We are filtering the exposure value to limit the gain to apply, but we are not using the result. Fix it. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/ipa/ipu3/algorithms/agc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index 984aed53..f5bb3328 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -158,17 +158,17 @@ void Agc::lockExposureGain(uint32_t &exposure, double &gain) utils::Duration newExposure = 0.0s; if (currentShutter < maxShutterSpeed) { - exposure = std::clamp(exposure * currentExposure_ / currentExposureNoDg_, + exposure = std::clamp(exposure * filteredExposure_ / currentExposureNoDg_, minExposureLines_, maxExposureLines_); - newExposure = currentExposure_ / exposure; - gain = std::clamp(gain * currentExposure_ / newExposure, + newExposure = filteredExposure_ / exposure; + gain = std::clamp(gain * filteredExposure_ / newExposure, kMinGain, kMaxGain); } else { - gain = std::clamp(gain * currentExposure_ / currentExposureNoDg_, + gain = std::clamp(gain * filteredExposure_ / currentExposureNoDg_, kMinGain, kMaxGain); - newExposure = currentExposure_ / gain; - exposure = std::clamp(exposure * currentExposure_ / newExposure, + newExposure = filteredExposure_ / gain; + exposure = std::clamp(exposure * filteredExposure_ / newExposure, minExposureLines_, maxExposureLines_); }