[{"id":20717,"web_url":"https://patchwork.libcamera.org/comment/20717/","msgid":"<163638232861.275423.7372896903730361711@Monstersaurus>","date":"2021-11-08T14:38:48","subject":"Re: [libcamera-devel] [PATCH 06/22] ipa: ipu3: agc: Refactor ev\n\tgain calculation and testing","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jean-Michel Hautbois (2021-11-08 13:13:34)\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> ---\n>  src/ipa/ipu3/algorithms/agc.cpp | 8 +++-----\n>  1 file changed, 3 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index 133f5931..119a7938 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -189,17 +189,15 @@ void Agc::filterExposure()\n>   */\n>  void Agc::computeExposure(uint32_t &exposure, double &analogueGain)\n>  {\n> +       /* Estimate the gain needed to have the proportion wanted */\n\nProportion? As we're in computeExposure, do you mean exposure? or\nsomething else?\n\nOtherwise - proportion of what? It doesn't quite make sense (to me) on\nthe small sentence on its own.\n\n> +       double evGain = kEvGainTarget * knumHistogramBins / iqMean_;\n>  \n> -       /* Are we correctly exposed ? */\n\nI guess this is redundant?\n\n> -       if (std::abs(iqMean_ - kEvGainTarget * knumHistogramBins) <= 1) {\n> +       if (std::abs(evGain - 1.0) < 0.01) {\n\nThis reads better, but while it can be inferred that the 0.01 is 1%, I'd be\ntempted to put something explicit:\n\t/* Consider within 1% of the target as correctly exposed */\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>                 LOG(IPU3Agc, Debug) << \"We are well exposed (iqMean = \"\n>                                     << iqMean_ << \")\";\n>                 return;\n>         }\n>  \n> -       /* Estimate the gain needed to have the proportion wanted */\n\nI see it was already in like that though. Still if you can expand upon\nit, it might help.\n\n\n> -       double evGain = kEvGainTarget * knumHistogramBins / iqMean_;\n> -\n>         /* extracted from Rpi::Agc::computeTargetExposure */\n>         /* Calculate the shutter time in seconds */\n>         utils::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 8F4BCBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Nov 2021 14:38:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D9A646035D;\n\tMon,  8 Nov 2021 15:38:52 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 239EC6032C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Nov 2021 15:38:52 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B2C0C8BB;\n\tMon,  8 Nov 2021 15:38:51 +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=\"vgQCYd3l\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636382331;\n\tbh=uZ/EiyBPVVsSiPGy+5/d1qybz8uzP+E9W3Ckri2hKZQ=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=vgQCYd3lBHmF8i3IJ6RAqRkSN+Penc1Gz90wSwzvUyjQ435Nneyi+0giUmNRbVrBo\n\tj0EdkIkyhIsZ52CaVgvCc5pBHoCMHehJvu/jNt7llOIxTgBpoJjDo23xEJnX9RMsqZ\n\tyqhY3KiEP0P679qk/BG3N+BCSuc/xK8qhkEaLKgI=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211108131350.130665-7-jeanmichel.hautbois@ideasonboard.com>","References":"<20211108131350.130665-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211108131350.130665-7-jeanmichel.hautbois@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 08 Nov 2021 14:38:48 +0000","Message-ID":"<163638232861.275423.7372896903730361711@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH 06/22] 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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]