From patchwork Tue Oct 26 11:27:50 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: 14353 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 CB4A9BDB1C for ; Tue, 26 Oct 2021 11:27:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4685560237; Tue, 26 Oct 2021 13:27:56 +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="Z3Vyi0aS"; 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 E6F6B60123 for ; Tue, 26 Oct 2021 13:27:54 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:dce3:eb54:18d7:6f3d]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 80C023F0; Tue, 26 Oct 2021 13:27:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1635247674; bh=2zWWA1QKuyRlkxS6tA4JR9KKrtQUqn66ffo+Sou2ARg=; h=From:To:Cc:Subject:Date:From; b=Z3Vyi0aS4wA5h/FnQPAPHiUvXAEljq1I7EZHJw39eQff7eXXY6EJUhjjAnwDcdZ3c yzWhcuj/IGTJ8NRWXgEUP8rbdPekmkEzYFwCmTCLOpLbr9OrkcNg+27poJcWbI2s+S dKFM7e8rU+LCWgSjLsuWPcENSBHRVyxYqwClbXVY= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Oct 2021 13:27:50 +0200 Message-Id: <20211026112750.113641-1-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] ipa: ipu3: agc: Clamp shutter speed 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" In case the maximum exposure received from the sensor is very high, we can have a very high shutter speed with a small analogue gain, and it may result in very slow framerate. We are not really supporting it for the moment, so clamp the shutter speed to an arbitrary value of 60ms. Signed-off-by: Jean-Michel Hautbois Tested-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- v2: - Reword the todo according to Laurent's comment --- src/ipa/ipu3/algorithms/agc.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index 6c151232..6b4ba4bf 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -34,6 +34,9 @@ static constexpr uint32_t kFrameSkipCount = 6; static constexpr double kMinAnalogueGain = 1.0; static constexpr double kMaxAnalogueGain = 8.0; +/* \todo Honour the FrameDurationLimits control instead of hardcoding a limit */ +static constexpr utils::Duration kMaxShutterSpeed = 60ms; + /* Histogram constants */ static constexpr uint32_t knumHistogramBins = 256; static constexpr double kEvGainTarget = 0.5; @@ -54,7 +57,8 @@ int Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo) /* \todo replace the exposure in lines storage with time based ones. */ minExposureLines_ = context.configuration.agc.minShutterSpeed / lineDuration_; - maxExposureLines_ = context.configuration.agc.maxShutterSpeed / lineDuration_; + maxExposureLines_ = std::min(context.configuration.agc.maxShutterSpeed / lineDuration_, + kMaxShutterSpeed / lineDuration_); minAnalogueGain_ = std::max(context.configuration.agc.minAnalogueGain, kMinAnalogueGain); maxAnalogueGain_ = std::min(context.configuration.agc.maxAnalogueGain, kMaxAnalogueGain);