From patchwork Wed Oct 13 15:41:25 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: 14128 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 E085EBDC71 for ; Wed, 13 Oct 2021 15:41:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A431268F5C; Wed, 13 Oct 2021 17:41:45 +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="BmnegxZv"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4209F68F5F for ; Wed, 13 Oct 2021 17:41:33 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:3857:aa01:4281:bd9f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C299E18FF; Wed, 13 Oct 2021 17:41:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634139692; bh=aq8KohAFBHd3KTwqBHD1wtWzCRFutqLeVPvKI/v7WeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BmnegxZvD7SzApYctQQO54dcJbNwUhb144HfsglEV1ZwEXFubMCN6dlFBOi9I72Nk 1D8k6ePalmzAhrMhPtnbnG4tn1Mw7jO07mBa+tPt/N0SiF1xCByS6ys8WhRVjLd5+Z tsMU3OD4tIQnW717EeV53KIQs02nf02cewb1Aro8= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Wed, 13 Oct 2021 17:41:25 +0200 Message-Id: <20211013154125.133419-14-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211013154125.133419-1-jeanmichel.hautbois@ideasonboard.com> References: <20211013154125.133419-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 13/13] ipa: ipu3: agc: Remove unused variables 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 currently control the exposure value by the shutter speed and the analogue gain. We can't use the digital gain to have more than the maximum exposure value calculated because we are not controlling it. Remove unused code associated with this digital gain. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- src/ipa/ipu3/algorithms/agc.cpp | 19 +++---------------- src/ipa/ipu3/algorithms/agc.h | 2 -- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index 81eaf436..0177bb92 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -46,8 +46,7 @@ static constexpr double kEvGainTarget = 0.5; Agc::Agc() : frameCount_(0), lastFrame_(0), iqMean_(0.0), lineDuration_(0s), minExposureLines_(0), maxExposureLines_(0), filteredExposure_(0s), - filteredExposureNoDg_(0s), currentExposure_(0s), - currentExposureNoDg_(0s), prevExposureValue(0s) + currentExposure_(0s), prevExposureValue(0s) { } @@ -96,7 +95,6 @@ void Agc::filterExposure() if (filteredExposure_ == 0s) { /* DG stands for digital gain.*/ filteredExposure_ = currentExposure_; - filteredExposureNoDg_ = currentExposureNoDg_; } else { /* * If we are close to the desired result, go faster to avoid making @@ -109,18 +107,8 @@ void Agc::filterExposure() filteredExposure_ = speed * currentExposure_ + filteredExposure_ * (1.0 - speed); - filteredExposureNoDg_ = speed * currentExposureNoDg_ + - filteredExposureNoDg_ * (1.0 - speed); } - /* - * We can't let the no_dg exposure deviate too far below the - * total exposure, as there might not be enough digital gain available - * in the ISP to hide it (which will cause nasty oscillation). - */ - double fastReduceThreshold = 0.4; - if (filteredExposureNoDg_ < - filteredExposure_ * fastReduceThreshold) - filteredExposureNoDg_ = filteredExposure_ * fastReduceThreshold; + LOG(IPU3Agc, Debug) << "After filtering, total_exposure " << filteredExposure_; } @@ -136,8 +124,7 @@ void Agc::lockExposureGain(uint32_t &exposure, double &analogueGain) /* extracted from Rpi::Agc::computeTargetExposure */ Duration currentShutter = exposure * lineDuration_; - currentExposureNoDg_ = currentShutter * analogueGain; - LOG(IPU3Agc, Debug) << "Actual total exposure " << currentExposureNoDg_ + LOG(IPU3Agc, Debug) << "Actual total exposure " << currentShutter * analogueGain << " Shutter speed " << currentShutter << " Gain " << analogueGain << " Needed ev gain " << evGain; diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h index 32817c4f..5b34c013 100644 --- a/src/ipa/ipu3/algorithms/agc.h +++ b/src/ipa/ipu3/algorithms/agc.h @@ -48,9 +48,7 @@ private: uint32_t maxExposureLines_; Duration filteredExposure_; - Duration filteredExposureNoDg_; Duration currentExposure_; - Duration currentExposureNoDg_; Duration prevExposureValue; uint32_t stride_;