[{"id":20934,"web_url":"https://patchwork.libcamera.org/comment/20934/","msgid":"<20211112230645.GD8453@jade.amanokami.net>","date":"2021-11-12T23:06:45","subject":"Re: [libcamera-devel] [PATCH v4 06/14] ipa: ipu3: agc: Refactor ev\n\tgain calculation and testing","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Jean-Michel,\n\nOn Thu, Nov 11, 2021 at 03:09:20PM +0100, Jean-Michel Hautbois wrote:\n> When we compute the new gain, we use the iqMean_ and estimate an\n> exposure value gain to apply. Return early when the gain is less than\n> 1%.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/ipu3/algorithms/agc.cpp | 14 ++++++--------\n>  1 file changed, 6 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index 74bce7bb..61ca8b3f 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -188,14 +188,6 @@ void Agc::filterExposure()\n>   */\n>  void Agc::computeExposure(IPAFrameContext &frameContext)\n>  {\n> -\n> -\t/* Are we correctly exposed ? */\n> -\tif (std::abs(iqMean_ - kEvGainTarget * knumHistogramBins) <= 1) {\n> -\t\tLOG(IPU3Agc, Debug) << \"We are well exposed (iqMean = \"\n> -\t\t\t\t    << iqMean_ << \")\";\n> -\t\treturn;\n> -\t}\n> -\n>  \t/* Get the effective exposure and gain applied on the sensor. */\n>  \tuint32_t exposure = frameContext.sensor.exposure;\n>  \tdouble analogueGain = frameContext.sensor.gain;\n> @@ -203,6 +195,12 @@ void Agc::computeExposure(IPAFrameContext &frameContext)\n>  \t/* Estimate the gain needed to have the proportion wanted */\n>  \tdouble evGain = kEvGainTarget * knumHistogramBins / iqMean_;\n>  \n> +\tif (std::abs(evGain - 1.0) < 0.01) {\n> +\t\tLOG(IPU3Agc, Debug) << \"We are well exposed (iqMean = \"\n> +\t\t\t\t    << iqMean_ << \")\";\n> +\t\treturn;\n> +\t}\n> +\n>  \t/* extracted from Rpi::Agc::computeTargetExposure */\n>  \t/* Calculate the shutter time in seconds */\n>  \tutils::Duration currentShutter = exposure * lineDuration_;\n> -- \n> 2.32.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2CEAEBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Nov 2021 23:06:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DB4506036B;\n\tSat, 13 Nov 2021 00:06:57 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 72E1B600B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 13 Nov 2021 00:06:56 +0100 (CET)","from jade.amanokami.net (KD027085206038.au-net.ne.jp\n\t[27.85.206.38])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A1BF19CA;\n\tSat, 13 Nov 2021 00:06:54 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"jqAPMDJl\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636758416;\n\tbh=nxCshD7I4XlmUqFndkGupwam3YSR1VEE7N5SWGdervM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jqAPMDJleh4+SrZJDqlYq3kE2Zf1YnWqukhlNmYgWkBInMYb5KembcNGpUY5RsYwu\n\txXcxbo/NT4CRdcVHbv6VsxHAamwS+Fycu8O8HUnAHwx72rZ9HVPZR+opf24kiT2rW3\n\t9HsqvANdVWPTc/FVhr68blbISENQw4NVMH+D7J14=","Date":"Sat, 13 Nov 2021 08:06:45 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<20211112230645.GD8453@jade.amanokami.net>","References":"<20211111140928.136111-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211111140928.136111-7-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20211111140928.136111-7-jeanmichel.hautbois@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v4 06/14] ipa: ipu3: agc: Refactor ev\n\tgain calculation and testing","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]